// File: /workspace/github_c_makefile_star2_O2/hyc[P]trek73c/trekx.c
// Function: AtPwr
void AtPwr()
{
  double inbuf[4];
  int i;
  boolean Ok;

  sprintf(scrstr,"Scott: Regeneration rate is %0.2f", Ships[0]->Regen);
  SEndln();
  waddstr(Cmdwin,"   Designate shield drains (X,X,X,X).");
  Endln();
  sprintf(scrstr,"   Current drains are: %0.2f %0.2f %0.2f %0.2f", Ships[0]->Sdrns[0],
    Ships[0]->Sdrns[1], Ships[0]->Sdrns[2], Ships[0]->Sdrns[3]);
  SEndln();
  do {
  do {
    Endln();
    sprintf(scrstr,"%s: Shield drains are [0-1] ", Name);
    waddstr(Cmdwin,scrstr);
    mygetstr(Cmdwin,scrstr,true);
    i=sscanf(scrstr," %lg%*[, ]%lg%*[, ]%lg%*[, ]%lg",&inbuf[0],&inbuf[1],
      &inbuf[2], &inbuf[3]);
    if (i<4) {
      sprintf(scrstr,"Scott: A value is needed for each of the 4 shields, %s.",
	Title);
      SEndln();
    } else
      break;
  } while (i<4);
  Ok = true;
  for (i=0; i<4; i++) {
    if (inbuf[i]<0 || inbuf[i]>1) {
      Ok = false;
      break;
    }
    Ships[0]->Sdrns[i] = inbuf[i];
  }
  if (!Ok) {
    sprintf(scrstr,"Scott: Minimum drain for shields is zero, maximum is one, %s.",
      Title);
    SEndln();
    sprintf(scrstr,"%s: Son-of-a-gun, you're right.", Name);
    SEndln();
  } else
    break;
  } while (!Ok);

  waddstr(Cmdwin,"Scott: Designate phaser charge/discharge (X,X,X,X).");
  Endln();
  sprintf(scrstr,"   current rates are: %0.2f %0.2f %0.2f %0.2f",Ships[0]->PCrts[0],
    Ships[0]->PCrts[1], Ships[0]->PCrts[2], Ships[0]->PCrts[3]);
  SEndln();
  do {
  do {
    Endln();
    sprintf(scrstr,"%s: Phaser C/D rates [-10 to 10] ", Name);
    waddstr(Cmdwin,scrstr);
    mygetstr(Cmdwin,scrstr,true);
    Endln();
    i=sscanf(scrstr," %lg%*[, ]%lg%*[, ]%lg%*[, ]%lg",&inbuf[0],&inbuf[1],
      &inbuf[2], &inbuf[3]);
    if (i<4) {
      sprintf(scrstr,"Scott: A value is needed for each of the 4 phasers, %s.",
	Title);
      SEndln();
    } else
      break;
  } while (i<4);
  Ok = true;
  for (i=0; i<4; i++) {
    if (inbuf[i]<-10 || inbuf[i]>10) {
      Ok = false;
      break;
    }
    Ships[0]->PCrts[i] = inbuf[i];
  }
  if (!Ok) {
    sprintf(scrstr,"Scott: I remind you, %s, maximum discharge rate is -10 and",
      Title);
    SEndln();
    waddstr(Cmdwin,"   maximum charge rate is 10.");
    Endln();
  } else
    break;
  } while (!Ok);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq 0x97db(%rip), %rax      # 0x12980
movsd (%rax), %xmm0
leaq 0x92f0(%rip), %r12      # 0x124a0
leaq 0x4181(%rip), %rsi      # 0xd338
movq %r12, %rdi
movb $0x1, %al
callq 0x2190
callq 0x399b
movq 0x981b(%rip), %rdi      # 0x129e8
leaq 0x4186(%rip), %rsi      # 0xd35a
pushq $-0x1
popq %rbp
movl %ebp, %edx
callq 0x2200
callq 0x3933
movq 0x9796(%rip), %rax      # 0x12980
movsd 0x80(%rax), %xmm0
movsd 0x88(%rax), %xmm1
movsd 0x90(%rax), %xmm2
movsd 0x98(%rax), %xmm3
leaq 0x416f(%rip), %rsi      # 0xd380
movq %r12, %rdi
movb $0x4, %al
callq 0x2190
callq 0x399b
leaq 0x4188(%rip), %r13      # 0xd3af
pushq $0x1
popq %rbx
leaq 0x419b(%rip), %r14      # 0xd3cc
movq %rsp, %r15
callq 0x3933
movq 0x9378(%rip), %rdx      # 0x125b8
movq %r12, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x2190
movq 0x9794(%rip), %rdi      # 0x129e8
movq %r12, %rsi
movl %ebp, %edx
callq 0x2200
movq 0x9783(%rip), %rdi      # 0x129e8
movq %r12, %rsi
movl %ebx, %edx
callq 0x246d
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
leaq 0x8(%rsp), %rcx
leaq 0x10(%rsp), %r8
leaq 0x18(%rsp), %r9
xorl %eax, %eax
callq 0x20a0
cmpl $0x4, %eax
jge 0x92a6
movq 0x932e(%rip), %rdx      # 0x125c8
movq %r12, %rdi
leaq 0x4148(%rip), %rsi      # 0xd3ec
jmp 0x930e
movq 0x96d3(%rip), %rax      # 0x12980
xorl %ecx, %ecx
xorpd %xmm1, %xmm1
movsd 0x1d55(%rip), %xmm2     # 0xb010
cmpq $0x4, %rcx
je 0x931f
movsd (%rsp,%rcx,8), %xmm0
ucomisd %xmm0, %xmm1
ja 0x92e0
ucomisd %xmm2, %xmm0
ja 0x92e0
movsd %xmm0, 0x80(%rax,%rcx,8)
incq %rcx
jmp 0x92bb
movq 0x92e1(%rip), %rdx      # 0x125c8
movq %r12, %rdi
leaq 0x4133(%rip), %rsi      # 0xd424
xorl %eax, %eax
callq 0x2190
callq 0x399b
movq 0x92b4(%rip), %rdx      # 0x125b8
movq %r12, %rdi
leaq 0x4154(%rip), %rsi      # 0xd462
xorl %eax, %eax
callq 0x2190
callq 0x399b
jmp 0x9234
movq 0x96c2(%rip), %rdi      # 0x129e8
leaq 0x4155(%rip), %rsi      # 0xd482
pushq $-0x1
popq %rbp
movl %ebp, %edx
callq 0x2200
callq 0x3933
movq 0x963d(%rip), %rax      # 0x12980
movsd 0x40(%rax), %xmm0
movsd 0x48(%rax), %xmm1
movsd 0x50(%rax), %xmm2
movsd 0x58(%rax), %xmm3
leaq 0x9142(%rip), %r12      # 0x124a0
leaq 0x4151(%rip), %rsi      # 0xd4b6
movq %r12, %rdi
movb $0x4, %al
callq 0x2190
callq 0x399b
leaq 0x4169(%rip), %r13      # 0xd4e4
pushq $0x1
popq %rbx
leaq 0x4047(%rip), %r14      # 0xd3cc
movq %rsp, %r15
callq 0x3933
movq 0x9224(%rip), %rdx      # 0x125b8
movq %r12, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x2190
movq 0x9640(%rip), %rdi      # 0x129e8
movq %r12, %rsi
movl %ebp, %edx
callq 0x2200
movq 0x962f(%rip), %rdi      # 0x129e8
movq %r12, %rsi
movl %ebx, %edx
callq 0x246d
callq 0x3933
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
leaq 0x8(%rsp), %rcx
leaq 0x10(%rsp), %r8
leaq 0x18(%rsp), %r9
xorl %eax, %eax
callq 0x20a0
cmpl $0x4, %eax
jge 0x940e
movq 0x91d5(%rip), %rdx      # 0x125c8
movq %r12, %rdi
leaq 0x4109(%rip), %rsi      # 0xd506
xorl %eax, %eax
callq 0x2190
callq 0x399b
jmp 0x9388
movq 0x956b(%rip), %rax      # 0x12980
xorl %ecx, %ecx
movapd 0x1e21(%rip), %xmm2     # 0xb240
movsd 0x1be1(%rip), %xmm3     # 0xb008
cmpq $0x4, %rcx
je 0x9487
movsd (%rsp,%rcx,8), %xmm0
movapd %xmm0, %xmm1
andpd %xmm2, %xmm1
ucomisd %xmm3, %xmm1
ja 0x944b
movsd %xmm0, 0x40(%rax,%rcx,8)
incq %rcx
jmp 0x9427
movq 0x9176(%rip), %rdx      # 0x125c8
movq %r12, %rdi
leaq 0x40e2(%rip), %rsi      # 0xd53e
xorl %eax, %eax
callq 0x2190
callq 0x399b
movq 0x9579(%rip), %rdi      # 0x129e8
leaq 0x4103(%rip), %rsi      # 0xd579
movl %ebp, %edx
callq 0x2200
callq 0x3933
jmp 0x9388
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq