// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/cab.c
// Function: do_one_CFFOLDER
static int do_one_CFFOLDER(deark *c, lctx *d, i64 folder_idx,
	i64 pos1, i64 *bytes_consumed)
{
	i64 pos = pos1;
	struct folder_info *fldi = NULL;

	fldi = de_malloc(c, sizeof(struct folder_info));
	fldi->folder_idx = folder_idx;

	fldi->coffCabStart = de_getu32le_p(&pos);
	de_dbg(c, "first CFDATA blk offset (coffCabStart): %"I64_FMT, fldi->coffCabStart);

	fldi->cCFData = de_getu16le_p(&pos);
	de_dbg(c, "no. of CFDATA blks for this folder (cCFData): %d", (int)fldi->cCFData);

	fldi->typeCompress_raw = (unsigned int)de_getu16le_p(&pos);
	fldi->cmpr_type = fldi->typeCompress_raw & 0x000f;
	de_dbg(c, "typeCompress field: 0x%04x", fldi->typeCompress_raw);
	de_dbg_indent(c, 1);
	de_dbg(c, "compression type: 0x%04x (%s)", fldi->cmpr_type,
		get_cmpr_type_name(fldi->cmpr_type));
	de_dbg_indent(c, -1);

	if((d->header_flags&0x0004) && (d->cbCFFolder>0)) {
		de_dbg(c, "[%d bytes of abReserve data at %d]", (int)d->cbCFFolder,
			(int)pos);
		de_dbg_indent(c, 1);
		de_dbg_hexdump(c, c->infile, pos, d->cbCFFolder, 256, NULL, 0x1);
		de_dbg_indent(c, -1);
		pos += d->cbCFFolder;
	}

	*bytes_consumed = pos-pos1;

	do_CFDATA_for_one_CFFOLDER(c, d, fldi);

	de_free(c, fldi);
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movl $0x20, %esi
callq 0x15b780
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x165580
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x1556f7(%rip), %rsi    # 0x1a4fdf
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x1652c0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movl %eax, %edx
leaq 0x1556eb(%rip), %rsi    # 0x1a500b
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x1652c0
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x38(%rbp), %rax
movl 0x18(%rax), %ecx
andl $0xf, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movl 0x18(%rax), %edx
leaq 0x1556d8(%rip), %rsi    # 0x1a503c
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x3c(%rbp)
movq -0x38(%rbp), %rax
movl 0x1c(%rax), %edi
callq 0x4fa90
movq -0x48(%rbp), %rdi
movl -0x3c(%rbp), %edx
movq %rax, %rcx
leaq 0x1556af(%rip), %rsi    # 0x1a5057
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x4fa58
movq -0x10(%rbp), %rax
cmpq $0x0, 0x30(%rax)
jle 0x4fa58
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movl %eax, %edx
movq -0x30(%rbp), %rax
movl %eax, %ecx
leaq 0x15551f(%rip), %rsi    # 0x1a4f15
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x30(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rcx
movl $0x100, %r8d            # imm = 0x100
xorl %eax, %eax
movl %eax, %r9d
movl $0x1, (%rsp)
callq 0x15b840
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rcx
subq -0x20(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0x4fb00
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x15b820
movl $0x1, %eax
addq $0x50, %rsp
popq %rbp
retq