// File: /workspace/github_c_makefile_star2_O3/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 0x286f8
testl %eax, %eax
je 0x28565
movq 0x8(%r15), %r12
movl %eax, %r13d
movzwl 0x22(%r15), %eax
cmpl $0x3fff, %eax           # imm = 0x3FFF
ja 0x284e3
movl (%r12,%r13,8), %eax
andl $0xfffff, %eax          # imm = 0xFFFFF
addq (%r15), %rax
jmp 0x286db
movzbl 0x4(%r12,%r13,8), %ecx
movzbl 0x5(%r12,%r13,8), %ebx
imull %ecx, %ebx
testl %ebx, %ebx
je 0x28565
shrl $0xa, %eax
andl $0x7, %eax
decl %eax
cmpl $0x3, %eax
ja 0x2851f
leaq 0x1777e(%rip), %rcx     # 0x3fc88
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
shrl %ebx
jmp 0x2851f
shrl $0x3, %ebx
jmp 0x2851f
shrl $0x2, %ebx
movq 0x37f62(%rip), %rdi     # 0x60488
callq 0x2a0fb
movq 0x37f56(%rip), %rdi     # 0x60488
cmpl %ebx, %eax
jae 0x2856c
movl %ebx, %esi
callq 0x2a06f
movq %rax, 0x37f44(%rip)     # 0x60488
movq %rax, %rdi
callq 0x80e4
movq 0x37f35(%rip), %rsi     # 0x60488
testb %al, %al
je 0x286ea
movq %rsi, 0x8(%rsp)
testq %rsi, %rsi
jne 0x28571
xorl %eax, %eax
jmp 0x286db
movq %rdi, 0x8(%rsp)
movl (%r12,%r13,8), %eax
andl $0xfffff, %eax          # imm = 0xFFFFF
addq (%r15), %rax
movzbl 0x4(%r12,%r13,8), %edx
movzbl 0x5(%r12,%r13,8), %ecx
movq %rdx, %r13
movl %ecx, 0x4(%rsp)
movzwl 0x22(%r15), %ecx
shrl $0xa, %ecx
andb $0x7, %cl
cmpb $0x3, %cl
movzbl %cl, %ebp
movl $0x4, %ebx
cmovnel %ebp, %ebx
movq %rax, 0x37ee0(%rip)     # 0x60490
movb %bpl, 0x37ee1(%rip)     # 0x60498
xorl %r15d, %r15d
movl %r15d, 0x37edb(%rip)    # 0x6049c
movl %r15d, 0x37ed8(%rip)    # 0x604a0
movb %r15b, 0x37ed5(%rip)    # 0x604a4
movb %r15b, 0x37ecf(%rip)    # 0x604a5
leal (%rdx,%rdx), %edi
callq 0x36748
movq %rax, %r12
movq %rax, %rdi
movl %r13d, %esi
callq 0x28a0c
movzbl %bl, %eax
testq %r13, %r13
movq 0x8(%rsp), %rbx
movq %r13, 0x10(%rsp)
je 0x28632
xorl %r14d, %r14d
xorl %r15d, %r15d
movzbl (%r12,%r14), %edx
movq %rbx, %rdi
movl %r15d, %esi
movl %ebp, %ecx
movq %r12, %r13
movl %eax, %r12d
callq 0x28c17
movl %r12d, %eax
movq %r13, %r12
movq 0x10(%rsp), %r13
addl %eax, %r15d
incq %r14
cmpq %r14, %r13
jne 0x28604
movq %r12, 0x28(%rsp)
movl %eax, 0x18(%rsp)
movl %ebp, 0x1c(%rsp)
cmpb $0x2, 0x4(%rsp)
jb 0x286d4
movq 0x28(%rsp), %rdi
addq %r13, %rdi
movw $0x1, %ax
movzwl %r13w, %ecx
movl %ecx, 0x20(%rsp)
movq %rdi, 0x30(%rsp)
movq 0x8(%rsp), %rbx
movl 0x18(%rsp), %r12d
movq 0x28(%rsp), %rbp
movl %eax, 0x24(%rsp)
movl 0x20(%rsp), %esi
callq 0x28a0c
testb %r13b, %r13b
je 0x286bd
xorl %r14d, %r14d
movl 0x1c(%rsp), %r13d
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 0x28c17
addl %r12d, %r15d
incq %r14
cmpq %r14, 0x10(%rsp)
jne 0x2868c
movl 0x24(%rsp), %eax
incl %eax
cmpw 0x4(%rsp), %ax
movq 0x10(%rsp), %r13
movq 0x30(%rsp), %rdi
jne 0x28672
movq 0x37dad(%rip), %rax     # 0x60488
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x169df(%rip), %rdi     # 0x3f0d0
callq 0x8294
jmp 0x286f6