// File: /workspace/github_c_makefile_star2_O2/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 $0x18, %rsp
movq 0x18(%rdi), %r15
callq 0x26263
testl %eax, %eax
je 0x261ce
movq 0x8(%r15), %r12
movl %eax, %r13d
movzwl 0x22(%r15), %eax
cmpl $0x3fff, %eax           # imm = 0x3FFF
ja 0x26097
movl (%r12,%r13,8), %eax
andl $0xfffff, %eax          # imm = 0xFFFFF
addq (%r15), %rax
jmp 0x26243
movzbl 0x4(%r12,%r13,8), %ecx
movzbl 0x5(%r12,%r13,8), %ebx
imull %ecx, %ebx
testl %ebx, %ebx
je 0x261ce
shrl $0xa, %eax
andl $0x7, %eax
decl %eax
cmpl $0x3, %eax
ja 0x260d7
leaq 0x15ab2(%rip), %rcx     # 0x3bb74
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
shrl %ebx
jmp 0x260d7
shrl $0x3, %ebx
jmp 0x260d7
shrl $0x2, %ebx
movq 0x383aa(%rip), %rdi     # 0x5e488
callq 0x27b65
movq 0x3839e(%rip), %r14     # 0x5e488
cmpl %ebx, %eax
jae 0x2611f
movl %ebx, %esi
movq %r14, %rdi
callq 0x27ad9
movq %rax, 0x38389(%rip)     # 0x5e488
movq %rax, %rdi
callq 0x7994
movq 0x3837a(%rip), %r14     # 0x5e488
testb %al, %al
je 0x26252
testq %r14, %r14
je 0x261ce
movl (%r12,%r13,8), %eax
andl $0xfffff, %eax          # imm = 0xFFFFF
addq (%r15), %rax
movzbl 0x4(%r12,%r13,8), %ebp
movzbl 0x5(%r12,%r13,8), %ecx
movl %ecx, 0x10(%rsp)
movzwl 0x22(%r15), %ecx
shrl $0xa, %ecx
andb $0x7, %cl
cmpb $0x3, %cl
movzbl %cl, %ecx
pushq $0x4
popq %r12
cmovnel %ecx, %r12d
movq %rax, 0x38335(%rip)     # 0x5e490
andl $0x0, 0x3833a(%rip)     # 0x5e49c
movl %ecx, 0x8(%rsp)
movb %cl, 0x3832c(%rip)      # 0x5e498
andl $0x0, 0x3832d(%rip)     # 0x5e4a0
xorl %r13d, %r13d
movb %r13b, 0x38327(%rip)    # 0x5e4a4
movb %r13b, 0x38321(%rip)    # 0x5e4a5
leal (,%rbp,2), %edi
callq 0x334c8
movq %rax, %r15
movq %rax, %rdi
movq %rbp, %rbx
movl %ebp, %esi
callq 0x26564
movzbl %r12b, %eax
movl %eax, 0x4(%rsp)
xorl %r12d, %r12d
cmpq %r13, %rbx
je 0x261d2
movzbl (%r15,%r13), %edx
movq %r14, %rdi
movl %r12d, %esi
movl 0x8(%rsp), %ecx
callq 0x26752
addl 0x4(%rsp), %r12d
incq %r13
jmp 0x261ab
xorl %eax, %eax
jmp 0x26243
movq %r15, %r13
movq %rbx, %rax
addq %rbx, %r13
movw $0x1, %cx
movzwl %ax, %eax
movl %eax, 0xc(%rsp)
cmpw 0x10(%rsp), %cx
jae 0x2623c
movl %ecx, 0x14(%rsp)
movq %r14, %rbp
movq %r13, %rdi
movl 0xc(%rsp), %esi
callq 0x26564
xorl %r14d, %r14d
cmpq %r14, %rbx
je 0x26231
movb (%r15,%r14), %al
xorb (%r13,%r14), %al
movb %al, (%r15,%r14)
movzbl %al, %edx
movq %rbp, %rdi
movl %r12d, %esi
movl 0x8(%rsp), %ecx
callq 0x26752
addl 0x4(%rsp), %r12d
incq %r14
jmp 0x26203
movl 0x14(%rsp), %ecx
incl %ecx
movq %rbp, %r14
jmp 0x261e6
movq 0x38245(%rip), %rax     # 0x5e488
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x14de7(%rip), %rdi     # 0x3b040
movq %r14, %rsi
callq 0x7b01
jmp 0x26261