// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/ilbm.c
// Function: decompress_delta_op7
static void decompress_delta_op7(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;
	i64 dataelem_size;
	dbuf *inf = NULL;

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

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

	if(frctx->bits & 0xfffffffeU) {
		de_err(c, "Unsupported ANHD options");
		d->errflag = 1;
		goto done;
	}
	if(frctx->bits & 0x00000001) {
		dataelem_size = 4;
	}
	else {
		dataelem_size = 2;
	}

	// We'll have to interleave lots of short reads between two different segments of
	// the file, with no way to know how big either segment is.
	// I see no good way to process this DLTA#7 format, except by first reading the
	// entire chunk into memory.
	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++) {
		opcodelist_offs[i] = dbuf_getu32be_p(inf, &infpos);
	}

	for(i=0; i<8; i++) {
		datalist_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_vdelta(c, d, ibi, frctx, i, inf,
					opcodelist_offs[i], datalist_offs[i], len,
					1, dataelem_size, 1, 0);
			}
		}
	}

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movq %rdx, -0x28(%rbp)
movq %rcx, -0x30(%rbp)
movq %r8, -0x38(%rbp)
movq %r9, -0x40(%rbp)
movq $0x0, -0xe0(%rbp)
movq -0x18(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x15b580
movq -0x30(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0xb4771
jmp 0xb49e8
movq -0x18(%rbp), %rdi
leaq 0x100369(%rip), %rsi    # 0x1b4ae5
movb $0x0, %al
callq 0x15b0d0
movq -0x30(%rbp), %rax
movl 0x18(%rax), %eax
andl $-0x2, %eax
cmpl $0x0, %eax
je 0xb47b4
movq -0x18(%rbp), %rdi
leaq 0x1002b3(%rip), %rsi    # 0x1b4a50
movb $0x0, %al
callq 0x15bfb0
movq -0x20(%rbp), %rax
movl $0x1, 0x1c(%rax)
jmp 0xb49e8
movq -0x30(%rbp), %rax
movl 0x18(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xb47d0
movq $0x4, -0xd8(%rbp)
jmp 0xb47db
movq $0x2, -0xd8(%rbp)
cmpq $0x5f5e100, -0x40(%rbp) # imm = 0x5F5E100
jle 0xb47f5
movq -0x20(%rbp), %rax
movl $0x1, 0x1c(%rax)
jmp 0xb49e8
movq -0x18(%rbp), %rdi
movq -0x40(%rbp), %rsi
xorl %edx, %edx
callq 0x168020
movq %rax, -0xe0(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0xe0(%rbp), %rcx
callq 0x166070
movq $0x0, -0xc8(%rbp)
movl $0x0, -0xcc(%rbp)
cmpl $0x8, -0xcc(%rbp)
jge 0xb4878
movq -0xe0(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x1654b0
movq %rax, %rcx
movslq -0xcc(%rbp), %rax
movq %rcx, -0x80(%rbp,%rax,8)
movl -0xcc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xcc(%rbp)
jmp 0xb483c
movl $0x0, -0xcc(%rbp)
cmpl $0x8, -0xcc(%rbp)
jge 0xb48c1
movq -0xe0(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x1654b0
movq %rax, %rcx
movslq -0xcc(%rbp), %rax
movq %rcx, -0xc0(%rbp,%rax,8)
movl -0xcc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xcc(%rbp)
jmp 0xb4882
movl $0x0, -0xcc(%rbp)
cmpl $0x8, -0xcc(%rbp)
jge 0xb49e6
movq -0x20(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
je 0xb48e7
jmp 0xb49e8
movslq -0xcc(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jge 0xb49d0
movq -0x18(%rbp), %rdi
movl -0xcc(%rbp), %edx
movslq -0xcc(%rbp), %rax
movq -0x80(%rbp,%rax,8), %rcx
leaq 0x1001da(%rip), %rsi    # 0x1b4af3
movb $0x0, %al
callq 0x15b350
movq -0x18(%rbp), %rdi
movl -0xcc(%rbp), %edx
movslq -0xcc(%rbp), %rax
movq -0xc0(%rbp,%rax,8), %rcx
leaq 0x1001cd(%rip), %rsi    # 0x1b4b0d
movb $0x0, %al
callq 0x15b350
movslq -0xcc(%rbp), %rax
cmpq $0x0, -0x80(%rbp,%rax,8)
jle 0xb49ce
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x30(%rbp), %rcx
movslq -0xcc(%rbp), %r8
movq -0xe0(%rbp), %r9
movslq -0xcc(%rbp), %rax
movq -0x80(%rbp,%rax,8), %rbx
movslq -0xcc(%rbp), %rax
movq -0xc0(%rbp,%rax,8), %r11
movq -0x40(%rbp), %r10
movq -0xd8(%rbp), %rax
xorl %r14d, %r14d
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movq %r10, 0x10(%rsp)
movq $0x1, 0x18(%rsp)
movq %rax, 0x20(%rsp)
movl $0x1, 0x28(%rsp)
movl $0x0, 0x30(%rsp)
callq 0xb5350
jmp 0xb49d0
jmp 0xb49d2
movl -0xcc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xcc(%rbp)
jmp 0xb48cb
jmp 0xb49e8
movq -0xe0(%rbp), %rdi
callq 0x1676a0
movq -0x18(%rbp), %rdi
movl -0xd0(%rbp), %esi
callq 0x15b5a0
addq $0x110, %rsp            # imm = 0x110
popq %rbx
popq %r14
popq %rbp
retq
nop