// File: /workspace/github_c_makefile_star2_O3/hyc[P]trek73c/trekx.c
// Function: Torpfire
void Torpfire(I)
int I;
{
  int J, K, Num;
  double X;
  reg Object *WITH;

  K = (-1);
  for (J = 0; J < Tubes; J++) {
    if (Ships[I]->Tstat[J] > 99) {
      K = J;
      break;
    }
  }
  if (K < 0)
    return;
  TrakTorp(I, K);
  if (Ships[I]->Tstat[K] <= 99)
    return;
  Launch(I, &Num);
  sprintf(scrstr,"<<%s firing Torpedo %d>>", Snams[I], Num);
  SEndln();
  WITH = Objects[Num];
  WITH->Des_Spd = Ships[I]->Tstat[6];
  WITH->Act_Spd = WITH->Des_Spd;
  WITH->Des_Crs = RMod(Ships[I]->TDepl[K] + Objects[I]->Act_Crs);
  WITH->Act_Crs = WITH->Des_Crs;
  WITH->Fuel = Ships[I]->Tengy[K];
  WITH->ObTyp = I + 30;
  WITH->Tim_Del = 10000 - Ships[I]->Tstat[7] * 4.0;
  WITH->Prx_Del = Ships[I]->Tstat[8];
  X = Radians(WITH->Act_Crs);
  WITH->XPos += WITH->Act_Spd * cos(X) * Iter * 100;
  WITH->YPos -= WITH->Act_Spd * sin(X) * Iter * 100;
  Ships[I]->Tstat[K] -= 100;
  Ships[I]->Tengy[K] = 0;
}

// Assembly:
movzbl 0xdf4f(%rip), %eax      # 0x131c1
testq %rax, %rax
je 0x54ea
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movslq %edi, %rbx
leaq 0xe6fd(%rip), %r13      # 0x13990
movq (%r13,%rbx,8), %rcx
xorl %r14d, %r14d
cmpw $0x63, 0x110(%rcx,%r14,2)
jg 0x52b4
incq %r14
cmpq %r14, %rax
jne 0x529b
jmp 0x54dc
movl %ebx, %edi
movl %r14d, %esi
callq 0x50eb
movq (%r13,%rbx,8), %rax
cmpw $0x64, 0x110(%rax,%r14,2)
jl 0x54dc
leaq 0x2c(%rsp), %r15
movl %ebx, %edi
movq %r15, %rsi
callq 0x5045
leaq 0xe647(%rip), %rax      # 0x13930
movq (%rax,%rbx,8), %rdx
movslq (%r15), %r15
leaq 0xe1b9(%rip), %r12      # 0x134b0
leaq 0x8db6(%rip), %rsi      # 0xe0b4
movq %r12, %rdi
movl %r15d, %ecx
xorl %eax, %eax
callq 0x21a0
movq 0xe6e6(%rip), %rdi      # 0x139f8
movq %r12, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
callq 0x3d76
leaq 0xe2c5(%rip), %rax      # 0x135f0
movq (%rax,%r15,8), %r12
movq (%r13,%rbx,8), %rbp
movswl 0x11c(%rbp), %ecx
cvtsi2sd %ecx, %xmm0
movsd %xmm0, 0x8(%rsp)
movsd %xmm0, 0x8(%r12)
movsd %xmm0, (%r12)
movsd 0xe0(%rbp,%r14,8), %xmm0
movq (%rax,%rbx,8), %rax
addsd 0x10(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x7ddd(%rip), %xmm2     # 0xd150
divsd %xmm2, %xmm0
leaq 0x30(%rsp), %r15
movq %r15, %rdi
callq 0x22b0
movsd 0x7dcc(%rip), %xmm0     # 0xd158
movsd (%r15), %xmm1
mulsd %xmm0, %xmm1
addsd 0x10(%rsp), %xmm1
addsd %xmm1, %xmm0
movsd 0x7da9(%rip), %xmm3     # 0xd150
movapd %xmm3, %xmm2
cmpnlesd %xmm1, %xmm2
andpd %xmm2, %xmm1
andnpd %xmm0, %xmm2
orpd %xmm1, %xmm2
addsd %xmm2, %xmm3
xorpd %xmm0, %xmm0
movapd %xmm2, %xmm1
cmpltsd %xmm0, %xmm1
andpd %xmm1, %xmm3
andnpd %xmm2, %xmm1
orpd %xmm3, %xmm1
movlpd %xmm1, 0x18(%r12)
movlpd %xmm1, 0x10(%r12)
movapd %xmm1, %xmm2
leal 0x1e(%rbx), %eax
xorpd %xmm0, %xmm0
pinsrw $0x1, 0xc6(%rbp,%r14,2), %xmm0
movw %ax, 0x4a(%r12)
movswl 0x11e(%rbp), %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
mulsd 0x7de7(%rip), %xmm1     # 0xd200
addsd 0x7de7(%rip), %xmm1     # 0xd208
movsd %xmm1, 0x30(%r12)
pinsrw $0x3, 0x120(%rbp), %xmm0
psrad $0x10, %xmm0
cvtdq2pd %xmm0, %xmm0
movups %xmm0, 0x20(%r12)
movapd %xmm2, %xmm0
mulsd 0x7cf4(%rip), %xmm0     # 0xd140
divsd 0x7cf4(%rip), %xmm0     # 0xd148
movapd %xmm0, 0x10(%rsp)
callq 0x20f0
mulsd 0x8(%rsp), %xmm0
mulsd 0xdd43(%rip), %xmm0     # 0x131b0
mulsd 0x7d33(%rip), %xmm0     # 0xd1a8
addsd 0x38(%r12), %xmm0
movsd %xmm0, 0x38(%r12)
movsd (%r12), %xmm0
movsd %xmm0, 0x8(%rsp)
movapd 0x10(%rsp), %xmm0
callq 0x2310
movsd 0x40(%r12), %xmm1
mulsd 0x8(%rsp), %xmm0
mulsd 0xdd01(%rip), %xmm0     # 0x131b0
mulsd 0x7cf1(%rip), %xmm0     # 0xd1a8
subsd %xmm0, %xmm1
movsd %xmm1, 0x40(%r12)
movq (%r13,%rbx,8), %rax
addw $-0x64, 0x110(%rax,%r14,2)
movw $0x0, 0xc6(%rax,%r14,2)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq