// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/src/tekstat.c
// Function: playervirus
int
playervirus(short pnum, int pic)
{
     int       j,nextj;

     if( !validplayer(pnum) ) {
          crashgame("plrvrus: bad plrnum");
     }

	j=headspritestat[PLRVIRUS];
	while( j >= 0 ) {
		nextj = nextspritestat[j];
          // already hosting ?
          if( sprptr[j]->owner == pnum ) {
               return(0);
          }
		j = nextj;
	}

     j=jsinsertsprite(cursectnum[pnum], PLRVIRUS);
     if( j == -1 ) {
          return(0);
     }

     sprptr[j]->extra=-1;
     sprptr[j]->x=posx[pnum];
     sprptr[j]->y=posy[pnum];
     sprptr[j]->z=posz[pnum];
     sprptr[j]->xrepeat=18;
     sprptr[j]->yrepeat=40;
     sprptr[j]->cstat=0x0000;
     sprptr[j]->shade=-28;
     sprptr[j]->picnum=pic;
     sprptr[j]->lotag=(krand_intercept("STAT1172")&512)+128;
     sprptr[j]->hitag=0;
     sprptr[j]->owner=pnum;  // host

     playsound(S_FIRELOOP,sprptr[j]->x,sprptr[j]->y,0,ST_UPDATE);

     return(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movw %di, %ax
movw %ax, -0x6(%rbp)
movl %esi, -0xc(%rbp)
movswl -0x6(%rbp), %edi
callq 0x11c50
cmpl $0x0, %eax
jne 0x2edae
leaq 0xab5f2(%rip), %rdi     # 0xda399
movb $0x0, %al
callq 0x44240
leaq 0x58959b(%rip), %rax    # 0x5b8350
movswl 0x1fe(%rax), %eax
movl %eax, -0x10(%rbp)
cmpl $0x0, -0x10(%rbp)
jl 0x2ee06
movslq -0x10(%rbp), %rcx
leaq 0x591d90(%rip), %rax    # 0x5c0b60
movswl (%rax,%rcx,2), %eax
movl %eax, -0x14(%rbp)
movslq -0x10(%rbp), %rcx
leaq 0x14b3fe(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movswl 0x1e(%rax), %eax
movswl -0x6(%rbp), %ecx
cmpl %ecx, %eax
jne 0x2edfe
movl $0x0, -0x4(%rbp)
jmp 0x2efa8
movl -0x14(%rbp), %eax
movl %eax, -0x10(%rbp)
jmp 0x2edbf
movswq -0x6(%rbp), %rcx
movl $0xff, %esi
leaq 0xff8c9(%rip), %rax     # 0x12e6e0
movswl (%rax,%rcx,2), %edi
callq 0x2abd0
cwtl
movl %eax, -0x10(%rbp)
cmpl $-0x1, -0x10(%rbp)
jne 0x2ee36
movl $0x0, -0x4(%rbp)
jmp 0x2efa8
movslq -0x10(%rbp), %rcx
leaq 0x14b39f(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movw $0xffff, 0x2a(%rax)     # imm = 0xFFFF
movswq -0x6(%rbp), %rcx
leaq 0xfe9f9(%rip), %rax     # 0x12d850
movl (%rax,%rcx,4), %ecx
movslq -0x10(%rbp), %rdx
leaq 0x14b37b(%rip), %rax    # 0x17a1e0
movq (%rax,%rdx,8), %rax
movl %ecx, (%rax)
movswq -0x6(%rbp), %rcx
leaq 0xfea19(%rip), %rax     # 0x12d890
movl (%rax,%rcx,4), %ecx
movslq -0x10(%rbp), %rdx
leaq 0x14b35b(%rip), %rax    # 0x17a1e0
movq (%rax,%rdx,8), %rax
movl %ecx, 0x4(%rax)
movswq -0x6(%rbp), %rcx
leaq 0xfea38(%rip), %rax     # 0x12d8d0
movl (%rax,%rcx,4), %ecx
movslq -0x10(%rbp), %rdx
leaq 0x14b33a(%rip), %rax    # 0x17a1e0
movq (%rax,%rdx,8), %rax
movl %ecx, 0x8(%rax)
movslq -0x10(%rbp), %rcx
leaq 0x14b328(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movb $0x12, 0x14(%rax)
movslq -0x10(%rbp), %rcx
leaq 0x14b315(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movb $0x28, 0x15(%rax)
movslq -0x10(%rbp), %rcx
leaq 0x14b302(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movw $0x0, 0xc(%rax)
movslq -0x10(%rbp), %rcx
leaq 0x14b2ed(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movb $-0x1c, 0x10(%rax)
movl -0xc(%rbp), %eax
movw %ax, %cx
movslq -0x10(%rbp), %rdx
leaq 0x14b2d4(%rip), %rax    # 0x17a1e0
movq (%rax,%rdx,8), %rax
movw %cx, 0xe(%rax)
leaq 0xab492(%rip), %rdi     # 0xda3ad
callq 0x41510
andl $0x200, %eax            # imm = 0x200
addl $0x80, %eax
movw %ax, %cx
movslq -0x10(%rbp), %rdx
leaq 0x14b2a8(%rip), %rax    # 0x17a1e0
movq (%rax,%rdx,8), %rax
movw %cx, 0x26(%rax)
movslq -0x10(%rbp), %rcx
leaq 0x14b295(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movw $0x0, 0x28(%rax)
movw -0x6(%rbp), %cx
movslq -0x10(%rbp), %rdx
leaq 0x14b27c(%rip), %rax    # 0x17a1e0
movq (%rax,%rdx,8), %rax
movw %cx, 0x1e(%rax)
movslq -0x10(%rbp), %rcx
leaq 0x14b269(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movl (%rax), %esi
movslq -0x10(%rbp), %rcx
leaq 0x14b258(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movl 0x4(%rax), %edx
movl $0x24, %edi
xorl %ecx, %ecx
movl $0x2, %r8d
callq 0x26af0
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)