// File: /workspace/github_c_makefile_star2_O1/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 $0x2208, %rsp           # imm = 0x2208
movq %rsi, %r14
movl %edi, %ebx
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x40(%rsp)
movl $0x9, 0x4(%rsp)
leaq 0x229c(%rip), %rdx      # 0x720c
leaq 0x5d49(%rip), %rcx      # 0xacc0
xorl %r8d, %r8d
callq 0x10e0
testl %eax, %eax
js 0x5075
leaq 0x2226(%rip), %r13      # 0x71b4
movq 0x6043(%rip), %rbp      # 0xafd8
leaq 0x2270(%rip), %r15      # 0x720c
leaq 0x5d1d(%rip), %r12      # 0xacc0
cmpl $0x61, %eax
jg 0x4fd5
leal -0x4d(%rax), %ecx
cmpl $0x9, %ecx
ja 0x5048
movslq (%r13,%rcx,4), %rax
addq %r13, %rax
jmpq *%rax
orb $0x4, (%rsp)
movq (%rbp), %rdi
callq 0x1130
movq %rax, 0x10(%rsp)
jmp 0x505a
cmpl $0x62, %eax
je 0x5008
cmpl $0x6f, %eax
je 0x503d
cmpl $0x69, %eax
jne 0x505a
movq (%rbp), %rax
movq %rax, 0x18(%rsp)
jmp 0x505a
orb $0x2, (%rsp)
movq (%rbp), %rdi
callq 0x11c0
movl %eax, 0x8(%rsp)
jmp 0x505a
orb $0x1, (%rsp)
jmp 0x505a
movq (%rbp), %rdi
callq 0x11c0
xorl %ecx, %ecx
cmpl $0x1, %eax
je 0x5037
testl %eax, %eax
je 0x53c9
xorl %ecx, %ecx
testb $0x1, %al
jne 0x535a
movl %eax, %edx
shrl %edx
incl %ecx
cmpl $0x2, %eax
movl %edx, %eax
ja 0x5022
movl %ecx, 0x4(%rsp)
jmp 0x505a
movq (%rbp), %rax
movq %rax, 0x20(%rsp)
jmp 0x505a
cmpl $0x3f, %eax
je 0x53c2
cmpl $0x48, %eax
je 0x53d7
movl %ebx, %edi
movq %r14, %rsi
movq %r15, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
callq 0x10e0
testl %eax, %eax
jns 0x4fa3
movq 0x5f54(%rip), %rax      # 0xafd0
movslq (%rax), %rax
subl %eax, %ebx
jle 0x5361
leaq (%r14,%rax,8), %rcx
movq (%rcx), %rax
movq %rax, 0x28(%rsp)
cmpl $0x1, %ebx
jne 0x50aa
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movl $0x0, 0x40(%rsp)
jmp 0x510d
movq %rcx, 0x50(%rsp)
movq 0x8(%rcx), %r14
leaq 0x5c86(%rip), %r13      # 0xad40
xorl %ebp, %ebp
movq %r12, %r15
movq %r13, %r12
addq %rbp, %r12
movq (%rbp,%r13), %rdi
movq %r14, %rsi
callq 0x1040
testl %eax, %eax
cmovneq %r15, %r12
je 0x50ea
addq $0x10, %rbp
cmpq $0x90, %rbp
jne 0x50bc
xorl %r12d, %r12d
movq 0x50(%rsp), %rax
movq %r12, 0x30(%rsp)
addq $0x10, %rax
movq %rax, 0x38(%rsp)
addl $-0x2, %ebx
movl %ebx, 0x40(%rsp)
testq %r12, %r12
je 0x5382
movl 0x8(%rsp), %edi
callq 0x1070
movq 0x28(%rsp), %rbx
movl 0x4(%rsp), %eax
movl %eax, 0x58(%rsp)
leaq 0x1503(%rip), %rax      # 0x662d
movq %rax, 0x60(%rsp)
leaq 0x159a(%rip), %rax      # 0x66d0
movq %rax, 0x68(%rsp)
movl $0x0, 0x78(%rsp)
testb $0x4, (%rsp)
jne 0x517d
leaq 0x2c26(%rip), %rsi      # 0x7d76
movq %rbx, %rdi
callq 0x11a0
movq %rax, 0x70(%rsp)
testq %rax, %rax
jne 0x5191
callq 0x1060
cmpl $0xd, (%rax)
jne 0x5191
movl $0x1, 0x78(%rsp)
leaq 0x29ee(%rip), %rsi      # 0x7b69
jmp 0x5184
leaq 0x2bee(%rip), %rsi      # 0x7d72
movq %rbx, %rdi
callq 0x11a0
movq %rax, 0x70(%rsp)
cmpq $0x0, 0x70(%rsp)
je 0x5368
leaq 0x70(%rsp), %rbx
testb $0x4, (%rsp)
je 0x51bf
movq 0x10(%rsp), %rsi
leaq 0x58(%rsp), %rdi
callq 0x4548
testl %eax, %eax
js 0x539f
leaq 0x88(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x1c38
testl %eax, %eax
jne 0x5376
movq 0x30(%rsp), %rax
testq %rax, %rax
je 0x51f6
leaq 0x88(%rsp), %rdi
movq %rsp, %rsi
callq *0x8(%rax)
jmp 0x5315
movq 0x20(%rsp), %rdi
callq 0x53e6
testq %rax, %rax
je 0x5353
movq %rax, %rbx
movl 0xb0(%rsp), %edx
leaq 0x2c13(%rip), %rsi      # 0x7e2d
movq %rax, %rdi
xorl %eax, %eax
callq 0x1140
movb 0xb4(%rsp), %cl
movl $0x1, %edx
shll %cl, %edx
leaq 0x2c17(%rip), %rsi      # 0x7e50
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movq 0xc0(%rsp), %rdx
leaq 0x2c1e(%rip), %rsi      # 0x7e70
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movq 0xb8(%rsp), %rdx
leaq 0x2c27(%rip), %rsi      # 0x7e92
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movl 0xc8(%rsp), %edx
leaq 0x2c31(%rip), %rsi      # 0x7eb4
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movq 0xd0(%rsp), %rdx
leaq 0x2c38(%rip), %rsi      # 0x7ed4
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movl 0xd8(%rsp), %edx
leaq 0x2c42(%rip), %rsi      # 0x7ef6
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movq 0xe0(%rsp), %rdx
leaq 0x2c49(%rip), %rsi      # 0x7f16
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movq 0xe8(%rsp), %rdx
leaq 0x2c52(%rip), %rsi      # 0x7f38
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movl 0xf0(%rsp), %edx
leaq 0x2c5c(%rip), %rsi      # 0x7f5a
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1140
movq 0x20(%rsp), %rdi
movq %rbx, %rsi
callq 0x5418
movl %eax, %ebx
leaq 0x88(%rsp), %rdi
callq 0x2183
movq 0x70(%rsp), %rdi
callq 0x10c0
testb $0x1, (%rsp)
je 0x53ae
leaq 0x88(%rsp), %rdi
leaq 0x84(%rsp), %r14
movl %ebx, %esi
movq %r14, %rdx
callq 0x12e8
movl (%r14), %ebx
jmp 0x53ae
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x5317
callq 0x1258
jmp 0x53a9
callq 0x13b0
jmp 0x53a9
leaq 0x2a0b(%rip), %rdi      # 0x7d7a
callq 0x11b0
jmp 0x53a9
movl %eax, %edi
movq %rbx, %rsi
callq 0x12ae
jmp 0x53a9
movq 0x5c6f(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x1eb2(%rip), %rsi      # 0x7245
movq %r14, %rdx
xorl %eax, %eax
callq 0x1140
jmp 0x53a9
movl %eax, %edi
movq %rbx, %rsi
callq 0x1274
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x2208, %rsp           # imm = 0x2208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1220
jmp 0x53a9
callq 0x123c
jmp 0x53a9
callq 0x545c
jmp 0x53df
movq (%r14), %rdi
callq 0x544b
xorl %edi, %edi
callq 0x11d0