// File: /workspace/github_c_makefile_star2_O0/hyc[P]trek73c/trekx.c
// Function: Execute
void Execute()
{
  int I, I0, J, N1, N2;
  boolean Ok;
  double Rn;
  int FORLIM;
  Srec *WITH;

  FORLIM = (long)(SimTim / Iter);
  for (I = 0; I < FORLIM; I++) {
    for (J = 0; J < ObjCount; J++) {
      if (Objects[J] != NULL) {
	I0 = Objects[J]->ObTyp;
	if (I0 < 10) {
	  if (Ships[J]->Crew > 0) {
	    if (I < Phasers)
	      PhaserFire(J);
	    if (I < Tubes)
	      Torpfire(J);
	  }
	}
	Antimatter(J);
	if (Objects[J] != NULL)
	  Movem(J);
      }
    }
  }
  for (I = 0; I <= Enemies; I++) {
    if (Ships[I] != NULL) {
      Distrib(I, 2.0);
      for (J = 0; J < Phasers; J++) {
	if (Ships[I]->Pstat[J] >= 0)
	  TrakPhas(I, J);
      }
      for (J = 0; J < Tubes; J++) {
	if (Ships[I]->Tstat[J] >= 0)
	  TrakTorp(I, J);
      }
    }
  }
  TCount = (-1);
  if (Ships[0] != NULL) {
    I0 = (long)floor((10000 - Objects[0]->Tim_Del) * Iter + 0.5);
    if (I0 != 0 && I0 <= 15) {
      sprintf(scrstr,"Computer: %d seconds to self-destruct.\n", I0);
      SEndln();
    }
  }
  /*
   * Fuses, bluffs, surrenders
   */
  for (I = 0; I <= 3; I++) {
    if (Ct[I] != 0)
      Ct[I]++;
  }
  N1 = 0;
  N2 = 0;
  Win = 0;
  /*
   * Federation disposition
   */
  if ((Ships[0] == NULL) || (Ships[0]->Crew == 0))
    Win = 1;
  else {
    WITH = Ships[0];
    Ok = false;
    if ((WITH->Regen > 1) ||
       ((!WITH->Dmge[(int)Warp] || !WITH->Dmge[(int)Prob]) &&
	Objects[0]->Fuel > 10)) {
      Ok = true;
    } else {
      for (I = 0; I < Phasers; I++) {
        if (WITH->PChrg[I] > 0) {
	  Ok = true; break;
        }
      }
      for (I = 0; (I < Tubes) && !Ok; I++) {
        if (WITH->Tengy[I] > 0) {
	  Ok = true; break;
        }
      }
    }
    if (!Ok)
      Win = 1;
  }
  /*
   * Enemy disposition
   */
  for (I = 1; I <= Enemies; I++) {
    if ((Ships[I] == NULL) || (Ships[I]->Crew == 0)) {
      N1++;
      continue;
    }
    Rn = Range(I, 0);
    if (((Rn > 3500) && Ships[I]->Dmge[(long)Warp]) ||
	((Rn > 20000) && (Objects[0]->Tim_Del > 100))) {
      N2++;
      continue;
    }
    if (Objects[I]->Fuel > 10)
      continue;
    Ok = false;
    for (J = 0; J < Phasers; J++) {
      if (Ships[I]->PChrg[J] > 0) {
	    Ok = true;
	    break;
      }
    }
    if (Ok)
      continue;
    for (J = 0; J < Tubes; J++) {
      if (Ships[I]->Tengy[J] > 0) {
	    Ok = true;
	    break;
      }
    }
    if (!Ok)
      N1++;
  }

  /* Don't quit on all disabled... */
  if (cheat)
    N2 = 0;

  switch (Win) {

  case 0:
    if (N1 == Enemies)
      Win = 2;
    else if (N1 + N2 == Enemies)
      Win = 3;
    break;

  case 1:
    if (N1 == Enemies)
      Win = 6;		/* Nobody won */
/*    else if (N1 + N2 < Enemies)
      Win = 5;		/* No special case needed */
    break;
  }
  if (Win > 0)
    Ender();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movsd 0xdf48(%rip), %xmm0     # 0x151a8
divsd 0xdf38(%rip), %xmm0     # 0x151a0
cvttsd2si %xmm0, %rax
movl %eax, -0x24(%rbp)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x735a
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movzbl 0xe33e(%rip), %ecx      # 0x155d2
cmpl %ecx, %eax
jge 0x734a
movslq -0xc(%rbp), %rcx
leaq 0xe339(%rip), %rax      # 0x155e0
cmpq $0x0, (%rax,%rcx,8)
je 0x733a
movslq -0xc(%rbp), %rcx
leaq 0xe323(%rip), %rax      # 0x155e0
movq (%rax,%rcx,8), %rax
movswl 0x4a(%rax), %eax
movl %eax, -0x8(%rbp)
cmpl $0xa, -0x8(%rbp)
jge 0x7316
movslq -0xc(%rbp), %rcx
leaq 0xe6a7(%rip), %rax      # 0x15980
movq (%rax,%rcx,8), %rax
movswl 0x1a(%rax), %eax
cmpl $0x0, %eax
jle 0x7314
movl -0x4(%rbp), %eax
movzbl 0xdec0(%rip), %ecx      # 0x151b0
cmpl %ecx, %eax
jge 0x72fc
movl -0xc(%rbp), %edi
callq 0x5830
movl -0x4(%rbp), %eax
movzbl 0xdeab(%rip), %ecx      # 0x151b1
cmpl %ecx, %eax
jge 0x7312
movl -0xc(%rbp), %edi
callq 0x5e50
jmp 0x7314
jmp 0x7316
movl -0xc(%rbp), %edi
callq 0x6560
movslq -0xc(%rbp), %rcx
leaq 0xe2b7(%rip), %rax      # 0x155e0
cmpq $0x0, (%rax,%rcx,8)
je 0x7338
movl -0xc(%rbp), %edi
callq 0x6690
jmp 0x733a
jmp 0x733c
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x728a
jmp 0x734c
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x7277
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
movzbl 0xe265(%rip), %ecx      # 0x155d0
cmpl %ecx, %eax
jg 0x7445
movslq -0x4(%rbp), %rcx
leaq 0xe602(%rip), %rax      # 0x15980
cmpq $0x0, (%rax,%rcx,8)
je 0x7435
movl -0x4(%rbp), %edi
movsd 0x7d3c(%rip), %xmm0     # 0xf0d0
callq 0x4b30
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movzbl 0xde06(%rip), %ecx      # 0x151b0
cmpl %ecx, %eax
jge 0x73e6
movslq -0x4(%rbp), %rcx
leaq 0xe5c7(%rip), %rax      # 0x15980
movq (%rax,%rcx,8), %rax
movslq -0xc(%rbp), %rcx
movswl 0xd2(%rax,%rcx,2), %eax
cmpl $0x0, %eax
jl 0x73d9
movl -0x4(%rbp), %edi
movl -0xc(%rbp), %esi
callq 0x54e0
jmp 0x73db
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x73a0
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movzbl 0xddba(%rip), %ecx      # 0x151b1
cmpl %ecx, %eax
jge 0x7433
movslq -0x4(%rbp), %rcx
leaq 0xe57a(%rip), %rax      # 0x15980
movq (%rax,%rcx,8), %rax
movslq -0xc(%rbp), %rcx
movswl 0x110(%rax,%rcx,2), %eax
cmpl $0x0, %eax
jl 0x7426
movl -0x4(%rbp), %edi
movl -0xc(%rbp), %esi
callq 0x5cc0
jmp 0x7428
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x73ed
jmp 0x7435
jmp 0x7437
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x7361
movl $0xffffffff, 0xe5d9(%rip) # imm = 0xFFFFFFFF
cmpq $0x0, 0xe529(%rip)      # 0x15980
je 0x74bd
movq 0xe180(%rip), %rax      # 0x155e0
movsd 0x7c40(%rip), %xmm0     # 0xf0a8
subsd 0x30(%rax), %xmm0
movsd 0xdd2b(%rip), %xmm1     # 0x151a0
mulsd %xmm1, %xmm0
movsd 0x7c07(%rip), %xmm1     # 0xf088
addsd %xmm1, %xmm0
callq 0x22c0
cvttsd2si %xmm0, %rax
movl %eax, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
je 0x74bb
cmpl $0xf, -0x8(%rbp)
jg 0x74bb
movl -0x8(%rbp), %edx
leaq 0xdff8(%rip), %rdi      # 0x154a0
leaq 0x91fb(%rip), %rsi      # 0x106aa
movb $0x0, %al
callq 0x2190
callq 0x4320
jmp 0x74bd
movl $0x0, -0x4(%rbp)
cmpl $0x3, -0x4(%rbp)
jg 0x7506
movslq -0x4(%rbp), %rcx
leaq 0xe0fe(%rip), %rax      # 0x155d3
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x74f9
movslq -0x4(%rbp), %rcx
leaq 0xe0ea(%rip), %rax      # 0x155d3
movb (%rax,%rcx), %dl
addb $0x1, %dl
leaq 0xe0dd(%rip), %rax      # 0x155d3
movb %dl, (%rax,%rcx)
jmp 0x74fb
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x74c4
movl $0x0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movb $0x0, 0xe0bc(%rip)      # 0x155d7
cmpq $0x0, 0xe45d(%rip)      # 0x15980
je 0x7535
movq 0xe454(%rip), %rax      # 0x15980
movswl 0x1a(%rax), %eax
cmpl $0x0, %eax
jne 0x7541
movb $0x1, 0xe09b(%rip)      # 0x155d7
jmp 0x764a
movq 0xe438(%rip), %rax      # 0x15980
movq %rax, -0x30(%rbp)
movb $0x0, -0x15(%rbp)
movq -0x30(%rbp), %rax
movsd (%rax), %xmm0
movsd 0x7ab0(%rip), %xmm1     # 0xf010
ucomisd %xmm1, %xmm0
ja 0x759a
movq -0x30(%rbp), %rax
cmpb $0x0, 0xc3(%rax)
je 0x7580
movq -0x30(%rbp), %rax
cmpb $0x0, 0xc2(%rax)
jne 0x75a3
movq 0xe059(%rip), %rax      # 0x155e0
movsd 0x20(%rax), %xmm0
movsd 0x7a74(%rip), %xmm1     # 0xf008
ucomisd %xmm1, %xmm0
jbe 0x75a3
movb $0x1, -0x15(%rbp)
jmp 0x763b
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
movzbl 0xdbfc(%rip), %ecx      # 0x151b0
cmpl %ecx, %eax
jge 0x75e2
movq -0x30(%rbp), %rax
movslq -0x4(%rbp), %rcx
movsd 0x20(%rax,%rcx,8), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x75d5
movb $0x1, -0x15(%rbp)
jmp 0x75e2
jmp 0x75d7
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x75aa
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %ecx
movzbl 0xdbbe(%rip), %edx      # 0x151b1
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x31(%rbp)
jge 0x7608
cmpb $0x0, -0x15(%rbp)
setne %al
xorb $-0x1, %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0x7611
jmp 0x7639
movq -0x30(%rbp), %rax
movslq -0x4(%rbp), %rcx
movswl 0xc6(%rax,%rcx,2), %eax
cmpl $0x0, %eax
jle 0x762c
movb $0x1, -0x15(%rbp)
jmp 0x7639
jmp 0x762e
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x75e9
jmp 0x763b
cmpb $0x0, -0x15(%rbp)
jne 0x7648
movb $0x1, 0xdf8f(%rip)      # 0x155d7
jmp 0x764a
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
movzbl 0xdf75(%rip), %ecx      # 0x155d0
cmpl %ecx, %eax
jg 0x77f7
movslq -0x4(%rbp), %rcx
leaq 0xe312(%rip), %rax      # 0x15980
cmpq $0x0, (%rax,%rcx,8)
je 0x768d
movslq -0x4(%rbp), %rcx
leaq 0xe300(%rip), %rax      # 0x15980
movq (%rax,%rcx,8), %rax
movswl 0x1a(%rax), %eax
cmpl $0x0, %eax
jne 0x769b
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x77e9
movl -0x4(%rbp), %edi
xorl %esi, %esi
callq 0x4540
movsd %xmm0, -0x20(%rbp)
movsd -0x20(%rbp), %xmm0
movsd 0x7a49(%rip), %xmm1     # 0xf100
ucomisd %xmm1, %xmm0
jbe 0x76d8
movslq -0x4(%rbp), %rcx
leaq 0xe2b8(%rip), %rax      # 0x15980
movq (%rax,%rcx,8), %rax
movsbl 0xc3(%rax), %eax
cmpl $0x0, %eax
jne 0x7705
movsd -0x20(%rbp), %xmm0
movsd 0x7a23(%rip), %xmm1     # 0xf108
ucomisd %xmm1, %xmm0
jbe 0x7713
movq 0xdeee(%rip), %rax      # 0x155e0
movsd 0x30(%rax), %xmm0
movsd 0x7969(%rip), %xmm1     # 0xf068
ucomisd %xmm1, %xmm0
jbe 0x7713
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x77e9
movslq -0x4(%rbp), %rcx
leaq 0xdec2(%rip), %rax      # 0x155e0
movq (%rax,%rcx,8), %rax
movsd 0x20(%rax), %xmm0
movsd 0x78d9(%rip), %xmm1     # 0xf008
ucomisd %xmm1, %xmm0
jbe 0x773a
jmp 0x77e9
movb $0x0, -0x15(%rbp)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movzbl 0xda61(%rip), %ecx      # 0x151b0
cmpl %ecx, %eax
jge 0x7788
movslq -0x4(%rbp), %rcx
leaq 0xe222(%rip), %rax      # 0x15980
movq (%rax,%rcx,8), %rax
movslq -0xc(%rbp), %rcx
movsd 0x20(%rax,%rcx,8), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x777b
movb $0x1, -0x15(%rbp)
jmp 0x7788
jmp 0x777d
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x7745
cmpb $0x0, -0x15(%rbp)
je 0x7790
jmp 0x77e9
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movzbl 0xda10(%rip), %ecx      # 0x151b1
cmpl %ecx, %eax
jge 0x77d8
movslq -0x4(%rbp), %rcx
leaq 0xe1d0(%rip), %rax      # 0x15980
movq (%rax,%rcx,8), %rax
movslq -0xc(%rbp), %rcx
movswl 0xc6(%rax,%rcx,2), %eax
cmpl $0x0, %eax
jle 0x77cb
movb $0x1, -0x15(%rbp)
jmp 0x77d8
jmp 0x77cd
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x7797
cmpb $0x0, -0x15(%rbp)
jne 0x77e7
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x77e9
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x7651
cmpb $0x0, 0xddc2(%rip)      # 0x155c0
je 0x7807
movl $0x0, -0x14(%rbp)
movzbl 0xddc9(%rip), %eax      # 0x155d7
movl %eax, -0x38(%rbp)
testl %eax, %eax
je 0x7821
jmp 0x7817
movl -0x38(%rbp), %eax
subl $0x1, %eax
je 0x7854
jmp 0x786b
movl -0x10(%rbp), %eax
movzbl 0xdda5(%rip), %ecx      # 0x155d0
cmpl %ecx, %eax
jne 0x7838
movb $0x2, 0xdda1(%rip)      # 0x155d7
jmp 0x7852
movl -0x10(%rbp), %eax
addl -0x14(%rbp), %eax
movzbl 0xdd8b(%rip), %ecx      # 0x155d0
cmpl %ecx, %eax
jne 0x7850
movb $0x3, 0xdd87(%rip)      # 0x155d7
jmp 0x7852
jmp 0x786b
movl -0x10(%rbp), %eax
movzbl 0xdd72(%rip), %ecx      # 0x155d0
cmpl %ecx, %eax
jne 0x7869
movb $0x6, 0xdd6e(%rip)      # 0x155d7
jmp 0x786b
movzbl 0xdd65(%rip), %eax      # 0x155d7
cmpl $0x0, %eax
jle 0x787c
callq 0x6be0
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)