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

     if (option[4] == 0) return;

     i = connecthead; j = connectpoint2[i];
     while (j >= 0)
     {
          if ((syncbits[j]&512) > 0)
          {
               connectpoint2[i] = connectpoint2[j];
               connectpoint2[j] = connecthead;
               connecthead = (short)j;

               olocvel = locvel+1; olocvel2 = locvel2+1;
               olocsvel = locsvel+1; olocsvel2 = locsvel2+1;
               olocangvel = locangvel+1; olocangvel2 = locangvel2+1;
               olocbits = locbits+1; olocbits2 = locbits2+1;
               for(i=0;i<MAXPLAYERS;i++)
               {
                    osyncvel[i] = fsyncvel[i]+1;
                    osyncsvel[i] = fsyncsvel[i]+1;
                    osyncangvel[i] = fsyncangvel[i]+1;
                    osyncbits[i] = fsyncbits[i]+1;
               }

               syncvalplc = 0L; othersyncvalplc = 0L;
               syncvalend = 0L; othersyncvalend = 0L;
               syncvalcnt = 0L; othersyncvalcnt = 0L;

               totalclock = lockclock;
               ototalclock = lockclock;
               gotlastpacketclock = lockclock;
               masterslavetexttime = lockclock;
               ready2send = 1;
               return;
          }
          i = j; j = connectpoint2[i];
     }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movzbl 0x109651(%rip), %eax    # 0x119f1c
cmpl $0x0, %eax
jne 0x108d5
jmp 0x10b22
leaq 0x794674(%rip), %rax    # 0x7a4f50
movl (%rax), %eax
movl %eax, -0x4(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x794674(%rip), %rax    # 0x7a4f60
movl (%rax,%rcx,4), %eax
movl %eax, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
jl 0x10b22
movslq -0x8(%rbp), %rcx
leaq 0x11cf09(%rip), %rax    # 0x12d810
movzwl (%rax,%rcx,2), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
jle 0x10b06
movslq -0x8(%rbp), %rcx
leaq 0x79463c(%rip), %rax    # 0x7a4f60
movl (%rax,%rcx,4), %edx
movslq -0x4(%rbp), %rcx
leaq 0x79462e(%rip), %rax    # 0x7a4f60
movl %edx, (%rax,%rcx,4)
leaq 0x794614(%rip), %rax    # 0x7a4f50
movl (%rax), %edx
movslq -0x8(%rbp), %rcx
leaq 0x794617(%rip), %rax    # 0x7a4f60
movl %edx, (%rax,%rcx,4)
movl -0x8(%rbp), %eax
movswl %ax, %ecx
leaq 0x7945f7(%rip), %rax    # 0x7a4f50
movl %ecx, (%rax)
movsbl 0x1632e3(%rip), %eax    # 0x173c45
addl $0x1, %eax
movb %al, 0x11db65(%rip)     # 0x12e4d0
movsbl 0x165ade(%rip), %eax    # 0x176450
addl $0x1, %eax
movb %al, 0x11db56(%rip)     # 0x12e4d1
movswl 0x1632c4(%rip), %eax    # 0x173c46
addl $0x1, %eax
movw %ax, 0x11db46(%rip)     # 0x12e4d2
movswl 0x165abf(%rip), %eax    # 0x176452
addl $0x1, %eax
movw %ax, 0x11db37(%rip)     # 0x12e4d4
movswl 0x1632a4(%rip), %eax    # 0x173c48
addl $0x1, %eax
movw %ax, 0x11db28(%rip)     # 0x12e4d6
movswl 0x165a9f(%rip), %eax    # 0x176454
addl $0x1, %eax
movw %ax, 0x11db19(%rip)     # 0x12e4d8
movswl 0x11e19e(%rip), %eax    # 0x12eb64
addl $0x1, %eax
movw %ax, 0x11db0a(%rip)     # 0x12e4da
movswl 0x165a7f(%rip), %eax    # 0x176456
addl $0x1, %eax
movw %ax, 0x11dafb(%rip)     # 0x12e4dc
movl $0x0, -0x4(%rbp)
cmpl $0x10, -0x4(%rbp)
jge 0x10a8e
movslq -0x4(%rbp), %rcx
leaq 0x11db13(%rip), %rax    # 0x12e510
movsbl (%rax,%rcx), %eax
addl $0x1, %eax
movb %al, %dl
movslq -0x4(%rbp), %rcx
leaq 0x11dadf(%rip), %rax    # 0x12e4f0
movb %dl, (%rax,%rcx)
movslq -0x4(%rbp), %rcx
leaq 0x11db41(%rip), %rax    # 0x12e560
movswl (%rax,%rcx,2), %eax
addl $0x1, %eax
movw %ax, %dx
movslq -0x4(%rbp), %rcx
leaq 0x11daec(%rip), %rax    # 0x12e520
movw %dx, (%rax,%rcx,2)
movslq -0x4(%rbp), %rcx
leaq 0x11db7d(%rip), %rax    # 0x12e5c0
movswl (%rax,%rcx,2), %eax
addl $0x1, %eax
movw %ax, %dx
movslq -0x4(%rbp), %rcx
leaq 0x11db28(%rip), %rax    # 0x12e580
movw %dx, (%rax,%rcx,2)
movslq -0x4(%rbp), %rcx
leaq 0x11db99(%rip), %rax    # 0x12e600
movzwl (%rax,%rcx,2), %eax
addl $0x1, %eax
movw %ax, %dx
movslq -0x4(%rbp), %rcx
leaq 0x11db64(%rip), %rax    # 0x12e5e0
movw %dx, (%rax,%rcx,2)
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x109e8
movl $0x0, 0x11da20(%rip)    # 0x12e4b8
movl $0x0, 0x11da1a(%rip)    # 0x12e4bc
movl $0x0, 0x11da14(%rip)    # 0x12e4c0
movl $0x0, 0x11da0e(%rip)    # 0x12e4c4
movl $0x0, 0x11da08(%rip)    # 0x12e4c8
movl $0x0, 0x11da02(%rip)    # 0x12e4cc
movl 0x11cd38(%rip), %ecx    # 0x12d808
leaq 0x595841(%rip), %rax    # 0x5a6318
movl %ecx, (%rax)
movl 0x11cd29(%rip), %eax    # 0x12d808
movl %eax, 0x11ccef(%rip)    # 0x12d7d4
movl 0x11cd1d(%rip), %eax    # 0x12d808
movl %eax, 0x11cce7(%rip)    # 0x12d7d8
movl 0x11cd11(%rip), %eax    # 0x12d808
movl %eax, 0x11d9e3(%rip)    # 0x12e4e0
movb $0x1, 0x11cccf(%rip)    # 0x12d7d3
jmp 0x10b22
movl -0x8(%rbp), %eax
movl %eax, -0x4(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x794449(%rip), %rax    # 0x7a4f60
movl (%rax,%rcx,4), %eax
movl %eax, -0x8(%rbp)
jmp 0x108f2
popq %rbp
retq
nopw %cs:(%rax,%rax)