// File: /workspace/github_c_makefile_star2_O1/OnionIoT[P]lv_example/lvgl/src/lv_font/lv_font_fmt_txt.c
// Function: lv_font_get_bitmap_fmt_txt
const uint8_t * lv_font_get_bitmap_fmt_txt(const lv_font_t * font, uint32_t unicode_letter)
{
    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 NULL;

    const lv_font_fmt_txt_glyph_dsc_t * gdsc = &fdsc->glyph_dsc[gid];

    if(fdsc->bitmap_format == LV_FONT_FMT_TXT_PLAIN) {
        if(gdsc) return &fdsc->glyph_bitmap[gdsc->bitmap_index];
    }
    /*Handle compressed bitmap*/
    else
    {
        static uint8_t * buf = NULL;

        uint32_t gsize = gdsc->box_w * gdsc->box_h;
        if(gsize == 0) return NULL;

        uint32_t buf_size = gsize;
        switch(fdsc->bpp) {
        case 1: buf_size = gsize >> 3;  break;
        case 2: buf_size = gsize >> 2;  break;
        case 3: buf_size = gsize >> 1;  break;
        case 4: buf_size = gsize >> 1;  break;
        }

        if(lv_mem_get_size(buf) < buf_size) {
            buf = lv_mem_realloc(buf, buf_size);
            LV_ASSERT_MEM(buf);
            if(buf == NULL) return NULL;
        }

        decompress(&fdsc->glyph_bitmap[gdsc->bitmap_index], buf, gdsc->box_w , gdsc->box_h, (uint8_t)fdsc->bpp);
        return buf;
    }

    /*If not returned earlier then the letter is not found in this font*/
    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq 0x18(%rdi), %r15
callq 0x27ff1
testl %eax, %eax
je 0x27fd2
movq 0x8(%r15), %rbx
movl %eax, %r12d
movzwl 0x22(%r15), %eax
cmpl $0x3fff, %eax           # imm = 0x3FFF
ja 0x27de3
movl (%rbx,%r12,8), %eax
andl $0xfffff, %eax          # imm = 0xFFFFF
addq (%r15), %rax
jmp 0x27fd4
movzbl 0x4(%rbx,%r12,8), %ecx
movzbl 0x5(%rbx,%r12,8), %ebp
imull %ecx, %ebp
testl %ebp, %ebp
je 0x27fd2
shrl $0xa, %eax
andl $0x7, %eax
decl %eax
cmpl $0x3, %eax
ja 0x27e23
leaq 0x17ce2(%rip), %rcx     # 0x3faf0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
shrl %ebp
jmp 0x27e23
shrl $0x3, %ebp
jmp 0x27e23
shrl $0x2, %ebp
movq 0x3865e(%rip), %rdi     # 0x60488
callq 0x29a7b
cmpl %ebp, %eax
jae 0x27e68
movq 0x3864e(%rip), %rdi     # 0x60488
movl %ebp, %esi
callq 0x299f8
movq %rax, 0x38640(%rip)     # 0x60488
movq %rax, %rdi
callq 0x80d4
movq 0x38631(%rip), %rsi     # 0x60488
testb %al, %al
je 0x27fe3
testq %rsi, %rsi
je 0x27fd2
movl (%rbx,%r12,8), %eax
andl $0xfffff, %eax          # imm = 0xFFFFF
addq (%r15), %rax
movq 0x3860d(%rip), %rcx     # 0x60488
movq %rcx, 0x20(%rsp)
movzbl 0x4(%rbx,%r12,8), %ebp
movzbl 0x5(%rbx,%r12,8), %ecx
movl %ecx, 0x4(%rsp)
movzwl 0x22(%r15), %ecx
shrl $0xa, %ecx
andb $0x7, %cl
cmpb $0x3, %cl
movzbl %cl, %r14d
movl $0x4, %ebx
cmovnel %r14d, %ebx
movq %rax, 0x385de(%rip)     # 0x60490
movb %r14b, 0x385df(%rip)    # 0x60498
xorl %r15d, %r15d
movl %r15d, 0x385d9(%rip)    # 0x6049c
movl %r15d, 0x385d6(%rip)    # 0x604a0
movb %r15b, 0x385d3(%rip)    # 0x604a4
movb %r15b, 0x385cd(%rip)    # 0x604a5
leal (,%rbp,2), %edi
callq 0x3638c
movq %rax, %r12
movq %rax, %rdi
movl %ebp, %esi
callq 0x28356
movzbl %bl, %r13d
movl %r14d, %ebx
testq %rbp, %rbp
je 0x27f22
xorl %r14d, %r14d
xorl %r15d, %r15d
movzbl (%r12,%r14), %edx
movq 0x20(%rsp), %rdi
movl %r15d, %esi
movl %ebx, %ecx
callq 0x28554
addl %r13d, %r15d
incq %r14
cmpq %r14, %rbp
jne 0x27f03
movq %r12, 0x18(%rsp)
movl %r13d, 0x8(%rsp)
movl %ebx, 0xc(%rsp)
cmpb $0x2, 0x4(%rsp)
jb 0x27fc9
movq 0x18(%rsp), %rdi
addq %rbp, %rdi
movw $0x1, %ax
movzwl %bp, %ecx
movl %ecx, 0x10(%rsp)
movq %rdi, 0x30(%rsp)
movq %rbp, 0x28(%rsp)
movq 0x20(%rsp), %rbx
movl 0xc(%rsp), %r13d
movl 0x8(%rsp), %r12d
movl %eax, 0x14(%rsp)
movl 0x10(%rsp), %esi
callq 0x28356
testb %bpl, %bpl
je 0x27fb2
xorl %r14d, %r14d
movq 0x18(%rsp), %rbp
movb (%rbp,%r14), %al
movq 0x30(%rsp), %rcx
xorb (%rcx,%r14), %al
movb %al, (%rbp,%r14)
movzbl %al, %edx
movq %rbx, %rdi
movl %r15d, %esi
movl %r13d, %ecx
callq 0x28554
addl %r12d, %r15d
incq %r14
cmpq %r14, 0x28(%rsp)
jne 0x27f81
movl 0x14(%rsp), %eax
incl %eax
cmpw 0x4(%rsp), %ax
movq 0x28(%rsp), %rbp
movq 0x30(%rsp), %rdi
jne 0x27f67
movq 0x384b8(%rip), %rax     # 0x60488
jmp 0x27fd4
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x17056(%rip), %rdi     # 0x3f040
callq 0x829e
jmp 0x27fef