// File: /workspace/github_c_makefile_star2_O3/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 0x22b18
movq %rax, %rbx
movq %rax, %rdi
callq 0x80e4
testb %al, %al
je 0x13250
testq %rbx, %rbx
je 0x13261
cmpq $0x0, 0x4d224(%rip)     # 0x60360
jne 0x1314d
movq %rbx, %rdi
callq 0x6a8b
movq %rax, 0x4d213(%rip)     # 0x60360
cmpq $0x0, 0x4d213(%rip)     # 0x60368
jne 0x13166
movq %rbx, %rdi
callq 0x6aaf
movq %rax, 0x4d202(%rip)     # 0x60368
movq %rbx, %rdi
movl $0x38, %esi
callq 0x64db
movq %rax, %r12
movq %rax, %rdi
callq 0x80e4
testb %al, %al
je 0x13270
testq %r12, %r12
je 0x13261
movq %r12, %r13
addq $0x8, %r13
leaq 0x4cf73(%rip), %rax     # 0x60110
movq %rax, 0x8(%r12)
leaq 0x4cfaf(%rip), %rax     # 0x60158
movq %rax, 0x10(%r12)
leaq 0x4cfeb(%rip), %rax     # 0x601a0
movq %rax, 0x18(%r12)
leaq 0x4d027(%rip), %rax     # 0x601e8
movq %rax, 0x20(%r12)
leaq 0x4d063(%rip), %rax     # 0x60230
movq %rax, 0x28(%r12)
andb $-0x10, 0x30(%r12)
leaq 0x136(%rip), %rsi       # 0x13315
movq %rbx, %rdi
callq 0x647b
leaq 0x32d(%rip), %rsi       # 0x1351b
movq %rbx, %rdi
callq 0x64ab
testq %r14, %r14
je 0x13281
movq %r14, %rdi
callq 0x6af7
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 0x5e54
jmp 0x13263
leaq 0x2be79(%rip), %rdi     # 0x3f0d0
movq %rbx, %rsi
callq 0x8294
jmp 0x1325f
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x2be59(%rip), %rdi     # 0x3f0d0
movq %r12, %rsi
callq 0x8294
jmp 0x1327f
testq %r15, %r15
je 0x13293
movq %rbx, %rdi
movl $0x1, %esi
callq 0x22d1c
movq %rbx, %rdi
movl $0x1, %esi
callq 0x5ff7
callq 0x2e91c
testq %rax, %rax
je 0x13304
movq %rax, %r14
movq 0x20(%rax), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x13534
movq 0x28(%r14), %rdx
movq %rbx, %rdi
movl $0x1, %esi
callq 0x13534
movq 0x30(%r14), %rdx
movq %rbx, %rdi
movl $0x2, %esi
callq 0x13534
movq 0x38(%r14), %rdx
movq %rbx, %rdi
movl $0x3, %esi
callq 0x13534
movq 0x40(%r14), %rdx
movq %rbx, %rdi
movl $0x4, %esi
callq 0x13534
jmp 0x13263
movq (%r13), %rsi
movq %rbx, %rdi
callq 0x5d9f
jmp 0x13263