// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r15
callq 0x122f0
movq %rax, %rbx
movq %rax, %rdi
callq 0x7994
testb %al, %al
je 0x8eef
testq %rbx, %rbx
je 0x8f00
cmpq $0x0, 0x55470(%rip)     # 0x5e2a8
jne 0x8e49
movq %rbx, %rdi
callq 0x66db
movq %rax, 0x5545f(%rip)     # 0x5e2a8
cmpq $0x0, 0x5545f(%rip)     # 0x5e2b0
jne 0x8e62
movq %rbx, %rdi
callq 0x66ff
movq %rax, 0x5544e(%rip)     # 0x5e2b0
pushq $0x48
popq %rsi
movq %rbx, %rdi
callq 0x6146
movq %rax, %r14
movq %rax, %rdi
callq 0x7994
testb %al, %al
je 0x8f07
testq %r14, %r14
je 0x8f00
movq %r14, %r12
addq $0x38, %r12
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%r14)
leaq 0x1b0(%rip), %rsi       # 0x904b
movq %rbx, %rdi
callq 0x60e6
leaq 0x250(%rip), %rsi       # 0x90fa
movq %rbx, %rdi
callq 0x6116
testq %r15, %r15
je 0x8f18
movq %r15, %rdi
callq 0x6747
movq %rax, %r15
movq 0x38(%rax), %rsi
movq %rbx, %rdi
callq 0x122f0
movq %rax, 0x38(%r14)
movq 0x40(%r15), %rsi
movq %rbx, %rdi
callq 0x182f0
movq %rax, 0x40(%r14)
movq %rbx, %rdi
callq 0x5ae7
jmp 0x902f
leaq 0x3214a(%rip), %rdi     # 0x3b040
movq %rbx, %rsi
callq 0x7b01
jmp 0x8efe
xorl %ebx, %ebx
jmp 0x903f
leaq 0x32132(%rip), %rdi     # 0x3b040
movq %r14, %rsi
callq 0x7b01
jmp 0x8f16
movq %rbx, %rdi
xorl %esi, %esi
callq 0x122f0
movq %rax, %rdi
movq %rax, (%r12)
cmpq $0x0, 0x55387(%rip)     # 0x5e2b8
jne 0x8f43
callq 0x66ff
movq %rax, 0x55379(%rip)     # 0x5e2b8
movq (%r12), %rdi
xorl %esi, %esi
callq 0x5c6f
movq %rbx, %rdi
xorl %esi, %esi
callq 0x182f0
movq %rax, 0x40(%r14)
leaq 0x32261(%rip), %rsi     # 0x3b1c0
movq %rbx, %rdi
callq 0x915a
pushq $0x6
popq %rsi
movq %rbx, %rdi
callq 0x20bca
pushq $0x1
popq %rbp
movq %rbx, %rdi
movl %ebp, %esi
movl %ebp, %edx
movl %ebp, %ecx
movl %ebp, %r8d
callq 0x20c30
movq %rbx, %rdi
movl %ebp, %esi
callq 0x1274d
pushq $0x10
popq %rsi
movq %rbx, %rdi
callq 0x5f71
callq 0x2be75
testq %rax, %rax
je 0x900c
movq %rax, %r14
movq 0x158(%rax), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x9199
movq 0x160(%r14), %rdx
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x9199
movq 0x168(%r14), %rdx
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x9199
movq 0x170(%r14), %rdx
pushq $0x3
popq %rsi
movq %rbx, %rdi
callq 0x9199
movq 0x178(%r14), %rdx
pushq $0x4
popq %rsi
movq %rbx, %rdi
callq 0x9199
movq 0x180(%r14), %rdx
pushq $0x5
jmp 0x9026
leaq 0x55025(%rip), %rdx     # 0x5e038
movq %rbx, %rdi
xorl %esi, %esi
callq 0x9199
leaq 0x54f84(%rip), %rdx     # 0x5dfa8
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x9199
movq (%r12), %rdi
leaq 0x222(%rip), %rsi       # 0x925c
callq 0x6116
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq