// File: /workspace/github_c_makefile_star2_O3/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2218, %rsp           # imm = 0x2218
movq %rsi, %r15
movl %edi, %ebp
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x60(%rsp)
movl $0x9, 0x24(%rsp)
leaq 0x2433(%rip), %rdx      # 0x720c
leaq 0x5ee0(%rip), %rcx      # 0xacc0
xorl %ebx, %ebx
xorl %r8d, %r8d
callq 0x10e0
movl $0x9, %r14d
testl %eax, %eax
js 0x4f5e
movq $0x0, 0x8(%rsp)
leaq 0x2404(%rip), %r13      # 0x720c
leaq 0x5eb1(%rip), %rbx      # 0xacc0
movq $0x0, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movl $0x0, 0x4(%rsp)
xorl %r12d, %r12d
cmpl $0x61, %eax
jg 0x4e6a
leal -0x4d(%rax), %ecx
cmpl $0x9, %ecx
ja 0x4ef8
leaq 0x2370(%rip), %rdx      # 0x71b4
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
orl $0x4, %r12d
movq 0x6180(%rip), %rax      # 0xafd8
movq (%rax), %rdi
callq 0x1130
movq %rax, 0x18(%rsp)
jmp 0x4f0a
cmpl $0x62, %eax
je 0x4ead
cmpl $0x6f, %eax
je 0x4ee7
cmpl $0x69, %eax
jne 0x4f0a
movq 0x6154(%rip), %rax      # 0xafd8
movq (%rax), %rax
movq %rax, 0x8(%rsp)
jmp 0x4f0a
orl $0x2, %r12d
movq 0x613f(%rip), %rax      # 0xafd8
movq (%rax), %rdi
callq 0x11c0
movl %eax, 0x4(%rsp)
jmp 0x4f0a
orl $0x1, %r12d
jmp 0x4f0a
movq 0x6124(%rip), %rax      # 0xafd8
movq (%rax), %rdi
callq 0x11c0
xorl %r14d, %r14d
cmpl $0x1, %eax
je 0x4f0a
testl %eax, %eax
je 0x52d8
xorl %r14d, %r14d
testb $0x1, %al
jne 0x5286
movl %eax, %ecx
shrl %ecx
incl %r14d
cmpl $0x2, %eax
movl %ecx, %eax
ja 0x4ecf
jmp 0x4f0a
movq 0x60ea(%rip), %rax      # 0xafd8
movq (%rax), %rax
movq %rax, 0x10(%rsp)
jmp 0x4f0a
cmpl $0x3f, %eax
je 0x52d1
cmpl $0x48, %eax
je 0x52e6
movl %ebp, %edi
movq %r15, %rsi
movq %r13, %rdx
movq %rbx, %rcx
xorl %r8d, %r8d
callq 0x10e0
testl %eax, %eax
jns 0x4e2c
movl %r14d, 0x24(%rsp)
movl %r12d, 0x20(%rsp)
movl 0x4(%rsp), %eax
movl %eax, 0x28(%rsp)
movq 0x18(%rsp), %rbx
movq %rbx, 0x30(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x38(%rsp)
testb $0x4, %r12b
sete %cl
jmp 0x4f71
movb $0x1, %cl
movq $0x0, 0x10(%rsp)
movl $0x0, 0x4(%rsp)
movq 0x6058(%rip), %rax      # 0xafd0
movslq (%rax), %rax
subl %eax, %ebp
jle 0x528d
movb %cl, 0x3(%rsp)
leaq (%r15,%rax,8), %r13
movq (%r13), %rax
movq %rax, 0x8(%rsp)
movq %rax, 0x48(%rsp)
cmpl $0x1, %ebp
jne 0x4fb3
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movl $0x0, 0x60(%rsp)
xorl %r12d, %r12d
jmp 0x501f
movq %rbx, 0x18(%rsp)
movq 0x8(%r13), %r15
xorl %ebx, %ebx
leaq 0x5d7b(%rip), %r12      # 0xad40
movq (%rbx,%r12), %rdi
movq %r15, %rsi
callq 0x1040
testl %eax, %eax
je 0x5002
addq $0x10, %rbx
cmpq $0x90, %rbx
jne 0x4fc5
movq 0x600f(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x2252(%rip), %rsi      # 0x7245
movq %r15, %rdx
xorl %eax, %eax
callq 0x1140
jmp 0x52b8
addq %rbx, %r12
movq %r12, 0x50(%rsp)
addq $0x10, %r13
movq %r13, 0x58(%rsp)
addl $-0x2, %ebp
movl %ebp, 0x60(%rsp)
movq 0x18(%rsp), %rbx
movl 0x4(%rsp), %edi
callq 0x1070
leaq 0x88(%rsp), %r15
movl %r14d, -0x18(%r15)
leaq 0x14ae(%rip), %rax      # 0x64e9
movq %rax, -0x10(%r15)
leaq 0x1546(%rip), %rax      # 0x658c
movq %rax, -0x8(%r15)
movl $0x0, 0x8(%r15)
cmpb $0x0, 0x3(%rsp)
je 0x50b4
leaq 0x2d16(%rip), %rsi      # 0x7d76
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x11a0
movq %rax, 0x88(%rsp)
testq %rax, %rax
jne 0x50eb
callq 0x1060
cmpl $0xd, (%rax)
jne 0x52a0
movl $0x1, 0x90(%rsp)
leaq 0x2acf(%rip), %rsi      # 0x7b69
movq %rbx, %rdi
callq 0x11a0
movq %rax, 0x88(%rsp)
testq %rax, %rax
jne 0x50eb
jmp 0x52a0
leaq 0x2cb7(%rip), %rsi      # 0x7d72
movq 0x8(%rsp), %rdi
callq 0x11a0
movq %rax, 0x88(%rsp)
testq %rax, %rax
je 0x52a0
leaq 0x70(%rsp), %rdi
movq %rbx, %rsi
callq 0x430c
testl %eax, %eax
js 0x52ae
leaq 0x98(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x1c0c
testl %eax, %eax
jne 0x5294
testq %r12, %r12
je 0x5121
leaq 0x98(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq *0x8(%r12)
jmp 0x5240
movq 0x10(%rsp), %rdi
callq 0x52f5
testq %rax, %rax
je 0x527f
movq %rax, %rbx
movl 0xc0(%rsp), %edx
leaq 0x2ce8(%rip), %rsi      # 0x7e2d
movq %rax, %rdi
xorl %eax, %eax
callq 0x1140
movb 0xc4(%rsp), %cl
movl $0x1, %edx
shll %cl, %edx
leaq 0x2cec(%rip), %rsi      # 0x7e50
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movq 0xd0(%rsp), %rdx
leaq 0x2cf3(%rip), %rsi      # 0x7e70
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movq 0xc8(%rsp), %rdx
leaq 0x2cfc(%rip), %rsi      # 0x7e92
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movl 0xd8(%rsp), %edx
leaq 0x2d06(%rip), %rsi      # 0x7eb4
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movq 0xe0(%rsp), %rdx
leaq 0x2d0d(%rip), %rsi      # 0x7ed4
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movl 0xe8(%rsp), %edx
leaq 0x2d17(%rip), %rsi      # 0x7ef6
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movq 0xf0(%rsp), %rdx
leaq 0x2d1e(%rip), %rsi      # 0x7f16
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movq 0xf8(%rsp), %rdx
leaq 0x2d27(%rip), %rsi      # 0x7f38
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movl 0x100(%rsp), %edx
leaq 0x2d31(%rip), %rsi      # 0x7f5a
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movq 0x40(%rsp), %rdi
movq %rbx, %rsi
callq 0x5327
movl %eax, %ebx
leaq 0x98(%rsp), %rdi
callq 0x20fd
movq 0x88(%rsp), %rdi
callq 0x10c0
testb $0x1, 0x20(%rsp)
je 0x52bd
leaq 0x98(%rsp), %rdi
leaq 0x6c(%rsp), %r14
movl %ebx, %esi
movq %r14, %rdx
callq 0x12e8
movl (%r14), %ebx
jmp 0x52bd
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x5242
callq 0x1258
jmp 0x52b8
callq 0x13b0
jmp 0x52b8
movl %eax, %edi
movq %r15, %rsi
callq 0x12ae
jmp 0x52b8
leaq 0x2ad3(%rip), %rdi      # 0x7d7a
callq 0x11b0
jmp 0x52b8
movl %eax, %edi
movq %r15, %rsi
callq 0x1274
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x2218, %rsp           # imm = 0x2218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1220
jmp 0x52b8
callq 0x123c
jmp 0x52b8
callq 0x536b
jmp 0x52ee
movq (%r15), %rdi
callq 0x535a
xorl %edi, %edi
callq 0x11d0