// File: jkingan[P]ladyheather/heathgps.cpp
// Function: parse_gpsd_osc(char*)
void parse_gpsd_osc(char *s)
{
int saw_run;
int running;
int saw_ref;
int ref;
int saw_dis;
int dis;
int saw_pps;
double pps;

   // decode the OSC message - used to display GPSDO related info

   saw_run = saw_ref = saw_dis = saw_pps = 0;
   running = ref = dis = 0;
   pps = 0.0;
   saw_gpsdo = 1;
   while(s) {
      s = get_json_field(s);
      strcpy(gpsd_cmd, msg_field);
      if(gpsd_cmd[0] == 0) continue; 

      s = get_json_field(s);
log_gpsd_cmd();

      if(!strcmp(gpsd_cmd, "\"RUNNING\"")) {  // warming up
         if(!strcmp(msg_field, "TRUE")) {
            running = 1;
         }
         else {
            running = 0;
         }
         saw_run = 1;
      }
      else if(!strcmp(gpsd_cmd, "\"REFERENCE\"")) {   // pps active
         if(!strcmp(msg_field, "TRUE")) ref = 1;
         else                            ref = 0;
         saw_ref = 1;
      }
      else if(!strcmp(gpsd_cmd, "\"DISCIPLINED\"")) { // being disciplined
         if(!strcmp(msg_field, "TRUE")) dis = 1;
         else                            dis = 0;
         saw_dis = 1;
      }
      else if(!strcmp(gpsd_cmd, "\"DELTA\"")) {  // ns of err
         pps = atof(msg_field);
         osc_offset = pps;
         have_osc_offset = 8;
         have_rcvr_osc = 8;
// adadad         if(jitter_adev == 0) do_osc_adev(osc_offset);
         saw_pps = 1;
      }
   }

   if(saw_run && (running == 0))  discipline_mode = DIS_MODE_POWERUP;      // power up init
   else if(saw_dis && (dis == 0)) discipline_mode = DIS_MODE_MANUAL_HOLD;  // PPS OFF -> holdover
   else if(saw_ref && (ref == 0)) discipline_mode = DIS_MODE_RECOVERY;     // PPS OFF -> holdover
   else                           discipline_mode = DIS_MODE_NORMAL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0xc(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x10(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
leaq 0x19749c(%rip), %rax    # 0x27a218
movl $0x1, (%rax)
cmpq $0x0, -0x8(%rbp)
je 0xe2f13
movq -0x8(%rbp), %rdi
callq 0xe1c20
movq %rax, -0x8(%rbp)
leaq 0x2ee46f(%rip), %rdi    # 0x3d1210
leaq 0x2b7e78(%rip), %rsi    # 0x39ac20
callq 0x9350
movsbl 0x2ee45c(%rip), %eax    # 0x3d1210
cmpl $0x0, %eax
jne 0xe2dbb
jmp 0xe2d82
movq -0x8(%rbp), %rdi
callq 0xe1c20
movq %rax, -0x8(%rbp)
callq 0xe1e70
leaq 0x2ee43c(%rip), %rdi    # 0x3d1210
leaq 0xa63dc(%rip), %rsi     # 0x1891b7
callq 0x9510
cmpl $0x0, %eax
jne 0xe2e19
leaq 0x2b7e34(%rip), %rdi    # 0x39ac20
leaq 0xa6364(%rip), %rsi     # 0x189157
callq 0x9510
cmpl $0x0, %eax
jne 0xe2e06
movl $0x1, -0x10(%rbp)
jmp 0xe2e0d
movl $0x0, -0x10(%rbp)
movl $0x1, -0xc(%rbp)
jmp 0xe2f0e
leaq 0x2ee3f0(%rip), %rdi    # 0x3d1210
leaq 0xa639a(%rip), %rsi     # 0x1891c1
callq 0x9510
cmpl $0x0, %eax
jne 0xe2e65
leaq 0x2b7de8(%rip), %rdi    # 0x39ac20
leaq 0xa6318(%rip), %rsi     # 0x189157
callq 0x9510
cmpl $0x0, %eax
jne 0xe2e52
movl $0x1, -0x18(%rbp)
jmp 0xe2e59
movl $0x0, -0x18(%rbp)
movl $0x1, -0x14(%rbp)
jmp 0xe2f0c
leaq 0x2ee3a4(%rip), %rdi    # 0x3d1210
leaq 0xa635a(%rip), %rsi     # 0x1891cd
callq 0x9510
cmpl $0x0, %eax
jne 0xe2eae
leaq 0x2b7d9c(%rip), %rdi    # 0x39ac20
leaq 0xa62cc(%rip), %rsi     # 0x189157
callq 0x9510
cmpl $0x0, %eax
jne 0xe2e9e
movl $0x1, -0x20(%rbp)
jmp 0xe2ea5
movl $0x0, -0x20(%rbp)
movl $0x1, -0x1c(%rbp)
jmp 0xe2f0a
leaq 0x2ee35b(%rip), %rdi    # 0x3d1210
leaq 0xa631f(%rip), %rsi     # 0x1891db
callq 0x9510
cmpl $0x0, %eax
jne 0xe2f08
leaq 0x2b7d53(%rip), %rdi    # 0x39ac20
callq 0x9480
movsd %xmm0, -0x30(%rbp)
movsd -0x30(%rbp), %xmm0
leaq 0x288abd(%rip), %rax    # 0x36b9a0
movsd %xmm0, (%rax)
leaq 0x289526(%rip), %rax    # 0x36c414
movl $0x8, (%rax)
leaq 0x28952d(%rip), %rax    # 0x36c428
movl $0x8, (%rax)
movl $0x1, -0x24(%rbp)
jmp 0xe2f0a
jmp 0xe2f0c
jmp 0xe2f0e
jmp 0xe2d82
cmpl $0x0, -0xc(%rbp)
je 0xe2f2b
cmpl $0x0, -0x10(%rbp)
jne 0xe2f2b
leaq 0x289751(%rip), %rax    # 0x36c677
movb $0x1, (%rax)
jmp 0xe2f69
cmpl $0x0, -0x1c(%rbp)
je 0xe2f43
cmpl $0x0, -0x20(%rbp)
jne 0xe2f43
leaq 0x289739(%rip), %rax    # 0x36c677
movb $0x3, (%rax)
jmp 0xe2f67
cmpl $0x0, -0x14(%rbp)
je 0xe2f5b
cmpl $0x0, -0x18(%rbp)
jne 0xe2f5b
leaq 0x289721(%rip), %rax    # 0x36c677
movb $0x4, (%rax)
jmp 0xe2f65
leaq 0x289715(%rip), %rax    # 0x36c677
movb $0x0, (%rax)
jmp 0xe2f67
jmp 0xe2f69
addq $0x30, %rsp
popq %rbp
retq
nop