// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/tekgame.c
// Function: waitforeverybody
void
waitforeverybody()
{
     int i, j, oldtotalclock;

     if (numplayers < 2) return;

     if (myconnectindex == connecthead)
     {
          for(j=1;j<=2;j++)
          {
               for(i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
                    playerreadyflag[i] = 0;
               oldtotalclock = totalclock-8;
               do
               {
                    getpackets();
                    if (totalclock >= oldtotalclock+8)
                    {
                         oldtotalclock = totalclock;
                         tempbuf[0] = 5;
                         tempbuf[1] = j;
                         for(i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
                              if (playerreadyflag[i] != j) sendpacket(i,tempbuf,2);
                    }
                    for(i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
                         if (playerreadyflag[i] != j) break;
               } while (i >= 0);
          }
     }
     else
     {
          playerreadyflag[connecthead] = 0;
          while (playerreadyflag[connecthead] != 2)
          {
               getpackets();
               if (playerreadyflag[connecthead] == 1)
               {
                    playerreadyflag[connecthead] = 0;
                    sendpacket(connecthead,tempbuf,2);
               }
          }
     }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x796a4e(%rip), %rax    # 0x7a5b2c
cmpl $0x2, (%rax)
jl 0xf220
leaq 0x796a36(%rip), %rax    # 0x7a5b24
movl (%rax), %eax
leaq 0x796a39(%rip), %rcx    # 0x7a5b30
movslq (%rcx), %rcx
cmpl %ecx, %eax
jne 0xf1d2
movl $0x1, %ebp
leaq 0x796a32(%rip), %r12    # 0x7a5b40
leaq 0x11e38b(%rip), %r13    # 0x12d4a0
leaq 0x54e24c(%rip), %r15    # 0x55d368
cltq
movl (%r12,%rax,4), %eax
testl %eax, %eax
js 0xf12f
movl %eax, %eax
movb $0x0, (%rax,%r13)
jmp 0xf11e
movl (%r15), %r14d
addl $-0x8, %r14d
callq 0xedd6
movq %r15, %rbx
movl (%r15), %r15d
leal 0x8(%r14), %ecx
leaq 0x7969e4(%rip), %rax    # 0x7a5b30
movl (%rax), %eax
cmpl %ecx, %r15d
jge 0xf158
movl %r14d, %r15d
jmp 0xf1a2
movslq %eax, %rcx
movb $0x5, 0xd548e(%rip)     # 0xe45f0
movb %bpl, 0xd5488(%rip)     # 0xe45f1
movl (%r12,%rcx,4), %ecx
testl %ecx, %ecx
js 0xf1a2
movl %ecx, %r14d
movsbl (%r14,%r13), %eax
cmpl %eax, %ebp
je 0xf191
movl %r14d, %edi
leaq 0xd5469(%rip), %rsi     # 0xe45f0
movl $0x2, %edx
callq 0x5f092
movl (%r12,%r14,4), %ecx
testl %ecx, %ecx
jns 0xf171
leaq 0x796990(%rip), %rax    # 0x7a5b30
movl (%rax), %eax
movslq %eax, %rcx
movslq (%r12,%rcx,4), %rcx
testq %rcx, %rcx
js 0xf1c2
movsbl (%rcx,%r13), %edx
cmpl %edx, %ebp
je 0xf1a5
movl %r15d, %r14d
movq %rbx, %r15
jmp 0xf136
incl %ebp
cmpl $0x3, %ebp
movq %rbx, %r15
jne 0xf11c
jmp 0xf220
leaq 0x11e2c7(%rip), %r14    # 0x12d4a0
movb $0x0, (%rcx,%r14)
leaq 0xd540b(%rip), %rbx     # 0xe45f0
callq 0xedd6
leaq 0x79693f(%rip), %rax    # 0x7a5b30
movslq (%rax), %rdi
movb (%rdi,%r14), %al
cmpb $0x1, %al
jne 0xf21c
movb $0x0, (%rdi,%r14)
movq %rbx, %rsi
movl $0x2, %edx
callq 0x5f092
leaq 0x79691b(%rip), %rax    # 0x7a5b30
movslq (%rax), %rax
movb (%rax,%r14), %al
cmpb $0x2, %al
jne 0xf1e5
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop