// File: /workspace/github_c_makefile_star2_O1/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), %r13
movl %edx, %esi
callq 0x27ff1
movl %eax, %ebp
testl %eax, %eax
je 0x2830e
xorl %r12d, %r12d
movq %r13, 0x8(%rsp)
cmpq $0x0, 0x18(%r13)
movl %ebp, %r13d
je 0x282bc
movq %r14, %rdi
movl %r15d, %esi
callq 0x27ff1
testl %eax, %eax
je 0x282bc
movq 0x18(%r14), %rcx
testb $0x20, 0x23(%rcx)
movq 0x18(%rcx), %r15
jne 0x28237
movl 0x10(%r15), %edx
movl %edx, %ecx
shrl $0x18, %ecx
andl $0x3, %ecx
cmpl $0x1, %ecx
je 0x28277
testl %ecx, %ecx
jne 0x282b6
movq (%r15), %r14
shll $0x8, %eax
addl %ebp, %eax
leaq 0x6(%rsp), %rdi
movw %ax, (%rdi)
andl $0xffffff, %edx         # imm = 0xFFFFFF
leaq 0x112(%rip), %r8        # 0x2832b
movq %r14, %rsi
movl $0x2, %ecx
callq 0x2b004
testq %rax, %rax
je 0x282b6
subq %r14, %rax
shrq %rax
jmp 0x282ad
movq 0x8(%r15), %rdx
movzbl (%rdx,%r13), %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 0x282b6
movzbl %al, %eax
movq (%r15), %rdx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
addl %esi, %ecx
movzbl 0x19(%r15), %edi
imull %ecx, %edi
addl %esi, %eax
addl %edi, %eax
movb (%rdx,%rax), %al
jmp 0x282b8
movq (%r15), %r14
shll $0x8, %eax
addl %ebp, %eax
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
andl $0xffffff, %edx         # imm = 0xFFFFFF
leaq 0xac(%rip), %r8         # 0x28340
movq %r14, %rsi
movl $0x4, %ecx
callq 0x2b004
testq %rax, %rax
je 0x282b6
subq %r14, %rax
shrq $0x4, %rax
movq 0x8(%r15), %rcx
movb (%rcx,%rax), %al
jmp 0x282b8
xorl %eax, %eax
movsbl %al, %r12d
movq 0x8(%rsp), %rsi
movq 0x8(%rsi), %rax
movzwl 0x20(%rsi), %ecx
imull %r12d, %ecx
shrl $0x4, %ecx
movl (%rax,%r13,8), %edx
shrl $0x14, %edx
addl %edx, %ecx
addl $0x8, %ecx
shrl $0x4, %ecx
movw %cx, (%rbx)
movb 0x5(%rax,%r13,8), %cl
movb %cl, 0x3(%rbx)
movb 0x4(%rax,%r13,8), %cl
movb %cl, 0x2(%rbx)
movb 0x6(%rax,%r13,8), %cl
movb %cl, 0x4(%rbx)
movb 0x7(%rax,%r13,8), %al
movb %al, 0x5(%rbx)
movzwl 0x22(%rsi), %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