// File: /workspace/github_c_makefile_star2_O2/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 $0x38, %rsp
orl $-0x1, 0xa153(%rip)     # 0x12a28
movq 0xa124(%rip), %rdi      # 0x12a00
callq 0x2080
movq 0xa118(%rip), %rdi      # 0x12a00
xorl %esi, %esi
xorl %edx, %edx
callq 0x21d0
cmpl $-0x1, %eax
je 0x890c
movq 0xa103(%rip), %rdi      # 0x12a00
leaq 0x491a(%rip), %rsi      # 0xd21e
pushq $-0x1
popq %rdx
callq 0x2200
movq 0xa06d(%rip), %r13      # 0x12980
leaq 0x9b86(%rip), %rbx      # 0x124a0
pushq $-0x1
popq %rbp
leaq 0x4939(%rip), %r14      # 0xd25d
xorl %r15d, %r15d
movzbl 0x9882(%rip), %esi      # 0x121b0
cmpq %rsi, %r15
jae 0x8a57
leal 0x1(%r15), %r12d
movq %rbx, %rdi
leaq 0x3df2(%rip), %rsi      # 0xc737
movl %r12d, %edx
xorl %eax, %eax
callq 0x2190
movq 0xa0aa(%rip), %rdi      # 0x12a00
movl %r12d, %esi
xorl %edx, %edx
callq 0x21d0
cmpl $-0x1, %eax
je 0x8976
movq 0xa094(%rip), %rdi      # 0x12a00
movq %rbx, %rsi
movl %ebp, %edx
callq 0x2200
movzwl 0xd2(%r13,%r15,2), %eax
leaq 0x48b9(%rip), %rsi      # 0xd23f
testw %ax, %ax
js 0x89d7
leaq 0x48bc(%rip), %rsi      # 0xd24e
je 0x89d7
decl %eax
movzwl %ax, %eax
leaq 0x9f80(%rip), %rcx      # 0x12920
movq (%rcx,%rax,8), %r12
movq %r12, %rdi
callq 0x2140
shrq %rax
pushq $0x5
popq %r8
subl %eax, %r8d
leal 0x9(%rax), %edx
movq %rbx, %rdi
leaq 0x3e20(%rip), %rsi      # 0xc7e3
movq %r12, %rcx
leaq 0x32a5(%rip), %r9       # 0xbc72
xorl %eax, %eax
callq 0x2190
movq %rbx, %rsi
movq 0xa022(%rip), %rdi      # 0x12a00
movl %ebp, %edx
callq 0x2200
cmpw $0x0, 0xd2(%r13,%r15,2)
movq %r14, %rsi
js 0x8a41
movsd 0x60(%r13,%r15,8), %xmm0
movsd 0x2645(%rip), %xmm1     # 0xb048
addsd %xmm1, %xmm0
callq 0x22c0
cvttsd2si %xmm0, %r12
movsd 0x20(%r13,%r15,8), %xmm0
addsd 0x2628(%rip), %xmm0     # 0xb048
callq 0x22c0
cvttsd2si %xmm0, %rcx
movq %rbx, %rdi
leaq 0x4836(%rip), %rsi      # 0xd26a
movq %r12, %rdx
xorl %eax, %eax
callq 0x2190
movq %rbx, %rsi
movq 0x9fb8(%rip), %rdi      # 0x12a00
movl %ebp, %edx
callq 0x2200
incq %r15
jmp 0x8927
movq 0x9fa2(%rip), %rdi      # 0x12a00
addl $0x2, %esi
xorl %edx, %edx
callq 0x21d0
cmpl $-0x1, %eax
je 0x8a83
movq 0x9f8c(%rip), %rdi      # 0x12a00
leaq 0x47f8(%rip), %rsi      # 0xd273
pushq $-0x1
popq %rdx
callq 0x2200
xorl %r15d, %r15d
leaq 0x9a13(%rip), %rbx      # 0x124a0
leaq 0x3d3e(%rip), %r14      # 0xc7d2
pushq $-0x1
popq %rbp
movq 0x9ee2(%rip), %rax      # 0x12980
cmpq $0x4, %r15
je 0x8ace
movsd 0x40(%rax,%r15,8), %xmm0
movq %rbx, %rdi
movq %r14, %rsi
movb $0x1, %al
callq 0x2190
movq 0x9f41(%rip), %rdi      # 0x12a00
movq %rbx, %rsi
movl %ebp, %edx
callq 0x2200
incq %r15
jmp 0x8a97
movswl 0xdc(%rax), %edx
leaq 0x99c4(%rip), %rdi      # 0x124a0
leaq 0x479f(%rip), %rsi      # 0xd282
xorl %eax, %eax
callq 0x2190
movq 0x9f0f(%rip), %rdi      # 0x12a00
movzbl 0x96b8(%rip), %esi      # 0x121b0
addl $0x3, %esi
xorl %edx, %edx
callq 0x21d0
cmpl $-0x1, %eax
je 0x8b1d
movq 0x9ef2(%rip), %rdi      # 0x12a00
leaq 0x998b(%rip), %rsi      # 0x124a0
pushq $-0x1
popq %rdx
callq 0x2200
movq 0x9edc(%rip), %rdi      # 0x12a00
callq 0x2180
movq 0x9eb8(%rip), %rdi      # 0x129e8
leaq 0x4761(%rip), %rsi      # 0xd298
pushq $-0x1
popq %rdx
callq 0x2200
leaq 0x10(%rsp), %rdi
callq 0x6cd8
xorl %eax, %eax
cmpq $0x4, %rax
je 0x8b5b
movb $0x0, 0xc(%rsp,%rax)
incq %rax
jmp 0x8b4b
cmpl $0x0, 0x10(%rsp)
jle 0x8d02
incl 0x9ebc(%rip)            # 0x12a28
movq 0x9e75(%rip), %rdi      # 0x129e8
leaq 0x4735(%rip), %rsi      # 0xd2af
pushq $-0x1
popq %rdx
callq 0x2200
leaq 0xa(%rsp), %rdi
leaq 0xb(%rsp), %r14
movq %r14, %rsi
callq 0x702f
movl %eax, %ebx
movq 0x9de3(%rip), %r15      # 0x12980
cmpb $0x0, (%r14)
je 0x8cbd
xorl %r14d, %r14d
xorl %edi, %edi
movl %ebx, %esi
callq 0x3a49
movq 0x9a26(%rip), %rax      # 0x125e0
subsd 0x10(%rax), %xmm0
callq 0x39cd
movb 0xa(%rsp), %al
incl %ebx
xorl %ebp, %ebp
cmpq $0x4, %r14
je 0x8c0e
movl 0x10(%rsp,%r14,4), %ecx
decl %ecx
cmpl $0x3, %ecx
ja 0x8c09
movl %ecx, %ecx
cmpw $0x0, 0xd2(%r15,%rcx,2)
js 0x8c02
testb %al, %al
je 0x8c02
movw %bx, 0xd2(%r15,%rcx,2)
movsd %xmm0, 0x60(%r15,%rcx,8)
jmp 0x8c09
incl %ebp
movb $0x1, 0xc(%rsp,%rcx)
incq %r14
jmp 0x8bcc
testl %ebp, %ebp
jle 0x8d02
movq 0x9dcb(%rip), %rdi      # 0x129e8
leaq 0x3bfd(%rip), %rsi      # 0xc821
pushq $-0x1
popq %rdx
callq 0x2200
cmpl $0x1, %ebp
je 0x8c40
movq 0x9db0(%rip), %rdi      # 0x129e8
pushq $0x73
popq %rsi
callq 0x2150
leaq 0x9859(%rip), %rbx      # 0x124a0
leaq 0x3be4(%rip), %r14      # 0xc832
pushq $-0x1
popq %rbp
xorl %r15d, %r15d
movzbl 0x9555(%rip), %eax      # 0x121b0
movq %r15, %rcx
cmpq %rax, %rcx
jae 0x8c94
leaq 0x1(%rcx), %r15
cmpb $0x0, 0xc(%rsp,%rcx)
movq %r15, %rcx
je 0x8c5e
movq %rbx, %rdi
movq %r14, %rsi
movl %r15d, %edx
xorl %eax, %eax
callq 0x2190
movq 0x9d60(%rip), %rdi      # 0x129e8
movq %rbx, %rsi
movl %ebp, %edx
callq 0x2200
jmp 0x8c54
movq 0x9d4d(%rip), %rdi      # 0x129e8
leaq 0x4614(%rip), %rsi      # 0xd2b6
pushq $-0x1
popq %rdx
callq 0x2200
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3933
movl $0x168, %ecx            # imm = 0x168
movl %ebx, %eax
cltd
idivl %ecx
cvtsi2sd %edx, %xmm0
xorl %eax, %eax
cmpq $0x4, %rax
je 0x8d02
movl 0x10(%rsp,%rax,4), %ecx
decl %ecx
cmpl $0x3, %ecx
ja 0x8cfd
movl %ecx, %ecx
cmpw $0x0, 0xd2(%r15,%rcx,2)
js 0x8cfd
movsd %xmm0, 0x60(%r15,%rcx,8)
andw $0x0, 0xd2(%r15,%rcx,2)
incq %rax
jmp 0x8ccd
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq