// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/colorix.c
// Function: do_colorix_decompress
static int do_colorix_decompress(deark *c, struct colorix_ctx *d, i64 pos1,
	dbuf *unc_pixels)
{
	int retval = 0;
	struct de_dfilter_in_params dcmpri;
	struct de_dfilter_out_params dcmpro;
	struct de_dfilter_results dres;
	struct de_rixdecomp_params params;

	de_zeromem(&params, sizeof(struct de_rixdecomp_params));
	params.known_segment_size = d->known_segment_size;
	params.rowspan = d->rowspan;
	params.imgtype = d->imgtype;

	de_dfilter_init_objects(c, &dcmpri, &dcmpro, &dres);
	dcmpri.f = c->infile;
	dcmpri.pos = pos1;
	dcmpri.len = c->infile->len - pos1;
	dcmpro.f = unc_pixels;
	dcmpro.expected_len = d->unc_image_size;
	dcmpro.len_known = 1;

	rixdecomp_codectype1(c, &dcmpri, &dcmpro, &dres, (void*)&params);
	dbuf_flush(dcmpro.f);

	if(dres.errcode) {
		de_err(c, "Decompression failed: %s", de_dfilter_get_errmsg(c, &dres));
		goto done;
	}

	retval = 1;
done:
	return retval;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rcx, 0x18(%rsp)
movq %rdx, %rbp
movq %rsi, %r13
movq %rdi, %r14
leaq 0xe0(%rsp), %rbx
movq $0x0, 0x10(%rbx)
movq 0x28(%rsi), %rax
movq %rax, (%rbx)
movq 0x20(%rsi), %rax
movq %rax, 0x10(%rsp)
movq %rax, 0x8(%rbx)
movb 0x6(%rsi), %al
movb %al, 0x20(%rsp)
movb %al, 0x10(%rbx)
leaq 0xc0(%rsp), %r12
leaq 0x48(%rsp), %r15
leaq 0x60(%rsp), %rcx
movq %r12, %rsi
movq %r15, %rdx
callq 0xfa1dc
movq 0x18(%r14), %rax
movq %rax, (%r12)
movq %rbp, 0x8(%r12)
movq 0x18(%rax), %rax
subq %rbp, %rax
movq %rax, 0x10(%r12)
movq 0x18(%rsp), %rax
movq %rax, (%r15)
movq 0x38(%r13), %rax
movq %r14, %r13
movq %rax, 0x10(%r15)
movb $0x1, 0x8(%r15)
leaq 0x2c(%rsp), %rsi
movq %r14, %rdi
callq 0xe8a1c
movl $0xe8, %esi
movq %r14, %rdi
callq 0xe8b2b
movq %rax, %r14
movq %r13, (%rax)
movq %rbx, 0x8(%rax)
leaq 0xd36ac(%rip), %rax     # 0x11e361
movq %rax, 0x28(%r14)
movq %r12, 0x10(%r14)
movq %r15, 0x18(%r14)
leaq 0x60(%rsp), %rax
movq %rax, 0x20(%r14)
movq 0x8(%r12), %rax
movq 0x10(%r12), %rbx
addq %rax, %rbx
cmpb $0x0, 0x20(%rsp)
sete 0x31(%r14)
movq (%r15), %rcx
cmpl $0x3, (%rcx)
jne 0x4b15a
cmpq $0x0, 0x18(%rcx)
setne %cl
cmpb $0x0, 0x50(%rsp)
sete %dl
cmpq $0x0, 0x10(%rsp)
setle %sil
orb %dl, %sil
orb %cl, %sil
jne 0x4b15a
movq %rax, 0x40(%r14)
leaq 0x4(%rsp), %rsi
movq %r13, %rdi
callq 0xe8a1c
movq 0x40(%r14), %rdx
leaq 0x8(%rsp), %r15
movq %rdx, (%r15)
leaq 0xd36cd(%rip), %rsi     # 0x11e404
movq %r13, %rdi
xorl %eax, %eax
callq 0xe8617
movq %r13, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x10(%r14), %rax
movq (%rax), %rdi
movq %r15, %rsi
callq 0xeebeb
movq %rax, %r12
leaq (%rax,%rax), %rdx
movq %rdx, 0x90(%r14)
leaq 0xd36b4(%rip), %rsi     # 0x11e426
movq %r13, %rdi
xorl %eax, %eax
callq 0xe8617
movq (%r15), %rax
movq %rax, 0x88(%r14)
addq 0x90(%r14), %rax
movq %rax, 0x48(%r14)
movl $0x100, %esi            # imm = 0x100
movl $0x100, %edx            # imm = 0x100
movq %r13, %rdi
callq 0x104d0e
movq %rax, 0x50(%r14)
testq %r12, %r12
jle 0x4b13e
movq 0x88(%r14), %rdx
leaq 0xd367d(%rip), %rsi     # 0x11e43b
movq %r13, %rdi
xorl %eax, %eax
callq 0xe87e4
movq %r13, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x88(%r14), %rsi
movq %r14, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x4b1f3
movq %r13, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
cmpl $0x4, (%r13)
jl 0x4ae08
movq 0x50(%r14), %rsi
movq %r13, %rdi
callq 0x1047f5
movl 0x4(%rsp), %esi
movq %r13, %rdi
callq 0xe8a25
movq 0x48(%r14), %r12
movq %r12, 0x8(%rsp)
leaq 0x2(%r12), %rax
cmpq %rbx, %rax
jge 0x4b135
leaq 0x58(%r14), %r15
movq %r14, %rax
addq $0x78, %rax
movq %rax, 0x38(%rsp)
leaq 0x4(%rsp), %rbp
movq $0x0, 0x10(%rsp)
movq %r13, 0x40(%rsp)
movq %rbx, 0x30(%rsp)
movq 0x18(%r14), %rax
movq (%rax), %rcx
movq 0x18(%rcx), %rcx
movq %rcx, 0x38(%r14)
cmpq 0x10(%rax), %rcx
jge 0x4b135
movq 0xc0(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xeebeb
testq %rax, %rax
je 0x4b135
movq %r13, %rbx
movq 0x8(%rsp), %r13
movq %rbx, %rdi
leaq 0xd34d2(%rip), %rsi     # 0x11e36b
movq %r12, %rdx
movq %r13, %rcx
movq %rax, %r8
movq %rax, %r12
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x18(%r14), %rax
movq (%rax), %rdi
movq 0x18(%rdi), %rax
movq %rax, 0x20(%rsp)
callq 0xf0855
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%r15)
movups %xmm0, 0x10(%r15)
movups %xmm0, (%r15)
movq 0x10(%r14), %rax
movq (%rax), %rax
movq %rax, 0x58(%r14)
movq %r13, 0x60(%r14)
movq %r12, 0x18(%rsp)
addq %r12, %r13
movq %r13, 0x68(%r14)
movq 0x38(%rsp), %rdi
callq 0xf1bdd
movq 0x50(%r14), %rax
movq (%rax), %rdi
callq 0x1044ba
xorl %eax, %eax
movl %eax, 0x98(%r14)
movb $0x0, 0x9c(%r14)
movl %eax, 0x4(%rsp)
movq 0x50(%r14), %rax
movq 0x8(%rax), %rdi
movq %r15, %rsi
movq %rbp, %rdx
xorl %ecx, %ecx
callq 0x1046f3
testl %eax, %eax
sete %al
movl 0x4(%rsp), %r12d
cmpl $0x100, %r12d           # imm = 0x100
setae %cl
orb %al, %cl
jne 0x4b029
movq 0x18(%r14), %rcx
movq 0x38(%r14), %rax
cmpq 0x10(%rcx), %rax
jge 0x4aff6
movl 0x98(%r14), %ecx
cmpl $0x1, %ecx
je 0x4af9a
testl %ecx, %ecx
jne 0x4afed
leal 0x1(%r12), %eax
movl $0x1, %ebx
cmpb $0x1, %al
ja 0x4afb5
movl $0x1, 0x98(%r14)
movb %r12b, 0x9d(%r14)
jmp 0x4aff6
incl %r12d
movq %r12, %rbx
movb 0x9d(%r14), %al
movl $0x0, 0x98(%r14)
movl %eax, %r12d
movq %rbx, %r13
cmpb $0x0, 0x31(%r14)
movl %r12d, %eax
je 0x4afcc
movb 0x9c(%r14), %al
xorb %r12b, %al
movb %al, 0x9c(%r14)
movq 0x18(%r14), %rcx
movq (%rcx), %rdi
movzbl %al, %esi
callq 0xf0bd6
decq %r13
jne 0x4afb8
movq 0x38(%r14), %rax
jmp 0x4afef
xorl %ebx, %ebx
addq %rax, %rbx
movq %rbx, 0x38(%r14)
movl $0x0, 0x4(%rsp)
movq 0x50(%r14), %rax
movq 0x8(%rax), %rdi
movq %r15, %rsi
movq %rbp, %rdx
xorl %ecx, %ecx
callq 0x1046f3
testl %eax, %eax
je 0x4b029
movl 0x4(%rsp), %r12d
cmpl $0x100, %r12d           # imm = 0x100
jb 0x4af56
movq 0x18(%r14), %rax
movq (%rax), %rdi
callq 0xf087d
movq 0x18(%r14), %rax
movq (%rax), %rax
movq 0x18(%rax), %r12
subq 0x20(%rsp), %r12
movq 0x40(%rsp), %r13
movq %r13, %rdi
leaq 0xd3345(%rip), %rsi     # 0x11e399
movq %r12, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x8(%r14), %rax
movq 0x8(%rax), %rcx
cmpq %rcx, %r12
jl 0x4b1dd
movq %r12, %rax
cqto
idivq %rcx
movq %r13, %rdi
leaq 0xd332f(%rip), %rsi     # 0x11e3b0
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x8(%r14), %rcx
movq (%rcx), %rsi
testq %rsi, %rsi
je 0x4b0ba
movq 0x10(%rsp), %rax
incq %rax
imulq %rax, %rsi
movq %rsi, 0x38(%r14)
movq 0x18(%r14), %rax
movq (%rax), %rdi
callq 0xf0f27
movq 0x30(%rsp), %rbx
jmp 0x4b106
movq 0x18(%r14), %rdx
movq (%rdx), %rax
movq 0x18(%rax), %rax
cmpq 0x10(%rdx), %rax
movq 0x30(%rsp), %rbx
jge 0x4b106
cqto
idivq 0x8(%rcx)
testq %rdx, %rdx
jle 0x4b106
movq %rdx, %r12
movq %r13, %rdi
leaq 0xd32dc(%rip), %rsi     # 0x11e3c4
xorl %eax, %eax
callq 0xe8617
movq 0x18(%r14), %rax
movq (%rax), %rdi
movq 0x18(%rdi), %rsi
subq %r12, %rsi
movq %rsi, 0x38(%r14)
callq 0xf0f27
movq 0x18(%rsp), %rax
addq %rax, 0x8(%rsp)
incq 0x10(%rsp)
movq %r13, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq 0x8(%rsp), %r12
leaq 0x2(%r12), %rax
cmpq %rbx, %rax
jl 0x4ae53
cmpl $0x0, 0x60(%rsp)
jne 0x4b15a
jmp 0x4b16b
movq 0x20(%r14), %rsi
movq 0x28(%r14), %rdx
movq %r13, %rdi
callq 0xfa311
movl 0x4(%rsp), %esi
movq %r13, %rdi
callq 0xe8a25
movq 0x28(%r14), %rdx
leaq 0x60(%rsp), %rsi
movq %r13, %rdi
callq 0xfa311
movq 0x50(%r14), %rsi
movq %r13, %rdi
callq 0x104dc7
movq %r13, %rdi
movq %r14, %rsi
callq 0xe8be2
movl 0x2c(%rsp), %esi
movq %r13, %rdi
callq 0xe8a25
movq 0x48(%rsp), %rdi
callq 0xf08ba
cmpl $0x0, 0x60(%rsp)
je 0x4b1c4
leaq 0x60(%rsp), %rsi
movq %r13, %rdi
callq 0xfa1a4
leaq 0xc906e(%rip), %rsi     # 0x114221
xorl %ebp, %ebp
movq %r13, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9295
jmp 0x4b1c9
movl $0x1, %ebp
movl %ebp, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x28(%r14), %rdx
leaq 0x60(%rsp), %rsi
movq %r13, %rdi
callq 0xfa311
jmp 0x4b15a