// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/ilbm.c
// Function: do_anim_anhd
static void do_anim_anhd(deark *c, lctx *d, i64 pos, i64 len)
{
	i64 tmp;
	u8 ileave_raw;
	de_ucstring *bits_descr = NULL;
	struct frame_ctx *frctx = d->frctx;

	if(!frctx) return;
	if(len<24) return;

	frctx->op = de_getbyte(pos++);
	de_dbg(c, "operation: %d (%s)", (int)frctx->op, anim_get_op_name(frctx->op));

	if(frctx->op==ANIM_OP_XOR) {
		pos++; // Mask
		pos += 2; // w
		pos += 2; // h
		pos += 2; // x
		pos += 2; // y
	}
	else {
		pos += 9;
	}
	pos += 4; // abstime

	tmp = de_getu32be_p(&pos); // reltime
	de_dbg(c, "reltime: %.5f sec", ((double)tmp)/60.0);

	ileave_raw = de_getbyte_p(&pos);
	de_dbg(c, "interleave: %d", (int)ileave_raw);
	if(ileave_raw==0) {
		frctx->interleave = 2;
	}
	else {
		frctx->interleave = (UI)ileave_raw;
	}
	if(frctx->interleave>2 && !d->errflag) {
		de_err(c, "Unsupported interleave");
		d->errflag = 1;
	}

	pos++; // pad0

	frctx->bits = (UI)de_getu32be_p(&pos);
	bits_descr = ucstring_create(c);
	get_bits_descr(c, d, frctx, bits_descr);
	de_dbg(c, "bits: 0x%08x (%s)", frctx->bits, ucstring_getpsz_d(bits_descr));

	ucstring_destroy(bits_descr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0xb0(%rax), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0xb095b
jmp 0xb0b60
cmpq $0x18, -0x20(%rbp)
jge 0xb0967
jmp 0xb0b60
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
movq %rsi, %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
callq 0x165060
movb %al, %cl
movq -0x40(%rbp), %rax
movb %cl, 0x10(%rax)
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x40(%rbp), %rax
movzbl 0x10(%rax), %eax
movl %eax, -0x44(%rbp)
movq -0x40(%rbp), %rax
movzbl 0x10(%rax), %edi
callq 0xb19a0
movq -0x50(%rbp), %rdi
movl -0x44(%rbp), %edx
movq %rax, %rcx
leaq 0x103c32(%rip), %rsi    # 0x1b45ef
movb $0x0, %al
callq 0x15b0d0
movq -0x40(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0xb0a0f
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x18(%rbp)
jmp 0xb0a1b
movq -0x18(%rbp), %rax
addq $0x9, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x18(%rbp), %rsi
callq 0x1654b0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
cvtsi2sdq -0x28(%rbp), %xmm0
movsd 0x103772(%rip), %xmm1   # 0x1b41c0
divsd %xmm1, %xmm0
leaq 0x103ba9(%rip), %rsi    # 0x1b4602
movb $0x1, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x18(%rbp), %rsi
callq 0x165170
movb %al, -0x29(%rbp)
movq -0x8(%rbp), %rdi
movzbl -0x29(%rbp), %edx
leaq 0x103b91(%rip), %rsi    # 0x1b4614
movb $0x0, %al
callq 0x15b0d0
movzbl -0x29(%rbp), %eax
cmpl $0x0, %eax
jne 0xb0aa0
movq -0x40(%rbp), %rax
movl $0x2, 0x14(%rax)
jmp 0xb0aab
movzbl -0x29(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x40(%rbp), %rax
cmpl $0x2, 0x14(%rax)
jbe 0xb0adc
movq -0x10(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
jne 0xb0adc
movq -0x8(%rbp), %rdi
leaq 0x103b59(%rip), %rsi    # 0x1b4623
movb $0x0, %al
callq 0x15bfb0
movq -0x10(%rbp), %rax
movl $0x1, 0x1c(%rax)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x18(%rbp), %rsi
callq 0x1654b0
movl %eax, %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x8(%rbp), %rdi
callq 0x1711d0
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x38(%rbp), %rcx
callq 0xb1aa0
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x40(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x54(%rbp)
movq -0x38(%rbp), %rdi
callq 0x172650
movq -0x60(%rbp), %rdi
movl -0x54(%rbp), %edx
movq %rax, %rcx
leaq 0x103aea(%rip), %rsi    # 0x1b463a
movb $0x0, %al
callq 0x15b0d0
movq -0x38(%rbp), %rdi
callq 0x171750
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)