// File: /workspace/github_c_makefile_star2_O1/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 $0x48, %rsp
movq %rsi, %rbx
movq %rdi, %r12
callq 0x80d4
testb %al, %al
je 0x1b438
movq %rbx, %rdi
callq 0x80d4
testb %al, %al
je 0x1b449
movq %rbx, 0x28(%rsp)
movq %r12, %rdi
callq 0x1a239
movq %rax, %r14
movq %r12, %rdi
callq 0x6ad8
movq %rax, %r15
movq %r12, %rdi
callq 0x5651
movl %eax, %ebx
movq %r12, %rdi
callq 0x6697
movq %rax, 0x18(%rsp)
movq 0x28(%rax), %rax
movq %rax, 0x10(%rsp)
movzbl 0x10(%rax), %eax
movl %eax, 0x20(%rsp)
movq %r12, 0x38(%rsp)
movq %r12, %rdi
callq 0x1a1ff
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, %ecx
cmovnsl %edx, %ecx
leal 0x4(%rcx), %edx
movb %al, 0x6(%rsp)
cmpb $0x1, %al
movzbl %dl, %edx
cmovnel %ecx, %edx
testb $0x7, %sil
movl $0x7c18, %eax           # imm = 0x7C18
cmovnel %ebx, %eax
cmpb $0x0, (%r14)
movl %edx, 0x34(%rsp)
movzbl %dl, %ecx
movl %ecx, 0x8(%rsp)
movq %r14, 0x40(%rsp)
je 0x1b45a
xorl %r13d, %r13d
movswl %ax, %ebx
movq %r14, %r15
xorl %ebp, %ebp
movq 0x18(%rsp), %r12
movswl 0x30(%r12), %edx
movq %r15, %rdi
movq 0x10(%rsp), %rsi
movl %ebx, %ecx
movl 0x8(%rsp), %r8d
callq 0x2a787
movzwl %ax, %r14d
addl %r13d, %r14d
movq 0x28(%rsp), %rax
movswl 0x2(%rax), %eax
movswl %bp, %ebp
addl 0x20(%rsp), %ebp
cmpl %eax, %ebp
jge 0x1b468
movzwl 0x32(%r12), %eax
addl %eax, %ebp
movl %r14d, %eax
movq 0x40(%rsp), %rcx
leaq (%rcx,%rax), %r15
cmpb $0x0, (%rcx,%rax)
movl %r14d, %r13d
jne 0x1b3e4
jmp 0x1b468
leaq 0x23cf5(%rip), %rdi     # 0x3f134
movq %r12, %rsi
callq 0x829e
jmp 0x1b447
leaq 0x23ce4(%rip), %rdi     # 0x3f134
movq %rbx, %rsi
callq 0x829e
jmp 0x1b458
xorl %r13d, %r13d
movq %r14, %r15
xorl %r14d, %r14d
movq 0x18(%rsp), %r12
movb 0x6(%rsp), %al
cmpb $0x1, %al
jne 0x1b4bb
movl %r14d, %eax
subl %r13d, %eax
movswl 0x30(%r12), %ecx
movzwl %ax, %esi
movq %r15, %rdi
movq 0x10(%rsp), %rdx
movl 0x8(%rsp), %r8d
callq 0x2ab49
movl %eax, %ebx
movzwl %ax, %ebp
movq 0x38(%rsp), %rdi
callq 0x5651
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 0x1b4f2
cmpb $0x2, %al
jne 0x1b4f0
movl %r14d, %eax
subl %r13d, %eax
movswl 0x30(%r12), %ecx
movzwl %ax, %esi
movq %r15, %rdi
movq 0x10(%rsp), %rdx
movl 0x8(%rsp), %r8d
callq 0x2ab49
movl %eax, %ebx
movq 0x38(%rsp), %rdi
callq 0x5651
subl %ebx, %eax
jmp 0x1b4f2
xorl %eax, %eax
movb $0x0, 0x7(%rsp)
movl %r13d, (%rsp)
testl %r14d, %r14d
movq 0x40(%rsp), %r12
je 0x1b5a8
decl %r14d
xorl %edx, %edx
movl $0x0, %ebp
movl $0x0, %r15d
cmpl %r14d, (%rsp)
ja 0x1b5b6
xorl %ecx, %ecx
leaq 0x38104(%rip), %rbx     # 0x53630
movq %rcx, 0x20(%rsp)
movq %rax, 0x8(%rsp)
movq %r12, %rdi
movq %rsp, %rsi
callq *(%rbx)
movl %eax, %ebp
movl (%rsp), %edi
addq %r12, %rdi
xorl %esi, %esi
callq *(%rbx)
movl %eax, %r15d
testb $0x1, 0x34(%rsp)
je 0x1b572
movl (%rsp), %eax
movsbl (%r12,%rax), %esi
leaq 0x7(%rsp), %rdi
callq 0x2ac84
testb %al, %al
je 0x1b572
cmpl %r14d, (%rsp)
jbe 0x1b536
jmp 0x1b5b1
movq 0x10(%rsp), %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x27d87
movq 0x8(%rsp), %rdx
addl %edx, %eax
movq 0x28(%rsp), %rcx
cmpw %ax, (%rcx)
jl 0x1b606
movq 0x18(%rsp), %rcx
addw 0x30(%rcx), %ax
movl (%rsp), %r13d
movl %edx, %ecx
cmpl %r14d, %r13d
jbe 0x1b52c
jmp 0x1b5b6
xorl %edx, %edx
xorl %ebp, %ebp
xorl %r15d, %r15d
jmp 0x1b5b6
movq 0x20(%rsp), %rdx
movq 0x10(%rsp), %rdi
movl %ebp, %esi
movq %rdx, %rbx
movl %r15d, %edx
callq 0x27d87
movq 0x18(%rsp), %rcx
movswl 0x30(%rcx), %edx
movq 0x28(%rsp), %rcx
movswl (%rcx), %ecx
movswl %bx, %esi
movl %esi, %edi
subl %edx, %edi
cmpl %ecx, %edi
jle 0x1b5e8
xorl %eax, %eax
jmp 0x1b5f7
movzwl %ax, %eax
addl %eax, %esi
leal (%rdx,%rsi), %eax
incl %eax
cmpl %ecx, %eax
setge %al
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r13d, (%rsp)
jmp 0x1b5b6