// File: /workspace/github_c_makefile_star2_O1/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 0xe969b
movq %rax, %rbp
movq %rax, %r14
movq 0x18(%rbx), %rdi
leaq 0xd3d83(%rip), %rdx     # 0x11e1ab
movl $0x4, %ecx
xorl %esi, %esi
callq 0xf025e
testl %eax, %eax
je 0x4a452
movq 0x18(%rbx), %rdi
xorl %esi, %esi
callq 0x4ab14
movl %eax, (%r14)
cmpl $0x2, %eax
jne 0x4a459
movb $0x1, 0x7(%r14)
jmp 0x4a459
movl $0x3, (%r14)
movl (%r14), %eax
leal -0x1(%rax), %ecx
cmpl $0x2, %ecx
jae 0x4a5a8
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)
cmpl $0x3, %eax
leaq 0xd3dae(%rip), %rax     # 0x11e24d
leaq 0xf0028(%rip), %rdx     # 0x13a4ce
cmoveq %rax, %rdx
cmpb $0x0, 0x7(%r14)
leaq 0xc9169(%rip), %rax     # 0x11361f
leaq 0xfa713(%rip), %rcx     # 0x144bd0
cmoveq %rax, %rcx
leaq 0xd3d6a(%rip), %rsi     # 0x11e232
movq %rbx, %rdi
xorl %eax, %eax
callq 0xeb703
leaq 0x8(%rsp), %rax
movq $0x0, (%rax)
addq $0x40, %rbp
movq %rbp, 0x18(%rsp)
leaq 0xd3e76(%rip), %r12     # 0x11e364
leaq 0x20(%rsp), %r13
movq %r14, %r15
xorl %ebp, %ebp
movq 0x18(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0xef14d
andb $0x3f, %al
movq %rbx, %r14
movzbl %al, %ebx
movl $0x1e, %edi
xorl %esi, %esi
movl %ebx, %edx
callq 0xecac6
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 0xe8d67
movl 0x40(%r15,%rbp,4), %edx
movq %r14, %rdi
movq %rbp, %rsi
movq %r13, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xe9c1e
incq %rbp
cmpq $0x10, %rbp
jne 0x4a4f8
cmpb $0x0, 0x7(%r15)
je 0x4a708
movl $0x100, %esi            # imm = 0x100
addq 0x38(%r15), %rsi
xorl %r13d, %r13d
movq %rbx, %rdi
xorl %edx, %edx
callq 0xf0faf
movq %rax, %r12
movl $0x10, %edx
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rcx
callq 0x4ac9c
testl %eax, %eax
movq %r12, 0x10(%rsp)
jne 0x4a71b
xorl %ebp, %ebp
xorl %r12d, %r12d
jmp 0x4a808
cmpl $0x3, %eax
jne 0x4a6f2
leaq 0x20(%rsp), %r15
movq $0x4, (%r15)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef1ed
movq %rax, 0x10(%r14)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef1ed
movq %rax, 0x18(%r14)
movq 0x10(%r14), %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0xe9b05
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef14d
movb %al, 0x4(%r14)
movzbl %al, %edx
leaq 0xd3bb6(%rip), %rsi     # 0x11e1bc
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movzbl 0x4(%r14), %edx
movl %edx, %eax
orl $0x4, %eax
cmpl $0xaf, %eax
jne 0x4a84a
movq 0x18(%rbx), %rdi
leaq 0x20(%rsp), %rsi
callq 0xef14d
movb %al, 0x5(%r14)
movzbl %al, %edx
leaq 0xcab5c(%rip), %rsi     # 0x11519d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movb 0x5(%r14), %al
testb %al, %al
jns 0x4a658
movb $0x1, 0x7(%r14)
testb $0x40, %al
je 0x4a661
movb $0x1, 0x9(%r14)
testb $0x20, %al
je 0x4a66a
movb $0x1, 0x8(%r14)
andb $0xf, %al
movb %al, 0x6(%r14)
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movzbl 0x6(%r14), %edx
leaq 0xefddf(%rip), %rsi     # 0x13a468
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
cmpl $0x3, (%r14)
leaq 0xd3ba2(%rip), %rax     # 0x11e24d
leaq 0xefe1c(%rip), %rdx     # 0x13a4ce
cmoveq %rax, %rdx
cmpb $0x0, 0x7(%r14)
leaq 0xc8f5d(%rip), %rax     # 0x11361f
leaq 0xfa507(%rip), %rcx     # 0x144bd0
cmoveq %rax, %rcx
leaq 0xd3b5e(%rip), %rsi     # 0x11e232
movq %rbx, %rdi
xorl %eax, %eax
callq 0xeb703
cmpb $0x0, 0x8(%r14)
je 0x4a85d
leaq 0xd3ae1(%rip), %rsi     # 0x11e1d1
jmp 0x4a6f9
leaq 0xd3a90(%rip), %rsi     # 0x11e189
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
jmp 0x4a830
movq 0x18(%rbx), %r12
movl $0x10, %r13d
movq $0x0, 0x10(%rsp)
movq 0x38(%r15), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0xf0faf
movq %rax, %rbp
movl $0x6d60, %edx           # imm = 0x6D60
movq %r12, %rdi
movq %r13, %rsi
movq %rax, %rcx
callq 0xefabc
leaq 0xdac0(%r13), %rsi
movl $0x6d60, %edx           # imm = 0x6D60
movq %r12, %rdi
movq %rbp, %rcx
callq 0xefabc
leaq 0x6d60(%r13), %rsi
movl $0x6d60, %edx           # imm = 0x6D60
movq %r12, %rdi
movq %rbp, %rcx
callq 0xefabc
orq $0x14820, %r13          # imm = 0x14820
movl $0x6d60, %edx           # imm = 0x6D60
movq %r12, %rdi
movq %r13, %rsi
movq %rbp, %rcx
callq 0xefabc
movq 0x10(%r15), %rsi
movq 0x18(%r15), %rdx
movq %rbx, %rdi
movl $0x3, %ecx
callq 0xf2cab
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 0xf36f9
addq $0x10, %rsp
movq %rbx, %rdi
callq 0xea9a9
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 0xf2917
movq %r13, %rdi
callq 0xf28d4
movq 0x10(%rsp), %rdi
callq 0xf0b13
movq %rbp, %rdi
callq 0xf0b13
movq %rbx, %rdi
movq %r12, %rsi
callq 0xea9b3
movq %r15, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe9752
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xd395f(%rip), %rsi     # 0x11e1b0
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
jmp 0x4a830
cmpb $0x0, 0x9(%r14)
je 0x4a892
movq 0x18(%rbx), %rdi
leaq 0x20(%rsp), %r15
movq %r15, %rsi
callq 0xef1ed
movq %rax, %r12
movq (%r15), %rdx
leaq 0xd396d(%rip), %rsi     # 0x11e1ef
movq %rbx, %rdi
movq %rax, %rcx
xorl %eax, %eax
callq 0xe9226
addq %r12, (%r15)
movq 0x20(%rsp), %rdx
addq $0x40, %rbp
cmpb $-0x55, 0x4(%r14)
movq 0x18(%rbx), %rsi
jne 0x4a8d2
subq $0x8, %rsp
movl $0x10, %ecx
movl $0x3, %r8d
movq %rbx, %rdi
movq %rbp, %r9
pushq $0x0
pushq $0x2
pushq $0x10
callq 0xf32f2
addq $0x20, %rsp
movl $0x30, %r12d
jmp 0x4a8ff
subq $0x8, %rsp
movl $0x100, %ecx            # imm = 0x100
movl $0x3, %r8d
movq %rbx, %rdi
movq %rbp, %r9
pushq $0x0
pushq $0x2
pushq $0x100                  # imm = 0x100
callq 0xf32f2
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 0x4a9ef
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0xe958c
leaq 0xe3bea(%rip), %rsi     # 0x12e518
xorl %r13d, %r13d
movq %rbx, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq 0x10(%r14), %rsi
movq 0x18(%r14), %rdx
movq %rbx, %rdi
callq 0xf241d
testl %eax, %eax
je 0x4aa03
cmpb $0x4, 0x6(%r14)
movq 0x10(%r14), %rdi
jne 0x4a985
movl $0x8, %esi
callq 0xea80b
movq %rax, %rdi
shrq $0x3f, %rdi
addq %rax, %rdi
sarq %rdi
movq %rdi, 0x20(%r14)
testq %rdi, %rdi
jle 0x4aa00
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 0xf2cab
movq %rax, %r13
cmpb $0x0, 0x7(%r14)
je 0x4aa07
movl $0x100, %esi            # imm = 0x100
addq 0x38(%r14), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0xf0faf
movq %r14, %rsi
movq %rax, %rbp
movq %rbx, %rdi
movq %r12, %rdx
movq %rax, %rcx
callq 0x4ac9c
testl %eax, %eax
je 0x4aa69
movq %rbp, %rdi
xorl %r12d, %r12d
jmp 0x4aa0d
movzbl 0x5(%r14), %edx
leaq 0xd3818(%rip), %rsi     # 0x11e213
jmp 0x4a851
xorl %r13d, %r13d
xorl %ebp, %ebp
jmp 0x4aa69
movq 0x18(%rbx), %rdi
xorl %ebp, %ebp
cmpb $0x4, 0x6(%r14)
movq 0x20(%r14), %rcx
jne 0x4aa3d
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 0xf36f9
jmp 0x4aa56
subq $0x8, %rsp
movl $0x8, %edx
movq %r12, %rsi
movq %r15, %r8
movq %r13, %r9
pushq $0x0
callq 0xf35b8
addq $0x10, %rsp
movq %r13, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0xf2923
movq %r13, %rdi
callq 0xf28d4
movq %rbp, %rdi
callq 0xf0b13
movl 0x8(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
jmp 0x4a830