// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/ilbm.c
// Function: decompress_delta_op108
static void decompress_delta_op108(deark *c, lctx *d, struct imgbody_info *ibi,
	struct frame_ctx *frctx, i64 pos1, i64 len)
{
	i64 opcodelist_offs[8];
	i64 datalist_offs[8];
	i64 infpos;
	int i;
	int saved_indent_level;
	dbuf *inf = NULL;

	de_dbg_indent_save(c, &saved_indent_level);
	if(!frctx->frame_buffer) goto done;

	de_dbg(c, "[delta108 data]");

	// Read the entire chunk into memory, so that the random-access reads will be
	// faster.
	if(len > DE_MAX_SANE_OBJECT_SIZE) {
		d->errflag = 1;
		goto done;
	}
	inf = dbuf_create_membuf(c, len, 0);
	dbuf_copy(c->infile, pos1, len, inf);
	infpos = 0;

	for(i=0; i<8; i++) {
		datalist_offs[i] = dbuf_getu32be_p(inf, &infpos);
	}

	for(i=0; i<8; i++) {
		opcodelist_offs[i] = dbuf_getu32be_p(inf, &infpos);
	}

	for(i=0; i<8; i++) {
		if(d->errflag) goto done;
		if(i<ibi->planes_total) {
			de_dbg2(c, "opcode_list[%d] offs: %"I64_FMT, i, opcodelist_offs[i]);
			de_dbg2(c, "data_list[%d] offs: %"I64_FMT, i, datalist_offs[i]);
			if(opcodelist_offs[i]>0) {
				decompress_plane_delta_op108(c, d, ibi, frctx, i, inf,
					2*opcodelist_offs[i], 2*datalist_offs[i], len);
			}
		}
	}

done:
	dbuf_close(inf);
	de_dbg_indent_restore(c, saved_indent_level);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %r9, %r15
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, 0x8(%rsp)
movq %rsi, 0x40(%rsp)
movq %rdi, %r12
leaq 0x4c(%rsp), %rsi
callq 0xe958c
movq %r14, 0x38(%rsp)
cmpq $0x0, 0x20(%r14)
je 0x7c821
leaq 0xac83b(%rip), %rsi     # 0x12903d
movq %r12, %rdi
xorl %eax, %eax
callq 0xe9226
cmpq $0x5f5e101, %r15        # imm = 0x5F5E101
jl 0x7c828
movq 0x40(%rsp), %rax
movl $0x1, 0x1c(%rax)
xorl %edi, %edi
jmp 0x7cc2d
xorl %r14d, %r14d
movq %r12, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0xf0faf
movq %rax, %r13
movq 0x18(%r12), %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %rax, %rcx
callq 0xefabc
leaq 0x68(%rsp), %rbx
movq $0x0, (%rbx)
movq %r13, %rdi
movq %rbx, %rsi
callq 0xef34e
movq %rax, 0x70(%rsp,%r14,8)
incq %r14
cmpq $0x8, %r14
jne 0x7c85a
movq %r15, 0x10(%rsp)
movq %r12, 0x20(%rsp)
xorl %r14d, %r14d
leaq 0x68(%rsp), %rbx
movq %r13, %rdi
movq %rbx, %rsi
callq 0xef34e
movq %rax, 0xb0(%rsp,%r14,8)
incq %r14
cmpq $0x8, %r14
jne 0x7c885
movq %r13, 0x18(%rsp)
leaq 0x28(%rsp), %r13
xorl %r12d, %r12d
movq 0x8(%rsp), %rax
movq 0x40(%rsp), %rbp
cmpl $0x0, 0x1c(%rbp)
jne 0x7cc23
cmpq %r12, 0x18(%rax)
jle 0x7cc16
movq 0xb0(%rsp,%r12,8), %rbx
movq 0x20(%rsp), %r15
movq %r15, %rdi
leaq 0xac6b2(%rip), %rsi     # 0x128f95
movl %r12d, %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0xe93cf
movq 0x70(%rsp,%r12,8), %r14
movq %r15, %rdi
leaq 0xac6b0(%rip), %rsi     # 0x128faf
movl %r12d, %edx
movq %r14, %rcx
xorl %eax, %eax
callq 0xe93cf
movq 0x8(%rsp), %rax
testq %rbx, %rbx
jle 0x7cc16
addq %rbx, %rbx
addq %r14, %r14
movq %rbx, 0x28(%rsp)
movq 0x20(%rsp), %rdi
leaq 0xac71c(%rip), %rsi     # 0x12904d
movq %r12, 0x50(%rsp)
movl %r12d, %edx
movq %rbx, %rcx
movq %r14, %r12
movq %r14, %r8
xorl %eax, %eax
callq 0xe93cf
movq 0x8(%rsp), %rax
movq 0x40(%rax), %rbx
testq %rbx, %rbx
jle 0x7cc11
leaq 0x1(%rbx), %rax
shrq $0x3f, %rax
addq %rbx, %rax
incq %rax
sarq %rax
movq %rax, 0x58(%rsp)
imulq 0x50(%rsp), %rbx
movl $0x0, (%rsp)
movq %r13, %r14
movq 0x10(%rsp), %r13
movq 0x28(%rsp), %rax
addq $0x2, %rax
movl $0x2, %ebp
cmpq %r13, %rax
jg 0x7cbd1
movq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0xef193
cmpq $0xffff, %rax           # imm = 0xFFFF
je 0x7cbd1
cqto
idivq 0x58(%rsp)
movq %rax, %r15
movq 0x28(%rsp), %rax
addq $0x2, %rax
cmpq %r13, %rax
jg 0x7cbd1
movq 0x8(%rsp), %rax
movq 0x48(%rax), %rax
imulq %r15, %rax
leaq (%rbx,%rdx,2), %r13
addq %rax, %r13
movq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0xef295
movq %rax, %r14
testq %rax, %rax
js 0x7cadc
je 0x7ca0d
movq 0x38(%rsp), %rax
movl $0x1, 0xc(%rax)
testq %r14, %r14
setne %al
je 0x7cb05
cmpq $0x2, %r14
movl $0x1, %eax
cmovgeq %r14, %rax
movq %rax, 0x60(%rsp)
movl $0x2, %ebp
movb $0x1, %al
movq 0x8(%rsp), %rcx
cmpq 0x8(%rcx), %r15
jge 0x7cb0c
leaq 0x2(%r12), %rcx
cmpq 0x10(%rsp), %rcx
jg 0x7cb0c
movq %rbx, 0x30(%rsp)
movl $0x1, %eax
movq %r12, %rsi
movq %rsi, %rbx
movq %rax, %r12
movl $0x2, %ecx
movq 0x18(%rsp), %rdi
leaq 0x6(%rsp), %rbp
movq %rbp, %rsi
movq %rbx, %rdx
callq 0xeeee8
movq 0x38(%rsp), %rax
movq 0x20(%rax), %rdi
movl $0x2, %ecx
movq %r13, %rsi
movq %rbp, %rdx
callq 0xf11f9
cmpq %r12, 0x60(%rsp)
je 0x7cba7
leaq (%r15,%r12), %rax
movl $0x2, %ebp
movl $0x1, %ecx
movq 0x8(%rsp), %rdx
cmpq 0x8(%rdx), %rax
jge 0x7cbac
addq 0x48(%rdx), %r13
leaq 0x2(%rbx), %rsi
leaq 0x4(%rbx), %rdx
leaq 0x1(%r12), %rax
cmpq 0x10(%rsp), %rdx
jle 0x7ca5e
jmp 0x7cbac
movq 0x38(%rsp), %rax
movl $0x1, 0xc(%rax)
leaq 0x2(%r12), %rax
movl $0x2, %ebp
movl $0x1, %ecx
cmpq 0x10(%rsp), %rax
jle 0x7cb18
xorl %eax, %eax
jmp 0x7cb94
xorl %ebp, %ebp
jmp 0x7cbc1
movl $0x1, (%rsp)
jmp 0x7cbc1
movq %r12, %rdx
movq %rax, %r12
movq %rbx, 0x30(%rsp)
negq %r14
movl $0x2, %ecx
movq 0x18(%rsp), %rdi
leaq 0x6(%rsp), %rsi
callq 0xeeee8
cmpq $0x2, %r14
movl $0x1, %eax
cmovlq %rax, %r14
movq 0x8(%rsp), %rbx
cmpq 0x8(%rbx), %r15
setl %al
jge 0x7cb8a
movq 0x38(%rsp), %rax
movq 0x20(%rax), %rdi
movl $0x2, %ecx
movq %r13, %rsi
leaq 0x6(%rsp), %rdx
callq 0xf11f9
incq %r15
addq 0x48(%rbx), %r13
decq %r14
jne 0x7cb4c
xorl %ebp, %ebp
movb $0x1, %al
movl (%rsp), %ecx
movq 0x30(%rsp), %rbx
jmp 0x7cb94
movq 0x30(%rsp), %rbx
movl $0x1, %ecx
movl %ecx, (%rsp)
testb %al, %al
movq 0x10(%rsp), %r13
leaq 0x28(%rsp), %r14
jne 0x7cbcf
jmp 0x7cbd1
xorl %ebp, %ebp
movl (%rsp), %ecx
cmpq %r14, %r12
setl %al
addq $0x2, %rbx
movq %rbx, %r12
movl %ecx, (%rsp)
movq 0x30(%rsp), %rbx
testb %al, %al
movq 0x10(%rsp), %r13
leaq 0x28(%rsp), %r14
jne 0x7cbd1
xorl %ebp, %ebp
testl %ebp, %ebp
je 0x7c986
movq %r14, %r13
cmpl $0x0, (%rsp)
movq 0x40(%rsp), %rbp
movq 0x8(%rsp), %rax
je 0x7cc11
cmpl $0x0, 0x1c(%rbp)
jne 0x7cc11
movq 0x20(%rsp), %rdi
leaq 0xac36e(%rip), %rsi     # 0x128f6c
xorl %eax, %eax
callq 0xe9df7
movq 0x8(%rsp), %rax
movl $0x1, 0x1c(%rbp)
movq 0x50(%rsp), %r12
incq %r12
cmpq $0x8, %r12
jne 0x7c8b8
movq 0x20(%rsp), %r12
movq 0x18(%rsp), %rdi
callq 0xf0b13
movl 0x4c(%rsp), %esi
movq %r12, %rdi
callq 0xe9595
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq