// File: /workspace/github_c_makefile_star2_O1/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 %rbx
leaq 0xb058a(%rip), %r14     # 0xce978
cmpb $0x0, 0x4(%r14)
movswq %di, %rbx
jne 0x1e454
leaq 0x10fe10(%rip), %r15    # 0x12e210
movq (%r15,%rbx,8), %rax
cmpw $0x7d4, 0x26(%rax)      # imm = 0x7D4
jne 0x1e454
movswl %bx, %edi
callq 0x1f578
movq (%r15,%rbx,8), %rcx
movzwl 0xe(%rcx), %ecx
cmpl $0x1d6, %ecx            # imm = 0x1D6
je 0x1e546
cmpl $0x1d3, %ecx            # imm = 0x1D3
je 0x1e546
cmpl $0x104, %ecx            # imm = 0x104
jne 0x1e55d
testl %eax, %eax
je 0x1e55d
leaq 0x6ede7(%rip), %rdi     # 0x8d236
jmp 0x1e551
leaq 0x10fdb5(%rip), %r15    # 0x12e210
movq (%r15,%rbx,8), %rax
movzwl 0xe(%rax), %eax
cmpl $0x551, %eax            # imm = 0x551
je 0x1e478
cmpl $0x250, %eax            # imm = 0x250
jne 0x1e49c
movl $0x79, %edi
jmp 0x1e47d
movl $0x63, %edi
imulq $0x2c, %rbx, %rax
leaq 0x40c688(%rip), %rcx    # 0x42ab10
movl (%rcx,%rax), %esi
movl 0x4(%rcx,%rax), %edx
xorl %ecx, %ecx
movl $0x8, %r8d
callq 0x1c1f1
movq (%r15,%rbx,8), %rdi
movzwl 0x26(%rdi), %eax
cmpl $0x4, %eax
je 0x1e4f1
cmpl $0x6, %eax
jne 0x1e55d
movzwl 0xc(%rdi), %eax
addq $0xe, %rdi
andl $0x1, %eax
leal -0x4(,%rax,8), %edx
movl $0x9, %esi
callq 0x2cf7d
movq (%r15,%rbx,8), %rax
xorw $0x101, 0xc(%rax)       # imm = 0x101
movswl %bx, %edx
leaq -0x100(%rip), %rdi      # 0x1e3e2
movl $0x1e0, %esi            # imm = 0x1E0
popq %rbx
popq %r14
popq %r15
jmp 0x2cef2
leaq 0x1ffd1c(%rip), %rax    # 0x21e214
cmpl $0x0, (%rax)
je 0x1e55d
cmpb $0x0, 0x4(%r14)
je 0x1e55d
movzwl 0xe(%rdi), %eax
cmpl $0x323, %eax            # imm = 0x323
je 0x1e516
cmpl $0xb6, %eax
jne 0x1e55d
imulq $0x2c, %rbx, %rax
leaq 0x40c5ef(%rip), %rcx    # 0x42ab10
movl (%rcx,%rax), %esi
movl 0x4(%rcx,%rax), %edx
movl $0x18, %edi
xorl %ecx, %ecx
movl $0x8, %r8d
callq 0x1c1f1
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0x15a2f
testl %eax, %eax
je 0x1e55d
leaq 0x6ecee(%rip), %rdi     # 0x8d23f
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0x14b61
popq %rbx
popq %r14
popq %r15
retq