// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xdc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xe8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x1989
movl $0x0, -0xd8(%rbp)
cmpl $0x3, -0xd8(%rbp)
jge 0x1987
movq 0x3c73(%rip), %rax      # 0x55b8
movq (%rax), %rdx
movslq -0xd8(%rbp), %rcx
leaq 0x3c6a(%rip), %rax      # 0x55c0
movq %rdx, (%rax,%rcx,8)
movq 0x3c57(%rip), %rax      # 0x55b8
movq (%rax), %rdx
movslq -0xd8(%rbp), %rcx
leaq 0x3c6e(%rip), %rax      # 0x55e0
movq %rdx, (%rax,%rcx,8)
movl -0xd8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd8(%rbp)
jmp 0x1935
jmp 0x19f7
movl $0x0, -0xd8(%rbp)
cmpl $0x3, -0xd8(%rbp)
jge 0x19f5
movq 0x3c15(%rip), %rax      # 0x55b8
movq -0x8(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdx
movslq -0xd8(%rbp), %rcx
leaq 0x3c04(%rip), %rax      # 0x55c0
movq %rdx, (%rax,%rcx,8)
movq 0x3bf1(%rip), %rax      # 0x55b8
movq -0x8(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdx
movslq -0xd8(%rbp), %rcx
leaq 0x3c00(%rip), %rax      # 0x55e0
movq %rdx, (%rax,%rcx,8)
movl -0xd8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd8(%rbp)
jmp 0x1993
jmp 0x19f7
jmp 0x19f9
movl $0x1, -0xd4(%rbp)
movl -0xd4(%rbp), %eax
cmpl 0x3711(%rip), %eax      # 0x5120
jg 0x1b01
movl 0x3705(%rip), %eax      # 0x5120
subl -0xd4(%rbp), %eax
cvtsi2sd %eax, %xmm0
cvtsi2sdl 0x36f3(%rip), %xmm1 # 0x5120
divsd %xmm1, %xmm0
movsd %xmm0, -0x10(%rbp)
callq 0x20c0
movl $0x0, -0xd8(%rbp)
cmpl $0x3, -0xd8(%rbp)
jge 0x1a75
movsd -0x10(%rbp), %xmm0
movl -0xd8(%rbp), %edi
movl -0xdc(%rbp), %esi
callq 0x1bd0
movl -0xd8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd8(%rbp)
jmp 0x1a45
movl -0xdc(%rbp), %edi
callq 0x1ec0
cmpl $0x0, -0xdc(%rbp)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0xdc(%rbp)
movl $0x7530, %edi           # imm = 0x7530
callq 0x1f20
leaq 0x3bc8(%rip), %rax      # 0x5670
movq (%rax), %rdi
callq 0x11d0
cmpl $0x0, %eax
je 0x1aeb
leaq 0x3bb4(%rip), %rax      # 0x5670
movq (%rax), %rdi
movl $0x1, %esi
leaq -0xd0(%rbp), %rdx
callq 0x1120
cmpl $0x0, %eax
je 0x1aeb
leaq -0xd0(%rbp), %rdi
callq 0x1f70
movl $0x0, -0xd4(%rbp)
jmp 0x1aed
movl -0xd4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd4(%rbp)
jmp 0x1a03
cmpq $0x0, -0x8(%rbp)
jne 0x1b12
callq 0x2040
jmp 0x1bc5
movq -0xe8(%rbp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0xe8(%rbp)
movl 0x4(%rax), %eax
movl %eax, -0xe0(%rbp)
cmpl $-0x1, -0xe0(%rbp)
jne 0x1b62
movq -0x8(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0xe8(%rbp)
movl 0x4(%rax), %eax
movl %eax, -0xe0(%rbp)
movl $0x0, -0xd8(%rbp)
cmpl $0x3, -0xd8(%rbp)
jge 0x1bc3
movq 0x3a04(%rip), %rdx      # 0x5580
movslq -0xd8(%rbp), %rcx
leaq 0x3a36(%rip), %rax      # 0x55c0
movq %rdx, (%rax,%rcx,8)
movq 0x3a23(%rip), %rax      # 0x55b8
movslq -0xe0(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movslq -0xd8(%rbp), %rcx
leaq 0x3a32(%rip), %rax      # 0x55e0
movq %rdx, (%rax,%rcx,8)
movl -0xd8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd8(%rbp)
jmp 0x1b6c
jmp 0x1bc5
jmp 0x19f9
nopw (%rax,%rax)