// File: /workspace/github_c_makefile_star2_O1/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 0x93c3(%rip), %rax      # 0x13990
movsd (%rax), %xmm0
leaq 0x8ed8(%rip), %rbx      # 0x134b0
leaq 0x4d19(%rip), %rsi      # 0xf2f8
movq %rbx, %rdi
movb $0x1, %al
callq 0x21a0
movq 0x9408(%rip), %rdi      # 0x139f8
movq %rbx, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
callq 0x3c58
movq 0x93ef(%rip), %rdi      # 0x139f8
leaq 0x4d0a(%rip), %rsi      # 0xf31a
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
callq 0x3c58
movq 0x936a(%rip), %rax      # 0x13990
movsd 0x80(%rax), %xmm0
movsd 0x88(%rax), %xmm1
movsd 0x90(%rax), %xmm2
movsd 0x98(%rax), %xmm3
leaq 0x4cf3(%rip), %rsi      # 0xf340
movq %rbx, %rdi
movb $0x4, %al
callq 0x21a0
movq 0x939a(%rip), %rdi      # 0x139f8
movq %rbx, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
callq 0x3c58
leaq 0x10(%rsp), %r15
leaq 0x18(%rsp), %r12
leaq 0x4cee(%rip), %r13      # 0xf36f
leaq 0x4d04(%rip), %rbp      # 0xf38c
movq %rsp, %r14
callq 0x3c58
movq 0x8f31(%rip), %rdx      # 0x135c8
movq %rbx, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x21a0
movq 0x934d(%rip), %rdi      # 0x139f8
movq %rbx, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq 0x9339(%rip), %rdi      # 0x139f8
movq %rbx, %rsi
movl $0x1, %edx
callq 0x249f
movq %rbx, %rdi
movq %rbp, %rsi
movq %r14, %rdx
leaq 0x8(%rsp), %rcx
movq %r15, %r8
movq %r12, %r9
xorl %eax, %eax
callq 0x20b0
cmpl $0x4, %eax
jge 0xa6ff
movq 0x8ee5(%rip), %rdx      # 0x135d8
movq %rbx, %rdi
leaq 0x4caf(%rip), %rsi      # 0xf3ac
jmp 0xa77b
movq 0x928a(%rip), %rax      # 0x13990
xorl %ecx, %ecx
xorpd %xmm1, %xmm1
movsd 0x294c(%rip), %xmm2     # 0xd060
movsd (%rsp,%rcx,8), %xmm0
ucomisd %xmm0, %xmm1
ja 0xa739
ucomisd %xmm2, %xmm0
ja 0xa739
movsd %xmm0, 0x80(%rax,%rcx,8)
incq %rcx
cmpq $0x4, %rcx
jne 0xa714
jmp 0xa7a0
movq 0x8e98(%rip), %rdx      # 0x135d8
movq %rbx, %rdi
leaq 0x4c9a(%rip), %rsi      # 0xf3e4
xorl %eax, %eax
callq 0x21a0
movq 0x92a0(%rip), %rdi      # 0x139f8
movq %rbx, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
callq 0x3c58
movq 0x8e57(%rip), %rdx      # 0x135c8
movq %rbx, %rdi
leaq 0x4ca7(%rip), %rsi      # 0xf422
xorl %eax, %eax
callq 0x21a0
movq 0x926f(%rip), %rdi      # 0x139f8
movq %rbx, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
callq 0x3c58
jmp 0xa68b
movq 0x9251(%rip), %rdi      # 0x139f8
leaq 0x4c94(%rip), %rsi      # 0xf442
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
callq 0x3c58
movq 0x91cc(%rip), %rax      # 0x13990
movsd 0x40(%rax), %xmm0
movsd 0x48(%rax), %xmm1
movsd 0x50(%rax), %xmm2
movsd 0x58(%rax), %xmm3
leaq 0x4c97(%rip), %rsi      # 0xf476
movq %rbx, %rdi
movb $0x4, %al
callq 0x21a0
leaq 0x4cb4(%rip), %r14      # 0xf4a4
leaq 0x4b95(%rip), %r13      # 0xf38c
movq %rsp, %rbp
movq %rbx, %rsi
movq 0x91f4(%rip), %rdi      # 0x139f8
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
callq 0x3c58
callq 0x3c58
movq 0x8da9(%rip), %rdx      # 0x135c8
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x21a0
movq 0x91c5(%rip), %rdi      # 0x139f8
movq %rbx, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq 0x91b1(%rip), %rdi      # 0x139f8
movq %rbx, %rsi
movl $0x1, %edx
callq 0x249f
callq 0x3c58
movq %rbx, %rdi
movq %r13, %rsi
movq %rbp, %rdx
leaq 0x8(%rsp), %rcx
movq %r15, %r8
movq %r12, %r9
xorl %eax, %eax
callq 0x20b0
cmpl $0x4, %eax
jl 0xa8f3
movq 0x9110(%rip), %rax      # 0x13990
xorl %ecx, %ecx
movapd 0x2986(%rip), %xmm2     # 0xd210
movsd 0x2776(%rip), %xmm3     # 0xd008
movsd (%rsp,%rcx,8), %xmm0
movapd %xmm0, %xmm1
andpd %xmm2, %xmm1
ucomisd %xmm3, %xmm1
ja 0xa8b6
movsd %xmm0, 0x40(%rax,%rcx,8)
incq %rcx
cmpq $0x4, %rcx
jne 0xa892
jmp 0xa910
movq 0x8d1b(%rip), %rdx      # 0x135d8
movq %rbx, %rdi
leaq 0x4c37(%rip), %rsi      # 0xf4fe
xorl %eax, %eax
callq 0x21a0
movq 0x9123(%rip), %rdi      # 0x139f8
movq %rbx, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
callq 0x3c58
leaq 0x4c4b(%rip), %rsi      # 0xf539
jmp 0xa7fd
movq 0x8cde(%rip), %rdx      # 0x135d8
movq %rbx, %rdi
leaq 0x4bc2(%rip), %rsi      # 0xf4c6
xorl %eax, %eax
callq 0x21a0
jmp 0xa7fa
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq