// Lean compiler output
// Module: Lake.Config.ExternLib
// Imports: public import Lake.Config.ConfigTarget
#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_object* l_Id_instMonad___lam__5___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Id_instMonad___lam__4___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Id_instMonad___lam__3(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Id_instMonad___lam__2___boxed(lean_object*, lean_object*);
lean_object* l_Id_instMonad___lam__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Id_instMonad___lam__0(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_mk_empty_array_with_capacity(lean_object*);
uint8_t lean_name_eq(lean_object*, lean_object*);
lean_object* lean_array_push(lean_object*, lean_object*);
lean_object* l_Id_instMonad___lam__6(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Name_str___override(lean_object*, lean_object*);
lean_object* lean_array_get_size(lean_object*);
uint8_t lean_nat_dec_lt(lean_object*, lean_object*);
extern lean_object* l_Lake_ExternLib_keyword;
uint8_t lean_nat_dec_le(lean_object*, lean_object*);
size_t lean_usize_of_nat(lean_object*);
lean_object* l___private_Init_Data_Array_Basic_0__Array_foldlMUnsafe_fold(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, size_t, size_t, lean_object*);
lean_object* l_Lake_Package_findTargetDecl_x3f(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lake_Package_externLibs___lam__0(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lake_Package_externLibs___lam__0___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
static const lean_array_object l_Lake_Package_externLibs___closed__0_value = {.m_header = {.m_rc = 0, .m_cs_sz = sizeof(lean_array_object) + sizeof(void*)*0, .m_other = 0, .m_tag = 246}, .m_size = 0, .m_capacity = 0, .m_data = {}};
static const lean_object* l_Lake_Package_externLibs___closed__0 = (const lean_object*)&l_Lake_Package_externLibs___closed__0_value;
static const lean_closure_object l_Lake_Package_externLibs___closed__1_value = {.m_header = {.m_rc = 0, .m_cs_sz = sizeof(lean_closure_object) + sizeof(void*)*0, .m_other = 0, .m_tag = 245}, .m_fun = (void*)l_Id_instMonad___lam__0, .m_arity = 4, .m_num_fixed = 0, .m_objs = {} };
static const lean_object* l_Lake_Package_externLibs___closed__1 = (const lean_object*)&l_Lake_Package_externLibs___closed__1_value;
static const lean_closure_object l_Lake_Package_externLibs___closed__2_value = {.m_header = {.m_rc = 0, .m_cs_sz = sizeof(lean_closure_object) + sizeof(void*)*0, .m_other = 0, .m_tag = 245}, .m_fun = (void*)l_Id_instMonad___lam__1___boxed, .m_arity = 4, .m_num_fixed = 0, .m_objs = {} };
static const lean_object* l_Lake_Package_externLibs___closed__2 = (const lean_object*)&l_Lake_Package_externLibs___closed__2_value;
static const lean_closure_object l_Lake_Package_externLibs___closed__3_value = {.m_header = {.m_rc = 0, .m_cs_sz = sizeof(lean_closure_object) + sizeof(void*)*0, .m_other = 0, .m_tag = 245}, .m_fun = (void*)l_Id_instMonad___lam__2___boxed, .m_arity = 2, .m_num_fixed = 0, .m_objs = {} };
static const lean_object* l_Lake_Package_externLibs___closed__3 = (const lean_object*)&l_Lake_Package_externLibs___closed__3_value;
static const lean_closure_object l_Lake_Package_externLibs___closed__4_value = {.m_header = {.m_rc = 0, .m_cs_sz = sizeof(lean_closure_object) + sizeof(void*)*0, .m_other = 0, .m_tag = 245}, .m_fun = (void*)l_Id_instMonad___lam__3, .m_arity = 4, .m_num_fixed = 0, .m_objs = {} };
static const lean_object* l_Lake_Package_externLibs___closed__4 = (const lean_object*)&l_Lake_Package_externLibs___closed__4_value;
static const lean_closure_object l_Lake_Package_externLibs___closed__5_value = {.m_header = {.m_rc = 0, .m_cs_sz = sizeof(lean_closure_object) + sizeof(void*)*0, .m_other = 0, .m_tag = 245}, .m_fun = (void*)l_Id_instMonad___lam__4___boxed, .m_arity = 4, .m_num_fixed = 0, .m_objs = {} };
static const lean_object* l_Lake_Package_externLibs___closed__5 = (const lean_object*)&l_Lake_Package_externLibs___closed__5_value;
static const lean_closure_object l_Lake_Package_externLibs___closed__6_value = {.m_header = {.m_rc = 0, .m_cs_sz = sizeof(lean_closure_object) + sizeof(void*)*0, .m_other = 0, .m_tag = 245}, .m_fun = (void*)l_Id_instMonad___lam__5___boxed, .m_arity = 4, .m_num_fixed = 0, .m_objs = {} };
static const lean_object* l_Lake_Package_externLibs___closed__6 = (const lean_object*)&l_Lake_Package_externLibs___closed__6_value;
static const lean_closure_object l_Lake_Package_externLibs___closed__7_value = {.m_header = {.m_rc = 0, .m_cs_sz = sizeof(lean_closure_object) + sizeof(void*)*0, .m_other = 0, .m_tag = 245}, .m_fun = (void*)l_Id_instMonad___lam__6, .m_arity = 4, .m_num_fixed = 0, .m_objs = {} };
static const lean_object* l_Lake_Package_externLibs___closed__7 = (const lean_object*)&l_Lake_Package_externLibs___closed__7_value;
static const lean_ctor_object l_Lake_Package_externLibs___closed__8_value = {.m_header = {.m_rc = 0, .m_cs_sz = sizeof(lean_ctor_object) + sizeof(void*)*2 + 0, .m_other = 2, .m_tag = 0}, .m_objs = {((lean_object*)&l_Lake_Package_externLibs___closed__1_value),((lean_object*)&l_Lake_Package_externLibs___closed__2_value)}};
static const lean_object* l_Lake_Package_externLibs___closed__8 = (const lean_object*)&l_Lake_Package_externLibs___closed__8_value;
static const lean_ctor_object l_Lake_Package_externLibs___closed__9_value = {.m_header = {.m_rc = 0, .m_cs_sz = sizeof(lean_ctor_object) + sizeof(void*)*5 + 0, .m_other = 5, .m_tag = 0}, .m_objs = {((lean_object*)&l_Lake_Package_externLibs___closed__8_value),((lean_object*)&l_Lake_Package_externLibs___closed__3_value),((lean_object*)&l_Lake_Package_externLibs___closed__4_value),((lean_object*)&l_Lake_Package_externLibs___closed__5_value),((lean_object*)&l_Lake_Package_externLibs___closed__6_value)}};
static const lean_object* l_Lake_Package_externLibs___closed__9 = (const lean_object*)&l_Lake_Package_externLibs___closed__9_value;
static const lean_ctor_object l_Lake_Package_externLibs___closed__10_value = {.m_header = {.m_rc = 0, .m_cs_sz = sizeof(lean_ctor_object) + sizeof(void*)*2 + 0, .m_other = 2, .m_tag = 0}, .m_objs = {((lean_object*)&l_Lake_Package_externLibs___closed__9_value),((lean_object*)&l_Lake_Package_externLibs___closed__7_value)}};
static const lean_object* l_Lake_Package_externLibs___closed__10 = (const lean_object*)&l_Lake_Package_externLibs___closed__10_value;
LEAN_EXPORT lean_object* l_Lake_Package_externLibs(lean_object*);
LEAN_EXPORT lean_object* l_Lake_Package_findExternLib_x3f(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lake_Package_findExternLib_x3f___boxed(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lake_ExternLib_config(lean_object*);
LEAN_EXPORT lean_object* l_Lake_ExternLib_config___boxed(lean_object*);
LEAN_EXPORT lean_object* l_Lake_ExternLib_linkArgs(lean_object*);
LEAN_EXPORT lean_object* l_Lake_ExternLib_linkArgs___boxed(lean_object*);
static const lean_string_object l_Lake_ExternLib_staticTargetName___closed__0_value = {.m_header = {.m_rc = 0, .m_cs_sz = 0, .m_other = 0, .m_tag = 249}, .m_size = 7, .m_capacity = 7, .m_length = 6, .m_data = "static"};
static const lean_object* l_Lake_ExternLib_staticTargetName___closed__0 = (const lean_object*)&l_Lake_ExternLib_staticTargetName___closed__0_value;
LEAN_EXPORT lean_object* l_Lake_ExternLib_staticTargetName(lean_object*);
LEAN_EXPORT lean_object* l_Lake_Package_externLibs___lam__0(lean_object* v___x_1_, lean_object* v_self_2_, lean_object* v_x1_3_, lean_object* v_x2_4_){
_start:
{
lean_object* v_name_5_; lean_object* v_kind_6_; lean_object* v_config_7_; uint8_t v___x_8_; 
v_name_5_ = lean_ctor_get(v_x2_4_, 1);
v_kind_6_ = lean_ctor_get(v_x2_4_, 2);
v_config_7_ = lean_ctor_get(v_x2_4_, 3);
v___x_8_ = lean_name_eq(v_kind_6_, v___x_1_);
if (v___x_8_ == 0)
{
lean_dec_ref(v_self_2_);
return v_x1_3_;
}
else
{
lean_object* v___x_9_; lean_object* v___x_10_; 
lean_inc(v_config_7_);
lean_inc(v_name_5_);
v___x_9_ = lean_alloc_ctor(0, 3, 0);
lean_ctor_set(v___x_9_, 0, v_self_2_);
lean_ctor_set(v___x_9_, 1, v_name_5_);
lean_ctor_set(v___x_9_, 2, v_config_7_);
v___x_10_ = lean_array_push(v_x1_3_, v___x_9_);
return v___x_10_;
}
}
}
LEAN_EXPORT lean_object* l_Lake_Package_externLibs___lam__0___boxed(lean_object* v___x_11_, lean_object* v_self_12_, lean_object* v_x1_13_, lean_object* v_x2_14_){
_start:
{
lean_object* v_res_15_; 
v_res_15_ = l_Lake_Package_externLibs___lam__0(v___x_11_, v_self_12_, v_x1_13_, v_x2_14_);
lean_dec_ref(v_x2_14_);
lean_dec(v___x_11_);
return v_res_15_;
}
}
LEAN_EXPORT lean_object* l_Lake_Package_externLibs(lean_object* v_self_37_){
_start:
{
lean_object* v_targetDecls_38_; lean_object* v___x_39_; lean_object* v___x_40_; lean_object* v___x_41_; lean_object* v___x_42_; uint8_t v___x_43_; 
v_targetDecls_38_ = lean_ctor_get(v_self_37_, 13);
lean_inc_ref(v_targetDecls_38_);
v___x_39_ = lean_unsigned_to_nat(0u);
v___x_40_ = ((lean_object*)(l_Lake_Package_externLibs___closed__0));
v___x_41_ = lean_array_get_size(v_targetDecls_38_);
v___x_42_ = ((lean_object*)(l_Lake_Package_externLibs___closed__10));
v___x_43_ = lean_nat_dec_lt(v___x_39_, v___x_41_);
if (v___x_43_ == 0)
{
lean_dec_ref(v_targetDecls_38_);
lean_dec_ref(v_self_37_);
return v___x_40_;
}
else
{
lean_object* v___x_44_; lean_object* v___f_45_; uint8_t v___x_46_; 
v___x_44_ = l_Lake_ExternLib_keyword;
v___f_45_ = lean_alloc_closure((void*)(l_Lake_Package_externLibs___lam__0___boxed), 4, 2);
lean_closure_set(v___f_45_, 0, v___x_44_);
lean_closure_set(v___f_45_, 1, v_self_37_);
v___x_46_ = lean_nat_dec_le(v___x_41_, v___x_41_);
if (v___x_46_ == 0)
{
if (v___x_43_ == 0)
{
lean_dec_ref(v___f_45_);
lean_dec_ref(v_targetDecls_38_);
return v___x_40_;
}
else
{
size_t v___x_47_; size_t v___x_48_; lean_object* v___x_49_; 
v___x_47_ = ((size_t)0ULL);
v___x_48_ = lean_usize_of_nat(v___x_41_);
v___x_49_ = l___private_Init_Data_Array_Basic_0__Array_foldlMUnsafe_fold(lean_box(0), lean_box(0), lean_box(0), v___x_42_, v___f_45_, v_targetDecls_38_, v___x_47_, v___x_48_, v___x_40_);
return v___x_49_;
}
}
else
{
size_t v___x_50_; size_t v___x_51_; lean_object* v___x_52_; 
v___x_50_ = ((size_t)0ULL);
v___x_51_ = lean_usize_of_nat(v___x_41_);
v___x_52_ = l___private_Init_Data_Array_Basic_0__Array_foldlMUnsafe_fold(lean_box(0), lean_box(0), lean_box(0), v___x_42_, v___f_45_, v_targetDecls_38_, v___x_50_, v___x_51_, v___x_40_);
return v___x_52_;
}
}
}
}
LEAN_EXPORT lean_object* l_Lake_Package_findExternLib_x3f(lean_object* v_name_53_, lean_object* v_self_54_){
_start:
{
lean_object* v___x_55_; 
v___x_55_ = l_Lake_Package_findTargetDecl_x3f(v_name_53_, v_self_54_);
if (lean_obj_tag(v___x_55_) == 0)
{
lean_object* v___x_56_; 
lean_dec_ref(v_self_54_);
v___x_56_ = lean_box(0);
return v___x_56_;
}
else
{
lean_object* v_val_57_; lean_object* v___x_59_; uint8_t v_isShared_60_; uint8_t v_isSharedCheck_71_; 
v_val_57_ = lean_ctor_get(v___x_55_, 0);
v_isSharedCheck_71_ = !lean_is_exclusive(v___x_55_);
if (v_isSharedCheck_71_ == 0)
{
v___x_59_ = v___x_55_;
v_isShared_60_ = v_isSharedCheck_71_;
goto v_resetjp_58_;
}
else
{
lean_inc(v_val_57_);
lean_dec(v___x_55_);
v___x_59_ = lean_box(0);
v_isShared_60_ = v_isSharedCheck_71_;
goto v_resetjp_58_;
}
v_resetjp_58_:
{
lean_object* v_name_61_; lean_object* v_kind_62_; lean_object* v_config_63_; lean_object* v___x_64_; uint8_t v___x_65_; 
v_name_61_ = lean_ctor_get(v_val_57_, 1);
lean_inc(v_name_61_);
v_kind_62_ = lean_ctor_get(v_val_57_, 2);
lean_inc(v_kind_62_);
v_config_63_ = lean_ctor_get(v_val_57_, 3);
lean_inc(v_config_63_);
lean_dec(v_val_57_);
v___x_64_ = l_Lake_ExternLib_keyword;
v___x_65_ = lean_name_eq(v_kind_62_, v___x_64_);
lean_dec(v_kind_62_);
if (v___x_65_ == 0)
{
lean_object* v___x_66_; 
lean_dec(v_config_63_);
lean_dec(v_name_61_);
lean_del_object(v___x_59_);
lean_dec_ref(v_self_54_);
v___x_66_ = lean_box(0);
return v___x_66_;
}
else
{
lean_object* v___x_67_; lean_object* v___x_69_; 
v___x_67_ = lean_alloc_ctor(0, 3, 0);
lean_ctor_set(v___x_67_, 0, v_self_54_);
lean_ctor_set(v___x_67_, 1, v_name_61_);
lean_ctor_set(v___x_67_, 2, v_config_63_);
if (v_isShared_60_ == 0)
{
lean_ctor_set(v___x_59_, 0, v___x_67_);
v___x_69_ = v___x_59_;
goto v_reusejp_68_;
}
else
{
lean_object* v_reuseFailAlloc_70_; 
v_reuseFailAlloc_70_ = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(v_reuseFailAlloc_70_, 0, v___x_67_);
v___x_69_ = v_reuseFailAlloc_70_;
goto v_reusejp_68_;
}
v_reusejp_68_:
{
return v___x_69_;
}
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lake_Package_findExternLib_x3f___boxed(lean_object* v_name_72_, lean_object* v_self_73_){
_start:
{
lean_object* v_res_74_; 
v_res_74_ = l_Lake_Package_findExternLib_x3f(v_name_72_, v_self_73_);
lean_dec(v_name_72_);
return v_res_74_;
}
}
LEAN_EXPORT lean_object* l_Lake_ExternLib_config(lean_object* v_self_75_){
_start:
{
lean_object* v_config_76_; 
v_config_76_ = lean_ctor_get(v_self_75_, 2);
lean_inc(v_config_76_);
return v_config_76_;
}
}
LEAN_EXPORT lean_object* l_Lake_ExternLib_config___boxed(lean_object* v_self_77_){
_start:
{
lean_object* v_res_78_; 
v_res_78_ = l_Lake_ExternLib_config(v_self_77_);
lean_dec_ref(v_self_77_);
return v_res_78_;
}
}
LEAN_EXPORT lean_object* l_Lake_ExternLib_linkArgs(lean_object* v_self_79_){
_start:
{
lean_object* v_pkg_80_; lean_object* v_config_81_; lean_object* v_toLeanConfig_82_; lean_object* v_moreLinkArgs_83_; 
v_pkg_80_ = lean_ctor_get(v_self_79_, 0);
v_config_81_ = lean_ctor_get(v_pkg_80_, 6);
v_toLeanConfig_82_ = lean_ctor_get(v_config_81_, 1);
v_moreLinkArgs_83_ = lean_ctor_get(v_toLeanConfig_82_, 8);
lean_inc_ref(v_moreLinkArgs_83_);
return v_moreLinkArgs_83_;
}
}
LEAN_EXPORT lean_object* l_Lake_ExternLib_linkArgs___boxed(lean_object* v_self_84_){
_start:
{
lean_object* v_res_85_; 
v_res_85_ = l_Lake_ExternLib_linkArgs(v_self_84_);
lean_dec_ref(v_self_84_);
return v_res_85_;
}
}
LEAN_EXPORT lean_object* l_Lake_ExternLib_staticTargetName(lean_object* v_self_87_){
_start:
{
lean_object* v_name_88_; lean_object* v___x_89_; lean_object* v___x_90_; 
v_name_88_ = lean_ctor_get(v_self_87_, 1);
lean_inc(v_name_88_);
lean_dec_ref(v_self_87_);
v___x_89_ = ((lean_object*)(l_Lake_ExternLib_staticTargetName___closed__0));
v___x_90_ = l_Lean_Name_str___override(v_name_88_, v___x_89_);
return v___x_90_;
}
}
lean_object* runtime_initialize_Lake_Config_ConfigTarget(uint8_t builtin);
static bool _G_runtime_initialized = false;
LEAN_EXPORT lean_object* runtime_initialize_Lake_Config_ExternLib(uint8_t builtin) {
lean_object * res;
if (_G_runtime_initialized) return lean_io_result_mk_ok(lean_box(0));
_G_runtime_initialized = true;
res = runtime_initialize_Lake_Config_ConfigTarget(builtin);
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
return lean_io_result_mk_ok(lean_box(0));
}
static bool _G_meta_initialized = false;
LEAN_EXPORT lean_object* meta_initialize_Lake_Config_ExternLib(uint8_t builtin) {
lean_object * res;
if (_G_meta_initialized) return lean_io_result_mk_ok(lean_box(0));
_G_meta_initialized = true;
return lean_io_result_mk_ok(lean_box(0));
}
lean_object* initialize_Lake_Config_ConfigTarget(uint8_t builtin);
static bool _G_initialized = false;
LEAN_EXPORT lean_object* initialize_Lake_Config_ExternLib(uint8_t builtin) {
lean_object * res;
if (_G_initialized) return lean_io_result_mk_ok(lean_box(0));
_G_initialized = true;
res = initialize_Lake_Config_ConfigTarget(builtin);
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = runtime_initialize_Lake_Config_ExternLib(builtin);
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = meta_initialize_Lake_Config_ExternLib(builtin);
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
return initialize_Lake_Config_ExternLib(builtin);
}
#ifdef __cplusplus
}
#endif
