// File: /workspace/github_c_makefile_star2_O1/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 $0xf8, %rsp
movq %rdi, %rbx
movq 0x3cb8(%rip), %rax      # 0x55c8
testq %rdi, %rdi
je 0x1944
movslq (%rbx), %rcx
xorl %edx, %edx
leaq 0x3caf(%rip), %rsi      # 0x55d0
leaq 0x3cc8(%rip), %rdi      # 0x55f0
movq (%rax,%rcx,8), %r8
movq %r8, (%rdx,%rsi)
movq (%rax,%rcx,8), %r8
movq %r8, (%rdx,%rdi)
addq $0x8, %rdx
cmpq $0x18, %rdx
jne 0x1928
jmp 0x196c
xorl %ecx, %ecx
leaq 0x3c83(%rip), %rdx      # 0x55d0
leaq 0x3c9c(%rip), %rsi      # 0x55f0
movq (%rax), %rdi
movq %rdi, (%rcx,%rdx)
movq (%rax), %rdi
movq %rdi, (%rcx,%rsi)
addq $0x8, %rcx
cmpq $0x18, %rcx
jne 0x1954
leaq 0x4(%rbx), %rax
movq %rax, 0x10(%rsp)
xorl %r12d, %r12d
leaq 0x3d01(%rip), %r13      # 0x5680
leaq 0x28(%rsp), %r14
leaq 0x38(%rsp), %r15
movq %rbx, 0x8(%rsp)
movq %rbx, 0x18(%rsp)
movl 0x3797(%rip), %eax      # 0x5130
testl %eax, %eax
jle 0x1a67
movl $0x1, %ebx
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
subl %ebx, %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x20(%rsp)
movq (%r13), %rdi
leaq 0x3cd5(%rip), %rax      # 0x56a0
movq 0x8(%rax), %rsi
callq 0x1040
xorl %ebp, %ebp
movsd 0x20(%rsp), %xmm0
movl %ebp, %edi
movl %r12d, %esi
callq 0x1ad8
incl %ebp
cmpl $0x3, %ebp
jne 0x19d6
movl %r12d, %edi
callq 0x1c63
xorl %ebp, %ebp
testl %r12d, %r12d
sete %r12b
movq $0x0, 0x28(%rsp)
movq $0x7530, 0x30(%rsp)     # imm = 0x7530
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movq %r14, %r8
callq 0x1080
movq (%r13), %rdi
callq 0x11e0
testl %eax, %eax
je 0x1a4c
movq (%r13), %rdi
movl $0x1, %esi
movq %r15, %rdx
callq 0x1130
testl %eax, %eax
je 0x1a4c
movq %r15, %rdi
callq 0x1cdf
xorl %ebx, %ebx
movb %r12b, %bpl
leal 0x1(%rbx), %ecx
movl 0x36d8(%rip), %eax      # 0x5130
movl %ebp, %r12d
cmpl %eax, %ebx
movl %ecx, %ebx
jl 0x19a6
jmp 0x1a6a
movl %r12d, %ebp
movq 0x18(%rsp), %rbx
testq %rbx, %rbx
je 0x1a87
movq 0x8(%rsp), %rcx
movl 0x4(%rcx), %eax
cmpl $-0x1, %eax
je 0x1a8e
addq $0x4, %rcx
jmp 0x1a95
callq 0x1d77
jmp 0x1ad0
movq 0x10(%rsp), %rcx
movl (%rcx), %eax
movq %rcx, 0x8(%rsp)
leaq 0x3b2f(%rip), %r8       # 0x55d0
leaq 0x3b48(%rip), %r9       # 0x55f0
movq 0x3ae1(%rip), %rcx      # 0x5590
movq 0x3b12(%rip), %rdx      # 0x55c8
cltq
xorl %esi, %esi
movq %rcx, (%rsi,%r8)
movq (%rdx,%rax,8), %rdi
movq %rdi, (%rsi,%r9)
addq $0x8, %rsi
cmpq $0x18, %rsi
jne 0x1aba
movl %ebp, %r12d
jmp 0x1993