// File: /workspace/github_c_makefile_star2_O0/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_btnm.c
// Function: lv_btnm_design
static bool lv_btnm_design(lv_obj_t * btnm, const lv_area_t * mask, lv_design_mode_t mode)
{
    if(mode == LV_DESIGN_COVER_CHK) {
        return ancestor_design_f(btnm, mask, mode);
        /*Return false if the object is not covers the mask_p area*/
    }
    /*Draw the object*/
    else if(mode == LV_DESIGN_DRAW_MAIN) {
        ancestor_design_f(btnm, mask, mode);

        lv_btnm_ext_t * ext         = lv_obj_get_ext_attr(btnm);
        const lv_style_t * bg_style = lv_obj_get_style(btnm);
        const lv_style_t * btn_style;
        lv_opa_t opa_scale = lv_obj_get_opa_scale(btnm);

        lv_area_t area_btnm;
        lv_obj_get_coords(btnm, &area_btnm);

        lv_area_t area_tmp;
        lv_coord_t btn_w;
        lv_coord_t btn_h;

        uint16_t btn_i = 0;
        uint16_t txt_i = 0;
        lv_style_t style_tmp;
        lv_txt_flag_t txt_flag = LV_TXT_FLAG_NONE;

        if(ext->recolor) txt_flag = LV_TXT_FLAG_RECOLOR;
        for(btn_i = 0; btn_i < ext->btn_cnt; btn_i++, txt_i++) {
            /*Search the next valid text in the map*/
            while(strcmp(ext->map_p[txt_i], "\n") == 0) {
                txt_i++;
            }

            /*Skip hidden buttons*/
            if(button_is_hidden(ext->ctrl_bits[btn_i])) continue;

            lv_area_copy(&area_tmp, &ext->button_areas[btn_i]);
            area_tmp.x1 += area_btnm.x1;
            area_tmp.y1 += area_btnm.y1;
            area_tmp.x2 += area_btnm.x1;
            area_tmp.y2 += area_btnm.y1;

            btn_w = lv_area_get_width(&area_tmp);
            btn_h = lv_area_get_height(&area_tmp);

            /*Load the style*/
            bool tgl_state = button_get_tgl_state(ext->ctrl_bits[btn_i]);
            if(button_is_inactive(ext->ctrl_bits[btn_i]))
                btn_style = lv_btnm_get_style(btnm, LV_BTNM_STYLE_BTN_INA);
            else if(btn_i != ext->btn_id_pr && tgl_state == false)
                btn_style = lv_btnm_get_style(btnm, LV_BTNM_STYLE_BTN_REL);
            else if(btn_i == ext->btn_id_pr && tgl_state == false)
                btn_style = lv_btnm_get_style(btnm, LV_BTNM_STYLE_BTN_PR);
            else if(btn_i != ext->btn_id_pr && tgl_state == true)
                btn_style = lv_btnm_get_style(btnm, LV_BTNM_STYLE_BTN_TGL_REL);
            else if(btn_i == ext->btn_id_pr && tgl_state == true)
                btn_style = lv_btnm_get_style(btnm, LV_BTNM_STYLE_BTN_TGL_PR);
            else
                btn_style = lv_btnm_get_style(btnm, LV_BTNM_STYLE_BTN_REL); /*Not possible option, just to be sure*/

            lv_style_copy(&style_tmp, btn_style);

            /*Remove borders on the edges if `LV_BORDER_INTERNAL`*/
            if(style_tmp.body.border.part & LV_BORDER_INTERNAL) {
                if(area_tmp.y1 == btnm->coords.y1 + bg_style->body.padding.top) {
                    style_tmp.body.border.part &= ~LV_BORDER_TOP;
                }
                if(area_tmp.y2 == btnm->coords.y2 - bg_style->body.padding.bottom) {
                    style_tmp.body.border.part &= ~LV_BORDER_BOTTOM;
                }

                if(txt_i == 0) {
                    style_tmp.body.border.part &= ~LV_BORDER_LEFT;
                } else if(strcmp(ext->map_p[txt_i - 1], "\n") == 0) {
                    style_tmp.body.border.part &= ~LV_BORDER_LEFT;
                }

                if(ext->map_p[txt_i + 1][0] == '\0' || strcmp(ext->map_p[txt_i + 1], "\n") == 0) {
                    style_tmp.body.border.part &= ~LV_BORDER_RIGHT;
                }
            }
            lv_draw_rect(&area_tmp, mask, &style_tmp, opa_scale);

            /*Calculate the size of the text*/
            if(btn_style->glass) btn_style = bg_style;
            const lv_font_t * font = btn_style->text.font;
            lv_point_t txt_size;
            lv_txt_get_size(&txt_size, ext->map_p[txt_i], font, btn_style->text.letter_space,
                            btn_style->text.line_space, lv_area_get_width(&area_btnm), txt_flag);

            area_tmp.x1 += (btn_w - txt_size.x) / 2;
            area_tmp.y1 += (btn_h - txt_size.y) / 2;
            area_tmp.x2 = area_tmp.x1 + txt_size.x;
            area_tmp.y2 = area_tmp.y1 + txt_size.y;

            lv_draw_label(&area_tmp, mask, btn_style, opa_scale, ext->map_p[txt_i], txt_flag, NULL, NULL, NULL, lv_obj_get_base_dir(btnm));
        }
    }

    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movb %dl, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movb %al, -0x19(%rbp)
movzbl -0x19(%rbp), %eax
cmpl $0x2, %eax
jne 0x366d0
movq 0x52e40(%rip), %rax     # 0x894f8
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movzbl -0x19(%rbp), %edx
callq *%rax
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x36c6c
movzbl -0x19(%rbp), %eax
cmpl $0x0, %eax
jne 0x36c66
movq 0x52e14(%rip), %rax     # 0x894f8
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movzbl -0x19(%rbp), %edx
callq *%rax
movq -0x10(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
callq 0xa080
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
callq 0xa710
movb %al, -0x39(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x42(%rbp), %rsi
callq 0x7fb0
movw $0x0, -0x50(%rbp)
movw $0x0, -0x52(%rbp)
movb $0x0, -0xa1(%rbp)
movq -0x28(%rbp), %rax
movb 0x46(%rax), %al
andb $0x1, %al
cmpb $0x0, %al
je 0x3674c
movb $0x1, -0xa1(%rbp)
movw $0x0, -0x50(%rbp)
movzwl -0x50(%rbp), %eax
movq -0x28(%rbp), %rcx
movzwl 0x40(%rcx), %ecx
cmpl %ecx, %eax
jge 0x36c64
jmp 0x36768
movq -0x28(%rbp), %rax
movq (%rax), %rax
movzwl -0x52(%rbp), %ecx
movq (%rax,%rcx,8), %rdi
leaq 0x35996(%rip), %rsi     # 0x6c114
callq 0x20d0
cmpl $0x0, %eax
jne 0x36796
movw -0x52(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x52(%rbp)
jmp 0x36768
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movzwl -0x50(%rbp), %ecx
movzwl (%rax,%rcx,2), %edi
callq 0x37f40
testb $0x1, %al
jne 0x367b1
jmp 0x367b6
jmp 0x36c47
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rsi
movzwl -0x50(%rbp), %eax
shlq $0x3, %rax
addq %rax, %rsi
leaq -0x4a(%rbp), %rdi
callq 0x37f70
movswl -0x42(%rbp), %ecx
movswl -0x4a(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x4a(%rbp)
movswl -0x40(%rbp), %ecx
movswl -0x48(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x48(%rbp)
movswl -0x42(%rbp), %ecx
movswl -0x46(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x46(%rbp)
movswl -0x40(%rbp), %ecx
movswl -0x44(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x44(%rbp)
leaq -0x4a(%rbp), %rdi
callq 0x37f90
movw %ax, -0x4c(%rbp)
leaq -0x4a(%rbp), %rdi
callq 0x37fb0
movw %ax, -0x4e(%rbp)
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movzwl -0x50(%rbp), %ecx
movzwl (%rax,%rcx,2), %edi
callq 0x37fd0
andb $0x1, %al
movb %al, -0xa2(%rbp)
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movzwl -0x50(%rbp), %ecx
movzwl (%rax,%rcx,2), %edi
callq 0x38000
testb $0x1, %al
jne 0x3685c
jmp 0x36873
movq -0x10(%rbp), %rdi
movl $0x5, %esi
callq 0x37530
movq %rax, -0x38(%rbp)
jmp 0x36960
movzwl -0x50(%rbp), %eax
movq -0x28(%rbp), %rcx
movzwl 0x42(%rcx), %ecx
cmpl %ecx, %eax
je 0x368aa
movb -0xa2(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x368aa
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x37530
movq %rax, -0x38(%rbp)
jmp 0x3695e
movzwl -0x50(%rbp), %eax
movq -0x28(%rbp), %rcx
movzwl 0x42(%rcx), %ecx
cmpl %ecx, %eax
jne 0x368de
movb -0xa2(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x368de
movq -0x10(%rbp), %rdi
movl $0x2, %esi
callq 0x37530
movq %rax, -0x38(%rbp)
jmp 0x3695c
movzwl -0x50(%rbp), %eax
movq -0x28(%rbp), %rcx
movzwl 0x42(%rcx), %ecx
cmpl %ecx, %eax
je 0x36912
movb -0xa2(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x36912
movq -0x10(%rbp), %rdi
movl $0x3, %esi
callq 0x37530
movq %rax, -0x38(%rbp)
jmp 0x3695a
movzwl -0x50(%rbp), %eax
movq -0x28(%rbp), %rcx
movzwl 0x42(%rcx), %ecx
cmpl %ecx, %eax
jne 0x36946
movb -0xa2(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x36946
movq -0x10(%rbp), %rdi
movl $0x4, %esi
callq 0x37530
movq %rax, -0x38(%rbp)
jmp 0x36958
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x37530
movq %rax, -0x38(%rbp)
jmp 0x3695a
jmp 0x3695c
jmp 0x3695e
jmp 0x36960
movq -0x38(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
callq 0xc550
movzbl -0x92(%rbp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x36a7f
movswl -0x48(%rbp), %eax
movq -0x10(%rbp), %rcx
movswl 0x22(%rcx), %ecx
movq -0x30(%rbp), %rdx
movswl 0x16(%rdx), %edx
addl %edx, %ecx
cmpl %ecx, %eax
jne 0x369ad
movzbl -0x92(%rbp), %eax
andl $-0x3, %eax
movb %al, -0x92(%rbp)
movswl -0x44(%rbp), %eax
movq -0x10(%rbp), %rcx
movswl 0x26(%rcx), %ecx
movq -0x30(%rbp), %rdx
movswl 0x18(%rdx), %edx
subl %edx, %ecx
cmpl %ecx, %eax
jne 0x369d7
movzbl -0x92(%rbp), %eax
andl $-0x2, %eax
movb %al, -0x92(%rbp)
movzwl -0x52(%rbp), %eax
cmpl $0x0, %eax
jne 0x369f2
movzbl -0x92(%rbp), %eax
andl $-0x5, %eax
movb %al, -0x92(%rbp)
jmp 0x36a2a
movq -0x28(%rbp), %rax
movq (%rax), %rax
movzwl -0x52(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x35706(%rip), %rsi     # 0x6c114
callq 0x20d0
cmpl $0x0, %eax
jne 0x36a28
movzbl -0x92(%rbp), %eax
andl $-0x5, %eax
movb %al, -0x92(%rbp)
jmp 0x36a2a
movq -0x28(%rbp), %rax
movq (%rax), %rax
movzwl -0x52(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x36a6d
movq -0x28(%rbp), %rax
movq (%rax), %rax
movzwl -0x52(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x356b1(%rip), %rsi     # 0x6c114
callq 0x20d0
cmpl $0x0, %eax
jne 0x36a7d
movzbl -0x92(%rbp), %eax
andl $-0x9, %eax
movb %al, -0x92(%rbp)
jmp 0x36a7f
movq -0x18(%rbp), %rsi
leaq -0x4a(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
movzbl -0x39(%rbp), %ecx
callq 0x5a9e0
movq -0x38(%rbp), %rax
movb (%rax), %al
andb $0x1, %al
cmpb $0x0, %al
je 0x36aab
movq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0xb0(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movzwl -0x52(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, -0xf0(%rbp)
movq -0xb0(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0x38(%rbp), %rax
movw 0x30(%rax), %ax
movw %ax, -0xdc(%rbp)
movq -0x38(%rbp), %rax
movw 0x32(%rax), %ax
movw %ax, -0xda(%rbp)
leaq -0x42(%rbp), %rdi
callq 0x37f90
movq -0xf0(%rbp), %rsi
movq -0xe8(%rbp), %rdx
movw -0xdc(%rbp), %cx
movw -0xda(%rbp), %r8w
leaq -0xb4(%rbp), %rdi
movswl %cx, %ecx
movswl %r8w, %r8d
movswl %ax, %r9d
movzbl -0xa1(%rbp), %eax
movl %eax, (%rsp)
callq 0x46820
movswl -0x4c(%rbp), %eax
movswl -0xb4(%rbp), %ecx
subl %ecx, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movswl -0x4a(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x4a(%rbp)
movswl -0x4e(%rbp), %eax
movswl -0xb2(%rbp), %ecx
subl %ecx, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movswl -0x48(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x48(%rbp)
movswl -0x4a(%rbp), %eax
movswl -0xb4(%rbp), %ecx
addl %ecx, %eax
movw %ax, -0x46(%rbp)
movswl -0x48(%rbp), %eax
movswl -0xb2(%rbp), %ecx
addl %ecx, %eax
movw %ax, -0x44(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0xd0(%rbp)
movb -0x39(%rbp), %al
movb %al, -0xc1(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movzwl -0x52(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, -0xc0(%rbp)
movb -0xa1(%rbp), %al
movb %al, -0xb5(%rbp)
movq -0x10(%rbp), %rdi
callq 0x7180
movq -0xd8(%rbp), %rsi
movq -0xd0(%rbp), %rdx
movb -0xc1(%rbp), %cl
movq -0xc0(%rbp), %r8
movb -0xb5(%rbp), %r9b
leaq -0x4a(%rbp), %rdi
xorl %r10d, %r10d
movzbl %cl, %ecx
movzbl %r9b, %r9d
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movzbl %al, %eax
movl %eax, 0x18(%rsp)
callq 0x5f210
movw -0x50(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x50(%rbp)
movw -0x52(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x52(%rbp)
jmp 0x36752
jmp 0x36c66
jmp 0x36c68
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
nopw (%rax,%rax)