// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/arcfs.c
// Function: do_arcfs_file_header
static int do_arcfs_file_header(deark *c, lctx *d, i64 pos1)
{
	i64 pos = pos1;
	i64 hlen;
	u32 ver_r, ver_rw;
	u32 format_ver;
	int retval = 0;

	de_dbg(c, "file header at %d", (int)pos1);
	de_dbg_indent(c, 1);
	pos += 8; // Signature

	hlen = de_getu32le_p(&pos);
	d->nmembers = hlen/36;
	de_dbg(c, "header len: %d (%d members)", (int)hlen, (int)d->nmembers);

	d->data_offs = de_getu32le_p(&pos);
	de_dbg(c, "data offset: %d", (int)d->data_offs);

	ver_r = (u32)de_getu32le_p(&pos);
	de_dbg(c, "version req'd for read: %u.%02u", (unsigned int)(ver_r/100),
		(unsigned int)(ver_r%100));
	ver_rw = (u32)de_getu32le_p(&pos);
	de_dbg(c, "version req'd for read/write: %u.%02u", (unsigned int)(ver_rw/100),
		(unsigned int)(ver_rw%100));

	// ??
	format_ver = (u32)de_getu32le_p(&pos);
	de_dbg(c, "format version: %u", (unsigned int)format_ver);
	if(format_ver!=0) {
		de_err(c, "Unsupported format version: %u", (unsigned int)format_ver);
		goto done;
	}

	// 68 reserved bytes here

	retval = 1;
done:
	de_dbg_indent(c, -1);
	return retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl %eax, %edx
leaq 0x172d0f(%rip), %rsi    # 0x19fe73
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x20(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x165580
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl $0x24, %ecx
cqto
idivq %rcx
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movl %eax, %edx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl %eax, %ecx
leaq 0x172cb7(%rip), %rsi    # 0x19fe85
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x165580
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl %eax, %edx
leaq 0x17dae5(%rip), %rsi    # 0x1aaceb
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x165580
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %eax
movl $0x64, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, -0x40(%rbp)
movl -0x2c(%rbp), %eax
movl $0x64, %ecx
xorl %edx, %edx
divl %ecx
movl %edx, %ecx
movl -0x40(%rbp), %edx
leaq 0x172c55(%rip), %rsi    # 0x19fea1
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x165580
movl %eax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movl -0x30(%rbp), %eax
movl $0x64, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, -0x3c(%rbp)
movl -0x30(%rbp), %eax
movl $0x64, %ecx
xorl %edx, %edx
divl %ecx
movl %edx, %ecx
movl -0x3c(%rbp), %edx
leaq 0x172c2f(%rip), %rsi    # 0x19fec1
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x165580
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rdi
movl -0x34(%rbp), %edx
leaq 0x172c38(%rip), %rsi    # 0x19fef3
movb $0x0, %al
callq 0x15b0d0
cmpl $0x0, -0x34(%rbp)
je 0x2d2df
movq -0x8(%rbp), %rdi
movl -0x34(%rbp), %edx
leaq 0x172c11(%rip), %rsi    # 0x19fee7
movb $0x0, %al
callq 0x15bfb0
jmp 0x2d2e6
movl $0x1, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movl -0x38(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)