// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/cab.c
// Function: do_one_CFFILE
static int do_one_CFFILE(deark *c, lctx *d, i64 pos1, i64 *bytes_consumed)
{
	i64 cbFile;
	i64 uoffFolderStart;
	i64 iFolder;
	i64 pos = pos1;
	i64 date_;
	i64 time_;
	unsigned int attribs;
	int retval = 0;
	struct de_stringreaderdata *szName = NULL;
	de_ucstring *attribs_str = NULL;
	struct de_timestamp ts;
	char timestamp_buf[64];
	char tmps[80];

	cbFile = de_getu32le_p(&pos);
	de_dbg(c, "uncompressed file size (cbFile): %"I64_FMT, cbFile);

	uoffFolderStart = de_getu32le_p(&pos);
	de_dbg(c, "offset in folder (uoffFolderStart): %"I64_FMT, uoffFolderStart);

	iFolder = de_getu16le_p(&pos);
	if(iFolder>=0xfffd) {
		de_snprintf(tmps, sizeof(tmps), "0x%04x (%s)", (unsigned int)iFolder,
			get_special_folder_name(iFolder));
	}
	else {
		de_snprintf(tmps, sizeof(tmps), "%u", (unsigned int)iFolder);
	}
	de_dbg(c, "folder index (iFolder): %s", tmps);

	date_ = de_getu16le_p(&pos);
	time_ = de_getu16le_p(&pos);
	de_dos_datetime_to_timestamp(&ts, date_, time_);
	ts.tzcode = DE_TZCODE_LOCAL;
	de_timestamp_to_string(&ts, timestamp_buf, sizeof(timestamp_buf), 0);
	de_dbg(c, "timestamp: %s", timestamp_buf);

	attribs = (unsigned int)de_getu16le_p(&pos);
	attribs_str = ucstring_create(c);
	de_describe_dos_attribs(c, (attribs & 0x3f), attribs_str, 0);
	if(attribs&0x40) ucstring_append_flags_item(attribs_str, "EXEC");
	if(attribs&0x80) ucstring_append_flags_item(attribs_str, "NAME_IS_UTF8");
	de_dbg(c, "attribs: 0x%04x (%s)", attribs, ucstring_getpsz(attribs_str));

	szName = dbuf_read_string(c->infile, pos, 257, 257,
		DE_CONVFLAG_STOP_AT_NUL,
		(attribs&0x80)?DE_ENCODING_UTF8:DE_ENCODING_ASCII);
	de_dbg(c, "szName: \"%s\"", ucstring_getpsz(szName->str));
	if(!szName->found_nul) goto done;
	pos += szName->bytes_consumed;

	*bytes_consumed = pos-pos1;
	retval = 1;
done:
	de_destroy_stringreaderdata(c, szName);
	ucstring_destroy(attribs_str);
	return retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x40(%rbp), %rsi
callq 0x165580
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0x1552f4(%rip), %rsi    # 0x1a5152
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x40(%rbp), %rsi
callq 0x165580
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0x1552ee(%rip), %rsi    # 0x1a5177
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x40(%rbp), %rsi
callq 0x1652c0
movq %rax, -0x38(%rbp)
cmpq $0xfffd, -0x38(%rbp)    # imm = 0xFFFD
jl 0x4fef5
leaq -0x110(%rbp), %rax
movq %rax, -0x120(%rbp)
movq -0x38(%rbp), %rax
movl %eax, -0x114(%rbp)
movq -0x38(%rbp), %rdi
callq 0x50110
movq -0x120(%rbp), %rdi
movl -0x114(%rbp), %ecx
movq %rax, %r8
movl $0x50, %esi
leaq 0x17ce51(%rip), %rdx    # 0x1ccd3d
movb $0x0, %al
callq 0x15a980
jmp 0x4ff15
leaq -0x110(%rbp), %rdi
movq -0x38(%rbp), %rax
movl %eax, %ecx
movl $0x50, %esi
leaq 0x1513ae(%rip), %rdx    # 0x1a12bc
movb $0x0, %al
callq 0x15a980
movq -0x8(%rbp), %rdi
leaq -0x110(%rbp), %rdx
leaq 0x155278(%rip), %rsi    # 0x1a519f
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x40(%rbp), %rsi
callq 0x1652c0
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x40(%rbp), %rsi
callq 0x1652c0
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rsi
movq -0x50(%rbp), %rdx
leaq -0x78(%rbp), %rdi
callq 0x15d750
movb $0x2, -0x77(%rbp)
leaq -0xc0(%rbp), %rsi
leaq -0x78(%rbp), %rdi
movl $0x40, %edx
xorl %ecx, %ecx
callq 0x15e130
movq -0x8(%rbp), %rdi
leaq -0xc0(%rbp), %rdx
leaq 0x154cb1(%rip), %rsi    # 0x1a4c47
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x40(%rbp), %rsi
callq 0x1652c0
movl %eax, -0x54(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1711d0
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rdi
movl -0x54(%rbp), %esi
andl $0x3f, %esi
movq -0x68(%rbp), %rdx
xorl %ecx, %ecx
callq 0x15d9f0
movl -0x54(%rbp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x4ffee
movq -0x68(%rbp), %rdi
leaq 0x1551d1(%rip), %rsi    # 0x1a51ba
callq 0x172680
movl -0x54(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x5000b
movq -0x68(%rbp), %rdi
leaq 0x1551b9(%rip), %rsi    # 0x1a51bf
callq 0x172680
movq -0x8(%rbp), %rax
movq %rax, -0x138(%rbp)
movl -0x54(%rbp), %eax
movl %eax, -0x12c(%rbp)
movq -0x68(%rbp), %rdi
callq 0x172500
movq -0x138(%rbp), %rdi
movl -0x12c(%rbp), %edx
movq %rax, %rcx
leaq 0x15518d(%rip), %rsi    # 0x1a51cc
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x40(%rbp), %rsi
movl -0x54(%rbp), %ecx
andl $0x80, %ecx
movl $0x1, %r9d
movl $0x2, %eax
cmpl $0x0, %ecx
cmovnel %eax, %r9d
movl $0x101, %ecx            # imm = 0x101
movl $0x1, %r8d
movq %rcx, %rdx
callq 0x1664c0
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x128(%rbp)
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x172500
movq -0x128(%rbp), %rdi
movq %rax, %rdx
leaq 0x155134(%rip), %rsi    # 0x1a51e1
movb $0x0, %al
callq 0x15b0d0
movq -0x60(%rbp), %rax
cmpl $0x0, 0x34(%rax)
jne 0x500c0
jmp 0x500e5
movq -0x60(%rbp), %rax
movq (%rax), %rax
addq -0x40(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rcx
subq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movl $0x1, -0x58(%rbp)
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x166830
movq -0x68(%rbp), %rdi
callq 0x171750
movl -0x58(%rbp), %eax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
nopw (%rax,%rax)