// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/jfbuild/src/mdsprite.c
// Function: updateanimation
static void updateanimation (md2model *m, spritetype *tspr)
{
	mdanim_t *anim;
	int i, j;

	m->cframe = m->nframe = tile2model[tspr->picnum].framenum;

	for (anim = m->animations;
		  anim && anim->startframe != m->cframe;
		  anim = anim->next) ;
	if (!anim) { m->interpol = 0; return; }

	if (((int)spriteext[tspr->owner].mdanimcur) != anim->startframe ||
			(spriteext[tspr->owner].flags & SPREXT_NOMDANIM))
	{
		spriteext[tspr->owner].mdanimcur = (short)anim->startframe;
		spriteext[tspr->owner].mdanimtims = mdtims;
		m->cframe = m->nframe = anim->startframe;
		m->interpol = 0;
		return;
	}

	i = (mdtims-spriteext[tspr->owner].mdanimtims)*anim->fpssc;
	j = ((anim->endframe+1-anim->startframe)<<16);

		//Just in case you play the game for a VERY int time...
	if (i < 0) { i = 0; spriteext[tspr->owner].mdanimtims = mdtims; }
		//compare with j*2 instead of j to ensure i stays > j-65536 for MDANIM_ONESHOT
	if ((i >= j+j) && (anim->fpssc)) //Keep mdanimtims close to mdtims to avoid the use of MOD
		spriteext[tspr->owner].mdanimtims += j/anim->fpssc;

	if (anim->flags&MDANIM_ONESHOT)
		{ if (i > j-65536) i = j-65536; }
	else { if (i >= j) { i -= j; if (i >= j) i %= j; } }

	m->cframe = (i>>16)+anim->startframe;
	m->nframe = m->cframe+1; if (m->nframe > anim->endframe) m->nframe = anim->startframe;
	m->interpol = ((float)(i&65535))/65536.f;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movswq 0xe(%rax), %rcx
leaq 0x5a3994(%rip), %rax    # 0x63c020
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x28(%rax)
movq -0x8(%rbp), %rax
movl %ecx, 0x24(%rax)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x18(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x18(%rbp)
movb %al, -0x21(%rbp)
je 0x986cf
movq -0x18(%rbp), %rax
movl (%rax), %eax
movq -0x8(%rbp), %rcx
cmpl 0x24(%rcx), %eax
setne %al
movb %al, -0x21(%rbp)
movb -0x21(%rbp), %al
testb $0x1, %al
jne 0x986d8
jmp 0x986e8
jmp 0x986da
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x986b0
cmpq $0x0, -0x18(%rbp)
jne 0x98700
movq -0x8(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x3c(%rax)
jmp 0x98912
movq -0x10(%rbp), %rax
movswq 0x1e(%rax), %rcx
leaq 0x2d1100(%rip), %rax    # 0x369810
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movswl 0x4(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
jne 0x98746
movq -0x10(%rbp), %rax
movswq 0x1e(%rax), %rcx
leaq 0x2d10dd(%rip), %rax    # 0x369810
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movzbl 0x8(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x987ae
movq -0x18(%rbp), %rax
movl (%rax), %eax
movw %ax, %cx
movq -0x10(%rbp), %rax
movswq 0x1e(%rax), %rdx
leaq 0x2d10b1(%rip), %rax    # 0x369810
imulq $0xc, %rdx, %rdx
addq %rdx, %rax
movw %cx, 0x4(%rax)
movl 0x60e910(%rip), %ecx    # 0x6a7080
movq -0x10(%rbp), %rax
movswq 0x1e(%rax), %rdx
leaq 0x2d1090(%rip), %rax    # 0x369810
imulq $0xc, %rdx, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
movl (%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x28(%rax)
movq -0x8(%rbp), %rax
movl %ecx, 0x24(%rax)
movq -0x8(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x3c(%rax)
jmp 0x98912
movl 0x60e8cc(%rip), %eax    # 0x6a7080
movq -0x10(%rbp), %rcx
movswq 0x1e(%rcx), %rdx
leaq 0x2d104c(%rip), %rcx    # 0x369810
imulq $0xc, %rdx, %rdx
addq %rdx, %rcx
subl (%rcx), %eax
movq -0x18(%rbp), %rcx
imull 0x8(%rcx), %eax
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
addl $0x1, %eax
movq -0x18(%rbp), %rcx
subl (%rcx), %eax
shll $0x10, %eax
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x1c(%rbp)
jge 0x9881a
movl $0x0, -0x1c(%rbp)
movl 0x60e87f(%rip), %ecx    # 0x6a7080
movq -0x10(%rbp), %rax
movswq 0x1e(%rax), %rdx
leaq 0x2d0fff(%rip), %rax    # 0x369810
imulq $0xc, %rdx, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movl -0x1c(%rbp), %eax
movl -0x20(%rbp), %ecx
addl -0x20(%rbp), %ecx
cmpl %ecx, %eax
jl 0x98859
movq -0x18(%rbp), %rax
cmpl $0x0, 0x8(%rax)
je 0x98859
movl -0x20(%rbp), %eax
movq -0x18(%rbp), %rcx
cltd
idivl 0x8(%rcx)
movl %eax, %ecx
movq -0x10(%rbp), %rax
movswq 0x1e(%rax), %rdx
leaq 0x2d0fc2(%rip), %rax    # 0x369810
imulq $0xc, %rdx, %rdx
addq %rdx, %rax
addl (%rax), %ecx
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x98885
movl -0x1c(%rbp), %eax
movl -0x20(%rbp), %ecx
subl $0x10000, %ecx          # imm = 0x10000
cmpl %ecx, %eax
jle 0x98883
movl -0x20(%rbp), %eax
subl $0x10000, %eax          # imm = 0x10000
movl %eax, -0x1c(%rbp)
jmp 0x988b0
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jl 0x988ae
movl -0x20(%rbp), %ecx
movl -0x1c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jl 0x988ac
movl -0x20(%rbp), %ecx
movl -0x1c(%rbp), %eax
cltd
idivl %ecx
movl %edx, -0x1c(%rbp)
jmp 0x988ae
jmp 0x988b0
movl -0x1c(%rbp), %ecx
sarl $0x10, %ecx
movq -0x18(%rbp), %rax
addl (%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x24(%rax)
movq -0x8(%rbp), %rax
movl 0x24(%rax), %ecx
addl $0x1, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x28(%rax)
movq -0x8(%rbp), %rax
movl 0x28(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jle 0x988f1
movq -0x18(%rbp), %rax
movl (%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x28(%rax)
movl -0x1c(%rbp), %eax
andl $0xffff, %eax           # imm = 0xFFFF
cvtsi2ss %eax, %xmm0
movss 0x1a4f3(%rip), %xmm1    # 0xb2df8
divss %xmm1, %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x3c(%rax)
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop