// File: /workspace/github_c_makefile_star2_O2/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 0xade0(%rip), %rdi      # 0x129e8
leaq 0x4d98(%rip), %rsi      # 0xc9a7
pushq $-0x1
popq %rbp
movl %ebp, %edx
callq 0x2200
movq 0xadc8(%rip), %rdi      # 0x129e8
movl %ebp, %r14d
testq %rdi, %rdi
je 0x7c30
movswl (%rdi), %ebp
movswl 0x2(%rdi), %r14d
leaq 0xa869(%rip), %rbx      # 0x124a0
movq %rbx, %rsi
xorl %edx, %edx
callq 0x246d
callq 0x2100
movq (%rax), %rax
movsbq 0xa84f(%rip), %rcx      # 0x124a0
movb (%rax,%rcx,4), %al
movb %al, 0xa846(%rip)       # 0x124a0
movq 0xad87(%rip), %rdi      # 0x129e8
movl %ebp, %esi
movl %r14d, %edx
callq 0x21d0
movb 0xa82e(%rip), %r14b     # 0x124a0
cmpb $0x4c, %r14b
jne 0x7c81
leaq 0x4d3d(%rip), %rsi      # 0xc9bc
jmp 0x7c92
cmpb $0x55, %r14b
jne 0x7e63
leaq 0x4d2f(%rip), %rsi      # 0xc9c1
movq 0xad4f(%rip), %rdi      # 0x129e8
pushq $-0x1
popq %rbp
movl %ebp, %edx
callq 0x2200
movq 0xad3e(%rip), %rdi      # 0x129e8
leaq 0x4d17(%rip), %rsi      # 0xc9c8
movl %ebp, %edx
callq 0x2200
movq %rsp, %rdi
callq 0x6cd8
movq 0xacb9(%rip), %r15      # 0x12980
cmpb $0x4c, %r14b
jne 0x7d5f
movq 0xa908(%rip), %rax      # 0x125e0
movb 0xa8e2(%rip), %cl       # 0x125c0
xorl %edx, %edx
pushq $0xa
popq %rsi
cmpq $0x6, %rdx
je 0x7dbf
movl (%rsp,%rdx,4), %edi
decl %edi
cmpl $0x5, %edi
ja 0x7d5a
movl %edi, %edi
cmpw $0x0, 0x110(%r15,%rdi,2)
js 0x7d5a
movswl 0x11e(%r15), %r10d
movswl 0xc6(%r15,%rdi,2), %r9d
movl %esi, %r8d
subl %r9d, %r8d
cmpl %r10d, %r8d
cmovgel %r10d, %r8d
cvtsi2sd %r8d, %xmm1
movsd 0x20(%rax), %xmm0
ucomisd %xmm0, %xmm1
jbe 0x7d38
cvttsd2si %xmm0, %r8
addl %r8d, %r9d
cvtsi2sd %r8d, %xmm1
movw %r9w, 0xc6(%r15,%rdi,2)
subsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rax)
testb %cl, %cl
jne 0x7d5a
subb %r8b, 0x18(%r15)
incq %rdx
jmp 0x7ce3
movq 0xa87a(%rip), %rax      # 0x125e0
movb 0xa854(%rip), %cl       # 0x125c0
movsd 0x20(%rax), %xmm0
xorl %edx, %edx
cmpq $0x6, %rdx
je 0x7dba
movslq (%rsp,%rdx,4), %rsi
movswl 0xc4(%r15,%rsi,2), %edi
cvtsi2sd %edi, %xmm1
addsd %xmm1, %xmm0
testb %cl, %cl
je 0x7da7
movzbl 0x18(%r15), %edi
cvtsi2sd %edi, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x7dab
movapd %xmm1, %xmm0
jmp 0x7dab
addb %dil, 0x18(%r15)
andw $0x0, 0xc4(%r15,%rsi,2)
incq %rdx
jmp 0x7d73
movsd %xmm0, 0x20(%rax)
callq 0x3933
movq 0xac1d(%rip), %rdi      # 0x129e8
leaq 0x4c07(%rip), %rsi      # 0xc9d9
pushq $-0x1
popq %rbp
movl %ebp, %edx
callq 0x2200
pushq $-0xc
popq %r12
leaq 0x547e(%rip), %r13      # 0xd265
leaq 0x4949(%rip), %r14      # 0xc737
testq %r12, %r12
je 0x7e2f
cmpw $0x0, 0x11c(%r15,%r12)
movq %r13, %rsi
js 0x7e1b
movswl 0xd2(%r15,%r12), %edx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x2190
movq %rbx, %rsi
movq 0xabc6(%rip), %rdi      # 0x129e8
movl %ebp, %edx
callq 0x2200
addq $0x2, %r12
jmp 0x7dee
movq 0xa7aa(%rip), %rax      # 0x125e0
movsd 0x20(%rax), %xmm0
leaq 0xa65e(%rip), %rdi      # 0x124a0
leaq 0x4ba7(%rip), %rsi      # 0xc9f0
movb $0x1, %al
callq 0x2190
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x399b
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6b4c