LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/ufat_file.c
// Function: write_block_fragment
static int write_block_fragment(struct ufat_file *f, const char *buf,
				ufat_size_t size)
{
	const struct ufat_bpb *bpb = &f->uf->bpb;
	const unsigned int log2_block_size = f->uf->dev->log2_block_size;
	const unsigned int block_size = 1 << log2_block_size;
	const unsigned int offset = f->cur_pos & (block_size - 1);
	const unsigned int remainder = block_size - offset;
	ufat_block_t cur_block;
	int i;

	if (size > remainder)
		size = remainder;
	size &= (block_size - 1);
	if (!size)
		return 0;

	i = ensure_room(f);
	if (i < 0)
		return i;

	cur_block =
		cluster_to_block(bpb, f->cur_cluster) +
		((f->cur_pos >> log2_block_size) &
		 ((1 << bpb->log2_blocks_per_cluster) - 1));

	i = ufat_cache_open(f->uf, cur_block, 0);
	if (i < 0)
		return i;

	ufat_cache_write(f->uf, i);
	memcpy(ufat_cache_data(f->uf, i) + offset, buf, size);

	i = advance_ptr(f, size);
	if (i < 0)
		return i;

	return size;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movq %rsi, 0x30(%rsp)
movl %edx, 0x2c(%rsp)
movq 0x38(%rsp), %rax
movq (%rax), %rax
addq $0x28, %rax
movq %rax, 0x20(%rsp)
movq 0x38(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rax
movl (%rax), %eax
movl %eax, 0x1c(%rsp)
movl 0x1c(%rsp), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, 0x18(%rsp)
movq 0x38(%rsp), %rax
movl 0x24(%rax), %eax
movl 0x18(%rsp), %ecx
subl $0x1, %ecx
andl %ecx, %eax
movl %eax, 0x14(%rsp)
movl 0x18(%rsp), %eax
subl 0x14(%rsp), %eax
movl %eax, 0x10(%rsp)
movl 0x2c(%rsp), %eax
cmpl 0x10(%rsp), %eax
jbe 0x5766
movl 0x10(%rsp), %eax
movl %eax, 0x2c(%rsp)
movl 0x18(%rsp), %eax
subl $0x1, %eax
andl 0x2c(%rsp), %eax
movl %eax, 0x2c(%rsp)
cmpl $0x0, 0x2c(%rsp)
jne 0x5789
movl $0x0, 0x44(%rsp)
jmp 0x587f
movq 0x38(%rsp), %rdi
callq 0x5e20
movl %eax, 0x4(%rsp)
cmpl $0x0, 0x4(%rsp)
jge 0x57ab
movl 0x4(%rsp), %eax
movl %eax, 0x44(%rsp)
jmp 0x587f
movq 0x20(%rsp), %rdi
movq 0x38(%rsp), %rax
movl 0x20(%rax), %esi
callq 0x5dc0
movq 0x38(%rsp), %rcx
movl 0x24(%rcx), %edx
movl 0x1c(%rsp), %ecx
shrl %cl, %edx
movl %edx, (%rsp)
movq 0x20(%rsp), %rcx
movl 0x4(%rcx), %ecx
movl $0x1, %edx
shll %cl, %edx
movl (%rsp), %ecx
subl $0x1, %edx
andl %edx, %ecx
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, 0x8(%rsp)
movq 0x38(%rsp), %rax
movq (%rax), %rdi
movq 0x8(%rsp), %rsi
xorl %edx, %edx
callq 0x2660
movl %eax, 0x4(%rsp)
cmpl $0x0, 0x4(%rsp)
jge 0x5818
movl 0x4(%rsp), %eax
movl %eax, 0x44(%rsp)
jmp 0x587f
movq 0x38(%rsp), %rax
movq (%rax), %rdi
movl 0x4(%rsp), %esi
callq 0x5f00
movq 0x38(%rsp), %rax
movq (%rax), %rdi
movl 0x4(%rsp), %esi
callq 0x5df0
movq %rax, %rdi
movl 0x14(%rsp), %eax
addq %rax, %rdi
movq 0x30(%rsp), %rsi
movl 0x2c(%rsp), %eax
movl %eax, %edx
callq 0x2140
movq 0x38(%rsp), %rdi
movl 0x2c(%rsp), %esi
callq 0x5030
movl %eax, 0x4(%rsp)
cmpl $0x0, 0x4(%rsp)
jge 0x5877
movl 0x4(%rsp), %eax
movl %eax, 0x44(%rsp)
jmp 0x587f
movl 0x2c(%rsp), %eax
movl %eax, 0x44(%rsp)
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/ufat_file.c
// Function: set_size
static int set_size(struct ufat_file *f, ufat_size_t s)
{
	int idx = ufat_cache_open(f->uf, f->dirent_block, 0);

	if (idx < 0)
		return idx;

	ufat_cache_write(f->uf, idx);
	w32(ufat_cache_data(f->uf, idx) +
	    f->dirent_pos * UFAT_DIRENT_SIZE + 0x1c, s);

	f->file_size = s;
	return 0;
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x8(%rsp)
movl %esi, 0x4(%rsp)
movq 0x8(%rsp), %rax
movq (%rax), %rdi
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rsi
xorl %edx, %edx
callq 0x2660
movl %eax, (%rsp)
cmpl $0x0, (%rsp)
jge 0x5a67
movl (%rsp), %eax
movl %eax, 0x14(%rsp)
jmp 0x5abb
movq 0x8(%rsp), %rax
movq (%rax), %rdi
movl (%rsp), %esi
callq 0x5f00
movq 0x8(%rsp), %rax
movq (%rax), %rdi
movl (%rsp), %esi
callq 0x5df0
movq %rax, %rdi
movq 0x8(%rsp), %rax
movl 0x10(%rax), %eax
shll $0x5, %eax
movl %eax, %eax
addq %rax, %rdi
addq $0x1c, %rdi
movl 0x4(%rsp), %esi
callq 0x5f40
movl 0x4(%rsp), %ecx
movq 0x8(%rsp), %rax
movl %ecx, 0x18(%rax)
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/ufat_file.c
// Function: set_start
static int set_start(struct ufat_file *f, ufat_cluster_t s)
{
	int idx = ufat_cache_open(f->uf, f->dirent_block, 0);
	uint8_t *data;

	if (idx < 0)
		return idx;

	ufat_cache_write(f->uf, idx);
	data = ufat_cache_data(f->uf, idx) + f->dirent_pos * UFAT_DIRENT_SIZE;
	w16(data + 0x14, s >> 16);
	w16(data + 0x1a, s & 0xffff);

	f->start = s;
	return 0;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movl %esi, 0x14(%rsp)
movq 0x18(%rsp), %rax
movq (%rax), %rdi
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rsi
xorl %edx, %edx
callq 0x2660
movl %eax, 0x10(%rsp)
cmpl $0x0, 0x10(%rsp)
jge 0x5d3a
movl 0x10(%rsp), %eax
movl %eax, 0x24(%rsp)
jmp 0x5db7
movq 0x18(%rsp), %rax
movq (%rax), %rdi
movl 0x10(%rsp), %esi
callq 0x5f00
movq 0x18(%rsp), %rax
movq (%rax), %rdi
movl 0x10(%rsp), %esi
callq 0x5df0
movq 0x18(%rsp), %rcx
movl 0x10(%rcx), %ecx
shll $0x5, %ecx
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rdi
addq $0x14, %rdi
movl 0x14(%rsp), %eax
shrl $0x10, %eax
movzwl %ax, %esi
callq 0x5f80
movq 0x8(%rsp), %rdi
addq $0x1a, %rdi
movl 0x14(%rsp), %eax
andl $0xffff, %eax           # imm = 0xFFFF
movzwl %ax, %esi
callq 0x5f80
movl 0x14(%rsp), %ecx
movq 0x18(%rsp), %rax
movl %ecx, 0x14(%rax)
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/ufat_file.c
// Function: ensure_room
static int ensure_room(struct ufat_file *f)
{
	ufat_cluster_t c;
	int err;

	if (UFAT_CLUSTER_IS_PTR(f->cur_cluster))
		return 0;

	err = ufat_alloc_chain(f->uf, 1, &c);
	if (err < 0)
		return err;

	if (UFAT_CLUSTER_IS_PTR(f->prev_cluster))
		err = ufat_write_fat(f->uf, f->prev_cluster, c);
	else
		err = set_start(f, c);

	if (err < 0) {
		ufat_free_chain(f->uf, c);
		return err;
	}

	f->cur_cluster = c;
	return 0;
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x8(%rsp)
movq 0x8(%rsp), %rax
cmpl $0x2, 0x20(%rax)
jb 0x5e4f
movq 0x8(%rsp), %rax
cmpl $0xffffff0, 0x20(%rax)  # imm = 0xFFFFFF0
jae 0x5e4f
movl $0x0, 0x14(%rsp)
jmp 0x5ef4
movq 0x8(%rsp), %rax
movq (%rax), %rdi
movl $0x1, %esi
leaq 0x4(%rsp), %rdx
callq 0x33e0
movl %eax, (%rsp)
cmpl $0x0, (%rsp)
jge 0x5e78
movl (%rsp), %eax
movl %eax, 0x14(%rsp)
jmp 0x5ef4
movq 0x8(%rsp), %rax
cmpl $0x2, 0x1c(%rax)
jb 0x5eaf
movq 0x8(%rsp), %rax
cmpl $0xffffff0, 0x1c(%rax)  # imm = 0xFFFFFF0
jae 0x5eaf
movq 0x8(%rsp), %rax
movq (%rax), %rdi
movq 0x8(%rsp), %rax
movl 0x1c(%rax), %esi
movl 0x4(%rsp), %edx
callq 0x3000
movl %eax, (%rsp)
jmp 0x5ec0
movq 0x8(%rsp), %rdi
movl 0x4(%rsp), %esi
callq 0x5d00
movl %eax, (%rsp)
cmpl $0x0, (%rsp)
jge 0x5ee0
movq 0x8(%rsp), %rax
movq (%rax), %rdi
movl 0x4(%rsp), %esi
callq 0x3340
movl (%rsp), %eax
movl %eax, 0x14(%rsp)
jmp 0x5ef4
movl 0x4(%rsp), %ecx
movq 0x8(%rsp), %rax
movl %ecx, 0x20(%rax)
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
addq $0x18, %rsp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/ufat_ent.c
// Function: ufat_write_raw_dirent
int ufat_write_raw_dirent(struct ufat_directory *dir,
			  const uint8_t *data, unsigned int len)
{
	int idx;

	if (dir->cur_block == UFAT_BLOCK_NONE)
		return -UFAT_ERR_IO;

	idx = ufat_cache_open(dir->uf, dir->cur_block, 0);
	if (idx < 0)
		return idx;

	ufat_cache_write(dir->uf, idx);
	memcpy(ufat_cache_data(dir->uf, idx) +
	       dir->cur_pos * UFAT_DIRENT_SIZE,
	       data, len);

	return 0;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movl %edx, 0xc(%rsp)
movq 0x18(%rsp), %rax
cmpq $-0x1, 0x10(%rax)
jne 0x5fe8
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
jmp 0x6062
movq 0x18(%rsp), %rax
movq (%rax), %rdi
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rsi
xorl %edx, %edx
callq 0x2660
movl %eax, 0x8(%rsp)
cmpl $0x0, 0x8(%rsp)
jge 0x6015
movl 0x8(%rsp), %eax
movl %eax, 0x24(%rsp)
jmp 0x6062
movq 0x18(%rsp), %rax
movq (%rax), %rdi
movl 0x8(%rsp), %esi
callq 0x6070
movq 0x18(%rsp), %rax
movq (%rax), %rdi
movl 0x8(%rsp), %esi
callq 0x60b0
movq %rax, %rdi
movq 0x18(%rsp), %rax
movl 0x8(%rax), %eax
shll $0x5, %eax
movl %eax, %eax
addq %rax, %rdi
movq 0x10(%rsp), %rsi
movl 0xc(%rsp), %eax
movl %eax, %edx
callq 0x2140
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/ufat_ent.c
// Function: ufat_advance_raw_dirent
int ufat_advance_raw_dirent(struct ufat_directory *dir, int can_alloc)
{
	/* Advance the dirent pointer and check for a block overrun */
	dir->cur_pos++;
	if (dir->cur_pos * UFAT_DIRENT_SIZE >=
	    (1u << dir->uf->dev->log2_block_size)) {
		dir->cur_pos = 0;

		if (dir->cur_block < dir->uf->bpb.cluster_start) {
			/* FAT12/16 root directory */
			dir->cur_block++;
			if (dir->cur_block >= dir->uf->bpb.cluster_start)
				dir->cur_block = UFAT_BLOCK_NONE;

			return 0;
		}

		return advance_block_in_chain(dir, can_alloc);
	}

	return 0;
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x8(%rsp)
movl %esi, 0x4(%rsp)
movq 0x8(%rsp), %rax
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x8(%rax)
movq 0x8(%rsp), %rax
movl 0x8(%rax), %eax
shll $0x5, %eax
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
movq (%rcx), %rcx
movl (%rcx), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
cmpl %ecx, %eax
jb 0x6196
movq 0x8(%rsp), %rax
movl $0x0, 0x8(%rax)
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
cmpq 0x48(%rcx), %rax
jae 0x6182
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x10(%rax)
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
cmpq 0x48(%rcx), %rax
jb 0x6178
movq 0x8(%rsp), %rax
movq $-0x1, 0x10(%rax)
movl $0x0, 0x14(%rsp)
jmp 0x619e
movq 0x8(%rsp), %rdi
movl 0x4(%rsp), %esi
callq 0x61b0
movl %eax, 0x14(%rsp)
jmp 0x619e
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
addq $0x18, %rsp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/ufat_ent.c
// Function: ufat_read_raw_dirent
int ufat_read_raw_dirent(struct ufat_directory *dir, uint8_t *data)
{
	int idx;

	if (dir->cur_block == UFAT_BLOCK_NONE)
		return 1;

	idx = ufat_cache_open(dir->uf, dir->cur_block, 0);
	if (idx < 0)
		return idx;

	memcpy(data, ufat_cache_data(dir->uf, idx) +
	       dir->cur_pos * UFAT_DIRENT_SIZE,
	       UFAT_DIRENT_SIZE);

	return 0;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movq 0x18(%rsp), %rax
cmpq $-0x1, 0x10(%rax)
jne 0x63a7
movl $0x1, 0x24(%rsp)
jmp 0x642c
movq 0x18(%rsp), %rax
movq (%rax), %rdi
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rsi
xorl %edx, %edx
callq 0x2660
movl %eax, 0xc(%rsp)
cmpl $0x0, 0xc(%rsp)
jge 0x63d4
movl 0xc(%rsp), %eax
movl %eax, 0x24(%rsp)
jmp 0x642c
movq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq 0x18(%rsp), %rax
movq (%rax), %rdi
movl 0xc(%rsp), %esi
callq 0x60b0
movq %rax, %rcx
movq (%rsp), %rax
movq 0x18(%rsp), %rdx
movl 0x8(%rdx), %edx
shll $0x5, %edx
movl %edx, %edx
movq (%rcx,%rdx), %rsi
movq %rsi, (%rax)
movq 0x8(%rcx,%rdx), %rsi
movq %rsi, 0x8(%rax)
movq 0x10(%rcx,%rdx), %rsi
movq %rsi, 0x10(%rax)
movq 0x18(%rcx,%rdx), %rcx
movq %rcx, 0x18(%rax)
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/ufat_ent.c
// Function: ufat_allocate_raw_dirent
int ufat_allocate_raw_dirent(struct ufat_directory *dir, unsigned int count)
{
	ufat_block_t empty_start = UFAT_BLOCK_NONE;
	unsigned int empty_pos = 0;
	unsigned int empty_count = 0;

	ufat_dir_rewind(dir);

	for (;;) {
		uint8_t data[UFAT_DIRENT_SIZE];
		int err;

		err = ufat_read_raw_dirent(dir, data);
		if (err < 0)
			return err;

		/* Check to see if this raw dirent is empty. Keep track
		 * of contiguous chains of empty dirents.
		 */
		if (!data[0] || data[0] == 0xe5) {
			if (!empty_count) {
				empty_start = dir->cur_block;
				empty_pos = dir->cur_pos;
			}

			empty_count++;
		} else {
			empty_count = 0;
		}

		/* Is this chain long enough? */
		if (empty_count >= count)
			break;

		err = ufat_advance_raw_dirent(dir, 1);
		if (err < 0)
			return err;

		if (dir->cur_block == UFAT_BLOCK_NONE)
			return -UFAT_ERR_DIRECTORY_FULL;
	}

	/* Reposition at the start of the empty chain */
	dir->cur_block = empty_start;
	dir->cur_pos = empty_pos;

	return 0;
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movl %esi, 0x44(%rsp)
movq $-0x1, 0x38(%rsp)
movl $0x0, 0x34(%rsp)
movl $0x0, 0x30(%rsp)
movq 0x48(%rsp), %rdi
callq 0x3da0
movq 0x48(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x6380
movl %eax, 0xc(%rsp)
cmpl $0x0, 0xc(%rsp)
jge 0x6497
movl 0xc(%rsp), %eax
movl %eax, 0x54(%rsp)
jmp 0x654d
cmpb $0x0, 0x10(%rsp)
je 0x64aa
movzbl 0x10(%rsp), %eax
cmpl $0xe5, %eax
jne 0x64d8
cmpl $0x0, 0x30(%rsp)
jne 0x64cb
movq 0x48(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x38(%rsp)
movq 0x48(%rsp), %rax
movl 0x8(%rax), %eax
movl %eax, 0x34(%rsp)
movl 0x30(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x30(%rsp)
jmp 0x64e0
movl $0x0, 0x30(%rsp)
movl 0x30(%rsp), %eax
cmpl 0x44(%rsp), %eax
jb 0x64ec
jmp 0x652b
movq 0x48(%rsp), %rdi
movl $0x1, %esi
callq 0x60e0
movl %eax, 0xc(%rsp)
cmpl $0x0, 0xc(%rsp)
jge 0x6510
movl 0xc(%rsp), %eax
movl %eax, 0x54(%rsp)
jmp 0x654d
movq 0x48(%rsp), %rax
cmpq $-0x1, 0x10(%rax)
jne 0x6526
movl $0xfffffff2, 0x54(%rsp) # imm = 0xFFFFFFF2
jmp 0x654d
jmp 0x6470
movq 0x38(%rsp), %rcx
movq 0x48(%rsp), %rax
movq %rcx, 0x10(%rax)
movl 0x34(%rsp), %ecx
movq 0x48(%rsp), %rax
movl %ecx, 0x8(%rax)
movl $0x0, 0x54(%rsp)
movl 0x54(%rsp), %eax
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/ufat_ent.c
// Function: ufat_init_dirent_cluster
int ufat_init_dirent_cluster(struct ufat *uf, ufat_cluster_t c)
{
	const struct ufat_bpb *bpb = &uf->bpb;
	const ufat_block_t start = cluster_to_block(bpb, c);
	const unsigned int count =
		1 << bpb->log2_blocks_per_cluster;
	const unsigned int block_size = 1 << uf->dev->log2_block_size;
	int i;

	for (i = count - 1; i >= 0; i--) {
		int idx = ufat_cache_open(uf, start + i, 1);

		if (idx < 0)
			return idx;

		ufat_cache_write(uf, idx);
		memset(ufat_cache_data(uf, idx), 0, block_size);
	}

	return 0;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movl %esi, 0x24(%rsp)
movq 0x28(%rsp), %rax
addq $0x28, %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rdi
movl 0x24(%rsp), %esi
callq 0x6640
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %rax
movl 0x4(%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, 0xc(%rsp)
movq 0x28(%rsp), %rax
movq (%rax), %rax
movl (%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, 0x8(%rsp)
movl 0xc(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x4(%rsp)
cmpl $0x0, 0x4(%rsp)
jl 0x662d
movq 0x28(%rsp), %rdi
movq 0x10(%rsp), %rsi
movslq 0x4(%rsp), %rax
addq %rax, %rsi
movl $0x1, %edx
callq 0x2660
movl %eax, (%rsp)
cmpl $0x0, (%rsp)
jge 0x65f6
movl (%rsp), %eax
movl %eax, 0x34(%rsp)
jmp 0x6635
movq 0x28(%rsp), %rdi
movl (%rsp), %esi
callq 0x6070
movq 0x28(%rsp), %rdi
movl (%rsp), %esi
callq 0x60b0
movq %rax, %rdi
movl 0x8(%rsp), %eax
movl %eax, %edx
xorl %esi, %esi
callq 0x2100
movl 0x4(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x4(%rsp)
jmp 0x65c1
movl $0x0, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/ufat_ent.c
// Function: ufat_parse_dirent
void ufat_parse_dirent(ufat_fat_type_t type,
		       const uint8_t *data, struct ufat_dirent *inf)
{
	sn_copy(data, inf->short_name, 8);
	sn_copy(data + 0x08, inf->short_ext, 3);

	inf->attributes = data[0x0b];
	inf->create_time = r16(data + 0x0e);
	inf->create_date = r16(data + 0x10);
	inf->access_date = r16(data + 0x12);
	inf->modify_time = r16(data + 0x16);
	inf->modify_date = r16(data + 0x18);
	inf->file_size = r32(data + 0x1c);
	inf->first_cluster = r16(data + 0x1a);

	if (type == UFAT_TYPE_FAT32) {
		uint32_t high = r16(data + 0x14);

		inf->first_cluster |= high << 16;
	}
}

// Assembly:
subq $0x28, %rsp
movl %edi, 0x24(%rsp)
movq %rsi, 0x18(%rsp)
movq %rdx, 0x10(%rsp)
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %rsi
addq $0x1c, %rsi
movl $0x8, %edx
callq 0x67b0
movq 0x18(%rsp), %rdi
addq $0x8, %rdi
movq 0x10(%rsp), %rsi
addq $0x25, %rsi
movl $0x3, %edx
callq 0x67b0
movq 0x18(%rsp), %rax
movzbl 0xb(%rax), %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x2c(%rax)
movq 0x18(%rsp), %rdi
addq $0xe, %rdi
callq 0x6830
movw %ax, %cx
movq 0x10(%rsp), %rax
movw %cx, 0x32(%rax)
movq 0x18(%rsp), %rdi
addq $0x10, %rdi
callq 0x6830
movw %ax, %cx
movq 0x10(%rsp), %rax
movw %cx, 0x30(%rax)
movq 0x18(%rsp), %rdi
addq $0x12, %rdi
callq 0x6830
movw %ax, %cx
movq 0x10(%rsp), %rax
movw %cx, 0x38(%rax)
movq 0x18(%rsp), %rdi
addq $0x16, %rdi
callq 0x6830
movw %ax, %cx
movq 0x10(%rsp), %rax
movw %cx, 0x36(%rax)
movq 0x18(%rsp), %rdi
addq $0x18, %rdi
callq 0x6830
movw %ax, %cx
movq 0x10(%rsp), %rax
movw %cx, 0x34(%rax)
movq 0x18(%rsp), %rdi
addq $0x1c, %rdi
callq 0x6860
movl %eax, %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x40(%rax)
movq 0x18(%rsp), %rdi
addq $0x1a, %rdi
callq 0x6830
movzwl %ax, %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x3c(%rax)
cmpl $0x20, 0x24(%rsp)
jne 0x67a8
movq 0x18(%rsp), %rdi
addq $0x14, %rdi
callq 0x6830
movzwl %ax, %eax
movl %eax, 0xc(%rsp)
movl 0xc(%rsp), %ecx
shll $0x10, %ecx
movq 0x10(%rsp), %rax
orl 0x3c(%rax), %ecx
movl %ecx, 0x3c(%rax)
addq $0x28, %rsp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/ufat_ent.c
// Function: sn_copy
static void sn_copy(const uint8_t *src, char *dst, int len)
{
	int i;

	for (i = 0; i < len && src[i] > ' '; i++)
		dst[i] = src[i];

	dst[i] = 0;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq %rsi, -0x10(%rsp)
movl %edx, -0x14(%rsp)
movl $0x0, -0x18(%rsp)
movl -0x18(%rsp), %ecx
xorl %eax, %eax
cmpl -0x14(%rsp), %ecx
movb %al, -0x19(%rsp)
jge 0x67ee
movq -0x8(%rsp), %rax
movslq -0x18(%rsp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x20, %eax
setg %al
movb %al, -0x19(%rsp)
movb -0x19(%rsp), %al
testb $0x1, %al
jne 0x67f8
jmp 0x681f
movq -0x8(%rsp), %rax
movslq -0x18(%rsp), %rcx
movb (%rax,%rcx), %dl
movq -0x10(%rsp), %rax
movslq -0x18(%rsp), %rcx
movb %dl, (%rax,%rcx)
movl -0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rsp)
jmp 0x67c6
movq -0x10(%rsp), %rax
movslq -0x18(%rsp), %rcx
movb $0x0, (%rax,%rcx)
retq
nop
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/ufat_ent.c
// Function: ufat_pack_dirent
void ufat_pack_dirent(const struct ufat_dirent *ent, uint8_t *data)
{
	memset(data, 0x20, 11);
	memcpy(data, ent->short_name, strlen(ent->short_name));
	memcpy(data + 0x08, ent->short_ext, strlen(ent->short_ext));

	data[0x0b] = ent->attributes;
	data[0x0c] = 0;
	data[0x0d] = 0;
	w16(data + 0x0e, ent->create_time);
	w16(data + 0x10, ent->create_date);
	w16(data + 0x12, ent->access_date);
	w16(data + 0x14, ent->first_cluster >> 16);
	w16(data + 0x16, ent->modify_time);
	w16(data + 0x18, ent->modify_date);
	w16(data + 0x1a, ent->first_cluster & 0xffff);
	w32(data + 0x1c, ent->file_size);
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movq 0x28(%rsp), %rdi
movl $0x20, %esi
movl $0xb, %edx
callq 0x2100
movq 0x28(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x30(%rsp), %rax
addq $0x1c, %rax
movq %rax, 0x10(%rsp)
movq 0x30(%rsp), %rdi
addq $0x1c, %rdi
callq 0x20c0
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %rax, %rdx
callq 0x2140
movq 0x28(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x18(%rsp)
movq 0x30(%rsp), %rax
addq $0x25, %rax
movq %rax, 0x20(%rsp)
movq 0x30(%rsp), %rdi
addq $0x25, %rdi
callq 0x20c0
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq %rax, %rdx
callq 0x2140
movq 0x30(%rsp), %rax
movl 0x2c(%rax), %eax
movb %al, %cl
movq 0x28(%rsp), %rax
movb %cl, 0xb(%rax)
movq 0x28(%rsp), %rax
movb $0x0, 0xc(%rax)
movq 0x28(%rsp), %rax
movb $0x0, 0xd(%rax)
movq 0x28(%rsp), %rdi
addq $0xe, %rdi
movq 0x30(%rsp), %rax
movzwl 0x32(%rax), %esi
callq 0x6a30
movq 0x28(%rsp), %rdi
addq $0x10, %rdi
movq 0x30(%rsp), %rax
movzwl 0x30(%rax), %esi
callq 0x6a30
movq 0x28(%rsp), %rdi
addq $0x12, %rdi
movq 0x30(%rsp), %rax
movzwl 0x38(%rax), %esi
callq 0x6a30
movq 0x28(%rsp), %rdi
addq $0x14, %rdi
movq 0x30(%rsp), %rax
movl 0x3c(%rax), %eax
shrl $0x10, %eax
movzwl %ax, %esi
callq 0x6a30
movq 0x28(%rsp), %rdi
addq $0x16, %rdi
movq 0x30(%rsp), %rax
movzwl 0x36(%rax), %esi
callq 0x6a30
movq 0x28(%rsp), %rdi
addq $0x18, %rdi
movq 0x30(%rsp), %rax
movzwl 0x34(%rax), %esi
callq 0x6a30
movq 0x28(%rsp), %rdi
addq $0x1a, %rdi
movq 0x30(%rsp), %rax
movl 0x3c(%rax), %eax
andl $0xffff, %eax           # imm = 0xFFFF
movzwl %ax, %esi
callq 0x6a30
movq 0x28(%rsp), %rdi
addq $0x1c, %rdi
movq 0x30(%rsp), %rax
movl 0x40(%rax), %esi
callq 0x6a70
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/ufat_ent.c
// Function: ufat_lfn_is_legal
int ufat_lfn_is_legal(const char *name)
{
	if (!*name)
		return 0;

	if (name[0] == '.') {
		if (!name[1])
			return 0;
		if (name[1] == '.' && !name[2])
			return 0;
	}

	while (*name) {
		if (*name == '\\' || *name == '/' || *name < ' ')
			return 0;

		name++;
	}

	return 1;
}

// Assembly:
movq %rdi, -0x10(%rsp)
movq -0x10(%rsp), %rax
cmpb $0x0, (%rax)
jne 0x6acc
movl $0x0, -0x4(%rsp)
jmp 0x6b68
movq -0x10(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x2e, %eax
jne 0x6b13
movq -0x10(%rsp), %rax
cmpb $0x0, 0x1(%rax)
jne 0x6aee
movl $0x0, -0x4(%rsp)
jmp 0x6b68
movq -0x10(%rsp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x2e, %eax
jne 0x6b11
movq -0x10(%rsp), %rax
cmpb $0x0, 0x2(%rax)
jne 0x6b11
movl $0x0, -0x4(%rsp)
jmp 0x6b68
jmp 0x6b13
jmp 0x6b15
movq -0x10(%rsp), %rax
cmpb $0x0, (%rax)
je 0x6b60
movq -0x10(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x5c, %eax
je 0x6b46
movq -0x10(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
je 0x6b46
movq -0x10(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x20, %eax
jge 0x6b50
movl $0x0, -0x4(%rsp)
jmp 0x6b68
movq -0x10(%rsp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rsp)
jmp 0x6b15
movl $0x1, -0x4(%rsp)
movl -0x4(%rsp), %eax
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/ufat_ent.c
// Function: is_legal_dos_char
static int is_legal_dos_char(char c)
{
	return isalnum(c) ||
		(c >= '!' && c <= ')') ||
		(c == '-') ||
		(c == '@') ||
		(c >= '^' && c <= '`') ||
		(c == '{' || c == '}' || c == '~');
}

// Assembly:
pushq %rax
movb %dil, %al
movb %al, 0x7(%rsp)
callq 0x21e0
movq (%rax), %rax
movsbl 0x7(%rsp), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %ecx
andl $0x8, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, 0x6(%rsp)
jne 0x6e29
movsbl 0x7(%rsp), %eax
cmpl $0x21, %eax
jl 0x6db8
movsbl 0x7(%rsp), %ecx
movb $0x1, %al
cmpl $0x29, %ecx
movb %al, 0x6(%rsp)
jle 0x6e29
movsbl 0x7(%rsp), %ecx
movb $0x1, %al
cmpl $0x2d, %ecx
movb %al, 0x6(%rsp)
je 0x6e29
movsbl 0x7(%rsp), %ecx
movb $0x1, %al
cmpl $0x40, %ecx
movb %al, 0x6(%rsp)
je 0x6e29
movsbl 0x7(%rsp), %eax
cmpl $0x5e, %eax
jl 0x6df2
movsbl 0x7(%rsp), %ecx
movb $0x1, %al
cmpl $0x60, %ecx
movb %al, 0x6(%rsp)
jle 0x6e29
movsbl 0x7(%rsp), %ecx
movb $0x1, %al
cmpl $0x7b, %ecx
movb %al, 0x5(%rsp)
je 0x6e21
movsbl 0x7(%rsp), %ecx
movb $0x1, %al
cmpl $0x7d, %ecx
movb %al, 0x5(%rsp)
je 0x6e21
movsbl 0x7(%rsp), %eax
cmpl $0x7e, %eax
sete %al
movb %al, 0x5(%rsp)
movb 0x5(%rsp), %al
movb %al, 0x6(%rsp)
movb 0x6(%rsp), %al
andb $0x1, %al
movzbl %al, %eax
popq %rcx
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/ufat_ent.c
// Function: ufat_short_next
void ufat_short_next(char *short_name)
{
	int len = strlen(short_name);
	int tilde = strlen(short_name);
	unsigned int suffix_num;
	int i;

	while (tilde >= 0 && short_name[tilde] != '~')
		tilde--;
	if (tilde < 0)
		tilde = len;
	else
		tilde++;

	suffix_num = atoi(short_name + tilde) + 1;
	short_name[8] = 0;

	i = 7;
	while (suffix_num && i >= 0) {
		short_name[i] = (suffix_num % 10) + '0';
		suffix_num /= 10;
		i--;
	}

	if (i >= 0)
		short_name[i--] = '~';

	while (i >= tilde)
		short_name[i--] = '~';
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq 0x20(%rsp), %rdi
callq 0x20c0
movl %eax, 0x1c(%rsp)
movq 0x20(%rsp), %rdi
callq 0x20c0
movl %eax, 0x18(%rsp)
xorl %eax, %eax
cmpl $0x0, 0x18(%rsp)
movb %al, 0xf(%rsp)
jl 0x6e8a
movq 0x20(%rsp), %rax
movslq 0x18(%rsp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x7e, %eax
setne %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0x6e94
jmp 0x6ea1
movl 0x18(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x18(%rsp)
jmp 0x6e65
cmpl $0x0, 0x18(%rsp)
jge 0x6eb2
movl 0x1c(%rsp), %eax
movl %eax, 0x18(%rsp)
jmp 0x6ebd
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
movq 0x20(%rsp), %rdi
movslq 0x18(%rsp), %rax
addq %rax, %rdi
callq 0x21a0
addl $0x1, %eax
movl %eax, 0x14(%rsp)
movq 0x20(%rsp), %rax
movb $0x0, 0x8(%rax)
movl $0x7, 0x10(%rsp)
xorl %eax, %eax
cmpl $0x0, 0x14(%rsp)
movb %al, 0xe(%rsp)
je 0x6f00
cmpl $0x0, 0x10(%rsp)
setge %al
movb %al, 0xe(%rsp)
movb 0xe(%rsp), %al
testb $0x1, %al
jne 0x6f0a
jmp 0x6f45
movl 0x14(%rsp), %eax
movl $0xa, %ecx
xorl %edx, %edx
divl %ecx
addl $0x30, %edx
movq 0x20(%rsp), %rax
movslq 0x10(%rsp), %rcx
movb %dl, (%rax,%rcx)
movl 0x14(%rsp), %eax
movl $0xa, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, 0x14(%rsp)
movl 0x10(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rsp)
jmp 0x6ee7
cmpl $0x0, 0x10(%rsp)
jl 0x6f65
movq 0x20(%rsp), %rax
movl 0x10(%rsp), %ecx
movl %ecx, %edx
addl $-0x1, %edx
movl %edx, 0x10(%rsp)
movslq %ecx, %rcx
movb $0x7e, (%rax,%rcx)
jmp 0x6f67
movl 0x10(%rsp), %eax
cmpl 0x18(%rsp), %eax
jl 0x6f8c
movq 0x20(%rsp), %rax
movl 0x10(%rsp), %ecx
movl %ecx, %edx
addl $-0x1, %edx
movl %edx, 0x10(%rsp)
movslq %ecx, %rcx
movb $0x7e, (%rax,%rcx)
jmp 0x6f67
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/ufat_ent.c
// Function: ufat_short_exists
int ufat_short_exists(struct ufat_directory *dir, const char *short_name,
		      const char *short_ext)
{
	struct ufat_dirent ent;

	ufat_dir_rewind(dir);
	for (;;) {
		int err = ufat_dir_read(dir, &ent, NULL, 0);

		if (err < 0)
			return err;

		if (err)
			break;

		if (ufat_compare_name(short_name, ent.short_name, 0) >= 0 &&
		    ufat_compare_name(short_ext, ent.short_ext, 0) >= 0)
			return 1;
	}

	return 0;
}

// Assembly:
subq $0x78, %rsp
movq %rdi, 0x68(%rsp)
movq %rsi, 0x60(%rsp)
movq %rdx, 0x58(%rsp)
movq 0x68(%rsp), %rdi
callq 0x3da0
movq 0x68(%rsp), %rdi
leaq 0x10(%rsp), %rsi
xorl %eax, %eax
movl %eax, %edx
xorl %ecx, %ecx
callq 0x3dd0
movl %eax, 0xc(%rsp)
cmpl $0x0, 0xc(%rsp)
jge 0x6fe7
movl 0xc(%rsp), %eax
movl %eax, 0x74(%rsp)
jmp 0x7038
cmpl $0x0, 0xc(%rsp)
je 0x6ff0
jmp 0x7030
movq 0x60(%rsp), %rdi
leaq 0x10(%rsp), %rsi
addq $0x1c, %rsi
xorl %edx, %edx
callq 0x7050
cmpl $0x0, %eax
jl 0x702e
movq 0x58(%rsp), %rdi
leaq 0x10(%rsp), %rsi
addq $0x25, %rsi
xorl %edx, %edx
callq 0x7050
cmpl $0x0, %eax
jl 0x702e
movl $0x1, 0x74(%rsp)
jmp 0x7038
jmp 0x6fbd
movl $0x0, 0x74(%rsp)
movl 0x74(%rsp), %eax
addq $0x78, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/ufat_ent.c
// Function: ufat_compare_name
int ufat_compare_name(const char *search_name, const char *dir_name,
		      int component_only)
{
	int m = 0;

	while (search_name[m]) {
		int dc = dir_name[m];
		int sc = search_name[m];

		if (component_only && (sc == '/' || sc == '\\'))
			break;

		if (!dc)
			return -1;

		if (sc >= 'a' && sc <= 'z')
			sc -= 32;

		if (dc >= 'a' && dc <= 'z')
			dc -= 32;

		if (sc != dc)
			return -1;

		m++;
	}

	if (dir_name[m])
		return -1;

	return m;
}

// Assembly:
movq %rdi, -0x10(%rsp)
movq %rsi, -0x18(%rsp)
movl %edx, -0x1c(%rsp)
movl $0x0, -0x20(%rsp)
movq -0x10(%rsp), %rax
movslq -0x20(%rsp), %rcx
cmpb $0x0, (%rax,%rcx)
je 0x711c
movq -0x18(%rsp), %rax
movslq -0x20(%rsp), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x24(%rsp)
movq -0x10(%rsp), %rax
movslq -0x20(%rsp), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x28(%rsp)
cmpl $0x0, -0x1c(%rsp)
je 0x70b5
cmpl $0x2f, -0x28(%rsp)
je 0x70b3
cmpl $0x5c, -0x28(%rsp)
jne 0x70b5
jmp 0x711c
cmpl $0x0, -0x24(%rsp)
jne 0x70c6
movl $0xffffffff, -0x4(%rsp) # imm = 0xFFFFFFFF
jmp 0x713e
cmpl $0x61, -0x28(%rsp)
jl 0x70df
cmpl $0x7a, -0x28(%rsp)
jg 0x70df
movl -0x28(%rsp), %eax
subl $0x20, %eax
movl %eax, -0x28(%rsp)
cmpl $0x61, -0x24(%rsp)
jl 0x70f8
cmpl $0x7a, -0x24(%rsp)
jg 0x70f8
movl -0x24(%rsp), %eax
subl $0x20, %eax
movl %eax, -0x24(%rsp)
movl -0x28(%rsp), %eax
cmpl -0x24(%rsp), %eax
je 0x710c
movl $0xffffffff, -0x4(%rsp) # imm = 0xFFFFFFFF
jmp 0x713e
movl -0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rsp)
jmp 0x7066
movq -0x18(%rsp), %rax
movslq -0x20(%rsp), %rcx
cmpb $0x0, (%rax,%rcx)
je 0x7136
movl $0xffffffff, -0x4(%rsp) # imm = 0xFFFFFFFF
jmp 0x713e
movl -0x20(%rsp), %eax
movl %eax, -0x4(%rsp)
movl -0x4(%rsp), %eax
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/ufat_ent.c
// Function: ufat_short_checksum
uint8_t ufat_short_checksum(const char *short_name, const char *short_ext)
{
	uint8_t sum = 0;
	int i;

	for (i = 0; short_name[i]; i++)
		sum = cksum_next(sum, short_name[i]);
	for (; i < 8; i++)
		sum = cksum_next(sum, ' ');

	for (i = 0; short_ext[i]; i++)
		sum = cksum_next(sum, short_ext[i]);
	for (; i < 3; i++)
		sum = cksum_next(sum, ' ');

	return sum;
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movb $0x0, 0x7(%rsp)
movl $0x0, (%rsp)
movq 0x10(%rsp), %rax
movslq (%rsp), %rcx
cmpb $0x0, (%rax,%rcx)
je 0x75b1
movb 0x7(%rsp), %dl
movq 0x10(%rsp), %rax
movslq (%rsp), %rcx
movzbl %dl, %edi
movsbl (%rax,%rcx), %esi
callq 0x7650
movb %al, 0x7(%rsp)
movl (%rsp), %eax
addl $0x1, %eax
movl %eax, (%rsp)
jmp 0x757a
jmp 0x75b3
cmpl $0x8, (%rsp)
jge 0x75d7
movl $0x20, %esi
movzbl 0x7(%rsp), %edi
callq 0x7650
movb %al, 0x7(%rsp)
movl (%rsp), %eax
addl $0x1, %eax
movl %eax, (%rsp)
jmp 0x75b3
movl $0x0, (%rsp)
movq 0x8(%rsp), %rax
movslq (%rsp), %rcx
cmpb $0x0, (%rax,%rcx)
je 0x7615
movb 0x7(%rsp), %dl
movq 0x8(%rsp), %rax
movslq (%rsp), %rcx
movzbl %dl, %edi
movsbl (%rax,%rcx), %esi
callq 0x7650
movb %al, 0x7(%rsp)
movl (%rsp), %eax
addl $0x1, %eax
movl %eax, (%rsp)
jmp 0x75de
jmp 0x7617
cmpl $0x3, (%rsp)
jge 0x763b
movl $0x20, %esi
movzbl 0x7(%rsp), %edi
callq 0x7650
movb %al, 0x7(%rsp)
movl (%rsp), %eax
addl $0x1, %eax
movl %eax, (%rsp)
jmp 0x7617
movb 0x7(%rsp), %al
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/ufat_ent.c
// Function: ufat_lfn_pack_fragment
void ufat_lfn_pack_fragment(const uint16_t *ucs, int seq, int is_first,
			    uint8_t *data, uint8_t checksum)
{
	int i;

	data[0] = seq;
	if (is_first)
		data[0] |= 0x40;

	for (i = 0; i < 5; i++)
		w16(data + 0x01 + i * 2, ucs[i]);

	data[0x0b] = UFAT_ATTR_LFN_FRAGMENT;
	data[0x0c] = 0;
	data[0x0d] = checksum;

	for (i = 0; i < 6; i++)
		w16(data + 0x0e + i * 2, ucs[i + 5]);

	data[0x1a] = 0;
	data[0x1b] = 0;

	w16(data + 0x1c, ucs[11]);
	w16(data + 0x1e, ucs[12]);
}

// Assembly:
subq $0x28, %rsp
movb %r8b, %al
movq %rdi, 0x20(%rsp)
movl %esi, 0x1c(%rsp)
movl %edx, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
movb %al, 0xf(%rsp)
movl 0x1c(%rsp), %eax
movb %al, %cl
movq 0x10(%rsp), %rax
movb %cl, (%rax)
cmpl $0x0, 0x18(%rsp)
je 0x78ee
movq 0x10(%rsp), %rax
movzbl (%rax), %ecx
orl $0x40, %ecx
movb %cl, (%rax)
movl $0x0, 0x8(%rsp)
cmpl $0x5, 0x8(%rsp)
jge 0x7931
movq 0x10(%rsp), %rdi
addq $0x1, %rdi
movl 0x8(%rsp), %eax
shll %eax
cltq
addq %rax, %rdi
movq 0x20(%rsp), %rax
movslq 0x8(%rsp), %rcx
movzwl (%rax,%rcx,2), %esi
callq 0x6a30
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x78f6
movq 0x10(%rsp), %rax
movb $0xf, 0xb(%rax)
movq 0x10(%rsp), %rax
movb $0x0, 0xc(%rax)
movb 0xf(%rsp), %cl
movq 0x10(%rsp), %rax
movb %cl, 0xd(%rax)
movl $0x0, 0x8(%rsp)
cmpl $0x6, 0x8(%rsp)
jge 0x7997
movq 0x10(%rsp), %rdi
addq $0xe, %rdi
movl 0x8(%rsp), %eax
shll %eax
cltq
addq %rax, %rdi
movq 0x20(%rsp), %rax
movl 0x8(%rsp), %ecx
addl $0x5, %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %esi
callq 0x6a30
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x7957
movq 0x10(%rsp), %rax
movb $0x0, 0x1a(%rax)
movq 0x10(%rsp), %rax
movb $0x0, 0x1b(%rax)
movq 0x10(%rsp), %rdi
addq $0x1c, %rdi
movq 0x20(%rsp), %rax
movzwl 0x16(%rax), %esi
callq 0x6a30
movq 0x10(%rsp), %rdi
addq $0x1e, %rdi
movq 0x20(%rsp), %rax
movzwl 0x18(%rax), %esi
callq 0x6a30
addq $0x28, %rsp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/ufat_ent.c
// Function: ufat_format_short
int ufat_format_short(const char *name, const char *ext,
		      char *out, int max_len)
{
	int i = 0;

	while (*name) {
		if (i >= max_len)
			return -UFAT_ERR_NAME_TOO_LONG;

		out[i++] = *(name++);
	}

	if (*ext) {
		if (i >= max_len)
			return -UFAT_ERR_NAME_TOO_LONG;
		out[i++] = '.';

		while (*ext) {
			if (i >= max_len)
				return -UFAT_ERR_NAME_TOO_LONG;
			out[i++] = *(ext++);
		}
	}

	if (i >= max_len)
		return -UFAT_ERR_NAME_TOO_LONG;

	out[i] = 0;
	return 0;
}

// Assembly:
movq %rdi, -0x10(%rsp)
movq %rsi, -0x18(%rsp)
movq %rdx, -0x20(%rsp)
movl %ecx, -0x24(%rsp)
movl $0x0, -0x28(%rsp)
movq -0x10(%rsp), %rax
cmpb $0x0, (%rax)
je 0x7a49
movl -0x28(%rsp), %eax
cmpl -0x24(%rsp), %eax
jl 0x7a1c
movl $0xfffffffa, -0x4(%rsp) # imm = 0xFFFFFFFA
jmp 0x7afa
movq -0x10(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rsp)
movb (%rax), %dl
movq -0x20(%rsp), %rax
movl -0x28(%rsp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x28(%rsp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
jmp 0x79fb
movq -0x18(%rsp), %rax
cmpb $0x0, (%rax)
je 0x7ad0
movl -0x28(%rsp), %eax
cmpl -0x24(%rsp), %eax
jl 0x7a6a
movl $0xfffffffa, -0x4(%rsp) # imm = 0xFFFFFFFA
jmp 0x7afa
movq -0x20(%rsp), %rax
movl -0x28(%rsp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x28(%rsp)
movslq %ecx, %rcx
movb $0x2e, (%rax,%rcx)
movq -0x18(%rsp), %rax
cmpb $0x0, (%rax)
je 0x7ace
movl -0x28(%rsp), %eax
cmpl -0x24(%rsp), %eax
jl 0x7aa1
movl $0xfffffffa, -0x4(%rsp) # imm = 0xFFFFFFFA
jmp 0x7afa
movq -0x18(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rsp)
movb (%rax), %dl
movq -0x20(%rsp), %rax
movl -0x28(%rsp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x28(%rsp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
jmp 0x7a83
jmp 0x7ad0
movl -0x28(%rsp), %eax
cmpl -0x24(%rsp), %eax
jl 0x7ae4
movl $0xfffffffa, -0x4(%rsp) # imm = 0xFFFFFFFA
jmp 0x7afa
movq -0x20(%rsp), %rax
movslq -0x28(%rsp), %rcx
movb $0x0, (%rax,%rcx)
movl $0x0, -0x4(%rsp)
movl -0x4(%rsp), %eax
retq
nop
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/ufat_ent.c
// Function: ufat_update_attributes
int ufat_update_attributes(struct ufat *uf, struct ufat_dirent *ent)
{
	int idx = ufat_cache_open(uf, ent->dirent_block, 0);
	uint8_t *data;
	struct ufat_dirent old;

	if (idx < 0)
		return idx;

	data = ufat_cache_data(uf, idx) + ent->dirent_pos * UFAT_DIRENT_SIZE;
	ufat_parse_dirent(uf->bpb.type, data, &old);

	if (!(old.attributes & UFAT_ATTR_DIRECTORY))
		old.attributes = (old.attributes & ~UFAT_ATTR_USER) |
			(ent->attributes & UFAT_ATTR_USER);

	old.create_date = ent->create_date;
	old.create_time = ent->create_time;
	old.modify_date = ent->modify_date;
	old.modify_time = ent->modify_time;
	old.access_date = ent->access_date;

	ufat_cache_write(uf, idx);
	ufat_pack_dirent(&old, data);

	return 0;
}

// Assembly:
subq $0x78, %rsp
movq %rdi, 0x68(%rsp)
movq %rsi, 0x60(%rsp)
movq 0x68(%rsp), %rdi
movq 0x60(%rsp), %rax
movq (%rax), %rsi
xorl %edx, %edx
callq 0x2660
movl %eax, 0x5c(%rsp)
cmpl $0x0, 0x5c(%rsp)
jge 0x7b3a
movl 0x5c(%rsp), %eax
movl %eax, 0x74(%rsp)
jmp 0x7c03
movq 0x68(%rsp), %rdi
movl 0x5c(%rsp), %esi
callq 0x60b0
movq 0x60(%rsp), %rcx
movl 0x8(%rcx), %ecx
shll $0x5, %ecx
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, 0x50(%rsp)
movq 0x68(%rsp), %rax
movl 0x28(%rax), %edi
movq 0x50(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x6670
movl 0x34(%rsp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
jne 0x7b98
movl 0x34(%rsp), %eax
andl $-0x28, %eax
movq 0x60(%rsp), %rcx
movl 0x2c(%rcx), %ecx
andl $0x27, %ecx
orl %ecx, %eax
movl %eax, 0x34(%rsp)
movq 0x60(%rsp), %rax
movw 0x30(%rax), %ax
movw %ax, 0x38(%rsp)
movq 0x60(%rsp), %rax
movw 0x32(%rax), %ax
movw %ax, 0x3a(%rsp)
movq 0x60(%rsp), %rax
movw 0x34(%rax), %ax
movw %ax, 0x3c(%rsp)
movq 0x60(%rsp), %rax
movw 0x36(%rax), %ax
movw %ax, 0x3e(%rsp)
movq 0x60(%rsp), %rax
movw 0x38(%rax), %ax
movw %ax, 0x40(%rsp)
movq 0x68(%rsp), %rdi
movl 0x5c(%rsp), %esi
callq 0x6070
movq 0x50(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x68a0
movl $0x0, 0x74(%rsp)
movl 0x74(%rsp), %eax
addq $0x78, %rsp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/ufat_mkfs.c
// Function: ufat_mkfs
int ufat_mkfs(struct ufat_device *dev, ufat_block_t nblk)
{
	struct fs_layout fl;
	int err;

	err = calculate_layout(&fl, nblk, dev->log2_block_size);
	if (err < 0)
		return err;

	err = erase_reserved_blocks(dev, &fl);
	if (err < 0)
		return err;

	switch (fl.type) {
	case UFAT_TYPE_FAT12:
		err = init_fat12(dev, &fl);
		break;

	case UFAT_TYPE_FAT16:
		err = init_fat16(dev, &fl);
		break;

	case UFAT_TYPE_FAT32:
		err = init_fat32(dev, &fl);
		break;
	}

	if (err < 0)
		return err;

	if (fl.type == UFAT_TYPE_FAT32)
		err = init_root_cluster(dev, &fl);
	else
		err = init_root_blocks(dev, &fl);

	if (err < 0)
		return err;

	if (fl.type == UFAT_TYPE_FAT32) {
		err = write_fsinfo(dev, &fl);
		if (err < 0)
			return err;
	}

	return write_bpb(dev, &fl);
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rax
movl (%rax), %edx
leaq 0x10(%rsp), %rdi
callq 0x7db0
movl %eax, 0xc(%rsp)
cmpl $0x0, 0xc(%rsp)
jge 0x7c7c
movl 0xc(%rsp), %eax
movl %eax, 0x54(%rsp)
jmp 0x7d99
movq 0x48(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x8130
movl %eax, 0xc(%rsp)
cmpl $0x0, 0xc(%rsp)
jge 0x7ca3
movl 0xc(%rsp), %eax
movl %eax, 0x54(%rsp)
jmp 0x7d99
movl 0x3c(%rsp), %eax
movl %eax, 0x8(%rsp)
subl $0xc, %eax
je 0x7cc8
jmp 0x7cb2
movl 0x8(%rsp), %eax
subl $0x10, %eax
je 0x7cdd
jmp 0x7cbd
movl 0x8(%rsp), %eax
subl $0x20, %eax
je 0x7cf2
jmp 0x7d05
movq 0x48(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x8160
movl %eax, 0xc(%rsp)
jmp 0x7d05
movq 0x48(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x8340
movl %eax, 0xc(%rsp)
jmp 0x7d05
movq 0x48(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x84d0
movl %eax, 0xc(%rsp)
cmpl $0x0, 0xc(%rsp)
jge 0x7d19
movl 0xc(%rsp), %eax
movl %eax, 0x54(%rsp)
jmp 0x7d99
cmpl $0x20, 0x3c(%rsp)
jne 0x7d35
movq 0x48(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x8670
movl %eax, 0xc(%rsp)
jmp 0x7d48
movq 0x48(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x86d0
movl %eax, 0xc(%rsp)
cmpl $0x0, 0xc(%rsp)
jge 0x7d59
movl 0xc(%rsp), %eax
movl %eax, 0x54(%rsp)
jmp 0x7d99
cmpl $0x20, 0x3c(%rsp)
jne 0x7d86
movq 0x48(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x8720
movl %eax, 0xc(%rsp)
cmpl $0x0, 0xc(%rsp)
jge 0x7d84
movl 0xc(%rsp), %eax
movl %eax, 0x54(%rsp)
jmp 0x7d99
jmp 0x7d86
movq 0x48(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x8880
movl %eax, 0x54(%rsp)
movl 0x54(%rsp), %eax
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/ufat_mkfs.c
// Function: init_fat16
static int init_fat16(struct ufat_device *dev, const struct fs_layout *fl)
{
	const unsigned int block_size = 1 << dev->log2_block_size;
	ufat_block_t i;
	ufat_block_t block;
	ufat_cluster_t c;

	for (i = 0, block = 0, c = 0; i < fl->fat_blocks * 2; i++, block++) {
		uint8_t buf[block_size];
		unsigned int j;

		if (block == fl->fat_blocks) {
			block = 0;
			c = 0;
		}

		memset(buf, 0, block_size);

		for (j = 0; j < block_size; j += 2) {
			if (c >= fl->clusters)
				w16(buf + j, 0xfff7);

			c++;
		}

		if (block == 0) {
			w16(buf, 0xff00 | MEDIA_DISK);
			w16(buf + 2, 0xfff8);
		}

		if (dev->write(dev, fl->reserved_blocks + i, 1, buf) < 0)
			return -UFAT_ERR_IO;
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, -0x1c(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rcx
shlq %rcx
cmpq %rcx, %rax
jae 0x84bc
movl -0x1c(%rbp), %eax
movq %rsp, %rcx
movq %rcx, -0x40(%rbp)
movq %rax, %rdx
addq $0xf, %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x58(%rbp)
movq %rcx, %rsp
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jne 0x83d2
movq $0x0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x58(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, %edx
xorl %esi, %esi
callq 0x2100
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jae 0x8425
movl -0x34(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x28(%rcx), %eax
jb 0x8411
movq -0x58(%rbp), %rdi
movl -0x4c(%rbp), %eax
addq %rax, %rdi
movl $0xfff7, %esi           # imm = 0xFFF7
callq 0x8cb0
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
movl -0x4c(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x4c(%rbp)
jmp 0x83e9
cmpq $0x0, -0x30(%rbp)
jne 0x844c
movq -0x58(%rbp), %rdi
movl $0xfff8, %esi           # imm = 0xFFF8
callq 0x8cb0
movq -0x58(%rbp), %rdi
addq $0x2, %rdi
movl $0xfff8, %esi           # imm = 0xFFF8
callq 0x8cb0
movq -0x58(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rdx
movq 0x8(%rdx), %rsi
addq -0x28(%rbp), %rsi
movl $0x1, %edx
callq *%rax
cmpl $0x0, %eax
jge 0x8484
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x50(%rbp)
jmp 0x848b
movl $0x0, -0x50(%rbp)
movq -0x40(%rbp), %rax
movq %rax, %rsp
movl -0x50(%rbp), %eax
testl %eax, %eax
je 0x849d
jmp 0x849b
jmp 0x84c3
jmp 0x849f
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x8377
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
movq %rbp, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/ufat_mkfs.c
// Function: init_fat32
static int init_fat32(struct ufat_device *dev, const struct fs_layout *fl)
{
	const unsigned int block_size = 1 << dev->log2_block_size;
	ufat_block_t i;
	ufat_block_t block;
	ufat_cluster_t c;

	for (i = 0, block = 0, c = 0; i < fl->fat_blocks * 2; i++, block++) {
		uint8_t buf[block_size];
		unsigned int j;

		if (block == fl->fat_blocks) {
			block = 0;
			c = 0;
		}

		memset(buf, 0, block_size);

		for (j = 0; j < block_size; j += 4) {
			if (c >= fl->clusters)
				w32(buf + j, 0xfffffff7);

			c++;
		}

		if (block == 0) {
			w32(buf + 0, 0xffffff00 | MEDIA_DISK);
			w32(buf + 4, 0xfffffff8);
			w32(buf + 8, 0xfffffff8);
		}

		if (dev->write(dev, fl->reserved_blocks + i, 1, buf) < 0)
			return -UFAT_ERR_IO;
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, -0x1c(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rcx
shlq %rcx
cmpq %rcx, %rax
jae 0x865e
movl -0x1c(%rbp), %eax
movq %rsp, %rcx
movq %rcx, -0x40(%rbp)
movq %rax, %rdx
addq $0xf, %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x58(%rbp)
movq %rcx, %rsp
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jne 0x8562
movq $0x0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x58(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, %edx
xorl %esi, %esi
callq 0x2100
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jae 0x85b5
movl -0x34(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x28(%rcx), %eax
jb 0x85a1
movq -0x58(%rbp), %rdi
movl -0x4c(%rbp), %eax
addq %rax, %rdi
movl $0xfffffff7, %esi       # imm = 0xFFFFFFF7
callq 0x8cf0
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
movl -0x4c(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x4c(%rbp)
jmp 0x8579
cmpq $0x0, -0x30(%rbp)
jne 0x85ee
movq -0x58(%rbp), %rdi
movl $0xfffffff8, %esi       # imm = 0xFFFFFFF8
callq 0x8cf0
movq -0x58(%rbp), %rdi
addq $0x4, %rdi
movl $0xfffffff8, %esi       # imm = 0xFFFFFFF8
callq 0x8cf0
movq -0x58(%rbp), %rdi
addq $0x8, %rdi
movl $0xfffffff8, %esi       # imm = 0xFFFFFFF8
callq 0x8cf0
movq -0x58(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rdx
movq 0x8(%rdx), %rsi
addq -0x28(%rbp), %rsi
movl $0x1, %edx
callq *%rax
cmpl $0x0, %eax
jge 0x8626
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x50(%rbp)
jmp 0x862d
movl $0x0, -0x50(%rbp)
movq -0x40(%rbp), %rax
movq %rax, %rsp
movl -0x50(%rbp), %eax
testl %eax, %eax
je 0x863f
jmp 0x863d
jmp 0x8665
jmp 0x8641
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x8507
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
movq %rbp, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/ufat_mkfs.c
// Function: init_root_cluster
static int init_root_cluster(struct ufat_device *dev,
			     const struct fs_layout *fl)
{
	const ufat_block_t cluster_start =
		fl->fat_blocks * 2 + fl->reserved_blocks + fl->root_blocks;
	const unsigned int cluster_blocks = 1 << fl->log2_bpc;

	return erase_blocks(dev, cluster_start, cluster_blocks);
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rax
shlq %rax
movq 0x18(%rsp), %rcx
addq 0x8(%rcx), %rax
movq 0x18(%rsp), %rcx
addq 0x10(%rcx), %rax
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %rax
movl 0x4(%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, 0xc(%rsp)
movq 0x20(%rsp), %rdi
movq 0x10(%rsp), %rsi
movl 0xc(%rsp), %eax
movl %eax, %edx
callq 0x8be0
addq $0x28, %rsp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/ufat_mkfs.c
// Function: write_fsinfo
static int write_fsinfo(struct ufat_device *dev, const struct fs_layout *fl)
{
	const unsigned int log2_bps =
		fl->log2_sector_size - dev->log2_block_size;
	const unsigned int block_size = 1 << dev->log2_block_size;
	uint8_t buf[block_size];

	memset(buf, 0, sizeof(buf));
	w32(buf + 0x000, 0x41615252); /* FSI_LeadSig */
	w32(buf + 0x1e4, 0x61417272); /* FSI_StrucSig */
	w32(buf + 0x1e8, fl->clusters - 3); /* FSI_Free_Count */
	w32(buf + 0x1ec, 2); /* FSI_Nxt_Free */
	w32(buf + 0x1fc, 0xaa550000); /* FSI_TrailSig */

	/* Write FSInfo and its backup */
	const ufat_block_t fsinfo_block = FSINFO_SECTOR >> log2_bps;
	const ufat_block_t fsinfo_backup_block =
		(FSINFO_SECTOR + BACKUP_SECTOR) >> log2_bps;
	if (dev->write(dev, fsinfo_block, 1, buf) < 0 ||
	    dev->write(dev, fsinfo_backup_block, 1, buf) < 0)
		return -UFAT_ERR_IO;

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %eax
movq -0x10(%rbp), %rcx
movl (%rcx), %ecx
subl %ecx, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movb (%rax), %cl
movl $0x1, %eax
shll %cl, %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
movl %eax, %edx
movq %rsp, %rax
movq %rax, -0x28(%rbp)
movq %rdx, %rax
addq $0xf, %rax
andq $-0x10, %rax
movq %rsp, %rdi
subq %rax, %rdi
movq %rdi, -0x50(%rbp)
movq %rdi, %rsp
movq %rdx, -0x30(%rbp)
xorl %esi, %esi
callq 0x2100
movq -0x50(%rbp), %rdi
movl $0x41615252, %esi       # imm = 0x41615252
callq 0x8cf0
movq -0x50(%rbp), %rdi
addq $0x1e4, %rdi            # imm = 0x1E4
movl $0x61417272, %esi       # imm = 0x61417272
callq 0x8cf0
movq -0x50(%rbp), %rdi
addq $0x1e8, %rdi            # imm = 0x1E8
movq -0x18(%rbp), %rax
movl 0x28(%rax), %esi
subl $0x3, %esi
callq 0x8cf0
movq -0x50(%rbp), %rdi
addq $0x1ec, %rdi            # imm = 0x1EC
movl $0x2, %esi
callq 0x8cf0
movq -0x50(%rbp), %rdi
addq $0x1fc, %rdi            # imm = 0x1FC
movl $0xaa550000, %esi       # imm = 0xAA550000
callq 0x8cf0
movl -0x1c(%rbp), %ecx
movl $0x1, %eax
sarl %cl, %eax
cltq
movq %rax, -0x38(%rbp)
movl -0x1c(%rbp), %ecx
movl $0x7, %eax
sarl %cl, %eax
movq -0x50(%rbp), %rcx
cltq
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl $0x1, %edx
callq *%rax
cmpl $0x0, %eax
jl 0x8847
movq -0x50(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
movl $0x1, %edx
callq *%rax
cmpl $0x0, %eax
jge 0x8857
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x44(%rbp)
jmp 0x8865
movl $0x0, -0x4(%rbp)
movl $0x1, -0x44(%rbp)
movq -0x28(%rbp), %rax
movq %rax, %rsp
movl -0x4(%rbp), %eax
movq %rbp, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)