// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, 0x8(%rsp)
movq 0xb0(%rsi), %r12
testq %r12, %r12
sete %al
cmpq $0x18, %rcx
setl %cl
orb %al, %cl
jne 0x79f82
movq %rsi, %r14
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
leaq 0x1(%rdx), %rax
movq %rax, 0x8(%rsp)
movq %rdx, %rsi
callq 0xef0d5
movb %al, 0x10(%r12)
movzbl %al, %edx
leaq 0xb2146(%rip), %rcx     # 0x12be69
cmpl $0x49, %edx
jg 0x79d4c
cmpl $0x8, %edx
ja 0x79dc6
movl %edx, %eax
leaq 0xaeaca(%rip), %rsi     # 0x128804
movslq (%rsi,%rax,4), %rax
addq %rsi, %rax
jmpq *%rax
leaq 0xaeda4(%rip), %rcx     # 0x128aee
jmp 0x79dc6
cmpl $0x64, %edx
jg 0x79d64
cmpl $0x4a, %edx
je 0x79db6
cmpl $0x64, %edx
jne 0x79dc6
leaq 0xaee1f(%rip), %rcx     # 0x128b81
jmp 0x79dc6
cmpl $0x65, %edx
je 0x79dbf
cmpl $0x6c, %edx
jne 0x79dc6
leaq 0xaee1a(%rip), %rcx     # 0x128b8f
jmp 0x79dc6
leaq 0xaedcb(%rip), %rcx     # 0x128b49
jmp 0x79dc6
leaq 0xaed7e(%rip), %rcx     # 0x128b05
jmp 0x79dc6
leaq 0xaed69(%rip), %rcx     # 0x128af9
jmp 0x79dc6
leaq 0xaed72(%rip), %rcx     # 0x128b0b
jmp 0x79dc6
leaq 0xaed74(%rip), %rcx     # 0x128b16
jmp 0x79dc6
leaq 0xaed4a(%rip), %rcx     # 0x128af5
jmp 0x79dc6
leaq 0xaed73(%rip), %rcx     # 0x128b27
jmp 0x79dc6
leaq 0xaedaf(%rip), %rcx     # 0x128b6c
jmp 0x79dc6
leaq 0xaedc2(%rip), %rcx     # 0x128b88
leaq 0xaecc4(%rip), %rsi     # 0x128a91
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
leaq 0x8(%rsp), %r15
addq $0xd, (%r15)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef34e
cvtsi2sd %rax, %xmm0
divsd 0xaeab7(%rip), %xmm0    # 0x1288b0
leaq 0xaeca4(%rip), %rsi     # 0x128aa4
movq %rbx, %rdi
movb $0x1, %al
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef14d
movzbl %al, %ebp
leaq 0xaec96(%rip), %rsi     # 0x128ab6
movq %rbx, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0xe9226
testb %bpl, %bpl
movl $0x2, %eax
cmovnel %ebp, %eax
movl %eax, 0x14(%r12)
cmpl $0x3, %eax
jb 0x79e61
cmpl $0x0, 0x1c(%r14)
jne 0x79e61
leaq 0xaec76(%rip), %rsi     # 0x128ac5
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
movl $0x1, 0x1c(%r14)
leaq 0x8(%rsp), %rsi
incq (%rsi)
movq 0x18(%rbx), %rdi
callq 0xef34e
movl %eax, 0x18(%r12)
movq %rbx, %rdi
callq 0xf6870
movq %rax, %r15
movl 0x18(%r12), %ebp
movzbl 0x10(%r12), %eax
cmpl $0x8, %eax
ja 0x79eb8
movl $0x1b0, %ecx            # imm = 0x1B0
btl %eax, %ecx
jae 0x79eb8
testb $0x1, %bpl
je 0x79eb8
leaq 0xaecfb(%rip), %rsi     # 0x128ba4
movq %r15, %rdi
callq 0xf7566
decl %ebp
movb $0x1, 0x46(%r14)
movb 0x10(%r12), %al
andb $-0x2, %al
cmpb $0x4, %al
jne 0x79f40
testb $0x2, %bpl
je 0x79ee0
leaq 0xaec25(%rip), %rsi     # 0x128af5
movq %r15, %rdi
callq 0xf7566
addl $-0x2, %ebp
movb $0x1, 0x45(%r14)
testb $0x4, %bpl
je 0x79ef8
leaq 0xaecc1(%rip), %rsi     # 0x128bae
movq %r15, %rdi
callq 0xf7566
addl $-0x4, %ebp
testb $0x8, %bpl
je 0x79f10
leaq 0xaecb7(%rip), %rsi     # 0x128bbc
movq %r15, %rdi
callq 0xf7566
addl $-0x8, %ebp
testb $0x10, %bpl
je 0x79f28
leaq 0xaeca3(%rip), %rsi     # 0x128bc0
movq %r15, %rdi
callq 0xf7566
addl $-0x10, %ebp
testb $0x20, %bpl
je 0x79f40
leaq 0xaec94(%rip), %rsi     # 0x128bc9
movq %r15, %rdi
callq 0xf7566
addl $-0x20, %ebp
testl %ebp, %ebp
je 0x79f57
leaq 0xd02d1(%rip), %rsi     # 0x14a21c
movq %r15, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0xf7593
movl 0x18(%r12), %ebp
movq %r15, %rdi
callq 0xf7557
leaq 0xaeb71(%rip), %rsi     # 0x128adc
movq %rbx, %rdi
movl %ebp, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe9226
movq %r15, %rdi
callq 0xf6bb0
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq