// File: /workspace/github_c_makefile_star2_O1/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movzbl 0xe003(%rip), %eax      # 0x131c1
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movslq %edi, %rbx
testq %rax, %rax
je 0x51ef
leaq 0xe7be(%rip), %rcx      # 0x13990
movq (%rcx,%rbx,8), %rdx
xorl %ecx, %ecx
cmpw $0x63, 0x110(%rdx,%rcx,2)
jg 0x51ed
incq %rcx
cmpq %rcx, %rax
jne 0x51d8
jmp 0x51ef
movl %ecx, %ebp
testl %ebp, %ebp
js 0x541c
movl %ebx, %edi
movl %ebp, %esi
callq 0x5030
leaq 0xe789(%rip), %r13      # 0x13990
movq (%r13,%rbx,8), %rax
movl %ebp, %r12d
cmpw $0x64, 0x110(%rax,%r12,2)
jl 0x541c
leaq 0x2c(%rsp), %r14
movl %ebx, %edi
movq %r14, %rsi
callq 0x4f71
leaq 0xe6fb(%rip), %rax      # 0x13930
movq (%rax,%rbx,8), %rdx
movslq (%r14), %r14
leaq 0xe26d(%rip), %r15      # 0x134b0
leaq 0x8db2(%rip), %rsi      # 0xdffc
movq %r15, %rdi
movl %r14d, %ecx
xorl %eax, %eax
callq 0x21a0
movq 0xe79a(%rip), %rdi      # 0x139f8
movq %r15, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
callq 0x3c58
leaq 0xe379(%rip), %rax      # 0x135f0
movq (%rax,%r14,8), %r15
movq (%r13,%rbx,8), %rbp
movswl 0x11c(%rbp), %ecx
cvtsi2sd %ecx, %xmm0
movsd %xmm0, 0x8(%rsp)
movsd %xmm0, 0x8(%r15)
movsd %xmm0, (%r15)
movsd 0xe0(%rbp,%r12,8), %xmm0
movq (%rax,%rbx,8), %rax
addsd 0x10(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x7d63(%rip), %xmm2     # 0xd020
divsd %xmm2, %xmm0
leaq 0x30(%rsp), %r14
movq %r14, %rdi
callq 0x22b0
movsd 0x7d52(%rip), %xmm0     # 0xd028
movsd (%r14), %xmm1
mulsd %xmm0, %xmm1
addsd 0x10(%rsp), %xmm1
addsd %xmm1, %xmm0
movsd 0x7d2f(%rip), %xmm3     # 0xd020
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(%r15)
movlpd %xmm1, 0x10(%r15)
movswl 0xc6(%rbp,%r12,2), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x20(%r15)
leal 0x1e(%rbx), %eax
movw %ax, 0x4a(%r15)
movswl 0x11e(%rbp), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x7d5d(%rip), %xmm0     # 0xd0c0
addsd 0x7d5d(%rip), %xmm0     # 0xd0c8
movsd %xmm0, 0x30(%r15)
movswl 0x120(%rbp), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x28(%r15)
mulsd 0x7c83(%rip), %xmm1     # 0xd010
divsd 0x7c83(%rip), %xmm1     # 0xd018
movapd %xmm1, %xmm0
movapd %xmm1, 0x10(%rsp)
callq 0x20f0
mulsd 0x8(%rsp), %xmm0
mulsd 0xddfe(%rip), %xmm0     # 0x131b0
mulsd 0x7cd6(%rip), %xmm0     # 0xd090
addsd 0x38(%r15), %xmm0
movsd %xmm0, 0x38(%r15)
movsd (%r15), %xmm0
movsd %xmm0, 0x8(%rsp)
movapd 0x10(%rsp), %xmm0
callq 0x2310
movsd 0x40(%r15), %xmm1
mulsd 0x8(%rsp), %xmm0
mulsd 0xddc0(%rip), %xmm0     # 0x131b0
mulsd 0x7c98(%rip), %xmm0     # 0xd090
subsd %xmm0, %xmm1
movsd %xmm1, 0x40(%r15)
movq (%r13,%rbx,8), %rax
addw $-0x64, 0x110(%rax,%r12,2)
movw $0x0, 0xc6(%rax,%r12,2)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq