LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/ufat_mkfs.c
// Function: erase_blocks
static int erase_blocks(struct ufat_device *dev, ufat_block_t start,
			ufat_block_t count)
{
	const unsigned int block_size = 1 << dev->log2_block_size;
	uint8_t buf[block_size];

	memset(buf, 0, sizeof(buf));
	for (ufat_block_t i = 0; i < count; i++)
		if (dev->write(dev, start + i, 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 %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movb (%rax), %cl
movl $0x1, %eax
shll %cl, %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl %eax, %edx
movq %rsp, %rax
movq %rax, -0x30(%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, -0x38(%rbp)
xorl %esi, %esi
callq 0x2100
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x8c89
movq -0x50(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq -0x40(%rbp), %rsi
movl $0x1, %edx
callq *%rax
cmpl $0x0, %eax
jge 0x8c79
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x44(%rbp)
jmp 0x8c97
jmp 0x8c7b
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x8c3b
movl $0x0, -0x4(%rbp)
movl $0x1, -0x44(%rbp)
movq -0x30(%rbp), %rax
movq %rax, %rsp
movl -0x4(%rbp), %eax
movq %rbp, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/main.c
// Function: file_device_open
static int file_device_open(struct file_device *dev, const char *fname,
			    unsigned int log2_bs, int create)
{
	dev->base.log2_block_size = log2_bs;
	dev->base.read = file_device_read;
	dev->base.write = file_device_write;
	dev->is_read_only = 0;

	if (create) {
		dev->f = fopen(fname, "wb+");
	} else {
		dev->f = fopen(fname, "rb+");
		if (!dev->f && errno == EACCES) {
			dev->is_read_only = 1;
			dev->f = fopen(fname, "rb");
		}
	}

	if (!dev->f) {
		perror("open");
		return -1;
	}

	return 0;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movl %edx, 0xc(%rsp)
movl %ecx, 0x8(%rsp)
movl 0xc(%rsp), %ecx
movq 0x18(%rsp), %rax
movl %ecx, (%rax)
movq 0x18(%rsp), %rax
leaq 0x25f3(%rip), %rcx      # 0xb820
movq %rcx, 0x8(%rax)
movq 0x18(%rsp), %rax
leaq 0x26e3(%rip), %rcx      # 0xb920
movq %rcx, 0x10(%rax)
movq 0x18(%rsp), %rax
movl $0x0, 0x20(%rax)
cmpl $0x0, 0x8(%rsp)
je 0x9273
movq 0x10(%rsp), %rdi
leaq 0x3d0f(%rip), %rsi      # 0xcf6f
callq 0x2180
movq %rax, %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x18(%rax)
jmp 0x92d1
movq 0x10(%rsp), %rdi
leaq 0x3cf4(%rip), %rsi      # 0xcf73
callq 0x2180
movq %rax, %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x18(%rsp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x92cf
callq 0x2050
cmpl $0xd, (%rax)
jne 0x92cf
movq 0x18(%rsp), %rax
movl $0x1, 0x20(%rax)
movq 0x10(%rsp), %rdi
leaq 0x3aa8(%rip), %rsi      # 0xcd66
callq 0x2180
movq %rax, %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x18(%rax)
jmp 0x92d1
movq 0x18(%rsp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x92f3
leaq 0x3c93(%rip), %rdi      # 0xcf77
callq 0x2190
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
jmp 0x92fb
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/main.c
// Function: open_output
static FILE *open_output(const char *fname)
{
	FILE *out;

	if (!fname)
		return stdout;

	out = fopen(fname, "wb");
	if (!out) {
		fprintf(stderr, "Failed to open %s for writing: %s\n",
			fname, strerror(errno));
		return NULL;
	}

	return out;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
cmpq $0x0, 0x18(%rsp)
jne 0x9352
movq 0x6c78(%rip), %rax      # 0xffc0
movq (%rax), %rax
movq %rax, 0x20(%rsp)
jmp 0x93c3
movq 0x18(%rsp), %rdi
leaq 0x3ca6(%rip), %rsi      # 0xd004
callq 0x2180
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
jne 0x93b9
movq 0x6c81(%rip), %rax      # 0xfff8
movq (%rax), %rax
movq %rax, (%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
callq 0x2050
movl (%rax), %edi
callq 0x21d0
movq (%rsp), %rdi
movq 0x8(%rsp), %rdx
movq %rax, %rcx
leaq 0x3c60(%rip), %rsi      # 0xd007
movb $0x0, %al
callq 0x2120
movq $0x0, 0x20(%rsp)
jmp 0x93c3
movq 0x10(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
addq $0x28, %rsp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/main.c
// Function: show_info
static void show_info(FILE *out, const struct ufat_bpb *bpb)
{
	fprintf(out, "Type:                       FAT%d\n", bpb->type);
	fprintf(out, "Blocks per cluster:         %u\n",
		1 << bpb->log2_blocks_per_cluster);
	fprintf(out, "FAT size (blocks):          %llu\n", bpb->fat_size);
	fprintf(out, "FAT offset (block):         %llu\n", bpb->fat_start);
	fprintf(out, "FAT count:                  %u\n", bpb->fat_count);
	fprintf(out, "Cluster starting block:     %llu\n", bpb->cluster_start);
	fprintf(out, "Clusters:                   %u\n", bpb->num_clusters);
	fprintf(out, "Root directory block start: %llu\n", bpb->root_start);
	fprintf(out, "Root directory block count: %llu\n", bpb->root_size);
	fprintf(out, "Root directory cluster:     %u\n", bpb->root_cluster);
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rax
movl (%rax), %edx
leaq 0x3c39(%rip), %rsi      # 0xd02a
movb $0x0, %al
callq 0x2120
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rax
movl 0x4(%rax), %ecx
movl $0x1, %edx
shll %cl, %edx
leaq 0x3c3a(%rip), %rsi      # 0xd04d
movb $0x0, %al
callq 0x2120
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rdx
leaq 0x3c3e(%rip), %rsi      # 0xd06d
movb $0x0, %al
callq 0x2120
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rdx
leaq 0x3c44(%rip), %rsi      # 0xd08f
movb $0x0, %al
callq 0x2120
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rax
movl 0x18(%rax), %edx
leaq 0x3c4b(%rip), %rsi      # 0xd0b1
movb $0x0, %al
callq 0x2120
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rdx
leaq 0x3c4f(%rip), %rsi      # 0xd0d1
movb $0x0, %al
callq 0x2120
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rax
movl 0x28(%rax), %edx
leaq 0x3c56(%rip), %rsi      # 0xd0f3
movb $0x0, %al
callq 0x2120
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rax
movq 0x30(%rax), %rdx
leaq 0x3c5a(%rip), %rsi      # 0xd113
movb $0x0, %al
callq 0x2120
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rax
movq 0x38(%rax), %rdx
leaq 0x3c60(%rip), %rsi      # 0xd135
movb $0x0, %al
callq 0x2120
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rax
movl 0x40(%rax), %edx
leaq 0x3c67(%rip), %rsi      # 0xd157
movb $0x0, %al
callq 0x2120
addq $0x18, %rsp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/main.c
// Function: close_output
static int close_output(const char *fname, FILE *f)
{
	if (fname && fclose(f) < 0) {
		fprintf(stderr, "Error on closing %s: %s\n",
			fname, strerror(errno));
		return -1;
	}

	return 0;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
cmpq $0x0, 0x18(%rsp)
je 0x956d
movq 0x10(%rsp), %rdi
callq 0x20b0
cmpl $0x0, %eax
jge 0x956d
movq 0x6acc(%rip), %rax      # 0xfff8
movq (%rax), %rax
movq %rax, (%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
callq 0x2050
movl (%rax), %edi
callq 0x21d0
movq (%rsp), %rdi
movq 0x8(%rsp), %rdx
movq %rax, %rcx
leaq 0x3c1b(%rip), %rsi      # 0xd177
movb $0x0, %al
callq 0x2120
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
jmp 0x9575
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/main.c
// Function: dump_stats
static void dump_stats(const struct ufat_stat *st)
{
	fprintf(stderr, "\n");
	fprintf(stderr,
		"Reads:             %6d comprising %6d blocks\n",
		st->read, st->read_blocks);
	fprintf(stderr,
		"Writes:            %6d comprising %6d blocks\n",
		st->write, st->write_blocks);

	fprintf(stderr,	"Cache write/flush: %6d/%6d\n",
		st->cache_write, st->cache_flush);
	fprintf(stderr, "Cache hit/miss:    %6d/%6d",
		st->cache_hit, st->cache_miss);

	if (st->cache_hit + st->cache_miss)
		fprintf(stderr, " (%02d%% hit rate)\n",
			st->cache_hit * 100 / (st->cache_hit + st->cache_miss));
	else
		fprintf(stderr, "\n");
}

// Assembly:
pushq %rax
movq %rdi, (%rsp)
movq 0x6a6c(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0x3c9f(%rip), %rsi      # 0xd235
movb $0x0, %al
callq 0x2120
movq 0x6a54(%rip), %rax      # 0xfff8
movq (%rax), %rdi
movq (%rsp), %rax
movl (%rax), %edx
movq (%rsp), %rax
movl 0x8(%rax), %ecx
leaq 0x3bd5(%rip), %rsi      # 0xd190
movb $0x0, %al
callq 0x2120
movq 0x6a2f(%rip), %rax      # 0xfff8
movq (%rax), %rdi
movq (%rsp), %rax
movl 0x4(%rax), %edx
movq (%rsp), %rax
movl 0xc(%rax), %ecx
leaq 0x3bdd(%rip), %rsi      # 0xd1be
movb $0x0, %al
callq 0x2120
movq 0x6a09(%rip), %rax      # 0xfff8
movq (%rax), %rdi
movq (%rsp), %rax
movl 0x18(%rax), %edx
movq (%rsp), %rax
movl 0x1c(%rax), %ecx
leaq 0x3be5(%rip), %rsi      # 0xd1ec
movb $0x0, %al
callq 0x2120
movq 0x69e3(%rip), %rax      # 0xfff8
movq (%rax), %rdi
movq (%rsp), %rax
movl 0x10(%rax), %edx
movq (%rsp), %rax
movl 0x14(%rax), %ecx
leaq 0x3bdb(%rip), %rsi      # 0xd208
movb $0x0, %al
callq 0x2120
movq (%rsp), %rax
movl 0x10(%rax), %eax
movq (%rsp), %rcx
addl 0x14(%rcx), %eax
cmpl $0x0, %eax
je 0x967d
movq 0x69aa(%rip), %rax      # 0xfff8
movq (%rax), %rdi
movq (%rsp), %rax
imull $0x64, 0x10(%rax), %eax
movq (%rsp), %rcx
movl 0x10(%rcx), %ecx
movq (%rsp), %rdx
addl 0x14(%rdx), %ecx
xorl %edx, %edx
divl %ecx
movl %eax, %edx
leaq 0x3baf(%rip), %rsi      # 0xd223
movb $0x0, %al
callq 0x2120
jmp 0x9695
movq 0x6974(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0x3ba7(%rip), %rsi      # 0xd235
movb $0x0, %al
callq 0x2120
popq %rax
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/main.c
// Function: parse_blocksize
static int parse_blocksize(const char *arg, unsigned int *out)
{
	unsigned int target = atoi(arg);
	unsigned int c = 0;

	if (!target) {
		fprintf(stderr, "Block size must be greater than 0\n");
		return -1;
	}

	while (target > 1) {
		if (target & 1) {
			fprintf(stderr, "Block size must be a power of 2\n");
			return -1;
		}

		target >>= 1;
		c++;
	}

	*out = c;
	return 0;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movq 0x18(%rsp), %rdi
callq 0x21a0
movl %eax, 0xc(%rsp)
movl $0x0, 0x8(%rsp)
cmpl $0x0, 0xc(%rsp)
jne 0x972d
movq 0x68e6(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0x3377(%rip), %rsi      # 0xca93
movb $0x0, %al
callq 0x2120
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
jmp 0x978e
jmp 0x972f
cmpl $0x1, 0xc(%rsp)
jbe 0x977b
movl 0xc(%rsp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x9764
movq 0x68af(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0x3363(%rip), %rsi      # 0xcab6
movb $0x0, %al
callq 0x2120
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
jmp 0x978e
movl 0xc(%rsp), %eax
shrl %eax
movl %eax, 0xc(%rsp)
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x972f
movl 0x8(%rsp), %ecx
movq 0x10(%rsp), %rax
movl %ecx, (%rax)
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/main.c
// Function: find_command
static const struct command *find_command(const char *name)
{
	size_t i;

	for (i = 0; i < sizeof(command_table) /
		     sizeof(command_table[0]); i++) {
		const struct command *c = &command_table[i];

		if (!strcasecmp(c->name, name))
			return c;
	}

	return NULL;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq $0x0, 0x10(%rsp)
cmpq $0x9, 0x10(%rsp)
jae 0x9807
movq 0x10(%rsp), %rcx
leaq 0x657a(%rip), %rax      # 0xfd40
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq (%rax), %rdi
movq 0x18(%rsp), %rsi
callq 0x2030
cmpl $0x0, %eax
jne 0x97f5
movq 0x8(%rsp), %rax
movq %rax, 0x20(%rsp)
jmp 0x9810
jmp 0x97f7
movq 0x10(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x10(%rsp)
jmp 0x97b2
movq $0x0, 0x20(%rsp)
movq 0x20(%rsp), %rax
addq $0x28, %rsp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/main.c
// Function: cmd_dir
static int cmd_dir(struct ufat *uf, const struct options *opt)
{
	struct ufat_directory dir;
	FILE *out;

	if (opt->argc) {
		struct ufat_dirent ent;
		int err;

		if (require_file(uf, opt->argv[0], &ent) < 0)
			return -1;

		err = ufat_open_subdir(uf, &dir, &ent);
		if (err < 0) {
			fprintf(stderr, "ufat_open_subdir: %s\n",
				ufat_strerror(err));
			return -1;
		}
	} else {
		ufat_open_root(uf, &dir);
	}

	out = open_output(opt->out_file);
	if (!out)
		return -1;

	if (list_dir(out, &dir) < 0) {
		close_output(opt->out_file, out);
		return -1;
	}

	return close_output(opt->out_file, out);
}

// Assembly:
subq $0x98, %rsp
movq %rdi, 0x88(%rsp)
movq %rsi, 0x80(%rsp)
movq 0x80(%rsp), %rax
cmpl $0x0, 0x40(%rax)
je 0x98df
movq 0x88(%rsp), %rdi
movq 0x80(%rsp), %rax
movq 0x38(%rax), %rax
movq (%rax), %rsi
leaq 0x10(%rsp), %rdx
callq 0xad00
cmpl $0x0, %eax
jge 0x987f
movl $0xffffffff, 0x94(%rsp) # imm = 0xFFFFFFFF
jmp 0x9970
movq 0x88(%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x3ce0
movl %eax, 0xc(%rsp)
cmpl $0x0, 0xc(%rsp)
jge 0x98dd
movq 0x6750(%rip), %rax      # 0xfff8
movq (%rax), %rax
movq %rax, (%rsp)
movl 0xc(%rsp), %edi
callq 0x2c40
movq (%rsp), %rdi
movq %rax, %rdx
leaq 0x3233(%rip), %rsi      # 0xcaf9
movb $0x0, %al
callq 0x2120
movl $0xffffffff, 0x94(%rsp) # imm = 0xFFFFFFFF
jmp 0x9970
jmp 0x98f1
movq 0x88(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x3c30
movq 0x80(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x9330
movq %rax, 0x58(%rsp)
cmpq $0x0, 0x58(%rsp)
jne 0x991c
movl $0xffffffff, 0x94(%rsp) # imm = 0xFFFFFFFF
jmp 0x9970
movq 0x58(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0xad90
cmpl $0x0, %eax
jge 0x9953
movq 0x80(%rsp), %rax
movq 0x20(%rax), %rdi
movq 0x58(%rsp), %rsi
callq 0x9500
movl $0xffffffff, 0x94(%rsp) # imm = 0xFFFFFFFF
jmp 0x9970
movq 0x80(%rsp), %rax
movq 0x20(%rax), %rdi
movq 0x58(%rsp), %rsi
callq 0x9500
movl %eax, 0x94(%rsp)
movl 0x94(%rsp), %eax
addq $0x98, %rsp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/main.c
// Function: cmd_rm
static int cmd_rm(struct ufat *uf, const struct options *opt)
{
	struct ufat_dirent ent;
	int err;

	if (!opt->argc) {
		fprintf(stderr, "You must specify a file path\n");
		return -1;
	}

	if (require_file(uf, opt->argv[0], &ent) < 0)
		return -1;

	err = ufat_dir_delete(uf, &ent);
	if (err < 0) {
		fprintf(stderr, "ufat_dir_delete: %s\n", ufat_strerror(err));
		return -1;
	}

	return 0;
}

// Assembly:
subq $0x78, %rsp
movq %rdi, 0x68(%rsp)
movq %rsi, 0x60(%rsp)
movq 0x60(%rsp), %rax
cmpl $0x0, 0x40(%rax)
jne 0xa48e
movq 0x5b88(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0x2721(%rip), %rsi      # 0xcb9b
movb $0x0, %al
callq 0x2120
movl $0xffffffff, 0x74(%rsp) # imm = 0xFFFFFFFF
jmp 0xa512
movq 0x68(%rsp), %rdi
movq 0x60(%rsp), %rax
movq 0x38(%rax), %rax
movq (%rax), %rsi
leaq 0x18(%rsp), %rdx
callq 0xad00
cmpl $0x0, %eax
jge 0xa4b8
movl $0xffffffff, 0x74(%rsp) # imm = 0xFFFFFFFF
jmp 0xa512
movq 0x68(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x40d0
movl %eax, 0x14(%rsp)
cmpl $0x0, 0x14(%rsp)
jge 0xa50a
movq 0x5b1f(%rip), %rax      # 0xfff8
movq (%rax), %rax
movq %rax, 0x8(%rsp)
movl 0x14(%rsp), %edi
callq 0x2c40
movq 0x8(%rsp), %rdi
movq %rax, %rdx
leaq 0x2893(%rip), %rsi      # 0xcd8c
movb $0x0, %al
callq 0x2120
movl $0xffffffff, 0x74(%rsp) # imm = 0xFFFFFFFF
jmp 0xa512
movl $0x0, 0x74(%rsp)
movl 0x74(%rsp), %eax
addq $0x78, %rsp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/main.c
// Function: cmd_mkdir
static int cmd_mkdir(struct ufat *uf, const struct options *opt)
{
	const char *basename;
	struct ufat_directory dir;
	struct ufat_dirent ent;
	struct tm *local;
	time_t now = time(NULL);
	int err;

	if (!opt->argc) {
		fprintf(stderr, "You must specify a file path\n");
		return -1;
	}

	err = find_path(uf, &dir, opt->argv[0], &ent, &basename);
	if (err < 0)
		return -1;

	if (!err) {
		fprintf(stderr, "Path already exists: %s\n",
			opt->argv[0]);
		return -1;
	}

	local = localtime(&now);
	ent.attributes = 0;
	ent.create_date = UFAT_DATE(local->tm_year + 1900, local->tm_mon + 1,
				    local->tm_mday);
	ent.create_time = UFAT_TIME(local->tm_hour, local->tm_min,
				    local->tm_sec);
	ent.modify_date = ent.create_date;
	ent.modify_time = ent.create_time;
	ent.access_date = ent.create_date;

	err = ufat_dir_create(&dir, &ent, basename);
	if (err < 0) {
		fprintf(stderr, "ufat_dir_create: %s\n", ufat_strerror(err));
		return -1;
	}

	return 0;
}

// Assembly:
subq $0xa8, %rsp
movq %rdi, 0x98(%rsp)
movq %rsi, 0x90(%rsp)
xorl %eax, %eax
movl %eax, %edi
callq 0x2150
movq %rax, 0x10(%rsp)
movq 0x90(%rsp), %rax
cmpl $0x0, 0x40(%rax)
jne 0xa57b
movq 0x5a9e(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0x2637(%rip), %rsi      # 0xcb9b
movb $0x0, %al
callq 0x2120
movl $0xffffffff, 0xa4(%rsp) # imm = 0xFFFFFFFF
jmp 0xa6f7
movq 0x98(%rsp), %rdi
movq 0x90(%rsp), %rax
movq 0x38(%rax), %rax
movq (%rax), %rdx
leaq 0x68(%rsp), %rsi
leaq 0x20(%rsp), %rcx
leaq 0x88(%rsp), %r8
callq 0xaf10
movl %eax, 0xc(%rsp)
cmpl $0x0, 0xc(%rsp)
jge 0xa5c4
movl $0xffffffff, 0xa4(%rsp) # imm = 0xFFFFFFFF
jmp 0xa6f7
cmpl $0x0, 0xc(%rsp)
jne 0xa602
movq 0x5a26(%rip), %rax      # 0xfff8
movq (%rax), %rdi
movq 0x90(%rsp), %rax
movq 0x38(%rax), %rax
movq (%rax), %rdx
leaq 0x27b6(%rip), %rsi      # 0xcda1
movb $0x0, %al
callq 0x2120
movl $0xffffffff, 0xa4(%rsp) # imm = 0xFFFFFFFF
jmp 0xa6f7
leaq 0x10(%rsp), %rdi
callq 0x2040
movq %rax, 0x18(%rsp)
movl $0x0, 0x4c(%rsp)
movq 0x18(%rsp), %rax
movl 0x14(%rax), %eax
addl $0x76c, %eax            # imm = 0x76C
subl $0x7bc, %eax            # imm = 0x7BC
shll $0x9, %eax
movq 0x18(%rsp), %rcx
movl 0x10(%rcx), %ecx
addl $0x1, %ecx
shll $0x5, %ecx
orl %ecx, %eax
movq 0x18(%rsp), %rcx
orl 0xc(%rcx), %eax
movw %ax, 0x50(%rsp)
movq 0x18(%rsp), %rax
movl 0x8(%rax), %eax
shll $0xb, %eax
movq 0x18(%rsp), %rcx
movl 0x4(%rcx), %ecx
shll $0x5, %ecx
orl %ecx, %eax
movq 0x18(%rsp), %rcx
movl (%rcx), %ecx
sarl %ecx
orl %ecx, %eax
movw %ax, 0x52(%rsp)
movw 0x50(%rsp), %ax
movw %ax, 0x54(%rsp)
movw 0x52(%rsp), %ax
movw %ax, 0x56(%rsp)
movw 0x50(%rsp), %ax
movw %ax, 0x58(%rsp)
movq 0x88(%rsp), %rdx
leaq 0x68(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x4310
movl %eax, 0xc(%rsp)
cmpl $0x0, 0xc(%rsp)
jge 0xa6ec
movq 0x593e(%rip), %rax      # 0xfff8
movq (%rax), %rax
movq %rax, (%rsp)
movl 0xc(%rsp), %edi
callq 0x2c40
movq (%rsp), %rdi
movq %rax, %rdx
leaq 0x26e2(%rip), %rsi      # 0xcdba
movb $0x0, %al
callq 0x2120
movl $0xffffffff, 0xa4(%rsp) # imm = 0xFFFFFFFF
jmp 0xa6f7
movl $0x0, 0xa4(%rsp)
movl 0xa4(%rsp), %eax
addq $0xa8, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/main.c
// Function: cmd_chattr
static int cmd_chattr(struct ufat *uf, const struct options *opt)
{
	struct ufat_dirent ent;
	int err;
	int i;

	if (!opt->argc) {
		fprintf(stderr, "You must specify a file path\n");
		return -1;
	}

	if (require_file(uf, opt->argv[0], &ent) < 0)
		return -1;

	for (i = 1; i < opt->argc; i++)
		if (parse_attribute(opt->argv[i], &ent) < 0)
			return -1;

	err = ufat_update_attributes(uf, &ent);
	if (err < 0) {
		fprintf(stderr, "ufat_dir_update_attributes: %s\n",
			ufat_strerror(err));
		return -1;
	}

	return 0;
}

// Assembly:
subq $0x78, %rsp
movq %rdi, 0x68(%rsp)
movq %rsi, 0x60(%rsp)
movq 0x60(%rsp), %rax
cmpl $0x0, 0x40(%rax)
jne 0xa74e
movq 0x58c8(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0x2461(%rip), %rsi      # 0xcb9b
movb $0x0, %al
callq 0x2120
movl $0xffffffff, 0x74(%rsp) # imm = 0xFFFFFFFF
jmp 0xa825
movq 0x68(%rsp), %rdi
movq 0x60(%rsp), %rax
movq 0x38(%rax), %rax
movq (%rax), %rsi
leaq 0x18(%rsp), %rdx
callq 0xad00
cmpl $0x0, %eax
jge 0xa77b
movl $0xffffffff, 0x74(%rsp) # imm = 0xFFFFFFFF
jmp 0xa825
movl $0x1, 0x10(%rsp)
movl 0x10(%rsp), %eax
movq 0x60(%rsp), %rcx
cmpl 0x40(%rcx), %eax
jge 0xa7cb
movq 0x60(%rsp), %rax
movq 0x38(%rax), %rax
movslq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x18(%rsp), %rsi
callq 0xb1c0
cmpl $0x0, %eax
jge 0xa7bc
movl $0xffffffff, 0x74(%rsp) # imm = 0xFFFFFFFF
jmp 0xa825
jmp 0xa7be
movl 0x10(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10(%rsp)
jmp 0xa783
movq 0x68(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x7b00
movl %eax, 0x14(%rsp)
cmpl $0x0, 0x14(%rsp)
jge 0xa81d
movq 0x580c(%rip), %rax      # 0xfff8
movq (%rax), %rax
movq %rax, 0x8(%rsp)
movl 0x14(%rsp), %edi
callq 0x2c40
movq 0x8(%rsp), %rdi
movq %rax, %rdx
leaq 0x25c3(%rip), %rsi      # 0xcdcf
movb $0x0, %al
callq 0x2120
movl $0xffffffff, 0x74(%rsp) # imm = 0xFFFFFFFF
jmp 0xa825
movl $0x0, 0x74(%rsp)
movl 0x74(%rsp), %eax
addq $0x78, %rsp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/main.c
// Function: cmd_rename
static int cmd_rename(struct ufat *uf, const struct options *opt)
{
	struct ufat_directory dir;
	struct ufat_dirent ent;
	int err;
	const char *src_path;
	const char *dst_name;

	if (opt->argc < 2) {
		fprintf(stderr, "You must specified a source path and "
			"a new name.\n");
		return -1;
	}

	src_path = opt->argv[0];
	dst_name = opt->argv[1];

	err = find_path(uf, &dir, src_path, &ent, NULL);
	if (err < 0)
		return -1;

	if (err) {
		fprintf(stderr, "No such file or directory: %s\n",
			ufat_strerror(err));
		return -1;
	}

	err = ufat_move(&ent, &dir, dst_name);
	if (err < 0) {
		fprintf(stderr, "ufat_move: %s\n", ufat_strerror(err));
		return -1;
	}

	return 0;
}

// Assembly:
subq $0xa8, %rsp
movq %rdi, 0x98(%rsp)
movq %rsi, 0x90(%rsp)
movq 0x90(%rsp), %rax
cmpl $0x2, 0x40(%rax)
jge 0xabdd
movq 0x543c(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0x2377(%rip), %rsi      # 0xcf3d
movb $0x0, %al
callq 0x2120
movl $0xffffffff, 0xa4(%rsp) # imm = 0xFFFFFFFF
jmp 0xace7
movq 0x90(%rsp), %rax
movq 0x38(%rax), %rax
movq (%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x90(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x98(%rsp), %rdi
movq 0x18(%rsp), %rdx
leaq 0x70(%rsp), %rsi
leaq 0x28(%rsp), %rcx
xorl %eax, %eax
movl %eax, %r8d
callq 0xaf10
movl %eax, 0x24(%rsp)
cmpl $0x0, 0x24(%rsp)
jge 0xac42
movl $0xffffffff, 0xa4(%rsp) # imm = 0xFFFFFFFF
jmp 0xace7
cmpl $0x0, 0x24(%rsp)
je 0xac84
movq 0x53a8(%rip), %rax      # 0xfff8
movq (%rax), %rax
movq %rax, 0x8(%rsp)
movl 0x24(%rsp), %edi
callq 0x2c40
movq 0x8(%rsp), %rdi
movq %rax, %rdx
leaq 0x1e9f(%rip), %rsi      # 0xcb0f
movb $0x0, %al
callq 0x2120
movl $0xffffffff, 0xa4(%rsp) # imm = 0xFFFFFFFF
jmp 0xace7
movq 0x10(%rsp), %rdx
leaq 0x28(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x4d60
movl %eax, 0x24(%rsp)
cmpl $0x0, 0x24(%rsp)
jge 0xacdc
movq 0x534e(%rip), %rax      # 0xfff8
movq (%rax), %rax
movq %rax, (%rsp)
movl 0x24(%rsp), %edi
callq 0x2c40
movq (%rsp), %rdi
movq %rax, %rdx
leaq 0x2266(%rip), %rsi      # 0xcf2e
movb $0x0, %al
callq 0x2120
movl $0xffffffff, 0xa4(%rsp) # imm = 0xFFFFFFFF
jmp 0xace7
movl $0x0, 0xa4(%rsp)
movl 0xa4(%rsp), %eax
addq $0xa8, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/main.c
// Function: require_file
static int require_file(struct ufat *uf, const char *path,
			struct ufat_dirent *ent)
{
	struct ufat_directory dir;
	int err = find_path(uf, &dir, path, ent, NULL);

	if (err < 0)
		return err;

	if (err) {
		fprintf(stderr, "No such file or directory: %s\n", path);
		return -1;
	}

	return 0;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movq %rsi, 0x30(%rsp)
movq %rdx, 0x28(%rsp)
movq 0x38(%rsp), %rdi
movq 0x30(%rsp), %rdx
movq 0x28(%rsp), %rcx
leaq 0x8(%rsp), %rsi
xorl %eax, %eax
movl %eax, %r8d
callq 0xaf10
movl %eax, 0x4(%rsp)
cmpl $0x0, 0x4(%rsp)
jge 0xad46
movl 0x4(%rsp), %eax
movl %eax, 0x44(%rsp)
jmp 0xad7c
cmpl $0x0, 0x4(%rsp)
je 0xad74
movq 0x52a4(%rip), %rax      # 0xfff8
movq (%rax), %rdi
movq 0x30(%rsp), %rdx
leaq 0x1dac(%rip), %rsi      # 0xcb0f
movb $0x0, %al
callq 0x2120
movl $0xffffffff, 0x44(%rsp) # imm = 0xFFFFFFFF
jmp 0xad7c
movl $0x0, 0x44(%rsp)
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/main.c
// Function: list_dir
static int list_dir(FILE *out, struct ufat_directory *dir)
{
	for (;;) {
		struct ufat_dirent inf;
		char lfn[UFAT_LFN_MAX_UTF8];
		int err;

		err = ufat_dir_read(dir, &inf, lfn, sizeof(lfn));
		if (err < 0) {
			fprintf(stderr, "list_dir: ufat_dir_read: %s\n",
				ufat_strerror(err));
			return err;
		}

		if (err)
			break;

		print_date(out, inf.modify_date);
		fprintf(out, " ");
		print_time(out, inf.modify_time);
		fprintf(out, " ");
		print_attributes(out, inf.attributes & ~UFAT_ATTR_DIRECTORY);
		if (inf.attributes & UFAT_ATTR_DIRECTORY)
			fprintf(out, " %9s", "<DIR>");
		else
			fprintf(out, " %9u", inf.file_size);
		fprintf(out, " %s\n", lfn);
	}

	return 0;
}

// Assembly:
subq $0x378, %rsp            # imm = 0x378
movq %rdi, 0x368(%rsp)
movq %rsi, 0x360(%rsp)
movq 0x360(%rsp), %rdi
leaq 0x10(%rsp), %rdx
leaq 0x318(%rsp), %rsi
movl $0x300, %ecx            # imm = 0x300
callq 0x3dd0
movl %eax, 0xc(%rsp)
cmpl $0x0, 0xc(%rsp)
jge 0xae0d
movq 0x5220(%rip), %rax      # 0xfff8
movq (%rax), %rax
movq %rax, (%rsp)
movl 0xc(%rsp), %edi
callq 0x2c40
movq (%rsp), %rdi
movq %rax, %rdx
leaq 0x1d50(%rip), %rsi      # 0xcb46
movb $0x0, %al
callq 0x2120
movl 0xc(%rsp), %eax
movl %eax, 0x374(%rsp)
jmp 0xaefc
cmpl $0x0, 0xc(%rsp)
je 0xae19
jmp 0xaef1
movq 0x368(%rsp), %rdi
movzwl 0x34c(%rsp), %esi
callq 0xafa0
movq 0x368(%rsp), %rdi
leaq 0x1e7b(%rip), %rsi      # 0xccb8
movb $0x0, %al
callq 0x2120
movq 0x368(%rsp), %rdi
movzwl 0x34e(%rsp), %esi
callq 0xaff0
movq 0x368(%rsp), %rdi
leaq 0x1e50(%rip), %rsi      # 0xccb8
movb $0x0, %al
callq 0x2120
movq 0x368(%rsp), %rdi
movl 0x344(%rsp), %esi
andl $-0x11, %esi
callq 0xb040
movl 0x344(%rsp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0xaeb4
movq 0x368(%rsp), %rdi
leaq 0x1cbf(%rip), %rsi      # 0xcb63
leaq 0x1cbd(%rip), %rdx      # 0xcb68
movb $0x0, %al
callq 0x2120
jmp 0xaed1
movq 0x368(%rsp), %rdi
movl 0x358(%rsp), %edx
leaq 0x1ca4(%rip), %rsi      # 0xcb6e
movb $0x0, %al
callq 0x2120
movq 0x368(%rsp), %rdi
leaq 0x10(%rsp), %rdx
leaq 0x1d02(%rip), %rsi      # 0xcbe7
movb $0x0, %al
callq 0x2120
jmp 0xada7
movl $0x0, 0x374(%rsp)
movl 0x374(%rsp), %eax
addq $0x378, %rsp            # imm = 0x378
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/main.c
// Function: find_path
static int find_path(struct ufat *uf,
		     struct ufat_directory *dir, const char *path,
		     struct ufat_dirent *inf, const char **path_out)
{
	int err;

	ufat_open_root(uf, dir);
	err = ufat_dir_find_path(dir, path, inf, path_out);

	if (err < 0)
		fprintf(stderr, "ufat_dir_find_path: %s\n",
			ufat_strerror(err));

	return err;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdx, 0x20(%rsp)
movq %rcx, 0x18(%rsp)
movq %r8, 0x10(%rsp)
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0x3c30
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x10(%rsp), %rcx
callq 0x49d0
movl %eax, 0xc(%rsp)
cmpl $0x0, 0xc(%rsp)
jge 0xaf8c
movq 0x5091(%rip), %rax      # 0xfff8
movq (%rax), %rax
movq %rax, (%rsp)
movl 0xc(%rsp), %edi
callq 0x2c40
movq (%rsp), %rdi
movq %rax, %rdx
leaq 0x1ba9(%rip), %rsi      # 0xcb2e
movb $0x0, %al
callq 0x2120
movl 0xc(%rsp), %eax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/main.c
// Function: print_attributes
static void print_attributes(FILE *out, ufat_attr_t a)
{
	fprintf(out, "%c%c%c%c%c",
		(a & UFAT_ATTR_ARCHIVE) ? 'A' : ' ',
		(a & UFAT_ATTR_SYSTEM) ? 'S' : ' ',
		(a & UFAT_ATTR_HIDDEN) ? 'H' : ' ',
		(a & UFAT_ATTR_READONLY) ? 'R' : ' ',
		(a & UFAT_ATTR_DIRECTORY) ? 'D' : ' ');
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movl %esi, 0xc(%rsp)
movq 0x10(%rsp), %rdi
movl 0xc(%rsp), %ecx
andl $0x20, %ecx
movl $0x20, %edx
movl $0x41, %eax
cmpl $0x0, %ecx
cmovnel %eax, %edx
movl 0xc(%rsp), %esi
andl $0x4, %esi
movl $0x20, %ecx
movl $0x53, %eax
cmpl $0x0, %esi
cmovnel %eax, %ecx
movl 0xc(%rsp), %esi
andl $0x2, %esi
movl $0x20, %r8d
movl $0x48, %eax
cmpl $0x0, %esi
cmovnel %eax, %r8d
movl 0xc(%rsp), %esi
andl $0x1, %esi
movl $0x20, %r9d
movl $0x52, %eax
cmpl $0x0, %esi
cmovnel %eax, %r9d
movl 0xc(%rsp), %r10d
andl $0x10, %r10d
movl $0x20, %eax
movl $0x44, %esi
cmpl $0x0, %r10d
cmovnel %esi, %eax
leaq 0x1abd(%rip), %rsi      # 0xcb90
movl %eax, (%rsp)
movb $0x0, %al
callq 0x2120
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/main.c
// Function: open_input
static FILE *open_input(const char *fname)
{
	FILE *in;

	if (!fname)
		return stdin;

	in = fopen(fname, "rb");
	if (!in) {
		fprintf(stderr, "Failed to open %s for reading: %s\n",
			fname, strerror(errno));
		return NULL;
	}

	return in;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
cmpq $0x0, 0x18(%rsp)
jne 0xb112
movq 0x4ec0(%rip), %rax      # 0xffc8
movq (%rax), %rax
movq %rax, 0x20(%rsp)
jmp 0xb183
movq 0x18(%rsp), %rdi
leaq 0x1c48(%rip), %rsi      # 0xcd66
callq 0x2180
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
jne 0xb179
movq 0x4ec1(%rip), %rax      # 0xfff8
movq (%rax), %rax
movq %rax, (%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
callq 0x2050
movl (%rax), %edi
callq 0x21d0
movq (%rsp), %rdi
movq 0x8(%rsp), %rdx
movq %rax, %rcx
leaq 0x1c02(%rip), %rsi      # 0xcd69
movb $0x0, %al
callq 0x2120
movq $0x0, 0x20(%rsp)
jmp 0xb183
movq 0x10(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
addq $0x28, %rsp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/main.c
// Function: parse_dosattr
static int parse_dosattr(const char *attr, ufat_attr_t *a)
{
	ufat_attr_t out = 0;

	while (*attr) {
		switch (*attr) {
		case 'A':
		case 'a':
			out |= UFAT_ATTR_ARCHIVE;
			break;

		case 'H':
		case 'h':
			out |= UFAT_ATTR_HIDDEN;
			break;

		case 'R':
		case 'r':
			out |= UFAT_ATTR_READONLY;
			break;

		case 'S':
		case 's':
			out |= UFAT_ATTR_SYSTEM;
			break;

		default:
			fprintf(stderr, "Unrecognized DOS attribute: %c\n",
				*attr);
			return -1;
		}

		attr++;
	}

	*a = out;
	return 0;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movl $0x0, 0xc(%rsp)
movq 0x18(%rsp), %rax
cmpb $0x0, (%rax)
je 0xb4cf
movq 0x18(%rsp), %rax
movsbl (%rax), %eax
addl $-0x41, %eax
movl %eax, %ecx
movq %rcx, (%rsp)
subl $0x32, %eax
ja 0xb492
movq (%rsp), %rax
leaq 0xde3(%rip), %rcx       # 0xc238
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0xc(%rsp), %eax
orl $0x20, %eax
movl %eax, 0xc(%rsp)
jmp 0xb4bc
movl 0xc(%rsp), %eax
orl $0x2, %eax
movl %eax, 0xc(%rsp)
jmp 0xb4bc
movl 0xc(%rsp), %eax
orl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0xb4bc
movl 0xc(%rsp), %eax
orl $0x4, %eax
movl %eax, 0xc(%rsp)
jmp 0xb4bc
movq 0x4b5f(%rip), %rax      # 0xfff8
movq (%rax), %rdi
movq 0x18(%rsp), %rax
movsbl (%rax), %edx
leaq 0x19bc(%rip), %rsi      # 0xce67
movb $0x0, %al
callq 0x2120
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
jmp 0xb4e2
movq 0x18(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x18(%rsp)
jmp 0xb426
movl 0xc(%rsp), %ecx
movq 0x10(%rsp), %rax
movl %ecx, (%rax)
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/main.c
// Function: parse_date
static int parse_date(const char *text, ufat_date_t *d)
{
	int bits[3] = {0};
	int b = 0;
	int i;

	if (!strcasecmp(text, "now")) {
		time_t now = time(NULL);
		struct tm *local = localtime(&now);

		*d = UFAT_DATE(local->tm_year + 1900,
			       local->tm_mon + 1,
			       local->tm_mday);
		return 0;
	}

	for (i = 0; text[i]; i++) {
		const int c = text[i];

		if (c == '-') {
			b++;
			if (b >= 3)
				goto bad_format;
		} else if (isdigit(c)) {
			bits[b] = bits[b] * 10 + c - '0';
		} else {
			goto bad_format;
		}
	}

	if (b < 2)
		goto bad_format;

	*d = UFAT_DATE(bits[0], bits[1], bits[2]);
	return 0;

 bad_format:
	fprintf(stderr, "Date must be of the form YYYY-MM-DD: %s\n", text);
	return -1;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movq %rsi, 0x30(%rsp)
leaq 0x24(%rsp), %rdi
xorl %esi, %esi
movl $0xc, %edx
callq 0x2100
movl $0x0, 0x20(%rsp)
movq 0x38(%rsp), %rdi
leaq 0x1964(%rip), %rsi      # 0xce87
callq 0x2030
cmpl $0x0, %eax
jne 0xb58f
xorl %eax, %eax
movl %eax, %edi
callq 0x2150
movq %rax, 0x10(%rsp)
leaq 0x10(%rsp), %rdi
callq 0x2040
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movl 0x14(%rax), %eax
addl $0x76c, %eax            # imm = 0x76C
subl $0x7bc, %eax            # imm = 0x7BC
shll $0x9, %eax
movq 0x8(%rsp), %rcx
movl 0x10(%rcx), %ecx
addl $0x1, %ecx
shll $0x5, %ecx
orl %ecx, %eax
movq 0x8(%rsp), %rcx
orl 0xc(%rcx), %eax
movw %ax, %cx
movq 0x30(%rsp), %rax
movw %cx, (%rax)
movl $0x0, 0x44(%rsp)
jmp 0xb682
movl $0x0, 0x1c(%rsp)
movq 0x38(%rsp), %rax
movslq 0x1c(%rsp), %rcx
cmpb $0x0, (%rax,%rcx)
je 0xb626
movq 0x38(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, 0x4(%rsp)
cmpl $0x2d, 0x4(%rsp)
jne 0xb5d9
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
cmpl $0x3, 0x20(%rsp)
jl 0xb5d7
jmp 0xb65d
jmp 0xb614
callq 0x21e0
movq (%rax), %rax
movslq 0x4(%rsp), %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0xb610
movslq 0x20(%rsp), %rax
imull $0xa, 0x24(%rsp,%rax,4), %ecx
addl 0x4(%rsp), %ecx
subl $0x30, %ecx
movslq 0x20(%rsp), %rax
movl %ecx, 0x24(%rsp,%rax,4)
jmp 0xb612
jmp 0xb65d
jmp 0xb614
jmp 0xb616
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0xb597
cmpl $0x2, 0x20(%rsp)
jge 0xb62f
jmp 0xb65d
movl 0x24(%rsp), %eax
subl $0x7bc, %eax            # imm = 0x7BC
shll $0x9, %eax
movl 0x28(%rsp), %ecx
shll $0x5, %ecx
orl %ecx, %eax
orl 0x2c(%rsp), %eax
movw %ax, %cx
movq 0x30(%rsp), %rax
movw %cx, (%rax)
movl $0x0, 0x44(%rsp)
jmp 0xb682
movq 0x4994(%rip), %rax      # 0xfff8
movq (%rax), %rdi
movq 0x38(%rsp), %rdx
leaq 0x1818(%rip), %rsi      # 0xce8b
movb $0x0, %al
callq 0x2120
movl $0xffffffff, 0x44(%rsp) # imm = 0xFFFFFFFF
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/main.c
// Function: parse_time
static int parse_time(const char *text, ufat_time_t *t)
{
	int bits[3] = {0};
	int b = 0;
	int i;

	if (!strcasecmp(text, "now")) {
		time_t now = time(NULL);
		struct tm *local = localtime(&now);

		*t = UFAT_TIME(local->tm_hour,
			       local->tm_min,
			       local->tm_sec);
		return 0;
	}

	for (i = 0; text[i]; i++) {
		const int c = text[i];

		if (c == ':') {
			b++;
			if (b >= 3)
				goto bad_format;
		} else if (isdigit(c)) {
			bits[b] = bits[b] * 10 + c - '0';
		} else {
			goto bad_format;
		}
	}

	if (b < 2)
		goto bad_format;

	*t = UFAT_TIME(bits[0], bits[1], bits[2]);
	return 0;

 bad_format:
	fprintf(stderr, "Time must be of the form HH:MM:SS: %s\n",
		text);
	return -1;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movq %rsi, 0x30(%rsp)
leaq 0x24(%rsp), %rdi
xorl %esi, %esi
movl $0xc, %edx
callq 0x2100
movl $0x0, 0x20(%rsp)
movq 0x38(%rsp), %rdi
leaq 0x17c4(%rip), %rsi      # 0xce87
callq 0x2030
cmpl $0x0, %eax
jne 0xb725
xorl %eax, %eax
movl %eax, %edi
callq 0x2150
movq %rax, 0x10(%rsp)
leaq 0x10(%rsp), %rdi
callq 0x2040
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movl 0x8(%rax), %eax
shll $0xb, %eax
movq 0x8(%rsp), %rcx
movl 0x4(%rcx), %ecx
shll $0x5, %ecx
orl %ecx, %eax
movq 0x8(%rsp), %rcx
movl (%rcx), %ecx
sarl %ecx
orl %ecx, %eax
movw %ax, %cx
movq 0x30(%rsp), %rax
movw %cx, (%rax)
movl $0x0, 0x44(%rsp)
jmp 0xb817
movl $0x0, 0x1c(%rsp)
movq 0x38(%rsp), %rax
movslq 0x1c(%rsp), %rcx
cmpb $0x0, (%rax,%rcx)
je 0xb7bc
movq 0x38(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, 0x4(%rsp)
cmpl $0x3a, 0x4(%rsp)
jne 0xb76f
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
cmpl $0x3, 0x20(%rsp)
jl 0xb76d
jmp 0xb7f2
jmp 0xb7aa
callq 0x21e0
movq (%rax), %rax
movslq 0x4(%rsp), %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0xb7a6
movslq 0x20(%rsp), %rax
imull $0xa, 0x24(%rsp,%rax,4), %ecx
addl 0x4(%rsp), %ecx
subl $0x30, %ecx
movslq 0x20(%rsp), %rax
movl %ecx, 0x24(%rsp,%rax,4)
jmp 0xb7a8
jmp 0xb7f2
jmp 0xb7aa
jmp 0xb7ac
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0xb72d
cmpl $0x2, 0x20(%rsp)
jge 0xb7c5
jmp 0xb7f2
movl 0x24(%rsp), %eax
shll $0xb, %eax
movl 0x28(%rsp), %ecx
shll $0x5, %ecx
orl %ecx, %eax
movl 0x2c(%rsp), %ecx
sarl %ecx
orl %ecx, %eax
movw %ax, %cx
movq 0x30(%rsp), %rax
movw %cx, (%rax)
movl $0x0, 0x44(%rsp)
jmp 0xb817
movq 0x47ff(%rip), %rax      # 0xfff8
movq (%rax), %rdi
movq 0x38(%rsp), %rdx
leaq 0x16ac(%rip), %rsi      # 0xceb4
movb $0x0, %al
callq 0x2120
movl $0xffffffff, 0x44(%rsp) # imm = 0xFFFFFFFF
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/main.c
// Function: file_device_read
static int file_device_read(const struct ufat_device *dev, ufat_block_t start,
			    ufat_block_t count, void *buffer)
{
	struct file_device *f = (struct file_device *)dev;

	if (fseek(f->f, start << f->base.log2_block_size, SEEK_SET) < 0) {
		perror("file_device_read: fseek");
		return -1;
	}

	if (fread(buffer, 1 << f->base.log2_block_size,
		  count, f->f) != count) {
		if (feof(f->f)) {
			memset(buffer, 0xcc,
			       (1 << f->base.log2_block_size) * count);
		} else {
			perror("file_device_read: fread");
			return -1;
		}
	}

	return 0;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x20(%rsp), %rsi
movq 0x8(%rsp), %rax
movl (%rax), %eax
movl %eax, %ecx
shlq %cl, %rsi
xorl %edx, %edx
callq 0x2170
cmpl $0x0, %eax
jge 0xb881
leaq 0x170d(%rip), %rdi      # 0xcf7c
callq 0x2190
movl $0xffffffff, 0x34(%rsp) # imm = 0xFFFFFFFF
jmp 0xb90c
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rax
movl (%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movslq %eax, %rsi
movq 0x18(%rsp), %rdx
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rcx
callq 0x20a0
cmpq 0x18(%rsp), %rax
je 0xb904
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x2130
cmpl $0x0, %eax
je 0xb8ec
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rax
movl (%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movslq %eax, %rdx
imulq 0x18(%rsp), %rdx
movl $0xcc, %esi
callq 0x2100
jmp 0xb902
leaq 0x16a1(%rip), %rdi      # 0xcf94
callq 0x2190
movl $0xffffffff, 0x34(%rsp) # imm = 0xFFFFFFFF
jmp 0xb90c
jmp 0xb904
movl $0x0, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/main.c
// Function: file_device_write
static int file_device_write(const struct ufat_device *dev, ufat_block_t start,
			     ufat_block_t count, const void *buffer)
{
	struct file_device *f = (struct file_device *)dev;

	if (f->is_read_only) {
		fprintf(stderr, "file_device_write: read-only device\n");
		return -1;
	}

	if (fseek(f->f, start << f->base.log2_block_size, SEEK_SET) < 0) {
		perror("file_device_write: fseek");
		return -1;
	}

	if (fwrite(buffer, 1 << f->base.log2_block_size,
		   count, f->f) != count) {
		perror("file_device_write: fwrite");
		return -1;
	}

	return 0;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
cmpl $0x0, 0x20(%rax)
je 0xb972
movq 0x46a4(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0x164e(%rip), %rsi      # 0xcfac
movb $0x0, %al
callq 0x2120
movl $0xffffffff, 0x34(%rsp) # imm = 0xFFFFFFFF
jmp 0xb9fc
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x20(%rsp), %rsi
movq 0x8(%rsp), %rax
movl (%rax), %eax
movl %eax, %ecx
shlq %cl, %rsi
xorl %edx, %edx
callq 0x2170
cmpl $0x0, %eax
jge 0xb9ae
leaq 0x1632(%rip), %rdi      # 0xcfd1
callq 0x2190
movl $0xffffffff, 0x34(%rsp) # imm = 0xFFFFFFFF
jmp 0xb9fc
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rax
movl (%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movslq %eax, %rsi
movq 0x18(%rsp), %rdx
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rcx
callq 0x21c0
cmpq 0x18(%rsp), %rax
je 0xb9f4
leaq 0x1605(%rip), %rdi      # 0xcfea
callq 0x2190
movl $0xffffffff, 0x34(%rsp) # imm = 0xFFFFFFFF
jmp 0xb9fc
movl $0x0, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
// File: /workspace/github_c_makefile_star2_O0/accre[P]Cprogramming/file_IO.c
// Function: main
int main()
{
   
   // first example is reading from a file
   FILE *fp_in;
   fp_in = fopen("input_file.txt","r");
   // it's good practice to check whether the file
   // was actually opened successfully. fopen() will
   // fail if the file does not exist, for instance.
   if ( fp_in == NULL ) {
      printf("input_file.txt not opened, exiting...\n");
      exit(0);
   }
   int x,y,z;
   int i;
   for (i=0; i<3; i++) {
      fscanf(fp_in,"%d %d %d",&x,&y,&z);
      printf("x: %d y: %d z: %d\n",x,y,z);
   }
   fclose(fp_in);

   // now an example of writing to a file
   FILE *fp_out;
   fp_out = fopen("output_file.txt","w");
   if ( fp_out == NULL ) {
      printf("output_file.txt not opened, exiting...\n");
      exit(0);
   }
   for ( i=0 ; i < 50 ; i++ ) {
      fprintf(fp_out,"%d %d\n",i,i*10);
   } 
   fclose(fp_out);

   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl $0x0, -0x4(%rbp)
leaq 0xe5e(%rip), %rdi       # 0x2004
leaq 0xe66(%rip), %rsi       # 0x2013
callq 0x1070
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x11d2
leaq 0xe51(%rip), %rdi       # 0x2015
movb $0x0, %al
callq 0x1050
xorl %edi, %edi
callq 0x1080
movl $0x0, -0x20(%rbp)
cmpl $0x3, -0x20(%rbp)
jge 0x121f
movq -0x10(%rbp), %rdi
leaq 0xe52(%rip), %rsi       # 0x203c
leaq -0x14(%rbp), %rdx
leaq -0x18(%rbp), %rcx
leaq -0x1c(%rbp), %r8
movb $0x0, %al
callq 0x1030
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
movl -0x1c(%rbp), %ecx
leaq 0xe38(%rip), %rdi       # 0x2045
movb $0x0, %al
callq 0x1050
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x11d9
movq -0x10(%rbp), %rdi
callq 0x1040
leaq 0xe29(%rip), %rdi       # 0x2058
leaq 0xe32(%rip), %rsi       # 0x2068
callq 0x1070
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x125b
leaq 0xe1d(%rip), %rdi       # 0x206a
movb $0x0, %al
callq 0x1050
xorl %edi, %edi
callq 0x1080
movl $0x0, -0x20(%rbp)
cmpl $0x32, -0x20(%rbp)
jge 0x128c
movq -0x28(%rbp), %rdi
movl -0x20(%rbp), %edx
imull $0xa, -0x20(%rbp), %ecx
leaq 0xe18(%rip), %rsi       # 0x2092
movb $0x0, %al
callq 0x1060
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x1262
movq -0x28(%rbp), %rdi
callq 0x1040
xorl %eax, %eax
addq $0x30, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/arq5x[P]grabix/grabix.cpp
// Function: bgzf_getline_counting(BGZF*)
bool bgzf_getline_counting(BGZF * stream)
{
    int c = -1;
    while (true)
    {
        c = bgzf_getc (stream);
        if (c == -1)
            return true;
        else if (c == 10) // \n
            return false;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
movq -0x10(%rbp), %rdi
callq 0x7e80
movl %eax, -0x14(%rbp)
cmpl $-0x1, -0x14(%rbp)
jne 0x421b
movb $0x1, -0x1(%rbp)
jmp 0x422b
cmpl $0xa, -0x14(%rbp)
jne 0x4227
movb $0x0, -0x1(%rbp)
jmp 0x422b
jmp 0x4229
jmp 0x4203
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/arq5x[P]grabix/bgzf.c
// Function: bgzf_write
ssize_t bgzf_write(BGZF *fp, const void *data, size_t length)
{
	const uint8_t *input = (const uint8_t*)data;
	int block_length = BGZF_BLOCK_SIZE, bytes_written = 0;
	assert(fp->is_write);
#ifdef BGZF_MT
	if (fp->mt) return mt_write(fp, data, length);
#endif
	while (bytes_written < length) {
		uint8_t* buffer = (uint8_t*)fp->uncompressed_block;
		int copy_length = block_length - fp->block_offset < length - bytes_written? block_length - fp->block_offset : length - bytes_written;
		memcpy(buffer + fp->block_offset, input, copy_length);
		fp->block_offset += copy_length;
		input += copy_length;
		bytes_written += copy_length;
		if (fp->block_offset == block_length && bgzf_flush(fp)) break;
	}
	return bytes_written;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movl $0xff00, -0x24(%rbp)    # imm = 0xFF00
movl $0x0, -0x28(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
shll $0xe, %eax
sarl $0x1e, %eax
cmpl $0x0, %eax
je 0x79cd
jmp 0x79ec
leaq 0x1bc6(%rip), %rdi      # 0x959a
leaq 0x1b2a(%rip), %rsi      # 0x9505
movl $0x239, %edx            # imm = 0x239
leaq 0x1bc0(%rip), %rcx      # 0x95a7
callq 0x31c0
jmp 0x79ee
movslq -0x28(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x7ab0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x30(%rbp)
movl -0x24(%rbp), %eax
movq -0x8(%rbp), %rcx
subl 0xc(%rcx), %eax
cltq
movq -0x18(%rbp), %rcx
movslq -0x28(%rbp), %rdx
subq %rdx, %rcx
cmpq %rcx, %rax
jae 0x7a36
movl -0x24(%rbp), %eax
movq -0x8(%rbp), %rcx
subl 0xc(%rcx), %eax
cltq
movq %rax, -0x40(%rbp)
jmp 0x7a45
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
subq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movl %eax, -0x34(%rbp)
movq -0x30(%rbp), %rdi
movq -0x8(%rbp), %rax
movslq 0xc(%rax), %rax
addq %rax, %rdi
movq -0x20(%rbp), %rsi
movslq -0x34(%rbp), %rdx
callq 0x3240
movl -0x34(%rbp), %ecx
movq -0x8(%rbp), %rax
addl 0xc(%rax), %ecx
movl %ecx, 0xc(%rax)
movl -0x34(%rbp), %ecx
movq -0x20(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movl -0x34(%rbp), %eax
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movl 0xc(%rax), %eax
cmpl -0x24(%rbp), %eax
jne 0x7aab
movq -0x8(%rbp), %rdi
callq 0x77d0
cmpl $0x0, %eax
je 0x7aab
jmp 0x7ab0
jmp 0x79ee
movslq -0x28(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)