// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/colorix.c
// Function: de_run_colorix
static void de_run_colorix(deark *c, de_module_params *mparams)
{
	struct colorix_ctx *d = NULL;

	d = de_malloc(c, sizeof(struct colorix_ctx));

	if(is_RIX3(c->infile)) {
		d->fmtver = RIXFMT_RIX3;
	}
	else {
		d->fmtver = detect_old_fmt(c->infile, 0);
		if(d->fmtver==RIXFMT_OLD_C) {
			d->is_compressed = 1;
		}
	}

	if(d->fmtver==RIXFMT_RIX3) {
		do_colorix_RIX3(c, d);
	}
	else if(d->fmtver==RIXFMT_OLD_U || d->fmtver==RIXFMT_OLD_C) {
		do_colorix_old_SCR(c, d);
	}
	else {
		de_err(c, "Unknown or unsupported RIX format");
		goto done;
	}

done:
	de_free(c, d);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movl $0x440, %esi            # imm = 0x440
callq 0xe8b2b
movq %rax, %rbp
movq %rax, %r14
movq 0x18(%rbx), %rdi
leaq 0xd3f27(%rip), %rdx     # 0x11e2bb
movl $0x4, %ecx
xorl %esi, %esi
callq 0xefc85
testl %eax, %eax
je 0x4a3e0
movq 0x18(%rbx), %rdi
xorl %esi, %esi
callq 0x4aa73
movl %eax, (%r14)
cmpl $0x2, %eax
je 0x4a52b
cmpl $0x1, %eax
jne 0x4a64a
cmpb $0x0, 0x7(%r14)
leaq 0xc92ff(%rip), %rax     # 0x1136cf
leaq 0xfacd9(%rip), %rcx     # 0x1450b0
cmoveq %rax, %rcx
jmp 0x4a537
movl $0x3, (%r14)
leaq 0x20(%rsp), %r15
movq $0x4, (%r15)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeebeb
movq %rax, 0x10(%r14)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeebeb
movq %rax, 0x18(%r14)
movq 0x10(%r14), %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0xe8f88
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeeb4b
movb %al, 0x4(%r14)
movzbl %al, %edx
leaq 0xd3e90(%rip), %rsi     # 0x11e2cc
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movzbl 0x4(%r14), %edx
movl %edx, %eax
orl $0x4, %eax
cmpl $0xaf, %eax
jne 0x4a78d
movq 0x18(%rbx), %rdi
leaq 0x20(%rsp), %rsi
callq 0xeeb4b
movb %al, 0x5(%r14)
movzbl %al, %edx
leaq 0xcadd6(%rip), %rsi     # 0x11524d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movb 0x5(%r14), %al
testb %al, %al
jns 0x4a48e
movb $0x1, 0x7(%r14)
testb $0x40, %al
je 0x4a497
movb $0x1, 0x9(%r14)
testb $0x20, %al
je 0x4a4a0
movb $0x1, 0x8(%r14)
andb $0xf, %al
movb %al, 0x6(%r14)
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movzbl 0x6(%r14), %edx
leaq 0xf0329(%rip), %rsi     # 0x13a7e8
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
cmpl $0x3, (%r14)
leaq 0xd3e7c(%rip), %rax     # 0x11e35d
leaq 0xf0366(%rip), %rdx     # 0x13a84e
cmoveq %rax, %rdx
cmpb $0x0, 0x7(%r14)
leaq 0xc91d7(%rip), %rax     # 0x1136cf
leaq 0xfabb1(%rip), %rcx     # 0x1450b0
cmoveq %rax, %rcx
leaq 0xd3e38(%rip), %rsi     # 0x11e342
movq %rbx, %rdi
xorl %eax, %eax
callq 0xeb152
cmpb $0x0, 0x8(%r14)
je 0x4a7a3
leaq 0xd3dbb(%rip), %rsi     # 0x11e2e1
jmp 0x4a651
movb $0x1, 0x7(%r14)
leaq 0xfab79(%rip), %rcx     # 0x1450b0
movb $0x1, 0x6(%r14)
movq $0x280, 0x10(%r14)      # imm = 0x280
movq $0x15e, 0x18(%r14)      # imm = 0x15E
movq $0x1b580, 0x38(%r14)    # imm = 0x1B580
movq $0x6d60, 0x28(%r14)     # imm = 0x6D60
movq $0x50, 0x20(%r14)
leaq 0xd3dd7(%rip), %rsi     # 0x11e342
leaq 0xf02dc(%rip), %rdx     # 0x13a84e
movq %rbx, %rdi
xorl %eax, %eax
callq 0xeb152
leaq 0x8(%rsp), %rax
movq $0x0, (%rax)
addq $0x40, %rbp
movq %rbp, 0x18(%rsp)
leaq 0xd3edc(%rip), %r12     # 0x11e474
leaq 0x20(%rsp), %r13
movq %r14, %r15
xorl %ebp, %ebp
movq 0x18(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0xeeb4b
andb $0x3f, %al
movq %rbx, %r14
movzbl %al, %ebx
movl $0x1e, %edi
xorl %esi, %esi
movl %ebx, %edx
callq 0xec464
movl %eax, 0x40(%r15,%rbp,4)
movl $0x20, %esi
movq %r13, %rdi
movq %r12, %rdx
movl %ebx, %ecx
movq %r14, %rbx
xorl %eax, %eax
callq 0xe8193
movl 0x40(%r15,%rbp,4), %edx
movq %r14, %rdi
movq %rbp, %rsi
movq %r13, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xe90a3
incq %rbp
cmpq $0x10, %rbp
jne 0x4a5a2
cmpb $0x0, 0x7(%r15)
je 0x4a660
movl $0x100, %esi            # imm = 0x100
addq 0x38(%r15), %rsi
xorl %r13d, %r13d
movq %rbx, %rdi
xorl %edx, %edx
callq 0xf09c5
movq %rax, %r12
movl $0x10, %edx
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rcx
callq 0x4abef
testl %eax, %eax
movq %r12, 0x10(%rsp)
jne 0x4a673
xorl %ebp, %ebp
xorl %r12d, %r12d
jmp 0x4a760
leaq 0xd3c48(%rip), %rsi     # 0x11e299
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
jmp 0x4a9d9
movq 0x18(%rbx), %r12
movl $0x10, %r13d
movq $0x0, 0x10(%rsp)
movq 0x38(%r15), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0xf09c5
movq %rax, %rbp
movl $0x6d60, %edx           # imm = 0x6D60
movq %r12, %rdi
movq %r13, %rsi
movq %rax, %rcx
callq 0xef481
leaq 0xdac0(%r13), %rsi
movl $0x6d60, %edx           # imm = 0x6D60
movq %r12, %rdi
movq %rbp, %rcx
callq 0xef481
leaq 0x6d60(%r13), %rsi
movl $0x6d60, %edx           # imm = 0x6D60
movq %r12, %rdi
movq %rbp, %rcx
callq 0xef481
orq $0x14820, %r13          # imm = 0x14820
movl $0x6d60, %edx           # imm = 0x6D60
movq %r12, %rdi
movq %r13, %rsi
movq %rbp, %rcx
callq 0xef481
movq 0x10(%r15), %rsi
movq 0x18(%r15), %rdx
movq %rbx, %rdi
movl $0x3, %ecx
callq 0xf266a
movq %rax, %r13
movq 0x20(%r15), %rcx
movl $0x4, %edx
movl $0x6d60, %r8d           # imm = 0x6D60
movq %rbp, %rdi
xorl %esi, %esi
movq 0x18(%rsp), %r9
pushq $0x2
pushq %rax
callq 0xf30b3
addq $0x10, %rsp
movq %rbx, %rdi
callq 0xea504
movq %rax, %r12
movl $0x1, 0x78(%rax)
movabsq $0x407e000000000000, %rax # imm = 0x407E000000000000
movq %rax, 0x80(%r12)
cvtsi2sdq 0x18(%r15), %xmm0
movsd %xmm0, 0x88(%r12)
movq %r13, %rdi
movq %r12, %rsi
movl $0x2, %edx
callq 0xf22d0
movq %r13, %rdi
callq 0xf228d
movq 0x10(%rsp), %rdi
callq 0xf052b
movq %rbp, %rdi
callq 0xf052b
movq %rbx, %rdi
movq %r12, %rsi
callq 0xea50e
movq %r15, %r14
jmp 0x4a9d9
leaq 0xd3b2c(%rip), %rsi     # 0x11e2c0
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
jmp 0x4a9d9
cmpb $0x0, 0x9(%r14)
je 0x4a7e0
movq 0x18(%rbx), %rdi
leaq 0x20(%rsp), %r12
movq %r12, %rsi
callq 0xeebeb
movq %rax, %r15
movq (%r12), %rdx
leaq 0xd3b36(%rip), %rsi     # 0x11e2ff
movq %rbx, %rdi
movq %rax, %rcx
xorl %eax, %eax
callq 0xe8617
addq (%r12), %r15
movq %r15, (%r12)
jmp 0x4a7e5
movq 0x20(%rsp), %r15
addq $0x40, %rbp
cmpb $-0x55, 0x4(%r14)
movq 0x18(%rbx), %rsi
jne 0x4a823
subq $0x8, %rsp
movl $0x10, %ecx
movl $0x3, %r8d
movq %rbx, %rdi
movq %r15, %rdx
movq %rbp, %r9
pushq $0x0
pushq $0x2
pushq $0x10
callq 0xf2cb1
addq $0x20, %rsp
movl $0x30, %r12d
jmp 0x4a853
subq $0x8, %rsp
movl $0x100, %ecx            # imm = 0x100
movl $0x3, %r8d
movq %rbx, %rdi
movq %r15, %rdx
movq %rbp, %r9
pushq $0x0
pushq $0x2
pushq $0x100                  # imm = 0x100
callq 0xf2cb1
addq $0x20, %rsp
movl $0x300, %r12d           # imm = 0x300
movq %r12, 0x30(%r14)
addq 0x20(%rsp), %r12
movq %r12, 0x20(%rsp)
movzbl 0x6(%r14), %eax
testb $-0x5, %al
jne 0x4a943
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0xe8a1c
leaq 0xe3f8e(%rip), %rsi     # 0x12e810
xorl %r13d, %r13d
movq %rbx, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x10(%r14), %rsi
movq 0x18(%r14), %rdx
movq %rbx, %rdi
callq 0xf1db1
testl %eax, %eax
je 0x4a957
cmpb $0x4, 0x6(%r14)
movq 0x10(%r14), %rdi
jne 0x4a8d9
movl $0x8, %esi
callq 0xe9cb4
movq %rax, %rdi
shrq $0x3f, %rdi
addq %rax, %rdi
sarq %rdi
movq %rdi, 0x20(%r14)
testq %rdi, %rdi
jle 0x4a954
movq %rbp, %r15
movq 0x10(%r14), %rsi
movq 0x18(%r14), %rdx
imulq %rdx, %rdi
movq %rdi, 0x38(%r14)
movq %rbx, %rdi
movl $0x3, %ecx
callq 0xf266a
movq %rax, %r13
cmpb $0x0, 0x7(%r14)
je 0x4a95b
movl $0x100, %esi            # imm = 0x100
addq 0x38(%r14), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0xf09c5
movq %r14, %rsi
movq %rax, %rbp
movq %rbx, %rdi
movq %r12, %rdx
movq %rax, %rcx
callq 0x4abef
testl %eax, %eax
je 0x4a9bd
movq %rbp, %rdi
xorl %r12d, %r12d
jmp 0x4a961
movzbl 0x5(%r14), %edx
leaq 0xd39d4(%rip), %rsi     # 0x11e323
jmp 0x4a794
xorl %r13d, %r13d
xorl %ebp, %ebp
jmp 0x4a9bd
movq 0x18(%rbx), %rdi
xorl %ebp, %ebp
cmpb $0x4, 0x6(%r14)
movq 0x20(%r14), %rcx
jne 0x4a991
leaq 0x3(%rcx), %r8
testq %rcx, %rcx
cmovnsq %rcx, %r8
sarq $0x2, %r8
movl $0x4, %edx
movq %r12, %rsi
movq %r15, %r9
pushq $0x2
pushq %r13
callq 0xf30b3
jmp 0x4a9aa
subq $0x8, %rsp
movl $0x8, %edx
movq %r12, %rsi
movq %r15, %r8
movq %r13, %r9
pushq $0x0
callq 0xf2f79
addq $0x10, %rsp
movq %r13, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0xf22dc
movq %r13, %rdi
callq 0xf228d
movq %rbp, %rdi
callq 0xf052b
movl 0x8(%rsp), %esi
movq %rbx, %rdi
callq 0xe8a25
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe8be2
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq