// File: /workspace/github_c_makefile_star2_O1/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_btn.c
// Function: lv_btn_create
lv_obj_t * lv_btn_create(lv_obj_t * par, const lv_obj_t * copy)
{
    LV_LOG_TRACE("button create started");

    lv_obj_t * new_btn;

    new_btn = lv_cont_create(par, copy);
    LV_ASSERT_MEM(new_btn);
    if(new_btn == NULL) return NULL;

    if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(new_btn);
    if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_cb(new_btn);

    /*Allocate the extended data*/
    lv_btn_ext_t * ext = lv_obj_allocate_ext_attr(new_btn, sizeof(lv_btn_ext_t));
    LV_ASSERT_MEM(ext);
    if(ext == NULL) return NULL;

    ext->state = LV_BTN_STATE_REL;

    ext->styles[LV_BTN_STATE_REL]     = &lv_style_btn_rel;
    ext->styles[LV_BTN_STATE_PR]      = &lv_style_btn_pr;
    ext->styles[LV_BTN_STATE_TGL_REL] = &lv_style_btn_tgl_rel;
    ext->styles[LV_BTN_STATE_TGL_PR]  = &lv_style_btn_tgl_pr;
    ext->styles[LV_BTN_STATE_INA]     = &lv_style_btn_ina;

    ext->toggle = 0;
#if LV_USE_ANIMATION && LV_BTN_INK_EFFECT
    ext->ink_in_time   = 0;
    ext->ink_wait_time = 0;
    ext->ink_out_time  = 0;
#endif

    lv_obj_set_signal_cb(new_btn, lv_btn_signal);
    lv_obj_set_design_cb(new_btn, lv_btn_design);

    /*If no copy do the basic initialization*/
    if(copy == NULL) {
        /*Set layout if the button is not a screen*/
        if(par != NULL) {
            lv_btn_set_layout(new_btn, LV_LAYOUT_CENTER);
        }

        lv_obj_set_click(new_btn, true); /*Be sure the button is clickable*/

        /*Set the default styles*/
        lv_theme_t * th = lv_theme_get_current();
        if(th) {
            lv_btn_set_style(new_btn, LV_BTN_STYLE_REL, th->style.btn.rel);
            lv_btn_set_style(new_btn, LV_BTN_STYLE_PR, th->style.btn.pr);
            lv_btn_set_style(new_btn, LV_BTN_STYLE_TGL_REL, th->style.btn.tgl_rel);
            lv_btn_set_style(new_btn, LV_BTN_STYLE_TGL_PR, th->style.btn.tgl_pr);
            lv_btn_set_style(new_btn, LV_BTN_STYLE_INA, th->style.btn.ina);
        } else {
            lv_obj_set_style(new_btn, ext->styles[LV_BTN_STATE_REL]);
        }
    }
    /*Copy 'copy'*/
    else {
        lv_btn_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
        ext->state              = copy_ext->state;
        ext->toggle             = copy_ext->toggle;
#if LV_USE_ANIMATION && LV_BTN_INK_EFFECT
        ext->ink_in_time   = copy_ext->ink_in_time;
        ext->ink_wait_time = copy_ext->ink_wait_time;
        ext->ink_out_time  = copy_ext->ink_out_time;
#endif
        memcpy((void*) ext->styles, copy_ext->styles, sizeof(ext->styles));

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

    LV_LOG_INFO("button created");

    return new_btn;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
callq 0x22398
movq %rax, %rbx
movq %rax, %rdi
callq 0x80d4
testb %al, %al
je 0x13220
testq %rbx, %rbx
je 0x13231
cmpq $0x0, 0x4d254(%rip)     # 0x60360
jne 0x1311d
movq %rbx, %rdi
callq 0x6a6c
movq %rax, 0x4d243(%rip)     # 0x60360
cmpq $0x0, 0x4d243(%rip)     # 0x60368
jne 0x13136
movq %rbx, %rdi
callq 0x6a90
movq %rax, 0x4d232(%rip)     # 0x60368
movq %rbx, %rdi
movl $0x38, %esi
callq 0x64bc
movq %rax, %r12
movq %rax, %rdi
callq 0x80d4
testb %al, %al
je 0x13240
testq %r12, %r12
je 0x13231
movq %r12, %r13
addq $0x8, %r13
leaq 0x4cfa3(%rip), %rax     # 0x60110
movq %rax, 0x8(%r12)
leaq 0x4cfdf(%rip), %rax     # 0x60158
movq %rax, 0x10(%r12)
leaq 0x4d01b(%rip), %rax     # 0x601a0
movq %rax, 0x18(%r12)
leaq 0x4d057(%rip), %rax     # 0x601e8
movq %rax, 0x20(%r12)
leaq 0x4d093(%rip), %rax     # 0x60230
movq %rax, 0x28(%r12)
andb $-0x10, 0x30(%r12)
leaq 0x136(%rip), %rsi       # 0x132e5
movq %rbx, %rdi
callq 0x645c
leaq 0x365(%rip), %rsi       # 0x13523
movq %rbx, %rdi
callq 0x648c
testq %r14, %r14
je 0x13251
movq %r14, %rdi
callq 0x6ad8
movb 0x30(%rax), %cl
andb $0x7, %cl
movb 0x30(%r12), %dl
andb $-0x8, %dl
orb %cl, %dl
movb %dl, 0x30(%r12)
movb 0x30(%rax), %cl
andb $0x8, %cl
andb $-0x9, %dl
orb %cl, %dl
movb %dl, 0x30(%r12)
movq 0x28(%rax), %rcx
movq %rcx, 0x20(%r13)
movups 0x8(%rax), %xmm0
movups 0x18(%rax), %xmm1
movups %xmm1, 0x10(%r13)
movups %xmm0, (%r13)
movq %rbx, %rdi
callq 0x5e38
jmp 0x13233
leaq 0x2be19(%rip), %rdi     # 0x3f040
movq %rbx, %rsi
callq 0x829e
jmp 0x1322f
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x2bdf9(%rip), %rdi     # 0x3f040
movq %r12, %rsi
callq 0x829e
jmp 0x1324f
testq %r15, %r15
je 0x13263
movq %rbx, %rdi
movl $0x1, %esi
callq 0x2259a
movq %rbx, %rdi
movl $0x1, %esi
callq 0x5fd8
callq 0x2e244
testq %rax, %rax
je 0x132d4
movq %rax, %r14
movq 0x20(%rax), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1353c
movq 0x28(%r14), %rdx
movq %rbx, %rdi
movl $0x1, %esi
callq 0x1353c
movq 0x30(%r14), %rdx
movq %rbx, %rdi
movl $0x2, %esi
callq 0x1353c
movq 0x38(%r14), %rdx
movq %rbx, %rdi
movl $0x3, %esi
callq 0x1353c
movq 0x40(%r14), %rdx
movq %rbx, %rdi
movl $0x4, %esi
callq 0x1353c
jmp 0x13233
movq (%r13), %rsi
movq %rbx, %rdi
callq 0x5d83
jmp 0x13233