// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/src/tekstat.c
// Function: initspriteXTs
int
initspriteXTs()
{
     int       fh,i,nr,ext;

     memset(&pickup, 0, sizeof(pickup));
     pickup.extra=-1;

     for (i=0; i<MAXSPRITES; i++) {
          memset(&spriteXT[i], 0, sizeof(struct spriteextension));
     }

     fh=kopen4load(boardfilename, 0);
     if( fh == -1 ) {
          return 0;
     }

     // read in XTtrailer
     klseek(fh, -((int)sizeof(struct XTtrailertype)), SEEK_END);
     memset(&XTtrailer, 0, sizeof(struct XTtrailertype));
     kread(fh, &XTtrailer, sizeof(struct XTtrailertype));

     // if no previous extension info then continue
     if( strcmp(XTtrailer.ID, TRAILERID) != 0 ) {
          goto noext;
     }

     // load and intialize spriteXT array members
     klseek(fh, XTtrailer.start, SEEK_SET);
     for( i=0; i<XTtrailer.numXTs; i++ ) {
          nr=kread(fh, &XTsave, sizeof(struct XTsavetype));
          if( nr != sizeof(struct XTsavetype) )
               break;
          spriteXT[XTsave.XTnum]=XTsave.sprXT;  // struct assign
     }

noext:

     kclose(fh);

     switch( difficulty ) {
     case 0:
     case 1:
          vadd=-1;
          break;
     case 2:
          vadd=0;
          break;
     case 3:
          vadd=3;
          break;
     }

     // adjust speed for difficulty
     for( i=0; i<MAXSPRITES; i++ ) {
          if( sprite[i].extra != -1 ) {
              #ifdef  NOSHOWSPRITES
	          show2dsprite[i>>3] &= ~(1<<(i&7));
              #endif
               switch( spriteXT[sprite[i].extra].basestat ) {
               case GUARD:
               case CHASE:
               case STALK:
                    sprite[i].xvel+=vadd;
                    if( sprite[i].xvel < 0 )
                         sprite[i].xvel=0;
                    sprite[i].yvel+=vadd;
                    if( sprite[i].yvel < 0 )
                         sprite[i].yvel=0;
                    sprite[i].zvel+=vadd;
                    if( sprite[i].zvel < 0 )
                         sprite[i].zvel=0;
                    break;
               }
          }
     }

     // only CHASE in multiplayer
     if( option[4] != 0 ) {
          for( i=0; i<MAXSPRITES; i++ ) {
               if( (ext=sprite[i].extra) != -1 ) {
                    if( sprite[i].statnum != CHASE ) {
                         jsdeletesprite(i);
                    }
                    else if( spriteXT[ext].basestat != CHASE ) {
                         jsdeletesprite(i);
                    }
               }
          }
     }

     if( noenemiesflag != 0 ) {
          for( i=0; i<MAXSPRITES; i++ ) {
               if( sprptr[i]->extra != -1 ) {
                    jsdeletesprite(i);
               }
          }
     }

     if( noguardflag != 0 ) {
          for( i=0; i<MAXSPRITES; i++ ) {
               if( sprptr[i]->statnum == GUARD ) {
                    jsdeletesprite(i);
               }
               else {
                    if( sprptr[i]->extra != -1 ) {
                         if( sprXTptr[sprptr[i]->extra]->basestat == GUARD ) {
                              jsdeletesprite(i);
                         }
                    }
               }
          }
     }

     if( nostalkflag != 0 ) {
          for( i=0; i<MAXSPRITES; i++ ) {
               if( sprptr[i]->statnum == STALK ) {
                    jsdeletesprite(i);
               }
               else {
                    if( sprptr[i]->extra != -1 ) {
                         if( sprXTptr[sprptr[i]->extra]->basestat == STALK ) {
                              jsdeletesprite(i);
                         }
                    }
               }
          }
     }

     if( nochaseflag != 0 ) {
          for( i=0; i<MAXSPRITES; i++ ) {
               if( sprptr[i]->statnum == CHASE ) {
                    jsdeletesprite(i);
               }
               else {
                    if( sprptr[i]->extra != -1 ) {
                         if( sprXTptr[sprptr[i]->extra]->basestat == CHASE ) {
                              jsdeletesprite(i);
                         }
                    }
               }
          }
     }

     if( nostrollflag != 0 ) {
          for( i=0; i<MAXSPRITES; i++ ) {
               if( sprptr[i]->statnum == STROLL ) {
                    jsdeletesprite(i);
               }
               else {
                    if( sprptr[i]->extra != -1 ) {
                         if( sprXTptr[sprptr[i]->extra]->basestat == STROLL ) {
                              jsdeletesprite(i);
                         }
                    }
               }
          }
     }

     return(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
leaq 0x2ddff1(%rip), %rdi    # 0x309410
xorl %esi, %esi
movl $0x2c, %edx
callq 0x8410
movw $0xffff, 0x2de006(%rip) # imm = 0xFFFF
movl $0x0, -0xc(%rbp)
cmpl $0x4000, -0xc(%rbp)     # imm = 0x4000
jge 0x2b46d
movslq -0xc(%rbp), %rax
leaq 0x16ed91(%rip), %rdi    # 0x19a1e0
imulq $0x22, %rax, %rax
addq %rax, %rdi
xorl %esi, %esi
movl $0x22, %edx
callq 0x8410
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x2b43b
leaq 0x10335c(%rip), %rdi    # 0x12e7d0
xorl %esi, %esi
callq 0x4d470
movl %eax, -0x8(%rbp)
cmpl $-0x1, -0x8(%rbp)
jne 0x2b490
movl $0x0, -0x4(%rbp)
jmp 0x2bafd
movl -0x8(%rbp), %edi
movl $0xffffffde, %esi       # imm = 0xFFFFFFDE
movl $0x2, %edx
callq 0x4db20
leaq 0x2ddf93(%rip), %rdi    # 0x30943c
xorl %esi, %esi
movl $0x22, %edx
callq 0x8410
movl -0x8(%rbp), %edi
leaq 0x2ddf7d(%rip), %rsi    # 0x30943c
movl $0x22, %edx
callq 0x4d840
leaq 0x2ddf81(%rip), %rdi    # 0x309451
leaq 0xaedd5(%rip), %rsi     # 0xda2ac
callq 0x8b90
cmpl $0x0, %eax
je 0x2b4e3
jmp 0x2b560
movl -0x8(%rbp), %edi
movl 0x2ddf54(%rip), %esi    # 0x309440
xorl %edx, %edx
callq 0x4db20
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpl 0x2ddf39(%rip), %eax    # 0x30943c
jge 0x2b55e
movl -0x8(%rbp), %edi
leaq 0x2ddf4f(%rip), %rsi    # 0x30945e
movl $0x24, %edx
callq 0x4d840
movl %eax, -0x10(%rbp)
movslq -0x10(%rbp), %rax
cmpq $0x24, %rax
je 0x2b528
jmp 0x2b55e
movswq 0x2ddf2e(%rip), %rax    # 0x30945e
leaq 0x16eca9(%rip), %rdi    # 0x19a1e0
imulq $0x22, %rax, %rax
addq %rax, %rdi
leaq 0x2ddf19(%rip), %rsi    # 0x30945e
addq $0x2, %rsi
movl $0x22, %edx
callq 0x80e0
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x2b4fa
jmp 0x2b560
movl -0x8(%rbp), %edi
callq 0x4def0
leaq 0x14ea59(%rip), %rax    # 0x179fc8
movl (%rax), %eax
movl %eax, -0x18(%rbp)
subl $0x2, %eax
jb 0x2b58f
jmp 0x2b57b
movl -0x18(%rbp), %eax
subl $0x2, %eax
je 0x2b59b
jmp 0x2b585
movl -0x18(%rbp), %eax
subl $0x3, %eax
je 0x2b5a7
jmp 0x2b5b1
movl $0xffffffff, 0x2ddeeb(%rip) # imm = 0xFFFFFFFF
jmp 0x2b5b1
movl $0x0, 0x2ddedf(%rip)    # 0x309484
jmp 0x2b5b1
movl $0x3, 0x2dded3(%rip)    # 0x309484
movl $0x0, -0xc(%rbp)
cmpl $0x4000, -0xc(%rbp)     # imm = 0x4000
jge 0x2b742
movslq -0xc(%rbp), %rcx
leaq 0x44b510(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movswl 0x2a(%rax), %eax
cmpl $-0x1, %eax
je 0x2b732
movslq -0xc(%rbp), %rax
imulq $0x2c, %rax, %rcx
leaq 0x44b4ed(%rip), %rax    # 0x476ae0
movswq 0x2a(%rax,%rcx), %rcx
movq %rcx, %rax
shlq $0x5, %rax
leaq (%rax,%rcx,2), %rcx
leaq 0x16ebd5(%rip), %rax    # 0x19a1e0
movswl 0x8(%rax,%rcx), %eax
movl %eax, -0x1c(%rbp)
addl $0xffffff35, %eax       # imm = 0xFFFFFF35
subl $0x2, %eax
jb 0x2b62f
jmp 0x2b61f
movl -0x1c(%rbp), %eax
subl $0xce, %eax
jne 0x2b730
jmp 0x2b62f
movl 0x2dde4f(%rip), %edx    # 0x309484
movslq -0xc(%rbp), %rcx
leaq 0x44b4a0(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movswl 0x20(%rax), %ecx
addl %edx, %ecx
movw %cx, 0x20(%rax)
movslq -0xc(%rbp), %rcx
leaq 0x44b484(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movswl 0x20(%rax), %eax
cmpl $0x0, %eax
jge 0x2b684
movslq -0xc(%rbp), %rcx
leaq 0x44b469(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movw $0x0, 0x20(%rax)
movl 0x2dddfa(%rip), %edx    # 0x309484
movslq -0xc(%rbp), %rcx
leaq 0x44b44b(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movswl 0x22(%rax), %ecx
addl %edx, %ecx
movw %cx, 0x22(%rax)
movslq -0xc(%rbp), %rcx
leaq 0x44b42f(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movswl 0x22(%rax), %eax
cmpl $0x0, %eax
jge 0x2b6d9
movslq -0xc(%rbp), %rcx
leaq 0x44b414(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movw $0x0, 0x22(%rax)
movl 0x2ddda5(%rip), %edx    # 0x309484
movslq -0xc(%rbp), %rcx
leaq 0x44b3f6(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movswl 0x24(%rax), %ecx
addl %edx, %ecx
movw %cx, 0x24(%rax)
movslq -0xc(%rbp), %rcx
leaq 0x44b3da(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movswl 0x24(%rax), %eax
cmpl $0x0, %eax
jge 0x2b72e
movslq -0xc(%rbp), %rcx
leaq 0x44b3bf(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movw $0x0, 0x24(%rax)
jmp 0x2b730
jmp 0x2b732
jmp 0x2b734
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x2b5b8
leaq 0xee7cf(%rip), %rax     # 0x119f18
movzbl 0x4(%rax), %eax
cmpl $0x0, %eax
je 0x2b7f0
movl $0x0, -0xc(%rbp)
cmpl $0x4000, -0xc(%rbp)     # imm = 0x4000
jge 0x2b7ee
movslq -0xc(%rbp), %rcx
leaq 0x44b36b(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movswl 0x2a(%rax), %eax
movl %eax, -0x14(%rbp)
cmpl $-0x1, %eax
je 0x2b7de
movslq -0xc(%rbp), %rcx
leaq 0x44b34d(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movswl 0x1a(%rax), %eax
cmpl $0xce, %eax
je 0x2b7b2
movl -0xc(%rbp), %eax
movswl %ax, %edi
callq 0x2ae00
jmp 0x2b7dc
movslq -0x14(%rbp), %rcx
leaq 0x16ea23(%rip), %rax    # 0x19a1e0
imulq $0x22, %rcx, %rcx
addq %rcx, %rax
movswl 0x8(%rax), %eax
cmpl $0xce, %eax
je 0x2b7da
movl -0xc(%rbp), %eax
movswl %ax, %edi
callq 0x2ae00
jmp 0x2b7dc
jmp 0x2b7de
jmp 0x2b7e0
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x2b75d
jmp 0x2b7f0
leaq 0x14e7e1(%rip), %rax    # 0x179fd8
cmpl $0x0, (%rax)
je 0x2b83e
movl $0x0, -0xc(%rbp)
cmpl $0x4000, -0xc(%rbp)     # imm = 0x4000
jge 0x2b83c
movslq -0xc(%rbp), %rcx
leaq 0x14e9c9(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movswl 0x2a(%rax), %eax
cmpl $-0x1, %eax
je 0x2b82f
movl -0xc(%rbp), %eax
movswl %ax, %edi
callq 0x2ae00
jmp 0x2b831
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x2b803
jmp 0x2b83e
leaq 0x14e797(%rip), %rax    # 0x179fdc
cmpl $0x0, (%rax)
je 0x2b8ec
movl $0x0, -0xc(%rbp)
cmpl $0x4000, -0xc(%rbp)     # imm = 0x4000
jge 0x2b8ea
movslq -0xc(%rbp), %rcx
leaq 0x14e973(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movswl 0x1a(%rax), %eax
cmpl $0xcb, %eax
jne 0x2b889
movl -0xc(%rbp), %eax
movswl %ax, %edi
callq 0x2ae00
jmp 0x2b8da
movslq -0xc(%rbp), %rcx
leaq 0x14e94c(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movswl 0x2a(%rax), %eax
cmpl $-0x1, %eax
je 0x2b8d8
movslq -0xc(%rbp), %rcx
leaq 0x14e934(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movswq 0x2a(%rax), %rcx
leaq 0x1f6924(%rip), %rax    # 0x2221e0
movq (%rax,%rcx,8), %rax
movswl 0x8(%rax), %eax
cmpl $0xcb, %eax
jne 0x2b8d6
movl -0xc(%rbp), %eax
movswl %ax, %edi
callq 0x2ae00
jmp 0x2b8d8
jmp 0x2b8da
jmp 0x2b8dc
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x2b855
jmp 0x2b8ec
leaq 0x14e6ed(%rip), %rax    # 0x179fe0
cmpl $0x0, (%rax)
je 0x2b99a
movl $0x0, -0xc(%rbp)
cmpl $0x4000, -0xc(%rbp)     # imm = 0x4000
jge 0x2b998
movslq -0xc(%rbp), %rcx
leaq 0x14e8c5(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movswl 0x1a(%rax), %eax
cmpl $0xcc, %eax
jne 0x2b937
movl -0xc(%rbp), %eax
movswl %ax, %edi
callq 0x2ae00
jmp 0x2b988
movslq -0xc(%rbp), %rcx
leaq 0x14e89e(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movswl 0x2a(%rax), %eax
cmpl $-0x1, %eax
je 0x2b986
movslq -0xc(%rbp), %rcx
leaq 0x14e886(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movswq 0x2a(%rax), %rcx
leaq 0x1f6876(%rip), %rax    # 0x2221e0
movq (%rax,%rcx,8), %rax
movswl 0x8(%rax), %eax
cmpl $0xcc, %eax
jne 0x2b984
movl -0xc(%rbp), %eax
movswl %ax, %edi
callq 0x2ae00
jmp 0x2b986
jmp 0x2b988
jmp 0x2b98a
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x2b903
jmp 0x2b99a
leaq 0x14e643(%rip), %rax    # 0x179fe4
cmpl $0x0, (%rax)
je 0x2ba48
movl $0x0, -0xc(%rbp)
cmpl $0x4000, -0xc(%rbp)     # imm = 0x4000
jge 0x2ba46
movslq -0xc(%rbp), %rcx
leaq 0x14e817(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movswl 0x1a(%rax), %eax
cmpl $0xce, %eax
jne 0x2b9e5
movl -0xc(%rbp), %eax
movswl %ax, %edi
callq 0x2ae00
jmp 0x2ba36
movslq -0xc(%rbp), %rcx
leaq 0x14e7f0(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movswl 0x2a(%rax), %eax
cmpl $-0x1, %eax
je 0x2ba34
movslq -0xc(%rbp), %rcx
leaq 0x14e7d8(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movswq 0x2a(%rax), %rcx
leaq 0x1f67c8(%rip), %rax    # 0x2221e0
movq (%rax,%rcx,8), %rax
movswl 0x8(%rax), %eax
cmpl $0xce, %eax
jne 0x2ba32
movl -0xc(%rbp), %eax
movswl %ax, %edi
callq 0x2ae00
jmp 0x2ba34
jmp 0x2ba36
jmp 0x2ba38
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x2b9b1
jmp 0x2ba48
leaq 0x14e599(%rip), %rax    # 0x179fe8
cmpl $0x0, (%rax)
je 0x2baf6
movl $0x0, -0xc(%rbp)
cmpl $0x4000, -0xc(%rbp)     # imm = 0x4000
jge 0x2baf4
movslq -0xc(%rbp), %rcx
leaq 0x14e769(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movswl 0x1a(%rax), %eax
cmpl $0xd1, %eax
jne 0x2ba93
movl -0xc(%rbp), %eax
movswl %ax, %edi
callq 0x2ae00
jmp 0x2bae4
movslq -0xc(%rbp), %rcx
leaq 0x14e742(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movswl 0x2a(%rax), %eax
cmpl $-0x1, %eax
je 0x2bae2
movslq -0xc(%rbp), %rcx
leaq 0x14e72a(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movswq 0x2a(%rax), %rcx
leaq 0x1f671a(%rip), %rax    # 0x2221e0
movq (%rax,%rcx,8), %rax
movswl 0x8(%rax), %eax
cmpl $0xd1, %eax
jne 0x2bae0
movl -0xc(%rbp), %eax
movswl %ax, %edi
callq 0x2ae00
jmp 0x2bae2
jmp 0x2bae4
jmp 0x2bae6
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x2ba5f
jmp 0x2baf6
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)