// File: /workspace/github_c_makefile_star2_O0/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_cb.c
// Function: lv_cb_create
lv_obj_t * lv_cb_create(lv_obj_t * par, const lv_obj_t * copy)
{

    LV_LOG_TRACE("check box create started");

    /*Create the ancestor basic object*/
    lv_obj_t * new_cb = lv_btn_create(par, copy);
    LV_ASSERT_MEM(new_cb);
    if(new_cb == NULL) return NULL;

    if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(new_cb);
    if(ancestor_bg_design == NULL) ancestor_bg_design = lv_obj_get_design_cb(new_cb);

    lv_cb_ext_t * ext = lv_obj_allocate_ext_attr(new_cb, sizeof(lv_cb_ext_t));
    LV_ASSERT_MEM(ext);
    if(ext == NULL) return NULL;

    ext->bullet = NULL;
    ext->label  = NULL;

    lv_obj_set_signal_cb(new_cb, lv_cb_signal);
    lv_obj_set_design_cb(new_cb, lv_cb_design);

    /*Init the new checkbox object*/
    if(copy == NULL) {
        ext->bullet = lv_btn_create(new_cb, NULL);
        if(ancestor_bullet_design == NULL) ancestor_bullet_design = lv_obj_get_design_cb(ext->bullet);
        lv_obj_set_click(ext->bullet, false);

        ext->label = lv_label_create(new_cb, NULL);

        lv_cb_set_text(new_cb, "Check box");
        lv_btn_set_layout(new_cb, LV_LAYOUT_ROW_M);
        lv_btn_set_fit(new_cb, LV_FIT_TIGHT);
        lv_btn_set_toggle(new_cb, true);
        lv_obj_set_protect(new_cb, LV_PROTECT_PRESS_LOST);

        /*Set the default styles*/
        lv_theme_t * th = lv_theme_get_current();
        if(th) {
            lv_cb_set_style(new_cb, LV_CB_STYLE_BG, th->style.cb.bg);
            lv_cb_set_style(new_cb, LV_CB_STYLE_BOX_REL, th->style.cb.box.rel);
            lv_cb_set_style(new_cb, LV_CB_STYLE_BOX_PR, th->style.cb.box.pr);
            lv_cb_set_style(new_cb, LV_CB_STYLE_BOX_TGL_REL, th->style.cb.box.tgl_rel);
            lv_cb_set_style(new_cb, LV_CB_STYLE_BOX_TGL_PR, th->style.cb.box.tgl_pr);
            lv_cb_set_style(new_cb, LV_CB_STYLE_BOX_INA, th->style.cb.box.ina);
        } else {
            lv_cb_set_style(new_cb, LV_CB_STYLE_BG, &lv_style_transp);
            lv_cb_set_style(new_cb, LV_CB_STYLE_BOX_REL, &lv_style_pretty);
        }
    } else {
        lv_cb_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
        ext->bullet            = lv_btn_create(new_cb, copy_ext->bullet);
        ext->label             = lv_label_create(new_cb, copy_ext->label);

        /*Refresh the style with new signal function*/
        lv_obj_refresh_style(new_cb);
    }

    lv_obj_set_design_cb(ext->bullet, lv_bullet_design);

    LV_LOG_INFO("check box created");

    return new_cb;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x1fe90
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0xd120
testb $0x1, %al
jne 0xf8d0
movq -0x20(%rbp), %rsi
leaq 0x5877b(%rip), %rdi     # 0x68044
callq 0xd410
jmp 0xf8ce
cmpq $0x0, -0x20(%rbp)
jne 0xf8e4
movq $0x0, -0x8(%rbp)
jmp 0xfb81
cmpq $0x0, 0x79a8c(%rip)     # 0x89378
jne 0xf8fe
movq -0x20(%rbp), %rdi
callq 0xa830
movq %rax, 0x79a7a(%rip)     # 0x89378
cmpq $0x0, 0x79a7a(%rip)     # 0x89380
jne 0xf918
movq -0x20(%rbp), %rdi
callq 0xa870
movq %rax, 0x79a68(%rip)     # 0x89380
movq -0x20(%rbp), %rdi
movl $0x48, %esi
callq 0x9d60
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0xd120
testb $0x1, %al
jne 0xf949
movq -0x28(%rbp), %rsi
leaq 0x58702(%rip), %rdi     # 0x68044
callq 0xd410
jmp 0xf947
cmpq $0x0, -0x28(%rbp)
jne 0xf95d
movq $0x0, -0x8(%rbp)
jmp 0xfb81
movq -0x28(%rbp), %rax
movq $0x0, 0x38(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0x40(%rax)
movq -0x20(%rbp), %rdi
leaq 0x210(%rip), %rsi       # 0xfb90
callq 0x9cc0
movq -0x20(%rbp), %rdi
leaq 0x3b0(%rip), %rsi       # 0xfd40
callq 0x9d10
cmpq $0x0, -0x18(%rbp)
jne 0xfb17
movq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1fe90
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x38(%rax)
cmpq $0x0, 0x799c8(%rip)     # 0x89388
jne 0xf9d6
movq -0x28(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0xa870
movq %rax, 0x799b2(%rip)     # 0x89388
movq -0x28(%rbp), %rax
movq 0x38(%rax), %rdi
xorl %esi, %esi
callq 0x94b0
movq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x29820
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x20(%rbp), %rdi
leaq 0x58768(%rip), %rsi     # 0x68170
callq 0xfe10
movq -0x20(%rbp), %rdi
movl $0x6, %esi
callq 0xfe70
movq -0x20(%rbp), %rdi
movl $0x1, %esi
callq 0xfea0
movq -0x20(%rbp), %rdi
movl $0x1, %esi
callq 0x206b0
movq -0x20(%rbp), %rdi
movl $0x10, %esi
callq 0x9a50
callq 0x4cfc0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0xfaee
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x158(%rax), %rdx
xorl %esi, %esi
callq 0xfed0
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x160(%rax), %rdx
movl $0x1, %esi
callq 0xfed0
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x168(%rax), %rdx
movl $0x2, %esi
callq 0xfed0
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x170(%rax), %rdx
movl $0x3, %esi
callq 0xfed0
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x178(%rax), %rdx
movl $0x4, %esi
callq 0xfed0
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x180(%rax), %rdx
movl $0x5, %esi
callq 0xfed0
jmp 0xfb15
movq -0x20(%rbp), %rdi
xorl %esi, %esi
leaq 0x7960d(%rip), %rdx     # 0x89108
callq 0xfed0
movq -0x20(%rbp), %rdi
movl $0x1, %esi
leaq 0x79568(%rip), %rdx     # 0x89078
callq 0xfed0
jmp 0xfb65
movq -0x18(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x38(%rax), %rsi
callq 0x1fe90
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x20(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x40(%rax), %rsi
callq 0x29820
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x20(%rbp), %rdi
callq 0x9250
movq -0x28(%rbp), %rax
movq 0x38(%rax), %rdi
leaq 0x49c(%rip), %rsi       # 0x10010
callq 0x9d10
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)