// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/installshld.c
// Function: de_run_is_instarch
static void de_run_is_instarch(deark *c, de_module_params *mparams)
{
	de_arch_lctx *da = NULL;
	i64 pos;
	i64 i;
	struct de_arch_member_data *md = NULL;

	da = de_arch_create_lctx(c);
	da->is_le = 1;
	da->input_encoding = de_get_input_encoding(c, NULL, DE_ENCODING_WINDOWS1252);

	pos = 78;
	da->num_members = de_getu16le_p(&pos); // This might actually be a 32-bit field
	de_dbg(c, "number of members: %"I64_FMT, da->num_members);
	pos += 2;

	for(i=0; i<da->num_members; i++) {
		if(pos >= c->infile->len) goto done;

		if(md) {
			de_arch_destroy_md(c, md);
			md = NULL;
		}
		md = de_arch_create_md(c, da);
		md->member_hdr_pos = pos;
		if(!do_instarch_member(c, da, md)) goto done;
		if(md->member_hdr_size<=0) goto done;
		pos += md->member_hdr_size;
	}

done:
	if(md) {
		de_arch_destroy_md(c, md);
	}
	if(da) {
		de_arch_destroy_lctx(c, da);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
callq 0xf16ce
movq %rax, %r14
movl $0x1, 0x10(%rax)
pushq $0x9
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xe08d2
movl %eax, 0x18(%r14)
leaq 0x10(%rsp), %r15
movq $0x4e, (%r15)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xe3fc4
movq %rax, 0x20(%r14)
leaq 0x6b451(%rip), %rsi     # 0x1076ac
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
movq (%r15), %rax
addq $0x2, %rax
movq %rax, (%r15)
xorl %r12d, %r12d
xorl %r15d, %r15d
cmpq 0x20(%r14), %r12
jge 0x9c426
movq 0x18(%rbx), %rcx
cmpq 0x18(%rcx), %rax
jge 0x9c426
testq %r15, %r15
je 0x9c2a0
movq %rbx, %rdi
movq %r15, %rsi
callq 0xf167c
movq %rbx, %rdi
movq %r14, %rsi
callq 0xf1630
movq %rax, %r15
movq 0x10(%rsp), %rax
movq %rax, 0x18(%r15)
movq %rax, (%rsp)
movq %rbx, %rdi
leaq 0xc(%rsp), %rsi
callq 0xdebae
movq 0x18(%r15), %rdx
movq %rbx, %rdi
leaq 0x92597(%rip), %rsi     # 0x12e86d
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
pushq $0x1
popq %rsi
callq 0xdeba7
movq 0x18(%rbx), %rdi
movq %rsp, %rbp
movq %rbp, %rsi
callq 0xe40bf
movq %rax, 0x40(%r15)
movq %rbx, %rdi
leaq 0x7cb2a(%rip), %rsi     # 0x118e2f
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
movq %r15, %rdi
movq %rbp, %rsi
callq 0xf17ab
movq %r15, %rdi
movq %rbp, %rsi
callq 0xf1766
addq $0x8, (%rsp)
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xe3fc4
movq %rax, %r13
movq 0x18(%rbx), %rdi
movq (%rsp), %rsi
movq 0x58(%r15), %rcx
movl 0x18(%r14), %r9d
movq %rax, %rdx
xorl %r8d, %r8d
callq 0xe4c9a
movq 0x58(%r15), %rdi
callq 0xeb877
movq %rbx, %rdi
leaq 0x89342(%rip), %rsi     # 0x1256a9
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
addq %r13, (%rsp)
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xe3fc4
movq %rax, %r13
movq %rbx, %rdi
callq 0xeac74
movq %rax, %rbp
movq 0x18(%rbx), %rdi
movq (%rsp), %rsi
movl 0x18(%r14), %r9d
movq %r13, %rdx
movq %rax, %rcx
xorl %r8d, %r8d
callq 0xe4c9a
movq %rbp, %rdi
callq 0xeb877
movq %rbx, %rdi
leaq 0x892fb(%rip), %rsi     # 0x1256b6
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
addq %r13, (%rsp)
movq %r15, %rdi
callq 0xf19d5
testl %eax, %eax
je 0x9c42d
leaq 0x700(%rip), %rax       # 0x9cadc
movq %rax, 0xa8(%r15)
movq %r15, %rdi
callq 0xf1a85
movq (%rsp), %rax
subq 0x18(%r15), %rax
movq %rax, 0x20(%r15)
movq %rbp, %rdi
callq 0xeaf3c
movl 0xc(%rsp), %esi
movq %rbx, %rdi
callq 0xdebb7
movq 0x20(%r15), %rax
testq %rax, %rax
jle 0x9c441
addq 0x10(%rsp), %rax
movq %rax, 0x10(%rsp)
incq %r12
jmp 0x9c278
testq %r15, %r15
jne 0x9c441
jmp 0x9c44c
movq %rbp, %rdi
callq 0xeaf3c
movl 0xc(%rsp), %esi
movq %rbx, %rdi
callq 0xdebb7
movq %rbx, %rdi
movq %r15, %rsi
callq 0xf167c
movq %rbx, %rdi
movq %r14, %rsi
callq 0xf16e7
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq