// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/stuffit.c
// Function: do_member_header
static int do_member_header(deark *c, lctx *d, struct member_data *md, i64 pos1)
{
	i64 pos = pos1;
	i64 fnlen;
	i64 n;
	u32 hdr_crc_reported;
	u32 hdr_crc_calc;
	de_ucstring *descr = NULL;
	int saved_indent_level;
	char timestamp_buf[64];

	de_dbg_indent_save(c, &saved_indent_level);
	de_dbg(c, "member header at %"I64_FMT, pos1);
	de_dbg_indent(c, 1);

	md->rfork.cmpr_meth_etc = de_getbyte_p(&pos);
	descr = ucstring_create(c);
	decode_cmpr_meth(c, d, &md->rfork, descr);
	de_dbg(c, "rsrc cmpr meth (etc.): %u (%s)", (unsigned int)md->rfork.cmpr_meth_etc,
		ucstring_getpsz(descr));

	md->dfork.cmpr_meth_etc = de_getbyte_p(&pos);
	ucstring_empty(descr);
	decode_cmpr_meth(c, d, &md->dfork, descr);
	de_dbg(c, "data cmpr meth (etc.): %u (%s)", (unsigned int)md->dfork.cmpr_meth_etc,
		ucstring_getpsz(descr));

	fnlen = (i64)de_getbyte_p(&pos);
	if(fnlen>63) fnlen=63;
	md->fname = dbuf_read_string(c->infile, pos, fnlen, fnlen, 0, d->input_encoding);
	de_dbg(c, "filename: \"%s\"", ucstring_getpsz(md->fname->str));
	pos += 63;

	if(md->dfork.is_a_file || md->rfork.is_a_file) {
		dbuf_read_fourcc(c->infile, pos, &md->filetype, 4, 0x0);
		de_dbg(c, "filetype: '%s'", md->filetype.id_dbgstr);
		de_memcpy(md->advf->typecode, md->filetype.bytes, 4);
		md->advf->has_typecode = 1;
		pos += 4;
		dbuf_read_fourcc(c->infile, pos, &md->creator, 4, 0x0);
		de_dbg(c, "creator: '%s'", md->creator.id_dbgstr);
		de_memcpy(md->advf->creatorcode, md->creator.bytes, 4);
		md->advf->has_creatorcode = 1;
		pos += 4;

		md->finder_flags = (unsigned int)de_getu16be_p(&pos);
		de_dbg(c, "finder flags: 0x%04x", md->finder_flags);
		md->advf->finderflags = (u16)md->finder_flags;
		md->advf->has_finderflags = 1;
	}
	else {
		// Don't know if these fields mean anything for folders.
		// Possibly they're the first 10 bytes of DInfo (Finder Info for
		// folders), though that seems a little odd.
		pos += 10;
	}

	n = de_getu32be_p(&pos);
	de_mac_time_to_timestamp(n, &md->create_time);
	de_timestamp_to_string(&md->create_time, timestamp_buf, sizeof(timestamp_buf), 0);
	de_dbg(c, "create time: %"I64_FMT" (%s)", n, timestamp_buf);
	md->advf->mainfork.fi->timestamp[DE_TIMESTAMPIDX_CREATE] = md->create_time;

	n = de_getu32be_p(&pos);
	de_mac_time_to_timestamp(n, &md->mod_time);
	de_timestamp_to_string(&md->mod_time, timestamp_buf, sizeof(timestamp_buf), 0);
	de_dbg(c, "mod time: %"I64_FMT" (%s)", n, timestamp_buf);
	md->advf->mainfork.fi->timestamp[DE_TIMESTAMPIDX_MODIFY] = md->mod_time;

	md->rfork.unc_len = de_getu32be_p(&pos);
	md->dfork.unc_len = de_getu32be_p(&pos);
	md->rfork.cmpr_len = de_getu32be_p(&pos);
	md->dfork.cmpr_len = de_getu32be_p(&pos);
	de_dbg(c, "rsrc uncmpr len: %"I64_FMT, md->rfork.unc_len);
	de_dbg(c, "rsrc cmpr len: %"I64_FMT, md->rfork.cmpr_len);
	de_dbg(c, "data uncmpr len: %"I64_FMT, md->dfork.unc_len);
	de_dbg(c, "data cmpr len: %"I64_FMT, md->dfork.cmpr_len);

	md->rfork.crc_reported = (u32)de_getu16be_p(&pos);
	de_dbg(c, "rsrc crc (reported): 0x%04x", (UI)md->rfork.crc_reported);
	md->dfork.crc_reported = (u32)de_getu16be_p(&pos);
	de_dbg(c, "data crc (reported): 0x%04x", (UI)md->dfork.crc_reported);

	pos += 6; // reserved, etc.

	hdr_crc_reported = (u32)de_getu16be_p(&pos);
	de_dbg(c, "header crc (reported): 0x%04x", (UI)hdr_crc_reported);

	de_crcobj_reset(d->crco_hdr);
	de_crcobj_addslice(d->crco_hdr, c->infile, pos1, 110);
	hdr_crc_calc = de_crcobj_getval(d->crco_hdr);
	de_dbg(c, "header crc (calculated): 0x%04x", (UI)hdr_crc_calc);
	if(hdr_crc_reported != hdr_crc_calc) {
		de_warn(c, "Bad header CRC (reported 0x%04x, calculated 0x%04x)", (UI)hdr_crc_reported,
			(UI)hdr_crc_calc);
	}

	de_dbg_indent(c, -1);

	de_dbg_indent_restore(c, saved_indent_level);
	ucstring_destroy(descr);
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x4c(%rbp), %rsi
callq 0x15b580
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x90c7b(%rip), %rsi     # 0x1d0692
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x165170
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0xa1(%rax)
movq -0x8(%rbp), %rdi
callq 0x1711d0
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
addq $0xa0, %rdx
movq -0x48(%rbp), %rcx
callq 0x140380
movq -0x8(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x18(%rbp), %rax
movzbl 0xa1(%rax), %eax
movl %eax, -0xa4(%rbp)
movq -0x48(%rbp), %rdi
callq 0x172500
movq -0xb0(%rbp), %rdi
movl -0xa4(%rbp), %edx
movq %rax, %rcx
leaq 0x8e2da(%rip), %rsi     # 0x1cdd88
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x165170
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0xe1(%rax)
movq -0x48(%rbp), %rdi
callq 0x171210
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
addq $0xe0, %rdx
movq -0x48(%rbp), %rcx
callq 0x140380
movq -0x8(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x18(%rbp), %rax
movzbl 0xe1(%rax), %eax
movl %eax, -0x94(%rbp)
movq -0x48(%rbp), %rdi
callq 0x172500
movq -0xa0(%rbp), %rdi
movl -0x94(%rbp), %edx
movq %rax, %rcx
leaq 0x8e274(%rip), %rsi     # 0x1cdda7
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x165170
movzbl %al, %eax
movq %rax, -0x30(%rbp)
cmpq $0x3f, -0x30(%rbp)
jle 0x13fb61
movq $0x3f, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
movl 0x4(%rax), %r9d
xorl %r8d, %r8d
callq 0x1664c0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x18(%rax), %rdi
callq 0x172500
movq -0xb8(%rbp), %rdi
movq %rax, %rdx
leaq 0x879c6(%rip), %rsi     # 0x1c7583
movb $0x0, %al
callq 0x15b0d0
movq -0x28(%rbp), %rax
addq $0x3f, %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movzbl 0xe2(%rax), %eax
cmpl $0x0, %eax
jne 0x13fbf4
movq -0x18(%rbp), %rax
movzbl 0xa2(%rax), %eax
cmpl $0x0, %eax
je 0x13fd23
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x28(%rbp), %rsi
movq -0x18(%rbp), %rdx
addq $0x20, %rdx
movl $0x4, %ecx
xorl %r8d, %r8d
callq 0x169860
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
addq $0x20, %rdx
addq $0x10, %rdx
leaq 0x60adb(%rip), %rsi     # 0x1a0707
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x18(%rbp), %rcx
movl 0x20(%rcx), %ecx
movl %ecx, 0x90(%rax)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movb $0x1, 0x7b(%rax)
movq -0x28(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x28(%rbp), %rsi
movq -0x18(%rbp), %rdx
addq $0x50, %rdx
movl $0x4, %ecx
xorl %r8d, %r8d
callq 0x169860
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
addq $0x50, %rdx
addq $0x10, %rdx
leaq 0x8009a(%rip), %rsi     # 0x1bfd32
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x18(%rbp), %rcx
movl 0x50(%rcx), %ecx
movl %ecx, 0x94(%rax)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movb $0x1, 0x7c(%rax)
movq -0x28(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x165210
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x4(%rax), %edx
leaq 0x60a1e(%rip), %rsi     # 0x1a0716
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
movw %ax, %cx
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movw %cx, 0x7e(%rax)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movb $0x1, 0x7d(%rax)
jmp 0x13fd2f
movq -0x28(%rbp), %rax
addq $0xa, %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x1654b0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x90, %rsi
callq 0x15d720
movq -0x18(%rbp), %rdi
addq $0x90, %rdi
leaq -0x90(%rbp), %rsi
movl $0x40, %edx
xorl %ecx, %ecx
callq 0x15e130
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rdx
leaq -0x90(%rbp), %rcx
leaq 0x83ee9(%rip), %rsi     # 0x1c3c75
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x20(%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x90(%rcx), %rdx
movq %rdx, 0x28(%rax)
movq 0x98(%rcx), %rcx
movq %rcx, 0x30(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x1654b0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x80, %rsi
callq 0x15d720
movq -0x18(%rbp), %rdi
addq $0x80, %rdi
leaq -0x90(%rbp), %rsi
movl $0x40, %edx
xorl %ecx, %ecx
callq 0x15e130
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rdx
leaq -0x90(%rbp), %rcx
leaq 0x5e2b6(%rip), %rsi     # 0x19e0cc
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x20(%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x80(%rcx), %rdx
movq %rdx, 0x18(%rax)
movq 0x88(%rcx), %rcx
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x1654b0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0xb0(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x1654b0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0xf0(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x1654b0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0xc0(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x1654b0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x100(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0xb0(%rax), %rdx
leaq 0x8def1(%rip), %rsi     # 0x1cddc6
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0xc0(%rax), %rdx
leaq 0x8dee9(%rip), %rsi     # 0x1cdddb
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0xf0(%rax), %rdx
leaq 0x8dedf(%rip), %rsi     # 0x1cddee
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x100(%rax), %rdx
leaq 0x8ded7(%rip), %rsi     # 0x1cde03
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x165210
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0xa8(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0xa8(%rax), %edx
leaq 0x8deb1(%rip), %rsi     # 0x1cde16
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x165210
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0xe8(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0xe8(%rax), %edx
leaq 0x909a9(%rip), %rsi     # 0x1d0947
movb $0x0, %al
callq 0x15b0d0
movq -0x28(%rbp), %rax
addq $0x6, %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x165210
movl %eax, -0x3c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x3c(%rbp), %edx
leaq 0x78166(%rip), %rsi     # 0x1b8139
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x15f250
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x20(%rbp), %rdx
movl $0x6e, %ecx
callq 0x15f500
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x15f340
movl %eax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movl -0x40(%rbp), %edx
leaq 0x7b04e(%rip), %rsi     # 0x1bb071
movb $0x0, %al
callq 0x15b0d0
movl -0x3c(%rbp), %eax
cmpl -0x40(%rbp), %eax
je 0x14004a
movq -0x8(%rbp), %rdi
movl -0x3c(%rbp), %edx
movl -0x40(%rbp), %ecx
leaq 0x83c48(%rip), %rsi     # 0x1c3c8b
movb $0x0, %al
callq 0x15bc10
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movq -0x8(%rbp), %rdi
movl -0x4c(%rbp), %esi
callq 0x15b5a0
movq -0x48(%rbp), %rdi
callq 0x171750
movl $0x1, %eax
addq $0xc0, %rsp
popq %rbp
retq
nopl (%rax,%rax)