// File: /workspace/github_c_makefile_star2_O2/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 0xa6bd6(%rip), %rax     # 0xc7978
cmpb $0x0, 0x4(%rax)
jne 0x20de7
movl %edi, %ebx
movslq %edi, %r14
leaq 0x10647c(%rip), %r12    # 0x127230
movq (%r12,%r14,8), %rax
movzwl 0x2a(%rax), %r15d
movl %r14d, %edi
callq 0x1cfc4
testl %eax, %eax
je 0x20dd7
leaq 0x61a08(%rip), %rdi     # 0x827d8
xorl %eax, %eax
callq 0x2acb8
cmpb $0x1, 0xa7af4(%rip)     # 0xc88d2
jne 0x20df6
movb $0x0, 0xa7aeb(%rip)     # 0xc88d2
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 0x1ce42a(%rip), %r13    # 0x1ef230
movq (%r13,%rax,8), %rcx
cmpw $0x4, 0x22(%rcx)
jne 0x20e33
movl (%rdx), %esi
movl 0x4(%rdx), %edx
pushq $0xb
popq %rdi
pushq $0x2
popq %r8
xorl %ecx, %ecx
callq 0x1ab2a
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 0x20ebe
movl %ebx, %edi
callq 0x1f09c
testl %eax, %eax
jne 0x20f41
movl %ebx, %edi
callq 0xf8a2
testl %eax, %eax
je 0x20e62
movl %ebx, %edi
callq 0x182ed
movq (%r12,%r14,8), %rax
movl (%rax), %esi
movl 0x4(%rax), %edx
pushq $0x6b
popq %rdi
pushq $0x2
popq %r8
xorl %ecx, %ecx
callq 0x1ab2a
cmpw $0x3fff, %r15w          # imm = 0x3FFF
ja 0x20f41
leaq 0x1ae3a4(%rip), %rax    # 0x1cf230
movq (%rax,%r15,8), %rax
movzwl 0xa(%rax), %eax
cmpl $0x7d3, %eax            # imm = 0x7D3
je 0x20ee5
cmpl $0x79e, %eax            # imm = 0x79E
je 0x20ed4
cmpl $0x709, %eax            # imm = 0x709
jne 0x20f41
movl $0x8b, 0x4(%rsp)
leaq 0x6193f(%rip), %r15     # 0x827fb
jmp 0x20ef4
movswl %ax, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x253e8
movl $0x81, 0x4(%rsp)
leaq 0x6190f(%rip), %r15     # 0x827f2
jmp 0x20ef4
movl $0x81, 0x4(%rsp)
leaq 0x61910(%rip), %r15     # 0x82804
movq %r15, %rdi
callq 0x2945b
movl %eax, %ebp
shrl $0x3, %ebp
andl $0x3, %ebp
movq %r15, %rdi
callq 0x2945b
xorl %r13d, %r13d
cmpl $0x8001, %eax           # imm = 0x8001
setge %r13b
movq %r15, %rdi
callq 0x2945b
addl 0x4(%rsp), %ebp
btl $0x1, %eax
adcl %r13d, %ebp
movq (%r12,%r14,8), %rax
movl (%rax), %esi
movl 0x4(%rax), %edx
pushq $0x2
popq %r8
movl %ebp, %edi
xorl %ecx, %ecx
callq 0x1ab2a
movswl %bx, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1cf5e