// File: /workspace/github_c_makefile_star2_O1/jonof[P]jftekwar/src/tekstat.c
// Function: checkblastarea
void
checkblastarea(int spr)
{
     int      sect,i,j,nexti,xydist,zdist;

    #ifdef PLRSPRDEBUG
     if( isaplayersprite(spr) ) {
          crashgame("messing w plrsprite at 27");
     }
    #endif

     sect=sprptr[spr]->sectnum;

     for( j=connecthead ; j >= 0 ; j=connectpoint2[j] ) {
	     xydist=klabs(sprptr[spr]->x-posx[j])+klabs(sprptr[spr]->y-posy[j]);
          zdist=klabs(sprptr[spr]->z-posz[j]);
          if( (xydist < 512) && (zdist < 10240) ) {
               changehealth(j, -5000);
          }
          else if( (xydist < 2048) && (zdist < 20480) ) {
               changehealth(j, -800);
          }
          else if( (xydist < 4096) && (zdist < 40960) ) {
               changehealth(j, -200);
          }
     }

    if( option[4] == 0 ) {
	for( i=headspritesect[sect]; i>=0; i=nexti ) {
		nexti = nextspritesect[i];
          if( (i != spr) && (!isaplayersprite(i)) ) {
               switch( sprptr[i]->statnum ) {
               case PLAYER:
               case BOMBPROJECTILESTAT:
               case BOMBPROJECTILESTAT2:
               case RUNTHRU:
               case INACTIVE:
               case DEATH:
                    break;
               default:
		          xydist=klabs(sprptr[spr]->x-sprptr[i]->x)+klabs(sprptr[spr]->y-sprptr[i]->y);
                    zdist=klabs(sprptr[spr]->z - sprptr[i]->z);
                    if( (xydist < 2560) && (zdist < 16384) ) {
                         damagesprite(i, -500);
                    }
                    break;
               }
          }
     }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edi, %ebx
callq 0x1ea05
testl %eax, %eax
je 0x26f45
leaq 0x6694b(%rip), %rdi     # 0x8d889
xorl %eax, %eax
callq 0x2d800
movl %ebx, 0xc(%rsp)
movslq %ebx, %r15
leaq 0x1072bd(%rip), %rax    # 0x12e210
movq (%rax,%r15,8), %rax
movswq 0x18(%rax), %rax
movq %rax, 0x10(%rsp)
leaq 0x77bba8(%rip), %rax    # 0x7a2b10
movl (%rax), %eax
testl %eax, %eax
js 0x2701a
leaq 0xba557(%rip), %r13     # 0xe14d0
leaq 0xba590(%rip), %rbp     # 0xe1510
leaq 0xba5c9(%rip), %r14     # 0xe1550
leaq 0x77bb92(%rip), %rbx    # 0x7a2b20
leaq 0x10727b(%rip), %rcx    # 0x12e210
movq (%rcx,%r15,8), %rcx
movl %eax, %r12d
movl (%rcx), %eax
subl (%r13,%r12,4), %eax
movl %eax, %edx
negl %edx
cmovsl %eax, %edx
movl 0x4(%rcx), %esi
subl (%rbp,%r12,4), %esi
movl %esi, %eax
negl %eax
cmovsl %esi, %eax
addl %edx, %eax
movl 0x8(%rcx), %edx
subl (%r14,%r12,4), %edx
movl %edx, %ecx
negl %ecx
cmovsl %edx, %ecx
cmpl $0x1ff, %eax            # imm = 0x1FF
ja 0x26fdc
movw $0xec78, %dx            # imm = 0xEC78
cmpl $0x2800, %ecx           # imm = 0x2800
jb 0x27002
cmpl $0x7ff, %eax            # imm = 0x7FF
ja 0x26fef
movw $0xfce0, %dx            # imm = 0xFCE0
cmpl $0x5000, %ecx           # imm = 0x5000
jb 0x27002
cmpl $0xfff, %eax            # imm = 0xFFF
ja 0x2700e
movw $0xff38, %dx            # imm = 0xFF38
cmpl $0x9fff, %ecx           # imm = 0x9FFF
ja 0x2700e
movswl %dx, %esi
movswl %r12w, %edi
callq 0xa5d8
movl (%rbx,%r12,4), %eax
testl %eax, %eax
jns 0x26f8e
leaq 0xa7957(%rip), %rax     # 0xce978
cmpb $0x0, 0x4(%rax)
movl 0xc(%rsp), %ebx
je 0x2703a
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x53332f(%rip), %rax    # 0x55a370
movq 0x10(%rsp), %rcx
movzwl (%rax,%rcx,2), %ebp
testw %bp, %bp
js 0x2702b
leaq 0x53d32a(%rip), %r13    # 0x564380
movzwl %bp, %r14d
movzwl (%r13,%r14,2), %ebp
cmpl %ebx, %r14d
je 0x27071
movl %r14d, %edi
callq 0x1ea05
testl %eax, %eax
je 0x27078
testw %bp, %bp
jns 0x27056
jmp 0x2702b
leaq 0x107191(%rip), %rax    # 0x12e210
movq (%rax,%r14,8), %rax
movzwl 0x1a(%rax), %ecx
cmpl $0x196, %ecx            # imm = 0x196
jg 0x270a3
cmpl $0x8, %ecx
je 0x27071
cmpl $0x64, %ecx
je 0x27071
cmpl $0x12d, %ecx            # imm = 0x12D
je 0x27071
jmp 0x270bb
cmpl $0x197, %ecx            # imm = 0x197
je 0x27071
cmpl $0x2ca, %ecx            # imm = 0x2CA
je 0x27071
cmpl $0x2cc, %ecx            # imm = 0x2CC
je 0x27071
leaq 0x10714e(%rip), %rcx    # 0x12e210
movq (%rcx,%r15,8), %rcx
movl (%rcx), %edx
subl (%rax), %edx
movl %edx, %esi
negl %esi
cmovsl %edx, %esi
movl 0x4(%rcx), %edx
subl 0x4(%rax), %edx
movl %edx, %edi
negl %edi
cmovsl %edx, %edi
addl %esi, %edi
movl 0x8(%rcx), %ecx
subl 0x8(%rax), %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
cmpl $0x9ff, %edi            # imm = 0x9FF
ja 0x27071
cmpl $0x3fff, %eax           # imm = 0x3FFF
ja 0x27071
movl %r14d, %edi
movl $0xfffffe0c, %esi       # imm = 0xFFFFFE0C
callq 0x21942
jmp 0x27071