// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/misc3.c
// Function: do_BUhit_member
static int do_BUhit_member(deark *c, de_arch_lctx *d, struct de_arch_member_data *md)
{
	i64 pos = md->member_hdr_pos;
	i64 fnlen;
	UI hdr_checksum_reported;
	UI hdr_checksum_calc;
	UI flags_and_cmpr_meth;
	int saved_indent_level;
	int retval = 0;

	de_dbg_indent_save(c, &saved_indent_level);
	de_dbg(c, "member at %"I64_FMT, md->member_hdr_pos);
	de_dbg_indent(c, 1);

	md->member_hdr_size = de_getu16le_p(&pos);
	de_dbg(c, "header len: %"I64_FMT, md->member_hdr_size);
	if(md->member_hdr_size < HIT_MINHEADERLEN) goto done;

	hdr_checksum_reported = (UI)de_getbyte_p(&pos);
	de_dbg(c, "header checksum (reported): 0x%02x", hdr_checksum_reported);

	hdr_checksum_calc = hit_calc_hdr_checksum(md);
	de_dbg(c, "header checksum (calculated): 0x%02x", hdr_checksum_calc);

	// bit 0x80 = garbled (reserved)
	// bit 0x40 = Maybe a version flag? Affects the CRC field.
	// bit 0x20 = unknown (reserved?)
	// low 5 bits = compression method
	flags_and_cmpr_meth = (UI)de_getbyte_p(&pos);
	md->cmpr_meth = flags_and_cmpr_meth & 0x1f;
	de_dbg(c, "cmpr. method: %u", md->cmpr_meth);

	pos += 1; // ??

	de_arch_read_field_cmpr_len_p(md, &pos);
	de_arch_read_field_orig_len_p(md, &pos);

	pos = md->member_hdr_pos+13;
	de_arch_read_field_dttm_p(d, &md->fi->timestamp[DE_TIMESTAMPIDX_MODIFY], "mod",
		DE_ARCH_TSTYPE_DOS_TD, &pos);
	de_arch_read_field_dos_attr_p(md, &pos);

	pos += 2; // ??

	md->crc_reported = (u32)de_getu32le_p(&pos);
	de_dbg(c, "crc (reported): 0x%08x", (UI)md->crc_reported);

	fnlen = (i64)de_getbyte_p(&pos);
	dbuf_read_to_ucstring(c->infile, pos, fnlen, md->filename, 0,
		d->input_encoding);
	de_dbg(c, "filename: \"%s\"", ucstring_getpsz_d(md->filename));
	pos += fnlen;

	md->cmpr_pos = md->member_hdr_pos + md->member_hdr_size;
	de_dbg(c, "cmpr data pos: %"I64_FMT, md->cmpr_pos);
	md->member_total_size = md->member_hdr_size + md->cmpr_len;
	retval = 1;
	de_dbg_indent(c, -1);

done:
	de_dbg_indent_restore(c, saved_indent_level);
	return retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x3c(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x15b580
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdx
leaq 0x12338b(%rip), %rsi    # 0x1c7392
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x1652c0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rdx
leaq 0x10db6a(%rip), %rsi    # 0x1b1bb5
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rax
cmpq $0x14, 0x20(%rax)
jge 0xa4062
jmp 0xa426e
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x165170
movzbl %al, %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %edx
leaq 0x10dd9a(%rip), %rsi    # 0x1b1e21
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rdi
callq 0xa4290
movl %eax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movl -0x30(%rbp), %edx
leaq 0x10dd9c(%rip), %rsi    # 0x1b1e44
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x165170
movzbl %al, %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %ecx
andl $0x1f, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x90(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x90(%rax), %edx
leaq 0x10d5fe(%rip), %rsi    # 0x1b16e9
movb $0x0, %al
callq 0x15b0d0
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x17c400
movq -0x18(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x17c350
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
addq $0xd, %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x50(%rax), %rsi
addq $0x18, %rsi
leaq 0xffdb4(%rip), %rdx     # 0x1a3ef3
movl $0x4, %ecx
leaq -0x20(%rbp), %r8
callq 0x17c580
movq -0x18(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x17c540
movq -0x20(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x165580
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x48(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x48(%rax), %edx
leaq 0x12bc06(%rip), %rsi    # 0x1cfd98
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x165170
movzbl %al, %eax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rcx
movq -0x10(%rbp), %rax
movl 0x18(%rax), %r9d
xorl %r8d, %r8d
callq 0x1669f0
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0x172650
movq -0x48(%rbp), %rdi
movq %rax, %rdx
leaq 0x123387(%rip), %rsi    # 0x1c7583
movb $0x0, %al
callq 0x15b0d0
movq -0x28(%rbp), %rax
addq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x18(%rbp), %rax
addq 0x20(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rdx
leaq 0x10dc2f(%rip), %rsi    # 0x1b1e69
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rcx
movq -0x18(%rbp), %rax
addq 0x30(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x28(%rax)
movl $0x1, -0x3c(%rbp)
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movq -0x8(%rbp), %rdi
movl -0x38(%rbp), %esi
callq 0x15b5a0
movl -0x3c(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)