// File: /workspace/github_c_makefile_star2_O1/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 0xf210
testl %eax, %eax
jne 0x1f65d
leaq 0x6de47(%rip), %rdi     # 0x8d49d
xorl %eax, %eax
callq 0x2d800
cmpw $0x0, 0x29dde9(%rip)    # 0x2bd44e
je 0x1f8c5
movswq %bx, %rbx
leaq 0xc30aa(%rip), %r14     # 0xe2720
movswl (%r14,%rbx,2), %edi
movl $0x192, %esi            # imm = 0x192
callq 0x1e94c
cmpw $-0x1, %ax
je 0x1f8a4
leaq 0x10cd9a(%rip), %rcx    # 0x12c430
leaq 0xc1e13(%rip), %rdx     # 0xe14b0
movzwl (%rdx,%rbx,2), %edi
addl $0x300, %edi            # imm = 0x300
andl $0x7ff, %edi            # imm = 0x7FF
leaq 0x55d4fc(%rip), %rsi    # 0x57cbb0
movswl (%rsi,%rdi,2), %edi
sarl $0x6, %edi
cmpl $0x0, (%rcx,%rbx,4)
leaq 0xc1e0a(%rip), %rcx     # 0xe14d0
movl (%rcx,%rbx,4), %r8d
movswq %ax, %rax
leaq 0x10eb3b(%rip), %rcx    # 0x12e210
movq (%rcx,%rax,8), %r9
je 0x1f70c
subl %edi, %r8d
movl %r8d, (%r9)
leaq 0xc1e28(%rip), %rdi     # 0xe1510
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 0x1f734
addl %edi, %r8d
movl %r8d, (%r9)
leaq 0xc1df7(%rip), %r8      # 0xe1510
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 0xc1e0d(%rip), %rdi     # 0xe1550
movl $0x400, %r8d            # imm = 0x400
addl (%rdi,%rbx,4), %r8d
movq (%rcx,%rax,8), %rdi
movl %r8d, 0x8(%rdi)
movzwl 0x29dcf0(%rip), %edi    # 0x2bd44c
movq (%rcx,%rax,8), %r8
movw %di, 0xc(%r8)
movb 0x29dce4(%rip), %dil    # 0x2bd450
movq (%rcx,%rax,8), %r8
movb %dil, 0x10(%r8)
movb 0x29dcd6(%rip), %dil    # 0x2bd451
movq (%rcx,%rax,8), %r8
movb %dil, 0x11(%r8)
movb 0x29dcc8(%rip), %dil    # 0x2bd452
movq (%rcx,%rax,8), %r8
movb %dil, 0x12(%r8)
movb 0x29dcbb(%rip), %dil    # 0x2bd454
movq (%rcx,%rax,8), %r8
movb %dil, 0x14(%r8)
movb 0x29dcad(%rip), %dil    # 0x2bd455
movq (%rcx,%rax,8), %r8
movb %dil, 0x15(%r8)
movb 0x29dc9f(%rip), %dil    # 0x2bd456
movq (%rcx,%rax,8), %r8
movb %dil, 0x16(%r8)
movb 0x29dc91(%rip), %dil    # 0x2bd457
movq (%rcx,%rax,8), %r8
movb %dil, 0x17(%r8)
movzwl (%rdx,%rbx,2), %edi
movq (%rcx,%rax,8), %r8
movw %di, 0x1c(%r8)
movzwl 0x29dc6c(%rip), %edi    # 0x2bd44e
cmpl $0x104, %edi            # imm = 0x104
je 0x1f806
cmpl $0x1d6, %edi            # imm = 0x1D6
je 0x1f800
cmpl $0x1d3, %edi            # imm = 0x1D3
jne 0x1f80a
movw $0x1d2, %di             # imm = 0x1D2
jmp 0x1f80a
movw $0x1d5, %di             # imm = 0x1D5
jmp 0x1f80a
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 0xc300d(%rip), %rdx     # 0xe2860
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 0x29dbce(%rip), %edx    # 0x2bd46a
movq (%rcx,%rax,8), %rax
movw %dx, 0x2a(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x29dbae(%rip)   # 0x2bd45c
movups %xmm0, 0x29db9b(%rip)   # 0x2bd450
movups %xmm0, 0x29db84(%rip)   # 0x2bd440
movw $0xffff, 0x29dba5(%rip) # imm = 0xFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
retq