// File: /workspace/github_c_makefile_star2_O3/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 0x3c31(%rip), %rax      # 0x55c8
testq %rdi, %rdi
je 0x19cb
movslq (%rbx), %rcx
movq (%rax,%rcx,8), %rsi
xorl %edx, %edx
leaq 0x3c24(%rip), %rdi      # 0x55d0
leaq 0x3c3d(%rip), %r8       # 0x55f0
movq %rsi, (%rdx,%rdi)
movq (%rax,%rcx,8), %rsi
movq %rsi, (%rdx,%r8)
addq $0x8, %rdx
cmpq $0x18, %rdx
jne 0x19b3
jmp 0x19f3
movq (%rax), %rdx
xorl %ecx, %ecx
leaq 0x3bf9(%rip), %rsi      # 0x55d0
leaq 0x3c12(%rip), %rdi      # 0x55f0
movq %rdx, (%rcx,%rsi)
movq (%rax), %rdx
movq %rdx, (%rcx,%rdi)
addq $0x8, %rcx
cmpq $0x18, %rcx
jne 0x19de
leaq 0x4(%rbx), %rax
movq %rax, 0x10(%rsp)
xorl %r12d, %r12d
movl 0x372b(%rip), %eax      # 0x5130
leaq 0x3c74(%rip), %r13      # 0x5680
leaq 0x28(%rsp), %r14
leaq 0x38(%rsp), %r15
movq %rbx, 0x8(%rsp)
movq %rbx, 0x18(%rsp)
testl %eax, %eax
jle 0x1aee
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 0x3c4e(%rip), %rax      # 0x56a0
movq 0x8(%rax), %rsi
callq 0x1040
xorl %ebp, %ebp
movsd 0x20(%rsp), %xmm0
movl %ebp, %edi
movl %r12d, %esi
callq 0x1b66
incl %ebp
cmpl $0x3, %ebp
jne 0x1a5d
movl %r12d, %edi
callq 0x1cb8
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 0x1ad3
movq (%r13), %rdi
movl $0x1, %esi
movq %r15, %rdx
callq 0x1130
testl %eax, %eax
je 0x1ad3
movq %r15, %rdi
callq 0x1d34
xorl %ebx, %ebx
movb %r12b, %bpl
leal 0x1(%rbx), %ecx
movl 0x3651(%rip), %eax      # 0x5130
movl %ebp, %r12d
cmpl %eax, %ebx
movl %ecx, %ebx
jl 0x1a2d
jmp 0x1af1
movl %r12d, %ebp
movq 0x18(%rsp), %rbx
testq %rbx, %rbx
je 0x1b0e
movq 0x8(%rsp), %rdx
movl 0x4(%rdx), %ecx
cmpl $-0x1, %ecx
je 0x1b1b
addq $0x4, %rdx
jmp 0x1b22
callq 0x1dd0
movl 0x3617(%rip), %eax      # 0x5130
jmp 0x1b5e
movq 0x10(%rsp), %rdx
movl (%rdx), %ecx
movq %rdx, 0x8(%rsp)
leaq 0x3aa2(%rip), %r9       # 0x55d0
leaq 0x3abb(%rip), %r10      # 0x55f0
movq 0x3a54(%rip), %rdx      # 0x5590
movq 0x3a85(%rip), %rsi      # 0x55c8
movslq %ecx, %rcx
xorl %edi, %edi
movq %rdx, (%rdi,%r9)
movq (%rsi,%rcx,8), %r8
movq %r8, (%rdi,%r10)
addq $0x8, %rdi
cmpq $0x18, %rdi
jne 0x1b48
movl %ebp, %r12d
jmp 0x1a20