// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/src/tekspr.c
// Function: operatesprite
void
operatesprite(short dasprite)
{
     int           datag;
     spritetype     *spr;
     int            pu;

     // from tekstat.c
     #define   SPR_LOTAG_PICKUP    2004

     if( (option[4] == 0) && (sprptr[dasprite]->lotag == SPR_LOTAG_PICKUP) ) {
          pu=pickupsprite(dasprite);
          switch( sprptr[dasprite]->picnum ) {
          case RATPIC:
               if( pu ) {
                    showmessage("LIVE RAT");
               }
               break;
          case TUBEBOMB+1:
          case DARTBOMB+1:
               if( pu ) {
                    showmessage("GRENADE");
               }
          default:
               break;
          }
          return;
     }

     switch( sprptr[dasprite]->picnum ) {
     case 1361:   // the witchaven poster for demo
          playsound(S_WITCH,sprite[dasprite].x,sprite[dasprite].y,0,ST_UNIQUE);
          break;
     case 592:   // the witchaven poster for demo
          playsound(S_FLUSH,sprite[dasprite].x,sprite[dasprite].y,0,ST_UNIQUE);
          break;
     default:
          break;
     }

     spr=sprptr[dasprite];
     datag=spr->lotag;
     switch (datag) {
     case 6:
          if ((sprptr[dasprite]->cstat&0x001) != 0) {
               setanimpic(&spr->picnum,TICSPERFRAME*3,4);
          }
          else {
               setanimpic(&spr->picnum,TICSPERFRAME*3,-4);
          }
          sprptr[dasprite]->cstat^=0x101;
          teksetdelayfunc(operatesprite,CLKIPS*4,dasprite);
          break;
     case 4:
          if (!switchlevelsflag) {
               break;
          }
          if (option[4] != 0 && (spr->picnum == 182 || spr->picnum == 803)) {
               playsound(S_WH_SWITCH,sprite[dasprite].x,sprite[dasprite].y,0,ST_UNIQUE);
               nextnetlevel();
          }
          break;
     }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
leaq 0xaafb9(%rip), %r12     # 0xc7978
cmpb $0x0, 0x4(%r12)
movl %edi, %ebx
movslq %edi, %r14
leaq 0x10a85f(%rip), %r15    # 0x127230
movq (%r15,%r14,8), %rax
jne 0x1ca27
cmpw $0x7d4, 0x26(%rax)      # imm = 0x7D4
jne 0x1ca27
movswl %bx, %edi
callq 0x1dae1
movq (%r15,%r14,8), %rcx
movzwl 0xe(%rcx), %ecx
cmpl $0x1d6, %ecx            # imm = 0x1D6
je 0x1cb0e
cmpl $0x1d3, %ecx            # imm = 0x1D3
je 0x1cb0e
cmpl $0x104, %ecx            # imm = 0x104
jne 0x1cb2b
testl %eax, %eax
je 0x1cb2b
leaq 0x65884(%rip), %rdi     # 0x822a6
jmp 0x1cb19
movzwl 0xe(%rax), %eax
cmpl $0x551, %eax            # imm = 0x551
je 0x1ca3d
cmpl $0x250, %eax            # imm = 0x250
jne 0x1ca5d
pushq $0x79
jmp 0x1ca3f
pushq $0x63
popq %rdi
imulq $0x2c, %r14, %rax
leaq 0x4070e5(%rip), %rcx    # 0x423b30
movl (%rcx,%rax), %esi
movl 0x4(%rcx,%rax), %edx
pushq $0x8
popq %r8
xorl %ecx, %ecx
callq 0x1ab2a
movq (%r15,%r14,8), %rdi
movzwl 0x26(%rdi), %eax
cmpl $0x4, %eax
je 0x1cab6
cmpl $0x6, %eax
jne 0x1cb2b
movzwl 0xc(%rdi), %eax
addq $0xe, %rdi
andl $0x1, %eax
leal -0x4(,%rax,8), %edx
pushq $0x9
popq %rsi
callq 0x2a483
movq (%r15,%r14,8), %rax
xorw $0x101, 0xc(%rax)       # imm = 0x101
movswl %bx, %edx
leaq -0xf1(%rip), %rdi       # 0x1c9b0
movl $0x1e0, %esi            # imm = 0x1E0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2a3fa
leaq 0x1fa777(%rip), %rax    # 0x217234
cmpl $0x0, (%rax)
je 0x1cb2b
cmpb $0x0, 0x4(%r12)
je 0x1cb2b
movzwl 0xe(%rdi), %eax
cmpl $0x323, %eax            # imm = 0x323
je 0x1cadc
cmpl $0xb6, %eax
jne 0x1cb2b
imulq $0x2c, %r14, %rax
leaq 0x407049(%rip), %rcx    # 0x423b30
movl (%rcx,%rax), %esi
movl 0x4(%rcx,%rax), %edx
pushq $0x18
popq %rdi
pushq $0x8
popq %r8
xorl %ecx, %ecx
callq 0x1ab2a
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x1464f
testl %eax, %eax
je 0x1cb2b
leaq 0x65796(%rip), %rdi     # 0x822af
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x1373a
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq