// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/ilbm.c
// Function: decompress_delta_op5
static void decompress_delta_op5(deark *c, lctx *d, struct imgbody_info *ibi,
	struct frame_ctx *frctx, i64 pos1, i64 len)
{
	i64 planedata_offs[16];
	i64 pos = pos1;
	int i;
	int saved_indent_level;
	u8 delta4_5_xor_mode = 0;

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

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

	// Note that we ignore the 0x8 bit ("RLC - run length coded").
	// I don't know what this option is for. *All* ANIM4/5 frames use run length
	// coding, but they almost never have have this bit set.
	// The rare files that do set this bit don't seem to be any different from
	// those that don't.
	if((frctx->bits & 0xfffffff5U) != 0) {
		de_err(c, "Unsupported ANHD options");
		d->errflag = 1;
		goto done;
	}

	if(frctx->bits & 0x2) {
		delta4_5_xor_mode = 1;
	}

	for(i=0; i<16; i++) {
		if(d->errflag) goto done;
		planedata_offs[i] = de_getu32be_p(&pos);
		if(i<ibi->planes_total) {
			de_dbg2(c, "plane[%d] offs: %"I64_FMT, i, planedata_offs[i]);
			if(planedata_offs[i]>0) {
				decompress_plane_vdelta(c, d, ibi, frctx, i, c->infile,
					pos1+planedata_offs[i], 0, pos1+len, 1, 1,
					0, delta4_5_xor_mode);
			}
		}
	}

done:
	de_dbg_indent_restore(c, saved_indent_level);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
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 -0x28(%rbp), %rax
movq %rax, -0xb8(%rbp)
movb $0x0, -0xc1(%rbp)
movq -0x8(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x15b580
movq -0x20(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0xb4575
jmp 0xb46fe
movq -0x8(%rbp), %rdi
leaq 0x1004c2(%rip), %rsi    # 0x1b4a42
movb $0x0, %al
callq 0x15b0d0
movq -0x20(%rbp), %rax
movl 0x18(%rax), %eax
andl $-0xb, %eax
cmpl $0x0, %eax
je 0xb45b8
movq -0x8(%rbp), %rdi
leaq 0x1004af(%rip), %rsi    # 0x1b4a50
movb $0x0, %al
callq 0x15bfb0
movq -0x10(%rbp), %rax
movl $0x1, 0x1c(%rax)
jmp 0xb46fe
movq -0x20(%rbp), %rax
movl 0x18(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0xb45ce
movb $0x1, -0xc1(%rbp)
movl $0x0, -0xbc(%rbp)
cmpl $0x10, -0xbc(%rbp)
jge 0xb46fc
movq -0x10(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
je 0xb45f4
jmp 0xb46fe
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x1654b0
movq %rax, %rcx
movslq -0xbc(%rbp), %rax
movq %rcx, -0xb0(%rbp,%rax,8)
movslq -0xbc(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jge 0xb46e6
movq -0x8(%rbp), %rdi
movl -0xbc(%rbp), %edx
movslq -0xbc(%rbp), %rax
movq -0xb0(%rbp,%rax,8), %rcx
leaq 0x1003bf(%rip), %rsi    # 0x1b4a0e
movb $0x0, %al
callq 0x15b350
movslq -0xbc(%rbp), %rax
cmpq $0x0, -0xb0(%rbp,%rax,8)
jle 0xb46e4
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movslq -0xbc(%rbp), %r8
movq -0x8(%rbp), %rax
movq 0x18(%rax), %r9
movq -0x28(%rbp), %r10
movslq -0xbc(%rbp), %rax
addq -0xb0(%rbp,%rax,8), %r10
movq -0x28(%rbp), %rax
addq -0x30(%rbp), %rax
xorl %r11d, %r11d
xorl %r11d, %r11d
movq %r10, (%rsp)
movq $0x0, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movq $0x1, 0x18(%rsp)
movq $0x1, 0x20(%rsp)
movl $0x0, 0x28(%rsp)
movzbl -0xc1(%rbp), %eax
movl %eax, 0x30(%rsp)
callq 0xb5350
jmp 0xb46e6
jmp 0xb46e8
movl -0xbc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xbc(%rbp)
jmp 0xb45d8
jmp 0xb46fe
movq -0x8(%rbp), %rdi
movl -0xc0(%rbp), %esi
callq 0x15b5a0
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopw %cs:(%rax,%rax)