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

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

     while ((tempbufleng = getpacket(&other,tempbuf)) > 0)
     {
          switch(tempbuf[0])
          {
               case 0:  //[0] (receive master sync buffer)
                    j = ((numplayers+1)>>1)+1; k = (1<<3);
                    for(i=connecthead;i>=0;i=connectpoint2[i])
                    {
                         l = (tempbuf[k>>3]>>(k&7));
                         if (l&1) fsyncvel[i] = tempbuf[j++];
//** Les START - 09/27/95
                         if (l&2) {
                              fsyncsvel[i]=tempbuf[j++];
                              fsyncsvel[i]|=(tempbuf[j++]<<8);
                         }
                         if (l&4) {
                              fsyncangvel[i]=tempbuf[j++];
                              fsyncangvel[i]|=(tempbuf[j++]<<8);
                         }
//** Les END   - 09/27/95
                         if (l&8)
                         {
                              fsyncbits[i] = ((short)tempbuf[j])+(((short)tempbuf[j+1])<<8);
                              j += 2;
                         }
                         k += 4;
                    }
#if 0
                    while (j != tempbufleng)
                    {
                         othersyncval[othersyncvalend] = ((int)tempbuf[j]);
                         othersyncval[othersyncvalend] += (((int)tempbuf[j+1])<<8);
                         j += 2;
                         othersyncvalend = ((othersyncvalend+1)&(MOVEFIFOSIZ-1));
                    }

                    i = 0;
                    while (syncvalplc != syncvalend)
                    {
                         if (othersyncvalcnt > syncvalcnt)
                         {
                              if (i == 0) syncstat = 0, i = 1;
                              syncstat |= (syncval[syncvalplc]^othersyncval[syncvalplc]);
                         }
                         syncvalplc = ((syncvalplc+1)&(MOVEFIFOSIZ-1));
                         syncvalcnt++;
                    }
                    while (othersyncvalplc != othersyncvalend)
                    {
                         if (syncvalcnt > othersyncvalcnt)
                         {
                              if (i == 0) syncstat = 0, i = 1;
                              syncstat |= (syncval[othersyncvalplc]^othersyncval[othersyncvalplc]);
                         }
                         othersyncvalplc = ((othersyncvalplc+1)&(MOVEFIFOSIZ-1));
                         othersyncvalcnt++;
                    }
#endif

                movethings();        //Move all players and sprites
                    break;
               case 1:  //[1] (receive slave sync buffer)
                    j = 2; k = tempbuf[1];
                    if (k&1) fsyncvel[other] = tempbuf[j++];
//** Les START - 09/27/95
                     if (k&2) {
                         fsyncsvel[other]=tempbuf[j++];
                         fsyncsvel[other]|=(tempbuf[j++]<<8);
                     }
                     if (k&4) {
                         fsyncangvel[other]=tempbuf[j++];
                         fsyncangvel[other]|=(tempbuf[j++]<<8);
                     }
//** Les END   - 09/27/95
                    if (k&8) fsyncbits[other] = ((fsyncbits[other]&0xff00)|((short)tempbuf[j++]));
                    if (k&16) fsyncbits[other] = ((fsyncbits[other]&0x00ff)|(((short)tempbuf[j++])<<8));
                    break;
               case 2:
                    getmessageleng = tempbufleng-1;
                    for(j=getmessageleng-1;j>=0;j--) getmessage[j] = tempbuf[j+1];
                    getmessagetimeoff = totalclock+360+(getmessageleng<<4);
                    break;
               case 3:
                    break;
              #ifdef NETNAMES
               case 8:
                    memcpy(netnames[tempbuf[1]],&tempbuf[2],10);
                    netnames[tempbuf[1]][10]=0;
                    break;
              #endif
               case 5:
                    playerreadyflag[other] = tempbuf[1];
                    if ((other == connecthead) && (tempbuf[1] == 2))
                         sendpacket(connecthead,tempbuf,2);
                    break;
               case 255:  //[255] (logout)
                    deletesprite(playersprite[other]);
                    sprintf(tektempbuf,"%2d %8s HAS QUIT", other,netnames[other]);
                    showmessage(tektempbuf);
                    break;
          }
     }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movzbl 0x108a7d(%rip), %eax    # 0x119f1c
cmpl $0x0, %eax
jne 0x114a9
jmp 0x11a34
jmp 0x114ab
leaq -0x14(%rbp), %rdi
leaq 0x11c4ba(%rip), %rsi    # 0x12d970
callq 0x88500
movl %eax, -0x18(%rbp)
cmpl $0x0, %eax
jle 0x11a34
movzbl 0x11c4a2(%rip), %eax    # 0x12d970
movl %eax, -0x1c(%rbp)
testl %eax, %eax
je 0x11530
jmp 0x114d7
movl -0x1c(%rbp), %eax
subl $0x1, %eax
je 0x1170e
jmp 0x114e5
movl -0x1c(%rbp), %eax
subl $0x2, %eax
je 0x118d8
jmp 0x114f3
movl -0x1c(%rbp), %eax
subl $0x3, %eax
je 0x11948
jmp 0x11501
movl -0x1c(%rbp), %eax
subl $0x5, %eax
je 0x11999
jmp 0x1150f
movl -0x1c(%rbp), %eax
subl $0x8, %eax
je 0x1194d
jmp 0x1151d
movl -0x1c(%rbp), %eax
subl $0xff, %eax
je 0x119e3
jmp 0x11a2f
leaq 0x793a15(%rip), %rax    # 0x7a4f4c
movl (%rax), %eax
addl $0x1, %eax
sarl %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
movl $0x8, -0xc(%rbp)
leaq 0x7939fe(%rip), %rax    # 0x7a4f50
movl (%rax), %eax
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
jl 0x11704
movl -0xc(%rbp), %eax
sarl $0x3, %eax
movslq %eax, %rcx
leaq 0x11c3ff(%rip), %rax    # 0x12d970
movzbl (%rax,%rcx), %eax
movl -0xc(%rbp), %ecx
andl $0x7, %ecx
sarl %cl, %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x115b1
movl -0x8(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x8(%rbp)
movslq %eax, %rcx
leaq 0x11c3d0(%rip), %rax    # 0x12d970
movb (%rax,%rcx), %dl
movslq -0x4(%rbp), %rcx
leaq 0x11cf62(%rip), %rax    # 0x12e510
movb %dl, (%rax,%rcx)
movl -0x10(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x11622
movl -0x8(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x8(%rbp)
movslq %eax, %rcx
leaq 0x11c39f(%rip), %rax    # 0x12d970
movzbl (%rax,%rcx), %eax
movw %ax, %dx
movslq -0x4(%rbp), %rcx
leaq 0x11cf7d(%rip), %rax    # 0x12e560
movw %dx, (%rax,%rcx,2)
movl -0x8(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x8(%rbp)
movslq %eax, %rcx
leaq 0x11c374(%rip), %rax    # 0x12d970
movzbl (%rax,%rcx), %edx
shll $0x8, %edx
movslq -0x4(%rbp), %rcx
leaq 0x11cf52(%rip), %rax    # 0x12e560
movswl (%rax,%rcx,2), %eax
orl %edx, %eax
movw %ax, %dx
leaq 0x11cf42(%rip), %rax    # 0x12e560
movw %dx, (%rax,%rcx,2)
movl -0x10(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x11693
movl -0x8(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x8(%rbp)
movslq %eax, %rcx
leaq 0x11c32e(%rip), %rax    # 0x12d970
movzbl (%rax,%rcx), %eax
movw %ax, %dx
movslq -0x4(%rbp), %rcx
leaq 0x11cf6c(%rip), %rax    # 0x12e5c0
movw %dx, (%rax,%rcx,2)
movl -0x8(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x8(%rbp)
movslq %eax, %rcx
leaq 0x11c303(%rip), %rax    # 0x12d970
movzbl (%rax,%rcx), %edx
shll $0x8, %edx
movslq -0x4(%rbp), %rcx
leaq 0x11cf41(%rip), %rax    # 0x12e5c0
movswl (%rax,%rcx,2), %eax
orl %edx, %eax
movw %ax, %dx
leaq 0x11cf31(%rip), %rax    # 0x12e5c0
movw %dx, (%rax,%rcx,2)
movl -0x10(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x116e5
movslq -0x8(%rbp), %rcx
leaq 0x11c2c7(%rip), %rax    # 0x12d970
movzbl (%rax,%rcx), %eax
cwtl
movl -0x8(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rdx
leaq 0x11c2b2(%rip), %rcx    # 0x12d970
movzbl (%rcx,%rdx), %ecx
movswl %cx, %ecx
shll $0x8, %ecx
addl %ecx, %eax
movw %ax, %dx
movslq -0x4(%rbp), %rcx
leaq 0x11cf28(%rip), %rax    # 0x12e600
movw %dx, (%rax,%rcx,2)
movl -0x8(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x8(%rbp)
movl -0xc(%rbp), %eax
addl $0x4, %eax
movl %eax, -0xc(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x793867(%rip), %rax    # 0x7a4f60
movl (%rax,%rcx,4), %eax
movl %eax, -0x4(%rbp)
jmp 0x11557
callq 0xe1c0
jmp 0x11a2f
movl $0x2, -0x8(%rbp)
movzbl 0x11c255(%rip), %eax    # 0x12d971
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x11750
movl -0x8(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x8(%rbp)
movslq %eax, %rcx
leaq 0x11c231(%rip), %rax    # 0x12d970
movb (%rax,%rcx), %dl
movslq -0x14(%rbp), %rcx
leaq 0x11cdc3(%rip), %rax    # 0x12e510
movb %dl, (%rax,%rcx)
movl -0xc(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x117c1
movl -0x8(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x8(%rbp)
movslq %eax, %rcx
leaq 0x11c200(%rip), %rax    # 0x12d970
movzbl (%rax,%rcx), %eax
movw %ax, %dx
movslq -0x14(%rbp), %rcx
leaq 0x11cdde(%rip), %rax    # 0x12e560
movw %dx, (%rax,%rcx,2)
movl -0x8(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x8(%rbp)
movslq %eax, %rcx
leaq 0x11c1d5(%rip), %rax    # 0x12d970
movzbl (%rax,%rcx), %edx
shll $0x8, %edx
movslq -0x14(%rbp), %rcx
leaq 0x11cdb3(%rip), %rax    # 0x12e560
movswl (%rax,%rcx,2), %eax
orl %edx, %eax
movw %ax, %dx
leaq 0x11cda3(%rip), %rax    # 0x12e560
movw %dx, (%rax,%rcx,2)
movl -0xc(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x11832
movl -0x8(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x8(%rbp)
movslq %eax, %rcx
leaq 0x11c18f(%rip), %rax    # 0x12d970
movzbl (%rax,%rcx), %eax
movw %ax, %dx
movslq -0x14(%rbp), %rcx
leaq 0x11cdcd(%rip), %rax    # 0x12e5c0
movw %dx, (%rax,%rcx,2)
movl -0x8(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x8(%rbp)
movslq %eax, %rcx
leaq 0x11c164(%rip), %rax    # 0x12d970
movzbl (%rax,%rcx), %edx
shll $0x8, %edx
movslq -0x14(%rbp), %rcx
leaq 0x11cda2(%rip), %rax    # 0x12e5c0
movswl (%rax,%rcx,2), %eax
orl %edx, %eax
movw %ax, %dx
leaq 0x11cd92(%rip), %rax    # 0x12e5c0
movw %dx, (%rax,%rcx,2)
movl -0xc(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x11881
movslq -0x14(%rbp), %rcx
leaq 0x11cdb8(%rip), %rax    # 0x12e600
movzwl (%rax,%rcx,2), %eax
andl $0xff00, %eax           # imm = 0xFF00
movl -0x8(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x8(%rbp)
movslq %ecx, %rdx
leaq 0x11c10a(%rip), %rcx    # 0x12d970
movzbl (%rcx,%rdx), %ecx
movswl %cx, %ecx
orl %ecx, %eax
movw %ax, %dx
movslq -0x14(%rbp), %rcx
leaq 0x11cd83(%rip), %rax    # 0x12e600
movw %dx, (%rax,%rcx,2)
movl -0xc(%rbp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x118d3
movslq -0x14(%rbp), %rcx
leaq 0x11cd69(%rip), %rax    # 0x12e600
movzwl (%rax,%rcx,2), %eax
andl $0xff, %eax
movl -0x8(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x8(%rbp)
movslq %ecx, %rdx
leaq 0x11c0bb(%rip), %rcx    # 0x12d970
movzbl (%rcx,%rdx), %ecx
movswl %cx, %ecx
shll $0x8, %ecx
orl %ecx, %eax
movw %ax, %dx
movslq -0x14(%rbp), %rcx
leaq 0x11cd31(%rip), %rax    # 0x12e600
movw %dx, (%rax,%rcx,2)
jmp 0x11a2f
movl -0x18(%rbp), %eax
subl $0x1, %eax
movb %al, 0x11d282(%rip)     # 0x12eb66
movsbl 0x11d27b(%rip), %eax    # 0x12eb66
subl $0x1, %eax
movl %eax, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
jl 0x11923
movl -0x8(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq 0x11c069(%rip), %rax    # 0x12d970
movb (%rax,%rcx), %dl
movslq -0x8(%rbp), %rcx
leaq 0x11d25b(%rip), %rax    # 0x12eb70
movb %dl, (%rax,%rcx)
movl -0x8(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x118f1
leaq 0x5949ee(%rip), %rax    # 0x5a6318
movl (%rax), %eax
addl $0x168, %eax            # imm = 0x168
movsbl 0x11d22e(%rip), %ecx    # 0x12eb66
shll $0x4, %ecx
addl %ecx, %eax
movl %eax, 0x11d2d1(%rip)    # 0x12ec14
jmp 0x11a2f
jmp 0x11a2f
movzbl 0x11c01d(%rip), %eax    # 0x12d971
movl %eax, %ecx
leaq 0x11ccd3(%rip), %rax    # 0x12e630
imulq $0xb, %rcx, %rcx
addq %rcx, %rax
movq 0x11c007(%rip), %rcx    # 0x12d972
movq %rcx, (%rax)
movw 0x11c005(%rip), %cx     # 0x12d97a
movw %cx, 0x8(%rax)
movzbl 0x11bff1(%rip), %eax    # 0x12d971
movl %eax, %ecx
leaq 0x11cca7(%rip), %rax    # 0x12e630
imulq $0xb, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0xa(%rax)
jmp 0x11a2f
movb 0x11bfd2(%rip), %dl     # 0x12d971
movslq -0x14(%rbp), %rcx
leaq 0x164ab6(%rip), %rax    # 0x176460
movb %dl, (%rax,%rcx)
movl -0x14(%rbp), %eax
leaq 0x793599(%rip), %rcx    # 0x7a4f50
cmpl (%rcx), %eax
jne 0x119e1
movzbl 0x11bfaf(%rip), %eax    # 0x12d971
cmpl $0x2, %eax
jne 0x119e1
leaq 0x793582(%rip), %rax    # 0x7a4f50
movl (%rax), %edi
leaq 0x11bf99(%rip), %rsi    # 0x12d970
movl $0x2, %edx
callq 0x89280
jmp 0x11a2f
movslq -0x14(%rbp), %rcx
leaq 0x11cd22(%rip), %rax    # 0x12e710
movswl (%rax,%rcx,2), %edi
callq 0x6a190
movl -0x14(%rbp), %edx
movslq -0x14(%rbp), %rax
leaq 0x11cc2b(%rip), %rcx    # 0x12e630
imulq $0xb, %rax, %rax
addq %rax, %rcx
leaq 0x16840d(%rip), %rdi    # 0x179e20
leaq 0xc789b(%rip), %rsi     # 0xd92b5
movb $0x0, %al
callq 0x8e50
leaq 0x1683f8(%rip), %rdi    # 0x179e20
movb $0x0, %al
callq 0x1a150
jmp 0x114ab
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)