// File: /workspace/github_c_makefile_star2_O2/veltzer[P]xmeltdown/src/dance.c
// Function: DanceMainLoop
void DanceMainLoop(int* routine)
{
	double factor;
	XEvent my_event;
	int stepctr, i;
	int curbuf=0;
	int newpose;
	int* routine1=routine;
	if (!routine)
		for (i=0; i < PLAYERS; i++) {
			fromskel[i]=skellist[0];
			toskel[i]=skellist[0];
		}
	else
		for (i=0; i < PLAYERS; i++) {
			fromskel[i]=skellist[*routine];
			toskel[i]=skellist[*routine];
		}
	while (1) {
		for (stepctr=1; stepctr <= steps; stepctr++) {
			factor=(double) (steps-stepctr)/(double) steps;
			ClearFrame();
			for (i=0; i < PLAYERS; i++)
				DrawTween(factor, i, curbuf);
			ShowFrame(curbuf);

			curbuf=!curbuf;

			clock_usleep(30000L);
			if (XPending(dpy) && XCheckMaskEvent(dpy, KeyPressMask, &my_event)) {
				HandleKeyPress((XKeyEvent*)&my_event);
				stepctr=0;
			}
		}
#ifdef CHECK_EACH_MOVE
		XNextEvent (dpy, &my_event);
		if (my_event.type == KeyPress)
			HandleKeyPress((XKeyEvent*)&my_event);
#endif
		if (!routine)
			RandomMove();
		else {
			newpose=*(++routine1);
			if (newpose == -1) {
				routine1=routine;
				newpose=*(++routine1);
			}
			for (i=0; i < PLAYERS; i++) {
				fromskel[i]=tweenskel[0];
				toskel[i]=skellist[newpose];
			}
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq 0x3e37(%rip), %rax      # 0x55c8
testq %rdi, %rdi
je 0x17c1
movslq (%rdi), %rcx
xorl %edx, %edx
leaq 0x3e2e(%rip), %rsi      # 0x55d0
leaq 0x3e47(%rip), %r9       # 0x55f0
cmpq $0x18, %rdx
je 0x17e8
movq (%rax,%rcx,8), %r8
movq %r8, (%rdx,%rsi)
movq %r8, (%rdx,%r9)
addq $0x8, %rdx
jmp 0x17a9
xorl %ecx, %ecx
leaq 0x3e06(%rip), %rdx      # 0x55d0
leaq 0x3e1f(%rip), %rsi      # 0x55f0
cmpq $0x18, %rcx
je 0x17e8
movq (%rax), %r8
movq %r8, (%rcx,%rdx)
movq %r8, (%rcx,%rsi)
addq $0x8, %rcx
jmp 0x17d1
leaq 0x4(%rdi), %rax
movq %rax, 0x8(%rsp)
xorl %r12d, %r12d
leaq 0x3e85(%rip), %r13      # 0x5680
pushq $0x1
popq %r14
leaq 0x28(%rsp), %r15
movq %rdi, %r11
movq %rdi, 0x18(%rsp)
movq %r11, 0x10(%rsp)
pushq $0x1
popq %rbx
movl 0x3916(%rip), %eax      # 0x5130
movl %eax, %ecx
subl %ebx, %ecx
jl 0x18a8
cvtsi2sd %ecx, %xmm1
cvtsi2sd %eax, %xmm0
divsd %xmm0, %xmm1
movsd %xmm1, 0x20(%rsp)
callq 0x1bb5
xorl %ebp, %ebp
cmpl $0x3, %ebp
je 0x1856
movsd 0x20(%rsp), %xmm0
movl %ebp, %edi
movl %r12d, %esi
callq 0x1917
incl %ebp
jmp 0x183d
movl %r12d, %edi
callq 0x1a5a
xorl %ebp, %ebp
testl %r12d, %r12d
sete %r12b
movl $0x7530, %edi           # imm = 0x7530
callq 0x1a96
movq (%r13), %rdi
callq 0x11e0
testl %eax, %eax
je 0x189b
movq (%r13), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x1130
testl %eax, %eax
je 0x189b
movq %r15, %rdi
callq 0x1ac5
xorl %ebx, %ebx
movb %r12b, %bpl
incl %ebx
movl %ebp, %r12d
jmp 0x1814
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
jne 0x18bc
callq 0x1b5f
jmp 0x1811
movq 0x10(%rsp), %r11
movl 0x4(%r11), %ecx
cmpl $-0x1, %ecx
je 0x18d0
addq $0x4, %r11
jmp 0x18da
movq 0x8(%rsp), %rax
movl (%rax), %ecx
movq %rax, %r11
leaq 0x3cef(%rip), %r9       # 0x55d0
leaq 0x3d08(%rip), %r10      # 0x55f0
movq 0x3ca1(%rip), %rax      # 0x5590
movq 0x3cd2(%rip), %rdx      # 0x55c8
movslq %ecx, %rcx
xorl %esi, %esi
cmpq $0x18, %rsi
je 0x180c
movq %rax, (%rsi,%r9)
movq (%rdx,%rcx,8), %r8
movq %r8, (%rsi,%r10)
addq $0x8, %rsi
jmp 0x18fb