// Lean compiler output
// Module: Lake.Util.Cycle
// Imports: Init.Control.Except Init.Data.List.Basic Init.Data.ToString
#include <lean/lean.h>
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wunused-parameter"
#pragma clang diagnostic ignored "-Wunused-label"
#elif defined(__GNUC__) && !defined(__CLANG__)
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-label"
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#endif
#ifdef __cplusplus
extern "C" {
#endif
LEAN_EXPORT lean_object* l_List_partition_loop___at_Lake_guardCycle___spec__1(lean_object*);
LEAN_EXPORT lean_object* l_Lake_instMonadCycleOfMonadCycleOf___rarg(lean_object*);
LEAN_EXPORT lean_object* l_Lake_instMonadCallStackOfCallStackTOfMonad___rarg___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lake_instMonadCycleOfOfMonadLiftOfMonadFunctor(lean_object*, lean_object*, lean_object*);
lean_object* l_ExceptT_instMonad___rarg(lean_object*);
lean_object* l_ReaderT_read___rarg(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lake_formatCycle(lean_object*);
LEAN_EXPORT lean_object* l_Lake_formatCycle___rarg(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lake_instMonadCallStackOfCallStackTOfMonad___rarg___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lake_guardCycle___rarg___lambda__1___closed__1;
LEAN_EXPORT lean_object* l_Lake_instMonadCallStackOfOfMonadLiftOfMonadFunctor(lean_object*, lean_object*, lean_object*);
lean_object* l_List_appendTR___rarg(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lake_instMonadCallStackOfOfMonadLiftOfMonadFunctor___rarg___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lake_instMonadCallStackOfMonadCallStackOf(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lake_instMonadCycleOfMonadCycleOf___rarg___lambda__1(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lake_instMonadCallStackOfOfMonadLiftOfMonadFunctor___rarg___lambda__2(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lake_instMonadCallStackOfCallStackTOfMonad___rarg___closed__1;
LEAN_EXPORT lean_object* l_Lake_instMonadCallStackOfMonadCallStackOf___rarg___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lake_instMonadCallStackOfOfMonadLiftOfMonadFunctor___rarg(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lake_inhabitedOfMonadCycle___rarg(lean_object*);
LEAN_EXPORT lean_object* l_Lake_instMonadCycleOfCycleTOfMonad___rarg___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lake_instMonadCycleOfCycleTOfMonad___rarg___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_List_partition_loop___at_Lake_guardCycle___spec__1___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lake_inhabitedOfMonadCycle(lean_object*, lean_object*, lean_object*);
uint8_t l_List_elem___rarg(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_List_mapTR_loop___at_Lake_formatCycle___spec__1___rarg(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lake_instMonadCycleOfCycleTOfMonad(lean_object*, lean_object*);
static lean_object* l_List_mapTR_loop___at_Lake_formatCycle___spec__1___rarg___closed__1;
LEAN_EXPORT lean_object* l_Lake_instMonadCallStackOfCallStackTOfMonad(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lake_instMonadCycleOfOfMonadLiftOfMonadFunctor___rarg___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lake_instMonadCycleOfMonadCycleOf(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_List_mapTR_loop___at_Lake_formatCycle___spec__1(lean_object*);
LEAN_EXPORT lean_object* l_Lake_guardCycle___rarg(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lake_guardCycle___rarg___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lake_instMonadCallStackOfMonadCallStackOf___rarg(lean_object*);
static lean_object* l_Lake_formatCycle___rarg___closed__1;
LEAN_EXPORT lean_object* l_Lake_instMonadCallStackOfCallStackTOfMonad___rarg(lean_object*);
LEAN_EXPORT lean_object* l_Lake_instMonadCycleOfCycleTOfMonad___rarg(lean_object*);
lean_object* l_List_reverse___rarg(lean_object*);
LEAN_EXPORT lean_object* l_Lake_guardCycle(lean_object*, lean_object*, lean_object*);
lean_object* l_String_intercalate(lean_object*, lean_object*);
lean_object* lean_string_append(lean_object*, lean_object*);
static lean_object* l_List_mapTR_loop___at_Lake_formatCycle___spec__1___rarg___closed__2;
LEAN_EXPORT lean_object* l_Lake_instMonadCycleOfOfMonadLiftOfMonadFunctor___rarg(lean_object*, lean_object*, lean_object*);
static lean_object* _init_l_List_mapTR_loop___at_Lake_formatCycle___spec__1___rarg___closed__1() {
_start:
{
lean_object* x_1; 
x_1 = lean_mk_string_unchecked("  ", 2, 2);
return x_1;
}
}
static lean_object* _init_l_List_mapTR_loop___at_Lake_formatCycle___spec__1___rarg___closed__2() {
_start:
{
lean_object* x_1; 
x_1 = lean_mk_string_unchecked("", 0, 0);
return x_1;
}
}
LEAN_EXPORT lean_object* l_List_mapTR_loop___at_Lake_formatCycle___spec__1___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
if (lean_obj_tag(x_2) == 0)
{
lean_object* x_4; 
lean_dec(x_1);
x_4 = l_List_reverse___rarg(x_3);
return x_4;
}
else
{
uint8_t x_5; 
x_5 = !lean_is_exclusive(x_2);
if (x_5 == 0)
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; 
x_6 = lean_ctor_get(x_2, 0);
x_7 = lean_ctor_get(x_2, 1);
lean_inc(x_1);
x_8 = lean_apply_1(x_1, x_6);
x_9 = l_List_mapTR_loop___at_Lake_formatCycle___spec__1___rarg___closed__1;
x_10 = lean_string_append(x_9, x_8);
lean_dec(x_8);
x_11 = l_List_mapTR_loop___at_Lake_formatCycle___spec__1___rarg___closed__2;
x_12 = lean_string_append(x_10, x_11);
lean_ctor_set(x_2, 1, x_3);
lean_ctor_set(x_2, 0, x_12);
{
lean_object* _tmp_1 = x_7;
lean_object* _tmp_2 = x_2;
x_2 = _tmp_1;
x_3 = _tmp_2;
}
goto _start;
}
else
{
lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; 
x_14 = lean_ctor_get(x_2, 0);
x_15 = lean_ctor_get(x_2, 1);
lean_inc(x_15);
lean_inc(x_14);
lean_dec(x_2);
lean_inc(x_1);
x_16 = lean_apply_1(x_1, x_14);
x_17 = l_List_mapTR_loop___at_Lake_formatCycle___spec__1___rarg___closed__1;
x_18 = lean_string_append(x_17, x_16);
lean_dec(x_16);
x_19 = l_List_mapTR_loop___at_Lake_formatCycle___spec__1___rarg___closed__2;
x_20 = lean_string_append(x_18, x_19);
x_21 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_21, 0, x_20);
lean_ctor_set(x_21, 1, x_3);
x_2 = x_15;
x_3 = x_21;
goto _start;
}
}
}
}
LEAN_EXPORT lean_object* l_List_mapTR_loop___at_Lake_formatCycle___spec__1(lean_object* x_1) {
_start:
{
lean_object* x_2; 
x_2 = lean_alloc_closure((void*)(l_List_mapTR_loop___at_Lake_formatCycle___spec__1___rarg), 3, 0);
return x_2;
}
}
static lean_object* _init_l_Lake_formatCycle___rarg___closed__1() {
_start:
{
lean_object* x_1; 
x_1 = lean_mk_string_unchecked("\n", 1, 1);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lake_formatCycle___rarg(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; 
x_3 = lean_box(0);
x_4 = l_List_mapTR_loop___at_Lake_formatCycle___spec__1___rarg(x_1, x_2, x_3);
x_5 = l_Lake_formatCycle___rarg___closed__1;
x_6 = l_String_intercalate(x_5, x_4);
return x_6;
}
}
LEAN_EXPORT lean_object* l_Lake_formatCycle(lean_object* x_1) {
_start:
{
lean_object* x_2; 
x_2 = lean_alloc_closure((void*)(l_Lake_formatCycle___rarg), 2, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lake_instMonadCallStackOfMonadCallStackOf___rarg___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; lean_object* x_6; 
x_5 = lean_ctor_get(x_1, 1);
lean_inc(x_5);
lean_dec(x_1);
x_6 = lean_apply_3(x_5, lean_box(0), x_3, x_4);
return x_6;
}
}
LEAN_EXPORT lean_object* l_Lake_instMonadCallStackOfMonadCallStackOf___rarg(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3; uint8_t x_4; 
x_2 = lean_ctor_get(x_1, 0);
lean_inc(x_2);
lean_inc(x_1);
x_3 = lean_alloc_closure((void*)(l_Lake_instMonadCallStackOfMonadCallStackOf___rarg___lambda__1), 4, 1);
lean_closure_set(x_3, 0, x_1);
x_4 = !lean_is_exclusive(x_1);
if (x_4 == 0)
{
lean_object* x_5; lean_object* x_6; 
x_5 = lean_ctor_get(x_1, 1);
lean_dec(x_5);
x_6 = lean_ctor_get(x_1, 0);
lean_dec(x_6);
lean_ctor_set(x_1, 1, x_3);
return x_1;
}
else
{
lean_object* x_7; 
lean_dec(x_1);
x_7 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_7, 0, x_2);
lean_ctor_set(x_7, 1, x_3);
return x_7;
}
}
}
LEAN_EXPORT lean_object* l_Lake_instMonadCallStackOfMonadCallStackOf(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; 
x_3 = lean_alloc_closure((void*)(l_Lake_instMonadCallStackOfMonadCallStackOf___rarg), 1, 0);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lake_instMonadCallStackOfOfMonadLiftOfMonadFunctor___rarg___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; lean_object* x_6; 
x_5 = lean_ctor_get(x_1, 1);
lean_inc(x_5);
lean_dec(x_1);
x_6 = lean_apply_3(x_5, lean_box(0), x_2, x_4);
return x_6;
}
}
LEAN_EXPORT lean_object* l_Lake_instMonadCallStackOfOfMonadLiftOfMonadFunctor___rarg___lambda__2(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; lean_object* x_7; 
x_6 = lean_alloc_closure((void*)(l_Lake_instMonadCallStackOfOfMonadLiftOfMonadFunctor___rarg___lambda__1), 4, 2);
lean_closure_set(x_6, 0, x_1);
lean_closure_set(x_6, 1, x_4);
x_7 = lean_apply_3(x_2, lean_box(0), x_6, x_5);
return x_7;
}
}
LEAN_EXPORT lean_object* l_Lake_instMonadCallStackOfOfMonadLiftOfMonadFunctor___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; 
x_4 = lean_ctor_get(x_3, 0);
lean_inc(x_4);
x_5 = lean_apply_2(x_1, lean_box(0), x_4);
x_6 = lean_alloc_closure((void*)(l_Lake_instMonadCallStackOfOfMonadLiftOfMonadFunctor___rarg___lambda__2), 5, 2);
lean_closure_set(x_6, 0, x_3);
lean_closure_set(x_6, 1, x_2);
x_7 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_7, 0, x_5);
lean_ctor_set(x_7, 1, x_6);
return x_7;
}
}
LEAN_EXPORT lean_object* l_Lake_instMonadCallStackOfOfMonadLiftOfMonadFunctor(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; 
x_4 = lean_alloc_closure((void*)(l_Lake_instMonadCallStackOfOfMonadLiftOfMonadFunctor___rarg), 3, 0);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lake_instMonadCycleOfMonadCycleOf___rarg___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5; 
x_4 = lean_ctor_get(x_1, 1);
lean_inc(x_4);
lean_dec(x_1);
x_5 = lean_apply_2(x_4, lean_box(0), x_3);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lake_instMonadCycleOfMonadCycleOf___rarg(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5; 
x_2 = lean_ctor_get(x_1, 0);
lean_inc(x_2);
x_3 = l_Lake_instMonadCallStackOfMonadCallStackOf___rarg(x_2);
x_4 = lean_alloc_closure((void*)(l_Lake_instMonadCycleOfMonadCycleOf___rarg___lambda__1), 3, 1);
lean_closure_set(x_4, 0, x_1);
x_5 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_5, 0, x_3);
lean_ctor_set(x_5, 1, x_4);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lake_instMonadCycleOfMonadCycleOf(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; 
x_3 = lean_alloc_closure((void*)(l_Lake_instMonadCycleOfMonadCycleOf___rarg), 1, 0);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lake_instMonadCycleOfOfMonadLiftOfMonadFunctor___rarg___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; 
x_5 = lean_ctor_get(x_1, 1);
lean_inc(x_5);
lean_dec(x_1);
x_6 = lean_apply_2(x_5, lean_box(0), x_4);
x_7 = lean_apply_2(x_2, lean_box(0), x_6);
return x_7;
}
}
LEAN_EXPORT lean_object* l_Lake_instMonadCycleOfOfMonadLiftOfMonadFunctor___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; 
x_4 = lean_ctor_get(x_3, 0);
lean_inc(x_4);
lean_inc(x_1);
x_5 = l_Lake_instMonadCallStackOfOfMonadLiftOfMonadFunctor___rarg(x_1, x_2, x_4);
x_6 = lean_alloc_closure((void*)(l_Lake_instMonadCycleOfOfMonadLiftOfMonadFunctor___rarg___lambda__1), 4, 2);
lean_closure_set(x_6, 0, x_3);
lean_closure_set(x_6, 1, x_1);
x_7 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_7, 0, x_5);
lean_ctor_set(x_7, 1, x_6);
return x_7;
}
}
LEAN_EXPORT lean_object* l_Lake_instMonadCycleOfOfMonadLiftOfMonadFunctor(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; 
x_4 = lean_alloc_closure((void*)(l_Lake_instMonadCycleOfOfMonadLiftOfMonadFunctor___rarg), 3, 0);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lake_inhabitedOfMonadCycle___rarg(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3; lean_object* x_4; 
x_2 = lean_ctor_get(x_1, 1);
lean_inc(x_2);
lean_dec(x_1);
x_3 = lean_box(0);
x_4 = lean_apply_2(x_2, lean_box(0), x_3);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lake_inhabitedOfMonadCycle(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; 
x_4 = lean_alloc_closure((void*)(l_Lake_inhabitedOfMonadCycle___rarg), 1, 0);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lake_instMonadCallStackOfCallStackTOfMonad___rarg___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; 
x_5 = lean_apply_1(x_3, x_2);
return x_5;
}
}
static lean_object* _init_l_Lake_instMonadCallStackOfCallStackTOfMonad___rarg___closed__1() {
_start:
{
lean_object* x_1; 
x_1 = lean_alloc_closure((void*)(l_Lake_instMonadCallStackOfCallStackTOfMonad___rarg___lambda__1___boxed), 4, 0);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lake_instMonadCallStackOfCallStackTOfMonad___rarg(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3; lean_object* x_4; 
x_2 = lean_alloc_closure((void*)(l_ReaderT_read___rarg), 2, 1);
lean_closure_set(x_2, 0, x_1);
x_3 = l_Lake_instMonadCallStackOfCallStackTOfMonad___rarg___closed__1;
x_4 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_4, 0, x_2);
lean_ctor_set(x_4, 1, x_3);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lake_instMonadCallStackOfCallStackTOfMonad(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; 
x_3 = lean_alloc_closure((void*)(l_Lake_instMonadCallStackOfCallStackTOfMonad___rarg), 1, 0);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lake_instMonadCallStackOfCallStackTOfMonad___rarg___lambda__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; 
x_5 = l_Lake_instMonadCallStackOfCallStackTOfMonad___rarg___lambda__1(x_1, x_2, x_3, x_4);
lean_dec(x_4);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lake_instMonadCycleOfCycleTOfMonad___rarg___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; 
x_5 = lean_ctor_get(x_1, 0);
lean_inc(x_5);
lean_dec(x_1);
x_6 = lean_ctor_get(x_5, 1);
lean_inc(x_6);
lean_dec(x_5);
x_7 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_7, 0, x_3);
x_8 = lean_apply_2(x_6, lean_box(0), x_7);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Lake_instMonadCycleOfCycleTOfMonad___rarg(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5; 
lean_inc(x_1);
x_2 = l_ExceptT_instMonad___rarg(x_1);
x_3 = l_Lake_instMonadCallStackOfCallStackTOfMonad___rarg(x_2);
x_4 = lean_alloc_closure((void*)(l_Lake_instMonadCycleOfCycleTOfMonad___rarg___lambda__1___boxed), 4, 1);
lean_closure_set(x_4, 0, x_1);
x_5 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_5, 0, x_3);
lean_ctor_set(x_5, 1, x_4);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lake_instMonadCycleOfCycleTOfMonad(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; 
x_3 = lean_alloc_closure((void*)(l_Lake_instMonadCycleOfCycleTOfMonad___rarg), 1, 0);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lake_instMonadCycleOfCycleTOfMonad___rarg___lambda__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; 
x_5 = l_Lake_instMonadCycleOfCycleTOfMonad___rarg___lambda__1(x_1, x_2, x_3, x_4);
lean_dec(x_4);
return x_5;
}
}
LEAN_EXPORT lean_object* l_List_partition_loop___at_Lake_guardCycle___spec__1___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
if (lean_obj_tag(x_3) == 0)
{
uint8_t x_5; 
lean_dec(x_2);
lean_dec(x_1);
x_5 = !lean_is_exclusive(x_4);
if (x_5 == 0)
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; 
x_6 = lean_ctor_get(x_4, 0);
x_7 = lean_ctor_get(x_4, 1);
x_8 = l_List_reverse___rarg(x_6);
x_9 = l_List_reverse___rarg(x_7);
lean_ctor_set(x_4, 1, x_9);
lean_ctor_set(x_4, 0, x_8);
return x_4;
}
else
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; 
x_10 = lean_ctor_get(x_4, 0);
x_11 = lean_ctor_get(x_4, 1);
lean_inc(x_11);
lean_inc(x_10);
lean_dec(x_4);
x_12 = l_List_reverse___rarg(x_10);
x_13 = l_List_reverse___rarg(x_11);
x_14 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_14, 0, x_12);
lean_ctor_set(x_14, 1, x_13);
return x_14;
}
}
else
{
uint8_t x_15; 
x_15 = !lean_is_exclusive(x_3);
if (x_15 == 0)
{
uint8_t x_16; 
x_16 = !lean_is_exclusive(x_4);
if (x_16 == 0)
{
lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; uint8_t x_22; 
x_17 = lean_ctor_get(x_3, 0);
x_18 = lean_ctor_get(x_3, 1);
x_19 = lean_ctor_get(x_4, 0);
x_20 = lean_ctor_get(x_4, 1);
lean_inc(x_1);
lean_inc(x_2);
lean_inc(x_17);
x_21 = lean_apply_2(x_1, x_17, x_2);
x_22 = lean_unbox(x_21);
lean_dec(x_21);
if (x_22 == 0)
{
lean_ctor_set(x_3, 1, x_19);
lean_ctor_set(x_4, 0, x_3);
x_3 = x_18;
goto _start;
}
else
{
lean_ctor_set(x_3, 1, x_20);
lean_ctor_set(x_4, 1, x_3);
x_3 = x_18;
goto _start;
}
}
else
{
lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; uint8_t x_30; 
x_25 = lean_ctor_get(x_3, 0);
x_26 = lean_ctor_get(x_3, 1);
x_27 = lean_ctor_get(x_4, 0);
x_28 = lean_ctor_get(x_4, 1);
lean_inc(x_28);
lean_inc(x_27);
lean_dec(x_4);
lean_inc(x_1);
lean_inc(x_2);
lean_inc(x_25);
x_29 = lean_apply_2(x_1, x_25, x_2);
x_30 = lean_unbox(x_29);
lean_dec(x_29);
if (x_30 == 0)
{
lean_object* x_31; 
lean_ctor_set(x_3, 1, x_27);
x_31 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_31, 0, x_3);
lean_ctor_set(x_31, 1, x_28);
x_3 = x_26;
x_4 = x_31;
goto _start;
}
else
{
lean_object* x_33; 
lean_ctor_set(x_3, 1, x_28);
x_33 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_33, 0, x_27);
lean_ctor_set(x_33, 1, x_3);
x_3 = x_26;
x_4 = x_33;
goto _start;
}
}
}
else
{
lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40; uint8_t x_41; 
x_35 = lean_ctor_get(x_3, 0);
x_36 = lean_ctor_get(x_3, 1);
lean_inc(x_36);
lean_inc(x_35);
lean_dec(x_3);
x_37 = lean_ctor_get(x_4, 0);
lean_inc(x_37);
x_38 = lean_ctor_get(x_4, 1);
lean_inc(x_38);
if (lean_is_exclusive(x_4)) {
 lean_ctor_release(x_4, 0);
 lean_ctor_release(x_4, 1);
 x_39 = x_4;
} else {
 lean_dec_ref(x_4);
 x_39 = lean_box(0);
}
lean_inc(x_1);
lean_inc(x_2);
lean_inc(x_35);
x_40 = lean_apply_2(x_1, x_35, x_2);
x_41 = lean_unbox(x_40);
lean_dec(x_40);
if (x_41 == 0)
{
lean_object* x_42; lean_object* x_43; 
x_42 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_42, 0, x_35);
lean_ctor_set(x_42, 1, x_37);
if (lean_is_scalar(x_39)) {
 x_43 = lean_alloc_ctor(0, 2, 0);
} else {
 x_43 = x_39;
}
lean_ctor_set(x_43, 0, x_42);
lean_ctor_set(x_43, 1, x_38);
x_3 = x_36;
x_4 = x_43;
goto _start;
}
else
{
lean_object* x_45; lean_object* x_46; 
x_45 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_45, 0, x_35);
lean_ctor_set(x_45, 1, x_38);
if (lean_is_scalar(x_39)) {
 x_46 = lean_alloc_ctor(0, 2, 0);
} else {
 x_46 = x_39;
}
lean_ctor_set(x_46, 0, x_37);
lean_ctor_set(x_46, 1, x_45);
x_3 = x_36;
x_4 = x_46;
goto _start;
}
}
}
}
}
LEAN_EXPORT lean_object* l_List_partition_loop___at_Lake_guardCycle___spec__1(lean_object* x_1) {
_start:
{
lean_object* x_2; 
x_2 = lean_alloc_closure((void*)(l_List_partition_loop___at_Lake_guardCycle___spec__1___rarg), 4, 0);
return x_2;
}
}
static lean_object* _init_l_Lake_guardCycle___rarg___lambda__1___closed__1() {
_start:
{
lean_object* x_1; lean_object* x_2; 
x_1 = lean_box(0);
x_2 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_2, 0, x_1);
lean_ctor_set(x_2, 1, x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lake_guardCycle___rarg___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
uint8_t x_7; 
lean_inc(x_6);
lean_inc(x_2);
lean_inc(x_1);
x_7 = l_List_elem___rarg(x_1, x_2, x_6);
if (x_7 == 0)
{
lean_object* x_8; lean_object* x_9; lean_object* x_10; 
lean_dec(x_5);
lean_dec(x_1);
x_8 = lean_ctor_get(x_3, 1);
lean_inc(x_8);
lean_dec(x_3);
x_9 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_9, 0, x_2);
lean_ctor_set(x_9, 1, x_6);
x_10 = lean_apply_3(x_8, lean_box(0), x_9, x_4);
return x_10;
}
else
{
lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; 
lean_dec(x_4);
lean_dec(x_3);
x_11 = lean_ctor_get(x_5, 1);
lean_inc(x_11);
lean_dec(x_5);
x_12 = lean_box(0);
x_13 = l_Lake_guardCycle___rarg___lambda__1___closed__1;
lean_inc(x_2);
x_14 = l_List_partition_loop___at_Lake_guardCycle___spec__1___rarg(x_1, x_2, x_6, x_13);
x_15 = lean_ctor_get(x_14, 0);
lean_inc(x_15);
lean_dec(x_14);
lean_inc(x_2);
x_16 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_16, 0, x_2);
lean_ctor_set(x_16, 1, x_15);
x_17 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_17, 0, x_2);
lean_ctor_set(x_17, 1, x_12);
x_18 = l_List_appendTR___rarg(x_16, x_17);
x_19 = lean_apply_2(x_11, lean_box(0), x_18);
return x_19;
}
}
}
LEAN_EXPORT lean_object* l_Lake_guardCycle___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; 
x_6 = lean_ctor_get(x_2, 1);
lean_inc(x_6);
lean_dec(x_2);
x_7 = lean_ctor_get(x_3, 0);
lean_inc(x_7);
x_8 = lean_ctor_get(x_7, 0);
lean_inc(x_8);
x_9 = lean_alloc_closure((void*)(l_Lake_guardCycle___rarg___lambda__1), 6, 5);
lean_closure_set(x_9, 0, x_1);
lean_closure_set(x_9, 1, x_4);
lean_closure_set(x_9, 2, x_7);
lean_closure_set(x_9, 3, x_5);
lean_closure_set(x_9, 4, x_3);
x_10 = lean_apply_4(x_6, lean_box(0), lean_box(0), x_8, x_9);
return x_10;
}
}
LEAN_EXPORT lean_object* l_Lake_guardCycle(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; 
x_4 = lean_alloc_closure((void*)(l_Lake_guardCycle___rarg), 5, 0);
return x_4;
}
}
lean_object* initialize_Init_Control_Except(uint8_t builtin, lean_object*);
lean_object* initialize_Init_Data_List_Basic(uint8_t builtin, lean_object*);
lean_object* initialize_Init_Data_ToString(uint8_t builtin, lean_object*);
static bool _G_initialized = false;
LEAN_EXPORT lean_object* initialize_Lake_Util_Cycle(uint8_t builtin, lean_object* w) {
lean_object * res;
if (_G_initialized) return lean_io_result_mk_ok(lean_box(0));
_G_initialized = true;
res = initialize_Init_Control_Except(builtin, lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Init_Data_List_Basic(builtin, lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Init_Data_ToString(builtin, lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
l_List_mapTR_loop___at_Lake_formatCycle___spec__1___rarg___closed__1 = _init_l_List_mapTR_loop___at_Lake_formatCycle___spec__1___rarg___closed__1();
lean_mark_persistent(l_List_mapTR_loop___at_Lake_formatCycle___spec__1___rarg___closed__1);
l_List_mapTR_loop___at_Lake_formatCycle___spec__1___rarg___closed__2 = _init_l_List_mapTR_loop___at_Lake_formatCycle___spec__1___rarg___closed__2();
lean_mark_persistent(l_List_mapTR_loop___at_Lake_formatCycle___spec__1___rarg___closed__2);
l_Lake_formatCycle___rarg___closed__1 = _init_l_Lake_formatCycle___rarg___closed__1();
lean_mark_persistent(l_Lake_formatCycle___rarg___closed__1);
l_Lake_instMonadCallStackOfCallStackTOfMonad___rarg___closed__1 = _init_l_Lake_instMonadCallStackOfCallStackTOfMonad___rarg___closed__1();
lean_mark_persistent(l_Lake_instMonadCallStackOfCallStackTOfMonad___rarg___closed__1);
l_Lake_guardCycle___rarg___lambda__1___closed__1 = _init_l_Lake_guardCycle___rarg___lambda__1___closed__1();
lean_mark_persistent(l_Lake_guardCycle___rarg___lambda__1___closed__1);
return lean_io_result_mk_ok(lean_box(0));
}
#ifdef __cplusplus
}
#endif
