// File: /workspace/github_c_makefile_star2_O1/uobikiemukot[P]yaft/tools/bdf.h
// Function: read_bitmap
int read_bitmap(struct glyph_list_t **glist_head, struct glyph_t *default_glyph,
	char *buf, struct bdf_header_t *bdf_header, struct bdf_char_t *bdf_char)
{
	static int count = 0;
	uint32_t code;
	uint8_t width, height;
	struct glyph_list_t *listp;
	struct glyph_t *glyph;

	if (pre_match(buf, "ENDCHAR")) {
		count = 0;

		shift_glyph(bdf_header, bdf_char);

		if (bdf_char->encoding < 0 || bdf_char->encoding >= UCS2_CHARS)
			return BDF_CHAR;

		code   = convert_table[bdf_char->encoding];
		width  = bdf_char->dwidth;
		height = bdf_header->ascent + bdf_header->descent;

		//logging(DEBUG, "code:%d width:%d height:%d\n", code, width, height);

		if (code < UCS2_CHARS && width <= 64) {
			listp = ecalloc(1, sizeof(struct glyph_list_t));
			glyph = ecalloc(1, sizeof(struct glyph_t));

			glyph->width  = width;
			glyph->height = height;
			/* XXX: max width 64 pixels (wide char)  */
			glyph->bitmap = (bitmap_width_t *) ecalloc(glyph->height, sizeof(bitmap_width_t));

			for (int i = 0; i < glyph->height; i++)
				glyph->bitmap[i] = bdf_char->bitmap[i];

			/* add new element to glyph list */
			listp->code  = code;
			listp->glyph = glyph;
			listp->next  = *glist_head;
			*glist_head  = listp;

			if (code == DEFAULT_CHAR)
				*default_glyph = *glyph;
		}
		memset(bdf_char, 0, sizeof(struct bdf_char_t));
		return BDF_CHAR;
	}
	else
		sscanf(buf, "%X", (unsigned int *) &bdf_char->bitmap[count++]);

	return BDF_BITMAP;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %rbx
movq %rcx, %r12
movq %rdx, %r13
movq %rsi, %r14
movq %rdi, %r15
leaq 0x17d5(%rip), %rsi      # 0x31d2
movl $0x7, %edx
movq %r13, %rdi
callq 0x1060
testl %eax, %eax
je 0x1a41
movslq 0x436fb(%rip), %rax     # 0x45110
leal 0x1(%rax), %ecx
movl %ecx, 0x436f2(%rip)     # 0x45110
leaq (%rbx,%rax,8), %rdx
addq $0x18, %rdx
leaq 0x16a6(%rip), %rsi      # 0x30d3
movq %r13, %rdi
xorl %eax, %eax
callq 0x1110
movl $0x2, %ebp
jmp 0x1b3f
movl $0x0, 0x436c5(%rip)     # 0x45110
movq %r12, %rdi
movq %rbx, %rsi
callq 0x14bb
movl 0x14(%rbx), %eax
movl $0x1, %ebp
cmpq $0xffff, %rax           # imm = 0xFFFF
ja 0x1b3f
leaq 0x369f(%rip), %rcx      # 0x5110
movl (%rcx,%rax,4), %edx
movl 0x10(%rbx), %esi
movzbl %sil, %eax
cmpl $0x10000, %edx          # imm = 0x10000
setb %cl
cmpl $0x41, %eax
setb %al
andb %cl, %al
cmpb $0x1, %al
jne 0x1b30
movl %edx, 0xc(%rsp)
movq %r14, 0x10(%rsp)
movl 0x14(%r12), %r14d
addl 0x10(%r12), %r14d
movl $0x1, %edi
movl %esi, 0x8(%rsp)
movl $0x18, %esi
callq 0x1418
movq %rax, %r12
movl $0x1, %edi
movl $0x10, %esi
callq 0x1418
movq %rax, %r13
movl 0x8(%rsp), %eax
movb %al, (%r13)
movb %r14b, 0x1(%r13)
movzbl %r14b, %edi
movl $0x8, %esi
callq 0x1418
movq %rax, 0x8(%r13)
movzbl 0x1(%r13), %edx
testq %rdx, %rdx
je 0x1b06
leaq 0x18(%rbx), %rsi
shll $0x3, %edx
movq %rax, %rdi
callq 0x10f0
movl 0xc(%rsp), %ecx
movl %ecx, (%r12)
movq %r13, 0x8(%r12)
movq (%r15), %rax
movq %rax, 0x10(%r12)
movq %r12, (%r15)
cmpl $0x20, %ecx
movq 0x10(%rsp), %rax
jne 0x1b30
movups (%r13), %xmm0
movups %xmm0, (%rax)
movl $0x218, %edx            # imm = 0x218
movq %rbx, %rdi
xorl %esi, %esi
callq 0x10b0
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq