// File: /workspace/github_c_makefile_star2_O2/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 0xe2e0
testl %eax, %eax
jne 0x2033d
leaq 0x6240e(%rip), %rdi     # 0x82744
xorl %eax, %eax
callq 0x2acb8
leaq 0x54505c(%rip), %rax    # 0x5653a0
movzwl 0x1a2(%rax), %r12d
movslq %ebx, %r15
leaq 0x54d85a(%rip), %rsi    # 0x56dbb0
leaq 0x106ed3(%rip), %r13    # 0x127230
leaq 0xba16c(%rip), %rdi     # 0xda4d0
leaq 0xba1a5(%rip), %rbx     # 0xda510
cmpw $-0x1, %r12w
je 0x203e6
movswl %r12w, %eax
movslq %eax, %r14
movzwl (%rsi,%r14,2), %r12d
movq (%r13,%r14,8), %rax
movswq 0x2a(%rax), %rbp
cmpq $0x4000, %rbp           # imm = 0x4000
jb 0x203af
movl %r14d, %edi
pushq $0x67
popq %rsi
callq 0x1d148
leaq 0xba12d(%rip), %rdi     # 0xda4d0
leaq 0x54d806(%rip), %rsi    # 0x56dbb0
movq (%r13,%r14,8), %rax
movl (%rax), %ecx
movl 0x4(%rax), %eax
subl (%rdi,%r15,4), %ecx
movl %ecx, %edx
negl %edx
cmovsl %ecx, %edx
subl (%rbx,%r15,4), %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
addl %edx, %ecx
cmpl $0x27ff, %ecx           # imm = 0x27FF
ja 0x2036b
leaq 0x1aee55(%rip), %rax    # 0x1cf230
movq (%rax,%rbp,8), %rax
orw $0x4, 0x6(%rax)
jmp 0x2036b
leaq 0x544fb3(%rip), %rax    # 0x5653a0
movzwl 0x192(%rax), %r12d
cmpw $-0x1, %r12w
je 0x20470
movswl %r12w, %eax
movslq %eax, %r14
movzwl (%rsi,%r14,2), %r12d
movq (%r13,%r14,8), %rax
movswq 0x2a(%rax), %rbp
cmpq $0x4000, %rbp           # imm = 0x4000
jb 0x20439
movl %r14d, %edi
pushq $0x69
popq %rsi
callq 0x1d148
leaq 0xba0a3(%rip), %rdi     # 0xda4d0
leaq 0x54d77c(%rip), %rsi    # 0x56dbb0
movq (%r13,%r14,8), %rax
movl (%rax), %ecx
movl 0x4(%rax), %eax
subl (%rdi,%r15,4), %ecx
movl %ecx, %edx
negl %edx
cmovsl %ecx, %edx
subl (%rbx,%r15,4), %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
addl %edx, %ecx
cmpl $0x27ff, %ecx           # imm = 0x27FF
ja 0x203f5
leaq 0x1aedcb(%rip), %rax    # 0x1cf230
movq (%rax,%rbp,8), %rax
orw $0x4, 0x6(%rax)
jmp 0x203f5
leaq 0x544f29(%rip), %rax    # 0x5653a0
movzwl 0x196(%rax), %r12d
cmpw $-0x1, %r12w
je 0x204fa
movswl %r12w, %eax
movslq %eax, %r14
movzwl (%rsi,%r14,2), %r12d
movq (%r13,%r14,8), %rax
movswq 0x2a(%rax), %rbp
cmpq $0x4000, %rbp           # imm = 0x4000
jb 0x204c3
movl %r14d, %edi
pushq $0x6a
popq %rsi
callq 0x1d148
leaq 0xba019(%rip), %rdi     # 0xda4d0
leaq 0x54d6f2(%rip), %rsi    # 0x56dbb0
movq (%r13,%r14,8), %rax
movl (%rax), %ecx
movl 0x4(%rax), %eax
subl (%rdi,%r15,4), %ecx
movl %ecx, %edx
negl %edx
cmovsl %ecx, %edx
subl (%rbx,%r15,4), %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
addl %edx, %ecx
cmpl $0x27ff, %ecx           # imm = 0x27FF
ja 0x2047f
leaq 0x1aed41(%rip), %rax    # 0x1cf230
movq (%rax,%rbp,8), %rax
orw $0x4, 0x6(%rax)
jmp 0x2047f
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq