// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc3.c
// Function: de_run_hta
static void de_run_hta(deark *c, de_module_params *mparams)
{
	struct de_arch_member_data *md = NULL;
	i64 pos;
	i64 num_members;
	UI fmtver;
	i64 idx;
	de_arch_lctx *d = NULL;
	int saved_indent_level;
	i64 tracking_dpos = 0;
	struct fmtutil_fmtid_ctx *idctx = NULL;

	de_dbg_indent_save(c, &saved_indent_level);

	d = de_arch_create_lctx(c);
	d->is_le = 1;
	idctx = de_malloc(c, sizeof(struct fmtutil_fmtid_ctx));

	pos = 8;
	fmtver = (UI)de_getu32le_p(&pos);
	de_dbg(c, "format version: %u", fmtver);
	if(fmtver!=100) { d->need_errmsg = 1; goto done; }
	num_members = de_getu32le_p(&pos);
	de_dbg(c, "number of members: %"I64_FMT, num_members);
	if(pos+num_members*8 > c->infile->len) { d->need_errmsg = 1; goto done; }

	for(idx=0; idx<num_members; idx++) {
		i64 endpos;

		if(md) {
			de_arch_destroy_md(c, md);
			md = NULL;
		}
		md = de_arch_create_md(c, d);
		de_dbg(c, "member[%"I64_FMT"]", idx);
		de_dbg_indent(c, 1);

		md->cmpr_pos = de_getu32le_p(&pos);
		de_dbg(c, "data pos: %"I64_FMT, md->cmpr_pos);
		de_arch_read_field_orig_len_p(md, &pos);
		md->cmpr_len = md->orig_len;

		if(md->cmpr_pos < tracking_dpos) { d->need_errmsg = 1; goto done; }
		endpos = md->cmpr_pos + md->cmpr_len;
		if(endpos > c->infile->len) { d->need_errmsg = 1; goto done; }
		tracking_dpos = endpos;

		de_zeromem(idctx, sizeof(struct fmtutil_fmtid_ctx));
		idctx->inf = c->infile;
		idctx->inf_pos = md->cmpr_pos;
		idctx->inf_len = md->cmpr_len;
		idctx->mode = FMTUTIL_FMTIDMODE_ALL_IMG;
		fmtutil_fmtid(c, idctx);

		de_finfo_set_name_from_sz(c, md->fi, idctx->ext_sz, 0, DE_ENCODING_LATIN1);
		md->dfn = noncompressed_decompressor_fn;
		de_arch_extract_member_file(md);

		de_dbg_indent(c, -1);
	}

done:
	if(md) {
		de_arch_destroy_md(c, md);
		md = NULL;
	}
	if(d) {
		if(d->need_errmsg) {
			de_err(c, "Bad or unsupported HTA file");
		}
		de_arch_destroy_lctx(c, d);
	}
	de_free(c, idctx);
	de_dbg_indent_restore(c, saved_indent_level);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq 0x4(%rsp), %rsi
callq 0xdebae
movq %rbx, %rdi
callq 0xf16ce
movq %rax, %r14
movl $0x1, 0x10(%rax)
pushq $0x78
popq %rsi
movq %rbx, %rdi
callq 0xdecaf
movq %rax, %r15
leaq 0x8(%rsp), %rsi
movq $0x8, (%rsi)
movq 0x18(%rbx), %rdi
callq 0xe40bf
movq %rax, %r12
leaq 0x9ac09(%rip), %rsi     # 0x1070b7
movq %rbx, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0xde896
cmpl $0x64, %r12d
jne 0x6c4ff
movq 0x18(%rbx), %rdi
leaq 0x8(%rsp), %r13
movq %r13, %rsi
callq 0xe40bf
movq %rax, %r12
leaq 0x9b1d0(%rip), %rsi     # 0x1076ac
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
leaq (,%r12,8), %rax
addq (%r13), %rax
movq 0x18(%rbx), %rcx
cmpq 0x18(%rcx), %rax
jle 0x6c546
movb $0x1, 0x14(%r14)
leaq 0xaceb4(%rip), %rsi     # 0x1193bf
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdf2a5
movq %rbx, %rdi
movq %r14, %rsi
callq 0xf16e7
movq %rbx, %rdi
movq %r15, %rsi
callq 0xded32
movl 0x4(%rsp), %esi
movq %rbx, %rdi
callq 0xdebb7
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rax
addq $0x6c, %rax
movq %rax, 0x10(%rsp)
xorl %eax, %eax
testq %r12, %r12
cmovleq %rax, %r12
xorl %r13d, %r13d
xorl %eax, %eax
xorl %ebp, %ebp
movq %r12, 0x18(%rsp)
cmpq %r13, %r12
je 0x6c6b8
movq %rax, 0x20(%rsp)
testq %rbp, %rbp
je 0x6c585
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xf167c
movq %rbx, %rdi
movq %r14, %r12
movq %r14, %rsi
callq 0xf1630
movq %rax, %rbp
movq %rbx, %rdi
leaq 0xace13(%rip), %rsi     # 0x1193b3
movq %r13, %rdx
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
pushq $0x1
popq %rsi
callq 0xdeba7
movq 0x18(%rbx), %rdi
leaq 0x8(%rsp), %r14
movq %r14, %rsi
callq 0xe40bf
movq %rax, 0x40(%rbp)
movq %rbx, %rdi
leaq 0xac861(%rip), %rsi     # 0x118e35
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
movq %rbp, %rdi
movq %r14, %rsi
callq 0xf1766
movq 0x38(%rbp), %rax
movq 0x40(%rbp), %r14
movq %rax, 0x30(%rbp)
cmpq 0x20(%rsp), %r14
jl 0x6c6ad
addq %rax, %r14
movq 0x18(%rbx), %rax
cmpq 0x18(%rax), %r14
jg 0x6c6ad
xorps %xmm0, %xmm0
movups %xmm0, 0x60(%r15)
movups %xmm0, 0x50(%r15)
movups %xmm0, 0x40(%r15)
movups %xmm0, 0x30(%r15)
movups %xmm0, 0x20(%r15)
movups %xmm0, 0x10(%r15)
andq $0x0, 0x70(%r15)
movups %xmm0, (%r15)
movq 0x18(%rbx), %rax
movq %rax, 0x10(%r15)
movq 0x40(%rbp), %rax
movq %rax, 0x18(%r15)
movq 0x30(%rbp), %rax
movq %rax, 0x20(%r15)
movb $0x1, (%r15)
movq %rbx, %rdi
movq %r15, %rsi
callq 0xee4da
movq 0x50(%rbp), %rsi
movq %rbx, %rdi
movq 0x10(%rsp), %rdx
xorl %ecx, %ecx
pushq $0x5
popq %r8
callq 0xdffbd
leaq 0x148b(%rip), %rax      # 0x6db0b
movq %rax, 0xa8(%rbp)
movq %rbp, %rdi
callq 0xf1a85
movq %rbx, %rdi
pushq $-0x1
popq %rsi
callq 0xdeba7
incq %r13
movq %r14, %rax
movq %r12, %r14
movq 0x18(%rsp), %r12
jmp 0x6c567
movq %r12, %r14
movb $0x1, 0x14(%r12)
jmp 0x6c6bd
testq %rbp, %rbp
je 0x6c6c8
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xf167c
testq %r14, %r14
je 0x6c520
cmpb $0x0, 0x14(%r14)
jne 0x6c504
jmp 0x6c515