// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq $0x0, -0xc8(%rbp)
movq -0x8(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x15b580
movq -0x20(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0xb4e4e
jmp 0xb504b
movq -0x8(%rbp), %rdi
leaq 0xffd42(%rip), %rsi     # 0x1b4b9b
movb $0x0, %al
callq 0x15b0d0
cmpq $0x5f5e100, -0x30(%rbp) # imm = 0x5F5E100
jle 0xb4e7a
movq -0x10(%rbp), %rax
movl $0x1, 0x1c(%rax)
jmp 0xb504b
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
xorl %edx, %edx
callq 0x168020
movq %rax, -0xc8(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0xc8(%rbp), %rcx
callq 0x166070
movq $0x0, -0xb8(%rbp)
movl $0x0, -0xbc(%rbp)
cmpl $0x8, -0xbc(%rbp)
jge 0xb4f00
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x1654b0
movq %rax, %rcx
movslq -0xbc(%rbp), %rax
movq %rcx, -0xb0(%rbp,%rax,8)
movl -0xbc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xbc(%rbp)
jmp 0xb4ec1
movl $0x0, -0xbc(%rbp)
cmpl $0x8, -0xbc(%rbp)
jge 0xb4f46
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x1654b0
movq %rax, %rcx
movslq -0xbc(%rbp), %rax
movq %rcx, -0x70(%rbp,%rax,8)
movl -0xbc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xbc(%rbp)
jmp 0xb4f0a
movl $0x0, -0xbc(%rbp)
cmpl $0x8, -0xbc(%rbp)
jge 0xb5049
movq -0x10(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
je 0xb4f6c
jmp 0xb504b
movslq -0xbc(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jge 0xb5033
movq -0x8(%rbp), %rdi
movl -0xbc(%rbp), %edx
movslq -0xbc(%rbp), %rax
movq -0x70(%rbp,%rax,8), %rcx
leaq 0xffb55(%rip), %rsi     # 0x1b4af3
movb $0x0, %al
callq 0x15b350
movq -0x8(%rbp), %rdi
movl -0xbc(%rbp), %edx
movslq -0xbc(%rbp), %rax
movq -0xb0(%rbp,%rax,8), %rcx
leaq 0xffb48(%rip), %rsi     # 0x1b4b0d
movb $0x0, %al
callq 0x15b350
movslq -0xbc(%rbp), %rax
cmpq $0x0, -0x70(%rbp,%rax,8)
jle 0xb5031
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movslq -0xbc(%rbp), %r8
movq -0xc8(%rbp), %r9
movslq -0xbc(%rbp), %rax
movq -0x70(%rbp,%rax,8), %r11
shlq %r11
movslq -0xbc(%rbp), %rax
movq -0xb0(%rbp,%rax,8), %r10
shlq %r10
movq -0x30(%rbp), %rax
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0xb5d10
jmp 0xb5033
jmp 0xb5035
movl -0xbc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xbc(%rbp)
jmp 0xb4f50
jmp 0xb504b
movq -0xc8(%rbp), %rdi
callq 0x1676a0
movq -0x8(%rbp), %rdi
movl -0xc0(%rbp), %esi
callq 0x15b5a0
addq $0xe0, %rsp
popq %rbp
retq
nop