// File: /workspace/github_c_makefile_star2_O2/hyc[P]trek73c/trekx.c
// Function: Tstts
void Tstts()
{
  Digs temp;
  int i, shp, bad;
  boolean ok, Ship;
  Char *Junk;
  double B;
  boolean Stat[6];
  reg Srec *WITH;

  TCount = (-1);
  werase(Scnwin);
  mvwaddstr(Scnwin, 0, 0, " Tubes   Control  Turned  Levels");
  WITH = Ships[0];
  for (i = 0; i < Tubes; i++) {
    sprintf(scrstr,"%4d", i+1);
    mvwaddstr(Scnwin,i+1,0,scrstr);
    if (WITH->Tstat[i] < 0)
      waddstr(Scnwin,"     Damaged  ");
    else if (WITH->Tstat[i] < 1)
      waddstr(Scnwin,"      Manual  ");
    else {
      Junk = Snams[WITH->Tstat[i] - 1];
      shp = strlen(Junk) / 2 + 9;
      sprintf(scrstr,"%*s%*s", shp, Junk, 14 - shp, "");
      waddstr(Scnwin,scrstr);
    }
    if (WITH->Tstat[i] < 0)
      waddstr(Scnwin,"  --      --");
    else {
      sprintf(scrstr,"%4ld%8d",
	     (long)floor(WITH->TDepl[i] + 0.5), WITH->Tengy[i]);
      waddstr(Scnwin,scrstr);
    }
  }
  sprintf(scrstr,"Launch speed: %d", Ships[0]->Tstat[6]);
  mvwaddstr(Scnwin,Tubes+2,0,scrstr);
  sprintf(scrstr,"  Time delay: %d", Ships[0]->Tstat[7]);
  mvwaddstr(Scnwin,Tubes+3,0,scrstr);
  sprintf(scrstr,"  Prox delay: %d", Ships[0]->Tstat[8]);
  mvwaddstr(Scnwin,Tubes+4,0,scrstr);
  wrefresh(Scnwin);
  waddstr(Cmdwin,"   Lock Tubes [1-6] ");
  Indigits(temp);
  bad = 0;
  for (i = 0; i <= 5; 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 <= 5; i++) {
	if (temp[i] > 0 && temp[i] < 7) {
	  if (WITH->Tstat[temp[i] - 1] < 0 || !ok) {
	    bad++;
	    Stat[temp[i] - 1] = true;
	  } else {
	    WITH->Tstat[temp[i] - 1] = shp + 1;
	    WITH->TDepl[temp[i] - 1] = B;
	  }
	}
      }
    } else {
      for (i = 0; i <= 5; i++) {
	if (temp[i] > 0 && temp[i] < 7) {
	  if (WITH->Tstat[temp[i] - 1] >= 0) {
	    WITH->TDepl[temp[i] - 1] = shp % 360;
	    WITH->Tstat[temp[i] - 1] = 0;
	  }
	}
      }
    }
  }
  if (bad <= 0)
    return;
  waddstr(Cmdwin,"Computer: Tube");
  if (bad > 1)
    waddch(Cmdwin,'s');
  for (i = 0; i < Tubes; 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, 0x9d02(%rip)     # 0x12a28
movq 0x9cd3(%rip), %rdi      # 0x12a00
callq 0x2080
movq 0x9cc7(%rip), %rdi      # 0x12a00
xorl %esi, %esi
xorl %edx, %edx
callq 0x21d0
cmpl $-0x1, %eax
je 0x8d5d
movq 0x9cb2(%rip), %rdi      # 0x12a00
leaq 0x4572(%rip), %rsi      # 0xd2c7
pushq $-0x1
popq %rdx
callq 0x2200
movq 0x9c1c(%rip), %r13      # 0x12980
leaq 0x9735(%rip), %rbx      # 0x124a0
pushq $-0x1
popq %rbp
leaq 0x44e8(%rip), %r14      # 0xd25d
xorl %r15d, %r15d
movzbl 0x9432(%rip), %eax      # 0x121b1
cmpq %rax, %r15
jae 0x8e94
leal 0x1(%r15), %r12d
movq %rbx, %rdi
leaq 0x39a1(%rip), %rsi      # 0xc737
movl %r12d, %edx
xorl %eax, %eax
callq 0x2190
movq 0x9c59(%rip), %rdi      # 0x12a00
movl %r12d, %esi
xorl %edx, %edx
callq 0x21d0
cmpl $-0x1, %eax
je 0x8dc7
movq 0x9c43(%rip), %rdi      # 0x12a00
movq %rbx, %rsi
movl %ebp, %edx
callq 0x2200
movzwl 0x110(%r13,%r15,2), %eax
leaq 0x4468(%rip), %rsi      # 0xd23f
testw %ax, %ax
js 0x8e28
leaq 0x446b(%rip), %rsi      # 0xd24e
je 0x8e28
decl %eax
movzwl %ax, %eax
leaq 0x9b2f(%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 0x39cf(%rip), %rsi      # 0xc7e3
movq %r12, %rcx
leaq 0x2e54(%rip), %r9       # 0xbc72
xorl %eax, %eax
callq 0x2190
movq %rbx, %rsi
movq 0x9bd1(%rip), %rdi      # 0x12a00
movl %ebp, %edx
callq 0x2200
cmpw $0x0, 0x110(%r13,%r15,2)
movq %r14, %rsi
js 0x8e7e
movsd 0xe0(%r13,%r15,8), %xmm0
addsd 0x21f1(%rip), %xmm0     # 0xb048
callq 0x22c0
cvttsd2si %xmm0, %rdx
movswl 0xc6(%r13,%r15,2), %ecx
movq %rbx, %rdi
leaq 0x4474(%rip), %rsi      # 0xd2e8
xorl %eax, %eax
callq 0x2190
movq %rbx, %rsi
movq 0x9b7b(%rip), %rdi      # 0x12a00
movl %ebp, %edx
callq 0x2200
incq %r15
jmp 0x8d78
movq 0x9ae5(%rip), %rax      # 0x12980
movswl 0x11c(%rax), %edx
leaq 0x95f7(%rip), %rdi      # 0x124a0
leaq 0x4440(%rip), %rsi      # 0xd2f0
xorl %eax, %eax
callq 0x2190
movq 0x9b42(%rip), %rdi      # 0x12a00
movzbl 0x92ec(%rip), %esi      # 0x121b1
addl $0x2, %esi
xorl %edx, %edx
callq 0x21d0
cmpl $-0x1, %eax
je 0x8eea
movq 0x9b25(%rip), %rdi      # 0x12a00
leaq 0x95be(%rip), %rsi      # 0x124a0
pushq $-0x1
popq %rdx
callq 0x2200
movq 0x9a8f(%rip), %rax      # 0x12980
movswl 0x11e(%rax), %edx
leaq 0x95a1(%rip), %rdi      # 0x124a0
leaq 0x43fb(%rip), %rsi      # 0xd301
xorl %eax, %eax
callq 0x2190
movq 0x9aec(%rip), %rdi      # 0x12a00
movzbl 0x9296(%rip), %esi      # 0x121b1
addl $0x3, %esi
xorl %edx, %edx
callq 0x21d0
cmpl $-0x1, %eax
je 0x8f40
movq 0x9acf(%rip), %rdi      # 0x12a00
leaq 0x9568(%rip), %rsi      # 0x124a0
pushq $-0x1
popq %rdx
callq 0x2200
movq 0x9a39(%rip), %rax      # 0x12980
movswl 0x120(%rax), %edx
leaq 0x954b(%rip), %rdi      # 0x124a0
leaq 0x43b6(%rip), %rsi      # 0xd312
xorl %eax, %eax
callq 0x2190
movq 0x9a96(%rip), %rdi      # 0x12a00
movzbl 0x9240(%rip), %esi      # 0x121b1
addl $0x4, %esi
xorl %edx, %edx
callq 0x21d0
cmpl $-0x1, %eax
je 0x8f96
movq 0x9a79(%rip), %rdi      # 0x12a00
leaq 0x9512(%rip), %rsi      # 0x124a0
pushq $-0x1
popq %rdx
callq 0x2200
movq 0x9a63(%rip), %rdi      # 0x12a00
callq 0x2180
movq 0x9a3f(%rip), %rdi      # 0x129e8
leaq 0x4373(%rip), %rsi      # 0xd323
pushq $-0x1
popq %rdx
callq 0x2200
leaq 0x10(%rsp), %rdi
callq 0x6cd8
xorl %eax, %eax
cmpq $0x6, %rax
je 0x8fd4
movb $0x0, 0xa(%rsp,%rax)
incq %rax
jmp 0x8fc4
cmpl $0x0, 0x10(%rsp)
jle 0x9181
incl 0x9a43(%rip)            # 0x12a28
movq 0x99fc(%rip), %rdi      # 0x129e8
leaq 0x42bc(%rip), %rsi      # 0xd2af
pushq $-0x1
popq %rdx
callq 0x2200
leaq 0x8(%rsp), %rdi
leaq 0x9(%rsp), %r14
movq %r14, %rsi
callq 0x702f
movl %eax, %ebx
movq 0x996a(%rip), %r15      # 0x12980
cmpb $0x0, (%r14)
je 0x9139
xorl %r14d, %r14d
xorl %edi, %edi
movl %ebx, %esi
callq 0x3a49
movq 0x95ad(%rip), %rax      # 0x125e0
subsd 0x10(%rax), %xmm0
callq 0x39cd
movb 0x8(%rsp), %al
incl %ebx
xorl %ebp, %ebp
cmpq $0x6, %r14
je 0x908a
movl 0x10(%rsp,%r14,4), %ecx
decl %ecx
cmpl $0x5, %ecx
ja 0x9085
movl %ecx, %ecx
cmpw $0x0, 0x110(%r15,%rcx,2)
js 0x907e
testb %al, %al
je 0x907e
movw %bx, 0x110(%r15,%rcx,2)
movsd %xmm0, 0xe0(%r15,%rcx,8)
jmp 0x9085
incl %ebp
movb $0x1, 0xa(%rsp,%rcx)
incq %r14
jmp 0x9045
testl %ebp, %ebp
jle 0x9181
movq 0x994f(%rip), %rdi      # 0x129e8
leaq 0x37bd(%rip), %rsi      # 0xc85d
pushq $-0x1
popq %rdx
callq 0x2200
cmpl $0x1, %ebp
je 0x90bc
movq 0x9934(%rip), %rdi      # 0x129e8
pushq $0x73
popq %rsi
callq 0x2150
leaq 0x93dd(%rip), %rbx      # 0x124a0
leaq 0x3768(%rip), %r14      # 0xc832
pushq $-0x1
popq %rbp
xorl %r15d, %r15d
movzbl 0x90da(%rip), %eax      # 0x121b1
movq %r15, %rcx
cmpq %rax, %rcx
jae 0x9110
leaq 0x1(%rcx), %r15
cmpb $0x0, 0xa(%rsp,%rcx)
movq %r15, %rcx
je 0x90da
movq %rbx, %rdi
movq %r14, %rsi
movl %r15d, %edx
xorl %eax, %eax
callq 0x2190
movq 0x98e4(%rip), %rdi      # 0x129e8
movq %rbx, %rsi
movl %ebp, %edx
callq 0x2200
jmp 0x90d0
movq 0x98d1(%rip), %rdi      # 0x129e8
leaq 0x4198(%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 $0x6, %rax
je 0x9181
movl 0x10(%rsp,%rax,4), %ecx
decl %ecx
cmpl $0x5, %ecx
ja 0x917c
movl %ecx, %ecx
cmpw $0x0, 0x110(%r15,%rcx,2)
js 0x917c
movsd %xmm0, 0xe0(%r15,%rcx,8)
andw $0x0, 0x110(%r15,%rcx,2)
incq %rax
jmp 0x9149
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq