// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/misc3.c
// Function: de_run_mdcd
static void de_run_mdcd(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);
	d->crco = de_crcobj_create(c, DE_CRCOBJ_CRC16_XMODEM);

	while(1) {
		if(pos+MDCD_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_mdcd_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);
	}
	if(d) {
		if(d->need_errmsg) {
			de_err(c, "Bad or unsupported MDCD file");
		}
		de_arch_destroy_lctx(c, d);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
callq 0xfdb0a
movq %rax, %r12
movl $0x1, 0x10(%rax)
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %esi, %esi
movl $0xd, %edx
callq 0xeb7d1
movl %eax, 0x18(%r12)
movq %rbx, %rdi
movl $0x20, %esi
callq 0xeba56
movq %rax, 0x30(%r12)
movq 0x18(%rbx), %rax
cmpq $0x37, 0x18(%rax)
jl 0x6ee94
leaq 0x14(%rsp), %r13
leaq 0x8(%rsp), %r14
xorl %r15d, %r15d
xorl %ebp, %ebp
movq %r12, 0x18(%rsp)
testq %r15, %r15
je 0x6eac7
movq %rbx, %rdi
movq %r15, %rsi
callq 0xfdab8
movq %rbx, %rdi
movq %r12, %rsi
callq 0xfda6c
movq %rax, %r15
movq %rbp, 0x18(%rax)
movq %rbx, %rdi
movq %r13, %rsi
callq 0xe958c
movq 0x18(%r15), %rsi
movq %rsi, 0x8(%rsp)
movq 0x18(%rbx), %rdi
movl $0x4, %ecx
leaq 0xb751e(%rip), %rdx     # 0x12601b
callq 0xf025e
testl %eax, %eax
jne 0x6ee53
addq $0x4, 0x8(%rsp)
movq 0x18(%r15), %rdx
movq %rbx, %rdi
leaq 0xcccc5(%rip), %rsi     # 0x13b7e3
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
incq 0x8(%rsp)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef14d
movzbl %al, %r12d
movq %rbx, %rdi
leaq 0xb749a(%rip), %rsi     # 0x125feb
movl %r12d, %edx
xorl %eax, %eax
callq 0xe9226
cmpb $0x1, %r12b
jne 0x6ee48
movq %rbp, 0x20(%rsp)
movq %r13, %rbp
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef1ed
movq %rax, %r13
movq %rbx, %rdi
leaq 0xb75c2(%rip), %rsi     # 0x126148
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
cmpq $0x35, %r13
jle 0x6ee48
addq $0x10, 0x8(%rsp)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef14d
movzbl %al, %edx
movl %edx, 0x90(%r15)
movq %rbx, %rdi
leaq 0xb70bc(%rip), %rsi     # 0x125c7c
xorl %eax, %eax
callq 0xe9226
movq %r15, %rdi
movq %r14, %rsi
callq 0xfdb9b
movq %r15, %rdi
movq %r14, %rsi
callq 0xfdbe0
movq 0x18(%r15), %rax
addq %r13, %rax
movq %rax, 0x40(%r15)
movq %r15, %rdi
callq 0xfde12
testl %eax, %eax
je 0x6ee83
movq 0x30(%r15), %rax
addq %r13, %rax
movq %rax, 0x28(%r15)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef1ed
movq %r15, %rdi
movl %eax, %esi
callq 0xfdc20
movq 0x50(%r15), %rsi
addq $0x18, %rsi
movq 0x18(%rsp), %r12
movq %r12, %rdi
leaq 0xa946e(%rip), %rdx     # 0x11809e
movl $0x4, %ecx
movq %r14, %r8
callq 0xfdc9b
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef1ed
movl %eax, 0x48(%r15)
movq %rbx, %rdi
leaq 0xd5cf5(%rip), %rsi     # 0x14494c
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef14d
cmpb $0xd, %al
jb 0x6ec88
movb $0x1, 0x14(%r12)
leaq 0x8(%rsp), %r14
movq %rbp, %r13
movq 0x20(%rsp), %rbp
jmp 0x6ee18
movzbl %al, %r14d
movq %rbx, %rdi
callq 0xf6870
movq %rax, 0x68(%r15)
movq 0x18(%rbx), %rdi
movq 0x8(%rsp), %rsi
movl 0x18(%r12), %r9d
movq %r14, %rdx
movq %rax, %rcx
xorl %r8d, %r8d
callq 0xf01b0
movq 0x68(%r15), %rdi
callq 0xf7557
movq %rbx, %rdi
leaq 0xccd0d(%rip), %rsi     # 0x13b9d4
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
addq $0xc, 0x8(%rsp)
cmpq $0x36, %r13
jne 0x6ece2
xorl %r12d, %r12d
jmp 0x6ecf4
movq 0x18(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0xef14d
movzbl %al, %r12d
movq 0x20(%rsp), %rbp
movq %rbx, %rdi
callq 0xf6870
movq %rax, 0x70(%r15)
movq 0x18(%rbx), %rdi
movq 0x8(%rsp), %rsi
movq 0x18(%rsp), %rcx
movl 0x18(%rcx), %r9d
movq %r12, %rdx
movq %rax, %rcx
xorl %r8d, %r8d
callq 0xf01b0
movq 0x70(%r15), %rdi
callq 0xf7557
movq %rbx, %rdi
leaq 0xd5111(%rip), %rsi     # 0x143e49
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x70(%r15), %rdi
callq 0xf6c00
testl %eax, %eax
leaq 0x14(%rsp), %r13
je 0x6ed9d
movq 0x70(%r15), %rdi
movq 0x10(%rdi), %rax
testq %rax, %rax
jle 0x6ed71
movq 0x8(%rdi), %rcx
movl (%rcx), %ecx
cmpl $0x2f, %ecx
je 0x6ed9d
cmpl $0x5c, %ecx
je 0x6ed9d
cmpq $0x2, %rax
jl 0x6ed81
movq 0x8(%rdi), %rax
cmpl $0x3a, 0x4(%rax)
je 0x6ed9d
movl $0x1, %esi
callq 0xfdb50
movq 0x58(%r15), %rdi
movq 0x70(%r15), %rsi
callq 0xf6969
orb $0x1, 0x78(%r15)
movq 0x58(%r15), %rdi
movq 0x68(%r15), %rsi
callq 0xf6969
movq 0x30(%r15), %rcx
movq 0x40(%r15), %rdx
movq %rbx, %rdi
leaq 0xb723f(%rip), %rsi     # 0x125ffb
xorl %eax, %eax
callq 0xe9226
movl 0x90(%r15), %edx
cmpl $0x2, %edx
leaq 0x8(%rsp), %r14
movq 0x18(%rsp), %r12
jb 0x6edec
movq %rbx, %rdi
leaq 0xa49bf(%rip), %rsi     # 0x1137a2
xorl %eax, %eax
callq 0xe9df7
jmp 0x6ee18
leaq 0x2ebf(%rip), %rax      # 0x71cb2
movq %rax, 0xa8(%r15)
movb $0x1, 0xa1(%r15)
orl 0x48(%r15), %edx
jne 0x6ee10
movb $0x1, 0xa2(%r15)
movq %r15, %rdi
callq 0xfdec1
movl 0x14(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
movq 0x28(%r15), %rax
testq %rax, %rax
jle 0x6ee94
leaq (%rax,%rbp), %rcx
addq $0x36, %rcx
addq %rax, %rbp
movq 0x18(%rbx), %rax
cmpq 0x18(%rax), %rcx
jl 0x6eab7
jmp 0x6ee94
movq 0x18(%rsp), %rax
movb $0x1, 0x14(%rax)
jmp 0x6ee83
cmpq $0x0, 0x18(%r15)
je 0x6ee72
movq 0x8(%rsp), %rdx
leaq 0xb716b(%rip), %rsi     # 0x125fd1
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
jmp 0x6ee83
leaq 0xb7147(%rip), %rsi     # 0x125fc0
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
movl 0x14(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
movq 0x18(%rsp), %r12
testq %r15, %r15
je 0x6eea4
movq %rbx, %rdi
movq %r15, %rsi
callq 0xfdab8
testq %r12, %r12
je 0x6eecd
cmpb $0x0, 0x14(%r12)
je 0x6eec2
leaq 0xb70eb(%rip), %rsi     # 0x125fa3
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
movq %rbx, %rdi
movq %r12, %rsi
callq 0xfdb25
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq