// File: /workspace/github_c_makefile_star2_O3/OnionIoT[P]lv_example/lvgl/src/lv_font/lv_font_fmt_txt.c
// Function: lv_font_get_glyph_dsc_fmt_txt
bool lv_font_get_glyph_dsc_fmt_txt(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out, uint32_t unicode_letter, uint32_t unicode_letter_next)
{
    lv_font_fmt_txt_dsc_t * fdsc = (lv_font_fmt_txt_dsc_t *) font->dsc;
    uint32_t gid = get_glyph_dsc_id(font, unicode_letter);
    if(!gid) return false;

    int8_t kvalue = 0;
    if(fdsc->kern_dsc) {
        uint32_t gid_next = get_glyph_dsc_id(font, unicode_letter_next);
        if(gid_next) {
            kvalue = get_kern_value(font, gid, gid_next);
        }
    }

    /*Put together a glyph dsc*/
    const lv_font_fmt_txt_glyph_dsc_t * gdsc = &fdsc->glyph_dsc[gid];

    int32_t kv = ((int32_t)((int32_t)kvalue * fdsc->kern_scale) >> 4);

    uint32_t adv_w = gdsc->adv_w + kv;
    adv_w  = (adv_w + (1 << 3)) >> 4;

    dsc_out->adv_w = adv_w;
    dsc_out->box_h = gdsc->box_h;
    dsc_out->box_w = gdsc->box_w;
    dsc_out->ofs_x = gdsc->ofs_x;
    dsc_out->ofs_y = gdsc->ofs_y;
    dsc_out->bpp   = (uint8_t)fdsc->bpp;

    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %r15d
movq %rsi, %rbx
movq %rdi, %r14
movq 0x18(%rdi), %r12
movl %edx, %esi
callq 0x286f8
movl %eax, %ebp
testl %eax, %eax
je 0x289c4
xorl %r13d, %r13d
cmpq $0x0, 0x18(%r12)
movl %ebp, %r8d
je 0x2898a
movq %r14, %rdi
movl %r15d, %esi
movq %r8, %r15
callq 0x286f8
movq %r15, %r8
testl %eax, %eax
je 0x2898a
movq 0x18(%r14), %rcx
testb $0x20, 0x23(%rcx)
movq 0x18(%rcx), %r13
jne 0x288fc
movl 0x10(%r13), %edx
movl %edx, %ecx
shrl $0x18, %ecx
andl $0x3, %ecx
cmpl $0x1, %ecx
je 0x28941
testl %ecx, %ecx
jne 0x2893d
movq (%r13), %r14
shll $0x8, %eax
addl %ebp, %eax
leaq 0xe(%rsp), %rdi
movw %ax, (%rdi)
andl $0xffffff, %edx         # imm = 0xFFFFFF
leaq 0x103(%rip), %r8        # 0x289e1
movq %r14, %rsi
movl $0x2, %ecx
callq 0x2b755
testq %rax, %rax
je 0x28981
subq %r14, %rax
shrq %rax
jmp 0x28978
movq 0x8(%r13), %rdx
movzbl (%rdx,%r8), %ecx
testq %rcx, %rcx
setne %sil
movl %eax, %eax
movb (%rdx,%rax), %al
testb %al, %al
setne %dl
andb %sil, %dl
cmpb $0x1, %dl
jne 0x2893d
movzbl %al, %eax
movq (%r13), %rdx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
addl %esi, %ecx
movzbl 0x19(%r13), %edi
imull %ecx, %edi
addl %esi, %eax
addl %edi, %eax
movb (%rdx,%rax), %al
jmp 0x28986
xorl %eax, %eax
jmp 0x28986
movq (%r13), %r14
shll $0x8, %eax
addl %ebp, %eax
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
andl $0xffffff, %edx         # imm = 0xFFFFFF
leaq 0x97(%rip), %r8         # 0x289f6
movq %r14, %rsi
movl $0x4, %ecx
callq 0x2b755
testq %rax, %rax
je 0x28981
subq %r14, %rax
shrq $0x4, %rax
movq 0x8(%r13), %rcx
movb (%rcx,%rax), %al
jmp 0x28983
xorl %eax, %eax
movq %r15, %r8
movsbl %al, %r13d
movq 0x8(%r12), %rax
movzwl 0x20(%r12), %ecx
imull %r13d, %ecx
shrl $0x4, %ecx
movl (%rax,%r8,8), %edx
shrl $0x14, %edx
addl %edx, %ecx
addl $0x8, %ecx
shrl $0x4, %ecx
movw %cx, (%rbx)
movl 0x4(%rax,%r8,8), %eax
movl %eax, 0x2(%rbx)
movzwl 0x22(%r12), %eax
shrl $0xa, %eax
andb $0x7, %al
movb %al, 0x6(%rbx)
testl %ebp, %ebp
setne %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq