// File: /workspace/github_c_makefile_star2_O3/hyc[P]trek73c/trekx.c
// Function: Pstts
void Pstts()
{
  Digs temp;
  int i, shp, bad;
  boolean ok, Ship;
  Char *Junk;
  double B;
  boolean Stat[4];
  reg Srec *WITH;

  TCount = (-1);
  werase(Scnwin);
  mvwaddstr(Scnwin, 0, 0, "Phasers  Control  Turned  Levels");
  WITH = Ships[0];
  for (i = 0; i < Phasers; i++) {
    sprintf(scrstr,"%4d", i+1);
    mvwaddstr(Scnwin,i+1,0,scrstr);
    if (WITH->Pstat[i] < 0)
      waddstr(Scnwin,"     Damaged  ");
    else if (WITH->Pstat[i] == 0)
      waddstr(Scnwin,"      Manual  ");
    else {
      Junk = Snams[WITH->Pstat[i] - 1];
      shp = strlen(Junk) / 2 + 9;
      sprintf(scrstr,"%*s%*s", shp, Junk, 14 - shp, "");
      waddstr(Scnwin,scrstr);
    }
    if (WITH->Pstat[i] < 0)
      waddstr(Scnwin,"  --      --");
    else {
      sprintf(scrstr,"%4ld%8ld",
	     (long)floor(WITH->Pdepl[i] + 0.5),
	     (long)floor(WITH->PChrg[i] + 0.5));
      waddstr(Scnwin,scrstr);
    }
  }
  mvwaddstr(Scnwin,Phasers+2,0,"Charge rates: ");
  for (i = 0; i <= 3; i++) {
    sprintf(scrstr,"%4.0f", Ships[0]->PCrts[i]);
    waddstr(Scnwin,scrstr);
  }
  sprintf(scrstr,"Firing percentage: %d", Ships[0]->Pstat[5]);
  mvwaddstr(Scnwin,Phasers+3,0,scrstr);
  wrefresh(Scnwin);
  waddstr(Cmdwin,"   Lock Phasers [1-4] ");
  Indigits(temp);
  bad = 0;
  for (i = 0; i <= 3; i++)
    Stat[i] = false;
  if (temp[0] > 0) {
    TCount++;
    waddstr(Cmdwin,"   on ");
    shp = GetShp(&ok, &Ship);
    WITH = Ships[0];
    if (Ship) {
      B = Bearing(0, shp) - Objects[0]->Act_Crs;
      B = RMod(B);
      for (i = 0; i <= 3; i++) {
	if (temp[i] > 0 && temp[i] < 5) {
	  if (WITH->Pstat[temp[i] - 1] < 0 || !ok) {
	    bad++;
	    Stat[temp[i] - 1] = true;
	  } else {
	    WITH->Pstat[temp[i] - 1] = shp+1;
	    WITH->Pdepl[temp[i] - 1] = B;
	  }
	}
      }
    } else {
      for (i = 0; i <= 3; i++) {
	if (temp[i] > 0 && temp[i] < 5) {
	  if (WITH->Pstat[temp[i] - 1] >= 0) {
	    WITH->Pdepl[temp[i] - 1] = shp % 360;
	    WITH->Pstat[temp[i] - 1] = 0;
	  }
	}
      }
    }
  }
  if (bad <= 0)
    return;
  waddstr(Cmdwin,"Computer: Phaser");
  if (bad > 1)
    waddch(Cmdwin,'s');
  for (i = 0; i < Phasers; i++) {
    if (Stat[i]) {
      sprintf(scrstr,"%2d", i+1);
      waddstr(Cmdwin,scrstr);
    }
  }
  waddstr(Cmdwin," unable to turn.");
  Endln();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl $0xffffffff, 0x9dcf(%rip) # imm = 0xFFFFFFFF
movq 0x9da0(%rip), %rdi      # 0x13a10
callq 0x2090
movq 0x9d94(%rip), %rdi      # 0x13a10
xorl %esi, %esi
xorl %edx, %edx
callq 0x21e0
cmpl $-0x1, %eax
je 0x9ca2
movq 0x9d7f(%rip), %rdi      # 0x13a10
leaq 0x55fe(%rip), %rsi      # 0xf296
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
cmpb $0x0, 0x9517(%rip)      # 0x131c0
je 0x9e01
movq 0x9cda(%rip), %r13      # 0x13990
leaq 0x97f3(%rip), %rbx      # 0x134b0
leaq 0x5611(%rip), %r14      # 0xf2d5
xorl %ebp, %ebp
leaq 0x1(%rbp), %r15
movq %rbx, %rdi
leaq 0x4adb(%rip), %rsi      # 0xe7af
movl %r15d, %edx
xorl %eax, %eax
callq 0x21a0
movq 0x9d2b(%rip), %rdi      # 0x13a10
movl %r15d, %esi
xorl %edx, %edx
callq 0x21e0
cmpl $-0x1, %eax
je 0x9d08
movq 0x9d15(%rip), %rdi      # 0x13a10
movq %rbx, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movzwl 0xd2(%r13,%rbp,2), %eax
leaq 0x559f(%rip), %rsi      # 0xf2b7
testw %ax, %ax
js 0x9d6b
leaq 0x55a2(%rip), %rsi      # 0xf2c6
je 0x9d6b
decl %eax
movzwl %ax, %eax
leaq 0x9bfe(%rip), %rcx      # 0x13930
movq (%rcx,%rax,8), %r12
movq %r12, %rdi
callq 0x2150
shrq %rax
movl $0x5, %r8d
subl %eax, %r8d
leal 0x9(%rax), %edx
movq %rbx, %rdi
leaq 0x4b04(%rip), %rsi      # 0xe85b
movq %r12, %rcx
leaq 0x3f89(%rip), %r9       # 0xdcea
xorl %eax, %eax
callq 0x21a0
movq %rbx, %rsi
movq 0x9c9e(%rip), %rdi      # 0x13a10
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
cmpw $0x0, 0xd2(%r13,%rbp,2)
movq %r14, %rsi
js 0x9dd8
movsd 0x60(%r13,%rbp,8), %xmm0
movsd 0x33de(%rip), %xmm1     # 0xd178
addsd %xmm1, %xmm0
callq 0x22d0
cvttsd2si %xmm0, %r12
movsd 0x20(%r13,%rbp,8), %xmm0
addsd 0x33c1(%rip), %xmm0     # 0xd178
callq 0x22d0
cvttsd2si %xmm0, %rcx
movq %rbx, %rdi
leaq 0x5517(%rip), %rsi      # 0xf2e2
movq %r12, %rdx
xorl %eax, %eax
callq 0x21a0
movq %rbx, %rsi
movq 0x9c31(%rip), %rdi      # 0x13a10
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movzbl 0x93d0(%rip), %esi      # 0x131c0
movq %r15, %rbp
cmpq %rsi, %r15
jb 0x9cc6
addl $0x2, %esi
jmp 0x9e06
movl $0x2, %esi
movq 0x9c03(%rip), %rdi      # 0x13a10
xorl %edx, %edx
callq 0x21e0
cmpl $-0x1, %eax
je 0x9e31
movq 0x9bf0(%rip), %rdi      # 0x13a10
leaq 0x54c4(%rip), %rsi      # 0xf2eb
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
xorl %r15d, %r15d
leaq 0x9675(%rip), %rbx      # 0x134b0
leaq 0x4a08(%rip), %r14      # 0xe84a
movq 0x9b47(%rip), %rax      # 0x13990
movsd 0x40(%rax,%r15,8), %xmm0
movq %rbx, %rdi
movq %r14, %rsi
movb $0x1, %al
callq 0x21a0
movq 0x9bac(%rip), %rdi      # 0x13a10
movq %rbx, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
incq %r15
cmpq $0x4, %r15
jne 0x9e42
movq 0x9b0f(%rip), %rax      # 0x13990
movswl 0xdc(%rax), %edx
leaq 0x9621(%rip), %rdi      # 0x134b0
leaq 0x5464(%rip), %rsi      # 0xf2fa
xorl %eax, %eax
callq 0x21a0
movq 0x9b6c(%rip), %rdi      # 0x13a10
movzbl 0x9315(%rip), %esi      # 0x131c0
addl $0x3, %esi
xorl %edx, %edx
callq 0x21e0
cmpl $-0x1, %eax
je 0x9ed2
movq 0x9b4f(%rip), %rdi      # 0x13a10
leaq 0x95e8(%rip), %rsi      # 0x134b0
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq 0x9b37(%rip), %rdi      # 0x13a10
callq 0x2190
movq 0x9b13(%rip), %rdi      # 0x139f8
leaq 0x5424(%rip), %rsi      # 0xf310
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0x7d24
movl $0x0, 0xc(%rsp)
cmpl $0x0, (%rbx)
jle 0xa144
incl 0x9b1e(%rip)            # 0x13a38
movq 0x9ad7(%rip), %rdi      # 0x139f8
leaq 0x53ff(%rip), %rsi      # 0xf327
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
leaq 0xa(%rsp), %rdi
leaq 0xb(%rsp), %r14
movq %r14, %rsi
callq 0x809a
movl %eax, %ebx
movq 0x9a43(%rip), %r15      # 0x13990
cmpb $0x0, (%r14)
je 0xa0e5
xorl %r12d, %r12d
xorl %edi, %edi
movl %ebx, %esi
callq 0x3e93
movq 0x9686(%rip), %rax      # 0x135f0
subsd 0x10(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x31d3(%rip), %xmm2     # 0xd150
divsd %xmm2, %xmm0
leaq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0x22b0
movsd 0x31c2(%rip), %xmm0     # 0xd158
movsd (%r14), %xmm1
mulsd %xmm0, %xmm1
addsd 0x10(%rsp), %xmm1
addsd %xmm1, %xmm0
movsd 0x319f(%rip), %xmm3     # 0xd150
movapd %xmm3, %xmm2
cmpnlesd %xmm1, %xmm2
andpd %xmm2, %xmm1
andnpd %xmm0, %xmm2
orpd %xmm1, %xmm2
addsd %xmm2, %xmm3
xorpd %xmm1, %xmm1
movapd %xmm2, %xmm0
cmpltsd %xmm1, %xmm0
andpd %xmm0, %xmm3
andnpd %xmm2, %xmm0
orpd %xmm3, %xmm0
movb 0xa(%rsp), %al
incl %ebx
xorl %ebp, %ebp
movl 0x20(%rsp,%r12,4), %ecx
decl %ecx
cmpl $0x3, %ecx
ja 0xa022
movl %ecx, %ecx
cmpw $0x0, 0xd2(%r15,%rcx,2)
js 0xa01b
testb %al, %al
je 0xa01b
movw %bx, 0xd2(%r15,%rcx,2)
movsd %xmm0, 0x60(%r15,%rcx,8)
jmp 0xa022
incl %ebp
movb $0x1, 0xc(%rsp,%rcx)
incq %r12
cmpq $0x4, %r12
jne 0x9feb
testl %ebp, %ebp
jle 0xa144
movq 0x99be(%rip), %rdi      # 0x139f8
leaq 0x4858(%rip), %rsi      # 0xe899
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
cmpl $0x1, %ebp
je 0xa061
movq 0x99a1(%rip), %rdi      # 0x139f8
movl $0x73, %esi
callq 0x2160
movb 0x9159(%rip), %al       # 0x131c0
testb %al, %al
je 0xa0ba
leaq 0x943e(%rip), %rbx      # 0x134b0
leaq 0x4831(%rip), %r14      # 0xe8aa
xorl %r15d, %r15d
cmpb $0x0, 0xc(%rsp,%r15)
je 0xa0af
leal 0x1(%r15), %edx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x21a0
movq 0x995c(%rip), %rdi      # 0x139f8
movq %rbx, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movb 0x9111(%rip), %al       # 0x131c0
incq %r15
movzbl %al, %ecx
cmpq %rcx, %r15
jb 0xa07c
movq 0x9937(%rip), %rdi      # 0x139f8
leaq 0x5266(%rip), %rsi      # 0xf32e
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3d76
movslq %ebx, %rax
imulq $-0x49f49f49, %rax, %rax # imm = 0xB60B60B7
shrq $0x20, %rax
addl %ebx, %eax
movl %eax, %ecx
shrl $0x1f, %ecx
sarl $0x8, %eax
addl %ecx, %eax
imull $0x168, %eax, %eax      # imm = 0x168
subl %eax, %ebx
xorps %xmm0, %xmm0
cvtsi2sd %ebx, %xmm0
xorl %eax, %eax
movl 0x20(%rsp,%rax,4), %ecx
decl %ecx
cmpl $0x3, %ecx
ja 0xa13b
movl %ecx, %ecx
cmpw $0x0, 0xd2(%r15,%rcx,2)
js 0xa13b
movsd %xmm0, 0x60(%r15,%rcx,8)
movw $0x0, 0xd2(%r15,%rcx,2)
incq %rax
cmpq $0x4, %rax
jne 0xa110
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq