// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/installshld.c
// Function: de_run_tscomp
static void de_run_tscomp(deark *c, de_module_params *mparams)
{
	de_arch_lctx *d = NULL;
	i64 pos;
	i64 i;
	int saved_indent_level;
	u8 b;
	const char *name;
	struct de_arch_member_data *md = NULL;

	de_dbg_indent_save(c, &saved_indent_level);
	d = de_arch_create_lctx(c);
	d->is_le = 1;
	d->input_encoding = de_get_input_encoding(c, NULL, DE_ENCODING_CP437);

	pos = 0;
	de_dbg(c, "archive header at %d", (int)pos);
	de_dbg_indent(c, 1);
	pos += 4;

	b = de_getbyte_p(&pos);
	if(b!=0x08) { d->need_errmsg = 1; goto done; }
	pos += 3; // version?? (01 03 00)
	b = de_getbyte_p(&pos);
	switch(b) {
	case 1: name = "without wildcard"; break;
	case 2: name = "with wildcard"; break;
		// 0: seems to identify an "old" version (but it might be a significantly
		// different format).
	default: name = "?";
	}
	de_dbg(c, "filename style: %u (%s)", (UI)b, name);
	if(b!=1 && b!=2) { d->need_errmsg = 1; goto done; }

	pos += 4; // ??
	de_dbg_indent(c, -1);

	i = 0;
	while(1) {
		if(d->fatalerrflag) goto done;
		if(de_getbyte(pos) != 0x12) { d->need_errmsg = 1; goto done; }

		if(md) {
			de_arch_destroy_md(c, md);
			md = NULL;
		}

		md = de_arch_create_md(c, d);
		md->member_idx = i;
		md->member_hdr_pos = pos;

		tscomp_do_member(c, d, md);

		if(!md->next_member_exists) goto done;
		pos = md->next_member_pos;
		i++;
	}

done:
	if(d->need_errmsg) {
		de_err(c, "Bad or unsupported TSComp format");
	}
	de_arch_destroy_md(c, md);
	de_arch_destroy_lctx(c, d);
	de_dbg_indent_restore(c, saved_indent_level);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x10(%rsp), %rsi
callq 0xe958c
movq %rbx, %rdi
callq 0xfdb0a
movq %rax, %r14
movl $0x1, 0x10(%rax)
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %esi, %esi
movl $0xd, %edx
callq 0xeb7d1
movl %eax, 0x18(%r14)
leaq 0x8(%rsp), %r12
movq $0x0, (%r12)
leaq 0x82fa7(%rip), %rsi     # 0x125b33
movq %rbx, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
addq $0x4, (%r12)
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef14d
cmpb $0x8, %al
jne 0xa2c15
leaq 0x8(%rsp), %rsi
addq $0x3, (%rsi)
movq 0x18(%rbx), %rdi
callq 0xef14d
movzbl %al, %r12d
cmpb $0x2, %r12b
leaq 0x8fa61(%rip), %rax     # 0x13263c
leaq 0x89287(%rip), %rdx     # 0x12be69
cmoveq %rax, %rdx
cmpb $0x1, %r12b
leaq 0x8fa3a(%rip), %rcx     # 0x13262b
cmovneq %rdx, %rcx
leaq 0x8fa4e(%rip), %rsi     # 0x13264a
xorl %r15d, %r15d
movq %rbx, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0xe9226
leal -0x3(%r12), %eax
cmpb $-0x2, %al
jae 0xa2c63
movb $0x1, 0x14(%r14)
cmpb $0x0, 0x14(%r14)
je 0xa2c32
leaq 0x8fa3a(%rip), %rsi     # 0x132662
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
movq %rbx, %rdi
movq %r15, %rsi
callq 0xfdab8
movq %rbx, %rdi
movq %r14, %rsi
callq 0xfdb25
movl 0x10(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $0x4, 0x8(%rsp)
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
cmpl $0x0, 0x38(%r14)
je 0xa2c82
xorl %r15d, %r15d
jmp 0xa2c1a
movq %rsp, %rbp
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x18(%rbx), %rdi
movq 0x8(%rsp), %rsi
callq 0xef0d5
cmpb $0x12, %al
jne 0xa2c15
testq %r15, %r15
je 0xa2cb1
movq %rbx, %rdi
movq %r15, %rsi
callq 0xfdab8
movq %rbx, %rdi
movq %r14, %rsi
callq 0xfda6c
movq %rax, %r15
movq %r12, 0x10(%rax)
movq 0x8(%rsp), %rax
movq %rax, 0x18(%r15)
movq %rax, (%rsp)
movq %rbx, %rdi
leaq 0x14(%rsp), %rsi
callq 0xe958c
movl 0x10(%r15), %edx
movq 0x18(%r15), %rcx
movq %rbx, %rdi
leaq 0x8f994(%rip), %rsi     # 0x132683
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
incq (%rsp)
movq %r15, %rdi
movq %rbp, %rsi
callq 0xfdbe0
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xef3a0
movq %rax, 0x98(%r15)
movq %rbx, %rdi
leaq 0x8edc7(%rip), %rsi     # 0x131af6
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x98(%r15), %rax
testq %rax, %rax
je 0xa2d5d
cmpq 0x18(%r15), %rax
jle 0xa2d5d
movq 0x18(%rbx), %rcx
cmpq 0x18(%rcx), %rax
jge 0xa2d5d
movb $0x1, 0xa0(%r15)
movq 0x50(%r15), %rsi
addq $0x18, %rsi
movq %r14, %rdi
leaq 0x7532f(%rip), %rdx     # 0x11809e
movl $0x3, %ecx
movq %rbp, %r8
callq 0xfdc9b
addq $0x2, (%rsp)
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xef14d
movzbl %al, %r13d
movq 0x18(%rbx), %rdi
movq (%rsp), %rsi
movq 0x58(%r15), %rcx
movl 0x18(%r14), %r9d
movq %r13, %rdx
movl $0x1, %r8d
callq 0xf01b0
movq 0x58(%r15), %rdi
callq 0xf7557
movq %rbx, %rdi
leaq 0x98c12(%rip), %rsi     # 0x13b9d4
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq (%rsp), %rax
addq %r13, %rax
incq %rax
movq %rax, (%rsp)
movq %rax, 0x40(%r15)
leaq 0x3ac(%rip), %rax       # 0xa3191
movq %rax, 0xa8(%r15)
movq %r15, %rdi
callq 0xfdec1
movl 0x14(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
cmpb $0x0, 0xa0(%r15)
je 0xa2c1a
movq 0x98(%r15), %rax
movq %rax, 0x8(%rsp)
incq %r12
cmpl $0x0, 0x38(%r14)
je 0xa2c8b
jmp 0xa2c1a