// File: /workspace/github_c_makefile_star2_O0/veltzer[P]xmeltdown/src/stickread.c
// Function: Interpolate
void Interpolate(Skeleton** skellist, int steps)
{
	RayPtr to, from, tweenray;
	int bonesize=sizeof(Ray);
	Skeleton* skel1, *skel2;
	int stepctr, skelctr, bone;
	Skeleton tween1;
	// Skeleton	tween2;
	double factor;
	// Skeleton	*oldskel;
	Skeleton* newskel=NULL;
	/* Skeleton *tempskel; */
	int curbuf=0;
	int flag1=1;
	int flag2=1;
	int flag3=1;
	int flag4=0;

	newskel=&tween1;
	// oldskel = &tween2;
	for (skelctr=0; skellist[skelctr+1] != NULL; skelctr++) {
		skel1=skellist[skelctr];
		skel2=skellist[skelctr+1];

		tween1.headradius=skel1->headradius;
		// tween2.headradius = skel2->headradius;
		for (stepctr=0; stepctr < steps; stepctr++) {
			factor=(double) (steps-stepctr)/(double) steps;
			for (bone=0; bone < 11; bone++) {
				from=(RayPtr)((long) &(skel1->torso)+(long) (bone*bonesize));
				to=(RayPtr) ((long) &(skel2->torso)+(long) (bone*bonesize));
				tweenray=(RayPtr) ((long) &(newskel->torso)+(long) (bone*bonesize));
/*
** Never rotate through an angle > PI. I.e., take the shortest path.
*/
				if ((from->t-to->t) > M_PI)
					to->t+=2*M_PI;
				else if ((to->t-from->t) > M_PI)
					from->t+=2*M_PI;
				tweenray->t=(from->t*factor+to->t*(1.0-factor));
				tweenray->r=(from->r*factor+to->r*(1.0-factor));
			}
			newskel->waistx=skel1->waistx*factor+
					 skel2->waistx*(1.0-factor);
			newskel->waisty=skel1->waisty*factor+
					 skel2->waisty*(1.0-factor);
/*
** Real double-buffering...clear the hidden window, draw the skeleton
** in it, bring it to the top.
*/
			if (flag1 == 1) XClearWindow(dpy, buffer[!curbuf]);
			if (!flag2 && flag4) XRaiseWindow(dpy, buffer[!curbuf]);
			if (!flag2 && !flag4) {
				XMapWindow(dpy, buffer[!curbuf]);
				XUnmapWindow(dpy, buffer[curbuf]);
			}
			DrawSkel(newskel, unset_gc, buffer[!curbuf]);
			if (flag2 && flag4) XRaiseWindow(dpy, buffer[!curbuf]);
			if (flag2 && !flag4) {
				XMapWindow(dpy, buffer[!curbuf]);
				XUnmapWindow(dpy, buffer[curbuf]);
			}
			if (flag3) curbuf=!curbuf;
/*
 * Simulated double-buffering: Keep track of previous skeleton, and undraw
 * it just before drawing the new one.
 *
 * DrawSkel(newskel, neg_gc);
 *
 * if (oldskel != NULL)
 * DrawSkel(oldskel, neg_gc);
 *
 * DrawSkel(newskel, unset_gc);
 *
 * tempskel = oldskel;
 * oldskel = newskel;
 * newskel = tempskel;
 */
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1f0, %rsp            # imm = 0x1F0
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl $0x20, -0x2c(%rbp)
movq $0x0, -0x1d0(%rbp)
movl $0x0, -0x1d4(%rbp)
movl $0x1, -0x1d8(%rbp)
movl $0x1, -0x1dc(%rbp)
movl $0x1, -0x1e0(%rbp)
movl $0x0, -0x1e4(%rbp)
leaq -0x1c0(%rbp), %rax
movq %rax, -0x1d0(%rbp)
movl $0x0, -0x48(%rbp)
movq -0x8(%rbp), %rax
movl -0x48(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x1c6f
movq -0x8(%rbp), %rax
movslq -0x48(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movl -0x48(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x1c0(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x1c5f
movl -0xc(%rbp), %eax
subl -0x44(%rbp), %eax
cvtsi2sd %eax, %xmm0
cvtsi2sdl -0xc(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x1c8(%rbp)
movl $0x0, -0x4c(%rbp)
cmpl $0xb, -0x4c(%rbp)
jge 0x19fc
movq -0x38(%rbp), %rax
addq $0x10, %rax
movl -0x4c(%rbp), %ecx
imull -0x2c(%rbp), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x40(%rbp), %rax
addq $0x10, %rax
movl -0x4c(%rbp), %ecx
imull -0x2c(%rbp), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x1d0(%rbp), %rax
addq $0x10, %rax
movl -0x4c(%rbp), %ecx
imull -0x2c(%rbp), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movsd 0x8(%rax), %xmm0
movq -0x18(%rbp), %rax
subsd 0x8(%rax), %xmm0
movsd 0x16f5(%rip), %xmm1     # 0x3010
ucomisd %xmm1, %xmm0
jbe 0x1939
movq -0x18(%rbp), %rax
movsd 0x16eb(%rip), %xmm0     # 0x3018
addsd 0x8(%rax), %xmm0
movsd %xmm0, 0x8(%rax)
jmp 0x1971
movq -0x18(%rbp), %rax
movsd 0x8(%rax), %xmm0
movq -0x20(%rbp), %rax
subsd 0x8(%rax), %xmm0
movsd 0x16bd(%rip), %xmm1     # 0x3010
ucomisd %xmm1, %xmm0
jbe 0x196f
movq -0x20(%rbp), %rax
movsd 0x16b3(%rip), %xmm0     # 0x3018
addsd 0x8(%rax), %xmm0
movsd %xmm0, 0x8(%rax)
jmp 0x1971
movq -0x20(%rbp), %rax
movsd 0x8(%rax), %xmm0
movsd -0x1c8(%rbp), %xmm2
movq -0x18(%rbp), %rax
movsd 0x8(%rax), %xmm1
movsd 0x1675(%rip), %xmm3     # 0x3008
subsd -0x1c8(%rbp), %xmm3
mulsd %xmm3, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq -0x28(%rbp), %rax
movsd %xmm0, 0x8(%rax)
movq -0x20(%rbp), %rax
cvtsi2sdl (%rax), %xmm0
movsd -0x1c8(%rbp), %xmm2
movq -0x18(%rbp), %rax
cvtsi2sdl (%rax), %xmm1
movsd 0x1638(%rip), %xmm3     # 0x3008
subsd -0x1c8(%rbp), %xmm3
mulsd %xmm3, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x18a9
movq -0x38(%rbp), %rax
cvtsi2sdl 0x4(%rax), %xmm0
movsd -0x1c8(%rbp), %xmm2
movq -0x40(%rbp), %rax
cvtsi2sdl 0x4(%rax), %xmm1
movsd 0x15ea(%rip), %xmm3     # 0x3008
subsd -0x1c8(%rbp), %xmm3
mulsd %xmm3, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
movq -0x1d0(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x38(%rbp), %rax
cvtsi2sdl 0x8(%rax), %xmm0
movsd -0x1c8(%rbp), %xmm2
movq -0x40(%rbp), %rax
cvtsi2sdl 0x8(%rax), %xmm1
movsd 0x15a6(%rip), %xmm3     # 0x3008
subsd -0x1c8(%rbp), %xmm3
mulsd %xmm3, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
movq -0x1d0(%rbp), %rax
movl %ecx, 0x8(%rax)
cmpl $0x1, -0x1d8(%rbp)
jne 0x1abb
leaq 0x36ec(%rip), %rax      # 0x5180
movq (%rax), %rdi
cmpl $0x0, -0x1d4(%rbp)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movslq %eax, %rcx
leaq 0x36ee(%rip), %rax      # 0x51a0
movq (%rax,%rcx,8), %rsi
callq 0x1040
cmpl $0x0, -0x1dc(%rbp)
jne 0x1afb
cmpl $0x0, -0x1e4(%rbp)
je 0x1afb
leaq 0x36ac(%rip), %rax      # 0x5180
movq (%rax), %rdi
cmpl $0x0, -0x1d4(%rbp)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movslq %eax, %rcx
leaq 0x36ae(%rip), %rax      # 0x51a0
movq (%rax,%rcx,8), %rsi
callq 0x1070
cmpl $0x0, -0x1dc(%rbp)
jne 0x1b5c
cmpl $0x0, -0x1e4(%rbp)
jne 0x1b5c
leaq 0x366c(%rip), %rax      # 0x5180
movq (%rax), %rdi
cmpl $0x0, -0x1d4(%rbp)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movslq %eax, %rcx
leaq 0x366e(%rip), %rax      # 0x51a0
movq (%rax,%rcx,8), %rsi
callq 0x1110
leaq 0x363e(%rip), %rax      # 0x5180
movq (%rax), %rdi
movslq -0x1d4(%rbp), %rcx
leaq 0x364d(%rip), %rax      # 0x51a0
movq (%rax,%rcx,8), %rsi
callq 0x10d0
movq -0x1d0(%rbp), %rdi
movq 0x3596(%rip), %rsi      # 0x5100
cmpl $0x0, -0x1d4(%rbp)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movslq %eax, %rcx
leaq 0x361b(%rip), %rax      # 0x51a0
movq (%rax,%rcx,8), %rdx
callq 0x1d80
cmpl $0x0, -0x1dc(%rbp)
je 0x1bce
cmpl $0x0, -0x1e4(%rbp)
je 0x1bce
leaq 0x35d9(%rip), %rax      # 0x5180
movq (%rax), %rdi
cmpl $0x0, -0x1d4(%rbp)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movslq %eax, %rcx
leaq 0x35db(%rip), %rax      # 0x51a0
movq (%rax,%rcx,8), %rsi
callq 0x1070
cmpl $0x0, -0x1dc(%rbp)
je 0x1c2f
cmpl $0x0, -0x1e4(%rbp)
jne 0x1c2f
leaq 0x3599(%rip), %rax      # 0x5180
movq (%rax), %rdi
cmpl $0x0, -0x1d4(%rbp)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movslq %eax, %rcx
leaq 0x359b(%rip), %rax      # 0x51a0
movq (%rax,%rcx,8), %rsi
callq 0x1110
leaq 0x356b(%rip), %rax      # 0x5180
movq (%rax), %rdi
movslq -0x1d4(%rbp), %rcx
leaq 0x357a(%rip), %rax      # 0x51a0
movq (%rax,%rcx,8), %rsi
callq 0x10d0
cmpl $0x0, -0x1e0(%rbp)
je 0x1c4f
cmpl $0x0, -0x1d4(%rbp)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x1d4(%rbp)
jmp 0x1c51
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x187b
jmp 0x1c61
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x182b
addq $0x1f0, %rsp            # imm = 0x1F0
popq %rbp
retq
nopl (%rax,%rax)