// File: /workspace/github_c_makefile_star2_O1/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_label.c
// Function: lv_label_refr_text
static void lv_label_refr_text(lv_obj_t * label)
{
    lv_label_ext_t * ext = lv_obj_get_ext_attr(label);

    if(ext->text == NULL) return;
#if LV_LABEL_LONG_TXT_HINT
    ext->hint.line_start = -1; /*The hint is invalid if the text changes*/
#endif

    lv_coord_t max_w         = lv_obj_get_width(label);
    const lv_style_t * style = lv_obj_get_style(label);
    const lv_font_t * font   = style->text.font;

    /*If the width will be expanded set the max length to very big */
    if(ext->long_mode == LV_LABEL_LONG_EXPAND) {
        max_w = LV_COORD_MAX;
    }

    /*Calc. the height and longest line*/
    lv_point_t size;
    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;
    lv_txt_get_size(&size, ext->text, font, style->text.letter_space, style->text.line_space, max_w, flag);

    /*Set the full size in expand mode*/
    if(ext->long_mode == LV_LABEL_LONG_EXPAND) {
        lv_obj_set_size(label, size.x, size.y);
    }
    /*In roll mode keep the size but start offset animations*/
    else if(ext->long_mode == LV_LABEL_LONG_SROLL) {
#if LV_USE_ANIMATION
        lv_anim_t anim;
        anim.var      = label;
        anim.repeat   = 1;
        anim.playback = 1;
        anim.start    = 0;
        anim.ready_cb = NULL;
        anim.path_cb  = lv_anim_path_linear;
        anim.playback_pause =
            (((lv_font_get_glyph_width(style->text.font, ' ', ' ') + style->text.letter_space) * 1000) /
             ext->anim_speed) *
            LV_LABEL_WAIT_CHAR_COUNT;
        anim.repeat_pause = anim.playback_pause;
        anim.act_time     = -anim.playback_pause;

        bool hor_anim = false;
        if(size.x > lv_obj_get_width(label)) {
            anim.end     = lv_obj_get_width(label) - size.x;
            anim.exec_cb = (lv_anim_exec_xcb_t)lv_label_set_offset_x;
            anim.time    = lv_anim_speed_to_time(ext->anim_speed, anim.start, anim.end);
            lv_anim_create(&anim);
            hor_anim = true;
        } else {
            /*Delete the offset animation if not required*/
            lv_anim_del(label, (lv_anim_exec_xcb_t)lv_label_set_offset_x);
            ext->offset.x = 0;
        }

        if(size.y > lv_obj_get_height(label) && hor_anim == false) {
            anim.end     = lv_obj_get_height(label) - size.y - (lv_font_get_line_height(font));
            anim.exec_cb = (lv_anim_exec_xcb_t)lv_label_set_offset_y;

            anim.time = lv_anim_speed_to_time(ext->anim_speed, anim.start, anim.end);
            lv_anim_create(&anim);
        } else {
            /*Delete the offset animation if not required*/
            lv_anim_del(label, (lv_anim_exec_xcb_t)lv_label_set_offset_y);
            ext->offset.y = 0;
        }
#endif
    }
    /*In roll inf. mode keep the size but start offset animations*/
    else if(ext->long_mode == LV_LABEL_LONG_SROLL_CIRC) {
#if LV_USE_ANIMATION
        lv_label_align_t align = lv_label_get_align(label);

        lv_anim_t anim;
        anim.var      = label;
        anim.repeat   = 1;
        anim.playback = 0;
        anim.act_time = -(((lv_font_get_glyph_width(style->text.font, ' ', ' ') + style->text.letter_space) * 1000) /
                          ext->anim_speed) *
                        LV_LABEL_WAIT_CHAR_COUNT;
        anim.ready_cb       = NULL;
        anim.path_cb        = lv_anim_path_linear;
        anim.playback_pause = 0;
        anim.repeat_pause   = 0;

        bool hor_anim = false;
        if(size.x > lv_obj_get_width(label)) {
            if(align == LV_LABEL_ALIGN_RIGHT) {
                anim.end    = 0;
                anim.start     = -size.x - lv_font_get_glyph_width(font, ' ', ' ') * LV_LABEL_WAIT_CHAR_COUNT;
            } else {
                anim.start    = 0;
                anim.end     = -size.x - lv_font_get_glyph_width(font, ' ', ' ') * LV_LABEL_WAIT_CHAR_COUNT;
            }

            anim.exec_cb = (lv_anim_exec_xcb_t)lv_label_set_offset_x;
            anim.time    = lv_anim_speed_to_time(ext->anim_speed, anim.start, anim.end);
            lv_anim_create(&anim);
            hor_anim = true;
        } else {
            /*Delete the offset animation if not required*/
            lv_anim_del(label, (lv_anim_exec_xcb_t)lv_label_set_offset_x);
            ext->offset.x = 0;
        }

        if(size.y > lv_obj_get_height(label) && hor_anim == false) {
            if(align == LV_LABEL_ALIGN_RIGHT) {
                  anim.end    = 0;
                  anim.start     = -size.y - (lv_font_get_line_height(font));
              } else {
                  anim.start    = 0;
                  anim.end     = -size.y - (lv_font_get_line_height(font));
              }

            anim.exec_cb = (lv_anim_exec_xcb_t)lv_label_set_offset_y;
            anim.time    = lv_anim_speed_to_time(ext->anim_speed, anim.start, anim.end);
            lv_anim_create(&anim);
        } else {
            /*Delete the offset animation if not required*/
            lv_anim_del(label, (lv_anim_exec_xcb_t)lv_label_set_offset_y);
            ext->offset.y = 0;
        }
#endif
    } else if(ext->long_mode == LV_LABEL_LONG_DOT) {
        if(size.y <= lv_obj_get_height(label)) { /*No dots are required, the text is short enough*/
            ext->dot_end = LV_LABEL_DOT_END_INV;
        } else if(lv_txt_get_encoded_length(ext->text) <= LV_LABEL_DOT_NUM) { /*Don't turn to dots all the characters*/
            ext->dot_end = LV_LABEL_DOT_END_INV;
        } else {
            lv_point_t p;
            p.x = lv_obj_get_width(label) -
                  (lv_font_get_glyph_width(style->text.font, '.', '.') + style->text.letter_space) *
                      LV_LABEL_DOT_NUM; /*Shrink with dots*/
            p.y = lv_obj_get_height(label);
            p.y -= p.y %
                   (lv_font_get_line_height(style->text.font) + style->text.line_space); /*Round down to the last line*/
            p.y -= style->text.line_space;                                               /*Trim the last line space*/
            uint32_t letter_id = lv_label_get_letter_on(label, &p);

            /*Save letters under the dots and replace them with dots*/
            uint32_t i;
            uint32_t byte_id     = lv_txt_encoded_get_byte_id(ext->text, letter_id);
            uint32_t byte_id_ori = byte_id;
            uint8_t len          = 0;
            for(i = 0; i <= LV_LABEL_DOT_NUM; i++) {
                len += lv_txt_encoded_size(&ext->text[byte_id]);
                lv_txt_encoded_next(ext->text, &byte_id);
            }

            if(lv_label_set_dot_tmp(label, &ext->text[byte_id_ori], len)) {
                for(i = 0; i < LV_LABEL_DOT_NUM; i++) {
                    ext->text[byte_id_ori + i] = '.';
                }
                ext->text[byte_id_ori + LV_LABEL_DOT_NUM] = '\0';
                ext->dot_end                              = letter_id + LV_LABEL_DOT_NUM;
            }
        }
    }
    /*In break mode only the height can change*/
    else if(ext->long_mode == LV_LABEL_LONG_BREAK) {
        lv_obj_set_height(label, size.y);
    }
    /*Do not set the size in Clip mode*/
    else if(ext->long_mode == LV_LABEL_LONG_CROP) {
        /*Do nothing*/
    }

    lv_obj_invalidate(label);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
callq 0x6ad8
cmpq $0x0, (%rax)
je 0x1a799
movq %rax, %r14
movq %rbx, %rdi
callq 0x5651
movl %eax, %ebp
movq %rbx, %rdi
callq 0x6697
movq %rax, %r12
movq 0x28(%rax), %r15
movzwl 0x18(%r14), %eax
testb $0x7, %al
movl $0x7c18, %edx           # imm = 0x7C18
cmovnel %ebp, %edx
movl %eax, %ecx
shrb $0x6, %cl
movl %ecx, %esi
andb $0x1, %sil
orb $0x2, %cl
testb %al, %al
movzbl %sil, %eax
movzbl %cl, %edi
cmovnsl %eax, %edi
movq (%r14), %rsi
movswl 0x30(%r12), %ecx
movswl 0x32(%r12), %r8d
movzbl %dil, %eax
movl %eax, (%rsp)
movswl %dx, %r9d
leaq 0x8(%rsp), %rdi
movq %r15, %rdx
callq 0x2a643
movzwl 0x18(%r14), %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x1a791
leaq 0x25317(%rip), %rcx     # 0x3f720
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movswl 0x8(%rsp), %esi
movswl 0xa(%rsp), %edx
movq %rbx, %rdi
callq 0x553f
jmp 0x1a791
movq %rbx, %rdi
callq 0x1a1ff
movl %eax, %r13d
movq %rbx, 0x18(%rsp)
movb 0x48(%rsp), %al
andb $-0x4, %al
orb $0x2, %al
movb %al, 0x48(%rsp)
movq 0x28(%r12), %rdi
movl $0x20, %esi
movl $0x20, %edx
callq 0x27d87
movzwl %ax, %eax
movswl 0x30(%r12), %ecx
addl %eax, %ecx
imull $0x3e8, %ecx, %eax      # imm = 0x3E8
movzwl 0x16(%r14), %ecx
cltd
idivl %ecx
leal (%rax,%rax,2), %eax
negl %eax
movw %ax, 0x42(%rsp)
movq $0x0, 0x30(%rsp)
leaq 0xf069(%rip), %rax      # 0x294f5
movq %rax, 0x28(%rsp)
movl $0x0, 0x44(%rsp)
movzwl 0x8(%rsp), %ebp
movq %rbx, %rdi
callq 0x5651
movl %eax, %r12d
cmpw %ax, %bp
movb %r13b, 0x10(%rsp)
jle 0x1a601
cmpb $0x2, %r13b
jne 0x1a691
movl $0x0, 0x3c(%rsp)
movswl 0x8(%rsp), %r13d
movq %r15, %rdi
movl $0x20, %esi
movl $0x20, %edx
callq 0x27d87
movzwl %ax, %eax
leal (%rax,%rax,2), %eax
addl %r13d, %eax
negl %eax
movl %eax, 0x38(%rsp)
jmp 0x1a6c0
movzwl 0xa(%rsp), %ebp
movq %rbx, %rdi
callq 0x567b
cmpw %ax, %bp
jle 0x1a51c
leaq 0x39142(%rip), %rax     # 0x53650
movq (%r14), %rdi
callq *(%rax)
cmpl $0x3, %eax
ja 0x1a7a8
movw $0xffff, 0x10(%r14)     # imm = 0xFFFF
jmp 0x1a791
movq %rbx, 0x18(%rsp)
orb $0x3, 0x48(%rsp)
movl $0x0, 0x38(%rsp)
movq $0x0, 0x30(%rsp)
leaq 0xefab(%rip), %rax      # 0x294f5
movq %rax, 0x28(%rsp)
movq 0x28(%r12), %rdi
movl $0x20, %esi
movl $0x20, %edx
callq 0x27d87
movzwl %ax, %eax
movswl 0x30(%r12), %ecx
addl %eax, %ecx
imull $0x3e8, %ecx, %eax      # imm = 0x3E8
movzwl 0x16(%r14), %ecx
cltd
idivl %ecx
leal (%rax,%rax,2), %eax
movw %ax, 0x44(%rsp)
movw %ax, 0x46(%rsp)
negl %eax
movw %ax, 0x42(%rsp)
movzwl 0x8(%rsp), %r13d
movq %rbx, %rdi
callq 0x5651
movl %eax, %ebp
cmpw %ax, %r13w
jle 0x1a61c
movq %rbx, %rdi
callq 0x5651
cwtl
movswl 0x8(%rsp), %ecx
subl %ecx, %eax
leaq 0x18(%rsp), %r12
movl %eax, 0x24(%r12)
leaq 0x571(%rip), %rcx       # 0x1ab38
movq %rcx, 0x8(%r12)
movzwl 0x16(%r14), %edi
movswl 0x20(%r12), %esi
movswl %ax, %edx
callq 0x29677
movw %ax, 0x28(%r12)
movq %r12, %rdi
callq 0x29521
jmp 0x1a632
movswl 0xa(%rsp), %esi
movq %rbx, %rdi
callq 0x572f
jmp 0x1a791
leaq 0x530(%rip), %rsi       # 0x1ab38
movq %rbx, %rdi
callq 0x295b1
movw $0x0, 0x12(%r14)
jmp 0x1a6f1
leaq 0x515(%rip), %rsi       # 0x1ab38
movq %rbx, %rdi
callq 0x295b1
movw $0x0, 0x12(%r14)
movzwl 0xa(%rsp), %r12d
movq %rbx, %rdi
callq 0x567b
cmpw %bp, %r13w
jg 0x1a72e
cmpw %ax, %r12w
jle 0x1a72e
movq %rbx, %rdi
callq 0x567b
cwtl
movswl 0xa(%rsp), %ecx
movzbl 0x10(%r15), %edx
addl %ecx, %edx
subl %edx, %eax
leaq 0x18(%rsp), %r15
movl %eax, 0x24(%r15)
leaq 0x4de(%rip), %rcx       # 0x1ab59
movq %rcx, 0x8(%r15)
movzwl 0x16(%r14), %edi
movswl 0x20(%r15), %esi
movswl %ax, %edx
jmp 0x1a77f
movl $0x0, 0x38(%rsp)
movswl 0x8(%rsp), %r13d
movq %r15, %rdi
movl $0x20, %esi
movl $0x20, %edx
callq 0x27d87
movzwl %ax, %eax
leal (%rax,%rax,2), %eax
addl %r13d, %eax
negl %eax
movl %eax, 0x3c(%rsp)
leaq 0x471(%rip), %rax       # 0x1ab38
leaq 0x18(%rsp), %r13
movq %rax, 0x8(%r13)
movzwl 0x16(%r14), %edi
movswl 0x20(%r13), %esi
movswl 0x24(%r13), %edx
callq 0x29677
movw %ax, 0x28(%r13)
movq %r13, %rdi
callq 0x29521
movzwl 0xa(%rsp), %r13d
movq %rbx, %rdi
callq 0x567b
cmpw %r12w, %bp
jg 0x1a72e
cmpw %ax, %r13w
jle 0x1a72e
cmpb $0x2, 0x10(%rsp)
jne 0x1a746
movl $0x0, 0x3c(%rsp)
movswl 0xa(%rsp), %eax
movzbl 0x10(%r15), %ecx
addl %eax, %ecx
negl %ecx
movl %ecx, 0x38(%rsp)
jmp 0x1a760
leaq 0x424(%rip), %rsi       # 0x1ab59
movq %rbx, %rdi
callq 0x295b1
movw $0x0, 0x14(%r14)
jmp 0x1a791
movl $0x0, 0x38(%rsp)
movswl 0xa(%rsp), %eax
movzbl 0x10(%r15), %ecx
addl %eax, %ecx
negl %ecx
movl %ecx, 0x3c(%rsp)
leaq 0x3f2(%rip), %rax       # 0x1ab59
leaq 0x18(%rsp), %r15
movq %rax, 0x8(%r15)
movzwl 0x16(%r14), %edi
movswl 0x20(%r15), %esi
movswl 0x24(%r15), %edx
callq 0x29677
movw %ax, 0x28(%r15)
movq %r15, %rdi
callq 0x29521
movq %rbx, %rdi
callq 0x4c36
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x5651
movl %eax, %ebp
movq 0x28(%r12), %rdi
movl $0x2e, %esi
movl $0x2e, %edx
callq 0x27d87
addw 0x30(%r12), %ax
leal (%rax,%rax,2), %eax
subl %eax, %ebp
leaq 0x18(%rsp), %r15
movw %bp, (%r15)
movq %rbx, %rdi
callq 0x567b
movl %eax, %ecx
movw %ax, 0x2(%r15)
cwtl
movq 0x28(%r12), %rdx
movzbl 0x10(%rdx), %esi
movswl 0x32(%r12), %edi
addl %edi, %esi
cltd
idivl %esi
addl %edi, %edx
subl %edx, %ecx
movw %cx, 0x2(%r15)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1af91
movl %eax, 0x54(%rsp)
movzwl %ax, %esi
leaq 0x38e20(%rip), %rax     # 0x53640
movq (%r14), %rdi
callq *(%rax)
leaq 0xc(%rsp), %rcx
movq %rax, 0x10(%rsp)
movl %eax, (%rcx)
movl $0x4, %ebp
xorl %r13d, %r13d
leaq 0x38dd8(%rip), %r15     # 0x53618
leaq 0x38de9(%rip), %r12     # 0x53630
movl 0xc(%rsp), %edi
addq (%r14), %rdi
callq *(%r15)
addb %al, %r13b
movq (%r14), %rdi
leaq 0xc(%rsp), %rsi
callq *(%r12)
decl %ebp
jne 0x1a847
movq 0x10(%rsp), %r15
movl %r15d, %r12d
movq (%r14), %rsi
addq %r12, %rsi
movzbl %r13b, %edx
movq %rbx, %rdi
callq 0x1a2e5
testb %al, %al
je 0x1a791
xorl %eax, %eax
movq (%r14), %rcx
leal (%r12,%rax), %edx
movb $0x2e, (%rcx,%rdx)
incq %rax
cmpq $0x3, %rax
jne 0x1a888
movq (%r14), %rax
addl $0x3, %r15d
movb $0x0, (%rax,%r15)
movl 0x54(%rsp), %eax
addl $0x3, %eax
movw %ax, 0x10(%r14)
jmp 0x1a791