// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/src/tekstat.c
// Function: deathdropitem
void
deathdropitem(short sprnum)
{
     short       j,ext;
     int         pic;

    #ifdef PLRSPRDEBUG
     if( isaplayersprite(sprnum) ) {
          crashgame("messing w plrsprite at 7");
     }
    #endif

     if( option[4] != 0 ) {
          return;
     }

     ext=sprptr[sprnum]->extra;
     if( !validext(ext) ) {
          return;
     }

     if( sprXTptr[ext]->fxmask&FX_HASREDCARD ) {
           pic=RED_KEYCARD;
           sprXTptr[ext]->fxmask&=(~FX_HASREDCARD);
     }
     else if( sprXTptr[ext]->fxmask&FX_HASBLUECARD ) {
           pic=BLUE_KEYCARD;
           sprXTptr[ext]->fxmask&=(~FX_HASBLUECARD);
     }
     else if( sprXTptr[ext]->fxmask&FX_ANDROID ) {
          showmessage("WAS AN ANDROID");
          return;
     }
     else {
           switch( sprXTptr[ext]->weapon ) {
           case 4:
           case 5:
                 pic=KLIPPIC;
                 break;
           default:
                 return;
           }
     }

     j=jsinsertsprite(sprptr[sprnum]->sectnum, DROPSIES);
     if( j != -1 ) {
	     fillsprite(j,sprptr[sprnum]->x,sprptr[sprnum]->y,sprptr[sprnum]->z-(tilesizy[sprptr[sprnum]->picnum]<<6),128,
                     0,0,12,16,16,0,0,pic,sprptr[sprnum]->ang,
		           sintable[(sprptr[sprnum]->ang+2560)&2047]>>6,sintable[(sprptr[sprnum]->ang+2048)&2047]>>6,
		           30L,sprnum+4096,sprptr[sprnum]->sectnum,DROPSIES,0,0,0);
     }
     else {
           return;
     }

     // tweak the size of the pic
     switch( sprptr[j]->picnum ) {
     case KLIPPIC:
           sprptr[j]->xrepeat-=2;
           sprptr[j]->yrepeat-=2;
           break;
     case RED_KEYCARD:
     case BLUE_KEYCARD:
           sprptr[j]->xrepeat>>=1;
           sprptr[j]->yrepeat>>=1;
           break;
     default:
           break;
     }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movw %di, %ax
movw %ax, -0x2(%rbp)
movswl -0x2(%rbp), %edi
callq 0x2aec0
cmpl $0x0, %eax
je 0x2f3bb
leaq 0xab00b(%rip), %rdi     # 0xda3bf
movb $0x0, %al
callq 0x44240
leaq 0xeab56(%rip), %rax     # 0x119f18
movzbl 0x4(%rax), %eax
cmpl $0x0, %eax
je 0x2f3d0
jmp 0x2f775
movswq -0x2(%rbp), %rcx
leaq 0x14ae04(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movw 0x2a(%rax), %ax
movw %ax, -0x6(%rbp)
movswl -0x6(%rbp), %edi
callq 0x2ae90
cmpl $0x0, %eax
jne 0x2f3fb
jmp 0x2f775
movswq -0x6(%rbp), %rcx
leaq 0x1f2dd9(%rip), %rax    # 0x2221e0
movq (%rax,%rcx,8), %rax
movzwl 0x4(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x2f43e
movl $0x15a, -0xc(%rbp)      # imm = 0x15A
movswq -0x6(%rbp), %rcx
leaq 0x1f2db6(%rip), %rax    # 0x2221e0
movq (%rax,%rcx,8), %rax
movzwl 0x4(%rax), %ecx
andl $-0x2, %ecx
movw %cx, 0x4(%rax)
jmp 0x2f4df
movswq -0x6(%rbp), %rcx
leaq 0x1f2d96(%rip), %rax    # 0x2221e0
movq (%rax,%rcx,8), %rax
movzwl 0x4(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x2f47e
movl $0x15b, -0xc(%rbp)      # imm = 0x15B
movswq -0x6(%rbp), %rcx
leaq 0x1f2d73(%rip), %rax    # 0x2221e0
movq (%rax,%rcx,8), %rax
movzwl 0x4(%rax), %ecx
andl $-0x3, %ecx
movw %cx, 0x4(%rax)
jmp 0x2f4dd
movswq -0x6(%rbp), %rcx
leaq 0x1f2d56(%rip), %rax    # 0x2221e0
movq (%rax,%rcx,8), %rax
movzwl 0x4(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x2f4ad
leaq 0xa9f9d(%rip), %rdi     # 0xd943e
movb $0x0, %al
callq 0x1a150
jmp 0x2f775
movswq -0x6(%rbp), %rcx
leaq 0x1f2d27(%rip), %rax    # 0x2221e0
movq (%rax,%rcx,8), %rax
movzbl 0x1f(%rax), %eax
addl $-0x4, %eax
subl $0x1, %eax
ja 0x2f4d4
jmp 0x2f4cb
movl $0x39c, -0xc(%rbp)      # imm = 0x39C
jmp 0x2f4d9
jmp 0x2f775
jmp 0x2f4db
jmp 0x2f4dd
jmp 0x2f4df
movswq -0x2(%rbp), %rcx
leaq 0x14acf5(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movl $0x196, %esi            # imm = 0x196
movswl 0x18(%rax), %edi
callq 0x2abd0
movw %ax, -0x4(%rbp)
movswl -0x4(%rbp), %eax
cmpl $-0x1, %eax
je 0x2f6d5
movswq -0x4(%rbp), %rcx
leaq 0x4475c6(%rip), %rax    # 0x476ae0
imulq $0x2c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movswq -0x2(%rbp), %rcx
leaq 0x14acaf(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movl (%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movswq -0x2(%rbp), %rcx
leaq 0x14ac97(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movl 0x4(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x4(%rax)
movswq -0x2(%rbp), %rcx
leaq 0x14ac7d(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movl 0x8(%rax), %ecx
movswq -0x2(%rbp), %rdx
leaq 0x14ac6a(%rip), %rax    # 0x17a1e0
movq (%rax,%rdx,8), %rax
movswq 0xe(%rax), %rdx
leaq 0x5ca28a(%rip), %rax    # 0x5f9810
movswl (%rax,%rdx,2), %eax
shll $0x6, %eax
subl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x18(%rbp), %rax
movw $0x80, 0xc(%rax)
movq -0x18(%rbp), %rax
movb $0x0, 0x10(%rax)
movq -0x18(%rbp), %rax
movb $0x0, 0x11(%rax)
movq -0x18(%rbp), %rax
movb $0xc, 0x12(%rax)
movq -0x18(%rbp), %rax
movb $0x10, 0x14(%rax)
movq -0x18(%rbp), %rax
movb $0x10, 0x15(%rax)
movq -0x18(%rbp), %rax
movb $0x0, 0x16(%rax)
movq -0x18(%rbp), %rax
movb $0x0, 0x17(%rax)
movl -0xc(%rbp), %eax
movw %ax, %cx
movq -0x18(%rbp), %rax
movw %cx, 0xe(%rax)
movswq -0x2(%rbp), %rcx
leaq 0x14abee(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movw 0x1c(%rax), %cx
movq -0x18(%rbp), %rax
movw %cx, 0x1c(%rax)
movswq -0x2(%rbp), %rcx
leaq 0x14abd2(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movswl 0x1c(%rax), %eax
addl $0xa00, %eax            # imm = 0xA00
andl $0x7ff, %eax            # imm = 0x7FF
movslq %eax, %rcx
leaq 0x599556(%rip), %rax    # 0x5c8b80
movswl (%rax,%rcx,2), %eax
sarl $0x6, %eax
movw %ax, %cx
movq -0x18(%rbp), %rax
movw %cx, 0x20(%rax)
movswq -0x2(%rbp), %rcx
leaq 0x14ab98(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movswl 0x1c(%rax), %eax
addl $0x800, %eax            # imm = 0x800
andl $0x7ff, %eax            # imm = 0x7FF
movslq %eax, %rcx
leaq 0x59951c(%rip), %rax    # 0x5c8b80
movswl (%rax,%rcx,2), %eax
sarl $0x6, %eax
movw %ax, %cx
movq -0x18(%rbp), %rax
movw %cx, 0x22(%rax)
movq -0x18(%rbp), %rax
movw $0x1e, 0x24(%rax)
movswl -0x2(%rbp), %eax
addl $0x1000, %eax           # imm = 0x1000
movw %ax, %cx
movq -0x18(%rbp), %rax
movw %cx, 0x1e(%rax)
movq -0x18(%rbp), %rax
movw $0x0, 0x26(%rax)
movq -0x18(%rbp), %rax
movw $0x0, 0x28(%rax)
movq -0x18(%rbp), %rax
movw $0xffff, 0x2a(%rax)     # imm = 0xFFFF
movq -0x18(%rbp), %rdi
movswq -0x4(%rbp), %rax
leaq 0x10655e(%rip), %rsi    # 0x135c20
imulq $0xc, %rax, %rax
addq %rax, %rsi
movl $0x3, %edx
callq 0x8c070
jmp 0x2f6da
jmp 0x2f775
movswq -0x4(%rbp), %rcx
leaq 0x14aafa(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movswl 0xe(%rax), %eax
movl %eax, -0x1c(%rbp)
addl $0xfffffea6, %eax       # imm = 0xFFFFFEA6
subl $0x2, %eax
jb 0x2f73f
jmp 0x2f6fd
movl -0x1c(%rbp), %eax
subl $0x39c, %eax            # imm = 0x39C
jne 0x2f773
jmp 0x2f709
movswq -0x4(%rbp), %rcx
leaq 0x14aacb(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movzbl 0x14(%rax), %ecx
subl $0x2, %ecx
movb %cl, 0x14(%rax)
movswq -0x4(%rbp), %rcx
leaq 0x14aab1(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movzbl 0x15(%rax), %ecx
subl $0x2, %ecx
movb %cl, 0x15(%rax)
jmp 0x2f775
movswq -0x4(%rbp), %rcx
leaq 0x14aa95(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movzbl 0x14(%rax), %ecx
sarl %ecx
movb %cl, 0x14(%rax)
movswq -0x4(%rbp), %rcx
leaq 0x14aa7c(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movzbl 0x15(%rax), %ecx
sarl %ecx
movb %cl, 0x15(%rax)
jmp 0x2f775
jmp 0x2f775
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)