// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r15
leaq 0x16d29b(%rip), %rax    # 0x205038
movl $0x1, (%rax)
xorl %r12d, %r12d
leaq 0x2c4263(%rip), %rbx    # 0x35c010
leaq 0x28dc8c(%rip), %r14    # 0x325a40
xorl %r13d, %r13d
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movl $0x0, -0x38(%rbp)
movl $0x0, -0x34(%rbp)
testq %r15, %r15
je 0x97f0a
movq %r15, %rdi
callq 0x96fd1
movq %rax, %r15
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9330
cmpb $0x0, 0x2c4217(%rip)    # 0x35c010
je 0x97dd3
movq %r15, %rdi
callq 0x96fd1
movq %rax, %r15
callq 0x970c3
movq %rbx, %rdi
leaq 0x77fac(%rip), %rsi     # 0x10fdc1
pushq $0xa
popq %rdx
callq 0x9380
testl %eax, %eax
je 0x97e99
movq %rbx, %rdi
leaq 0x77fa0(%rip), %rsi     # 0x10fdcb
pushq $0xc
popq %rdx
callq 0x9380
testl %eax, %eax
je 0x97ebc
movq %rbx, %rdi
leaq 0x77f92(%rip), %rsi     # 0x10fdd7
pushq $0xe
popq %rdx
callq 0x9380
testl %eax, %eax
je 0x97ee3
movabsq $0x2241544c454422, %rax # imm = 0x2241544C454422
cmpq %rax, 0x2c41aa(%rip)    # 0x35c010
jne 0x97dd3
movq %r14, %rdi
callq 0x9470
leaq 0x25e945(%rip), %rax    # 0x2f67c0
movsd %xmm0, (%rax)
leaq 0x25f3ae(%rip), %rax    # 0x2f7234
pushq $0x8
popq %rcx
movl %ecx, (%rax)
leaq 0x25f3b6(%rip), %rax    # 0x2f7248
movl %ecx, (%rax)
jmp 0x97dd3
movq %r14, %rdi
leaq 0x77ebe(%rip), %rsi     # 0x10fd61
pushq $0x5
popq %rdx
callq 0x9380
xorl %r13d, %r13d
testl %eax, %eax
sete %r13b
movb $0x1, %r12b
jmp 0x97dd3
movq %r14, %rdi
leaq 0x77e9b(%rip), %rsi     # 0x10fd61
pushq $0x5
popq %rdx
callq 0x9380
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
movl %ecx, -0x30(%rbp)
pushq $0x1
popq %rax
movl %eax, -0x2c(%rbp)
jmp 0x97dd3
movq %r14, %rdi
leaq 0x77e74(%rip), %rsi     # 0x10fd61
pushq $0x5
popq %rdx
callq 0x9380
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
movl %ecx, -0x34(%rbp)
pushq $0x1
popq %rax
movl %eax, -0x38(%rbp)
jmp 0x97dd3
testl %r13d, %r13d
sete %cl
movb $0x1, %al
testb %cl, %r12b
jne 0x97f38
cmpl $0x0, -0x38(%rbp)
je 0x97f25
movb $0x3, %al
cmpl $0x0, -0x34(%rbp)
je 0x97f38
cmpl $0x0, -0x2c(%rbp)
setne %cl
cmpl $0x0, -0x30(%rbp)
sete %al
andb %cl, %al
shlb $0x2, %al
leaq 0x25f558(%rip), %rcx    # 0x2f7497
movb %al, (%rcx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq