// File: /workspace/github_c_makefile_star2_O3/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 0xf230
testl %eax, %eax
jne 0x1f8ce
leaq 0x70cfa(%rip), %rdi     # 0x905c1
xorl %eax, %eax
callq 0x2eb88
cmpw $0x0, 0x2a0b98(%rip)    # 0x2c046e
je 0x1fb36
movswq %bx, %rbx
leaq 0xc5e39(%rip), %r14     # 0xe5720
movswl (%r14,%rbx,2), %edi
movl $0x192, %esi            # imm = 0x192
callq 0x1eac8
cmpw $-0x1, %ax
je 0x1fb15
leaq 0x10fb29(%rip), %rcx    # 0x12f430
leaq 0xc4ba2(%rip), %rdx     # 0xe44b0
movzwl (%rdx,%rbx,2), %edi
addl $0x300, %edi            # imm = 0x300
andl $0x7ff, %edi            # imm = 0x7FF
leaq 0x5602ab(%rip), %rsi    # 0x57fbd0
movswl (%rsi,%rdi,2), %edi
sarl $0x6, %edi
cmpl $0x0, (%rcx,%rbx,4)
leaq 0xc4b99(%rip), %rcx     # 0xe44d0
movl (%rcx,%rbx,4), %r8d
movswq %ax, %rax
leaq 0x1118ea(%rip), %rcx    # 0x131230
movq (%rcx,%rax,8), %r9
je 0x1f97d
subl %edi, %r8d
movl %r8d, (%r9)
leaq 0xc4bb7(%rip), %rdi     # 0xe4510
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 0x1f9a5
addl %edi, %r8d
movl %r8d, (%r9)
leaq 0xc4b86(%rip), %r8      # 0xe4510
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 0xc4b9c(%rip), %rdi     # 0xe4550
movl $0x400, %r8d            # imm = 0x400
addl (%rdi,%rbx,4), %r8d
movq (%rcx,%rax,8), %rdi
movl %r8d, 0x8(%rdi)
movzwl 0x2a0a9f(%rip), %edi    # 0x2c046c
movq (%rcx,%rax,8), %r8
movw %di, 0xc(%r8)
movb 0x2a0a93(%rip), %dil    # 0x2c0470
movq (%rcx,%rax,8), %r8
movb %dil, 0x10(%r8)
movb 0x2a0a85(%rip), %dil    # 0x2c0471
movq (%rcx,%rax,8), %r8
movb %dil, 0x11(%r8)
movb 0x2a0a77(%rip), %dil    # 0x2c0472
movq (%rcx,%rax,8), %r8
movb %dil, 0x12(%r8)
movb 0x2a0a6a(%rip), %dil    # 0x2c0474
movq (%rcx,%rax,8), %r8
movb %dil, 0x14(%r8)
movb 0x2a0a5c(%rip), %dil    # 0x2c0475
movq (%rcx,%rax,8), %r8
movb %dil, 0x15(%r8)
movb 0x2a0a4e(%rip), %dil    # 0x2c0476
movq (%rcx,%rax,8), %r8
movb %dil, 0x16(%r8)
movb 0x2a0a40(%rip), %dil    # 0x2c0477
movq (%rcx,%rax,8), %r8
movb %dil, 0x17(%r8)
movzwl (%rdx,%rbx,2), %edi
movq (%rcx,%rax,8), %r8
movw %di, 0x1c(%r8)
movzwl 0x2a0a1b(%rip), %edi    # 0x2c046e
cmpl $0x104, %edi            # imm = 0x104
je 0x1fa77
cmpl $0x1d6, %edi            # imm = 0x1D6
je 0x1fa71
cmpl $0x1d3, %edi            # imm = 0x1D3
jne 0x1fa7b
movw $0x1d2, %di             # imm = 0x1D2
jmp 0x1fa7b
movw $0x1d5, %di             # imm = 0x1D5
jmp 0x1fa7b
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 0xc5d9c(%rip), %rdx     # 0xe5860
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
xorl %esi, %esi
movw %si, 0x26(%rdx)
movq (%rcx,%rax,8), %rdx
movw %si, 0x28(%rdx)
movzwl 0x2a097d(%rip), %edx    # 0x2c048a
movq (%rcx,%rax,8), %rax
movw %dx, 0x2a(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x2a095d(%rip)   # 0x2c047c
movups %xmm0, 0x2a094a(%rip)   # 0x2c0470
movups %xmm0, 0x2a0933(%rip)   # 0x2c0460
movw $0xffff, 0x2a0954(%rip) # imm = 0xFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
retq