// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
callq 0x13104
movq %rax, %rbx
movq %rax, %rdi
callq 0x80e4
testb %al, %al
je 0x96d5
testq %rbx, %rbx
je 0x96e6
cmpq $0x0, 0x56c8c(%rip)     # 0x602a8
jne 0x962d
movq %rbx, %rdi
callq 0x6a8b
movq %rax, 0x56c7b(%rip)     # 0x602a8
cmpq $0x0, 0x56c7b(%rip)     # 0x602b0
jne 0x9646
movq %rbx, %rdi
callq 0x6aaf
movq %rax, 0x56c6a(%rip)     # 0x602b0
movq %rbx, %rdi
movl $0x48, %esi
callq 0x64db
movq %rax, %r14
movq %rax, %rdi
callq 0x80e4
testb %al, %al
je 0x96ed
testq %r14, %r14
je 0x96e6
movq %r14, %r12
addq $0x38, %r12
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%r14)
leaq 0x1d3(%rip), %rsi       # 0x9854
movq %rbx, %rdi
callq 0x647b
leaq 0x27a(%rip), %rsi       # 0x990a
movq %rbx, %rdi
callq 0x64ab
testq %r15, %r15
je 0x96fe
movq %r15, %rdi
callq 0x6af7
movq %rax, %r15
movq 0x38(%rax), %rsi
movq %rbx, %rdi
callq 0x13104
movq %rax, 0x38(%r14)
movq 0x40(%r15), %rsi
movq %rbx, %rdi
callq 0x19ed4
movq %rax, 0x40(%r14)
movq %rbx, %rdi
callq 0x5e54
jmp 0x9835
leaq 0x359f4(%rip), %rdi     # 0x3f0d0
movq %rbx, %rsi
callq 0x8294
jmp 0x96e4
xorl %ebx, %ebx
jmp 0x9845
leaq 0x359dc(%rip), %rdi     # 0x3f0d0
movq %r14, %rsi
callq 0x8294
jmp 0x96fc
movq %rbx, %rdi
xorl %esi, %esi
callq 0x13104
movq %rax, %rdi
movq %rax, (%r12)
cmpq $0x0, 0x56ba1(%rip)     # 0x602b8
jne 0x9729
callq 0x6aaf
movq %rax, 0x56b93(%rip)     # 0x602b8
movq (%r12), %rdi
xorl %esi, %esi
callq 0x5ff7
movq %rbx, %rdi
xorl %esi, %esi
callq 0x19ed4
movq %rax, 0x40(%r14)
leaq 0x35b1b(%rip), %rsi     # 0x3f260
movq %rbx, %rdi
callq 0x996a
movq %rbx, %rdi
movl $0x6, %esi
callq 0x22d1c
movq %rbx, %rdi
movl $0x1, %esi
movl $0x1, %edx
movl $0x1, %ecx
movl $0x1, %r8d
callq 0x22d84
movq %rbx, %rdi
movl $0x1, %esi
callq 0x13589
movq %rbx, %rdi
movl $0x10, %esi
callq 0x6306
callq 0x2e91c
testq %rax, %rax
je 0x9810
movq %rax, %r14
movq 0x158(%rax), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x99a9
movq 0x160(%r14), %rdx
movq %rbx, %rdi
movl $0x1, %esi
callq 0x99a9
movq 0x168(%r14), %rdx
movq %rbx, %rdi
movl $0x2, %esi
callq 0x99a9
movq 0x170(%r14), %rdx
movq %rbx, %rdi
movl $0x3, %esi
callq 0x99a9
movq 0x178(%r14), %rdx
movq %rbx, %rdi
movl $0x4, %esi
callq 0x99a9
movq 0x180(%r14), %rdx
movq %rbx, %rdi
movl $0x5, %esi
jmp 0x9830
leaq 0x56821(%rip), %rdx     # 0x60038
movq %rbx, %rdi
xorl %esi, %esi
callq 0x99a9
leaq 0x56780(%rip), %rdx     # 0x5ffa8
movq %rbx, %rdi
movl $0x1, %esi
callq 0x99a9
movq (%r12), %rdi
leaq 0x23a(%rip), %rsi       # 0x9a7a
callq 0x64ab
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq