// File: /workspace/github_c_makefile_star2_O1/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_roller.c
// Function: lv_roller_design
static bool lv_roller_design(lv_obj_t * roller, 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 false;
    }
    /*Draw the object*/
    else if(mode == LV_DESIGN_DRAW_MAIN) {
        draw_bg(roller, mask);

        const lv_style_t * style = lv_roller_get_style(roller, LV_ROLLER_STYLE_BG);
        lv_opa_t opa_scale       = lv_obj_get_opa_scale(roller);
        const lv_font_t * font   = style->text.font;
        lv_roller_ext_t * ext    = lv_obj_get_ext_attr(roller);
        lv_coord_t font_h        = lv_font_get_line_height(font);
        lv_area_t rect_area;
        rect_area.y1 = roller->coords.y1 + lv_obj_get_height(roller) / 2 - font_h / 2 - style->text.line_space / 2;
        if((font_h & 0x1) && (style->text.line_space & 0x1)) rect_area.y1--; /*Compensate the two rounding error*/
        rect_area.y2 = rect_area.y1 + font_h + style->text.line_space - 1;
        lv_area_t roller_coords;
        lv_obj_get_coords(roller, &roller_coords);
        lv_obj_get_inner_coords(roller, &roller_coords);

        rect_area.x1 = roller_coords.x1;
        rect_area.x2 = roller_coords.x2;

        lv_draw_rect(&rect_area, mask, ext->ddlist.sel_style, opa_scale);
    }
    /*Post draw when the children are drawn*/
    else if(mode == LV_DESIGN_DRAW_POST) {
        const lv_style_t * style = lv_roller_get_style(roller, LV_ROLLER_STYLE_BG);
        lv_roller_ext_t * ext    = lv_obj_get_ext_attr(roller);
        const lv_font_t * font   = style->text.font;
        lv_coord_t font_h        = lv_font_get_line_height(font);
        lv_opa_t opa_scale       = lv_obj_get_opa_scale(roller);

        /*Redraw the text on the selected area with a different color*/
        lv_area_t rect_area;
        rect_area.y1 = roller->coords.y1 + lv_obj_get_height(roller) / 2 - font_h / 2 - style->text.line_space / 2;
        if((font_h & 0x1) && (style->text.line_space & 0x1)) rect_area.y1--; /*Compensate the two rounding error*/
        rect_area.y2 = rect_area.y1 + font_h + style->text.line_space - 1;
        rect_area.x1 = roller->coords.x1;
        rect_area.x2 = roller->coords.x2;
        lv_area_t mask_sel;
        bool area_ok;
        area_ok = lv_area_intersect(&mask_sel, mask, &rect_area);
        if(area_ok) {
            const lv_style_t * sel_style = lv_roller_get_style(roller, LV_ROLLER_STYLE_SEL);
            lv_style_t new_style;
            lv_txt_flag_t txt_align = LV_TXT_FLAG_NONE;

            {
                lv_label_align_t label_align = lv_label_get_align(ext->ddlist.label);

                if(LV_LABEL_ALIGN_CENTER == label_align) {
                    txt_align |= LV_TXT_FLAG_CENTER;
                } else if(LV_LABEL_ALIGN_RIGHT == label_align) {
                    txt_align |= LV_TXT_FLAG_RIGHT;
                }
            }

            lv_style_copy(&new_style, style);
            new_style.text.color = sel_style->text.color;
            new_style.text.opa   = sel_style->text.opa;
            lv_draw_label(&ext->ddlist.label->coords, &mask_sel, &new_style, opa_scale,
                          lv_label_get_text(ext->ddlist.label), txt_align, NULL, NULL, NULL, lv_obj_get_base_dir(ext->ddlist.label));
        }
    }

    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %edx, %ebx
cmpl $0x2, %edx
je 0xefff
movq %rdi, %r15
cmpb $0x1, %bl
je 0xeead
movzbl %bl, %eax
testl %eax, %eax
jne 0xefff
movq %r15, %rdi
movq %rsi, %r12
xorl %esi, %esi
callq 0xf745
movq %rax, 0x20(%rsp)
movq %r15, %rdi
callq 0x567b
movq 0x20(%r15), %rcx
leaq 0x28(%rsp), %r13
movq %rcx, (%r13)
movl 0x5c(%r15), %edx
subl %edx, %ecx
movw %cx, (%r13)
addw %dx, 0x4(%r13)
movl %eax, %ebp
subw %dx, 0x2(%r13)
movzwl %ax, %eax
shrl $0xf, %eax
addl %ebp, %eax
movswl %ax, %r14d
shrl %r14d
movzwl 0x22(%r15), %eax
addw %r14w, %ax
movw %ax, 0x6(%r13)
leaq 0x30(%rsp), %rdi
movq %r13, %rsi
movq %r12, 0x38(%rsp)
movq %r12, %rdx
movq 0x20(%rsp), %r12
callq 0x2865e
movzwl 0x5c(%r15), %ecx
addw %cx, (%r13)
subw %cx, 0x4(%r13)
addw %cx, 0x2(%r13)
movzwl 0x6(%r12), %ecx
addw %cx, 0x6(%r13)
testb %al, %al
je 0xed34
movq %r15, %rdi
callq 0x69cc
movzbl %al, %ecx
leaq 0x28(%rsp), %rdi
leaq 0x30(%rsp), %rsi
movq %r12, %rdx
callq 0x365ac
movzwl 0x5c(%r15), %eax
leaq 0x28(%rsp), %r13
subw %ax, (%r13)
addw %ax, 0x4(%r13)
addw 0x26(%r15), %ax
movw %ax, 0x6(%r13)
notl %ebp
andl $0x1, %ebp
addl %ebp, %r14d
addw 0x22(%r15), %r14w
movw %r14w, 0x2(%r13)
leaq 0x30(%rsp), %rdi
movq %r13, %rsi
movq 0x38(%rsp), %rdx
callq 0x2865e
movzwl 0x5c(%r15), %ecx
addw %cx, (%r13)
subw %cx, 0x4(%r13)
subw %cx, 0x6(%r13)
movzwl 0x6(%r12), %ecx
subw %cx, 0x2(%r13)
testb %al, %al
je 0xeddf
leaq 0x40(%rsp), %r13
movl $0x9, %ecx
movq %r13, %rdi
movq %r12, %rsi
rep  movsq (%rsi), %es:(%rdi)
movzwl 0x4(%r12), %eax
movw %ax, 0x2(%r13)
movzwl 0x2(%r12), %eax
movw %ax, 0x4(%r13)
movq %r15, %rdi
callq 0x69cc
movzbl %al, %ecx
leaq 0x28(%rsp), %rdi
leaq 0x30(%rsp), %rsi
movq %r13, %rdx
callq 0x365ac
movq %r15, %rdi
xorl %esi, %esi
callq 0xf745
movq %rax, %r13
movq %r15, %rdi
callq 0x69cc
movb %al, 0x20(%rsp)
movq 0x28(%r13), %r14
movq %r15, %rdi
callq 0x6ad8
movq %rax, %r12
movzbl 0x10(%r14), %r14d
movzwl 0x22(%r15), %ebp
movq %r15, %rdi
callq 0x567b
movzwl %ax, %ecx
shrl $0xf, %ecx
addl %eax, %ecx
movswl %cx, %eax
sarl %eax
addl %ebp, %eax
movl %r14d, %ecx
shrl %ecx
movzwl 0x32(%r13), %edx
movzwl %dx, %esi
shrl $0xf, %esi
addl %edx, %esi
movswl %si, %esi
sarl %esi
addl %ecx, %esi
subl %esi, %eax
movl %r14d, %ecx
andl %edx, %ecx
andl $0x1, %ecx
subl %ecx, %eax
leaq 0x40(%rsp), %r13
movw %ax, 0x2(%r13)
addl %edx, %r14d
addl %r14d, %eax
decl %eax
movw %ax, 0x6(%r13)
leaq 0x30(%rsp), %rbp
movq %r15, %rdi
movq %rbp, %rsi
callq 0x5427
movq %r15, %rdi
movq %rbp, %rsi
callq 0x662d
movzwl (%rbp), %eax
movzwl 0x4(%rbp), %ecx
movw %ax, (%r13)
movw %cx, 0x4(%r13)
movq 0x58(%r12), %rdx
movzbl 0x20(%rsp), %ecx
movq %r13, %rdi
movq 0x38(%rsp), %rsi
callq 0x365ac
jmp 0xefff
movq %r15, %rdi
movq %rsi, %r12
xorl %esi, %esi
callq 0xf745
movq %rax, %r13
movq %r15, %rdi
callq 0x6ad8
movq %rax, 0x20(%rsp)
movq 0x28(%r13), %rax
movzbl 0x10(%rax), %r14d
movq %r15, %rdi
callq 0x69cc
movb %al, 0x38(%rsp)
movzwl 0x22(%r15), %ebp
movq %r15, %rdi
callq 0x567b
movzwl %ax, %ecx
shrl $0xf, %ecx
addl %eax, %ecx
movswl %cx, %eax
sarl %eax
addl %ebp, %eax
movl %r14d, %ecx
shrl %ecx
movzwl 0x32(%r13), %esi
movzwl %si, %edx
shrl $0xf, %edx
addl %esi, %edx
movswl %dx, %edx
sarl %edx
addl %ecx, %edx
subl %edx, %eax
movl %r14d, %ecx
andl %esi, %ecx
andl $0x1, %ecx
subl %ecx, %eax
leaq 0x30(%rsp), %rdx
movw %ax, 0x2(%rdx)
addl %esi, %r14d
addl %r14d, %eax
decl %eax
movw %ax, 0x6(%rdx)
movzwl 0x20(%r15), %eax
movw %ax, (%rdx)
movzwl 0x24(%r15), %eax
movw %ax, 0x4(%rdx)
leaq 0x28(%rsp), %rdi
movq %r12, %rsi
callq 0x2865e
testb %al, %al
je 0xefff
movq %r15, %rdi
movl $0x1, %esi
callq 0xf745
movq %rax, %r15
movq 0x20(%rsp), %r12
movq 0x50(%r12), %rdi
callq 0x1a1ff
cmpb $0x2, %al
sete %cl
shlb $0x3, %cl
cmpb $0x1, %al
movzbl %cl, %eax
movl $0x4, %ebp
cmovnel %eax, %ebp
leaq 0x40(%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x798d
movzwl 0x20(%r15), %eax
movw %ax, 0x20(%r14)
movb 0x34(%r15), %al
movb %al, 0x34(%r14)
movq 0x50(%r12), %rdi
leaq 0x20(%rdi), %r15
callq 0x1a239
movq %rax, %r13
movq 0x50(%r12), %rdi
callq 0x4abc
movzbl %al, %eax
movl %eax, 0x18(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movzbl %bpl, %r9d
movzbl 0x38(%rsp), %ecx
leaq 0x28(%rsp), %rsi
movq %r15, %rdi
movq %r14, %rdx
movq %r13, %r8
callq 0x3a034
cmpb $0x2, %bl
setne %al
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq