// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/tekstat.c
// Function: enemynewsector
void
enemynewsector(int i)
{
	int	ext=sprptr[i]->extra;

     if( option[4] != 0 ) {
          return;
     }

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

     if( ensfirsttime == 1 ) {
          ensfirsttime=0;
          return;
     }

     switch( sectptr[sprptr[i]->sectnum]->lotag ) {
     case 4:
          playsound(S_SPLASH,sprptr[i]->x,sprptr[i]->y,0,ST_UPDATE);
          break;
     default:
          break;
     }
     switch( sectptr[sprptr[i]->sectnum]->hitag ) {
     case 1010:
     case 1011:
     case 1012:
     case 1013:
     case 1014:
     case 1015:
     case 1016:
     case 1017:
     case 1018:
     case 1019:
          if( isahologram(i) ) {
               jsdeletesprite(i);
               return;
          }
          if( tekexplodebody(i) ) {
               missionaccomplished(i);
          }
          playsound(S_BUSHIT, sprptr[i]->x,sprptr[i]->y, 0, ST_UPDATE);
          if( validext(ext) ) {
         	     switch( sprXTptr[ext]->basepic ) {
			case ERWALKPIC:
                 playsound(S_MANDIE1+RMOD4("STAT2615")+RMOD3("STAT2615"),sprptr[i]->x,sprptr[i]->y,0,ST_UPDATE);
          		break;
			case SARAHWALKPIC:
                 playsound(S_GIRLDIE1+RMOD4("STAT2618")+RMOD3("STAT2618"),sprptr[i]->x,sprptr[i]->y,0,ST_UPDATE);
          	     break;
			case SAMWALKPIC:
                 playsound(S_MANDIE1+RMOD4("STAT2621")+RMOD3("STAT2621"),sprptr[i]->x,sprptr[i]->y,0,ST_UPDATE);
          	     break;
         		}
    		}
          jsdeletesprite(i);
          break;
     default:
          operatesector(sprptr[i]->sectnum);  // JEFF TEST
          break;
     }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0xaeb14(%rip), %rax     # 0xd1978
cmpb $0x0, 0x4(%rax)
jne 0x22ea9
movl %edi, %ebx
movslq %edi, %r14
leaq 0x10e3ba(%rip), %r12    # 0x131230
movq (%r12,%r14,8), %rax
movzwl 0x2a(%rax), %r15d
movl %r14d, %edi
callq 0x1eb81
testl %eax, %eax
je 0x22e99
leaq 0x6d9e2(%rip), %rdi     # 0x90874
xorl %eax, %eax
callq 0x2eb88
cmpb $0x1, 0xafa32(%rip)     # 0xd28d2
jne 0x22eb8
movb $0x0, 0xafa29(%rip)     # 0xd28d2
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r12,%r14,8), %rdx
movswq 0x18(%rdx), %rax
leaq 0x1d6368(%rip), %r13    # 0x1f9230
movq (%r13,%rax,8), %rcx
cmpw $0x4, 0x22(%rcx)
jne 0x22ef9
movl (%rdx), %esi
movl 0x4(%rdx), %edx
movl $0xb, %edi
xorl %ecx, %ecx
movl $0x2, %r8d
callq 0x1c370
movq (%r12,%r14,8), %rax
movswq 0x18(%rax), %rax
movq (%r13,%rax,8), %rcx
movl $0xfffffc0e, %edx       # imm = 0xFFFFFC0E
addl 0x24(%rcx), %edx
cmpw $0x9, %dx
ja 0x22f8d
movl %ebx, %edi
callq 0x20ece
testl %eax, %eax
jne 0x23012
movl %ebx, %edi
callq 0x108e2
testl %eax, %eax
je 0x22f2c
movl %ebx, %edi
callq 0x1988c
movq (%r12,%r14,8), %rax
movl (%rax), %esi
movl 0x4(%rax), %edx
movl $0x6b, %edi
xorl %ecx, %ecx
movl $0x2, %r8d
callq 0x1c370
cmpl $0x3fff, %r15d          # imm = 0x3FFF
ja 0x23012
leaq 0x1b62d5(%rip), %rax    # 0x1d9230
movq (%rax,%r15,8), %rax
movzwl 0xa(%rax), %eax
cmpl $0x7d3, %eax            # imm = 0x7D3
je 0x22fb4
cmpl $0x79e, %eax            # imm = 0x79E
je 0x22fa3
cmpl $0x709, %eax            # imm = 0x709
jne 0x23012
movl $0x8b, 0x4(%rsp)
leaq 0x6d90c(%rip), %r15     # 0x90897
jmp 0x22fc3
movswl %ax, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x27c8c
movl $0x81, 0x4(%rsp)
leaq 0x6d8dc(%rip), %r15     # 0x9088e
jmp 0x22fc3
movl $0x81, 0x4(%rsp)
leaq 0x6d8dd(%rip), %r15     # 0x908a0
movq %r15, %rdi
callq 0x2d112
movl %eax, %ebp
shrl $0x3, %ebp
andl $0x3, %ebp
movq %r15, %rdi
callq 0x2d112
xorl %r13d, %r13d
cmpl $0x8001, %eax           # imm = 0x8001
setge %r13b
movq %r15, %rdi
callq 0x2d112
addl 0x4(%rsp), %ebp
btl $0x1, %eax
adcl %r13d, %ebp
movq (%r12,%r14,8), %rax
movl (%rax), %esi
movl 0x4(%rax), %edx
movl %ebp, %edi
xorl %ecx, %ecx
movl $0x2, %r8d
callq 0x1c370
movswl %bx, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1eb19