// File: /workspace/github_c_makefile_star2_O1/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 0xe969b
movq %rax, %r14
movq %rbx, %rdi
callq 0x107b04
movq %rax, %r15
movl $0x1, 0x58(%rax)
movb $0x0, 0x5c(%rax)
movq %r14, 0x10(%rax)
leaq 0x31a(%rip), %rax       # 0x554ed
movq %rax, 0x20(%r15)
movq 0x18(%rbx), %rax
movq %rax, 0x18(%r15)
movq 0x18(%rax), %rdx
movq %r15, %rdi
xorl %esi, %esi
callq 0x107b28
movq (%r14), %rdx
testq %rdx, %rdx
je 0x55383
leaq 0xcb76c(%rip), %rsi     # 0x12096c
xorl %r13d, %r13d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq 0x8(%r14), %rax
movq %rax, 0x8(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
cmpq $0xc, 0x10(%r14)
jl 0x55363
movq 0x18(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0xef3a0
movq %rax, %rbp
leaq 0xcb76d(%rip), %rsi     # 0x1209bb
xorl %r13d, %r13d
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
cmpq $0x5f5e100, %rbp        # imm = 0x5F5E100
jg 0x55363
movq 0x18(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0xef34e
cmpl $0x43506e67, %eax       # imm = 0x43506E67
jne 0x5534a
addq $0x4, 0x8(%rsp)
movq %rbp, %rdi
callq 0xea7d5
movq 0x8(%rsp), %rcx
movq 0x8(%r14), %r13
subq %rcx, %r13
addq 0x10(%r14), %r13
testq %r13, %r13
jle 0x55360
movq %rbx, %rdi
movq %rax, %rsi
movl $0x1, %edx
movq %rax, 0x10(%rsp)
movq %rcx, 0x18(%rsp)
callq 0xf0faf
movq %rax, %r12
leaq 0x48(%rsp), %rsi
leaq 0x30(%rsp), %rdx
leaq 0x68(%rsp), %rcx
movq %rbx, %rdi
callq 0xfa6e0
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 0x100d13
cmpl $0x0, (%r13)
je 0x553c0
leaq 0x78(%rsp), %rdx
leaq 0xbf974(%rip), %rsi     # 0x114caf
xorl %r13d, %r13d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
jmp 0x55366
leaq 0xcb68b(%rip), %rsi     # 0x1209dc
xorl %r13d, %r13d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
jmp 0x55363
xorl %r13d, %r13d
xorl %r12d, %r12d
movq %r12, %rdi
callq 0xf0b13
movq %r13, %rdi
callq 0xf0b13
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movq %r15, %rdi
callq 0x107b17
cmpl $0x0, 0x18(%r14)
jne 0x553a3
leaq 0xcb5eb(%rip), %rsi     # 0x120984
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe9752
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 0x553e3
leaq 0xcb625(%rip), %rsi     # 0x1209fb
movq %rbx, %rdi
movq %rbp, %rdx
xorl %eax, %eax
callq 0xe9b27
movq %r12, %rdi
movq %r13, %rsi
callq 0xf152a
movq 0x8(%r14), %rbp
movq 0x10(%r14), %rdi
callq 0xea7d5
addq %rax, %rbp
movq 0x18(%rbx), %rax
movq 0x18(%rax), %rdi
subq %rbp, %rdi
callq 0xea7d5
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 0xcb605(%rip), %rsi     # 0x120a37
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xf037a
movq %rax, %r13
movl $0x1, 0x18(%r14)
movl $0x52494646, %esi       # imm = 0x52494646
movq %rax, %rdi
callq 0xf1629
movq %r13, %rdi
movq 0x10(%rsp), %rsi
callq 0xf1645
movl $0x434d5831, %esi       # imm = 0x434D5831
movq %r13, %rdi
callq 0xf1629
movq 0x18(%rbx), %rdi
movq (%r14), %rdx
addq $-0xc, %rdx
movl $0xc, %esi
movq %r13, %rcx
callq 0xefabc
movq 0x18(%r12), %rdx
movq %r12, %rdi
xorl %esi, %esi
movq %r13, %rcx
callq 0xefabc
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
movq 0x18(%rsp), %rdx
movq %r13, %rcx
callq 0xefabc
jmp 0x55366