// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/misc3.c
// Function: do_tc_member
static void do_tc_member(deark *c, de_arch_lctx *d, struct de_arch_member_data *md)
{
	int saved_indent_level;
	i64 seq_num;
	i64 pos = md->member_hdr_pos;
	de_ucstring *fn_ext = NULL;
	u8 ver;
	u8 ftype;
	u8 aflag;

	de_dbg_indent_save(c, &saved_indent_level);

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

	seq_num = (i64)de_getbyte_p(&pos);
	de_dbg(c, "seq num: %d", (int)seq_num);
	if(seq_num == 0) {
		d->stop_flag = 1;
		goto done;
	}
	if(seq_num != md->member_idx) {
		d->fatalerrflag = 1;
		d->need_errmsg = 1;
		goto done;
	}

	// Presumably not a NUL-terminated string, but the flag won't hurt.
	dbuf_read_to_ucstring(c->infile, pos, 8, md->filename, DE_CONVFLAG_STOP_AT_NUL,
		d->input_encoding);
	pos += 8;
	ucstring_strip_trailing_spaces(md->filename);

	fn_ext = ucstring_create(c);
	dbuf_read_to_ucstring(c->infile, pos, 3, fn_ext, DE_CONVFLAG_STOP_AT_NUL,
		d->input_encoding);
	pos += 3;
	ucstring_strip_trailing_spaces(fn_ext);
	if(ucstring_isnonempty(fn_ext)) {
		ucstring_append_char(md->filename, '.');
		ucstring_append_ucstring(md->filename, fn_ext);
	}

	de_dbg(c, "filename: \"%s\"", ucstring_getpsz_d(md->filename));

	ftype = de_getbyte_p(&pos);
	de_dbg(c, "file type: %u", (UI)ftype);
	aflag = de_getbyte_p(&pos);
	de_dbg(c, "ascii flag: %u", (UI)aflag);
	ver = de_getbyte_p(&pos);
	if(ver != 1) {
		d->fatalerrflag = 1;
		d->need_errmsg = 1;
		goto done;
	}

	md->cmpr_len = dbuf_getint_ext(c->infile, pos, 3, 0, 0);
	pos += 3;
	de_dbg(md->c, "compressed size: %"I64_FMT, md->cmpr_len);

	md->cmpr_meth = (UI)de_getbyte_p(&pos);
	de_dbg(c, "cmpr. method: %u", md->cmpr_meth);

	md->cmpr_pos = pos;
	de_dbg(c, "file data pos: %"I64_FMT, md->cmpr_pos);
	md->member_total_size = md->cmpr_pos + md->cmpr_len - md->member_hdr_pos;

	if(md->cmpr_meth>1) {
		de_err(c, "Unsupported compression: %u", (UI)md->cmpr_meth);
		goto done;
	}

	md->dfn = tc_decompressor_fn;
	de_arch_extract_member_file(md);

done:
	ucstring_destroy(fn_ext);
	de_dbg_indent_restore(c, saved_indent_level);
}

// 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, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x1c(%rbp), %rsi
callq 0x15b580
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdx
leaq 0x1229ba(%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 -0x30(%rbp), %rsi
callq 0x165170
movzbl %al, %eax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movl %eax, %edx
leaq 0x105c1a(%rip), %rsi    # 0x1aa630
movb $0x0, %al
callq 0x15b0d0
cmpq $0x0, -0x28(%rbp)
jne 0xa4a34
movq -0x10(%rbp), %rax
movl $0x1, 0x50(%rax)
jmp 0xa4ce3
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x10(%rcx), %rax
je 0xa4a5a
movq -0x10(%rbp), %rax
movl $0x1, 0x38(%rax)
movq -0x10(%rbp), %rax
movb $0x1, 0x14(%rax)
jmp 0xa4ce3
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x30(%rbp), %rsi
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rcx
movq -0x10(%rbp), %rax
movl 0x18(%rax), %r9d
movl $0x8, %edx
movl $0x1, %r8d
callq 0x1669f0
movq -0x30(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0x171360
movq -0x8(%rbp), %rdi
callq 0x1711d0
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rcx
movq -0x10(%rbp), %rax
movl 0x18(%rax), %r9d
movl $0x3, %edx
movl $0x1, %r8d
callq 0x1669f0
movq -0x30(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %rdi
callq 0x171360
movq -0x38(%rbp), %rdi
callq 0x1717f0
cmpl $0x0, %eax
je 0xa4b1a
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rdi
movl $0x2e, %esi
callq 0x1714c0
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rdi
movq -0x38(%rbp), %rsi
callq 0x171460
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 0x122a46(%rip), %rsi    # 0x1c7583
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x165170
movb %al, -0x3a(%rbp)
movq -0x8(%rbp), %rdi
movzbl -0x3a(%rbp), %edx
leaq 0xff342(%rip), %rsi     # 0x1a3ea9
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x165170
movb %al, -0x3b(%rbp)
movq -0x8(%rbp), %rdi
movzbl -0x3b(%rbp), %edx
leaq 0x10d3ff(%rip), %rsi    # 0x1b1f90
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x165170
movb %al, -0x39(%rbp)
movzbl -0x39(%rbp), %eax
cmpl $0x1, %eax
je 0xa4bcd
movq -0x10(%rbp), %rax
movl $0x1, 0x38(%rax)
movq -0x10(%rbp), %rax
movb $0x1, 0x14(%rax)
jmp 0xa4ce3
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x30(%rbp), %rsi
movl $0x3, %edx
xorl %r8d, %r8d
movl %r8d, %ecx
callq 0x165a80
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x30(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rdx
leaq 0x105335(%rip), %rsi    # 0x1a9f4b
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x165170
movzbl %al, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x90(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x90(%rax), %edx
leaq 0x10ca99(%rip), %rsi    # 0x1b16e9
movb $0x0, %al
callq 0x15b0d0
movq -0x30(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rdx
leaq 0x10d329(%rip), %rsi    # 0x1b1f9f
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rcx
movq -0x18(%rbp), %rax
addq 0x30(%rax), %rcx
movq -0x18(%rbp), %rax
subq 0x18(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x18(%rbp), %rax
cmpl $0x1, 0x90(%rax)
jbe 0xa4cc8
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x90(%rax), %edx
leaq 0xfaac3(%rip), %rsi     # 0x19f782
movb $0x0, %al
callq 0x15bfb0
jmp 0xa4ce3
movq -0x18(%rbp), %rax
leaq 0x2d(%rip), %rcx        # 0xa4d00
movq %rcx, 0xa8(%rax)
movq -0x18(%rbp), %rdi
callq 0x17c920
movq -0x38(%rbp), %rdi
callq 0x171750
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x15b5a0
addq $0x50, %rsp
popq %rbp
retq
nop