// File: /workspace/github_c_makefile_star2_O3/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 $0xe8, %rsp
movq %r9, %rbp
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, 0x8(%rsp)
movq %rsi, %r13
movq %rdi, %r15
leaq 0x34(%rsp), %rsi
callq 0xe8a1c
movq %r14, 0x18(%rsp)
cmpq $0x0, 0x20(%r14)
je 0x7c413
leaq 0xace75(%rip), %rsi     # 0x12926d
movq %r15, %rdi
xorl %eax, %eax
callq 0xe8617
cmpq $0x5f5e101, %rbp        # imm = 0x5F5E101
jl 0x7c41a
movl $0x1, 0x1c(%r13)
xorl %edi, %edi
jmp 0x7c73c
xorl %r14d, %r14d
movq %r15, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0xf09c5
movq %rax, %r12
movq 0x18(%r15), %rdi
movq %rbx, %rsi
movq %rbp, %rdx
movq %rax, %rcx
callq 0xef481
leaq 0x58(%rsp), %rbx
movq $0x0, (%rbx)
movq %r12, %rdi
movq %rbx, %rsi
callq 0xeed31
movq %rax, 0x60(%rsp,%r14,8)
incq %r14
cmpq $0x8, %r14
jne 0x7c44b
xorl %r14d, %r14d
leaq 0x58(%rsp), %rbx
movq %r12, %rdi
movq %rbx, %rsi
callq 0xeed31
movq %rax, 0xa0(%rsp,%r14,8)
incq %r14
cmpq $0x8, %r14
jne 0x7c46c
movq %r12, 0x10(%rsp)
xorl %r12d, %r12d
movq %r15, 0x40(%rsp)
movq %rbp, 0x28(%rsp)
movq 0x8(%rsp), %rcx
movq %r13, 0x38(%rsp)
cmpl $0x0, 0x1c(%r13)
jne 0x7c737
cmpq %r12, 0x18(%rcx)
jle 0x7c72a
movq 0xa0(%rsp,%r12,8), %rbx
movq %r15, %rdi
leaq 0xaccfa(%rip), %rsi     # 0x1291c5
movl %r12d, %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0xe87e4
movq 0x60(%rsp,%r12,8), %r14
movq %r15, %rdi
leaq 0xaccf8(%rip), %rsi     # 0x1291df
movl %r12d, %edx
movq %r14, %rcx
xorl %eax, %eax
callq 0xe87e4
movq 0x8(%rsp), %rcx
testq %rbx, %rbx
jle 0x7c72a
addq %rbx, %rbx
addq %r14, %r14
movq %rbx, 0x20(%rsp)
movq %r15, %rdi
leaq 0xacd66(%rip), %rsi     # 0x12927d
movl %r12d, %edx
movq %rbx, %rcx
movq %r14, %r8
xorl %eax, %eax
callq 0xe87e4
movq 0x8(%rsp), %rcx
movq 0x40(%rcx), %rdx
testq %rdx, %rdx
jle 0x7c72a
addq $0x2, %rbx
cmpq %rbp, %rbx
jg 0x7c72a
leaq 0x1(%rdx), %rax
shrq $0x3f, %rax
addq %rdx, %rax
incq %rax
sarq %rax
movq %rax, 0x48(%rsp)
imulq %r12, %rdx
movq %rdx, 0x50(%rsp)
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0xeeb91
movq 0x50(%rsp), %rsi
movq 0x8(%rsp), %rcx
cmpq $0xffff, %rax           # imm = 0xFFFF
je 0x7c72a
cqto
idivq 0x48(%rsp)
movq %rax, %rbx
movq 0x20(%rsp), %rax
addq $0x2, %rax
cmpq %rbp, %rax
jg 0x7c72a
movq %rbx, %rax
imulq 0x48(%rcx), %rax
leaq (%rsi,%rdx,2), %r15
addq %rax, %r15
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0xeec86
movq %rax, %r13
testq %rax, %rax
js 0x7c647
je 0x7c6c8
movq 0x18(%rsp), %rax
movl $0x1, 0xc(%rax)
movq 0x8(%rsp), %rcx
cmpq 0x8(%rcx), %rbx
jge 0x7c6f6
leaq 0x2(%r14), %rbp
cmpq 0x28(%rsp), %rbp
jg 0x7c6f6
movl $0x2, %ecx
movq 0x10(%rsp), %rdi
leaq 0x6(%rsp), %rsi
movq %r14, %rdx
callq 0xee8d4
movq 0x18(%rsp), %rax
movq 0x20(%rax), %rdi
movl $0x2, %ecx
movq %r15, %rsi
leaq 0x6(%rsp), %rdx
callq 0xf0c11
movq 0x8(%rsp), %rcx
incq %rbx
addq 0x48(%rcx), %r15
movq %rbp, %r14
decq %r13
jne 0x7c5e3
jmp 0x7c6d0
movq 0x18(%rsp), %rax
movl $0x1, 0xc(%rax)
movq %rbp, %rax
leaq 0x2(%r14), %rbp
cmpq %rax, %rbp
movq 0x8(%rsp), %rcx
jg 0x7c6f6
negq %r13
movl $0x2, %ecx
movq 0x10(%rsp), %rdi
leaq 0x6(%rsp), %rsi
movq %r14, %rdx
callq 0xee8d4
movq 0x8(%rsp), %rcx
cmpq $0x2, %r13
movl $0x1, %eax
cmovlq %rax, %r13
cmpq 0x8(%rcx), %rbx
jge 0x7c6f6
movq 0x18(%rsp), %rax
movq 0x20(%rax), %rdi
movl $0x2, %ecx
movq %r15, %rsi
leaq 0x6(%rsp), %rdx
callq 0xf0c11
movq 0x8(%rsp), %rcx
incq %rbx
addq 0x48(%rcx), %r15
decq %r13
jne 0x7c694
jmp 0x7c6d0
movq %r14, %rbp
movq 0x8(%rsp), %rcx
movq 0x20(%rsp), %rax
addq $0x2, %rax
movq %rbp, %r14
movq 0x28(%rsp), %rbp
cmpq %rbp, %rax
movq 0x40(%rsp), %r15
movq 0x38(%rsp), %r13
jle 0x7c565
jmp 0x7c72a
movq 0x38(%rsp), %r13
cmpl $0x0, 0x1c(%r13)
movq 0x40(%rsp), %r15
movq 0x28(%rsp), %rbp
jne 0x7c72a
movq %r15, %rdi
leaq 0xaca86(%rip), %rsi     # 0x12919c
xorl %eax, %eax
callq 0xe9295
movq 0x8(%rsp), %rcx
movl $0x1, 0x1c(%r13)
incq %r12
cmpq $0x8, %r12
jne 0x7c4a4
movq 0x10(%rsp), %rdi
callq 0xf052b
movl 0x34(%rsp), %esi
movq %r15, %rdi
callq 0xe8a25
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq