// File: jkingan[P]ladyheather/heathgps.cpp
// Function: format_sat_state(int)
void format_sat_state(int state)
{
char fmt[SLEN+1];

   if(have_state == UBX_STATE) {  // ublox
      if     (state == 0) strcpy(fmt,  "  NO SIG  ");
      else if(state == 1) strcpy(fmt,  "  SEARCH  ");
      else if(state == 2) strcpy(fmt,  "  ACQUIRED");
      else if(state == 3) strcpy(fmt,  "  WEAK SIG");
      else if(state == 4) strcpy(fmt,  "  CODE LOK");
      else if(state == 5) strcpy(fmt,  "  CAR LOK5");
      else if(state == 6) strcpy(fmt,  "  CAR LOK6");
      else if(state == 7) strcpy(fmt,  "  CAR LOK7");
      else                sprintf(fmt, "  UNK:%-3d ", state);
      strcat(out, fmt);
   }
   else if(have_state == SIRF_STATE) {  // SIRF tracking flags
      sprintf(fmt, "   %04X  ", state);
      strcat(out, fmt);
   }
   else if(have_state == STAR_STATE) {
      if     (state == 0) strcpy(fmt, "  SEARCH  ");
      else if(state == 1) strcpy(fmt, "  ACQUIRE ");
      else if(state == 2) strcpy(fmt, "  AGC SET ");
      else if(state == 3) strcpy(fmt, "  PREQ ACQ");
      else if(state == 4) strcpy(fmt, "  BIT SYNC");
      else if(state == 5) strcpy(fmt, "  MSG SYNC");
      else if(state == 6) strcpy(fmt, "  TIME AVL");
      else if(state == 7) strcpy(fmt, "  EPH ACQ ");
      else if(state == 8) strcpy(fmt, "  TRACKING");
      else                strcpy(fmt, "  UNKNOWN ");
      strcat(out, fmt);
   }
   else if(have_state == MOTO_STATE) {
      if     (state == 0) strcpy(fmt, "  SEARCH  ");
      else if(state == 1) strcpy(fmt, "  CODE ACQ");
      else if(state == 2) strcpy(fmt, "  SET AGC ");
      else if(state == 3) strcpy(fmt, "  FREQ ACQ");
      else if(state == 4) strcpy(fmt, "  BIT SYNC");
      else if(state == 5) strcpy(fmt, "  MSG SYNC");
      else if(state == 6) strcpy(fmt, "  TIME ACQ");
      else if(state == 7) strcpy(fmt, "  EPH ACQ ");
      else if(state == 8) strcpy(fmt, "  TRACKING");
      else                strcpy(fmt, "  UNKNOWN ");
      strcat(out, fmt);
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movl %edi, -0x4(%rbp)
leaq 0x27b547(%rip), %rax    # 0x36c51c
cmpl $0x5, (%rax)
jne 0xf1100
cmpl $0x0, -0x4(%rbp)
jne 0xf0ffc
leaq -0x100(%rbp), %rdi
leaq 0x9939c(%rip), %rsi     # 0x18a38e
callq 0x9350
jmp 0xf10e8
cmpl $0x1, -0x4(%rbp)
jne 0xf101a
leaq -0x100(%rbp), %rdi
leaq 0x99389(%rip), %rsi     # 0x18a399
callq 0x9350
jmp 0xf10e6
cmpl $0x2, -0x4(%rbp)
jne 0xf1038
leaq -0x100(%rbp), %rdi
leaq 0x99376(%rip), %rsi     # 0x18a3a4
callq 0x9350
jmp 0xf10e4
cmpl $0x3, -0x4(%rbp)
jne 0xf1056
leaq -0x100(%rbp), %rdi
leaq 0x99363(%rip), %rsi     # 0x18a3af
callq 0x9350
jmp 0xf10e2
cmpl $0x4, -0x4(%rbp)
jne 0xf1071
leaq -0x100(%rbp), %rdi
leaq 0x99350(%rip), %rsi     # 0x18a3ba
callq 0x9350
jmp 0xf10e0
cmpl $0x5, -0x4(%rbp)
jne 0xf108c
leaq -0x100(%rbp), %rdi
leaq 0x99340(%rip), %rsi     # 0x18a3c5
callq 0x9350
jmp 0xf10de
cmpl $0x6, -0x4(%rbp)
jne 0xf10a7
leaq -0x100(%rbp), %rdi
leaq 0x99330(%rip), %rsi     # 0x18a3d0
callq 0x9350
jmp 0xf10dc
cmpl $0x7, -0x4(%rbp)
jne 0xf10c2
leaq -0x100(%rbp), %rdi
leaq 0x99320(%rip), %rsi     # 0x18a3db
callq 0x9350
jmp 0xf10da
leaq -0x100(%rbp), %rdi
movl -0x4(%rbp), %edx
leaq 0x99313(%rip), %rsi     # 0x18a3e6
movb $0x0, %al
callq 0x9060
jmp 0xf10dc
jmp 0xf10de
jmp 0xf10e0
jmp 0xf10e2
jmp 0xf10e4
jmp 0xf10e6
jmp 0xf10e8
leaq -0x100(%rbp), %rsi
leaq 0x2aa30a(%rip), %rdi    # 0x39b400
callq 0x96a0
jmp 0xf13d7
leaq 0x27b415(%rip), %rax    # 0x36c51c
cmpl $0x4, (%rax)
jne 0xf113c
leaq -0x100(%rbp), %rdi
movl -0x4(%rbp), %edx
leaq 0x992d5(%rip), %rsi     # 0x18a3f2
movb $0x0, %al
callq 0x9060
leaq -0x100(%rbp), %rsi
leaq 0x2aa2ce(%rip), %rdi    # 0x39b400
callq 0x96a0
jmp 0xf13d5
leaq 0x27b3d9(%rip), %rax    # 0x36c51c
cmpl $0x3, (%rax)
jne 0xf1289
cmpl $0x0, -0x4(%rbp)
jne 0xf116a
leaq -0x100(%rbp), %rdi
leaq 0x99239(%rip), %rsi     # 0x18a399
callq 0x9350
jmp 0xf1271
cmpl $0x1, -0x4(%rbp)
jne 0xf1188
leaq -0x100(%rbp), %rdi
leaq 0x9927e(%rip), %rsi     # 0x18a3fc
callq 0x9350
jmp 0xf126f
cmpl $0x2, -0x4(%rbp)
jne 0xf11a6
leaq -0x100(%rbp), %rdi
leaq 0x9926b(%rip), %rsi     # 0x18a407
callq 0x9350
jmp 0xf126d
cmpl $0x3, -0x4(%rbp)
jne 0xf11c4
leaq -0x100(%rbp), %rdi
leaq 0x99258(%rip), %rsi     # 0x18a412
callq 0x9350
jmp 0xf126b
cmpl $0x4, -0x4(%rbp)
jne 0xf11e2
leaq -0x100(%rbp), %rdi
leaq 0x99245(%rip), %rsi     # 0x18a41d
callq 0x9350
jmp 0xf1269
cmpl $0x5, -0x4(%rbp)
jne 0xf11fd
leaq -0x100(%rbp), %rdi
leaq 0x99232(%rip), %rsi     # 0x18a428
callq 0x9350
jmp 0xf1267
cmpl $0x6, -0x4(%rbp)
jne 0xf1218
leaq -0x100(%rbp), %rdi
leaq 0x99222(%rip), %rsi     # 0x18a433
callq 0x9350
jmp 0xf1265
cmpl $0x7, -0x4(%rbp)
jne 0xf1233
leaq -0x100(%rbp), %rdi
leaq 0x99212(%rip), %rsi     # 0x18a43e
callq 0x9350
jmp 0xf1263
cmpl $0x8, -0x4(%rbp)
jne 0xf124e
leaq -0x100(%rbp), %rdi
leaq 0x99202(%rip), %rsi     # 0x18a449
callq 0x9350
jmp 0xf1261
leaq -0x100(%rbp), %rdi
leaq 0x991f8(%rip), %rsi     # 0x18a454
callq 0x9350
jmp 0xf1263
jmp 0xf1265
jmp 0xf1267
jmp 0xf1269
jmp 0xf126b
jmp 0xf126d
jmp 0xf126f
jmp 0xf1271
leaq -0x100(%rbp), %rsi
leaq 0x2aa181(%rip), %rdi    # 0x39b400
callq 0x96a0
jmp 0xf13d3
leaq 0x27b28c(%rip), %rax    # 0x36c51c
cmpl $0x2, (%rax)
jne 0xf13d1
cmpl $0x0, -0x4(%rbp)
jne 0xf12b7
leaq -0x100(%rbp), %rdi
leaq 0x990ec(%rip), %rsi     # 0x18a399
callq 0x9350
jmp 0xf13be
cmpl $0x1, -0x4(%rbp)
jne 0xf12d5
leaq -0x100(%rbp), %rdi
leaq 0x99194(%rip), %rsi     # 0x18a45f
callq 0x9350
jmp 0xf13bc
cmpl $0x2, -0x4(%rbp)
jne 0xf12f3
leaq -0x100(%rbp), %rdi
leaq 0x99181(%rip), %rsi     # 0x18a46a
callq 0x9350
jmp 0xf13ba
cmpl $0x3, -0x4(%rbp)
jne 0xf1311
leaq -0x100(%rbp), %rdi
leaq 0x9916e(%rip), %rsi     # 0x18a475
callq 0x9350
jmp 0xf13b8
cmpl $0x4, -0x4(%rbp)
jne 0xf132f
leaq -0x100(%rbp), %rdi
leaq 0x990f8(%rip), %rsi     # 0x18a41d
callq 0x9350
jmp 0xf13b6
cmpl $0x5, -0x4(%rbp)
jne 0xf134a
leaq -0x100(%rbp), %rdi
leaq 0x990e5(%rip), %rsi     # 0x18a428
callq 0x9350
jmp 0xf13b4
cmpl $0x6, -0x4(%rbp)
jne 0xf1365
leaq -0x100(%rbp), %rdi
leaq 0x99122(%rip), %rsi     # 0x18a480
callq 0x9350
jmp 0xf13b2
cmpl $0x7, -0x4(%rbp)
jne 0xf1380
leaq -0x100(%rbp), %rdi
leaq 0x990c5(%rip), %rsi     # 0x18a43e
callq 0x9350
jmp 0xf13b0
cmpl $0x8, -0x4(%rbp)
jne 0xf139b
leaq -0x100(%rbp), %rdi
leaq 0x990b5(%rip), %rsi     # 0x18a449
callq 0x9350
jmp 0xf13ae
leaq -0x100(%rbp), %rdi
leaq 0x990ab(%rip), %rsi     # 0x18a454
callq 0x9350
jmp 0xf13b0
jmp 0xf13b2
jmp 0xf13b4
jmp 0xf13b6
jmp 0xf13b8
jmp 0xf13ba
jmp 0xf13bc
jmp 0xf13be
leaq -0x100(%rbp), %rsi
leaq 0x2aa034(%rip), %rdi    # 0x39b400
callq 0x96a0
jmp 0xf13d3
jmp 0xf13d5
jmp 0xf13d7
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq