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

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

	while(1) {
		if(pos+CMZ_MINHEADERLEN >= c->infile->len) goto done;

		if(md) {
			de_arch_destroy_md(c, md);
			md = NULL;
		}
		md = de_arch_create_md(c, d);
		md->member_hdr_pos = pos;
		if(!do_cmz_member(c, d, md)) goto done;
		if(md->member_total_size<=0) goto done;
		pos += md->member_total_size;
	}

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

// 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 $0xd
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xe08d2
movl %eax, 0x18(%r14)
leaq 0x8(%rsp), %r13
xorl %r12d, %r12d
xorl %r15d, %r15d
leaq 0x15(%r12), %rax
movq 0x18(%rbx), %rcx
cmpq 0x18(%rcx), %rax
jge 0x6b2be
testq %r15, %r15
je 0x6b150
movq %rbx, %rdi
movq %r15, %rsi
callq 0xf167c
movq %rbx, %rdi
movq %r14, %rsi
callq 0xf1630
movq %rax, %r15
movq %r12, 0x18(%rax)
movq %rbx, %rdi
leaq 0x14(%rsp), %rsi
callq 0xdebae
movq 0x18(%r15), %rbp
movq %rbp, 0x8(%rsp)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x6dbc4
testl %eax, %eax
je 0x6b2c5
addq $0x4, %rbp
movq %rbp, 0x8(%rsp)
movq 0x18(%r15), %rdx
movq %rbx, %rdi
leaq 0xc36cb(%rip), %rsi     # 0x12e86d
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
pushq $0x1
popq %rsi
callq 0xdeba7
movq %r15, %rdi
movq %r13, %rsi
callq 0xf17ab
movq %r15, %rdi
movq %r13, %rsi
callq 0xf1766
movq 0x50(%r15), %rsi
addq $0x18, %rsi
movq %r14, %rdi
leaq 0x9ff0a(%rip), %rdx     # 0x10b0e6
pushq $0x3
popq %rcx
movq %r13, %r8
callq 0xf1866
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xe3fc4
cmpq $0x100, %rax            # imm = 0x100
jge 0x6b2e2
movq %rax, %rbp
movq 0x8(%rsp), %rsi
addq $0x2, %rsi
movq %rsi, 0x8(%rsp)
movq 0x18(%rbx), %rdi
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 0xc3824(%rip), %rsi     # 0x12ea5e
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
addq 0x8(%rsp), %rbp
movq %rbp, 0x8(%rsp)
movq %rbp, 0x40(%r15)
movq 0x30(%r15), %rcx
movq %rbx, %rdi
leaq 0xaddcb(%rip), %rsi     # 0x11902b
movq %rbp, %rdx
xorl %eax, %eax
callq 0xde896
movq %r15, %rdi
callq 0xf19d5
testl %eax, %eax
je 0x6b2fa
movq 0x30(%r15), %rax
addq 0x40(%r15), %rax
subq 0x18(%r15), %rax
movq %rax, 0x28(%r15)
leaq 0x247c(%rip), %rax      # 0x6d70d
movq %rax, 0xa8(%r15)
movq %r15, %rdi
callq 0xf1a85
movl 0x14(%rsp), %esi
movq %rbx, %rdi
callq 0xdebb7
movq 0x28(%r15), %rax
addq %rax, %r12
testq %rax, %rax
jg 0x6b12d
jmp 0x6b306
testq %r15, %r15
jne 0x6b306
jmp 0x6b311
cmpq $0x0, 0x18(%r15)
je 0x6b2e9
leaq 0xaddeb(%rip), %rsi     # 0x1190be
movq %rbx, %rdi
movq %rbp, %rdx
xorl %eax, %eax
callq 0xdf2a5
jmp 0x6b2fa
movb $0x1, 0x14(%r14)
jmp 0x6b2fa
leaq 0xaddbf(%rip), %rsi     # 0x1190af
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdf2a5
movl 0x14(%rsp), %esi
movq %rbx, %rdi
callq 0xdebb7
movq %rbx, %rdi
movq %r15, %rsi
callq 0xf167c
testq %r14, %r14
je 0x6b339
cmpb $0x0, 0x14(%r14)
je 0x6b32e
leaq 0xadd6f(%rip), %rsi     # 0x119093
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdf2a5
movq %rbx, %rdi
movq %r14, %rsi
callq 0xf16e7
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq