// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/src/tekstat.c
// Function: toss
void
toss(short snum)
{
     int       j;

     if( !validplayer(snum) ) {
          crashgame("toss: bad plrnum");
     }
     if( pickup.picnum == 0 ) {
          return;
     }
     j=jsinsertsprite(cursectnum[snum], TOSS);
     if( j != -1 ) {
          if( drawweap[snum] == 0 ) {
               sprptr[j]->x=posx[snum]+(sintable[(ang[snum]+2560+256)&2047]>>6);
               sprptr[j]->y=posy[snum]+(sintable[(ang[snum]+2048+256)&2047]>>6);
          }
          else {
               sprptr[j]->x=posx[snum]-(sintable[(ang[snum]+2560+256)&2047]>>6);
               sprptr[j]->y=posy[snum]-(sintable[(ang[snum]+2048+256)&2047]>>6);
          }
	     sprptr[j]->z=posz[snum]+(4<<8);
	     sprptr[j]->cstat=pickup.cstat;
	     sprptr[j]->shade=pickup.shade;
	     sprptr[j]->pal=pickup.pal;
          sprptr[j]->clipdist=pickup.clipdist;
	     sprptr[j]->xrepeat=pickup.xrepeat;
	     sprptr[j]->yrepeat=pickup.yrepeat;
	     sprptr[j]->xoffset=pickup.xoffset;
	     sprptr[j]->yoffset=pickup.yoffset;
          sprptr[j]->ang=ang[snum];
          switch( pickup.picnum ) {
          case RATPIC:
               sprptr[j]->picnum=RATTHROWPIC;
               break;
          case TUBEBOMB+1:
               sprptr[j]->picnum=TUBEBOMB;
               break;
          case DARTBOMB+1:
               sprptr[j]->picnum=DARTBOMB;
               break;
          default:
               sprptr[j]->picnum=pickup.picnum;
               break;
          }
          sprptr[j]->xvel=sintable[(ang[snum]+2560)&2047]>>6;
          sprptr[j]->yvel=sintable[(ang[snum]+2048)&2047]>>6;
          sprptr[j]->zvel=(80-horiz[snum])<<6;
          sprptr[j]->owner=snum+4096;
          sprptr[j]->sectnum=cursectnum[snum];
          // TOSS will be usin hi/lo tag
          sprptr[j]->lotag=0;
          sprptr[j]->hitag=0;
          sprptr[j]->extra=pickup.extra;
     }
     memset(&pickup, 0, sizeof(pickup));
     pickup.extra=-1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebx
callq 0xe2e0
testl %eax, %eax
jne 0x1dba1
leaq 0x6498b(%rip), %rdi     # 0x82525
xorl %eax, %eax
callq 0x2acb8
cmpw $0x0, 0x2988c5(%rip)    # 0x2b646e
je 0x1de08
movswq %bx, %rbx
leaq 0xbdb66(%rip), %r14     # 0xdb720
movswl (%r14,%rbx,2), %edi
movl $0x192, %esi            # imm = 0x192
callq 0x1cf0c
cmpw $-0x1, %ax
je 0x1dde8
leaq 0x107856(%rip), %rcx    # 0x125430
leaq 0xbc8cf(%rip), %rdx     # 0xda4b0
movzwl (%rdx,%rbx,2), %edi
addl $0x300, %edi            # imm = 0x300
andl $0x7ff, %edi            # imm = 0x7FF
leaq 0x557fd8(%rip), %rsi    # 0x575bd0
movswl (%rsi,%rdi,2), %edi
sarl $0x6, %edi
cmpl $0x0, (%rcx,%rbx,4)
leaq 0xbc8c6(%rip), %rcx     # 0xda4d0
movl (%rcx,%rbx,4), %r8d
movswq %ax, %rax
leaq 0x109617(%rip), %rcx    # 0x127230
movq (%rcx,%rax,8), %r9
je 0x1dc50
subl %edi, %r8d
movl %r8d, (%r9)
leaq 0xbc8e4(%rip), %rdi     # 0xda510
movl (%rdi,%rbx,4), %edi
movzwl (%rdx,%rbx,2), %r8d
addl $0x100, %r8d            # imm = 0x100
andl $0x7ff, %r8d            # imm = 0x7FF
movswl (%rsi,%r8,2), %r8d
sarl $0x6, %r8d
subl %r8d, %edi
jmp 0x1dc78
addl %edi, %r8d
movl %r8d, (%r9)
leaq 0xbc8b3(%rip), %r8      # 0xda510
movzwl (%rdx,%rbx,2), %edi
addl $0x100, %edi            # imm = 0x100
andl $0x7ff, %edi            # imm = 0x7FF
movswl (%rsi,%rdi,2), %edi
sarl $0x6, %edi
addl (%r8,%rbx,4), %edi
movq (%rcx,%rax,8), %r8
movl %edi, 0x4(%r8)
leaq 0xbc8c9(%rip), %rdi     # 0xda550
movl $0x400, %r8d            # imm = 0x400
addl (%rdi,%rbx,4), %r8d
movq (%rcx,%rax,8), %rdi
movl %r8d, 0x8(%rdi)
movzwl 0x2987cc(%rip), %edi    # 0x2b646c
movq (%rcx,%rax,8), %r8
movw %di, 0xc(%r8)
movb 0x2987c0(%rip), %dil    # 0x2b6470
movq (%rcx,%rax,8), %r8
movb %dil, 0x10(%r8)
movb 0x2987b2(%rip), %dil    # 0x2b6471
movq (%rcx,%rax,8), %r8
movb %dil, 0x11(%r8)
movb 0x2987a4(%rip), %dil    # 0x2b6472
movq (%rcx,%rax,8), %r8
movb %dil, 0x12(%r8)
movb 0x298797(%rip), %dil    # 0x2b6474
movq (%rcx,%rax,8), %r8
movb %dil, 0x14(%r8)
movb 0x298789(%rip), %dil    # 0x2b6475
movq (%rcx,%rax,8), %r8
movb %dil, 0x15(%r8)
movb 0x29877b(%rip), %dil    # 0x2b6476
movq (%rcx,%rax,8), %r8
movb %dil, 0x16(%r8)
movb 0x29876d(%rip), %dil    # 0x2b6477
movq (%rcx,%rax,8), %r8
movb %dil, 0x17(%r8)
movzwl (%rdx,%rbx,2), %edi
movq (%rcx,%rax,8), %r8
movw %di, 0x1c(%r8)
movzwl 0x298748(%rip), %edi    # 0x2b646e
cmpl $0x104, %edi            # imm = 0x104
je 0x1dd4a
cmpl $0x1d6, %edi            # imm = 0x1D6
je 0x1dd44
cmpl $0x1d3, %edi            # imm = 0x1D3
jne 0x1dd4e
movw $0x1d2, %di             # imm = 0x1D2
jmp 0x1dd4e
movw $0x1d5, %di             # imm = 0x1D5
jmp 0x1dd4e
movw $0x12b, %di             # imm = 0x12B
movq (%rcx,%rax,8), %r8
movw %di, 0xe(%r8)
movzwl (%rdx,%rbx,2), %edi
addl $0x200, %edi            # imm = 0x200
movl $0x7ff, %r8d            # imm = 0x7FF
andl %r8d, %edi
movswl (%rsi,%rdi,2), %edi
shrl $0x6, %edi
movq (%rcx,%rax,8), %r9
movw %di, 0x20(%r9)
movzwl (%rdx,%rbx,2), %edx
andl %r8d, %edx
movswl (%rsi,%rdx,2), %edx
shrl $0x6, %edx
movq (%rcx,%rax,8), %rsi
movw %dx, 0x22(%rsi)
leaq 0xbdac9(%rip), %rdx     # 0xdb860
movl (%rdx,%rbx,4), %edx
shll $0x6, %edx
movl $0x1400, %esi           # imm = 0x1400
subl %edx, %esi
movq (%rcx,%rax,8), %rdx
movw %si, 0x24(%rdx)
leal 0x1000(%rbx), %edx
movq (%rcx,%rax,8), %rsi
movw %dx, 0x1e(%rsi)
movzwl (%r14,%rbx,2), %edx
movq (%rcx,%rax,8), %rsi
movw %dx, 0x18(%rsi)
movq (%rcx,%rax,8), %rdx
andw $0x0, 0x26(%rdx)
movq (%rcx,%rax,8), %rdx
andw $0x0, 0x28(%rdx)
movzwl 0x2986aa(%rip), %edx    # 0x2b648a
movq (%rcx,%rax,8), %rax
movw %dx, 0x2a(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x29868a(%rip)   # 0x2b647c
movups %xmm0, 0x298677(%rip)   # 0x2b6470
movups %xmm0, 0x298660(%rip)   # 0x2b6460
orw $-0x1, 0x298682(%rip)   # 0x2b648a
addq $0x8, %rsp
popq %rbx
popq %r14
retq