// File: /workspace/github_c_makefile_star2_O1/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 0x455f
movq %rax, %rbx
movq %rax, %rdi
callq 0x80d4
testb %al, %al
je 0x20df3
testq %rbx, %rbx
je 0x20e04
cmpq $0x0, 0x3f737(%rip)     # 0x60420
jne 0x20cfa
movq %rbx, %rdi
callq 0x6a6c
movq %rax, 0x3f726(%rip)     # 0x60420
movq %rbx, %rdi
movl $0x48, %esi
callq 0x64bc
movq %rax, %r15
movq %rax, %rdi
callq 0x80d4
testb %al, %al
je 0x20e0f
testq %r15, %r15
je 0x20e04
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 0x3f3c3(%rip), %rax     # 0x60110
movq %rax, 0x18(%r15)
leaq 0x3f400(%rip), %rax     # 0x60158
movq %rax, 0x20(%r15)
leaq 0x3f43d(%rip), %rax     # 0x601a0
movq %rax, 0x28(%r15)
leaq 0x3f47a(%rip), %rax     # 0x601e8
movq %rax, 0x30(%r15)
leaq 0x3f4b7(%rip), %rax     # 0x60230
movq %rax, 0x38(%r15)
cmpq $0x0, 0x3f6a3(%rip)     # 0x60428
jne 0x20d96
movq %rbx, %rdi
callq 0x6a90
movq %rax, 0x3f692(%rip)     # 0x60428
leaq 0x13f(%rip), %rsi       # 0x20edc
movq %rbx, %rdi
callq 0x645c
leaq 0x5be(%rip), %rsi       # 0x2136a
movq %rbx, %rdi
callq 0x648c
testq %r14, %r14
je 0x20e20
addq $0x18, %r15
movq %r14, %rdi
callq 0x6ad8
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 0x21ca4
movq %rbx, %rdi
movq %rax, %rsi
callq 0x21710
jmp 0x20e06
leaq 0x1e246(%rip), %rdi     # 0x3f040
movq %rbx, %rsi
callq 0x829e
jmp 0x20e02
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x1e22a(%rip), %rdi     # 0x3f040
movq %r15, %rsi
callq 0x829e
jmp 0x20e1e
leaq 0x32769(%rip), %rsi     # 0x53590
movq %rbx, %rdi
callq 0x21710
movq %rbx, %rdi
movl $0x12c, %esi            # imm = 0x12C
movl $0xc8, %edx
callq 0x553f
callq 0x2e244
testq %rax, %rax
je 0x20ec8
movq %rax, %r14
movq 0x188(%rax), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x21c20
movq 0x190(%r14), %rdx
movq %rbx, %rdi
movl $0x1, %esi
callq 0x21c20
movq 0x198(%r14), %rdx
movq %rbx, %rdi
movl $0x2, %esi
callq 0x21c20
movq 0x1a0(%r14), %rdx
movq %rbx, %rdi
movl $0x3, %esi
callq 0x21c20
movq 0x1a8(%r14), %rdx
movq %rbx, %rdi
movl $0x4, %esi
callq 0x21c20
movq 0x1b0(%r14), %rdx
movq %rbx, %rdi
movl $0x5, %esi
callq 0x21c20
jmp 0x20e06
leaq 0x3f0d9(%rip), %rsi     # 0x5ffa8
movq %rbx, %rdi
callq 0x5d83
jmp 0x20e06