// File: /workspace/github_c_makefile_star2_O3/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_label.c
// Function: lv_label_is_char_under_pos
bool lv_label_is_char_under_pos(const lv_obj_t * label, lv_point_t * pos)
{
    LV_ASSERT_OBJ(label, LV_OBJX_NAME);
    LV_ASSERT_NULL(pos);

    const char * txt         = lv_label_get_text(label);
    lv_label_ext_t * ext     = lv_obj_get_ext_attr(label);
    uint32_t line_start      = 0;
    uint32_t new_line_start  = 0;
    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;
    uint8_t letter_height    = lv_font_get_line_height(font);
    lv_coord_t y             = 0;
    lv_txt_flag_t flag       = LV_TXT_FLAG_NONE;
    lv_label_align_t align = lv_label_get_align(label);

    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 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;
    }

    /*Search the line of the index letter */;
    while(txt[line_start] != '\0') {
        new_line_start += lv_txt_get_next_line(&txt[line_start], font, style->text.letter_space, max_w, flag);

        if(pos->y <= y + letter_height) break; /*The line is found (stored in 'line_start')*/
        y += letter_height + style->text.line_space;

        line_start = new_line_start;
    }

    /*Calculate the x coordinate*/
    lv_coord_t x      = 0;
    lv_coord_t last_x = 0;
    if(align == LV_LABEL_ALIGN_CENTER) {
        lv_coord_t line_w;
        line_w = lv_txt_get_width(&txt[line_start], new_line_start - line_start, font, style->text.letter_space, flag);
        x += lv_obj_get_width(label) / 2 - line_w / 2;
    }
    else if(align == LV_LABEL_ALIGN_RIGHT) {
        lv_coord_t line_w;
        line_w = lv_txt_get_width(&txt[line_start], new_line_start - line_start, font, style->text.letter_space, flag);
        x += lv_obj_get_width(label) - line_w;
    }

    lv_txt_cmd_state_t cmd_state = LV_TXT_CMD_STATE_WAIT;

    uint32_t i           = line_start;
    uint32_t i_current   = i;
    uint32_t letter      = '\0';
    uint32_t letter_next = '\0';

    if(new_line_start > 0) {
        while(i <= new_line_start - 1) {
            /* Get the current letter
             * Be careful 'i' already points to the next character */
            letter = lv_txt_encoded_next(txt, &i);

            /*Get the next letter for kerning*/
            letter_next = lv_txt_encoded_next(&txt[i], NULL);

            /*Handle the recolor command*/
            if((flag & LV_TXT_FLAG_RECOLOR) != 0) {
                if(lv_txt_is_cmd(&cmd_state, txt[i]) != false) {
                    continue; /*Skip the letter is it is part of a command*/
                }
            }
            last_x = x;
            x += lv_font_get_glyph_width(font, letter, letter_next);
            if(pos->x < x) {
                i = i_current;
                break;
            }
            x += style->text.letter_space;
            i_current = i;
        }
    }

    int32_t max_diff = lv_font_get_glyph_width(font, letter, letter_next) + style->text.letter_space + 1;
    return (pos->x >= (last_x - style->text.letter_space) && pos->x <= (last_x + max_diff));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %rbx
movq %rdi, %r12
callq 0x80e4
testb %al, %al
je 0x1bc3b
movq %rbx, %rdi
callq 0x80e4
testb %al, %al
je 0x1bc4c
movq %rbx, 0x30(%rsp)
movq %r12, %rdi
callq 0x1aa00
movq %rax, %r14
movq %r12, %rdi
callq 0x6af7
movq %rax, %r15
movq %r12, %rdi
callq 0x566d
movl %eax, %ebx
movq %r12, %rdi
callq 0x66b6
movq %rax, 0x18(%rsp)
movq 0x28(%rax), %rax
movq %rax, 0x10(%rsp)
movzbl 0x10(%rax), %eax
movl %eax, 0x28(%rsp)
movq %r12, 0x40(%rsp)
movq %r12, %rdi
callq 0x1a9c6
movzwl 0x18(%r15), %esi
movl %esi, %ecx
shrb $0x6, %cl
movl %ecx, %edx
andb $0x1, %dl
orb $0x2, %cl
testb %sil, %sil
movzbl %dl, %edx
movzbl %cl, %edi
cmovnsl %edx, %edi
leal 0x4(%rdi), %ecx
movb %al, 0xa(%rsp)
cmpb $0x1, %al
movzbl %cl, %eax
movq %rdi, 0x50(%rsp)
movl %edi, %ecx
movl %eax, 0x38(%rsp)
cmovel %eax, %ecx
testb $0x7, %sil
movl $0x7c18, %eax           # imm = 0x7C18
cmovnel %ebx, %eax
cmpb $0x0, (%r14)
movq %r14, 0x48(%rsp)
movl %ecx, 0x3c(%rsp)
je 0x1bc5d
xorl %r13d, %r13d
cwtl
movl %eax, 0x20(%rsp)
movzbl %cl, %ebx
movq %r14, %r15
xorl %ebp, %ebp
movq 0x18(%rsp), %r12
movswl 0x30(%r12), %edx
movq %r15, %rdi
movq 0x10(%rsp), %rsi
movl 0x20(%rsp), %ecx
movl %ebx, %r8d
callq 0x2ae1d
movzwl %ax, %r14d
addl %r13d, %r14d
movq 0x30(%rsp), %rax
movswl 0x2(%rax), %eax
movswl %bp, %ebp
addl 0x28(%rsp), %ebp
cmpl %eax, %ebp
jge 0x1bc6b
movzwl 0x32(%r12), %eax
addl %eax, %ebp
movl %r14d, %eax
movq 0x48(%rsp), %rcx
leaq (%rcx,%rax), %r15
cmpb $0x0, (%rcx,%rax)
movl %r14d, %r13d
jne 0x1bbe7
jmp 0x1bc6b
leaq 0x235a2(%rip), %rdi     # 0x3f1e4
movq %r12, %rsi
callq 0x8294
jmp 0x1bc4a
leaq 0x23591(%rip), %rdi     # 0x3f1e4
movq %rbx, %rsi
callq 0x8294
jmp 0x1bc5b
xorl %r13d, %r13d
movq %r14, %r15
xorl %r14d, %r14d
movq 0x18(%rsp), %r12
movb 0xa(%rsp), %al
cmpb $0x1, %al
jne 0x1bcbe
movl %r14d, %eax
subl %r13d, %eax
movswl 0x30(%r12), %ecx
movzwl %ax, %esi
movq %r15, %rdi
movq 0x10(%rsp), %rdx
movl 0x38(%rsp), %r8d
callq 0x2b2a4
movl %eax, %ebx
movzwl %ax, %ebp
movq 0x40(%rsp), %rdi
callq 0x566d
movzwl %ax, %ecx
shrl $0xf, %ecx
addl %eax, %ecx
movswl %cx, %eax
sarl %eax
shrl $0xf, %ebp
addl %ebx, %ebp
movswl %bp, %ecx
sarl %ecx
subl %ecx, %eax
jmp 0x1bcf6
cmpb $0x2, %al
jne 0x1bcf4
movl %r14d, %eax
subl %r13d, %eax
movswl 0x30(%r12), %ecx
movzwl %ax, %esi
movzbl 0x50(%rsp), %r8d
movq %r15, %rdi
movq 0x10(%rsp), %rdx
callq 0x2b2a4
movl %eax, %ebx
movq 0x40(%rsp), %rdi
callq 0x566d
subl %ebx, %eax
jmp 0x1bcf6
xorl %eax, %eax
movb $0x0, 0xb(%rsp)
movl %r13d, 0xc(%rsp)
testl %r14d, %r14d
movq 0x48(%rsp), %r12
je 0x1bdb2
decl %r14d
xorl %edx, %edx
movl $0x0, %ebp
movl $0x0, %r15d
cmpl %r14d, %r13d
ja 0x1bdc0
xorl %ecx, %ecx
leaq 0x37900(%rip), %rbx     # 0x53630
movq %rcx, 0x20(%rsp)
movq %rax, 0x28(%rsp)
movq %r12, %rdi
leaq 0xc(%rsp), %rsi
callq *(%rbx)
movl %eax, %ebp
movl 0xc(%rsp), %edi
addq %r12, %rdi
xorl %esi, %esi
callq *(%rbx)
movl %eax, %r15d
testb $0x1, 0x3c(%rsp)
je 0x1bd7b
movl 0xc(%rsp), %eax
movsbl (%r12,%rax), %esi
leaq 0xb(%rsp), %rdi
callq 0x2b3cf
testb %al, %al
je 0x1bd7b
cmpl %r14d, 0xc(%rsp)
jbe 0x1bd3a
jmp 0x1bdbb
movq 0x10(%rsp), %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x28487
movq 0x28(%rsp), %rdx
addl %edx, %eax
movq 0x30(%rsp), %rcx
cmpw %ax, (%rcx)
jl 0x1be10
movq 0x18(%rsp), %rcx
addw 0x30(%rcx), %ax
movl 0xc(%rsp), %r13d
movl %edx, %ecx
cmpl %r14d, %r13d
jbe 0x1bd30
jmp 0x1bdc0
xorl %edx, %edx
xorl %ebp, %ebp
xorl %r15d, %r15d
jmp 0x1bdc0
movq 0x20(%rsp), %rdx
movq 0x10(%rsp), %rdi
movl %ebp, %esi
movq %rdx, %rbx
movl %r15d, %edx
callq 0x28487
movq 0x18(%rsp), %rcx
movswl 0x30(%rcx), %edx
movq 0x30(%rsp), %rcx
movswl (%rcx), %ecx
movswl %bx, %esi
movl %esi, %edi
subl %edx, %edi
cmpl %ecx, %edi
jle 0x1bdf2
xorl %eax, %eax
jmp 0x1be01
movzwl %ax, %eax
addl %eax, %esi
leal (%rdx,%rsi), %eax
incl %eax
cmpl %ecx, %eax
setge %al
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r13d, 0xc(%rsp)
jmp 0x1bdc0