// File: /workspace/github_c_makefile_star2_O1/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 0xf210
testl %eax, %eax
jne 0x220cb
leaq 0x6b5f8(%rip), %rdi     # 0x8d6bc
xorl %eax, %eax
callq 0x2d800
leaq 0x54a2ae(%rip), %rax    # 0x56c380
movzwl 0x1a2(%rax), %ebp
movslq %ebx, %rax
movq %rax, (%rsp)
cmpw $-0x1, %bp
je 0x2219b
leaq 0x552a9f(%rip), %rsi    # 0x574b90
leaq 0x10c118(%rip), %r14    # 0x12e210
leaq 0xbf3d1(%rip), %rdi     # 0xe14d0
leaq 0xbf40a(%rip), %r13     # 0xe1510
leaq 0x1b4103(%rip), %r12    # 0x1d6210
movswq %bp, %rbx
movzwl (%rsi,%rbx,2), %ebp
movq (%r14,%rbx,8), %rax
movswq 0x2a(%rax), %r15
cmpq $0x4000, %r15           # imm = 0x4000
jb 0x2215a
imulq $0x2c, %rbx, %rax
leaq 0x4089de(%rip), %rcx    # 0x42ab10
movl (%rcx,%rax), %esi
movl 0x4(%rcx,%rax), %edx
leaq 0x6b289(%rip), %rdi     # 0x8d3c9
movl $0x67, %ecx
xorl %eax, %eax
callq 0x2d800
leaq 0xbf37d(%rip), %rdi     # 0xe14d0
leaq 0x552a36(%rip), %rsi    # 0x574b90
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 0x22191
movq (%r12,%r15,8), %rax
orw $0x4, 0x6(%rax)
cmpw $-0x1, %bp
jne 0x2210d
leaq 0x54a1de(%rip), %rax    # 0x56c380
movzwl 0x192(%rax), %ebp
cmpw $-0x1, %bp
je 0x2225d
leaq 0x5529d6(%rip), %rsi    # 0x574b90
leaq 0x10c04f(%rip), %r12    # 0x12e210
leaq 0xbf308(%rip), %r13     # 0xe14d0
leaq 0xbf341(%rip), %r14     # 0xe1510
movswq %bp, %rbx
movzwl (%rsi,%rbx,2), %ebp
movq (%r12,%rbx,8), %rax
movswq 0x2a(%rax), %r15
cmpq $0x4000, %r15           # imm = 0x4000
jb 0x22215
imulq $0x2c, %rbx, %rax
leaq 0x40891c(%rip), %rcx    # 0x42ab10
movl (%rcx,%rax), %esi
movl 0x4(%rcx,%rax), %edx
leaq 0x6b1c7(%rip), %rdi     # 0x8d3c9
movl $0x69, %ecx
xorl %eax, %eax
callq 0x2d800
leaq 0x55297b(%rip), %rsi    # 0x574b90
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 0x22253
leaq 0x1b3fc6(%rip), %rax    # 0x1d6210
movq (%rax,%r15,8), %rax
orw $0x4, 0x6(%rax)
cmpw $-0x1, %bp
jne 0x221cf
leaq 0x54a11c(%rip), %rax    # 0x56c380
movzwl 0x196(%rax), %ebp
cmpw $-0x1, %bp
je 0x2231e
leaq 0x552914(%rip), %rsi    # 0x574b90
leaq 0x10bf8d(%rip), %r15    # 0x12e210
leaq 0xbf246(%rip), %r12     # 0xe14d0
leaq 0xbf27f(%rip), %r14     # 0xe1510
movswq %bp, %rbx
movzwl (%rsi,%rbx,2), %ebp
movq (%r15,%rbx,8), %rax
movswq 0x2a(%rax), %r13
cmpq $0x4000, %r13           # imm = 0x4000
jb 0x222d7
imulq $0x2c, %rbx, %rax
leaq 0x40885a(%rip), %rcx    # 0x42ab10
movl (%rcx,%rax), %esi
movl 0x4(%rcx,%rax), %edx
leaq 0x6b105(%rip), %rdi     # 0x8d3c9
movl $0x6a, %ecx
xorl %eax, %eax
callq 0x2d800
leaq 0x5528b9(%rip), %rsi    # 0x574b90
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 0x22314
leaq 0x1b3f05(%rip), %rax    # 0x1d6210
movq (%rax,%r13,8), %rax
orw $0x4, 0x6(%rax)
cmpw $-0x1, %bp
jne 0x22291
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq