// File: /workspace/github_c_makefile_star2_O1/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 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)
movq 0x18(%rbx), %rax
cmpq $0x16, 0x18(%rax)
jl 0x6f2fa
leaq 0x8(%rsp), %rbp
xorl %r15d, %r15d
xorl %r13d, %r13d
testq %r15, %r15
je 0x6f12c
movq %rbx, %rdi
movq %r15, %rsi
callq 0xfdab8
movq %rbx, %rdi
movq %r14, %rsi
callq 0xfda6c
movq %rax, %r15
movq %r13, 0x18(%rax)
movq %rbx, %rdi
leaq 0x14(%rsp), %rsi
callq 0xe958c
movq 0x18(%r15), %rsi
movq %rsi, 0x8(%rsp)
movq 0x18(%rbx), %rdi
movl $0x4, %ecx
leaq 0xb6f40(%rip), %rdx     # 0x1260a4
callq 0xf025e
testl %eax, %eax
jne 0x6f2b7
addq $0x4, 0x8(%rsp)
movq 0x18(%r15), %rdx
movq %rbx, %rdi
leaq 0xcc65e(%rip), %rsi     # 0x13b7e3
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq %r15, %rdi
movq %rbp, %rsi
callq 0xfdbe0
movq %r15, %rdi
movq %rbp, %rsi
callq 0xfdb9b
movq 0x50(%r15), %rsi
addq $0x18, %rsi
movq %r14, %rdi
leaq 0xa8edd(%rip), %rdx     # 0x11809e
movl $0x3, %ecx
movq %rbp, %r8
callq 0xfdc9b
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xef1ed
cmpq $0x100, %rax            # imm = 0x100
jge 0x6f2d6
movq %rax, %r12
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 0xf01b0
movq 0x58(%r15), %rdi
callq 0xf7557
movq %rbx, %rdi
leaq 0xcc7b3(%rip), %rsi     # 0x13b9d4
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
addq 0x8(%rsp), %r12
movq %r12, 0x8(%rsp)
movq %r12, 0x40(%r15)
movq 0x30(%r15), %rcx
movq %rbx, %rdi
leaq 0xb6db4(%rip), %rsi     # 0x125ffb
movq %r12, %rdx
xorl %eax, %eax
callq 0xe9226
movq %r15, %rdi
callq 0xfde12
testl %eax, %eax
je 0x6f2ee
movq 0x30(%r15), %rax
addq 0x40(%r15), %rax
subq 0x18(%r15), %rax
movq %rax, 0x28(%r15)
leaq 0x261f(%rip), %rax      # 0x71897
movq %rax, 0xa8(%r15)
movq %r15, %rdi
callq 0xfdec1
movl 0x14(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
movq 0x28(%r15), %rax
testq %rax, %rax
jle 0x6f2fa
leaq (%rax,%r13), %rcx
addq $0x15, %rcx
addq %rax, %r13
movq 0x18(%rbx), %rax
cmpq 0x18(%rax), %rcx
jl 0x6f11c
jmp 0x6f2fa
cmpq $0x0, 0x18(%r15)
je 0x6f2dd
movq 0x8(%rsp), %rdx
leaq 0xb6dc4(%rip), %rsi     # 0x12608e
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
jmp 0x6f2ee
movb $0x1, 0x14(%r14)
jmp 0x6f2ee
leaq 0xb6d9b(%rip), %rsi     # 0x12607f
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
movl 0x14(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
testq %r15, %r15
je 0x6f30a
movq %rbx, %rdi
movq %r15, %rsi
callq 0xfdab8
testq %r14, %r14
je 0x6f332
cmpb $0x0, 0x14(%r14)
je 0x6f327
leaq 0xb6d46(%rip), %rsi     # 0x126063
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
movq %rbx, %rdi
movq %r14, %rsi
callq 0xfdb25
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq