// File: /workspace/github_c_makefile_star2_O2/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, 0x20(%rsp)
movq %rdx, %r14
leaq 0xe0(%rsp), %rbx
andq $0x0, 0x10(%rbx)
movq %rsi, %r13
movq %rdi, %rbp
movq 0x28(%rsi), %rax
movq %rax, (%rbx)
movq 0x20(%rsi), %rax
movq %rax, 0x18(%rsp)
movq %rax, 0x8(%rbx)
movb 0x6(%rsi), %al
movb %al, 0x8(%rsp)
movb %al, 0x10(%rbx)
leaq 0xc0(%rsp), %r12
leaq 0x48(%rsp), %r15
leaq 0x60(%rsp), %rcx
movq %r12, %rsi
movq %r15, %rdx
callq 0xee7ee
movq 0x18(%rbp), %rax
movq %rax, (%r12)
movq %r14, 0x8(%r12)
movq 0x18(%rax), %rax
subq %r14, %rax
movq %rax, 0x10(%r12)
movq 0x20(%rsp), %rax
movq %rax, (%r15)
movq 0x38(%r13), %rax
movq %rax, 0x10(%r15)
movb $0x1, 0x8(%r15)
leaq 0x2c(%rsp), %rsi
movq %rbp, %rdi
callq 0xdebae
movl $0xe8, %esi
movq %rbp, %rdi
callq 0xdecaf
movq %rax, %r14
movq %rbp, (%rax)
movq %rbx, 0x8(%rax)
leaq 0xc8957(%rip), %rax     # 0x11128d
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), %rcx
addq %rax, %rcx
movq %rcx, 0x38(%rsp)
cmpb $0x0, 0x8(%rsp)
sete 0x31(%r14)
movq (%r15), %rcx
cmpl $0x3, (%rcx)
jne 0x48da5
cmpq $0x0, 0x18(%rcx)
setne %cl
cmpb $0x0, 0x50(%rsp)
sete %dl
cmpq $0x0, 0x18(%rsp)
setle %sil
orb %dl, %sil
orb %cl, %sil
jne 0x48da5
movq %rax, 0x40(%r14)
leaq 0x4(%rsp), %rsi
movq %rbp, %rdi
callq 0xdebae
movq 0x40(%r14), %rdx
leaq 0x10(%rsp), %r12
movq %rdx, (%r12)
leaq 0xc8972(%rip), %rsi     # 0x111330
movq %rbp, %rdi
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rsi
movq %rbp, %rdi
callq 0xdeba7
movq 0x10(%r14), %rax
movq (%rax), %rdi
movq %r12, %rsi
callq 0xe3fc4
movq %rax, %r15
leaq (%rax,%rax), %rdx
movq %rdx, 0x90(%r14)
leaq 0xc895b(%rip), %rsi     # 0x111352
movq %rbp, %rdi
xorl %eax, %eax
callq 0xde896
movq (%r12), %rax
movq %rax, 0x88(%r14)
addq 0x90(%r14), %rax
movq %rax, 0x48(%r14)
movl $0x100, %esi            # imm = 0x100
movl $0x100, %edx            # imm = 0x100
movq %rbp, %rdi
callq 0xf8601
movq %rax, 0x50(%r14)
testq %r15, %r15
jle 0x48a87
movq 0x88(%r14), %rdx
leaq 0xc8927(%rip), %rsi     # 0x111367
movq %rbp, %rdi
xorl %eax, %eax
callq 0xde9f1
pushq $0x1
popq %rsi
movq %rbp, %rdi
callq 0xdeba7
movq 0x88(%r14), %rsi
movq %r14, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x48e26
pushq $-0x1
popq %rsi
movq %rbp, %rdi
callq 0xdeba7
cmpl $0x4, (%rbp)
jl 0x48a97
movq 0x50(%r14), %rsi
movq %rbp, %rdi
callq 0xf811c
jmp 0x48a97
movq 0x20(%r14), %rsi
movq 0x28(%r14), %rdx
movq %rbp, %rdi
callq 0xee91c
movl 0x4(%rsp), %esi
movq %rbp, %rdi
callq 0xdebb7
testq %r15, %r15
jle 0x48da5
movq %rbp, 0x8(%rsp)
movq 0x48(%r14), %r13
leaq 0x10(%rsp), %rax
movq %r13, (%rax)
leaq 0x58(%r14), %r12
movq %r14, %rax
addq $0x78, %rax
movq %rax, 0x30(%rsp)
leaq 0x4(%rsp), %rbp
xorl %ebx, %ebx
leaq 0x2(%r13), %rax
cmpq 0x38(%rsp), %rax
jge 0x48d83
movq 0x18(%r14), %rax
movq (%rax), %rcx
movq 0x18(%rcx), %rcx
movq %rcx, 0x38(%r14)
cmpq 0x10(%rax), %rcx
jge 0x48d83
movq 0xc0(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0xe3fc4
testq %rax, %rax
je 0x48d83
movq %rbx, 0x18(%rsp)
movq 0x10(%rsp), %r15
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
leaq 0xc8767(%rip), %rsi     # 0x111297
movq %r13, %rdx
movq %r15, %rcx
movq %rax, %r8
movq %rax, %r13
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
pushq $0x1
popq %rsi
callq 0xdeba7
movq 0x18(%r14), %rax
movq (%rax), %rdi
movq 0x18(%rdi), %rax
movq %rax, 0x20(%rsp)
callq 0xe589c
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%r12)
movups %xmm0, 0x10(%r12)
movups %xmm0, (%r12)
movq 0x10(%r14), %rax
movq (%rax), %rax
movq %rax, 0x58(%r14)
movq %r15, 0x60(%r14)
movq %r13, 0x40(%rsp)
addq %r13, %r15
movq %r15, 0x68(%r14)
movq 0x30(%rsp), %rdi
callq 0xe6a40
movq 0x50(%r14), %rax
movq (%rax), %rdi
callq 0xf7e52
andl $0x0, 0x98(%r14)
movb $0x0, 0x9c(%r14)
andl $0x0, 0x4(%rsp)
movq 0x50(%r14), %rax
movq 0x8(%rax), %rdi
movq %r12, %rsi
movq %rbp, %rdx
xorl %ecx, %ecx
callq 0xf8071
testl %eax, %eax
je 0x48c87
movl 0x4(%rsp), %r15d
cmpl $0xff, %r15d
ja 0x48c87
movq 0x18(%r14), %rax
movq 0x38(%r14), %rcx
cmpq 0x10(%rax), %rcx
jge 0x48bb8
movl 0x98(%r14), %eax
cmpl $0x1, %eax
je 0x48c26
testl %eax, %eax
jne 0x48c40
leal 0x1(%r15), %eax
cmpb $0x1, %al
ja 0x48c45
movl $0x1, 0x98(%r14)
movb %r15b, 0x9d(%r14)
jmp 0x48bb8
incq %r15
movq %r15, %r13
movb 0x9d(%r14), %al
andl $0x0, 0x98(%r14)
movl %eax, %r15d
jmp 0x48c49
xorl %r13d, %r13d
jmp 0x48c49
pushq $0x1
popq %r13
movq %r13, %rbx
subq $0x1, %rbx
jb 0x48c7e
cmpb $0x0, 0x31(%r14)
movl %r15d, %eax
je 0x48c66
movb 0x9c(%r14), %al
xorb %r15b, %al
movb %al, 0x9c(%r14)
movq 0x18(%r14), %rcx
movq (%rcx), %rdi
movzbl %al, %esi
callq 0xe5bc5
jmp 0x48c4c
addq %r13, 0x38(%r14)
jmp 0x48bb8
movq 0x18(%r14), %rax
movq (%rax), %rdi
callq 0xe58c4
movq 0x18(%r14), %rax
movq (%rax), %rax
movq 0x18(%rax), %r15
subq 0x20(%rsp), %r15
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
leaq 0xc8613(%rip), %rsi     # 0x1112c5
movq %r15, %rdx
xorl %eax, %eax
callq 0xde896
movq 0x8(%r14), %rax
movq 0x8(%rax), %rcx
cmpq %rcx, %r15
jl 0x48d91
movq %r15, %rax
cqto
idivq %rcx
movq %rbx, %rdi
leaq 0xc85fd(%rip), %rsi     # 0x1112dc
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
movq 0x8(%r14), %rcx
movq (%rcx), %rsi
testq %rsi, %rsi
je 0x48d14
movq 0x18(%rsp), %rbx
leaq 0x1(%rbx), %rax
imulq %rax, %rsi
movq %rsi, 0x38(%r14)
movq 0x18(%r14), %rax
movq (%rax), %rdi
callq 0xe5eb2
jmp 0x48d5f
movq 0x18(%r14), %rdx
movq (%rdx), %rax
movq 0x18(%rax), %rax
cmpq 0x10(%rdx), %rax
movq 0x18(%rsp), %rbx
jge 0x48d5f
cqto
idivq 0x8(%rcx)
testq %rdx, %rdx
jle 0x48d5f
movq %rdx, %r15
movq 0x8(%rsp), %rdi
leaq 0xc85ac(%rip), %rsi     # 0x1112f0
xorl %eax, %eax
callq 0xde896
movq 0x18(%r14), %rax
movq (%rax), %rdi
movq 0x18(%rdi), %rsi
subq %r15, %rsi
movq %rsi, 0x38(%r14)
jmp 0x48d0d
movq 0x40(%rsp), %rax
addq %rax, 0x10(%rsp)
incq %rbx
movq 0x8(%rsp), %rdi
pushq $-0x1
popq %rsi
callq 0xdeba7
movq 0x10(%rsp), %r13
jmp 0x48ad4
cmpl $0x0, 0x60(%rsp)
movq 0x8(%rsp), %rbp
jne 0x48da5
jmp 0x48db6
movq 0x28(%r14), %rdx
leaq 0x60(%rsp), %rsi
movq %rbx, %rdi
callq 0xee91c
movq %rbx, %rbp
movq 0x28(%r14), %rdx
leaq 0x60(%rsp), %rsi
movq %rbp, %rdi
callq 0xee91c
movq 0x50(%r14), %rsi
movq %rbp, %rdi
callq 0xf86b0
movq %rbp, %rdi
movq %r14, %rsi
callq 0xded32
movl 0x2c(%rsp), %esi
movq %rbp, %rdi
callq 0xdebb7
movq 0x48(%rsp), %rdi
callq 0xe58e8
cmpl $0x0, 0x60(%rsp)
je 0x48e0f
leaq 0x60(%rsp), %rsi
movq %rbp, %rdi
callq 0xee7bc
leaq 0xbe3c3(%rip), %rsi     # 0x1071c1
movq %rbp, %rdi
xorl %ebp, %ebp
movq %rax, %rdx
xorl %eax, %eax
callq 0xdf2a5
jmp 0x48e12
pushq $0x1
popq %rbp
movl %ebp, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq