// File: /workspace/github_c_makefile_star2_O3/hyc[P]trek73c/trekx.c
// Function: TLoad
void TLoad()
{
  int I, J, k, X, Y;
  Digs Temp;
  reg Srec *WITH;

  waddstr(Cmdwin,"   [Load or Unload] ");
  getyx(Cmdwin, Y, X);
  mygetstr(Cmdwin,scrstr,false);
  scrstr[0] = toupper(scrstr[0]);
  wmove(Cmdwin, Y, X);
  if (scrstr[0]=='L') {
	waddstr(Cmdwin,"Load");
	I = 0;
  } else if (scrstr[0]=='U') {
	waddstr(Cmdwin,"Unload");
	I = 1;
  } else {
	Whatt();
	return;
  }
  waddstr(Cmdwin,"\n   Tubes [1-6] ");
  Indigits(Temp);
  WITH = Ships[0];
  if (!I) {
    for (I = 0; I <= 5; I++) {
      if (Temp[I] > 0 && Temp[I] < 7) {
	if (WITH->Tstat[Temp[I] - 1] >= 0) {
	  J = WITH->Tstat[7];
	  k = 10 - WITH->Tengy[Temp[I] - 1];
	  if (J > k)
	    J = k;
	  if (J > Objects[0]->Fuel)
	    J = (long)Objects[0]->Fuel;
	  WITH->Tengy[Temp[I] - 1] += J;
	  Objects[0]->Fuel -= J;
	  if (!cheat)
	    WITH->Fcap -= J;
	}
      }
    }
  } else {
    for (I = 0; I <= 5; I++) {
      J = WITH->Tengy[Temp[I] - 1];
      Objects[0]->Fuel += J;
      if (!cheat)
      	WITH->Fcap += J;
      else
	if (Objects[0]->Fuel > WITH->Fcap)
	  Objects[0]->Fuel = WITH->Fcap;
      WITH->Tengy[Temp[I] - 1] = 0;
    }
  }
  Endln();
  waddstr(Cmdwin,"Scott: Tube units now ");
  for (I = 0; I <= 5; I++) {
    if (WITH->Tstat[I] < 0)
      waddstr(Cmdwin,"  --");
    else {
      sprintf(scrstr,"%4d", WITH->Tengy[I]);
      waddstr(Cmdwin,scrstr);
    }
  }
  sprintf(scrstr,"  Fuel @ %0.0f", Objects[0]->Fuel);
  SEndln();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq 0xacc5(%rip), %rdi      # 0x139f8
leaq 0x5ce5(%rip), %rsi      # 0xea1f
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq 0xaca8(%rip), %rdi      # 0x139f8
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x8d63
movswl (%rdi), %ebp
movswl 0x2(%rdi), %r14d
leaq 0xa746(%rip), %rbx      # 0x134b0
movq %rbx, %rsi
xorl %edx, %edx
callq 0x249f
callq 0x2110
movq (%rax), %rax
movsbq 0xa72c(%rip), %rcx      # 0x134b0
movb (%rax,%rcx,4), %al
movb %al, 0xa723(%rip)       # 0x134b0
movq 0xac64(%rip), %rdi      # 0x139f8
movl %ebp, %esi
movl %r14d, %edx
callq 0x21e0
movb 0xa70b(%rip), %bpl      # 0x134b0
cmpb $0x4c, %bpl
jne 0x8db4
leaq 0x5c82(%rip), %rsi      # 0xea34
jmp 0x8dc5
cmpb $0x55, %bpl
jne 0x8fb8
leaq 0x5c74(%rip), %rsi      # 0xea39
movq 0xac2c(%rip), %rdi      # 0x139f8
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq 0xac1b(%rip), %rdi      # 0x139f8
leaq 0x5c5c(%rip), %rsi      # 0xea40
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq %rsp, %rdi
callq 0x7d24
movq 0xab93(%rip), %r15      # 0x13990
cmpb $0x4c, %bpl
jne 0x8e94
movq 0xa7e2(%rip), %rax      # 0x135f0
movb 0xa7bc(%rip), %cl       # 0x135d0
xorl %edx, %edx
movl (%rsp,%rdx,4), %esi
decl %esi
cmpl $0x5, %esi
ja 0x8e89
movl %esi, %esi
cmpw $0x0, 0x110(%r15,%rsi,2)
js 0x8e89
movswl 0x11e(%r15), %r9d
movswl 0xc6(%r15,%rsi,2), %r8d
movl $0xa, %edi
subl %r8d, %edi
cmpl %r9d, %edi
cmovgel %r9d, %edi
xorps %xmm1, %xmm1
cvtsi2sd %edi, %xmm1
movsd 0x20(%rax), %xmm0
ucomisd %xmm0, %xmm1
jbe 0x8e65
cvttsd2si %xmm0, %rdi
addl %edi, %r8d
xorps %xmm1, %xmm1
cvtsi2sd %edi, %xmm1
movw %r8w, 0xc6(%r15,%rsi,2)
subsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rax)
testb %cl, %cl
jne 0x8e89
subb %dil, 0x18(%r15)
incq %rdx
cmpq $0x6, %rdx
jne 0x8e16
jmp 0x8efd
movq 0xa755(%rip), %rax      # 0x135f0
movb 0xa72f(%rip), %cl       # 0x135d0
movsd 0x20(%rax), %xmm0
xorl %edx, %edx
movapd %xmm0, %xmm1
movslq (%rsp,%rdx,4), %rsi
movswl 0xc4(%r15,%rsi,2), %edi
xorps %xmm0, %xmm0
cvtsi2sd %edi, %xmm0
addsd %xmm1, %xmm0
testb %cl, %cl
je 0x8ee0
movzbl 0x18(%r15), %edi
xorps %xmm1, %xmm1
cvtsi2sd %edi, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x8ee4
movapd %xmm1, %xmm0
jmp 0x8ee4
addb %dil, 0x18(%r15)
movw $0x0, 0xc4(%r15,%rsi,2)
incq %rdx
cmpq $0x6, %rdx
jne 0x8ea8
movsd %xmm0, 0x20(%rax)
callq 0x3d76
movq 0xaaef(%rip), %rdi      # 0x139f8
leaq 0x5b41(%rip), %rsi      # 0xea51
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
movq $-0x6, %r12
leaq 0x63b5(%rip), %r13      # 0xf2dd
leaq 0x5880(%rip), %r14      # 0xe7af
cmpw $0x0, 0x11c(%r15,%r12,2)
movq %r13, %rsi
js 0x8f57
movswl 0xd2(%r15,%r12,2), %edx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x21a0
movq %rbx, %rsi
movq 0xaa9a(%rip), %rdi      # 0x139f8
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
incq %r12
jne 0x8f2f
movq 0xa67c(%rip), %rax      # 0x135f0
movsd 0x20(%rax), %xmm0
leaq 0xa530(%rip), %rbx      # 0x134b0
leaq 0x5ae1(%rip), %rsi      # 0xea68
movq %rbx, %rdi
movb $0x1, %al
callq 0x21a0
movq 0xaa60(%rip), %rdi      # 0x139f8
movq %rbx, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2210
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3d76
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x7b73