// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/corel.c
// Function: de_run_corel_ccx
static void de_run_corel_ccx(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	struct de_iffctx *ictx = NULL;

	d = de_malloc(c, sizeof(lctx));

	ictx = fmtutil_create_iff_decoder(c);
	ictx->is_le = 1;
	ictx->reversed_4cc = 0;
	ictx->userdata = (void*)d;
	ictx->handle_chunk_fn = my_ccx_chunk_handler;
	ictx->f = c->infile;

	fmtutil_read_iff_format(ictx, 0, c->infile->len);
	if(d->pack_pos) {
		de_dbg(c, "pack chunk found at %"I64_FMT, d->pack_pos);
		de_dbg_indent(c, 1);
		do_decompress(c, d);
		de_dbg_indent(c, -1);
	}

	fmtutil_destroy_iff_decoder(ictx);
	if(d) {
		if(!d->wrote_cmx_file) {
			de_err(c, "Cannot convert this CCX file. Try \"-m riff\" to decode.");
		}
		de_free(c, d);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %rbx
movl $0x20, %esi
callq 0xe8b2b
movq %rax, %r14
movq %rbx, %rdi
callq 0x1075c0
movq %rax, %r15
movl $0x1, 0x58(%rax)
movb $0x0, 0x5c(%rax)
movq %r14, 0x10(%rax)
leaq 0x31a(%rip), %rax       # 0x55414
movq %rax, 0x20(%r15)
movq 0x18(%rbx), %rax
movq %rax, 0x18(%r15)
movq 0x18(%rax), %rdx
movq %r15, %rdi
xorl %esi, %esi
callq 0x1075e4
movq (%r14), %rdx
testq %rdx, %rdx
je 0x552aa
leaq 0xcb96d(%rip), %rsi     # 0x120a94
xorl %r13d, %r13d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x8(%r14), %rax
movq %rax, 0x8(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
cmpq $0xc, 0x10(%r14)
jl 0x5528a
movq 0x18(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0xeed83
movq %rax, %rbp
leaq 0xcb96e(%rip), %rsi     # 0x120ae3
xorl %r13d, %r13d
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
cmpq $0x5f5e100, %rbp        # imm = 0x5F5E100
jg 0x5528a
movq 0x18(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0xeed31
cmpl $0x43506e67, %eax       # imm = 0x43506E67
jne 0x55271
addq $0x4, 0x8(%rsp)
movq %rbp, %rdi
callq 0xe9c7e
movq 0x8(%rsp), %rcx
movq 0x8(%r14), %r13
subq %rcx, %r13
addq 0x10(%r14), %r13
testq %r13, %r13
jle 0x55287
movq %rbx, %rdi
movq %rax, %rsi
movl $0x1, %edx
movq %rax, 0x10(%rsp)
movq %rcx, 0x18(%rsp)
callq 0xf09c5
movq %rax, %r12
leaq 0x48(%rsp), %rsi
leaq 0x30(%rsp), %rdx
leaq 0x68(%rsp), %rcx
movq %rbx, %rdi
callq 0xfa1dc
movq 0x18(%rbx), %rax
leaq 0x48(%rsp), %rsi
movq %rax, (%rsi)
movq 0x18(%rsp), %rax
movq %rax, 0x8(%rsi)
movq %r13, 0x10(%rsi)
leaq 0x30(%rsp), %rdx
movq %r12, (%rdx)
movb $0x1, 0x8(%rdx)
movq %rbp, 0x10(%rdx)
leaq 0x20(%rsp), %r8
movl $0x1, (%r8)
movq %rbx, %rdi
leaq 0x68(%rsp), %r13
movq %r13, %rcx
callq 0x10058f
cmpl $0x0, (%r13)
je 0x552e7
leaq 0x78(%rsp), %rdx
leaq 0xbfafd(%rip), %rsi     # 0x114d5f
xorl %r13d, %r13d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
jmp 0x5528d
leaq 0xcb88c(%rip), %rsi     # 0x120b04
xorl %r13d, %r13d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
jmp 0x5528a
xorl %r13d, %r13d
xorl %r12d, %r12d
movq %r12, %rdi
callq 0xf052b
movq %r13, %rdi
callq 0xf052b
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq %r15, %rdi
callq 0x1075d3
cmpl $0x0, 0x18(%r14)
jne 0x552ca
leaq 0xcb7ec(%rip), %rsi     # 0x120aac
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe8be2
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%rsp), %r13
movq 0x18(%r12), %rcx
cmpq %rbp, %rcx
jge 0x5530a
leaq 0xcb826(%rip), %rsi     # 0x120b23
movq %rbx, %rdi
movq %rbp, %rdx
xorl %eax, %eax
callq 0xe8faa
movq %r12, %rdi
movq %r13, %rsi
callq 0xf0f27
movq 0x8(%r14), %rbp
movq 0x10(%r14), %rdi
callq 0xe9c7e
addq %rax, %rbp
movq 0x18(%rbx), %rax
movq 0x18(%rax), %rdi
subq %rbp, %rdi
callq 0xe9c7e
movq %rax, 0x18(%rsp)
movq 0x18(%r12), %rdx
movq (%r14), %rcx
addq %rax, %rcx
leaq (%rdx,%rcx), %rax
addq $-0x8, %rax
movq %rax, 0x10(%rsp)
leaq 0xcb806(%rip), %rsi     # 0x120b5f
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xefda1
movq %rax, %r13
movl $0x1, 0x18(%r14)
movl $0x52494646, %esi       # imm = 0x52494646
movq %rax, %rdi
callq 0xf1026
movq %r13, %rdi
movq 0x10(%rsp), %rsi
callq 0xf1042
movl $0x434d5831, %esi       # imm = 0x434D5831
movq %r13, %rdi
callq 0xf1026
movq 0x18(%rbx), %rdi
movq (%r14), %rdx
addq $-0xc, %rdx
movl $0xc, %esi
movq %r13, %rcx
callq 0xef481
movq 0x18(%r12), %rdx
movq %r12, %rdi
xorl %esi, %esi
movq %r13, %rcx
callq 0xef481
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
movq 0x18(%rsp), %rdx
movq %r13, %rcx
callq 0xef481
jmp 0x5528d