// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x4(%rbp)
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
movzbl 0xf33e(%rip), %ecx      # 0x151b1
cmpl %ecx, %eax
jge 0x5eac
movslq -0x4(%rbp), %rcx
leaq 0xfafe(%rip), %rax      # 0x15980
movq (%rax,%rcx,8), %rax
movslq -0x8(%rbp), %rcx
movswl 0x110(%rax,%rcx,2), %eax
cmpl $0x63, %eax
jle 0x5e9f
movl -0x8(%rbp), %eax
movl %eax, -0xc(%rbp)
jmp 0x5eac
jmp 0x5ea1
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x5e69
cmpl $0x0, -0xc(%rbp)
jge 0x5eb7
jmp 0x6129
movl -0x4(%rbp), %edi
movl -0xc(%rbp), %esi
callq 0x5cc0
movslq -0x4(%rbp), %rcx
leaq 0xfab3(%rip), %rax      # 0x15980
movq (%rax,%rcx,8), %rax
movslq -0xc(%rbp), %rcx
movswl 0x110(%rax,%rcx,2), %eax
cmpl $0x63, %eax
jg 0x5ee7
jmp 0x6129
movl -0x4(%rbp), %edi
leaq -0x10(%rbp), %rsi
callq 0x5b30
movslq -0x4(%rbp), %rcx
leaq 0xfa22(%rip), %rax      # 0x15920
movq (%rax,%rcx,8), %rdx
movl -0x10(%rbp), %ecx
leaq 0xf594(%rip), %rdi      # 0x154a0
leaq 0xa225(%rip), %rsi      # 0x10138
xorl %eax, %eax
callq 0x2190
callq 0x4320
movslq -0x10(%rbp), %rcx
leaq 0xf6b6(%rip), %rax      # 0x155e0
movq (%rax,%rcx,8), %rcx
movq %rcx, -0x20(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0xfa43(%rip), %rdx      # 0x15980
movq %rdx, -0x38(%rbp)
movq (%rdx,%rcx,8), %rcx
movswl 0x11c(%rcx), %ecx
cvtsi2sd %ecx, %xmm0
movq -0x20(%rbp), %rcx
movsd %xmm0, 0x8(%rcx)
movq -0x20(%rbp), %rcx
movsd 0x8(%rcx), %xmm0
movsd %xmm0, (%rcx)
movslq -0x4(%rbp), %rcx
movq (%rdx,%rcx,8), %rdx
movslq -0xc(%rbp), %rsi
movsd 0xe0(%rdx,%rsi,8), %xmm0
movq (%rax,%rcx,8), %rax
movsd 0x10(%rax), %xmm1
addsd %xmm1, %xmm0
callq 0x4380
movq -0x38(%rbp), %rax
movq -0x20(%rbp), %rcx
movsd %xmm0, 0x18(%rcx)
movq -0x20(%rbp), %rcx
movsd 0x18(%rcx), %xmm0
movsd %xmm0, 0x10(%rcx)
movslq -0x4(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movslq -0xc(%rbp), %rdx
movswl 0xc6(%rcx,%rdx,2), %ecx
cvtsi2sd %ecx, %xmm0
movq -0x20(%rbp), %rcx
movsd %xmm0, 0x20(%rcx)
movl -0x4(%rbp), %ecx
addl $0x1e, %ecx
movw %cx, %dx
movq -0x20(%rbp), %rcx
movw %dx, 0x4a(%rcx)
movslq -0x4(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movswl 0x11e(%rcx), %ecx
cvtsi2sd %ecx, %xmm0
movsd 0x90eb(%rip), %xmm1     # 0xf0e0
mulsd %xmm1, %xmm0
movsd 0x90a7(%rip), %xmm1     # 0xf0a8
addsd %xmm1, %xmm0
movq -0x20(%rbp), %rcx
movsd %xmm0, 0x30(%rcx)
movslq -0x4(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movswl 0x120(%rax), %eax
cvtsi2sd %eax, %xmm0
movq -0x20(%rbp), %rax
movsd %xmm0, 0x28(%rax)
movq -0x20(%rbp), %rax
movsd 0x10(%rax), %xmm0
callq 0x4600
movsd %xmm0, -0x18(%rbp)
movq -0x20(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
movsd -0x18(%rbp), %xmm0
callq 0x20f0
movaps %xmm0, %xmm1
movsd -0x30(%rbp), %xmm0
mulsd %xmm1, %xmm0
mulsd 0xf138(%rip), %xmm0     # 0x151a0
movq -0x20(%rbp), %rax
movsd 0x38(%rax), %xmm1
movsd 0x8fef(%rip), %xmm2     # 0xf068
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x38(%rax)
movq -0x20(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x28(%rbp)
movsd -0x18(%rbp), %xmm0
callq 0x2300
movaps %xmm0, %xmm1
movsd -0x28(%rbp), %xmm0
mulsd %xmm1, %xmm0
mulsd 0xf0ef(%rip), %xmm0     # 0x151a0
movq -0x20(%rbp), %rax
movsd 0x40(%rax), %xmm1
movq %xmm0, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm0
movsd 0x8f8f(%rip), %xmm2     # 0xf068
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x40(%rax)
movslq -0x4(%rbp), %rcx
leaq 0xf88f(%rip), %rax      # 0x15980
movq (%rax,%rcx,8), %rax
movslq -0xc(%rbp), %rcx
movswl 0x110(%rax,%rcx,2), %edx
subl $0x64, %edx
movw %dx, 0x110(%rax,%rcx,2)
movslq -0x4(%rbp), %rcx
leaq 0xf869(%rip), %rax      # 0x15980
movq (%rax,%rcx,8), %rax
movslq -0xc(%rbp), %rcx
movw $0x0, 0xc6(%rax,%rcx,2)
addq $0x40, %rsp
popq %rbp
retq
nop