// File: /workspace/github_c_makefile_star2_O3/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 0xb3410(%rip), %r12     # 0xd1978
cmpb $0x0, 0x4(%r12)
movl %edi, %ebx
movslq %edi, %r14
leaq 0x112cb6(%rip), %r15    # 0x131230
movq (%r15,%r14,8), %rax
jne 0x1e5d0
cmpw $0x7d4, 0x26(%rax)      # imm = 0x7D4
jne 0x1e5d0
movswl %bx, %edi
callq 0x1f80c
movq (%r15,%r14,8), %rcx
movzwl 0xe(%rcx), %ecx
cmpl $0x1d6, %ecx            # imm = 0x1D6
je 0x1e6c4
cmpl $0x1d3, %ecx            # imm = 0x1D3
je 0x1e6c4
cmpl $0x104, %ecx            # imm = 0x104
jne 0x1e6e1
testl %eax, %eax
je 0x1e6e1
leaq 0x71d4b(%rip), %rdi     # 0x90316
jmp 0x1e6cf
movzwl 0xe(%rax), %eax
cmpl $0x551, %eax            # imm = 0x551
je 0x1e5e9
cmpl $0x250, %eax            # imm = 0x250
jne 0x1e60d
movl $0x79, %edi
jmp 0x1e5ee
movl $0x63, %edi
imulq $0x2c, %r14, %rax
leaq 0x40f537(%rip), %rcx    # 0x42db30
movl (%rcx,%rax), %esi
movl 0x4(%rcx,%rax), %edx
xorl %ecx, %ecx
movl $0x8, %r8d
callq 0x1c370
movq (%r15,%r14,8), %rdi
movzwl 0x26(%rdi), %eax
cmpl $0x4, %eax
je 0x1e668
cmpl $0x6, %eax
jne 0x1e6e1
movzwl 0xc(%rdi), %eax
addq $0xe, %rdi
andl $0x1, %eax
leal -0x4(,%rax,8), %edx
movl $0x9, %esi
callq 0x2e2af
movq (%r15,%r14,8), %rax
xorw $0x101, 0xc(%rax)       # imm = 0x101
movswl %bx, %edx
leaq -0xfa(%rip), %rdi       # 0x1e559
movl $0x1e0, %esi            # imm = 0x1E0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2e224
leaq 0x202bc5(%rip), %rax    # 0x221234
cmpl $0x0, (%rax)
je 0x1e6e1
cmpb $0x0, 0x4(%r12)
je 0x1e6e1
movzwl 0xe(%rdi), %eax
cmpl $0x323, %eax            # imm = 0x323
je 0x1e68e
cmpl $0xb6, %eax
jne 0x1e6e1
imulq $0x2c, %r14, %rax
leaq 0x40f497(%rip), %rcx    # 0x42db30
movl (%rcx,%rax), %esi
movl 0x4(%rcx,%rax), %edx
movl $0x18, %edi
xorl %ecx, %ecx
movl $0x8, %r8d
callq 0x1c370
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x15ac0
testl %eax, %eax
je 0x1e6e1
leaq 0x71c50(%rip), %rdi     # 0x9031f
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x14be7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq