// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x41820
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0x4166d
movq $0x0, -0x8(%rbp)
jmp 0x41816
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x24(%rbp), %ecx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movw 0x22(%rax), %ax
shrw $0xe, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
jne 0x416c4
cmpq $0x0, -0x30(%rbp)
je 0x416bf
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movl (%rcx), %ecx
andl $0xfffff, %ecx          # imm = 0xFFFFF
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0x41816
jmp 0x4180e
movq -0x30(%rbp), %rax
movzbl 0x4(%rax), %eax
movq -0x30(%rbp), %rcx
movzbl 0x5(%rcx), %ecx
imull %ecx, %eax
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jne 0x416ed
movq $0x0, -0x8(%rbp)
jmp 0x41816
movl -0x34(%rbp), %eax
movl %eax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movzwl 0x22(%rax), %eax
shrl $0xa, %eax
andl $0x7, %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x40(%rbp)
subl $0x3, %eax
ja 0x4174a
movq -0x40(%rbp), %rax
leaq 0x27087(%rip), %rcx     # 0x687a0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl -0x34(%rbp), %eax
shrl $0x3, %eax
movl %eax, -0x38(%rbp)
jmp 0x4174a
movl -0x34(%rbp), %eax
shrl $0x2, %eax
movl %eax, -0x38(%rbp)
jmp 0x4174a
movl -0x34(%rbp), %eax
shrl %eax
movl %eax, -0x38(%rbp)
jmp 0x4174a
movl -0x34(%rbp), %eax
shrl %eax
movl %eax, -0x38(%rbp)
movq 0x47e07(%rip), %rdi     # 0x89558
callq 0x45090
cmpl -0x38(%rbp), %eax
jae 0x417ae
movq 0x47df6(%rip), %rdi     # 0x89558
movl -0x38(%rbp), %eax
movl %eax, %esi
callq 0x44f70
movq %rax, 0x47de5(%rip)     # 0x89558
movq 0x47dde(%rip), %rdi     # 0x89558
callq 0xd120
testb $0x1, %al
jne 0x41798
movq 0x47dce(%rip), %rsi     # 0x89558
leaq 0x268b3(%rip), %rdi     # 0x68044
callq 0xd410
jmp 0x41796
cmpq $0x0, 0x47db8(%rip)     # 0x89558
jne 0x417ac
movq $0x0, -0x8(%rbp)
jmp 0x41816
jmp 0x417ae
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x30(%rbp), %rax
movl (%rax), %eax
andl $0xfffff, %eax          # imm = 0xFFFFF
movl %eax, %eax
addq %rax, %rdi
movq 0x47d8c(%rip), %rsi     # 0x89558
movq -0x30(%rbp), %rax
movzbl 0x4(%rax), %eax
movw %ax, %dx
movq -0x30(%rbp), %rax
movzbl 0x5(%rax), %eax
movw %ax, %cx
movq -0x20(%rbp), %rax
movw 0x22(%rax), %ax
shrw $0xa, %ax
andw $0x7, %ax
movswl %dx, %edx
movswl %cx, %ecx
movzbl %al, %r8d
callq 0x41b70
movq 0x47d50(%rip), %rax     # 0x89558
movq %rax, -0x8(%rbp)
jmp 0x41816
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq