// File: /workspace/github_c_makefile_star2_O1/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 0xabd70(%rip), %rax     # 0xce978
cmpb $0x0, 0x4(%rax)
jne 0x22c4d
movl %edi, %ebx
movslq %edi, %r14
leaq 0x10b5f6(%rip), %r12    # 0x12e210
movq (%r12,%r14,8), %rax
movzwl 0x2a(%rax), %r15d
movl %r14d, %edi
callq 0x1ea05
testl %eax, %eax
je 0x22c3d
leaq 0x6ab1a(%rip), %rdi     # 0x8d750
xorl %eax, %eax
callq 0x2d800
cmpb $0x1, 0xacc8e(%rip)     # 0xcf8d2
jne 0x22c5c
movb $0x0, 0xacc85(%rip)     # 0xcf8d2
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r12,%r14,8), %rax
movswq 0x18(%rax), %rcx
leaq 0x1d35a4(%rip), %r13    # 0x1f6210
movq (%r13,%rcx,8), %rcx
cmpw $0x4, 0x22(%rcx)
jne 0x22c8f
movl (%rax), %esi
movl 0x4(%rax), %edx
movl $0xb, %edi
xorl %ecx, %ecx
movl $0x2, %r8d
callq 0x1c1f1
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 0x22d31
movl %ebx, %edi
callq 0x20c64
testl %eax, %eax
jne 0x22db6
movl %ebx, %edi
callq 0x1088a
testl %eax, %eax
je 0x22cd0
movl %ebx, %edi
callq 0x19791
movq (%r12,%r14,8), %rax
movl (%rax), %esi
movl 0x4(%rax), %edx
movl $0x6b, %edi
xorl %ecx, %ecx
movl $0x2, %r8d
callq 0x1c1f1
cmpl $0x3fff, %r15d          # imm = 0x3FFF
ja 0x22db6
leaq 0x1b3511(%rip), %rax    # 0x1d6210
movq (%rax,%r15,8), %rax
movzwl 0xa(%rax), %eax
cmpl $0x7d3, %eax            # imm = 0x7D3
je 0x22d58
cmpl $0x79e, %eax            # imm = 0x79E
je 0x22d47
cmpl $0x709, %eax            # imm = 0x709
jne 0x22db6
movl $0x8b, 0x4(%rsp)
leaq 0x6aa44(%rip), %r15     # 0x8d773
jmp 0x22d67
movswl %ax, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x276ec
movl $0x81, 0x4(%rsp)
leaq 0x6aa14(%rip), %r15     # 0x8d76a
jmp 0x22d67
movl $0x81, 0x4(%rsp)
leaq 0x6aa15(%rip), %r15     # 0x8d77c
movq %r15, %rdi
callq 0x2be4a
movl %eax, %ebp
shrl $0x3, %ebp
andl $0x3, %ebp
movq %r15, %rdi
callq 0x2be4a
xorl %r13d, %r13d
cmpl $0x8001, %eax           # imm = 0x8001
setge %r13b
movq %r15, %rdi
callq 0x2be4a
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 0x1c1f1
movswl %bx, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1e99d