// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/tekstat.c
// Function: playergunshot
void
playergunshot(int snum)
{
     int       j,nextj,ext;
     int      dist;

     if( !validplayer(snum) ) {
          crashgame("plgunsht: bad plrnum");
     }

	j=headspritestat[STROLL];
    	while( j != -1 ) {
		nextj = nextspritestat[j];

          ext=sprptr[j]->extra;
          if( !validext(ext) ) {
               noextcrashgame(j,103);
          }
     	dist = abs(sprptr[j]->x-posx[snum])+abs(sprptr[j]->y-posy[snum]);
 		if( dist < HEARGUNSHOTDIST ) {
               sprXTptr[ext]->aimask|=AI_JUSTSHOTAT;
          }

		j = nextj;
	}

	j=headspritestat[STANDING];
    	while( j != -1 ) {
		nextj = nextspritestat[j];

          ext=sprptr[j]->extra;
          if( !validext(ext) ) {
               noextcrashgame(j,105);
          }
     	dist = abs(sprptr[j]->x-posx[snum])+abs(sprptr[j]->y-posy[snum]);
 		if( dist < HEARGUNSHOTDIST ) {
               sprXTptr[ext]->aimask|=AI_JUSTSHOTAT;
          }

		j = nextj;
	}

	j=headspritestat[GUARD];
    	while( j != -1 ) {
		nextj = nextspritestat[j];

          ext=sprptr[j]->extra;
          if( !validext(ext) ) {
               noextcrashgame(j,106);
          }
     	dist = abs(sprptr[j]->x-posx[snum])+abs(sprptr[j]->y-posy[snum]);
 		if( dist < HEARGUNSHOTDIST ) {
               sprXTptr[ext]->aimask|=AI_JUSTSHOTAT;
          }

		j = nextj;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %ebx
callq 0xf230
testl %eax, %eax
jne 0x22331
leaq 0x6e4b6(%rip), %rdi     # 0x907e0
xorl %eax, %eax
callq 0x2eb88
leaq 0x54d068(%rip), %rax    # 0x56f3a0
movzwl 0x1a2(%rax), %ebp
movslq %ebx, %rax
movq %rax, (%rsp)
cmpw $-0x1, %bp
je 0x22401
leaq 0x555859(%rip), %rsi    # 0x577bb0
leaq 0x10eed2(%rip), %r14    # 0x131230
leaq 0xc216b(%rip), %rdi     # 0xe44d0
leaq 0xc21a4(%rip), %r13     # 0xe4510
leaq 0x1b6ebd(%rip), %r12    # 0x1d9230
movswq %bp, %rbx
movzwl (%rsi,%rbx,2), %ebp
movq (%r14,%rbx,8), %rax
movswq 0x2a(%rax), %r15
cmpq $0x4000, %r15           # imm = 0x4000
jb 0x223c4
imulq $0x2c, %rbx, %rax
leaq 0x40b798(%rip), %rcx    # 0x42db30
movl (%rcx,%rax), %esi
movl 0x4(%rcx,%rax), %edx
leaq 0x6e147(%rip), %rdi     # 0x904ed
movl $0x67, %ecx
xorl %eax, %eax
callq 0x2eb88
leaq 0xc2117(%rip), %rdi     # 0xe44d0
leaq 0x5557f0(%rip), %rsi    # 0x577bb0
movq (%r14,%rbx,8), %rax
movl (%rax), %ecx
movl 0x4(%rax), %eax
movq (%rsp), %r10
subl (%rdi,%r10,4), %ecx
movl %ecx, %edx
negl %edx
cmovsl %ecx, %edx
subl (%r13,%r10,4), %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
addl %edx, %ecx
cmpl $0x27ff, %ecx           # imm = 0x27FF
ja 0x223f7
movq (%r12,%r15,8), %rax
orw $0x4, 0x6(%rax)
cmpw $-0x1, %bp
jne 0x22373
leaq 0x54cf98(%rip), %rax    # 0x56f3a0
movzwl 0x192(%rax), %ebp
cmpw $-0x1, %bp
je 0x224c3
leaq 0x555790(%rip), %rsi    # 0x577bb0
leaq 0x10ee09(%rip), %r12    # 0x131230
leaq 0xc20a2(%rip), %r13     # 0xe44d0
leaq 0xc20db(%rip), %r14     # 0xe4510
movswq %bp, %rbx
movzwl (%rsi,%rbx,2), %ebp
movq (%r12,%rbx,8), %rax
movswq 0x2a(%rax), %r15
cmpq $0x4000, %r15           # imm = 0x4000
jb 0x2247f
imulq $0x2c, %rbx, %rax
leaq 0x40b6d6(%rip), %rcx    # 0x42db30
movl (%rcx,%rax), %esi
movl 0x4(%rcx,%rax), %edx
leaq 0x6e085(%rip), %rdi     # 0x904ed
movl $0x69, %ecx
xorl %eax, %eax
callq 0x2eb88
leaq 0x555735(%rip), %rsi    # 0x577bb0
movq (%r12,%rbx,8), %rax
movl (%rax), %ecx
movl 0x4(%rax), %eax
movq (%rsp), %r10
subl (%r13,%r10,4), %ecx
movl %ecx, %edx
negl %edx
cmovsl %ecx, %edx
subl (%r14,%r10,4), %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
addl %edx, %ecx
cmpl $0x27ff, %ecx           # imm = 0x27FF
ja 0x224b9
leaq 0x1b6d80(%rip), %rax    # 0x1d9230
movq (%rax,%r15,8), %rax
orw $0x4, 0x6(%rax)
cmpw $-0x1, %bp
jne 0x22435
leaq 0x54ced6(%rip), %rax    # 0x56f3a0
movzwl 0x196(%rax), %ebp
cmpw $-0x1, %bp
je 0x22584
leaq 0x5556ce(%rip), %rsi    # 0x577bb0
leaq 0x10ed47(%rip), %r15    # 0x131230
leaq 0xc1fe0(%rip), %r12     # 0xe44d0
leaq 0xc2019(%rip), %r14     # 0xe4510
movswq %bp, %rbx
movzwl (%rsi,%rbx,2), %ebp
movq (%r15,%rbx,8), %rax
movswq 0x2a(%rax), %r13
cmpq $0x4000, %r13           # imm = 0x4000
jb 0x22541
imulq $0x2c, %rbx, %rax
leaq 0x40b614(%rip), %rcx    # 0x42db30
movl (%rcx,%rax), %esi
movl 0x4(%rcx,%rax), %edx
leaq 0x6dfc3(%rip), %rdi     # 0x904ed
movl $0x6a, %ecx
xorl %eax, %eax
callq 0x2eb88
leaq 0x555673(%rip), %rsi    # 0x577bb0
movq (%r15,%rbx,8), %rax
movl (%rax), %ecx
movl 0x4(%rax), %eax
movq (%rsp), %r9
subl (%r12,%r9,4), %ecx
movl %ecx, %edx
negl %edx
cmovsl %ecx, %edx
subl (%r14,%r9,4), %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
addl %edx, %ecx
cmpl $0x27ff, %ecx           # imm = 0x27FF
ja 0x2257a
leaq 0x1b6cbf(%rip), %rax    # 0x1d9230
movq (%rax,%r13,8), %rax
orw $0x4, 0x6(%rax)
cmpw $-0x1, %bp
jne 0x224f7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq