// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_brandy_f()
void parse_brandy_f()
{

   // frequency controller info

   log_packet_id("freq controller");

   if(get_msg_field()) {  // 2 -
      inst_phase = atof(msg_field);
      pps_offset = inst_phase;
      have_pps_offset = 456;
   }

   if(get_msg_field()) {  // 3 - documentation says this should be item 4!
      if(msg_field[0] == '%') { // value out of range
         avg_phase = atof(&msg_field[1]);
      }
      else {
         avg_phase = atof(msg_field);
      }
   }

   if(get_msg_field()) {  // 4 - always 0 on GPS-4  - documentation says this should be item 3!  
      phase_control_val = atof(msg_field);
   }

   if(get_msg_field()) {  // 5 -
      freq_control_val = atof(msg_field);
      dac_voltage = (DATA_SIZE) ((freq_control_val / 32767.0) * 100.0);
      have_dac = 44;
   }

   if(get_msg_field()) {  // 6 - last freq correction
      last_freq_corr = atof(msg_field);
      osc_offset = (last_freq_corr * 1.0E12);
      have_osc_offset = 44;
   }

   if(get_msg_field()) {  // 7 - frequency trend
      freq_trend = atof(msg_field);
   }

   if(get_msg_field()) {  // 8 - date of last correction
      msg_field[32] = 0;
      strcpy(last_correction, msg_field);
   }

   if(get_msg_field()) {  // 9 - temperature (not valid on GPS-4)
      temperature = (DATA_SIZE) atof(msg_field);
//    have_temperature = 1;  // temp reading not valid
   }

   if(get_msg_field()) {  // 10 -
      phase_status = atohex(msg_field);
      if(phase_status & 0xF8) minor_alarms |= MINOR_PLL;
      else                    minor_alarms &= (~MINOR_PLL);
      have_pll = 1;
   }

   if(get_msg_field()) {  // 11 -
      pll_constraint = atohex(msg_field);

      if(pll_constraint & 0x0C) time_flags |= TFLAGS_INVALID;
      else                      time_flags &= (~TFLAGS_INVALID);

      if(pll_constraint & 0x01) minor_alarms |= MINOR_OSC_CTRL;
      else                      minor_alarms &= (~MINOR_OSC_CTRL);

   }

   if(get_msg_field()) {  // 12 - osc type
      msg_field[16] = 0;
      strcpy(brandy_osc, msg_field);
      have_info |= (MANUF_PARAMS);
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x8fda3(%rip), %rdi     # 0x10d6ca
callq 0x520bf
callq 0x75767
testl %eax, %eax
je 0x7d964
leaq 0x2a8104(%rip), %rdi    # 0x325a40
callq 0x9470
leaq 0x2a8660(%rip), %rax    # 0x325fa8
movsd %xmm0, (%rax)
leaq 0x278e65(%rip), %rax    # 0x2f67b8
movsd %xmm0, (%rax)
leaq 0x2798da(%rip), %rax    # 0x2f7238
movl $0x1c8, (%rax)          # imm = 0x1C8
callq 0x75767
testl %eax, %eax
je 0x7d98f
leaq 0x2a80cc(%rip), %rax    # 0x325a40
leaq 0x1(%rax), %rdi
cmpb $0x25, (%rax)
cmovneq %rax, %rdi
callq 0x9470
leaq 0x2a862d(%rip), %rax    # 0x325fb8
movsd %xmm0, (%rax)
callq 0x75767
testl %eax, %eax
je 0x7d9af
leaq 0x2a80a1(%rip), %rdi    # 0x325a40
callq 0x9470
leaq 0x2a8605(%rip), %rax    # 0x325fb0
movsd %xmm0, (%rax)
callq 0x75767
testl %eax, %eax
je 0x7d9f7
leaq 0x2a8081(%rip), %rdi    # 0x325a40
callq 0x9470
leaq 0x2a85f5(%rip), %rax    # 0x325fc0
movsd %xmm0, (%rax)
divsd 0x8acd9(%rip), %xmm0    # 0x1086b0
mulsd 0x75681(%rip), %xmm0    # 0xf3060
leaq 0x27901a(%rip), %rax    # 0x2f6a00
movsd %xmm0, (%rax)
leaq 0x27990b(%rip), %rax    # 0x2f72fc
movl $0x2c, (%rax)
callq 0x75767
testl %eax, %eax
je 0x7da37
leaq 0x2a8039(%rip), %rdi    # 0x325a40
callq 0x9470
leaq 0x2a85b5(%rip), %rax    # 0x325fc8
movsd %xmm0, (%rax)
mulsd 0x75739(%rip), %xmm0    # 0xf3158
leaq 0x278d9a(%rip), %rax    # 0x2f67c0
movsd %xmm0, (%rax)
leaq 0x279803(%rip), %rax    # 0x2f7234
movl $0x2c, (%rax)
callq 0x75767
testl %eax, %eax
je 0x7da57
leaq 0x2a7ff9(%rip), %rdi    # 0x325a40
callq 0x9470
leaq 0x2a857d(%rip), %rax    # 0x325fd0
movsd %xmm0, (%rax)
callq 0x75767
testl %eax, %eax
je 0x7da77
leaq 0x2a7fd9(%rip), %rsi    # 0x325a40
movb $0x0, 0x20(%rsi)
leaq 0x2a856e(%rip), %rdi    # 0x325fe0
callq 0x9330
callq 0x75767
testl %eax, %eax
je 0x7da97
leaq 0x2a7fb9(%rip), %rdi    # 0x325a40
callq 0x9470
leaq 0x278f85(%rip), %rax    # 0x2f6a18
movsd %xmm0, (%rax)
callq 0x75767
testl %eax, %eax
je 0x7dade
leaq 0x2a7f99(%rip), %rdi    # 0x325a40
callq 0x98b2
leaq 0x2a8551(%rip), %rcx    # 0x326004
movl %eax, (%rcx)
xorl %ecx, %ecx
testb $-0x8, %al
setne %cl
leaq 0x279715(%rip), %rax    # 0x2f71d8
movl $0xfdffffff, %edx       # imm = 0xFDFFFFFF
andl (%rax), %edx
shll $0x19, %ecx
orl %edx, %ecx
movl %ecx, (%rax)
leaq 0x27970c(%rip), %rax    # 0x2f71e4
movl $0x1, (%rax)
callq 0x75767
testl %eax, %eax
je 0x7db2a
leaq 0x2a7f52(%rip), %rdi    # 0x325a40
callq 0x98b2
leaq 0x2a850e(%rip), %rcx    # 0x326008
movl %eax, (%rcx)
xorl %ecx, %ecx
testb $0xc, %al
setne %cl
leaq 0x27999a(%rip), %rdx    # 0x2f74a4
movl (%rdx), %esi
andl $-0x5, %esi
leal (%rsi,%rcx,4), %ecx
movl %ecx, (%rdx)
leaq 0x2796bd(%rip), %rcx    # 0x2f71d8
movl (%rcx), %edx
andl $-0x11, %edx
shll $0x4, %eax
andl $0x10, %eax
orl %edx, %eax
movl %eax, (%rcx)
callq 0x75767
testl %eax, %eax
je 0x7db54
leaq 0x2a7f06(%rip), %rsi    # 0x325a40
movb $0x0, 0x10(%rsi)
leaq 0x2a828b(%rip), %rdi    # 0x325dd0
callq 0x9330
leaq 0x279e23(%rip), %rax    # 0x2f7974
orb $0x1, (%rax)
popq %rbp
retq