// File: /workspace/github_c_makefile_star2_O2/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 0x1cfc4
testl %eax, %eax
je 0x24c98
leaq 0x5dc80(%rip), %rdi     # 0x82911
xorl %eax, %eax
callq 0x2acb8
movl %ebx, 0xc(%rsp)
movslq %ebx, %r14
leaq 0x10258a(%rip), %rax    # 0x127230
movq (%rax,%r14,8), %rax
movswq 0x18(%rax), %rax
movq %rax, 0x10(%rsp)
leaq 0x776e75(%rip), %r13    # 0x79bb30
leaq 0xb580e(%rip), %rbp     # 0xda4d0
leaq 0xb5847(%rip), %r12     # 0xda510
leaq 0xb5880(%rip), %rbx     # 0xda550
leaq 0x776e69(%rip), %r15    # 0x79bb40
movslq (%r13), %r13
testq %r13, %r13
js 0x24d6c
leaq 0x102545(%rip), %rax    # 0x127230
movq (%rax,%r14,8), %rcx
movl (%rcx), %eax
subl (%rbp,%r13,4), %eax
movl %eax, %edx
negl %edx
cmovsl %eax, %edx
movl 0x4(%rcx), %esi
subl (%r12,%r13,4), %esi
movl %esi, %eax
negl %eax
cmovsl %esi, %eax
addl %edx, %eax
movl 0x8(%rcx), %edx
subl (%rbx,%r13,4), %edx
movl %edx, %ecx
negl %ecx
cmovsl %edx, %ecx
cmpl $0x1ff, %eax            # imm = 0x1FF
ja 0x24d2e
movw $0xec78, %dx            # imm = 0xEC78
cmpl $0x2800, %ecx           # imm = 0x2800
jb 0x24d54
cmpl $0x7ff, %eax            # imm = 0x7FF
ja 0x24d41
movw $0xfce0, %dx            # imm = 0xFCE0
cmpl $0x5000, %ecx           # imm = 0x5000
jb 0x24d54
cmpl $0xfff, %eax            # imm = 0xFFF
ja 0x24d60
movw $0xff38, %dx            # imm = 0xFF38
cmpl $0x9fff, %ecx           # imm = 0x9FFF
ja 0x24d60
movswl %dx, %esi
movswl %r13w, %edi
callq 0x99a8
shlq $0x2, %r13
addq %r15, %r13
jmp 0x24cd7
leaq 0xa2c05(%rip), %rax     # 0xc7978
cmpb $0x0, 0x4(%rax)
movl 0xc(%rsp), %r15d
je 0x24d8d
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x52e5fc(%rip), %rax    # 0x553390
movq 0x10(%rsp), %rcx
movzwl (%rax,%rcx,2), %r13d
leaq 0x5385fb(%rip), %r12    # 0x55d3a0
testw %r13w, %r13w
js 0x24d7e
movswl %r13w, %ebp
movl %ebp, %ebx
movzwl (%r12,%rbx,2), %r13d
cmpl %r15d, %ebp
je 0x24da5
movl %ebp, %edi
callq 0x1cfc4
testl %eax, %eax
jne 0x24da5
leaq 0x102463(%rip), %rax    # 0x127230
movq (%rax,%rbx,8), %rax
movzwl 0x1a(%rax), %ecx
cmpl $0x8, %ecx
je 0x24da5
cmpl $0x64, %ecx
je 0x24da5
cmpl $0x12d, %ecx            # imm = 0x12D
je 0x24da5
cmpl $0x197, %ecx            # imm = 0x197
je 0x24da5
cmpl $0x2ca, %ecx            # imm = 0x2CA
je 0x24da5
cmpl $0x2cc, %ecx            # imm = 0x2CC
je 0x24da5
leaq 0x10242a(%rip), %rcx    # 0x127230
movq (%rcx,%r14,8), %rcx
movq (%rcx), %xmm0
movq (%rax), %xmm1
psubd %xmm1, %xmm0
movdqa %xmm0, %xmm1
psrad $0x1f, %xmm1
pxor %xmm1, %xmm0
psubd %xmm1, %xmm0
pshufd $0x55, %xmm0, %xmm1     # xmm1 = xmm0[1,1,1,1]
paddd %xmm0, %xmm1
movd %xmm1, %edx
movl 0x8(%rcx), %ecx
subl 0x8(%rax), %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
cmpl $0x9ff, %edx            # imm = 0x9FF
ja 0x24da5
cmpl $0x3fff, %eax           # imm = 0x3FFF
ja 0x24da5
movl %ebp, %edi
movl $0xfffffe0c, %esi       # imm = 0xFFFFFE0C
callq 0x1fc8e
jmp 0x24da5