// File: /workspace/github_c_makefile_star2_O2/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, %r15
movl $0x440, %esi            # imm = 0x440
callq 0xdecaf
movq %rax, %r14
movq %rax, %rbp
movq 0x18(%r15), %rdi
callq 0x486ae
testl %eax, %eax
movq %rbp, (%rsp)
je 0x4818c
movl $0x3, (%rbp)
leaq 0x20(%rsp), %rbx
movq $0x4, (%rbx)
movq 0x18(%r15), %rdi
movq %rbx, %rsi
callq 0xe3fc4
movq %rax, 0x10(%rbp)
movq 0x18(%r15), %rdi
movq %rbx, %rsi
callq 0xe3fc4
movq %rax, 0x18(%rbp)
movq 0x10(%rbp), %rsi
movq %r15, %rdi
movq %rax, %rdx
callq 0xdf038
movq 0x18(%r15), %rdi
movq %rbx, %rsi
callq 0xe3f2a
movb %al, 0x4(%rbp)
movzbl %al, %edx
leaq 0xc911b(%rip), %rsi     # 0x1111f8
movq %r15, %rdi
xorl %eax, %eax
callq 0xde896
movzbl 0x4(%rbp), %edx
movl %edx, %eax
orl $0x4, %eax
cmpl $0xaf, %eax
jne 0x482b2
movq 0x18(%r15), %rdi
leaq 0x20(%rsp), %rsi
callq 0xe3f2a
movb %al, 0x5(%rbp)
movzbl %al, %edx
leaq 0xc00ab(%rip), %rsi     # 0x1081c1
movq %r15, %rdi
xorl %eax, %eax
callq 0xde896
movb 0x5(%rbp), %al
testb %al, %al
jns 0x4812b
movb $0x1, 0x7(%rbp)
testb $0x40, %al
je 0x48133
movb $0x1, 0x9(%rbp)
testb $0x20, %al
je 0x4813b
movb $0x1, 0x8(%rbp)
andb $0xf, %al
movb %al, 0x6(%rbp)
pushq $0x1
popq %rsi
movq %r15, %rdi
callq 0xdeba7
movzbl 0x6(%rbp), %edx
leaq 0xe53a2(%rip), %rsi     # 0x12d4f8
movq %r15, %rdi
xorl %eax, %eax
callq 0xde896
pushq $-0x1
popq %rsi
movq %r15, %rdi
callq 0xdeba7
movq %r15, %rdi
movq %rbp, %rsi
callq 0x4883d
cmpb $0x0, 0x8(%rbp)
je 0x482c8
leaq 0xc9086(%rip), %rsi     # 0x11120d
jmp 0x48315
movq 0x18(%r15), %rdi
xorl %esi, %esi
callq 0x486cb
movl %eax, (%rbp)
cmpl $0x1, %eax
je 0x481ac
cmpl $0x2, %eax
jne 0x4830e
movb $0x1, 0x7(%rbp)
movb $0x1, 0x6(%rbp)
movq $0x280, 0x10(%rbp)      # imm = 0x280
movq $0x15e, 0x18(%rbp)      # imm = 0x15E
movq $0x1b580, 0x38(%rbp)    # imm = 0x1B580
movq $0x6d60, 0x28(%rbp)     # imm = 0x6D60
movq $0x50, 0x20(%rbp)
movq %r15, %r13
movq %r15, %rdi
movq %rbp, %rsi
callq 0x4883d
leaq 0x8(%rsp), %rax
andq $0x0, (%rax)
addq $0x40, %r14
movq %r14, 0x18(%rsp)
leaq 0x20(%rsp), %r15
xorl %r14d, %r14d
movq (%rsp), %rbx
cmpq $0x10, %r14
je 0x48265
movq 0x18(%r13), %rdi
leaq 0x8(%rsp), %rsi
callq 0xe3f2a
andb $0x3f, %al
movzbl %al, %r12d
pushq $0x1e
popq %rdi
xorl %esi, %esi
movl %r12d, %edx
callq 0xe1a23
movl %eax, 0x40(%rbx,%r14,4)
movq %r15, %rdi
pushq $0x20
popq %rsi
leaq 0xc9163(%rip), %rdx     # 0x1113a0
movl %r12d, %ecx
xorl %eax, %eax
callq 0xde40c
movl 0x40(%rbx,%r14,4), %edx
movq %r13, %rdi
movq %r14, %rsi
movq %r15, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xdf153
incq %r14
jmp 0x48204
movq (%rsp), %rbx
cmpb $0x0, 0x7(%rbx)
je 0x48324
movl $0x100, %esi            # imm = 0x100
addq 0x38(%rbx), %rsi
xorl %r14d, %r14d
movq %r13, %r15
movq %r13, %rdi
xorl %edx, %edx
callq 0xe59cd
movq %rax, %r12
pushq $0x10
popq %rdx
movq %r13, %rdi
movq %rbx, %rsi
movq %rax, %rcx
callq 0x48876
testl %eax, %eax
je 0x48424
movq %r12, 0x10(%rsp)
jmp 0x48338
leaq 0xc8f33(%rip), %rsi     # 0x1111ec
movq %r15, %rdi
xorl %eax, %eax
callq 0xdf2a5
jmp 0x4862c
cmpb $0x0, 0x9(%rbp)
je 0x48450
movq 0x18(%r15), %rdi
movq %r14, %r12
leaq 0x20(%rsp), %r14
movq %r14, %rsi
callq 0xe3fc4
movq %rax, %rbx
movq (%r14), %rdx
leaq 0xc8f38(%rip), %rsi     # 0x11122b
movq %r15, %rdi
movq %rax, %rcx
xorl %eax, %eax
callq 0xde896
addq (%r14), %rbx
movq %rbx, (%r14)
movq %r12, %r14
jmp 0x48455
leaq 0xc8eb0(%rip), %rsi     # 0x1111c5
movq %r15, %rdi
xorl %eax, %eax
callq 0xdf2a5
jmp 0x4862c
movq %r13, %r15
movq 0x18(%r13), %r12
pushq $0x10
popq %r14
movq $0x0, 0x10(%rsp)
movq 0x38(%rbx), %rsi
movq %r15, %rdi
xorl %edx, %edx
callq 0xe59cd
movq %rbx, %r13
movq %rax, %rbp
movl $0x6d60, %edx           # imm = 0x6D60
movq %r12, %rdi
movq %r14, %rsi
movq %rax, %rcx
callq 0xe45f4
leaq 0xdac0(%r14), %rsi
movl $0x6d60, %edx           # imm = 0x6D60
movq %r12, %rdi
movq %rbp, %rcx
callq 0xe45f4
leaq 0x6d60(%r14), %rsi
movl $0x6d60, %edx           # imm = 0x6D60
movq %r12, %rdi
movq %rbp, %rcx
callq 0xe45f4
orq $0x14820, %r14          # imm = 0x14820
movl $0x6d60, %edx           # imm = 0x6D60
movq %r12, %rdi
movq %r14, %rsi
movq %rbp, %rcx
callq 0xe45f4
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %rdx
pushq $0x3
popq %rcx
movq %r15, %rdi
callq 0xe7437
movq %rax, %r14
movq 0x20(%rbx), %rcx
pushq $0x4
popq %rdx
movl $0x6d60, %r8d           # imm = 0x6D60
movq %rbp, %rdi
xorl %esi, %esi
movq 0x18(%rsp), %r9
pushq $0x2
pushq %rax
callq 0xe7de1
popq %rax
popq %rcx
movq %r15, %rdi
callq 0xdfd1a
movq %rax, %rbx
movl $0x1, 0x78(%rax)
movabsq $0x407e000000000000, %rax # imm = 0x407E000000000000
movq %rax, 0x80(%rbx)
cvtsi2sdq 0x18(%r13), %xmm0
movsd %xmm0, 0x88(%rbx)
pushq $0x2
popq %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0xe70ab
movq 0x10(%rsp), %r12
jmp 0x48428
xorl %ebp, %ebp
xorl %ebx, %ebx
movq %r14, %rdi
callq 0xe7084
movq %r12, %rdi
callq 0xe5591
movq %rbp, %rdi
callq 0xe5591
movq %r15, %rdi
movq %rbx, %rsi
callq 0xdfd24
jmp 0x48628
movq 0x20(%rsp), %rbx
addq $0x40, %r14
cmpb $-0x55, 0x4(%rbp)
movq 0x18(%r15), %rsi
jne 0x4848c
subq $0x8, %rsp
pushq $0x10
popq %rcx
pushq $0x3
popq %r8
movq %r15, %rdi
movq %rbx, %rdx
movq %r14, %r9
pushq $0x0
pushq $0x2
pushq $0x10
callq 0xe79ca
addq $0x20, %rsp
pushq $0x30
popq %r12
jmp 0x484ba
subq $0x8, %rsp
pushq $0x3
popq %r8
movl $0x100, %ecx            # imm = 0x100
movq %r15, %rdi
movq %rbx, %rdx
movq %r14, %r9
pushq $0x0
pushq $0x2
pushq $0x100                  # imm = 0x100
callq 0xe79ca
addq $0x20, %rsp
movl $0x300, %r12d           # imm = 0x300
movq %r12, 0x30(%rbp)
addq 0x20(%rsp), %r12
movq %r12, 0x20(%rsp)
movzbl 0x6(%rbp), %eax
testb $-0x5, %al
jne 0x48598
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0xdebae
leaq 0xd90b8(%rip), %rsi     # 0x1215a0
xorl %r13d, %r13d
movq %r15, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rsi
movq %r15, %rdi
callq 0xdeba7
movq 0x10(%rbp), %rsi
movq 0x18(%rbp), %rdx
movq %r15, %rdi
callq 0xe6be1
testl %eax, %eax
je 0x485ab
cmpb $0x4, 0x6(%rbp)
movq 0x10(%rbp), %rax
jne 0x48538
pushq $0x8
popq %rsi
movq %rax, %rdi
callq 0xdfbb6
pushq $0x2
popq %rcx
cqto
idivq %rcx
movq %rax, 0x20(%rbp)
testq %rax, %rax
jle 0x485a8
movq 0x10(%rbp), %rsi
movq 0x18(%rbp), %rdx
imulq %rdx, %rax
movq %rax, 0x38(%rbp)
pushq $0x3
popq %rcx
movq %r15, %rdi
callq 0xe7437
movq %rax, %r13
cmpb $0x0, 0x7(%rbp)
je 0x485af
movl $0x100, %esi            # imm = 0x100
addq 0x38(%rbp), %rsi
movq %r15, %rdi
xorl %edx, %edx
callq 0xe59cd
movq %rbp, %rsi
movq %rax, %rbp
movq %r15, %rdi
movq %r12, %rdx
movq %rax, %rcx
callq 0x48876
testl %eax, %eax
je 0x4860c
movq %rbp, %rdi
xorl %r12d, %r12d
jmp 0x485b5
movzbl 0x5(%rbp), %edx
leaq 0xc8cac(%rip), %rsi     # 0x11124f
jmp 0x482b9
xorl %r13d, %r13d
xorl %ebp, %ebp
jmp 0x4860c
movq 0x18(%r15), %rdi
xorl %ebp, %ebp
movq (%rsp), %rax
cmpb $0x4, 0x6(%rax)
movq 0x20(%rax), %rcx
jne 0x485e6
pushq $0x4
popq %r8
movq %rcx, %rax
cqto
idivq %r8
movq %r12, %rsi
movq %r8, %rdx
movq %rax, %r8
movq %r14, %r9
pushq $0x2
pushq %r13
callq 0xe7de1
jmp 0x485fd
subq $0x8, %rsp
pushq $0x8
popq %rdx
movq %r12, %rsi
movq %r14, %r8
movq %r13, %r9
pushq $0x0
callq 0xe7cbc
popq %rax
popq %rcx
pushq $0x2
popq %rdx
movq %r13, %rdi
xorl %esi, %esi
callq 0xe70b7
movq %r13, %rdi
callq 0xe7084
movq %rbp, %rdi
callq 0xe5591
movl 0x8(%rsp), %esi
movq %r15, %rdi
callq 0xdebb7
movq (%rsp), %rbp
movq %r15, %rdi
movq %rbp, %rsi
callq 0xded32
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq