// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_label.c
// Function: lv_label_design
static bool lv_label_design(lv_obj_t * label, const lv_area_t * mask, lv_design_mode_t mode)
{
    /* A label never covers an area */
    if(mode == LV_DESIGN_COVER_CHK)
        return false;
    else if(mode == LV_DESIGN_DRAW_MAIN) {
        lv_area_t coords;
        const lv_style_t * style = lv_obj_get_style(label);
        lv_opa_t opa_scale       = lv_obj_get_opa_scale(label);
        lv_obj_get_coords(label, &coords);

#if LV_USE_GROUP
        lv_group_t * g = lv_obj_get_group(label);
        if(lv_group_get_focused(g) == label) {
            lv_draw_rect(&coords, mask, style, opa_scale);
        }
#endif

        lv_label_ext_t * ext = lv_obj_get_ext_attr(label);

        if(ext->body_draw) {
            lv_area_t bg;
            lv_obj_get_coords(label, &bg);
            bg.x1 -= style->body.padding.left;
            bg.x2 += style->body.padding.right;
            bg.y1 -= style->body.padding.top;
            bg.y2 += style->body.padding.bottom;

            lv_draw_rect(&bg, mask, style, lv_obj_get_opa_scale(label));
        }

        lv_label_align_t align = lv_label_get_align(label);

        lv_txt_flag_t flag = LV_TXT_FLAG_NONE;
        if(ext->recolor != 0) flag |= LV_TXT_FLAG_RECOLOR;
        if(ext->expand != 0) flag |= LV_TXT_FLAG_EXPAND;
        if(align == LV_LABEL_ALIGN_CENTER) flag |= LV_TXT_FLAG_CENTER;
        if(align == LV_LABEL_ALIGN_RIGHT) flag |= LV_TXT_FLAG_RIGHT;

        /* In ROLL mode the CENTER and RIGHT are pointless so remove them.
         * (In addition they will result mis-alignment is this case)*/
        if((ext->long_mode == LV_LABEL_LONG_SROLL || ext->long_mode == LV_LABEL_LONG_SROLL_CIRC) &&
           (ext->align == LV_LABEL_ALIGN_CENTER || ext->align == LV_LABEL_ALIGN_RIGHT)) {
            lv_point_t size;
            lv_txt_get_size(&size, ext->text, style->text.font, style->text.letter_space, style->text.line_space,
                            LV_COORD_MAX, flag);
            if(size.x > lv_obj_get_width(label)) {
                flag &= ~LV_TXT_FLAG_RIGHT;
                flag &= ~LV_TXT_FLAG_CENTER;
            }
        }
#if LV_LABEL_LONG_TXT_HINT
        lv_draw_label_hint_t * hint = &ext->hint;
        if(ext->long_mode == LV_LABEL_LONG_SROLL_CIRC || lv_obj_get_height(label) < LV_LABEL_HINT_HEIGHT_LIMIT)
            hint = NULL;

#else
        /*Just for compatibility*/
        lv_draw_label_hint_t * hint = NULL;
#endif
        lv_draw_label_txt_sel_t sel;

        sel.start = lv_label_get_text_sel_start(label);
        sel.end = lv_label_get_text_sel_end(label);
        lv_draw_label(&coords, mask, style, opa_scale, ext->text, flag, &ext->offset, &sel, hint, lv_obj_get_base_dir(label));


        if(ext->long_mode == LV_LABEL_LONG_SROLL_CIRC) {
            lv_point_t size;
            lv_txt_get_size(&size, ext->text, style->text.font, style->text.letter_space, style->text.line_space,
                            LV_COORD_MAX, flag);

            lv_point_t ofs;

            /*Draw the text again next to the original to make an circular effect */
            if(size.x > lv_obj_get_width(label)) {
                ofs.x = ext->offset.x + size.x +
                        lv_font_get_glyph_width(style->text.font, ' ', ' ') * LV_LABEL_WAIT_CHAR_COUNT;
                ofs.y = ext->offset.y;

                lv_draw_label(&coords, mask, style, opa_scale, ext->text, flag, &ofs, &sel, NULL, lv_obj_get_base_dir(label));
            }

            /*Draw the text again below the original to make an circular effect */
            if(size.y > lv_obj_get_height(label)) {
                ofs.x = ext->offset.x;
                ofs.y = ext->offset.y + size.y + lv_font_get_line_height(style->text.font);
                lv_draw_label(&coords, mask, style, opa_scale, ext->text, flag, &ofs, &sel, NULL, lv_obj_get_base_dir(label));
            }
        }
    }
    return true;
}

// Assembly:
testl %edx, %edx
jne 0x188a7
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r14
movq %rdi, %r15
movl %edx, 0x30(%rsp)
callq 0x6316
movq %rax, %r13
movq %r15, %rdi
callq 0x6649
movl %eax, %ebp
leaq 0x18(%rsp), %rsi
movq %r15, %rdi
callq 0x50e5
movq %r15, %rdi
callq 0x4b8e
movq %rax, %rdi
callq 0x29b8
movzbl %bpl, %ecx
movl %ecx, 0x8(%rsp)
cmpq %r15, %rax
jne 0x185d0
leaq 0x18(%rsp), %rdi
movq %r14, %rsi
movq %r13, %rdx
movl 0x8(%rsp), %ecx
callq 0x336d4
movq %r15, %rdi
callq 0x6747
movq %rax, %r12
testb $0x1, 0x19(%rax)
je 0x18634
leaq 0x10(%rsp), %rbp
movq %r15, %rdi
movq %rbp, %rsi
callq 0x50e5
movq 0x16(%r13), %xmm0
pshuflw $0x72, %xmm0, %xmm0     # xmm0 = xmm0[2,0,3,1,4,5,6,7]
movq (%rbp), %xmm1
movdqa %xmm1, %xmm2
psubw %xmm0, %xmm2
paddw %xmm0, %xmm1
pshufd $0x55, %xmm1, %xmm0     # xmm0 = xmm1[1,1,1,1]
punpckldq %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
movq %xmm2, (%rbp)
movq %r15, %rdi
callq 0x6649
movzbl %al, %ecx
movq %rbp, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x336d4
movq %r15, %rdi
callq 0x18d7f
movzwl 0x18(%r12), %ecx
movl %ecx, %edx
shrb $0x6, %dl
movl %edx, %esi
andb $0x1, %sil
orb $0x2, %dl
testb %cl, %cl
movzbl %sil, %esi
movzbl %dl, %edx
cmovnsl %esi, %edx
leal 0x4(%rdx), %esi
cmpb $0x1, %al
movzbl %sil, %esi
cmovnel %edx, %esi
movl %esi, %edx
orb $0x8, %dl
cmpb $0x2, %al
movzbl %dl, %ebp
cmovnel %esi, %ebp
movl %ecx, %eax
andl $0x7, %eax
addl $-0x3, %eax
cmpw $0x1, %ax
movq %r13, 0x20(%rsp)
movq %r14, 0x28(%rsp)
ja 0x186e8
shrl $0x4, %ecx
andl $0x3, %ecx
decl %ecx
cmpw $0x1, %cx
ja 0x186e8
movq (%r12), %rsi
movq 0x28(%r13), %rdx
movswl 0x30(%r13), %ecx
movswl 0x32(%r13), %r8d
subq $0x8, %rsp
movzbl %bpl, %r14d
leaq 0x18(%rsp), %rbp
movq %rbp, %rdi
movl $0x7c18, %r9d           # imm = 0x7C18
pushq %r14
callq 0x28723
popq %rax
popq %rcx
movzwl (%rbp), %ebp
movq %r15, %rdi
callq 0x5308
movl %r14d, %ecx
andb $0x73, %cl
cmpw %ax, %bp
movzbl %cl, %ebp
cmovlel %r14d, %ebp
movq %r15, %rdi
callq 0x19d96
leaq 0x10(%rsp), %rbx
orw $-0x1, (%rbx)
movq %r15, %rdi
callq 0x19dba
orw $-0x1, 0x2(%rbx)
movq (%r12), %r14
movq %r12, %r13
addq $0x12, %r13
movq %r15, %rdi
callq 0x47b9
movzbl %al, %eax
movq %r12, %r10
movzbl %bpl, %r12d
leaq 0x18(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rbp
movq %rbp, %rdx
movl 0x8(%rsp), %ecx
movq %r14, %r8
movl %r12d, %r9d
pushq %rax
pushq $0x0
pushq %rbx
pushq %r13
movq %r10, %r13
callq 0x3699c
addq $0x20, %rsp
movzwl 0x18(%r13), %eax
andl $0x7, %eax
cmpw $0x4, %ax
jne 0x18895
movq (%r13), %rsi
movq 0x28(%rbp), %rdx
movswl 0x30(%rbp), %ecx
movswl 0x32(%rbp), %r8d
subq $0x8, %rsp
leaq 0x14(%rsp), %r14
movq %r14, %rdi
movl $0x7c18, %r9d           # imm = 0x7C18
pushq %r12
callq 0x28723
popq %rax
popq %rcx
movzwl (%r14), %r14d
movq %r15, %rdi
callq 0x5308
cmpw %ax, %r14w
movq %r12, %rbx
movq %r13, %r12
jle 0x1881d
movzwl 0xc(%rsp), %r14d
addw 0x12(%r12), %r14w
movq 0x28(%rbp), %rdi
pushq $0x20
popq %rdx
movl %edx, %esi
callq 0x2603b
leal (%rax,%rax,2), %eax
addl %r14d, %eax
leaq 0x34(%rsp), %r13
movw %ax, (%r13)
movzwl 0x14(%r12), %eax
movw %ax, 0x2(%r13)
movq (%r12), %r14
movq %r15, %rdi
callq 0x47b9
movzbl %al, %eax
leaq 0x18(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rdx
movl 0x8(%rsp), %ecx
movq %r14, %r8
movl %ebx, %r9d
pushq %rax
pushq $0x0
leaq 0x20(%rsp), %rax
pushq %rax
pushq %r13
movq 0x40(%rsp), %rbp
callq 0x3699c
addq $0x20, %rsp
movzwl 0xe(%rsp), %r14d
movq %r15, %rdi
callq 0x5332
cmpw %ax, %r14w
jle 0x18895
movzwl 0x12(%r12), %eax
leaq 0x34(%rsp), %r13
movw %ax, (%r13)
movzwl 0xe(%rsp), %eax
addw 0x14(%r12), %ax
movq 0x28(%rbp), %rcx
movzbl 0x10(%rcx), %ecx
addl %eax, %ecx
movw %cx, 0x2(%r13)
movq (%r12), %r14
movq %r15, %rdi
callq 0x47b9
movzbl %al, %eax
leaq 0x18(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq %rbp, %rdx
movl 0x8(%rsp), %ecx
movq %r14, %r8
movl %ebx, %r9d
pushq %rax
pushq $0x0
leaq 0x20(%rsp), %rax
pushq %rax
pushq %r13
callq 0x3699c
addq $0x20, %rsp
movl 0x30(%rsp), %edx
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
cmpb $0x2, %dl
setne %al
retq