// File: /workspace/github_c_makefile_star2_O1/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_ta.c
// Function: refr_cursor_area
static void refr_cursor_area(lv_obj_t * ta)
{
    lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);

    const lv_style_t * label_style = lv_obj_get_style(ext->label);

    lv_style_t cur_style;
    get_cursor_style(ta, &cur_style);

    uint16_t cur_pos = lv_ta_get_cursor_pos(ta);
    const char * txt = lv_label_get_text(ext->label);

    uint32_t byte_pos;
    byte_pos = lv_txt_encoded_get_byte_id(txt, cur_pos);

    uint32_t letter = lv_txt_encoded_next(&txt[byte_pos], NULL);

    lv_coord_t letter_h = lv_font_get_line_height(label_style->text.font);

    /*Set letter_w (set not 0 on non printable but valid chars)*/
    lv_coord_t letter_w;
    if(letter == '\0' || letter == '\n' || letter == '\r') {
        letter_w = lv_font_get_glyph_width(label_style->text.font, ' ', '\0');
    } else {
        /*`letter_next` parameter is '\0' to ignore kerning*/
        letter_w = lv_font_get_glyph_width(label_style->text.font, letter, '\0');
    }

    lv_point_t letter_pos;
    lv_label_get_letter_pos(ext->label, cur_pos, &letter_pos);

    /*If the cursor is out of the text (most right) draw it to the next line*/
    if(letter_pos.x + ext->label->coords.x1 + letter_w > ext->label->coords.x2 && ext->one_line == 0 &&
       lv_label_get_align(ext->label) != LV_LABEL_ALIGN_RIGHT) {
        letter_pos.x = 0;
        letter_pos.y += letter_h + label_style->text.line_space;

        if(letter != '\0') {
            byte_pos += lv_txt_encoded_size(&txt[byte_pos]);
            letter = lv_txt_encoded_next(&txt[byte_pos], NULL);
        }

        if(letter == '\0' || letter == '\n' || letter == '\r') {
            letter_w = lv_font_get_glyph_width(label_style->text.font, ' ', '\0');
        } else {
            letter_w = lv_font_get_glyph_width(label_style->text.font, letter, '\0');
        }
    }

    /*Save the byte position. It is required to draw `LV_CURSOR_BLOCK`*/
    ext->cursor.txt_byte_pos = byte_pos;

    /*Draw he cursor according to the type*/
    lv_area_t cur_area;

    if(ext->cursor.type == LV_CURSOR_LINE) {
        cur_area.x1 =
            letter_pos.x + cur_style.body.padding.left - (cur_style.line.width >> 1) - (cur_style.line.width & 0x1);
        cur_area.y1 = letter_pos.y + cur_style.body.padding.top;
        cur_area.x2 = letter_pos.x + cur_style.body.padding.right + (cur_style.line.width >> 1);
        cur_area.y2 = letter_pos.y + cur_style.body.padding.bottom + letter_h;
    } else if(ext->cursor.type == LV_CURSOR_BLOCK) {
        cur_area.x1 = letter_pos.x - cur_style.body.padding.left;
        cur_area.y1 = letter_pos.y - cur_style.body.padding.top;
        cur_area.x2 = letter_pos.x + cur_style.body.padding.right + letter_w;
        cur_area.y2 = letter_pos.y + cur_style.body.padding.bottom + letter_h;

    } else if(ext->cursor.type == LV_CURSOR_OUTLINE) {
        cur_area.x1 = letter_pos.x - cur_style.body.padding.left;
        cur_area.y1 = letter_pos.y - cur_style.body.padding.top;
        cur_area.x2 = letter_pos.x + cur_style.body.padding.right + letter_w;
        cur_area.y2 = letter_pos.y + cur_style.body.padding.bottom + letter_h;
    } else if(ext->cursor.type == LV_CURSOR_UNDERLINE) {
        cur_area.x1 = letter_pos.x + cur_style.body.padding.left;
        cur_area.y1 = letter_pos.y + cur_style.body.padding.top + letter_h - (cur_style.line.width >> 1);
        cur_area.x2 = letter_pos.x + cur_style.body.padding.right + letter_w;
        cur_area.y2 = letter_pos.y + cur_style.body.padding.bottom + letter_h + (cur_style.line.width >> 1) +
                      (cur_style.line.width & 0x1);
    }

    /*Save the new area*/
    lv_disp_t * disp = lv_obj_get_disp(ta);
    lv_area_t area_tmp;
    lv_area_copy(&area_tmp, &ext->cursor.area);
    area_tmp.x1 += ext->label->coords.x1;
    area_tmp.y1 += ext->label->coords.y1;
    area_tmp.x2 += ext->label->coords.x1;
    area_tmp.y2 += ext->label->coords.y1;
    lv_inv_area(disp, &area_tmp);

    lv_area_copy(&ext->cursor.area, &cur_area);

    lv_area_copy(&area_tmp, &ext->cursor.area);
    area_tmp.x1 += ext->label->coords.x1;
    area_tmp.y1 += ext->label->coords.y1;
    area_tmp.x2 += ext->label->coords.x1;
    area_tmp.y2 += ext->label->coords.y1;
    lv_inv_area(disp, &area_tmp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdi, %r14
callq 0x6ad8
movq %rax, %rbx
movq 0x50(%rax), %rdi
callq 0x6697
movq %rax, %r13
leaq 0x20(%rsp), %rsi
movq %r14, %rdi
callq 0x2027a
movq %r14, 0x78(%rsp)
movq %r14, %rdi
callq 0x1f045
movl %eax, %ebp
movq 0x50(%rbx), %rdi
callq 0x1a239
movq %rax, %r12
leaq 0x33e6f(%rip), %rax     # 0x53640
movzwl %bp, %r15d
movq %r12, %rdi
movl %r15d, %esi
callq *(%rax)
leaq 0x33e4c(%rip), %rcx     # 0x53630
movq %rax, 0x10(%rsp)
movl %eax, %r14d
movq %r12, 0x68(%rsp)
addq %r12, %r14
movq %r14, %rdi
xorl %esi, %esi
callq *(%rcx)
movl %eax, %r12d
movq %r13, 0x70(%rsp)
movq 0x28(%r13), %rdi
movzbl 0x10(%rdi), %eax
movl %eax, 0x1c(%rsp)
cmpl $0xd, %r12d
ja 0x1f825
movl $0x20, %esi
movl $0x2401, %eax           # imm = 0x2401
btl %r12d, %eax
jb 0x1f828
movl %r12d, %esi
xorl %edx, %edx
callq 0x27d87
movl %eax, %ebp
movq 0x50(%rbx), %rdi
leaq 0xc(%rsp), %r13
movl %r15d, %esi
movq %r13, %rdx
callq 0x1ace1
movswl (%r13), %eax
movq 0x50(%rbx), %rdi
movswl 0x20(%rdi), %ecx
addl %eax, %ecx
movswl %bp, %eax
addl %ecx, %eax
movswl 0x24(%rdi), %ecx
cmpl %ecx, %eax
jle 0x1f877
testb $0x2, 0x98(%rbx)
jne 0x1f877
callq 0x1a1ff
cmpb $0x2, %al
jne 0x1fa58
movq 0x10(%rsp), %r14
movw %r14w, 0x8e(%rbx)
movzbl 0x90(%rbx), %eax
andl $0xf, %eax
decl %eax
cmpl $0x3, %eax
ja 0x1fa4f
leaq 0x1ffec(%rip), %rcx     # 0x3f88c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movzwl 0xc(%rsp), %eax
movswl 0x5e(%rsp), %ecx
movl %ecx, %ebp
sarl %ebp
andl $0x1, %ecx
movzwl 0x3a(%rsp), %edx
addw %ax, %dx
addl %ebp, %ecx
subl %ecx, %edx
movl %edx, 0x10(%rsp)
movzwl 0xe(%rsp), %ecx
movzwl 0x36(%rsp), %r13d
addw %cx, %r13w
addl %eax, %ebp
addw 0x3c(%rsp), %bp
movzwl 0x1c(%rsp), %r12d
addl %ecx, %r12d
jmp 0x1f993
movzwl 0x1c(%rsp), %r12d
movzwl 0xc(%rsp), %eax
movzwl 0x3a(%rsp), %ecx
addl %eax, %ebp
subw %cx, %ax
movl %eax, 0x10(%rsp)
movzwl 0xe(%rsp), %eax
movzwl 0x36(%rsp), %ecx
jmp 0x1f984
movl 0x1c(%rsp), %edi
movzwl %di, %r13d
movzwl 0xc(%rsp), %eax
movzwl 0x3a(%rsp), %ecx
addw %ax, %cx
movl %ecx, 0x10(%rsp)
movzwl 0xe(%rsp), %ecx
movswl 0x5e(%rsp), %edx
movl %edx, %esi
sarl %esi
addl %ecx, %r13d
addw 0x36(%rsp), %r13w
subl %esi, %r13d
addl %eax, %ebp
addw 0x3c(%rsp), %bp
movl %edx, %r12d
shrl %r12d
andl $0x1, %edx
addl %ecx, %r12d
addl %edx, %r12d
addl %edi, %r12d
jmp 0x1f993
movzwl 0xc(%rsp), %eax
movzwl 0x3a(%rsp), %ecx
addl %eax, %ebp
subw %cx, %ax
movl %eax, 0x10(%rsp)
movzwl 0xe(%rsp), %eax
movzwl 0x36(%rsp), %ecx
movzwl 0x1c(%rsp), %r12d
addl %eax, %r12d
movl %eax, %r13d
subw %cx, %r13w
addw 0x3c(%rsp), %bp
addw 0x38(%rsp), %r12w
movq 0x78(%rsp), %rdi
callq 0x5033
movq 0x86(%rbx), %rcx
leaq 0x80(%rsp), %r14
movq %rcx, (%r14)
movq 0x50(%rbx), %rdx
movl 0x20(%rdx), %esi
addl %esi, %ecx
movw %cx, (%r14)
movzwl 0x22(%rdx), %ecx
addw %cx, 0x2(%r14)
addw %si, 0x4(%r14)
movq %rax, %r15
addw %cx, 0x6(%r14)
movq %rax, %rdi
movq %r14, %rsi
callq 0x7184
movzwl %r12w, %eax
shlq $0x30, %rax
movzwl %bp, %ecx
shlq $0x20, %rcx
orq %rax, %rcx
shll $0x10, %r13d
orq %rcx, %r13
movl 0x10(%rsp), %esi
movzwl %si, %eax
orq %r13, %rax
movq %rax, 0x86(%rbx)
movq %rax, (%r14)
movq 0x50(%rbx), %rax
movl 0x20(%rax), %ecx
movl %ecx, %edx
addl %esi, %edx
movw %dx, (%r14)
movzwl 0x22(%rax), %eax
addw %ax, 0x2(%r14)
addw %cx, 0x4(%r14)
addw %ax, 0x6(%r14)
movq %r15, %rdi
movq %r14, %rsi
callq 0x7184
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, 0x10(%rsp)
jmp 0x1f999
movw $0x0, 0xc(%rsp)
movq 0x70(%rsp), %r15
movzwl 0x32(%r15), %eax
addw 0x1c(%rsp), %ax
addw %ax, 0xe(%rsp)
testl %r12d, %r12d
je 0x1faa4
leaq 0x33b99(%rip), %rax     # 0x53618
movq %r14, %rdi
callq *(%rax)
movzbl %al, %eax
movq 0x10(%rsp), %r14
addl %eax, %r14d
movq 0x68(%rsp), %rdi
addq %r14, %rdi
xorl %esi, %esi
leaq 0x33b90(%rip), %rax     # 0x53630
callq *(%rax)
jmp 0x1faab
xorl %eax, %eax
movq 0x10(%rsp), %r14
cmpl $0xd, %eax
ja 0x1fabf
movl $0x20, %esi
movl $0x2401, %ecx           # imm = 0x2401
btl %eax, %ecx
jb 0x1fac1
movl %eax, %esi
movq 0x28(%r15), %rdi
xorl %edx, %edx
callq 0x27d87
movl %eax, %ebp
jmp 0x1f87c