// File: /workspace/github_c_makefile_star2_O3/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, %ebx
testl %edx, %edx
je 0x1a16f
cmpb $0x2, %bl
setne %al
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsi, %r13
movq %rdi, %r15
callq 0x66b6
movq %rax, %r14
movq %r15, %rdi
callq 0x69eb
movl %eax, %ebp
leaq 0x28(%rsp), %rsi
movq %r15, %rdi
callq 0x542b
movq %r15, %rdi
callq 0x4ed1
movq %rax, %rdi
callq 0x2a19
cmpq %r15, %rax
jne 0x1a1bd
movzbl %bpl, %ecx
leaq 0x28(%rsp), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x36968
movb %bpl, 0x30(%rsp)
movq %r15, %rdi
callq 0x6af7
movq %rax, %r12
testb $0x1, 0x19(%rax)
je 0x1a226
leaq 0x8(%rsp), %rbp
movq %r15, %rdi
movq %rbp, %rsi
callq 0x542b
movq 0x16(%r14), %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 0x69eb
movzbl %al, %ecx
movq %rbp, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x36968
movq %r14, 0x20(%rsp)
movq %r15, %rdi
callq 0x1a9c6
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, %r14d
cmovnel %esi, %r14d
movl %ecx, %eax
andl $0x7, %eax
addl $-0x3, %eax
cmpw $0x1, %ax
ja 0x1a2dd
shrl $0x4, %ecx
andl $0x3, %ecx
decl %ecx
cmpw $0x1, %cx
ja 0x1a2dd
movq (%r12), %rsi
movq 0x20(%rsp), %rax
movq 0x28(%rax), %rdx
movswl 0x30(%rax), %ecx
movswl 0x32(%rax), %r8d
subq $0x8, %rsp
movzbl %r14b, %ebp
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movl $0x7c18, %r9d           # imm = 0x7C18
pushq %rbp
callq 0x2acd4
addq $0x10, %rsp
movzwl (%r14), %r14d
movq %r15, %rdi
callq 0x566d
movl %ebp, %ecx
andb $0x73, %cl
cmpw %ax, %r14w
movzbl %cl, %r14d
cmovlel %ebp, %r14d
movq %r15, %rdi
callq 0x80e4
testb %al, %al
je 0x1a4c6
movw $0xffff, 0x8(%rsp)      # imm = 0xFFFF
movq %r15, %rdi
callq 0x80e4
testb %al, %al
je 0x1a4d7
leaq 0x8(%rsp), %rax
movw $0xffff, 0x2(%rax)      # imm = 0xFFFF
movq (%r12), %rax
movq %rax, 0x18(%rsp)
movq %r13, %rbp
movq %r12, %r13
addq $0x12, %r13
movq %r15, %rdi
callq 0x4ab2
movzbl %al, %eax
movzbl 0x30(%rsp), %ecx
movzbl %r14b, %r14d
leaq 0x28(%rsp), %rdi
movq %rbp, 0x30(%rsp)
movq %rbp, %rsi
movq 0x20(%rsp), %rbp
movq %rbp, %rdx
movl %ecx, 0x14(%rsp)
movq 0x18(%rsp), %r8
movl %r14d, %r9d
pushq %rax
pushq $0x0
leaq 0x18(%rsp), %rax
pushq %rax
pushq %r13
callq 0x3a5ac
addq $0x20, %rsp
movzwl 0x18(%r12), %eax
andl $0x7, %eax
cmpw $0x4, %ax
jne 0x1a15a
movq (%r12), %rsi
movq 0x28(%rbp), %rdx
movswl 0x30(%rbp), %ecx
movswl 0x32(%rbp), %r8d
subq $0x8, %rsp
leaq 0xc(%rsp), %rbp
movq %rbp, %rdi
movl $0x7c18, %r9d           # imm = 0x7C18
movq %r14, 0x20(%rsp)
pushq %r14
callq 0x2acd4
addq $0x10, %rsp
movzwl (%rbp), %ebp
movq %r15, %rdi
callq 0x566d
cmpw %ax, %bp
movq 0x30(%rsp), %r13
jle 0x1a43d
movzwl 0x4(%rsp), %ebp
addw 0x12(%r12), %bp
movq 0x20(%rsp), %r14
movq 0x28(%r14), %rdi
movl $0x20, %esi
movl $0x20, %edx
callq 0x28487
leal (%rax,%rax,2), %eax
addl %ebp, %eax
movq %rsp, %rcx
movw %ax, (%rcx)
movzwl 0x14(%r12), %eax
movw %ax, 0x2(%rcx)
movq (%r12), %rbp
movq %r15, %rdi
callq 0x4ab2
movzbl %al, %eax
leaq 0x28(%rsp), %rdi
movq %r13, %rsi
movq %r14, %rdx
movl 0x14(%rsp), %ecx
movq %rbp, %r8
movq 0x18(%rsp), %r9
pushq %rax
pushq $0x0
leaq 0x18(%rsp), %rax
pushq %rax
leaq 0x18(%rsp), %rax
pushq %rax
callq 0x3a5ac
addq $0x20, %rsp
movzwl 0x6(%rsp), %ebp
movq %r15, %rdi
callq 0x5697
cmpw %ax, %bp
jle 0x1a15a
movzwl 0x12(%r12), %eax
movq %rsp, %rcx
movw %ax, (%rcx)
movq %rcx, %rdx
movzwl 0x6(%rsp), %eax
addw 0x14(%r12), %ax
movq 0x20(%rsp), %r14
movq 0x28(%r14), %rcx
movzbl 0x10(%rcx), %ecx
addl %eax, %ecx
movw %cx, 0x2(%rdx)
movq %r13, %rbp
movq (%r12), %r13
movq %r15, %rdi
callq 0x4ab2
movzbl %al, %eax
leaq 0x28(%rsp), %rdi
movq %rbp, %rsi
movq %r14, %rdx
movl 0x14(%rsp), %ecx
movq %r13, %r8
movq 0x18(%rsp), %r9
pushq %rax
pushq $0x0
leaq 0x18(%rsp), %rax
pushq %rax
leaq 0x18(%rsp), %rax
pushq %rax
callq 0x3a5ac
addq $0x20, %rsp
jmp 0x1a15a
leaq 0x24d17(%rip), %rdi     # 0x3f1e4
movq %r15, %rsi
callq 0x8294
jmp 0x1a4d5
leaq 0x24d06(%rip), %rdi     # 0x3f1e4
movq %r15, %rsi
callq 0x8294
jmp 0x1a4e6