// File: /workspace/github_c_makefile_star2_O1/veltzer[P]xmeltdown/src/dance.c
// Function: DrawTween
void DrawTween(double factor, int which, int curbuf)
/* what fraction the movement is completed
 * which player
 * which buffer not to draw into */
{
	RayPtr toray, fromray, tweenray;
	int bonesize=sizeof(Ray);
	int bone;
/*	int		stepctr, skelctr; */
	/* static int	lastbuf = 0; */
/*	int		flag1 = 1;
 * int		flag2 = 1;
 * int		flag3 = 1;
 * int		flag4 = 0; */
	for (bone=0; bone < 11; bone++) {
		fromray=(RayPtr) ((long) &(fromskel[which]->torso)+(long) (bone*bonesize));
		toray=(RayPtr) ((long) &(toskel[which]->torso)+(long) (bone*bonesize));
		tweenray=(RayPtr) ((long) &(tweenskel[which]->torso)+(long) (bone*bonesize));
/*
** Never rotate through an angle > PI. I.e., take the shortest path.
*/
		if ((fromray->t-toray->t) > M_PI)
			toray->t+=2*M_PI;
		else if ((toray->t-fromray->t) > M_PI)
			fromray->t+=2*M_PI;
		tweenray->t=(fromray->t*factor+toray->t*(1.0-factor));
		tweenray->r=(fromray->r*factor+toray->r*(1.0-factor));
	}
	tweenskel[which]->headradius=fromskel[which]->headradius*factor+toskel[which]->headradius*(1.0-factor);
	tweenskel[which]->waistx=fromskel[which]->waistx*factor+toskel[which]->waistx*(1.0-factor);
	tweenskel[which]->waisty=fromskel[which]->waisty*factor+toskel[which]->waisty*(1.0-factor);

	tweenskel[which]->waistx=OFFSET+(which*OFFSET);

	DrawSkel(tweenskel[which], unset_gc, buffer[!curbuf]);
}

// Assembly:
pushq %r14
pushq %rbx
movslq %edi, %rax
leaq 0x3aeb(%rip), %rdx      # 0x55d0
movq (%rdx,%rax,8), %r8
leaq 0x3b00(%rip), %rdi      # 0x55f0
movq (%rdi,%rax,8), %r9
leaq 0x3a95(%rip), %rcx      # 0x5590
movq (%rcx,%rax,8), %r10
movsd 0x1501(%rip), %xmm1     # 0x3008
subsd %xmm0, %xmm1
movl $0x10, %r11d
movsd 0x14f7(%rip), %xmm2     # 0x3010
movsd 0x14f7(%rip), %xmm3     # 0x3018
movsd 0x8(%r8,%r11), %xmm5
movsd 0x8(%r9,%r11), %xmm4
movapd %xmm5, %xmm6
subsd %xmm4, %xmm6
ucomisd %xmm2, %xmm6
jbe 0x1b47
leaq (%r9,%r11), %rbx
addq $0x8, %rbx
jmp 0x1b5d
subsd %xmm5, %xmm4
ucomisd %xmm2, %xmm4
jbe 0x1b65
leaq (%r8,%r11), %rbx
addq $0x8, %rbx
movapd %xmm5, %xmm4
addsd %xmm3, %xmm4
movsd %xmm4, (%rbx)
leaq (%r8,%r11), %rbx
leaq (%r9,%r11), %r14
movsd 0x8(%r14), %xmm4
mulsd %xmm1, %xmm4
movsd 0x8(%rbx), %xmm5
mulsd %xmm0, %xmm5
addsd %xmm4, %xmm5
movsd %xmm5, 0x8(%r10,%r11)
xorps %xmm4, %xmm4
cvtsi2sdl (%rbx), %xmm4
xorps %xmm5, %xmm5
cvtsi2sdl (%r14), %xmm5
mulsd %xmm1, %xmm5
mulsd %xmm0, %xmm4
addsd %xmm5, %xmm4
cvttsd2si %xmm4, %ebx
movl %ebx, (%r10,%r11)
addq $0x20, %r11
cmpq $0x170, %r11            # imm = 0x170
jne 0x1b21
movq (%rdx,%rax,8), %rdx
xorps %xmm2, %xmm2
cvtsi2sdl (%rdx), %xmm2
movq (%rdi,%rax,8), %r8
xorps %xmm3, %xmm3
cvtsi2sdl (%r8), %xmm3
mulsd %xmm1, %xmm3
mulsd %xmm0, %xmm2
addsd %xmm3, %xmm2
cvttsd2si %xmm2, %r9d
movq (%rcx,%rax,8), %rdi
movl %r9d, (%rdi)
xorps %xmm2, %xmm2
cvtsi2sdl 0x4(%rdx), %xmm2
xorps %xmm3, %xmm3
cvtsi2sdl 0x4(%r8), %xmm3
mulsd %xmm1, %xmm3
mulsd %xmm0, %xmm2
addsd %xmm3, %xmm2
cvttsd2si %xmm2, %ecx
movl %ecx, 0x4(%rdi)
xorps %xmm2, %xmm2
cvtsi2sdl 0x8(%rdx), %xmm2
xorps %xmm3, %xmm3
cvtsi2sdl 0x8(%r8), %xmm3
mulsd %xmm1, %xmm3
mulsd %xmm0, %xmm2
addsd %xmm3, %xmm2
cvttsd2si %xmm2, %ecx
movl %ecx, 0x8(%rdi)
imull $0x64, %eax, %eax
addl $0x64, %eax
movl %eax, 0x4(%rdi)
movq 0x396a(%rip), %rax      # 0x55b0
xorl %ecx, %ecx
testl %esi, %esi
sete %cl
leaq 0x3a4c(%rip), %rdx      # 0x56a0
movq (%rdx,%rcx,8), %rdx
movq %rax, %rsi
popq %rbx
popq %r14
jmp 0x1e88