// File: /workspace/github_c_makefile_star2_O1/dlbeer[P]ufat/main.c
// Function: cmd_fstat
static int cmd_fstat(struct ufat *uf, const struct options *opt)
{
	FILE *out;
	struct ufat_dirent ent;
	char can_name[UFAT_LFN_MAX_UTF8];
	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;

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

	err = ufat_get_filename(uf, &ent, can_name, sizeof(can_name));
	if (err < 0)
		fprintf(stderr, "ufat_get_filename: %s\n",
			ufat_strerror(err));
	else
		fprintf(out, "Filename:               %s\n", can_name);

	fprintf(out, "Entry block/offset:     %llu/%d\n",
		ent.dirent_block, ent.dirent_pos);

	if (ent.lfn_block != UFAT_BLOCK_NONE)
		fprintf(out, "LFN start block/offset: %llu/%d\n",
			ent.lfn_block, ent.lfn_pos);

	fprintf(out, "Short name:             %s", ent.short_name);
	if (ent.short_ext[0])
		fprintf(out, ".%s\n", ent.short_ext);
	else
		fprintf(out, "\n");
	fprintf(out, "Attributes:             0x%02x (", ent.attributes);
	print_attributes(out, ent.attributes);
	fprintf(out, ")\n");
	fprintf(out, "Creation date/time:     ");
	print_date(out, ent.create_date);
	fprintf(out, " ");
	print_time(out, ent.create_time);
	fprintf(out, "\n");
	fprintf(out, "Modification date/time: ");
	print_date(out, ent.modify_date);
	fprintf(out, " ");
	print_time(out, ent.modify_time);
	fprintf(out, "\n");
	fprintf(out, "Last access date:       ");
	print_date(out, ent.access_date);
	fprintf(out, "\n");
	fprintf(out, "First cluster:          %u\n", ent.first_cluster);
	fprintf(out, "Size:                   %u\n", ent.file_size);

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x350, %rsp            # imm = 0x350
cmpl $0x0, 0x40(%rsi)
je 0x5957
movq %rsi, %rbx
movq %rdi, %r15
movq 0x38(%rsi), %rax
movq (%rax), %rsi
leaq 0x8(%rsp), %rdx
callq 0x62cd
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x5945
movq 0x20(%rbx), %rdi
callq 0x53e6
testq %rax, %rax
je 0x5945
movq %rax, %r14
leaq 0x8(%rsp), %rsi
leaq 0x50(%rsp), %rdx
movq %r15, %rdi
movl $0x300, %ecx            # imm = 0x300
callq 0x2ee5
testl %eax, %eax
js 0x5963
leaq 0x22f7(%rip), %rsi      # 0x79d3
leaq 0x50(%rsp), %rdx
movq %r14, %rdi
xorl %eax, %eax
callq 0x1140
movq 0x8(%rsp), %rdx
movl 0x10(%rsp), %ecx
leaq 0x22f4(%rip), %rsi      # 0x79ef
movq %r14, %rdi
xorl %eax, %eax
callq 0x1140
movq 0x18(%rsp), %rdx
cmpq $-0x1, %rdx
je 0x5725
movl 0x20(%rsp), %ecx
leaq 0x22f5(%rip), %rsi      # 0x7a10
movq %r14, %rdi
xorl %eax, %eax
callq 0x1140
leaq 0x24(%rsp), %r15
leaq 0x2300(%rip), %rsi      # 0x7a31
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x1140
cmpb $0x0, 0x9(%r15)
je 0x575d
leaq 0x2d(%rsp), %rdx
leaq 0x22fb(%rip), %rsi      # 0x7a4c
movq %r14, %rdi
xorl %eax, %eax
callq 0x1140
jmp 0x576a
movl $0xa, %edi
movq %r14, %rsi
callq 0x1120
movl 0x34(%rsp), %edx
leaq 0x22dc(%rip), %rsi      # 0x7a51
movq %r14, %rdi
xorl %eax, %eax
callq 0x1140
movl 0x34(%rsp), %esi
movq %r14, %rdi
callq 0x636b
leaq 0x28a5(%rip), %rdi      # 0x8037
movl $0x2, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x11e0
leaq 0x22c7(%rip), %rdi      # 0x7a72
movl $0x18, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x11e0
movzwl 0x38(%rsp), %r8d
movl %r8d, %edx
shrl $0x9, %edx
movl $0x7bc, %ebp            # imm = 0x7BC
addl %ebp, %edx
movl %r8d, %ecx
shrl $0x5, %ecx
andl $0xf, %ecx
andl $0x1f, %r8d
leaq 0x2192(%rip), %r15      # 0x7976
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x1140
movl $0x20, %edi
movq %r14, %rsi
callq 0x1120
movzwl 0x3a(%rsp), %r8d
movl %r8d, %edx
shrl $0xb, %edx
movl %r8d, %ecx
shrl $0x5, %ecx
andl $0x3f, %ecx
addl %r8d, %r8d
andl $0x3e, %r8d
leaq 0x2164(%rip), %r12      # 0x7985
movq %r14, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x1140
movl $0xa, %edi
movq %r14, %rsi
callq 0x1120
leaq 0x2249(%rip), %rdi      # 0x7a8b
movl $0x18, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x11e0
movzwl 0x3c(%rsp), %r8d
movl %r8d, %edx
shrl $0x9, %edx
addl %ebp, %edx
movl %r8d, %ecx
shrl $0x5, %ecx
andl $0xf, %ecx
andl $0x1f, %r8d
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x1140
movl $0x20, %edi
movq %r14, %rsi
callq 0x1120
movzwl 0x3e(%rsp), %r8d
movl %r8d, %edx
shrl $0xb, %edx
movl %r8d, %ecx
shrl $0x5, %ecx
andl $0x3f, %ecx
addl %r8d, %r8d
andl $0x3e, %r8d
movq %r14, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x1140
movl $0xa, %edi
movq %r14, %rsi
callq 0x1120
leaq 0x21de(%rip), %rdi      # 0x7aa4
movl $0x18, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x11e0
movzwl 0x40(%rsp), %r8d
movl %r8d, %edx
shrl $0x9, %edx
addl %ebp, %edx
movl %r8d, %ecx
shrl $0x5, %ecx
andl $0xf, %ecx
andl $0x1f, %r8d
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x1140
movl $0xa, %edi
movq %r14, %rsi
callq 0x1120
movl 0x44(%rsp), %edx
leaq 0x21a5(%rip), %rsi      # 0x7abd
movq %r14, %rdi
xorl %eax, %eax
callq 0x1140
movl 0x48(%rsp), %edx
leaq 0x21ac(%rip), %rsi      # 0x7ad9
movq %r14, %rdi
xorl %eax, %eax
callq 0x1140
movq 0x20(%rbx), %rdi
movq %r14, %rsi
callq 0x5418
movl %eax, %ebp
movl %ebp, %eax
addq $0x350, %rsp            # imm = 0x350
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
callq 0x14b4
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x5945
movl %eax, %edi
callq 0x148e
jmp 0x56eb