// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathgps.cpp
// Function: show_x72_status(int, int, int)
int show_x72_status(int row,int col, int max_row)
{
int color;

   if(have_x72_creg) {
      if(x72_creg & 0x0008) vidstr(row,col, YELLOW, "PPS OUT: OFF  ");
      else                  vidstr(row,col, GREEN,  "PPS OUT: ON   ");
      if(++row > max_row) return row;

      if(x72_fw_discipline()) {
         if((last_x72_dmode != 1) && (last_x72_dmode != 2)) {
            vidstr(row,col, GREEN, "PPS IN:  UNKN ");
         }
         else if(x72_creg & 0x1000) {  // PPS input detected - fw discipline units only
            vidstr(row,col, GREEN,  "PPS IN:  SEEN ");
         }
         else {
            vidstr(row,col, YELLOW, "PPS IN:  NONE ");
         }
         if(++row > max_row) return row;

         if(user_set_x72_dmode && last_x72_dmode && (last_x72_dmode != 3)) {
            if(x72_creg & 0x0800) {  // PPS out locked to PPS in - fw discipline units only
               vidstr(row,col, GREEN,  "PPS OUT: LOCKED");
            }
            else if(x72_creg & 0x1000) {  // PPS input detected - fw discipline units only
               vidstr(row,col, YELLOW, "PPS OUT: UNLOCK");
            }
            else {
               vidstr(row,col, GREEN,  "PPS OUT: UNLOCK");
            }
            if(++row > max_row) return row;
         }
         else {
            vidstr(row,col, GREEN,  "PPS OUT: UNKN  ");
            if(++row > max_row) return row;
         }
      }

      if(x72_creg & 0x0004) vidstr(row,col, YELLOW, "FXO OUT: OFF  ");
      else                  vidstr(row,col, GREEN,  "FXO OUT: ON   ");
      if(++row > max_row) return row;

      if(x72_creg & 0x0010) vidstr(row,col, YELLOW, "ACMOS:   OFF  ");
      else                  vidstr(row,col, GREEN,  "ACMOS:   ON   ");
      if(++row > max_row) return row;

      if(x72_sine_level == 0) {
         vidstr(row,col, YELLOW, "Sine:    OFF  ");
      }
      else {
         sprintf(out,            "Sine ON: %d%%  ", x72_sine_level);
         vidstr(row,col, GREEN,  out);
      }
      if(++row > max_row) return row;


      if(x72_creg & 0x0002) vidstr(row,col, RED,    "Rb lock: OFF  ");
      else                  vidstr(row,col, GREEN,  "Rb lock: OK   ");
      if(++row > max_row) return row;

      if(x72_creg & 0x0400) vidstr(row,col, RED,    "Service: FAULT");
      else                  vidstr(row,col, GREEN,  "Service: OK   ");
      if(++row > max_row) return row;

      if(have_x72_srvc) {
         if(x72_srvc) vidstr(row,col, GREEN,  "SVC pol: HIGH ");
         else         vidstr(row,col, GREEN,  "SVC pol: LOW  ");
         if(++row > max_row) return row;
      }
      else {
         vidstr(row,col, GREEN,  "SVC pol: UNKN ");
         if(++row > max_row) return row;
      }

      if(x72_creg & 0x2000) {
         vidstr(row,col, GREEN,  "EFC INP: ON   ");
         if(++row > max_row) return row;
      }
      else if(have_x72_efc) {
         if(x72_efc) vidstr(row,col, GREEN,  "EFC inp: ON   ");
         else        vidstr(row,col, GREEN,  "EFC inp: OFF  ");
         if(++row > max_row) return row;
      }
      else {
         vidstr(row,col, GREEN,  "EFC inp: UNKN ");
         if(++row > max_row) return row;
      }

      if(have_x72_state) {
         color = YELLOW;
         if(x72_state == X72_STATE_DISCIPLINE) color = GREEN;
         else if(x72_state == X72_STATE_PIDCALC) color = GREEN;
         else if(x72_state == X72_STATE_PIDUPDATE) color = GREEN;
         else if(x72_state == X72_STATE_START0) color = GREEN;

         sprintf(out, "D State: %-3d  ", x72_state);
         if(color != GREEN)    vidstr(row,col, color, out);
         else if(x72_user_dis) vidstr(row,col, OSC_PID_COLOR, out);
         else                  vidstr(row,col, color,  out);
         if(++row > max_row) return row;
      }
      else {
         sprintf(out, "D State: UNKN ");
         vidstr(row,col, GREEN,  out);
         if(++row > max_row) return row;
      }


      if(x72_creg & 0x0001) vidstr(row,col, YELLOW, "L boost: ON   ");
      else                  vidstr(row,col, GREEN,  "L boost: OFF  ");
      if(++row > max_row) return row;

      if(x72_creg & 0x0020) vidstr(row,col, YELLOW, "C boost: ON   ");
      else                  vidstr(row,col, GREEN,  "C boost: OFF  ");
      if(++row > max_row) return row;
   }

   return row;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %r15d
leaq 0x163bad(%rip), %rax    # 0x21ac70
cmpl $0x0, (%rax)
je 0xb7521
movl %edx, %r14d
movl %esi, %ebx
leaq 0x163d00(%rip), %r13    # 0x21add8
testb $0x8, (%r13)
jne 0xb70f2
leaq 0x71c95(%rip), %rcx     # 0x128d7b
movl %r15d, %edi
movl %ebx, %esi
movl $0xa, %edx
jmp 0xb7103
leaq 0x71c73(%rip), %rcx     # 0x128d6c
movl %r15d, %edi
movl %ebx, %esi
movl $0xe, %edx
callq 0xe787
leal 0x1(%r15), %r12d
cmpl %r14d, %r15d
jge 0xb751e
callq 0x6cbe4
testl %eax, %eax
je 0xb7213
leaq 0x163df7(%rip), %r13    # 0x21af20
movl (%r13), %eax
addl $-0x3, %eax
cmpl $-0x3, %eax
ja 0xb713e
leaq 0x71c4e(%rip), %rcx     # 0x128d8a
jmp 0xb7165
leaq 0x163c93(%rip), %rax    # 0x21add8
testb $0x10, 0x1(%rax)
jne 0xb715e
leaq 0x71c56(%rip), %rcx     # 0x128da8
movl %r12d, %edi
movl %ebx, %esi
movl $0xe, %edx
jmp 0xb716f
leaq 0x71c34(%rip), %rcx     # 0x128d99
movl %r12d, %edi
movl %ebx, %esi
movl $0xa, %edx
callq 0xe787
leal 0x2(%r15), %edi
cmpl %r14d, %edi
jle 0xb7185
movl %edi, %r15d
jmp 0xb7521
leaq 0x163d78(%rip), %rax    # 0x21af04
cmpl $0x0, (%rax)
je 0xb71c5
movl (%r13), %eax
testl %eax, %eax
je 0xb71c5
cmpl $0x3, %eax
je 0xb71c5
leaq 0x163c33(%rip), %r13    # 0x21add8
movl (%r13), %eax
btl $0xb, %eax
jb 0xb71f0
leaq 0x71c11(%rip), %rcx     # 0x128dc7
btl $0xc, %eax
jae 0xb71f7
movl %ebx, %esi
movl $0xe, %edx
jmp 0xb71fe
leaq 0x71c0b(%rip), %rcx     # 0x128dd7
movl %ebx, %esi
movl $0xa, %edx
callq 0xe787
addl $0x3, %r15d
movl %r15d, %r12d
cmpl %r14d, %r15d
leaq 0x163bef(%rip), %r13    # 0x21add8
jle 0xb7213
jmp 0xb7521
leaq 0x71bc0(%rip), %rcx     # 0x128db7
movl %ebx, %esi
movl $0xa, %edx
callq 0xe787
addl $0x3, %r15d
movl %r15d, %r12d
cmpl %r14d, %r15d
jg 0xb7521
testb $0x4, (%r13)
jne 0xb722d
leaq 0x71bd5(%rip), %rcx     # 0x128df6
movl %r12d, %edi
movl %ebx, %esi
movl $0xa, %edx
jmp 0xb723e
leaq 0x71bb3(%rip), %rcx     # 0x128de7
movl %r12d, %edi
movl %ebx, %esi
movl $0xe, %edx
callq 0xe787
leal 0x1(%r12), %r15d
cmpl %r14d, %r12d
jge 0xb7521
testb $0x10, (%r13)
jne 0xb726b
leaq 0x71bb5(%rip), %rcx     # 0x128e14
movl %r15d, %edi
movl %ebx, %esi
movl $0xa, %edx
jmp 0xb727c
leaq 0x71b93(%rip), %rcx     # 0x128e05
movl %r15d, %edi
movl %ebx, %esi
movl $0xe, %edx
callq 0xe787
leal 0x2(%r12), %r15d
cmpl %r14d, %r15d
jg 0xb7521
leaq 0x163b62(%rip), %rax    # 0x21adf8
movl (%rax), %edx
testl %edx, %edx
je 0xb72c4
leaq 0x284f7d(%rip), %rdi    # 0x33c220
leaq 0x71b88(%rip), %rsi     # 0x128e32
xorl %eax, %eax
callq 0x9060
movl %r15d, %edi
movl %ebx, %esi
movl $0xa, %edx
leaq 0x284f5e(%rip), %rcx    # 0x33c220
jmp 0xb72d5
leaq 0x71b58(%rip), %rcx     # 0x128e23
movl %r15d, %edi
movl %ebx, %esi
movl $0xe, %edx
callq 0xe787
leal 0x3(%r12), %r15d
cmpl %r14d, %r15d
jg 0xb7521
testb $0x2, (%r13)
jne 0xb7302
leaq 0x71b5b(%rip), %rcx     # 0x128e51
movl %r15d, %edi
movl %ebx, %esi
movl $0xa, %edx
jmp 0xb7313
leaq 0x71b39(%rip), %rcx     # 0x128e42
movl %r15d, %edi
movl %ebx, %esi
movl $0xc, %edx
callq 0xe787
leal 0x4(%r12), %r15d
cmpl %r14d, %r15d
jg 0xb7521
testb $0x4, 0x1(%r13)
jne 0xb7340
leaq 0x71b3b(%rip), %rcx     # 0x128e6f
movl %r15d, %edi
movl %ebx, %esi
movl $0xa, %edx
jmp 0xb7351
leaq 0x71b19(%rip), %rcx     # 0x128e60
movl %r15d, %edi
movl %ebx, %esi
movl $0xc, %edx
callq 0xe787
leal 0x5(%r12), %r15d
cmpl %r14d, %r15d
jg 0xb7521
leaq 0x16399d(%rip), %rax    # 0x21ad08
cmpl $0x0, (%rax)
je 0xb738e
leaq 0x1639c5(%rip), %rax    # 0x21ad3c
cmpl $0x0, (%rax)
leaq 0x71b0c(%rip), %rax     # 0x128e8d
leaq 0x71af6(%rip), %rcx     # 0x128e7e
cmoveq %rax, %rcx
jmp 0xb7395
leaq 0x71b07(%rip), %rcx     # 0x128e9c
movl %r15d, %edi
movl %ebx, %esi
movl $0xa, %edx
callq 0xe787
addl $0x6, %r12d
movl %r12d, %r15d
cmpl %r14d, %r12d
jg 0xb7521
testb $0x20, 0x1(%r13)
jne 0xb73e5
leaq 0x163942(%rip), %rax    # 0x21ad04
cmpl $0x0, (%rax)
je 0xb73ee
leaq 0x16396a(%rip), %rax    # 0x21ad38
cmpl $0x0, (%rax)
leaq 0x71af1(%rip), %rax     # 0x128ec9
leaq 0x71adb(%rip), %rcx     # 0x128eba
cmoveq %rax, %rcx
jmp 0xb73f5
leaq 0x71abf(%rip), %rcx     # 0x128eab
jmp 0xb73f5
leaq 0x71ae3(%rip), %rcx     # 0x128ed8
movl %r12d, %edi
movl %ebx, %esi
movl $0xa, %edx
callq 0xe787
leal 0x1(%r12), %r15d
cmpl %r14d, %r12d
jge 0xb7521
leaq 0x1638bb(%rip), %rax    # 0x21acd4
cmpl $0x0, (%rax)
je 0xb7473
leaq 0x1639db(%rip), %rax    # 0x21ae00
movl (%rax), %edx
cmpl $0x8, %edx
ja 0xb7533
movl $0x1c1, %eax            # imm = 0x1C1
btl %edx, %eax
jae 0xb7533
leaq 0x284ddb(%rip), %rdi    # 0x33c220
leaq 0x71a9b(%rip), %rsi     # 0x128ee7
xorl %eax, %eax
callq 0x9060
leaq 0x163a96(%rip), %rax    # 0x21aef0
cmpl $0x0, (%rax)
sete %al
xorb $0xb, %al
movzbl %al, %edx
leaq 0x284db4(%rip), %rcx    # 0x33c220
movl %r15d, %edi
movl %ebx, %esi
jmp 0xb749f
leaq 0x284da6(%rip), %rcx    # 0x33c220
movabsq $0x204e4b4e55203a, %rax # imm = 0x204E4B4E55203A
movq %rax, 0x7(%rcx)
movabsq $0x3a65746174532044, %rax # imm = 0x3A65746174532044
movq %rax, (%rcx)
movl %r15d, %edi
movl %ebx, %esi
movl $0xa, %edx
callq 0xe787
leal 0x1(%r15), %r12d
cmpl %r14d, %r15d
movl %r12d, %r15d
jge 0xb7521
testb $0x1, (%r13)
jne 0xb74ca
leaq 0x71a57(%rip), %rcx     # 0x128f15
movl %r12d, %edi
movl %ebx, %esi
movl $0xa, %edx
jmp 0xb74db
leaq 0x71a35(%rip), %rcx     # 0x128f06
movl %r12d, %edi
movl %ebx, %esi
movl $0xe, %edx
callq 0xe787
leal 0x1(%r12), %r15d
cmpl %r14d, %r12d
jge 0xb7521
testb $0x20, (%r13)
jne 0xb7504
leaq 0x71a3b(%rip), %rcx     # 0x128f33
movl %r15d, %edi
movl %ebx, %esi
movl $0xa, %edx
jmp 0xb7515
leaq 0x71a19(%rip), %rcx     # 0x128f24
movl %r15d, %edi
movl %ebx, %esi
movl $0xe, %edx
callq 0xe787
addl $0x2, %r12d
movl %r12d, %r15d
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x284ce6(%rip), %rdi    # 0x33c220
leaq 0x719a6(%rip), %rsi     # 0x128ee7
xorl %eax, %eax
callq 0x9060
movb $0xe, %al
jmp 0xb7462