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

        lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
        lv_opa_t opa_scale    = lv_obj_get_opa_scale(ddlist);
        /*If the list is opened draw a rectangle under the selected item*/
        if(ext->opened != 0 || ext->force_sel) {
            const lv_style_t * style = lv_ddlist_get_style(ddlist, LV_DDLIST_STYLE_BG);
            const lv_font_t * font   = style->text.font;
            lv_coord_t font_h        = lv_font_get_line_height(font);

            /*Draw the selected*/
            lv_area_t rect_area;
            rect_area.y1 = ext->label->coords.y1;
            rect_area.y1 += ext->sel_opt_id * (font_h + style->text.line_space);
            rect_area.y1 -= style->text.line_space / 2;

            rect_area.y2 = rect_area.y1 + font_h + style->text.line_space - 1;
            rect_area.x1 = ddlist->coords.x1;
            rect_area.x2 = ddlist->coords.x2;

            lv_draw_rect(&rect_area, mask, ext->sel_style, opa_scale);
        }
    }
    /*Post draw when the children are drawn*/
    else if(mode == LV_DESIGN_DRAW_POST) {
        /*Redraw the text on the selected area with a different color*/
        lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
        lv_opa_t opa_scale    = lv_obj_get_opa_scale(ddlist);

        /*Redraw only in opened state*/
        if(ext->opened || ext->force_sel) {
            const lv_style_t * style = lv_ddlist_get_style(ddlist, LV_DDLIST_STYLE_BG);
            const lv_font_t * font   = style->text.font;
            lv_coord_t font_h        = lv_font_get_line_height(font);

            lv_area_t area_sel;
            area_sel.y1 = ext->label->coords.y1;
            area_sel.y1 += ext->sel_opt_id * (font_h + style->text.line_space);
            area_sel.y1 -= style->text.line_space / 2;

            area_sel.y2 = area_sel.y1 + font_h + style->text.line_space - 1;
            area_sel.x1 = ddlist->coords.x1;
            area_sel.x2 = ddlist->coords.x2;
            lv_area_t mask_sel;
            bool area_ok;
            area_ok = lv_area_intersect(&mask_sel, mask, &area_sel);
            if(area_ok) {
                const lv_style_t * sel_style = lv_ddlist_get_style(ddlist, LV_DDLIST_STYLE_SEL);
                lv_style_t new_style;
                lv_style_copy(&new_style, style);
                new_style.text.color = sel_style->text.color;
                new_style.text.opa   = sel_style->text.opa;
                lv_txt_flag_t flag   = lv_ddlist_get_txt_flag(ddlist);
                lv_draw_label(&ext->label->coords, &mask_sel, &new_style, opa_scale, lv_label_get_text(ext->label),
                              flag, NULL, NULL, NULL, lv_obj_get_base_dir(ddlist));
            }
        }

        /*Add a down symbol in ddlist when closed*/
        else {
            /*Draw a arrow in ddlist if enabled*/
            if(ext->draw_arrow) {
                const lv_style_t * style     = lv_ddlist_get_style(ddlist, LV_DDLIST_STYLE_BG);
                const lv_font_t * font       = style->text.font;
                const lv_style_t * sel_style = lv_ddlist_get_style(ddlist, LV_DDLIST_STYLE_BG);
                lv_coord_t font_h            = lv_font_get_line_height(font);
                lv_style_t new_style;
                lv_style_copy(&new_style, style);
                new_style.text.color = sel_style->text.color;
                new_style.text.opa   = sel_style->text.opa;
                lv_area_t area_arrow;
                lv_coord_t arrow_width = lv_txt_get_width(LV_SYMBOL_DOWN, (uint16_t)strlen(LV_SYMBOL_DOWN), sel_style->text.font, 0, 0);
                if(lv_label_get_align(ext->label) != LV_LABEL_ALIGN_RIGHT) {
                    area_arrow.x2 = ddlist->coords.x2 - style->body.padding.right;
                    area_arrow.x1 = area_arrow.x2 - arrow_width;
                } else {
                    area_arrow.x1 = ddlist->coords.x1 + style->body.padding.left;
                    area_arrow.x2 = area_arrow.x1 + arrow_width;
                }

                area_arrow.y1 = ddlist->coords.y1 + style->text.line_space;
                area_arrow.y2 = area_arrow.y1 + font_h;

                lv_area_t mask_arrow;
                bool area_ok;
                area_ok = lv_area_intersect(&mask_arrow, mask, &area_arrow);
                if(area_ok) {
                    /*Use a down arrow in ddlist, you can replace it with yourcustom symbol*/
                    lv_draw_label(&area_arrow, &mask_arrow, &new_style, opa_scale, LV_SYMBOL_DOWN, LV_TXT_FLAG_NONE,
                                  NULL, NULL, NULL, lv_obj_get_base_dir(ddlist));
                }
            }
        }
        /*Draw the scrollbar in the ancestor page design function*/
        ancestor_design(ddlist, mask, mode);
    }

    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1a0, %rsp            # imm = 0x1A0
movb %dl, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movb %al, -0x19(%rbp)
movzbl -0x19(%rbp), %eax
cmpl $0x2, %eax
jne 0x13630
movq 0x75d98(%rip), %rax     # 0x893b0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movzbl -0x19(%rbp), %edx
callq *%rax
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x13b95
movzbl -0x19(%rbp), %eax
cmpl $0x0, %eax
jne 0x1375e
movq 0x75d6c(%rip), %rax     # 0x893b0
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 0xa710
movb %al, -0x29(%rbp)
movq -0x28(%rbp), %rax
movb 0x66(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x13693
movq -0x28(%rbp), %rax
movb 0x66(%rax), %al
shrb %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x13759
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x13e80
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0x14bc0
movzbl %al, %eax
movw %ax, -0x42(%rbp)
movq -0x28(%rbp), %rax
movq 0x50(%rax), %rax
movw 0x22(%rax), %ax
movw %ax, -0x48(%rbp)
movq -0x28(%rbp), %rax
movzwl 0x62(%rax), %ecx
movswl -0x42(%rbp), %eax
movq -0x38(%rbp), %rdx
movswl 0x32(%rdx), %edx
addl %edx, %eax
imull %eax, %ecx
movswl -0x48(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x48(%rbp)
movq -0x38(%rbp), %rax
movswl 0x32(%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movswl -0x48(%rbp), %eax
subl %ecx, %eax
movw %ax, -0x48(%rbp)
movswl -0x48(%rbp), %eax
movswl -0x42(%rbp), %ecx
addl %ecx, %eax
movq -0x38(%rbp), %rcx
movswl 0x32(%rcx), %ecx
addl %ecx, %eax
subl $0x1, %eax
movw %ax, -0x44(%rbp)
movq -0x10(%rbp), %rax
movw 0x20(%rax), %ax
movw %ax, -0x4a(%rbp)
movq -0x10(%rbp), %rax
movw 0x24(%rax), %ax
movw %ax, -0x46(%rbp)
movq -0x18(%rbp), %rsi
movq -0x28(%rbp), %rax
movq 0x58(%rax), %rdx
leaq -0x4a(%rbp), %rdi
movzbl -0x29(%rbp), %ecx
callq 0x5a9e0
jmp 0x13b8f
movzbl -0x19(%rbp), %eax
cmpl $0x1, %eax
jne 0x13b8d
movq -0x10(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
callq 0xa710
movb %al, -0x59(%rbp)
movq -0x58(%rbp), %rax
movb 0x66(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x137ac
movq -0x58(%rbp), %rax
movb 0x66(%rax), %al
shrb %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x1397b
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x13e80
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rdi
callq 0x14bc0
movzbl %al, %eax
movw %ax, -0x72(%rbp)
movq -0x58(%rbp), %rax
movq 0x50(%rax), %rax
movw 0x22(%rax), %ax
movw %ax, -0x78(%rbp)
movq -0x58(%rbp), %rax
movzwl 0x62(%rax), %ecx
movswl -0x72(%rbp), %eax
movq -0x68(%rbp), %rdx
movswl 0x32(%rdx), %edx
addl %edx, %eax
imull %eax, %ecx
movswl -0x78(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x78(%rbp)
movq -0x68(%rbp), %rax
movswl 0x32(%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movswl -0x78(%rbp), %eax
subl %ecx, %eax
movw %ax, -0x78(%rbp)
movswl -0x78(%rbp), %eax
movswl -0x72(%rbp), %ecx
addl %ecx, %eax
movq -0x68(%rbp), %rcx
movswl 0x32(%rcx), %ecx
addl %ecx, %eax
subl $0x1, %eax
movw %ax, -0x74(%rbp)
movq -0x10(%rbp), %rax
movw 0x20(%rax), %ax
movw %ax, -0x7a(%rbp)
movq -0x10(%rbp), %rax
movw 0x24(%rax), %ax
movw %ax, -0x76(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x82(%rbp), %rdi
leaq -0x7a(%rbp), %rdx
callq 0x427d0
andb $0x1, %al
movb %al, -0x83(%rbp)
testb $0x1, -0x83(%rbp)
je 0x13976
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x13e80
movq %rax, -0x90(%rbp)
movq -0x68(%rbp), %rsi
leaq -0xd8(%rbp), %rdi
callq 0xc550
movq -0x90(%rbp), %rax
movw 0x20(%rax), %ax
movw %ax, -0xb8(%rbp)
movq -0x90(%rbp), %rax
movb 0x34(%rax), %al
movb %al, -0xa4(%rbp)
movq -0x10(%rbp), %rdi
callq 0x14be0
movb %al, -0xd9(%rbp)
movq -0x58(%rbp), %rax
movq 0x50(%rax), %rax
addq $0x20, %rax
movq %rax, -0x178(%rbp)
movb -0x59(%rbp), %al
movb %al, -0x169(%rbp)
movq -0x58(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x2abc0
movq %rax, -0x168(%rbp)
movb -0xd9(%rbp), %al
movb %al, -0x15c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x7180
movq -0x178(%rbp), %rdi
movb -0x169(%rbp), %cl
movq -0x168(%rbp), %r8
movb -0x15c(%rbp), %r9b
leaq -0x82(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
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
jmp 0x13b78
movq -0x58(%rbp), %rax
movb 0x66(%rax), %al
shrb $0x2, %al
andb $0x1, %al
cmpb $0x0, %al
je 0x13b76
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x13e80
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0xf0(%rbp)
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x13e80
movq %rax, -0xf8(%rbp)
movq -0xf0(%rbp), %rdi
callq 0x14bc0
movzbl %al, %eax
movw %ax, -0xfa(%rbp)
movq -0xe8(%rbp), %rsi
leaq -0x148(%rbp), %rdi
callq 0xc550
movq -0xf8(%rbp), %rax
movw 0x20(%rax), %ax
movw %ax, -0x128(%rbp)
movq -0xf8(%rbp), %rax
movb 0x34(%rax), %al
movb %al, -0x114(%rbp)
movq -0xf8(%rbp), %rax
movq 0x28(%rax), %rdx
leaq 0x54784(%rip), %rdi     # 0x681a6
movl $0x3, %esi
xorl %r8d, %r8d
movl %r8d, %ecx
callq 0x46bd0
movw %ax, -0x152(%rbp)
movq -0x58(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x2ab50
movzbl %al, %eax
cmpl $0x2, %eax
je 0x13a83
movq -0x10(%rbp), %rax
movswl 0x24(%rax), %eax
movq -0xe8(%rbp), %rcx
movswl 0x1c(%rcx), %ecx
subl %ecx, %eax
movw %ax, -0x14c(%rbp)
movswl -0x14c(%rbp), %eax
movswl -0x152(%rbp), %ecx
subl %ecx, %eax
movw %ax, -0x150(%rbp)
jmp 0x13ab6
movq -0x10(%rbp), %rax
movswl 0x20(%rax), %eax
movq -0xe8(%rbp), %rcx
movswl 0x1a(%rcx), %ecx
addl %ecx, %eax
movw %ax, -0x150(%rbp)
movswl -0x150(%rbp), %eax
movswl -0x152(%rbp), %ecx
addl %ecx, %eax
movw %ax, -0x14c(%rbp)
movq -0x10(%rbp), %rax
movswl 0x22(%rax), %eax
movq -0xe8(%rbp), %rcx
movswl 0x32(%rcx), %ecx
addl %ecx, %eax
movw %ax, -0x14e(%rbp)
movswl -0x14e(%rbp), %eax
movswl -0xfa(%rbp), %ecx
addl %ecx, %eax
movw %ax, -0x14a(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x15a(%rbp), %rdi
leaq -0x150(%rbp), %rdx
callq 0x427d0
andb $0x1, %al
movb %al, -0x15b(%rbp)
testb $0x1, -0x15b(%rbp)
je 0x13b74
movb -0x59(%rbp), %al
movb %al, -0x179(%rbp)
movq -0x10(%rbp), %rdi
callq 0x7180
movb -0x179(%rbp), %cl
leaq -0x150(%rbp), %rdi
leaq -0x15a(%rbp), %rsi
leaq -0x148(%rbp), %rdx
leaq 0x54661(%rip), %r8      # 0x681a6
xorl %r9d, %r9d
xorl %r10d, %r10d
movzbl %cl, %ecx
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movzbl %al, %eax
movl %eax, 0x18(%rsp)
callq 0x5f210
jmp 0x13b76
jmp 0x13b78
movq 0x75831(%rip), %rax     # 0x893b0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movzbl -0x19(%rbp), %edx
callq *%rax
jmp 0x13b8f
jmp 0x13b91
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbp
retq
nopw %cs:(%rax,%rax)