// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x381b0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0xd120
testb $0x1, %al
jne 0x1fed0
movq -0x20(%rbp), %rsi
leaq 0x4817b(%rip), %rdi     # 0x68044
callq 0xd410
jmp 0x1fece
cmpq $0x0, -0x20(%rbp)
jne 0x1fee4
movq $0x0, -0x8(%rbp)
jmp 0x2011c
cmpq $0x0, 0x69544(%rip)     # 0x89430
jne 0x1fefe
movq -0x20(%rbp), %rdi
callq 0xa830
movq %rax, 0x69532(%rip)     # 0x89430
cmpq $0x0, 0x69532(%rip)     # 0x89438
jne 0x1ff18
movq -0x20(%rbp), %rdi
callq 0xa870
movq %rax, 0x69520(%rip)     # 0x89438
movq -0x20(%rbp), %rdi
movl $0x38, %esi
callq 0x9d60
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0xd120
testb $0x1, %al
jne 0x1ff49
movq -0x28(%rbp), %rsi
leaq 0x48102(%rip), %rdi     # 0x68044
callq 0xd410
jmp 0x1ff47
cmpq $0x0, -0x28(%rbp)
jne 0x1ff5d
movq $0x0, -0x8(%rbp)
jmp 0x2011c
movq -0x28(%rbp), %rax
movb 0x30(%rax), %cl
andb $-0x8, %cl
orb $0x0, %cl
movb %cl, 0x30(%rax)
movq -0x28(%rbp), %rax
leaq 0x69268(%rip), %rcx     # 0x891e0
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rax
leaq 0x692a1(%rip), %rcx     # 0x89228
movq %rcx, 0x10(%rax)
movq -0x28(%rbp), %rax
leaq 0x692da(%rip), %rcx     # 0x89270
movq %rcx, 0x18(%rax)
movq -0x28(%rbp), %rax
leaq 0x69313(%rip), %rcx     # 0x892b8
movq %rcx, 0x20(%rax)
movq -0x28(%rbp), %rax
leaq 0x6934c(%rip), %rcx     # 0x89300
movq %rcx, 0x28(%rax)
movq -0x28(%rbp), %rax
movb 0x30(%rax), %cl
andb $-0x9, %cl
orb $0x0, %cl
movb %cl, 0x30(%rax)
movq -0x20(%rbp), %rdi
leaq 0x15d(%rip), %rsi       # 0x20130
callq 0x9cc0
movq -0x20(%rbp), %rdi
leaq 0x54d(%rip), %rsi       # 0x20530
callq 0x9d10
cmpq $0x0, -0x18(%rbp)
jne 0x200a6
cmpq $0x0, -0x10(%rbp)
je 0x20008
movq -0x20(%rbp), %rdi
movl $0x1, %esi
callq 0x205b0
movq -0x20(%rbp), %rdi
movl $0x1, %esi
callq 0x94b0
callq 0x4cfc0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x20093
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rdx
xorl %esi, %esi
callq 0x205e0
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rdx
movl $0x1, %esi
callq 0x205e0
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rdx
movl $0x2, %esi
callq 0x205e0
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x38(%rax), %rdx
movl $0x3, %esi
callq 0x205e0
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rdx
movl $0x4, %esi
callq 0x205e0
jmp 0x200a4
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x9150
jmp 0x20114
movq -0x18(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movb 0x30(%rax), %dl
andb $0x7, %dl
movq -0x28(%rbp), %rax
movb 0x30(%rax), %cl
andb $0x7, %dl
andb $-0x8, %cl
orb %dl, %cl
movb %cl, 0x30(%rax)
movq -0x38(%rbp), %rax
movb 0x30(%rax), %dl
shrb $0x3, %dl
andb $0x1, %dl
movq -0x28(%rbp), %rax
movb 0x30(%rax), %cl
andb $0x1, %dl
shlb $0x3, %dl
andb $-0x9, %cl
orb %dl, %cl
movb %cl, 0x30(%rax)
movq -0x28(%rbp), %rdi
addq $0x8, %rdi
movq -0x38(%rbp), %rsi
addq $0x8, %rsi
movl $0x28, %edx
callq 0x20e0
movq -0x20(%rbp), %rdi
callq 0x9250
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)