// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movw %di, %ax
movw %ax, -0x2(%rbp)
leaq 0xefbb2(%rip), %rax     # 0x119f18
movzbl 0x4(%rax), %eax
cmpl $0x0, %eax
jne 0x2a405
movswq -0x2(%rbp), %rcx
leaq 0x14fe61(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movswl 0x26(%rax), %eax
cmpl $0x7d4, %eax            # imm = 0x7D4
jne 0x2a405
movswl -0x2(%rbp), %edi
callq 0x2c420
movl %eax, -0x14(%rbp)
movswq -0x2(%rbp), %rcx
leaq 0x14fe3a(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movswl 0xe(%rax), %eax
movl %eax, -0x18(%rbp)
subl $0x104, %eax            # imm = 0x104
je 0x2a3d2
jmp 0x2a3ba
movl -0x18(%rbp), %eax
subl $0x1d3, %eax            # imm = 0x1D3
je 0x2a3e8
jmp 0x2a3c6
movl -0x18(%rbp), %eax
subl $0x1d6, %eax            # imm = 0x1D6
je 0x2a3e8
jmp 0x2a3fe
cmpl $0x0, -0x14(%rbp)
je 0x2a3e6
leaq 0xafdeb(%rip), %rdi     # 0xda1ca
movb $0x0, %al
callq 0x1a150
jmp 0x2a400
cmpl $0x0, -0x14(%rbp)
je 0x2a3fc
leaq 0xafdde(%rip), %rdi     # 0xda1d3
movb $0x0, %al
callq 0x1a150
jmp 0x2a3fe
jmp 0x2a400
jmp 0x2a5f9
movswq -0x2(%rbp), %rcx
leaq 0x14fdcf(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movswl 0xe(%rax), %eax
movl %eax, -0x1c(%rbp)
subl $0x250, %eax            # imm = 0x250
je 0x2a474
jmp 0x2a425
movl -0x1c(%rbp), %eax
subl $0x551, %eax            # imm = 0x551
jne 0x2a4b3
jmp 0x2a435
movswq -0x2(%rbp), %rcx
leaq 0x44c69f(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %esi
movswq -0x2(%rbp), %rcx
leaq 0x44c68a(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %edx
movl $0x63, %edi
xorl %ecx, %ecx
movl $0x8, %r8d
callq 0x26af0
jmp 0x2a4b5
movswq -0x2(%rbp), %rcx
leaq 0x44c660(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %esi
movswq -0x2(%rbp), %rcx
leaq 0x44c64b(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %edx
movl $0x79, %edi
xorl %ecx, %ecx
movl $0x8, %r8d
callq 0x26af0
jmp 0x2a4b5
jmp 0x2a4b5
movswq -0x2(%rbp), %rcx
leaq 0x14fd1f(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movswl 0x26(%rax), %eax
movl %eax, -0x8(%rbp)
movl -0x8(%rbp), %eax
movl %eax, -0x20(%rbp)
subl $0x4, %eax
je 0x2a577
jmp 0x2a4e5
movl -0x20(%rbp), %eax
subl $0x6, %eax
jne 0x2a5f9
jmp 0x2a4f3
movswq -0x2(%rbp), %rcx
leaq 0x14fce1(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movswl 0xc(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x2a528
movq -0x10(%rbp), %rdi
addq $0xe, %rdi
movl $0x9, %esi
movl $0x4, %edx
callq 0x43720
jmp 0x2a53f
movq -0x10(%rbp), %rdi
addq $0xe, %rdi
movl $0x9, %esi
movl $0xfffffffc, %edx       # imm = 0xFFFFFFFC
callq 0x43720
movswq -0x2(%rbp), %rcx
leaq 0x14fc95(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movswl 0xc(%rax), %ecx
xorl $0x101, %ecx            # imm = 0x101
movw %cx, 0xc(%rax)
leaq -0x214(%rip), %rdi      # 0x2a350
movl $0x1e0, %esi            # imm = 0x1E0
movswl -0x2(%rbp), %edx
callq 0x435b0
jmp 0x2a5f9
leaq 0x23fc66(%rip), %rax    # 0x26a1e4
cmpl $0x0, (%rax)
jne 0x2a585
jmp 0x2a5f9
leaq 0xef98c(%rip), %rax     # 0x119f18
movzbl 0x4(%rax), %eax
cmpl $0x0, %eax
je 0x2a5f7
movq -0x10(%rbp), %rax
movswl 0xe(%rax), %eax
cmpl $0xb6, %eax
je 0x2a5b3
movq -0x10(%rbp), %rax
movswl 0xe(%rax), %eax
cmpl $0x323, %eax            # imm = 0x323
jne 0x2a5f7
movswq -0x2(%rbp), %rcx
leaq 0x44c521(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %esi
movswq -0x2(%rbp), %rcx
leaq 0x44c50c(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %edx
movl $0x18, %edi
xorl %ecx, %ecx
movl $0x8, %r8d
callq 0x26af0
movb $0x0, %al
callq 0x1b820
jmp 0x2a5f9
addq $0x20, %rsp
popq %rbp
retq
nop