// File: /workspace/github_c_makefile_star2_O1/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 0x130d4
movq %rax, %rbx
movq %rax, %rdi
callq 0x80d4
testb %al, %al
je 0x9751
testq %rbx, %rbx
je 0x9762
cmpq $0x0, 0x56c10(%rip)     # 0x602a8
jne 0x96a9
movq %rbx, %rdi
callq 0x6a6c
movq %rax, 0x56bff(%rip)     # 0x602a8
cmpq $0x0, 0x56bff(%rip)     # 0x602b0
jne 0x96c2
movq %rbx, %rdi
callq 0x6a90
movq %rax, 0x56bee(%rip)     # 0x602b0
movq %rbx, %rdi
movl $0x48, %esi
callq 0x64bc
movq %rax, %r14
movq %rax, %rdi
callq 0x80d4
testb %al, %al
je 0x9769
testq %r14, %r14
je 0x9762
movq %r14, %r12
addq $0x38, %r12
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%r14)
leaq 0x1d3(%rip), %rsi       # 0x98d0
movq %rbx, %rdi
callq 0x645c
leaq 0x278(%rip), %rsi       # 0x9984
movq %rbx, %rdi
callq 0x648c
testq %r15, %r15
je 0x977a
movq %r15, %rdi
callq 0x6ad8
movq %rax, %r15
movq 0x38(%rax), %rsi
movq %rbx, %rdi
callq 0x130d4
movq %rax, 0x38(%r14)
movq 0x40(%r15), %rsi
movq %rbx, %rdi
callq 0x196f4
movq %rax, 0x40(%r14)
movq %rbx, %rdi
callq 0x5e38
jmp 0x98b1
leaq 0x358e8(%rip), %rdi     # 0x3f040
movq %rbx, %rsi
callq 0x829e
jmp 0x9760
xorl %ebx, %ebx
jmp 0x98c1
leaq 0x358d0(%rip), %rdi     # 0x3f040
movq %r14, %rsi
callq 0x829e
jmp 0x9778
movq %rbx, %rdi
xorl %esi, %esi
callq 0x130d4
movq %rax, (%r12)
cmpq $0x0, 0x56b28(%rip)     # 0x602b8
jne 0x97a1
movq %rax, %rdi
callq 0x6a90
movq %rax, 0x56b17(%rip)     # 0x602b8
movq 0x38(%r14), %rdi
xorl %esi, %esi
callq 0x5fd8
movq %rbx, %rdi
xorl %esi, %esi
callq 0x196f4
movq %rax, 0x40(%r14)
leaq 0x359ef(%rip), %rsi     # 0x3f1b0
movq %rbx, %rdi
callq 0x99dc
movq %rbx, %rdi
movl $0x6, %esi
callq 0x2259a
movq %rbx, %rdi
movl $0x1, %esi
movl $0x1, %edx
movl $0x1, %ecx
movl $0x1, %r8d
callq 0x22602
movq %rbx, %rdi
movl $0x1, %esi
callq 0x13591
movq %rbx, %rdi
movl $0x10, %esi
callq 0x62e7
callq 0x2e244
testq %rax, %rax
je 0x988c
movq %rax, %r14
movq 0x158(%rax), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x9a1b
movq 0x160(%r14), %rdx
movq %rbx, %rdi
movl $0x1, %esi
callq 0x9a1b
movq 0x168(%r14), %rdx
movq %rbx, %rdi
movl $0x2, %esi
callq 0x9a1b
movq 0x170(%r14), %rdx
movq %rbx, %rdi
movl $0x3, %esi
callq 0x9a1b
movq 0x178(%r14), %rdx
movq %rbx, %rdi
movl $0x4, %esi
callq 0x9a1b
movq 0x180(%r14), %rdx
movq %rbx, %rdi
movl $0x5, %esi
jmp 0x98ac
leaq 0x567a5(%rip), %rdx     # 0x60038
movq %rbx, %rdi
xorl %esi, %esi
callq 0x9a1b
leaq 0x56704(%rip), %rdx     # 0x5ffa8
movq %rbx, %rdi
movl $0x1, %esi
callq 0x9a1b
movq (%r12), %rdi
leaq 0x230(%rip), %rsi       # 0x9aec
callq 0x648c
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq