// File: /workspace/github_c_makefile_star2_O3/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 0x454f
movq %rax, %rbx
movq %rax, %rdi
callq 0x80e4
testb %al, %al
je 0x215c7
testq %rbx, %rbx
je 0x215d8
cmpq $0x0, 0x3ef63(%rip)     # 0x60420
jne 0x214ce
movq %rbx, %rdi
callq 0x6a8b
movq %rax, 0x3ef52(%rip)     # 0x60420
movq %rbx, %rdi
movl $0x48, %esi
callq 0x64db
movq %rax, %r15
movq %rax, %rdi
callq 0x80e4
testb %al, %al
je 0x215e3
testq %r15, %r15
je 0x215d8
movl $0xffff0000, 0x40(%r15) # imm = 0xFFFF0000
movw $0xffff, 0x44(%r15)     # imm = 0xFFFF
xorps %xmm0, %xmm0
movups %xmm0, (%r15)
movq $0x0, 0x10(%r15)
andb $-0x4, 0x46(%r15)
leaq 0x3ebef(%rip), %rax     # 0x60110
movq %rax, 0x18(%r15)
leaq 0x3ec2c(%rip), %rax     # 0x60158
movq %rax, 0x20(%r15)
leaq 0x3ec69(%rip), %rax     # 0x601a0
movq %rax, 0x28(%r15)
leaq 0x3eca6(%rip), %rax     # 0x601e8
movq %rax, 0x30(%r15)
leaq 0x3ece3(%rip), %rax     # 0x60230
movq %rax, 0x38(%r15)
cmpq $0x0, 0x3eecf(%rip)     # 0x60428
jne 0x2156a
movq %rbx, %rdi
callq 0x6aaf
movq %rax, 0x3eebe(%rip)     # 0x60428
leaq 0x13f(%rip), %rsi       # 0x216b0
movq %rbx, %rdi
callq 0x647b
leaq 0x603(%rip), %rsi       # 0x21b83
movq %rbx, %rdi
callq 0x64ab
testq %r14, %r14
je 0x215f4
addq $0x18, %r15
movq %r14, %rdi
callq 0x6af7
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 0x22463
movq %rbx, %rdi
movq %rax, %rsi
callq 0x21f33
jmp 0x215da
leaq 0x1db02(%rip), %rdi     # 0x3f0d0
movq %rbx, %rsi
callq 0x8294
jmp 0x215d6
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x1dae6(%rip), %rdi     # 0x3f0d0
movq %r15, %rsi
callq 0x8294
jmp 0x215f2
leaq 0x31f95(%rip), %rsi     # 0x53590
movq %rbx, %rdi
callq 0x21f33
movq %rbx, %rdi
movl $0x12c, %esi            # imm = 0x12C
movl $0xc8, %edx
callq 0x5557
callq 0x2e91c
testq %rax, %rax
je 0x2169c
movq %rax, %r14
movq 0x188(%rax), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x223df
movq 0x190(%r14), %rdx
movq %rbx, %rdi
movl $0x1, %esi
callq 0x223df
movq 0x198(%r14), %rdx
movq %rbx, %rdi
movl $0x2, %esi
callq 0x223df
movq 0x1a0(%r14), %rdx
movq %rbx, %rdi
movl $0x3, %esi
callq 0x223df
movq 0x1a8(%r14), %rdx
movq %rbx, %rdi
movl $0x4, %esi
callq 0x223df
movq 0x1b0(%r14), %rdx
movq %rbx, %rdi
movl $0x5, %esi
callq 0x223df
jmp 0x215da
leaq 0x3e905(%rip), %rsi     # 0x5ffa8
movq %rbx, %rdi
callq 0x5d9f
jmp 0x215da