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

    /*Create the ancestor object*/
    lv_obj_t * new_btnm = lv_obj_create(par, copy);
    LV_ASSERT_MEM(new_btnm);
    if(new_btnm == NULL) return NULL;

    if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(new_btnm);

    /*Allocate the object type specific extended data*/
    lv_btnm_ext_t * ext = lv_obj_allocate_ext_attr(new_btnm, sizeof(lv_btnm_ext_t));
    LV_ASSERT_MEM(ext);
    if(ext == NULL) return NULL;

    ext->btn_cnt                          = 0;
    ext->btn_id_pr                        = LV_BTNM_BTN_NONE;
    ext->btn_id_act                       = LV_BTNM_BTN_NONE;
    ext->button_areas                     = NULL;
    ext->ctrl_bits                        = NULL;
    ext->map_p                            = NULL;
    ext->recolor                          = 0;
    ext->one_toggle                       = 0;
    ext->styles_btn[LV_BTN_STATE_REL]     = &lv_style_btn_rel;
    ext->styles_btn[LV_BTN_STATE_PR]      = &lv_style_btn_pr;
    ext->styles_btn[LV_BTN_STATE_TGL_REL] = &lv_style_btn_tgl_rel;
    ext->styles_btn[LV_BTN_STATE_TGL_PR]  = &lv_style_btn_tgl_pr;
    ext->styles_btn[LV_BTN_STATE_INA]     = &lv_style_btn_ina;

    if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_cb(new_btnm);

    lv_obj_set_signal_cb(new_btnm, lv_btnm_signal);
    lv_obj_set_design_cb(new_btnm, lv_btnm_design);

    /*Init the new button matrix object*/
    if(copy == NULL) {
        lv_btnm_set_map(new_btnm, lv_btnm_def_map);
        lv_obj_set_size(new_btnm, LV_DPI * 3, LV_DPI * 2);

        /*Set the default styles*/
        lv_theme_t * th = lv_theme_get_current();
        if(th) {
            lv_btnm_set_style(new_btnm, LV_BTNM_STYLE_BG, th->style.btnm.bg);
            lv_btnm_set_style(new_btnm, LV_BTNM_STYLE_BTN_REL, th->style.btnm.btn.rel);
            lv_btnm_set_style(new_btnm, LV_BTNM_STYLE_BTN_PR, th->style.btnm.btn.pr);
            lv_btnm_set_style(new_btnm, LV_BTNM_STYLE_BTN_TGL_REL, th->style.btnm.btn.tgl_rel);
            lv_btnm_set_style(new_btnm, LV_BTNM_STYLE_BTN_TGL_PR, th->style.btnm.btn.tgl_pr);
            lv_btnm_set_style(new_btnm, LV_BTNM_STYLE_BTN_INA, th->style.btnm.btn.ina);
        } else {
            lv_obj_set_style(new_btnm, &lv_style_pretty);
        }
    }
    /*Copy an existing object*/
    else {
        lv_btnm_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
        memcpy((void*)ext->styles_btn, copy_ext->styles_btn, sizeof(ext->styles_btn));
        lv_btnm_set_map(new_btnm, lv_btnm_get_map_array(copy));
    }

    LV_LOG_INFO("button matrix created");

    return new_btnm;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
callq 0x42c9
movq %rax, %rbx
movq %rax, %rdi
callq 0x7994
testb %al, %al
je 0x1f555
testq %rbx, %rbx
je 0x1f566
cmpq $0x0, 0x3efcf(%rip)     # 0x5e420
jne 0x1f462
movq %rbx, %rdi
callq 0x66db
movq %rax, 0x3efbe(%rip)     # 0x5e420
pushq $0x48
popq %rsi
movq %rbx, %rdi
callq 0x6146
movq %rax, %r15
movq %rax, %rdi
callq 0x7994
testb %al, %al
je 0x1f571
testq %r15, %r15
je 0x1f566
movl $0xffff0000, 0x40(%r15) # imm = 0xFFFF0000
orw $-0x1, 0x44(%r15)
xorps %xmm0, %xmm0
andq $0x0, 0x10(%r15)
movups %xmm0, (%r15)
andb $-0x4, 0x46(%r15)
leaq 0x3ec61(%rip), %rax     # 0x5e110
movq %rax, 0x18(%r15)
leaq 0x3ec9e(%rip), %rax     # 0x5e158
movq %rax, 0x20(%r15)
leaq 0x3ecdb(%rip), %rax     # 0x5e1a0
movq %rax, 0x28(%r15)
leaq 0x3ed18(%rip), %rax     # 0x5e1e8
movq %rax, 0x30(%r15)
leaq 0x3ed55(%rip), %rax     # 0x5e230
movq %rax, 0x38(%r15)
cmpq $0x0, 0x3ef41(%rip)     # 0x5e428
jne 0x1f4f8
movq %rbx, %rdi
callq 0x66ff
movq %rax, 0x3ef30(%rip)     # 0x5e428
leaq 0x135(%rip), %rsi       # 0x1f634
movq %rbx, %rdi
callq 0x60e6
leaq 0x5b8(%rip), %rsi       # 0x1fac6
movq %rbx, %rdi
callq 0x6116
testq %r14, %r14
je 0x1f582
addq $0x18, %r15
movq %r14, %rdi
callq 0x6747
movups 0x18(%rax), %xmm0
movups 0x28(%rax), %xmm1
movups %xmm0, (%r15)
movups %xmm1, 0x10(%r15)
movq 0x38(%rax), %rax
movq %rax, 0x20(%r15)
movq %r14, %rdi
callq 0x2033d
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1fe53
jmp 0x1f568
leaq 0x1bae4(%rip), %rdi     # 0x3b040
movq %rbx, %rsi
callq 0x7b01
jmp 0x1f564
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x1bac8(%rip), %rdi     # 0x3b040
movq %r15, %rsi
callq 0x7b01
jmp 0x1f580
leaq 0x32007(%rip), %rsi     # 0x51590
movq %rbx, %rdi
callq 0x1fe53
movq %rbx, %rdi
movl $0x12c, %esi            # imm = 0x12C
movl $0xc8, %edx
callq 0x520e
callq 0x2be75
testq %rax, %rax
je 0x1f620
movq %rax, %r14
movq 0x188(%rax), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x202b9
movq 0x190(%r14), %rdx
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x202b9
movq 0x198(%r14), %rdx
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x202b9
movq 0x1a0(%r14), %rdx
pushq $0x3
popq %rsi
movq %rbx, %rdi
callq 0x202b9
movq 0x1a8(%r14), %rdx
pushq $0x4
popq %rsi
movq %rbx, %rdi
callq 0x202b9
movq 0x1b0(%r14), %rdx
pushq $0x5
popq %rsi
movq %rbx, %rdi
callq 0x202b9
jmp 0x1f568
leaq 0x3e981(%rip), %rsi     # 0x5dfa8
movq %rbx, %rdi
callq 0x5a3d
jmp 0x1f568