// Lean compiler output
// Module: Std.Internal.Async.Timer
// Imports: Std.Time Std.Internal.UV.Timer Std.Internal.Async.Select
#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_Std_Internal_IO_Async_Interval_mk(lean_object*, lean_object*, lean_object*);
static lean_object* l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__8;
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Waiter_race___at_Std_Internal_IO_Async_Sleep_selector___spec__1___boxed(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_sleep(lean_object*, lean_object*);
static lean_object* l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__20;
static lean_object* l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__6;
lean_object* lean_uv_timer_next(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l___auto____x40_Std_Internal_Async_Timer___hyg_322_;
static lean_object* l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__4;
uint64_t lean_uint64_of_nat(lean_object*);
lean_object* lean_array_push(lean_object*, lean_object*);
static lean_object* l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__16;
static lean_object* l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__12;
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_stop(lean_object*, lean_object*);
static lean_object* l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__22;
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_selector___lambda__1___boxed(lean_object*, lean_object*);
static lean_object* l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__17;
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_wait(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Interval_mk___boxed(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Interval_stop(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Selector_sleep(lean_object*, lean_object*);
lean_object* lean_io_promise_resolve(lean_object*, lean_object*, lean_object*);
static lean_object* l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__9;
lean_object* lean_st_ref_take(lean_object*, lean_object*);
static lean_object* l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__25;
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_mk(lean_object*, lean_object*);
static lean_object* l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__2;
lean_object* lean_uv_timer_stop(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Interval_tick___boxed(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_selector(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_selector___lambda__2(uint8_t, lean_object*);
lean_object* l_Except_pure___rarg(lean_object*);
lean_object* lean_uv_timer_reset(lean_object*, lean_object*);
static lean_object* l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__15;
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_sleep___boxed(lean_object*, lean_object*);
static lean_object* l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__21;
lean_object* l_EStateM_pure___rarg(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Selector_sleep___boxed(lean_object*, lean_object*);
lean_object* lean_io_map_task(lean_object*, lean_object*, lean_object*, uint8_t, lean_object*);
static lean_object* l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__23;
extern lean_object* l_Task_Priority_default;
lean_object* l_Lean_Name_str___override(lean_object*, lean_object*);
static lean_object* l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__7;
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_selector___lambda__4(lean_object*, lean_object*, lean_object*);
static lean_object* l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__27;
static lean_object* l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__11;
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_reset___boxed(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_selector___lambda__2___boxed(lean_object*, lean_object*);
static lean_object* l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__5;
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Interval_stop___boxed(lean_object*, lean_object*);
static lean_object* l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__18;
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_selector___lambda__3___boxed(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_selector___lambda__3(lean_object*, lean_object*, lean_object*);
static lean_object* l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__13;
static lean_object* l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__10;
lean_object* lean_io_get_task_state(lean_object*, lean_object*);
lean_object* l_Int_toNat(lean_object*);
lean_object* l_IO_Promise_result_x21___rarg(lean_object*);
static lean_object* l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__19;
lean_object* lean_task_map(lean_object*, lean_object*, lean_object*, uint8_t);
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Interval_reset(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_mk___boxed(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_wait___boxed(lean_object*, lean_object*);
static lean_object* l_Std_Internal_IO_Async_Sleep_selector___closed__1;
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_selector___boxed(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Interval_tick(lean_object*, lean_object*);
lean_object* lean_st_ref_set(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Name_mkStr4(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Interval_reset___boxed(lean_object*, lean_object*);
static lean_object* l_Std_Internal_IO_Async_Sleep_selector___lambda__3___closed__1;
static lean_object* l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__3;
lean_object* lean_uv_timer_mk(uint64_t, uint8_t, lean_object*);
static lean_object* l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__24;
static lean_object* l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__26;
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_stop___boxed(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_reset(lean_object*, lean_object*);
static lean_object* l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__14;
static lean_object* l_Std_Internal_IO_Async_Sleep_selector___lambda__2___closed__1;
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Waiter_race___at_Std_Internal_IO_Async_Sleep_selector___spec__1(lean_object*, lean_object*, lean_object*);
lean_object* l_EStateM_bind___rarg(lean_object*, lean_object*, lean_object*);
static lean_object* l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__1;
static lean_object* l_Std_Internal_IO_Async_Waiter_race___at_Std_Internal_IO_Async_Sleep_selector___spec__1___closed__1;
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_selector___lambda__1(lean_object*, lean_object*);
lean_object* lean_mk_empty_array_with_capacity(lean_object*);
static lean_object* l_Std_Internal_IO_Async_Sleep_wait___closed__1;
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_mk(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; uint64_t x_4; uint8_t x_5; lean_object* x_6; 
x_3 = l_Int_toNat(x_1);
x_4 = lean_uint64_of_nat(x_3);
lean_dec(x_3);
x_5 = 0;
x_6 = lean_uv_timer_mk(x_4, x_5, x_2);
if (lean_obj_tag(x_6) == 0)
{
uint8_t x_7; 
x_7 = !lean_is_exclusive(x_6);
if (x_7 == 0)
{
return x_6;
}
else
{
lean_object* x_8; lean_object* x_9; lean_object* x_10; 
x_8 = lean_ctor_get(x_6, 0);
x_9 = lean_ctor_get(x_6, 1);
lean_inc(x_9);
lean_inc(x_8);
lean_dec(x_6);
x_10 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_10, 0, x_8);
lean_ctor_set(x_10, 1, x_9);
return x_10;
}
}
else
{
uint8_t x_11; 
x_11 = !lean_is_exclusive(x_6);
if (x_11 == 0)
{
return x_6;
}
else
{
lean_object* x_12; lean_object* x_13; lean_object* x_14; 
x_12 = lean_ctor_get(x_6, 0);
x_13 = lean_ctor_get(x_6, 1);
lean_inc(x_13);
lean_inc(x_12);
lean_dec(x_6);
x_14 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_14, 0, x_12);
lean_ctor_set(x_14, 1, x_13);
return x_14;
}
}
}
}
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_mk___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; 
x_3 = l_Std_Internal_IO_Async_Sleep_mk(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
static lean_object* _init_l_Std_Internal_IO_Async_Sleep_wait___closed__1() {
_start:
{
lean_object* x_1; 
x_1 = lean_alloc_closure((void*)(l_Except_pure___rarg), 1, 0);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_wait(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; 
x_3 = lean_uv_timer_next(x_1, x_2);
if (lean_obj_tag(x_3) == 0)
{
uint8_t x_4; 
x_4 = !lean_is_exclusive(x_3);
if (x_4 == 0)
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; uint8_t x_9; lean_object* x_10; 
x_5 = lean_ctor_get(x_3, 0);
x_6 = l_IO_Promise_result_x21___rarg(x_5);
lean_dec(x_5);
x_7 = l_Std_Internal_IO_Async_Sleep_wait___closed__1;
x_8 = l_Task_Priority_default;
x_9 = 0;
x_10 = lean_task_map(x_7, x_6, x_8, x_9);
lean_ctor_set(x_3, 0, x_10);
return x_3;
}
else
{
lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; uint8_t x_16; lean_object* x_17; lean_object* x_18; 
x_11 = lean_ctor_get(x_3, 0);
x_12 = lean_ctor_get(x_3, 1);
lean_inc(x_12);
lean_inc(x_11);
lean_dec(x_3);
x_13 = l_IO_Promise_result_x21___rarg(x_11);
lean_dec(x_11);
x_14 = l_Std_Internal_IO_Async_Sleep_wait___closed__1;
x_15 = l_Task_Priority_default;
x_16 = 0;
x_17 = lean_task_map(x_14, x_13, x_15, x_16);
x_18 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_18, 0, x_17);
lean_ctor_set(x_18, 1, x_12);
return x_18;
}
}
else
{
uint8_t x_19; 
x_19 = !lean_is_exclusive(x_3);
if (x_19 == 0)
{
return x_3;
}
else
{
lean_object* x_20; lean_object* x_21; lean_object* x_22; 
x_20 = lean_ctor_get(x_3, 0);
x_21 = lean_ctor_get(x_3, 1);
lean_inc(x_21);
lean_inc(x_20);
lean_dec(x_3);
x_22 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_22, 0, x_20);
lean_ctor_set(x_22, 1, x_21);
return x_22;
}
}
}
}
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_wait___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; 
x_3 = l_Std_Internal_IO_Async_Sleep_wait(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_reset(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; 
x_3 = lean_uv_timer_reset(x_1, x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_reset___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; 
x_3 = l_Std_Internal_IO_Async_Sleep_reset(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_stop(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; 
x_3 = lean_uv_timer_stop(x_1, x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_stop___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; 
x_3 = l_Std_Internal_IO_Async_Sleep_stop(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
static lean_object* _init_l_Std_Internal_IO_Async_Waiter_race___at_Std_Internal_IO_Async_Sleep_selector___spec__1___closed__1() {
_start:
{
lean_object* x_1; lean_object* x_2; 
x_1 = lean_box(0);
x_2 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Waiter_race___at_Std_Internal_IO_Async_Sleep_selector___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
uint8_t x_4; lean_object* x_5; lean_object* x_15; lean_object* x_16; lean_object* x_17; uint8_t x_18; 
x_15 = lean_ctor_get(x_1, 0);
x_16 = lean_st_ref_take(x_15, x_3);
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
x_18 = lean_unbox(x_17);
lean_dec(x_17);
if (x_18 == 0)
{
lean_object* x_19; uint8_t x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; 
x_19 = lean_ctor_get(x_16, 1);
lean_inc(x_19);
lean_dec(x_16);
x_20 = 1;
x_21 = lean_box(x_20);
x_22 = lean_st_ref_set(x_15, x_21, x_19);
x_23 = lean_ctor_get(x_22, 1);
lean_inc(x_23);
lean_dec(x_22);
x_4 = x_20;
x_5 = x_23;
goto block_14;
}
else
{
lean_object* x_24; uint8_t x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; uint8_t x_29; 
x_24 = lean_ctor_get(x_16, 1);
lean_inc(x_24);
lean_dec(x_16);
x_25 = 1;
x_26 = lean_box(x_25);
x_27 = lean_st_ref_set(x_15, x_26, x_24);
x_28 = lean_ctor_get(x_27, 1);
lean_inc(x_28);
lean_dec(x_27);
x_29 = 0;
x_4 = x_29;
x_5 = x_28;
goto block_14;
}
block_14:
{
if (x_4 == 0)
{
lean_object* x_6; 
x_6 = lean_apply_1(x_2, x_5);
return x_6;
}
else
{
lean_object* x_7; lean_object* x_8; lean_object* x_9; uint8_t x_10; 
lean_dec(x_2);
x_7 = lean_ctor_get(x_1, 1);
x_8 = l_Std_Internal_IO_Async_Waiter_race___at_Std_Internal_IO_Async_Sleep_selector___spec__1___closed__1;
x_9 = lean_io_promise_resolve(x_8, x_7, x_5);
x_10 = !lean_is_exclusive(x_9);
if (x_10 == 0)
{
return x_9;
}
else
{
lean_object* x_11; lean_object* x_12; lean_object* x_13; 
x_11 = lean_ctor_get(x_9, 0);
x_12 = lean_ctor_get(x_9, 1);
lean_inc(x_12);
lean_inc(x_11);
lean_dec(x_9);
x_13 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_13, 0, x_11);
lean_ctor_set(x_13, 1, x_12);
return x_13;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_selector___lambda__1(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; 
x_3 = lean_io_get_task_state(x_1, x_2);
x_4 = lean_ctor_get(x_3, 0);
lean_inc(x_4);
if (lean_obj_tag(x_4) == 2)
{
uint8_t x_5; 
x_5 = !lean_is_exclusive(x_3);
if (x_5 == 0)
{
lean_object* x_6; uint8_t x_7; lean_object* x_8; 
x_6 = lean_ctor_get(x_3, 0);
lean_dec(x_6);
x_7 = 1;
x_8 = lean_box(x_7);
lean_ctor_set(x_3, 0, x_8);
return x_3;
}
else
{
lean_object* x_9; uint8_t x_10; lean_object* x_11; lean_object* x_12; 
x_9 = lean_ctor_get(x_3, 1);
lean_inc(x_9);
lean_dec(x_3);
x_10 = 1;
x_11 = lean_box(x_10);
x_12 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_12, 0, x_11);
lean_ctor_set(x_12, 1, x_9);
return x_12;
}
}
else
{
uint8_t x_13; 
lean_dec(x_4);
x_13 = !lean_is_exclusive(x_3);
if (x_13 == 0)
{
lean_object* x_14; uint8_t x_15; lean_object* x_16; 
x_14 = lean_ctor_get(x_3, 0);
lean_dec(x_14);
x_15 = 0;
x_16 = lean_box(x_15);
lean_ctor_set(x_3, 0, x_16);
return x_3;
}
else
{
lean_object* x_17; uint8_t x_18; lean_object* x_19; lean_object* x_20; 
x_17 = lean_ctor_get(x_3, 1);
lean_inc(x_17);
lean_dec(x_3);
x_18 = 0;
x_19 = lean_box(x_18);
x_20 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_20, 0, x_19);
lean_ctor_set(x_20, 1, x_17);
return x_20;
}
}
}
}
static lean_object* _init_l_Std_Internal_IO_Async_Sleep_selector___lambda__2___closed__1() {
_start:
{
lean_object* x_1; lean_object* x_2; 
x_1 = lean_box(0);
x_2 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_selector___lambda__2(uint8_t x_1, lean_object* x_2) {
_start:
{
if (x_1 == 0)
{
lean_object* x_3; lean_object* x_4; 
x_3 = lean_box(0);
x_4 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_4, 0, x_3);
lean_ctor_set(x_4, 1, x_2);
return x_4;
}
else
{
lean_object* x_5; lean_object* x_6; 
x_5 = l_Std_Internal_IO_Async_Sleep_selector___lambda__2___closed__1;
x_6 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_6, 0, x_5);
lean_ctor_set(x_6, 1, x_2);
return x_6;
}
}
}
static lean_object* _init_l_Std_Internal_IO_Async_Sleep_selector___lambda__3___closed__1() {
_start:
{
lean_object* x_1; lean_object* x_2; 
x_1 = lean_box(0);
x_2 = lean_alloc_closure((void*)(l_EStateM_pure___rarg), 2, 1);
lean_closure_set(x_2, 0, x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_selector___lambda__3(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
if (lean_obj_tag(x_2) == 0)
{
uint8_t x_4; 
x_4 = !lean_is_exclusive(x_2);
if (x_4 == 0)
{
lean_object* x_5; 
x_5 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_5, 0, x_2);
lean_ctor_set(x_5, 1, x_3);
return x_5;
}
else
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; 
x_6 = lean_ctor_get(x_2, 0);
lean_inc(x_6);
lean_dec(x_2);
x_7 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_7, 0, x_6);
x_8 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_8, 0, x_7);
lean_ctor_set(x_8, 1, x_3);
return x_8;
}
}
else
{
uint8_t x_9; 
x_9 = !lean_is_exclusive(x_2);
if (x_9 == 0)
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; 
x_10 = lean_ctor_get(x_2, 0);
lean_dec(x_10);
x_11 = l_Std_Internal_IO_Async_Sleep_selector___lambda__3___closed__1;
x_12 = l_Std_Internal_IO_Async_Waiter_race___at_Std_Internal_IO_Async_Sleep_selector___spec__1(x_1, x_11, x_3);
if (lean_obj_tag(x_12) == 0)
{
uint8_t x_13; 
x_13 = !lean_is_exclusive(x_12);
if (x_13 == 0)
{
lean_object* x_14; 
x_14 = lean_ctor_get(x_12, 0);
lean_ctor_set(x_2, 0, x_14);
lean_ctor_set(x_12, 0, x_2);
return x_12;
}
else
{
lean_object* x_15; lean_object* x_16; lean_object* x_17; 
x_15 = lean_ctor_get(x_12, 0);
x_16 = lean_ctor_get(x_12, 1);
lean_inc(x_16);
lean_inc(x_15);
lean_dec(x_12);
lean_ctor_set(x_2, 0, x_15);
x_17 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_17, 0, x_2);
lean_ctor_set(x_17, 1, x_16);
return x_17;
}
}
else
{
uint8_t x_18; 
x_18 = !lean_is_exclusive(x_12);
if (x_18 == 0)
{
lean_object* x_19; 
x_19 = lean_ctor_get(x_12, 0);
lean_ctor_set_tag(x_2, 0);
lean_ctor_set(x_2, 0, x_19);
lean_ctor_set_tag(x_12, 0);
lean_ctor_set(x_12, 0, x_2);
return x_12;
}
else
{
lean_object* x_20; lean_object* x_21; lean_object* x_22; 
x_20 = lean_ctor_get(x_12, 0);
x_21 = lean_ctor_get(x_12, 1);
lean_inc(x_21);
lean_inc(x_20);
lean_dec(x_12);
lean_ctor_set_tag(x_2, 0);
lean_ctor_set(x_2, 0, x_20);
x_22 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_22, 0, x_2);
lean_ctor_set(x_22, 1, x_21);
return x_22;
}
}
}
else
{
lean_object* x_23; lean_object* x_24; 
lean_dec(x_2);
x_23 = l_Std_Internal_IO_Async_Sleep_selector___lambda__3___closed__1;
x_24 = l_Std_Internal_IO_Async_Waiter_race___at_Std_Internal_IO_Async_Sleep_selector___spec__1(x_1, x_23, x_3);
if (lean_obj_tag(x_24) == 0)
{
lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; 
x_25 = lean_ctor_get(x_24, 0);
lean_inc(x_25);
x_26 = lean_ctor_get(x_24, 1);
lean_inc(x_26);
if (lean_is_exclusive(x_24)) {
 lean_ctor_release(x_24, 0);
 lean_ctor_release(x_24, 1);
 x_27 = x_24;
} else {
 lean_dec_ref(x_24);
 x_27 = lean_box(0);
}
x_28 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_28, 0, x_25);
if (lean_is_scalar(x_27)) {
 x_29 = lean_alloc_ctor(0, 2, 0);
} else {
 x_29 = x_27;
}
lean_ctor_set(x_29, 0, x_28);
lean_ctor_set(x_29, 1, x_26);
return x_29;
}
else
{
lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; 
x_30 = lean_ctor_get(x_24, 0);
lean_inc(x_30);
x_31 = lean_ctor_get(x_24, 1);
lean_inc(x_31);
if (lean_is_exclusive(x_24)) {
 lean_ctor_release(x_24, 0);
 lean_ctor_release(x_24, 1);
 x_32 = x_24;
} else {
 lean_dec_ref(x_24);
 x_32 = lean_box(0);
}
x_33 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_33, 0, x_30);
if (lean_is_scalar(x_32)) {
 x_34 = lean_alloc_ctor(0, 2, 0);
} else {
 x_34 = x_32;
 lean_ctor_set_tag(x_34, 0);
}
lean_ctor_set(x_34, 0, x_33);
lean_ctor_set(x_34, 1, x_31);
return x_34;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_selector___lambda__4(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5; uint8_t x_6; lean_object* x_7; uint8_t x_8; 
x_4 = lean_alloc_closure((void*)(l_Std_Internal_IO_Async_Sleep_selector___lambda__3___boxed), 3, 1);
lean_closure_set(x_4, 0, x_2);
x_5 = l_Task_Priority_default;
x_6 = 0;
x_7 = lean_io_map_task(x_4, x_1, x_5, x_6, x_3);
x_8 = !lean_is_exclusive(x_7);
if (x_8 == 0)
{
lean_object* x_9; lean_object* x_10; 
x_9 = lean_ctor_get(x_7, 0);
lean_dec(x_9);
x_10 = lean_box(0);
lean_ctor_set(x_7, 0, x_10);
return x_7;
}
else
{
lean_object* x_11; lean_object* x_12; lean_object* x_13; 
x_11 = lean_ctor_get(x_7, 1);
lean_inc(x_11);
lean_dec(x_7);
x_12 = lean_box(0);
x_13 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_13, 0, x_12);
lean_ctor_set(x_13, 1, x_11);
return x_13;
}
}
}
static lean_object* _init_l_Std_Internal_IO_Async_Sleep_selector___closed__1() {
_start:
{
lean_object* x_1; 
x_1 = lean_alloc_closure((void*)(l_Std_Internal_IO_Async_Sleep_selector___lambda__2___boxed), 2, 0);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_selector(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; 
x_3 = lean_uv_timer_next(x_1, x_2);
if (lean_obj_tag(x_3) == 0)
{
uint8_t x_4; 
x_4 = !lean_is_exclusive(x_3);
if (x_4 == 0)
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; uint8_t x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; 
x_5 = lean_ctor_get(x_3, 0);
x_6 = l_IO_Promise_result_x21___rarg(x_5);
lean_dec(x_5);
x_7 = l_Std_Internal_IO_Async_Sleep_wait___closed__1;
x_8 = l_Task_Priority_default;
x_9 = 0;
x_10 = lean_task_map(x_7, x_6, x_8, x_9);
lean_inc(x_10);
x_11 = lean_alloc_closure((void*)(l_Std_Internal_IO_Async_Sleep_selector___lambda__1___boxed), 2, 1);
lean_closure_set(x_11, 0, x_10);
x_12 = l_Std_Internal_IO_Async_Sleep_selector___closed__1;
x_13 = lean_alloc_closure((void*)(l_EStateM_bind___rarg), 3, 2);
lean_closure_set(x_13, 0, x_11);
lean_closure_set(x_13, 1, x_12);
x_14 = lean_alloc_closure((void*)(l_Std_Internal_IO_Async_Sleep_selector___lambda__4), 3, 1);
lean_closure_set(x_14, 0, x_10);
x_15 = l_Std_Internal_IO_Async_Sleep_selector___lambda__3___closed__1;
x_16 = lean_alloc_ctor(0, 3, 0);
lean_ctor_set(x_16, 0, x_13);
lean_ctor_set(x_16, 1, x_14);
lean_ctor_set(x_16, 2, x_15);
lean_ctor_set(x_3, 0, x_16);
return x_3;
}
else
{
lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; uint8_t x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; 
x_17 = lean_ctor_get(x_3, 0);
x_18 = lean_ctor_get(x_3, 1);
lean_inc(x_18);
lean_inc(x_17);
lean_dec(x_3);
x_19 = l_IO_Promise_result_x21___rarg(x_17);
lean_dec(x_17);
x_20 = l_Std_Internal_IO_Async_Sleep_wait___closed__1;
x_21 = l_Task_Priority_default;
x_22 = 0;
x_23 = lean_task_map(x_20, x_19, x_21, x_22);
lean_inc(x_23);
x_24 = lean_alloc_closure((void*)(l_Std_Internal_IO_Async_Sleep_selector___lambda__1___boxed), 2, 1);
lean_closure_set(x_24, 0, x_23);
x_25 = l_Std_Internal_IO_Async_Sleep_selector___closed__1;
x_26 = lean_alloc_closure((void*)(l_EStateM_bind___rarg), 3, 2);
lean_closure_set(x_26, 0, x_24);
lean_closure_set(x_26, 1, x_25);
x_27 = lean_alloc_closure((void*)(l_Std_Internal_IO_Async_Sleep_selector___lambda__4), 3, 1);
lean_closure_set(x_27, 0, x_23);
x_28 = l_Std_Internal_IO_Async_Sleep_selector___lambda__3___closed__1;
x_29 = lean_alloc_ctor(0, 3, 0);
lean_ctor_set(x_29, 0, x_26);
lean_ctor_set(x_29, 1, x_27);
lean_ctor_set(x_29, 2, x_28);
x_30 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_30, 0, x_29);
lean_ctor_set(x_30, 1, x_18);
return x_30;
}
}
else
{
uint8_t x_31; 
x_31 = !lean_is_exclusive(x_3);
if (x_31 == 0)
{
return x_3;
}
else
{
lean_object* x_32; lean_object* x_33; lean_object* x_34; 
x_32 = lean_ctor_get(x_3, 0);
x_33 = lean_ctor_get(x_3, 1);
lean_inc(x_33);
lean_inc(x_32);
lean_dec(x_3);
x_34 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_34, 0, x_32);
lean_ctor_set(x_34, 1, x_33);
return x_34;
}
}
}
}
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Waiter_race___at_Std_Internal_IO_Async_Sleep_selector___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; 
x_4 = l_Std_Internal_IO_Async_Waiter_race___at_Std_Internal_IO_Async_Sleep_selector___spec__1(x_1, x_2, x_3);
lean_dec(x_1);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_selector___lambda__1___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; 
x_3 = l_Std_Internal_IO_Async_Sleep_selector___lambda__1(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_selector___lambda__2___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
uint8_t x_3; lean_object* x_4; 
x_3 = lean_unbox(x_1);
lean_dec(x_1);
x_4 = l_Std_Internal_IO_Async_Sleep_selector___lambda__2(x_3, x_2);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_selector___lambda__3___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; 
x_4 = l_Std_Internal_IO_Async_Sleep_selector___lambda__3(x_1, x_2, x_3);
lean_dec(x_1);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Sleep_selector___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; 
x_3 = l_Std_Internal_IO_Async_Sleep_selector(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_sleep(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; uint64_t x_4; uint8_t x_5; lean_object* x_6; 
x_3 = l_Int_toNat(x_1);
x_4 = lean_uint64_of_nat(x_3);
lean_dec(x_3);
x_5 = 0;
x_6 = lean_uv_timer_mk(x_4, x_5, x_2);
if (lean_obj_tag(x_6) == 0)
{
lean_object* x_7; lean_object* x_8; lean_object* x_9; 
x_7 = lean_ctor_get(x_6, 0);
lean_inc(x_7);
x_8 = lean_ctor_get(x_6, 1);
lean_inc(x_8);
lean_dec(x_6);
x_9 = lean_uv_timer_next(x_7, x_8);
lean_dec(x_7);
if (lean_obj_tag(x_9) == 0)
{
uint8_t x_10; 
x_10 = !lean_is_exclusive(x_9);
if (x_10 == 0)
{
lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; 
x_11 = lean_ctor_get(x_9, 0);
x_12 = l_IO_Promise_result_x21___rarg(x_11);
lean_dec(x_11);
x_13 = l_Std_Internal_IO_Async_Sleep_wait___closed__1;
x_14 = l_Task_Priority_default;
x_15 = lean_task_map(x_13, x_12, x_14, x_5);
lean_ctor_set(x_9, 0, x_15);
return x_9;
}
else
{
lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; 
x_16 = lean_ctor_get(x_9, 0);
x_17 = lean_ctor_get(x_9, 1);
lean_inc(x_17);
lean_inc(x_16);
lean_dec(x_9);
x_18 = l_IO_Promise_result_x21___rarg(x_16);
lean_dec(x_16);
x_19 = l_Std_Internal_IO_Async_Sleep_wait___closed__1;
x_20 = l_Task_Priority_default;
x_21 = lean_task_map(x_19, x_18, x_20, x_5);
x_22 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_22, 0, x_21);
lean_ctor_set(x_22, 1, x_17);
return x_22;
}
}
else
{
uint8_t x_23; 
x_23 = !lean_is_exclusive(x_9);
if (x_23 == 0)
{
return x_9;
}
else
{
lean_object* x_24; lean_object* x_25; lean_object* x_26; 
x_24 = lean_ctor_get(x_9, 0);
x_25 = lean_ctor_get(x_9, 1);
lean_inc(x_25);
lean_inc(x_24);
lean_dec(x_9);
x_26 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_26, 0, x_24);
lean_ctor_set(x_26, 1, x_25);
return x_26;
}
}
}
else
{
uint8_t x_27; 
x_27 = !lean_is_exclusive(x_6);
if (x_27 == 0)
{
return x_6;
}
else
{
lean_object* x_28; lean_object* x_29; lean_object* x_30; 
x_28 = lean_ctor_get(x_6, 0);
x_29 = lean_ctor_get(x_6, 1);
lean_inc(x_29);
lean_inc(x_28);
lean_dec(x_6);
x_30 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_30, 0, x_28);
lean_ctor_set(x_30, 1, x_29);
return x_30;
}
}
}
}
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_sleep___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; 
x_3 = l_Std_Internal_IO_Async_sleep(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Selector_sleep(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; uint64_t x_4; uint8_t x_5; lean_object* x_6; 
x_3 = l_Int_toNat(x_1);
x_4 = lean_uint64_of_nat(x_3);
lean_dec(x_3);
x_5 = 0;
x_6 = lean_uv_timer_mk(x_4, x_5, x_2);
if (lean_obj_tag(x_6) == 0)
{
lean_object* x_7; lean_object* x_8; lean_object* x_9; 
x_7 = lean_ctor_get(x_6, 0);
lean_inc(x_7);
x_8 = lean_ctor_get(x_6, 1);
lean_inc(x_8);
lean_dec(x_6);
x_9 = l_Std_Internal_IO_Async_Sleep_selector(x_7, x_8);
lean_dec(x_7);
return x_9;
}
else
{
uint8_t x_10; 
x_10 = !lean_is_exclusive(x_6);
if (x_10 == 0)
{
return x_6;
}
else
{
lean_object* x_11; lean_object* x_12; lean_object* x_13; 
x_11 = lean_ctor_get(x_6, 0);
x_12 = lean_ctor_get(x_6, 1);
lean_inc(x_12);
lean_inc(x_11);
lean_dec(x_6);
x_13 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_13, 0, x_11);
lean_ctor_set(x_13, 1, x_12);
return x_13;
}
}
}
}
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Selector_sleep___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; 
x_3 = l_Std_Internal_IO_Async_Selector_sleep(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
static lean_object* _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__1() {
_start:
{
lean_object* x_1; 
x_1 = lean_mk_string_unchecked("Lean", 4, 4);
return x_1;
}
}
static lean_object* _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__2() {
_start:
{
lean_object* x_1; 
x_1 = lean_mk_string_unchecked("Parser", 6, 6);
return x_1;
}
}
static lean_object* _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__3() {
_start:
{
lean_object* x_1; 
x_1 = lean_mk_string_unchecked("Tactic", 6, 6);
return x_1;
}
}
static lean_object* _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__4() {
_start:
{
lean_object* x_1; 
x_1 = lean_mk_string_unchecked("tacticSeq", 9, 9);
return x_1;
}
}
static lean_object* _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__5() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5; 
x_1 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__1;
x_2 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__2;
x_3 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__3;
x_4 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__4;
x_5 = l_Lean_Name_mkStr4(x_1, x_2, x_3, x_4);
return x_5;
}
}
static lean_object* _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__6() {
_start:
{
lean_object* x_1; lean_object* x_2; 
x_1 = lean_unsigned_to_nat(0u);
x_2 = lean_mk_empty_array_with_capacity(x_1);
return x_2;
}
}
static lean_object* _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__7() {
_start:
{
lean_object* x_1; 
x_1 = lean_mk_string_unchecked("tacticSeq1Indented", 18, 18);
return x_1;
}
}
static lean_object* _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__8() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5; 
x_1 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__1;
x_2 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__2;
x_3 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__3;
x_4 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__7;
x_5 = l_Lean_Name_mkStr4(x_1, x_2, x_3, x_4);
return x_5;
}
}
static lean_object* _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__9() {
_start:
{
lean_object* x_1; 
x_1 = lean_mk_string_unchecked("null", 4, 4);
return x_1;
}
}
static lean_object* _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__10() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; 
x_1 = lean_box(0);
x_2 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__9;
x_3 = l_Lean_Name_str___override(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__11() {
_start:
{
lean_object* x_1; 
x_1 = lean_mk_string_unchecked("decide", 6, 6);
return x_1;
}
}
static lean_object* _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__12() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5; 
x_1 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__1;
x_2 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__2;
x_3 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__3;
x_4 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__11;
x_5 = l_Lean_Name_mkStr4(x_1, x_2, x_3, x_4);
return x_5;
}
}
static lean_object* _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__13() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; 
x_1 = lean_box(2);
x_2 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__11;
x_3 = lean_alloc_ctor(2, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
static lean_object* _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__14() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; 
x_1 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__6;
x_2 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__13;
x_3 = lean_array_push(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__15() {
_start:
{
lean_object* x_1; 
x_1 = lean_mk_string_unchecked("optConfig", 9, 9);
return x_1;
}
}
static lean_object* _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__16() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5; 
x_1 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__1;
x_2 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__2;
x_3 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__3;
x_4 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__15;
x_5 = l_Lean_Name_mkStr4(x_1, x_2, x_3, x_4);
return x_5;
}
}
static lean_object* _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__17() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; 
x_1 = lean_box(2);
x_2 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__10;
x_3 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__6;
x_4 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_4, 0, x_1);
lean_ctor_set(x_4, 1, x_2);
lean_ctor_set(x_4, 2, x_3);
return x_4;
}
}
static lean_object* _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__18() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; 
x_1 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__6;
x_2 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__17;
x_3 = lean_array_push(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__19() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; 
x_1 = lean_box(2);
x_2 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__16;
x_3 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__18;
x_4 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_4, 0, x_1);
lean_ctor_set(x_4, 1, x_2);
lean_ctor_set(x_4, 2, x_3);
return x_4;
}
}
static lean_object* _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__20() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; 
x_1 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__14;
x_2 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__19;
x_3 = lean_array_push(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__21() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; 
x_1 = lean_box(2);
x_2 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__12;
x_3 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__20;
x_4 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_4, 0, x_1);
lean_ctor_set(x_4, 1, x_2);
lean_ctor_set(x_4, 2, x_3);
return x_4;
}
}
static lean_object* _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__22() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; 
x_1 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__6;
x_2 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__21;
x_3 = lean_array_push(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__23() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; 
x_1 = lean_box(2);
x_2 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__10;
x_3 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__22;
x_4 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_4, 0, x_1);
lean_ctor_set(x_4, 1, x_2);
lean_ctor_set(x_4, 2, x_3);
return x_4;
}
}
static lean_object* _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__24() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; 
x_1 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__6;
x_2 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__23;
x_3 = lean_array_push(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__25() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; 
x_1 = lean_box(2);
x_2 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__8;
x_3 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__24;
x_4 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_4, 0, x_1);
lean_ctor_set(x_4, 1, x_2);
lean_ctor_set(x_4, 2, x_3);
return x_4;
}
}
static lean_object* _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__26() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; 
x_1 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__6;
x_2 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__25;
x_3 = lean_array_push(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__27() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; 
x_1 = lean_box(2);
x_2 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__5;
x_3 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__26;
x_4 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_4, 0, x_1);
lean_ctor_set(x_4, 1, x_2);
lean_ctor_set(x_4, 2, x_3);
return x_4;
}
}
static lean_object* _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322_() {
_start:
{
lean_object* x_1; 
x_1 = l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__27;
return x_1;
}
}
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Interval_mk(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; uint64_t x_5; uint8_t x_6; lean_object* x_7; 
x_4 = l_Int_toNat(x_1);
x_5 = lean_uint64_of_nat(x_4);
lean_dec(x_4);
x_6 = 1;
x_7 = lean_uv_timer_mk(x_5, x_6, x_3);
if (lean_obj_tag(x_7) == 0)
{
uint8_t x_8; 
x_8 = !lean_is_exclusive(x_7);
if (x_8 == 0)
{
return x_7;
}
else
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; 
x_9 = lean_ctor_get(x_7, 0);
x_10 = lean_ctor_get(x_7, 1);
lean_inc(x_10);
lean_inc(x_9);
lean_dec(x_7);
x_11 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_11, 0, x_9);
lean_ctor_set(x_11, 1, x_10);
return x_11;
}
}
else
{
uint8_t x_12; 
x_12 = !lean_is_exclusive(x_7);
if (x_12 == 0)
{
return x_7;
}
else
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; 
x_13 = lean_ctor_get(x_7, 0);
x_14 = lean_ctor_get(x_7, 1);
lean_inc(x_14);
lean_inc(x_13);
lean_dec(x_7);
x_15 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_15, 0, x_13);
lean_ctor_set(x_15, 1, x_14);
return x_15;
}
}
}
}
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Interval_mk___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; 
x_4 = l_Std_Internal_IO_Async_Interval_mk(x_1, x_2, x_3);
lean_dec(x_1);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Interval_tick(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; 
x_3 = lean_uv_timer_next(x_1, x_2);
if (lean_obj_tag(x_3) == 0)
{
uint8_t x_4; 
x_4 = !lean_is_exclusive(x_3);
if (x_4 == 0)
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; uint8_t x_9; lean_object* x_10; 
x_5 = lean_ctor_get(x_3, 0);
x_6 = l_IO_Promise_result_x21___rarg(x_5);
lean_dec(x_5);
x_7 = l_Std_Internal_IO_Async_Sleep_wait___closed__1;
x_8 = l_Task_Priority_default;
x_9 = 0;
x_10 = lean_task_map(x_7, x_6, x_8, x_9);
lean_ctor_set(x_3, 0, x_10);
return x_3;
}
else
{
lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; uint8_t x_16; lean_object* x_17; lean_object* x_18; 
x_11 = lean_ctor_get(x_3, 0);
x_12 = lean_ctor_get(x_3, 1);
lean_inc(x_12);
lean_inc(x_11);
lean_dec(x_3);
x_13 = l_IO_Promise_result_x21___rarg(x_11);
lean_dec(x_11);
x_14 = l_Std_Internal_IO_Async_Sleep_wait___closed__1;
x_15 = l_Task_Priority_default;
x_16 = 0;
x_17 = lean_task_map(x_14, x_13, x_15, x_16);
x_18 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_18, 0, x_17);
lean_ctor_set(x_18, 1, x_12);
return x_18;
}
}
else
{
uint8_t x_19; 
x_19 = !lean_is_exclusive(x_3);
if (x_19 == 0)
{
return x_3;
}
else
{
lean_object* x_20; lean_object* x_21; lean_object* x_22; 
x_20 = lean_ctor_get(x_3, 0);
x_21 = lean_ctor_get(x_3, 1);
lean_inc(x_21);
lean_inc(x_20);
lean_dec(x_3);
x_22 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_22, 0, x_20);
lean_ctor_set(x_22, 1, x_21);
return x_22;
}
}
}
}
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Interval_tick___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; 
x_3 = l_Std_Internal_IO_Async_Interval_tick(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Interval_reset(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; 
x_3 = lean_uv_timer_reset(x_1, x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Interval_reset___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; 
x_3 = l_Std_Internal_IO_Async_Interval_reset(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Interval_stop(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; 
x_3 = lean_uv_timer_stop(x_1, x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Std_Internal_IO_Async_Interval_stop___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; 
x_3 = l_Std_Internal_IO_Async_Interval_stop(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
lean_object* initialize_Std_Time(uint8_t builtin, lean_object*);
lean_object* initialize_Std_Internal_UV_Timer(uint8_t builtin, lean_object*);
lean_object* initialize_Std_Internal_Async_Select(uint8_t builtin, lean_object*);
static bool _G_initialized = false;
LEAN_EXPORT lean_object* initialize_Std_Internal_Async_Timer(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_Std_Time(builtin, lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Std_Internal_UV_Timer(builtin, lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Std_Internal_Async_Select(builtin, lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
l_Std_Internal_IO_Async_Sleep_wait___closed__1 = _init_l_Std_Internal_IO_Async_Sleep_wait___closed__1();
lean_mark_persistent(l_Std_Internal_IO_Async_Sleep_wait___closed__1);
l_Std_Internal_IO_Async_Waiter_race___at_Std_Internal_IO_Async_Sleep_selector___spec__1___closed__1 = _init_l_Std_Internal_IO_Async_Waiter_race___at_Std_Internal_IO_Async_Sleep_selector___spec__1___closed__1();
lean_mark_persistent(l_Std_Internal_IO_Async_Waiter_race___at_Std_Internal_IO_Async_Sleep_selector___spec__1___closed__1);
l_Std_Internal_IO_Async_Sleep_selector___lambda__2___closed__1 = _init_l_Std_Internal_IO_Async_Sleep_selector___lambda__2___closed__1();
lean_mark_persistent(l_Std_Internal_IO_Async_Sleep_selector___lambda__2___closed__1);
l_Std_Internal_IO_Async_Sleep_selector___lambda__3___closed__1 = _init_l_Std_Internal_IO_Async_Sleep_selector___lambda__3___closed__1();
lean_mark_persistent(l_Std_Internal_IO_Async_Sleep_selector___lambda__3___closed__1);
l_Std_Internal_IO_Async_Sleep_selector___closed__1 = _init_l_Std_Internal_IO_Async_Sleep_selector___closed__1();
lean_mark_persistent(l_Std_Internal_IO_Async_Sleep_selector___closed__1);
l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__1 = _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__1();
lean_mark_persistent(l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__1);
l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__2 = _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__2();
lean_mark_persistent(l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__2);
l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__3 = _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__3();
lean_mark_persistent(l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__3);
l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__4 = _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__4();
lean_mark_persistent(l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__4);
l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__5 = _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__5();
lean_mark_persistent(l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__5);
l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__6 = _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__6();
lean_mark_persistent(l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__6);
l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__7 = _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__7();
lean_mark_persistent(l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__7);
l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__8 = _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__8();
lean_mark_persistent(l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__8);
l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__9 = _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__9();
lean_mark_persistent(l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__9);
l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__10 = _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__10();
lean_mark_persistent(l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__10);
l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__11 = _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__11();
lean_mark_persistent(l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__11);
l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__12 = _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__12();
lean_mark_persistent(l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__12);
l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__13 = _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__13();
lean_mark_persistent(l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__13);
l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__14 = _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__14();
lean_mark_persistent(l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__14);
l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__15 = _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__15();
lean_mark_persistent(l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__15);
l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__16 = _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__16();
lean_mark_persistent(l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__16);
l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__17 = _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__17();
lean_mark_persistent(l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__17);
l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__18 = _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__18();
lean_mark_persistent(l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__18);
l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__19 = _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__19();
lean_mark_persistent(l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__19);
l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__20 = _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__20();
lean_mark_persistent(l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__20);
l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__21 = _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__21();
lean_mark_persistent(l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__21);
l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__22 = _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__22();
lean_mark_persistent(l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__22);
l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__23 = _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__23();
lean_mark_persistent(l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__23);
l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__24 = _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__24();
lean_mark_persistent(l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__24);
l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__25 = _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__25();
lean_mark_persistent(l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__25);
l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__26 = _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__26();
lean_mark_persistent(l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__26);
l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__27 = _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__27();
lean_mark_persistent(l___auto____x40_Std_Internal_Async_Timer___hyg_322____closed__27);
l___auto____x40_Std_Internal_Async_Timer___hyg_322_ = _init_l___auto____x40_Std_Internal_Async_Timer___hyg_322_();
lean_mark_persistent(l___auto____x40_Std_Internal_Async_Timer___hyg_322_);
return lean_io_result_mk_ok(lean_box(0));
}
#ifdef __cplusplus
}
#endif
