// File: /workspace/github_cpp_makefile_star2_O3/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 0x173b17(%rip), %rax    # 0x21b038
movl $0x1, (%rax)
xorl %r13d, %r13d
leaq 0x2caadf(%rip), %rbx    # 0x372010
leaq 0x294508(%rip), %r14    # 0x33ba40
xorl %r12d, %r12d
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movl $0x0, -0x38(%rbp)
movl $0x0, -0x34(%rbp)
testq %r15, %r15
je 0xa76c2
movq %r15, %rdi
callq 0xa6568
movq %rax, %r15
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9340
cmpb $0x0, 0x2caa93(%rip)    # 0x372010
je 0xa7557
movq %r15, %rdi
callq 0xa6568
movq %rax, %r15
callq 0xa6663
movq 0x2caa7a(%rip), %rax    # 0x372010
movabsq $0x474e494e4e555222, %rcx # imm = 0x474E494E4E555222
xorq %rcx, %rax
movzwl 0x2caa6e(%rip), %ecx    # 0x372018
xorq $0x22, %rcx
orq %rax, %rcx
je 0xa7658
movq 0x2caa52(%rip), %rax    # 0x372010
movabsq $0x4e45524546455222, %rcx # imm = 0x4E45524546455222
xorq %rcx, %rax
movl 0x2caa47(%rip), %ecx    # 0x372018
xorq $0x224543, %rcx         # imm = 0x224543
orq %rax, %rcx
je 0xa7678
movq 0x2caa28(%rip), %rax    # 0x372010
movabsq $0x4c50494353494422, %rcx # imm = 0x4C50494353494422
xorq %rcx, %rax
movq 0x2caa1a(%rip), %rcx    # 0x372016
movabsq $0x2244454e494c50, %rdx # imm = 0x2244454E494C50
xorq %rdx, %rcx
orq %rax, %rcx
je 0xa769d
movabsq $0x2241544c454422, %rax # imm = 0x2241544C454422
cmpq %rax, 0x2ca9ed(%rip)    # 0x372010
jne 0xa7557
movq %r14, %rdi
callq 0x9470
leaq 0x265188(%rip), %rax    # 0x30c7c0
movsd %xmm0, (%rax)
leaq 0x265bf1(%rip), %rax    # 0x30d234
movl $0x8, %ecx
movl %ecx, (%rax)
leaq 0x265bf7(%rip), %rax    # 0x30d248
movl %ecx, (%rax)
jmp 0xa7557
movl (%r14), %eax
movl $0x45555254, %ecx       # imm = 0x45555254
xorl %ecx, %eax
movzbl 0x4(%r14), %ecx
xorl %r12d, %r12d
orl %eax, %ecx
sete %r12b
movb $0x1, %r13b
jmp 0xa7557
movl (%r14), %eax
movl $0x45555254, %ecx       # imm = 0x45555254
xorl %ecx, %eax
movzbl 0x4(%r14), %ecx
xorl %edx, %edx
orl %eax, %ecx
sete %dl
movl %edx, -0x30(%rbp)
movl $0x1, -0x2c(%rbp)
jmp 0xa7557
movl (%r14), %eax
movl $0x45555254, %ecx       # imm = 0x45555254
xorl %ecx, %eax
movzbl 0x4(%r14), %ecx
xorl %edx, %edx
orl %eax, %ecx
sete %dl
movl %edx, -0x34(%rbp)
movl $0x1, -0x38(%rbp)
jmp 0xa7557
testl %r12d, %r12d
sete %cl
movb $0x1, %al
testb %cl, %r13b
jne 0xa76f0
cmpl $0x0, -0x38(%rbp)
je 0xa76dd
movb $0x3, %al
cmpl $0x0, -0x34(%rbp)
je 0xa76f0
cmpl $0x0, -0x2c(%rbp)
setne %cl
cmpl $0x0, -0x30(%rbp)
sete %al
andb %cl, %al
shlb $0x2, %al
leaq 0x265da0(%rip), %rcx    # 0x30d497
movb %al, (%rcx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq