// File: /workspace/github_c_makefile_star2_O1/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, 0x9eab(%rip) # imm = 0xFFFFFFFF
movq 0x9e7c(%rip), %rdi      # 0x13a10
callq 0x2090
movq 0x9e70(%rip), %rdi      # 0x13a10
xorl %esi, %esi
xorl %edx, %edx
callq 0x21e0
cmpl $-0x1, %eax
je 0x9bc6
movq 0x9e5b(%rip), %rdi      # 0x13a10
leaq 0x5622(%rip), %rsi      # 0xf1de
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movb 0x95f4(%rip), %al       # 0x131c0
testb %al, %al
je 0x9d21
movq 0x9db5(%rip), %r13      # 0x13990
leaq 0x98ce(%rip), %rbx      # 0x134b0
leaq 0x5634(%rip), %r14      # 0xf21d
xorl %ebp, %ebp
leaq 0x1(%rbp), %r15
movq %rbx, %rdi
leaq 0x4afe(%rip), %rsi      # 0xe6f7
movl %r15d, %edx
xorl %eax, %eax
callq 0x21a0
movq 0x9e06(%rip), %rdi      # 0x13a10
movl %r15d, %esi
xorl %edx, %edx
callq 0x21e0
cmpl $-0x1, %eax
je 0x9c2d
movq 0x9df0(%rip), %rdi      # 0x13a10
movq %rbx, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movswq 0xd2(%r13,%rbp,2), %rax
leaq 0x55c2(%rip), %rsi      # 0xf1ff
testq %rax, %rax
js 0x9c90
leaq 0x55c5(%rip), %rsi      # 0xf20e
testw %ax, %ax
je 0x9c90
decl %eax
leaq 0x9cd9(%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 0x4b27(%rip), %rsi      # 0xe7a3
movq %r12, %rcx
leaq 0x3fac(%rip), %r9       # 0xdc32
xorl %eax, %eax
callq 0x21a0
movq %rbx, %rsi
movq 0x9d79(%rip), %rdi      # 0x13a10
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
cmpw $0x0, 0xd2(%r13,%rbp,2)
movq %r14, %rsi
js 0x9cfd
movsd 0x60(%r13,%rbp,8), %xmm0
movsd 0x3389(%rip), %xmm1     # 0xd048
addsd %xmm1, %xmm0
callq 0x22d0
cvttsd2si %xmm0, %r12
movsd 0x20(%r13,%rbp,8), %xmm0
addsd 0x336c(%rip), %xmm0     # 0xd048
callq 0x22d0
cvttsd2si %xmm0, %rcx
movq %rbx, %rdi
leaq 0x553a(%rip), %rsi      # 0xf22a
movq %r12, %rdx
xorl %eax, %eax
callq 0x21a0
movq %rbx, %rsi
movq 0x9d0c(%rip), %rdi      # 0x13a10
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movzbl 0x94ab(%rip), %eax      # 0x131c0
movq %r15, %rbp
cmpq %rax, %r15
jb 0x9beb
movzbl %al, %esi
movq 0x9ce5(%rip), %rdi      # 0x13a10
addl $0x2, %esi
xorl %edx, %edx
callq 0x21e0
cmpl $-0x1, %eax
je 0x9d52
movq 0x9ccf(%rip), %rdi      # 0x13a10
leaq 0x54eb(%rip), %rsi      # 0xf233
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
xorl %r15d, %r15d
leaq 0x9754(%rip), %rbx      # 0x134b0
leaq 0x4a2f(%rip), %r14      # 0xe792
movq 0x9c26(%rip), %rax      # 0x13990
movsd 0x40(%rax,%r15,8), %xmm0
movq %rbx, %rdi
movq %r14, %rsi
movb $0x1, %al
callq 0x21a0
movq 0x9c8b(%rip), %rdi      # 0x13a10
movq %rbx, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
incq %r15
cmpq $0x4, %r15
jne 0x9d63
movq 0x9bee(%rip), %rax      # 0x13990
movswl 0xdc(%rax), %edx
leaq 0x9700(%rip), %rdi      # 0x134b0
leaq 0x548b(%rip), %rsi      # 0xf242
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x21a0
movq 0x9c49(%rip), %rdi      # 0x13a10
movzbl 0x93f2(%rip), %esi      # 0x131c0
addl $0x3, %esi
xorl %edx, %edx
callq 0x21e0
cmpl $-0x1, %eax
je 0x9df5
movq 0x9c2c(%rip), %rdi      # 0x13a10
leaq 0x96c5(%rip), %rsi      # 0x134b0
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq 0x9c14(%rip), %rdi      # 0x13a10
callq 0x2190
movq 0x9bf0(%rip), %rdi      # 0x139f8
leaq 0x5449(%rip), %rsi      # 0xf258
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0x7c6a
movl $0x0, 0xc(%rsp)
cmpl $0x0, (%rbx)
jle 0x9fb3
incl 0x9bfb(%rip)            # 0x13a38
movq 0x9bb4(%rip), %rdi      # 0x139f8
leaq 0x5424(%rip), %rsi      # 0xf26f
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
leaq 0xa(%rsp), %rdi
leaq 0xb(%rsp), %r14
movq %r14, %rsi
callq 0x7fe0
movl %eax, %ebx
movq 0x9b20(%rip), %r15      # 0x13990
cmpb $0x0, (%r14)
je 0x9f51
xorl %r12d, %r12d
xorl %edi, %edi
movl %ebx, %esi
callq 0x3d75
movq 0x9763(%rip), %rax      # 0x135f0
subsd 0x10(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x3180(%rip), %xmm2     # 0xd020
divsd %xmm2, %xmm0
leaq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0x22b0
movsd 0x316f(%rip), %xmm0     # 0xd028
movsd (%r14), %xmm1
mulsd %xmm0, %xmm1
addsd 0x10(%rsp), %xmm1
addsd %xmm1, %xmm0
movsd 0x314c(%rip), %xmm3     # 0xd020
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 0x9f46
cmpw $0x0, 0xd2(%r15,%rcx,2)
js 0x9f3f
testb %al, %al
je 0x9f3f
movw %bx, 0xd2(%r15,%rcx,2)
movslq %ecx, %rcx
movsd %xmm0, 0x60(%r15,%rcx,8)
jmp 0x9f46
incl %ebp
movb $0x1, 0xc(%rsp,%rcx)
incq %r12
cmpq $0x4, %r12
jne 0x9f0e
jmp 0x9fb3
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 0x9fa8
cmpw $0x0, 0xd2(%r15,%rcx,2)
js 0x9fa8
movsd %xmm0, 0x60(%r15,%rcx,8)
movslq %ecx, %rcx
movw $0x0, 0xd2(%r15,%rcx,2)
incq %rax
cmpq $0x4, %rax
jne 0x9f7c
xorl %ebp, %ebp
testl %ebp, %ebp
jle 0xa06a
movq 0x9a36(%rip), %rdi      # 0x139f8
leaq 0x4818(%rip), %rsi      # 0xe7e1
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
cmpl $0x1, %ebp
je 0x9fe9
movq 0x9a19(%rip), %rdi      # 0x139f8
movl $0x73, %esi
callq 0x2160
cmpb $0x0, 0x91d0(%rip)      # 0x131c0
je 0xa03f
leaq 0x94b7(%rip), %rbx      # 0x134b0
leaq 0x47f2(%rip), %r14      # 0xe7f2
xorl %r15d, %r15d
cmpb $0x0, 0xc(%rsp,%r15)
je 0xa030
leal 0x1(%r15), %edx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x21a0
movq 0x99d5(%rip), %rdi      # 0x139f8
movq %rbx, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
incq %r15
movzbl 0x9186(%rip), %eax      # 0x131c0
cmpq %rax, %r15
jb 0xa003
movq 0x99b2(%rip), %rdi      # 0x139f8
leaq 0x5229(%rip), %rsi      # 0xf276
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3c58
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq