// File: /workspace/github_c_makefile_star2_O2/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:
cmpb $0x0, 0xba0fe(%rip)     # 0xc797c
je 0xda17
leaq 0x78e2a5(%rip), %rax    # 0x79bb30
movl (%rax), %edx
movslq %edx, %rcx
leaq 0x78e2a9(%rip), %rsi    # 0x79bb40
leaq 0xccbf2(%rip), %rdi     # 0xda490
movl %edx, %r9d
movslq (%rsi,%rcx,4), %rcx
testq %rcx, %rcx
js 0xda17
movl %r9d, %r8d
testb $0x2, 0x1(%rdi,%rcx,2)
movl %ecx, %r9d
je 0xd8a1
pushq %rbp
pushq %rbx
movl (%rsi,%rcx,4), %edi
movslq %r8d, %r8
movl %edi, (%rsi,%r8,4)
movl %edx, (%rsi,%rcx,4)
movswl %cx, %ecx
movl %ecx, (%rax)
movb 0x1133b0(%rip), %al     # 0x120c85
incb %al
movb %al, 0xcdc33(%rip)      # 0xdb510
movb 0x115bad(%rip), %al     # 0x123490
incb %al
movb %al, 0xcdc26(%rip)      # 0xdb511
movzwl 0x113394(%rip), %eax    # 0x120c86
incl %eax
movw %ax, 0xcdc17(%rip)      # 0xdb512
movzwl 0x115b90(%rip), %eax    # 0x123492
incl %eax
movw %ax, 0xcdc09(%rip)      # 0xdb514
movzwl 0x113376(%rip), %eax    # 0x120c88
incl %eax
movw %ax, 0xcdbfb(%rip)      # 0xdb516
movzwl 0x115b72(%rip), %eax    # 0x123494
incl %eax
movw %ax, 0xcdbed(%rip)      # 0xdb518
movzwl 0xce272(%rip), %eax     # 0xdbba4
incl %eax
movw %ax, 0xcdbdf(%rip)      # 0xdb51a
movzwl 0x115b54(%rip), %eax    # 0x123496
incl %eax
movw %ax, 0xcdbd1(%rip)      # 0xdb51c
xorl %eax, %eax
leaq 0xcdbfc(%rip), %rcx     # 0xdb550
leaq 0xcdbd5(%rip), %rdx     # 0xdb530
leaq 0xcdc3e(%rip), %rsi     # 0xdb5a0
leaq 0xcdbf7(%rip), %rdi     # 0xdb560
leaq 0xcdc90(%rip), %r8      # 0xdb600
leaq 0xcdc49(%rip), %r9      # 0xdb5c0
leaq 0xcdcc2(%rip), %r10     # 0xdb640
leaq 0xcdc9b(%rip), %r11     # 0xdb620
xorl %ebx, %ebx
cmpq $0x10, %rbx
je 0xd9c3
movb (%rbx,%rcx), %bpl
incb %bpl
movb %bpl, (%rbx,%rdx)
movzwl (%rax,%rsi), %ebp
incl %ebp
movw %bp, (%rax,%rdi)
movzwl (%rax,%r8), %ebp
incl %ebp
movw %bp, (%rax,%r9)
movzwl (%rax,%r10), %ebp
incl %ebp
movw %bp, (%rax,%r11)
incq %rbx
addq $0x2, %rax
jmp 0xd987
andl $0x0, 0xcdb2e(%rip)     # 0xdb4f8
andl $0x0, 0xcdb2b(%rip)     # 0xdb4fc
andl $0x0, 0xcdb28(%rip)     # 0xdb500
andl $0x0, 0xcdb25(%rip)     # 0xdb504
andl $0x0, 0xcdb22(%rip)     # 0xdb508
andl $0x0, 0xcdb1f(%rip)     # 0xdb50c
movl 0xcca95(%rip), %eax     # 0xda488
leaq 0x54596e(%rip), %rcx    # 0x553368
movl %eax, (%rcx)
movl %eax, 0xcca52(%rip)     # 0xda454
movl %eax, 0xcca50(%rip)     # 0xda458
movl %eax, 0xcdb12(%rip)     # 0xdb520
movb $0x1, 0xcca3e(%rip)     # 0xda453
popq %rbx
popq %rbp
retq