// File: /workspace/github_c_makefile_star2_O0/hyc[P]trek73c/trekx.c
// Function: PhaserFire
void PhaserFire(I)
int I;
{
  int J, K, L, Hits, Units;

  K = (-1);
  for (J = 0; J < Phasers; J++) {
    if (Ships[I]->Pstat[J] > 99) {
      K = J;
      break;
    }
  }
  if (K < 0)
    return;
  TrakPhas(I, K);
  if (Ships[I]->Pstat[K] <= 99)
    return;
  sprintf(scrstr," <<%s Firing Phasers>>", Snams[I]);
  SEndln();
  Ships[I]->Pstat[K] -= 100;
  for (J = 0; J < ObjCount; J++) {
    if (Objects[J] != NULL) {
      L = Objects[J]->ObTyp;
      if (I != J && L >= 0) {
	Hits = PhHits(I, J, K, &Units);
	if (Hits > 0) {
	  if (L > 10) {
	    Objects[J]->Fuel -= Hits / 2.0;
	    if (Objects[J]->Fuel < 0)
	      Objects[J]->Fuel = 0.0;
	    Objects[J]->Tim_Del = 10000.0;
	  }
	  L/=10;
	  switch (L) {

	  case 0:
	    Damage(I, J, Hits, 0);
	    break;

	  case 1:
	    sprintf(scrstr,"%s's Engineering hit.",
		   Snams[(Objects[J]->ObTyp) % 10]);
	    break;

	  case 2:
	    sprintf(scrstr,"Hit on probe %d", J);
	    break;

	  case 3:
	    sprintf(scrstr,"Hit on torpedo %d", J);
	    break;
	  }
	  if (L > 0)
	    SEndln();
	}
      }
    }
  }
  Ships[I]->PChrg[K] -= Units;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
movzbl 0xf95d(%rip), %ecx      # 0x151b0
cmpl %ecx, %eax
jge 0x588c
movslq -0x4(%rbp), %rcx
leaq 0x1011e(%rip), %rax     # 0x15980
movq (%rax,%rcx,8), %rax
movslq -0x8(%rbp), %rcx
movswl 0xd2(%rax,%rcx,2), %eax
cmpl $0x63, %eax
jle 0x587f
movl -0x8(%rbp), %eax
movl %eax, -0xc(%rbp)
jmp 0x588c
jmp 0x5881
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x5849
cmpl $0x0, -0xc(%rbp)
jge 0x5897
jmp 0x5b1d
movl -0x4(%rbp), %edi
movl -0xc(%rbp), %esi
callq 0x54e0
movslq -0x4(%rbp), %rcx
leaq 0x100d3(%rip), %rax     # 0x15980
movq (%rax,%rcx,8), %rax
movslq -0xc(%rbp), %rcx
movswl 0xd2(%rax,%rcx,2), %eax
cmpl $0x63, %eax
jg 0x58c7
jmp 0x5b1d
movslq -0x4(%rbp), %rcx
leaq 0x1004e(%rip), %rax     # 0x15920
movq (%rax,%rcx,8), %rdx
leaq 0xfbc3(%rip), %rdi      # 0x154a0
leaq 0xa7b1(%rip), %rsi      # 0x10095
movb $0x0, %al
callq 0x2190
callq 0x4320
movslq -0x4(%rbp), %rcx
leaq 0x10085(%rip), %rax     # 0x15980
movq (%rax,%rcx,8), %rax
movslq -0xc(%rbp), %rcx
movswl 0xd2(%rax,%rcx,2), %edx
subl $0x64, %edx
movw %dx, 0xd2(%rax,%rcx,2)
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
movzbl 0xfcab(%rip), %ecx      # 0x155d2
cmpl %ecx, %eax
jge 0x5af5
movslq -0x8(%rbp), %rcx
leaq 0xfca6(%rip), %rax      # 0x155e0
cmpq $0x0, (%rax,%rcx,8)
je 0x5ae5
movslq -0x8(%rbp), %rcx
leaq 0xfc90(%rip), %rax      # 0x155e0
movq (%rax,%rcx,8), %rax
movswl 0x4a(%rax), %eax
movl %eax, -0x10(%rbp)
movl -0x4(%rbp), %eax
cmpl -0x8(%rbp), %eax
je 0x5ae3
cmpl $0x0, -0x10(%rbp)
jl 0x5ae3
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
movl -0xc(%rbp), %edx
leaq -0x18(%rbp), %rcx
callq 0x5680
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jle 0x5ae1
cmpl $0xa, -0x10(%rbp)
jle 0x5a10
cvtsi2sdl -0x14(%rbp), %xmm1
movsd 0x972d(%rip), %xmm0     # 0xf0d0
divsd %xmm0, %xmm1
movslq -0x8(%rbp), %rcx
leaq 0xfc2e(%rip), %rax      # 0x155e0
movq (%rax,%rcx,8), %rax
movsd 0x20(%rax), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rax)
movslq -0x8(%rbp), %rcx
leaq 0xfc11(%rip), %rax      # 0x155e0
movq (%rax,%rcx,8), %rax
xorps %xmm0, %xmm0
ucomisd 0x20(%rax), %xmm0
jbe 0x59f4
movslq -0x8(%rbp), %rcx
leaq 0xfbf8(%rip), %rax      # 0x155e0
movq (%rax,%rcx,8), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x20(%rax)
movslq -0x8(%rbp), %rcx
leaq 0xfbe1(%rip), %rax      # 0x155e0
movq (%rax,%rcx,8), %rax
movsd 0x969d(%rip), %xmm0     # 0xf0a8
movsd %xmm0, 0x30(%rax)
movslq -0x10(%rbp), %rax
imulq $0x66666667, %rax, %rax # imm = 0x66666667
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x22, %rax
addl %ecx, %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
movq %rax, -0x20(%rbp)
subq $0x3, %rax
ja 0x5ad4
movq -0x20(%rbp), %rax
leaq 0x9771(%rip), %rcx      # 0xf1b8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
movl -0x14(%rbp), %edx
xorl %ecx, %ecx
callq 0x4f80
jmp 0x5ad4
movslq -0x8(%rbp), %rcx
leaq 0xfb73(%rip), %rax      # 0x155e0
movq (%rax,%rcx,8), %rax
movswl 0x4a(%rax), %eax
movl $0xa, %ecx
cltd
idivl %ecx
movslq %edx, %rcx
leaq 0xfe99(%rip), %rax      # 0x15920
movq (%rax,%rcx,8), %rdx
leaq 0xfa0e(%rip), %rdi      # 0x154a0
leaq 0xa613(%rip), %rsi      # 0x100ac
movb $0x0, %al
callq 0x2190
jmp 0x5ad4
movl -0x8(%rbp), %edx
leaq 0xf9f4(%rip), %rdi      # 0x154a0
leaq 0xa60f(%rip), %rsi      # 0x100c2
movb $0x0, %al
callq 0x2190
jmp 0x5ad4
movl -0x8(%rbp), %edx
leaq 0xf9da(%rip), %rdi      # 0x154a0
leaq 0xa605(%rip), %rsi      # 0x100d2
movb $0x0, %al
callq 0x2190
cmpl $0x0, -0x10(%rbp)
jle 0x5adf
callq 0x4320
jmp 0x5ae1
jmp 0x5ae3
jmp 0x5ae5
jmp 0x5ae7
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x591d
cvtsi2sdl -0x18(%rbp), %xmm1
movslq -0x4(%rbp), %rcx
leaq 0xfe7b(%rip), %rax      # 0x15980
movq (%rax,%rcx,8), %rax
movslq -0xc(%rbp), %rcx
movsd 0x20(%rax,%rcx,8), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rax,%rcx,8)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)