// File: /workspace/github_c_makefile_star2_O0/dlbeer[P]ufat/main.c
// Function: main
int main(int argc, char **argv)
{
	struct file_device dev;
	struct ufat uf;
	struct options opt;
	int err;

	if (parse_options(argc, argv, &opt) < 0)
		return -1;

	srandom(opt.seed);

	if (file_device_open(&dev, opt.filename, opt.log2_bs,
			     opt.flags & OPTION_MKFS) < 0)
		return -1;

	if (opt.flags & OPTION_MKFS) {
		err = ufat_mkfs(&dev.base, opt.num_blocks);
		if (err < 0) {
			fprintf(stderr, "ufat_mkfs: %s\n", ufat_strerror(err));
			file_device_close(&dev);
			return -1;
		}
	}

	err = ufat_open(&uf, &dev.base);
	if (err) {
		fprintf(stderr, "ufat_open: %s\n", ufat_strerror(err));
		file_device_close(&dev);
		return -1;
	}

	if (!opt.command) {
		FILE *out = open_output(opt.out_file);

		if (!out) {
			err = -1;
		} else {
			show_info(out, &uf.bpb);
			err = close_output(opt.out_file, out);
		}
	} else {
		err = opt.command->func(&uf, &opt);
	}

	ufat_close(&uf);
	file_device_close(&dev);

	if (opt.flags & OPTION_STATISTICS)
		dump_stats(&uf.stat);

	return err;
}

// Assembly:
subq $0x2228, %rsp           # imm = 0x2228
movl $0x0, 0x2224(%rsp)
movl %edi, 0x2220(%rsp)
movq %rsi, 0x2218(%rsp)
movl 0x2220(%rsp), %edi
movq 0x2218(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0x8f50
cmpl $0x0, %eax
jge 0x8d7f
movl $0xffffffff, 0x2224(%rsp) # imm = 0xFFFFFFFF
jmp 0x8f3b
movl 0x30(%rsp), %edi
callq 0x2060
movq 0x50(%rsp), %rsi
movl 0x2c(%rsp), %edx
movl 0x28(%rsp), %ecx
andl $0x4, %ecx
leaq 0x21f0(%rsp), %rdi
callq 0x9200
cmpl $0x0, %eax
jge 0x8dba
movl $0xffffffff, 0x2224(%rsp) # imm = 0xFFFFFFFF
jmp 0x8f3b
movl 0x28(%rsp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x8e30
leaq 0x21f0(%rsp), %rdi
movq 0x38(%rsp), %rsi
callq 0x7c40
movl %eax, 0x24(%rsp)
cmpl $0x0, 0x24(%rsp)
jge 0x8e2e
movq 0x720e(%rip), %rax      # 0xfff8
movq (%rax), %rax
movq %rax, 0x10(%rsp)
movl 0x24(%rsp), %edi
callq 0x2c40
movq 0x10(%rsp), %rdi
movq %rax, %rdx
leaq 0x34fa(%rip), %rsi      # 0xc304
movb $0x0, %al
callq 0x2120
leaq 0x21f0(%rsp), %rdi
callq 0x9310
movl $0xffffffff, 0x2224(%rsp) # imm = 0xFFFFFFFF
jmp 0x8f3b
jmp 0x8e30
leaq 0x21f0(%rsp), %rsi
leaq 0x70(%rsp), %rdi
callq 0x2930
movl %eax, 0x24(%rsp)
cmpl $0x0, 0x24(%rsp)
je 0x8e98
movq 0x71a4(%rip), %rax      # 0xfff8
movq (%rax), %rax
movq %rax, 0x8(%rsp)
movl 0x24(%rsp), %edi
callq 0x2c40
movq 0x8(%rsp), %rdi
movq %rax, %rdx
leaq 0x349f(%rip), %rsi      # 0xc313
movb $0x0, %al
callq 0x2120
leaq 0x21f0(%rsp), %rdi
callq 0x9310
movl $0xffffffff, 0x2224(%rsp) # imm = 0xFFFFFFFF
jmp 0x8f3b
cmpq $0x0, 0x58(%rsp)
jne 0x8ee9
movq 0x48(%rsp), %rdi
callq 0x9330
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x18(%rsp)
jne 0x8ec1
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
jmp 0x8ee7
movq 0x18(%rsp), %rdi
leaq 0x70(%rsp), %rsi
addq $0x28, %rsi
callq 0x93d0
movq 0x48(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x9500
movl %eax, 0x24(%rsp)
jmp 0x8eff
movq 0x58(%rsp), %rax
leaq 0x70(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq *0x8(%rax)
movl %eax, 0x24(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x2c30
leaq 0x21f0(%rsp), %rdi
callq 0x9310
movl 0x28(%rsp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x8f30
leaq 0x70(%rsp), %rdi
addq $0x8, %rdi
callq 0x9580
movl 0x24(%rsp), %eax
movl %eax, 0x2224(%rsp)
movl 0x2224(%rsp), %eax
addq $0x2228, %rsp           # imm = 0x2228
retq
nopw (%rax,%rax)