// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/xxdp.c
// Function: render_bitmap
static void render_bitmap(xxdp_filesystem_t *_this) {
	xxdp_blocknr_t blknr;

	// link blocks
	xxdp_blocklist_set(_this, &(_this->bitmap->blocklist));

	for (blknr = 0; blknr < _this->blockcount; blknr++) {
		// which bitmap block resides the flag in?
		int map_blkidx = blknr / (XXDP_BITMAP_WORDS_PER_MAP * 16); // # in list
		int map_blknr = _this->bitmap->blocklist.blocknr[map_blkidx]; // abs pos bitmap blk
		int map_flags_bitnr = blknr % (XXDP_BITMAP_WORDS_PER_MAP * 16);

		// set metadata for the whole bitmap block only if first flag is processed
		if (map_flags_bitnr == 0) {
			xxdp_image_set_word(_this, map_blknr, 1, map_blkidx + 1); // "map number":  enumerates map blocks
			xxdp_image_set_word(_this, map_blknr, 2, XXDP_BITMAP_WORDS_PER_MAP); // 60
			xxdp_image_set_word(_this, map_blknr, 3, _this->bitmap->blocklist.blocknr[0]); // "link to first map"
		}

		// set a single block flag
		if (_this->bitmap->used[blknr]) {
			// word and bit in this block containing the flag
			int map_flags_wordnr = map_flags_bitnr / 16;
			int map_flag_bitpos = map_flags_bitnr % 16;
			uint16_t map_flags = xxdp_image_get_word(_this, map_blknr, map_flags_wordnr + 4);
			map_flags |= (1 << map_flag_bitpos);
			xxdp_image_set_word(_this, map_blknr, map_flags_wordnr + 4, map_flags);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x90(%rax), %rsi
callq 0x134b0
movw $0x0, -0xa(%rbp)
movzwl -0xa(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x4c(%rcx), %eax
jae 0x1139d
movzwl -0xa(%rbp), %eax
movl $0x3c0, %ecx            # imm = 0x3C0
cltd
idivl %ecx
movl %eax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x90(%rax), %rax
movslq -0x10(%rbp), %rcx
movzwl 0x4(%rax,%rcx,2), %eax
movl %eax, -0x14(%rbp)
movzwl -0xa(%rbp), %eax
movl $0x3c0, %ecx            # imm = 0x3C0
cltd
idivl %ecx
movl %edx, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jne 0x11301
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %eax
movw %ax, %cx
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl $0x1, %edx
movzwl %cx, %esi
movzwl %ax, %ecx
callq 0x13540
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %eax
movl $0x2, %edx
movl $0x3c, %ecx
movzwl %ax, %esi
callq 0x13540
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %eax
movw %ax, %cx
movq -0x8(%rbp), %rax
movq 0x90(%rax), %rax
movl $0x3, %edx
movzwl %cx, %esi
movzwl 0x4(%rax), %ecx
callq 0x13540
movq -0x8(%rbp), %rax
movq 0x90(%rax), %rax
movzwl -0xa(%rbp), %ecx
cmpb $0x0, 0x804(%rax,%rcx)
je 0x1138a
movl -0x18(%rbp), %eax
movl $0x10, %ecx
cltd
idivl %ecx
movl %eax, -0x1c(%rbp)
movl -0x18(%rbp), %eax
movl $0x10, %ecx
cltd
idivl %ecx
movl %edx, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %eax
movw %ax, %cx
movl -0x1c(%rbp), %eax
addl $0x4, %eax
movzwl %cx, %esi
movzbl %al, %edx
callq 0x13420
movw %ax, -0x22(%rbp)
movl -0x20(%rbp), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, %ecx
movzwl -0x22(%rbp), %eax
orl %ecx, %eax
movw %ax, -0x22(%rbp)
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %eax
movw %ax, %cx
movl -0x1c(%rbp), %eax
addl $0x4, %eax
movzwl %cx, %esi
movzbl %al, %edx
movzwl -0x22(%rbp), %ecx
callq 0x13540
jmp 0x1138c
movw -0xa(%rbp), %ax
addw $0x1, %ax
movw %ax, -0xa(%rbp)
jmp 0x11256
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)