// File: jkingan[P]ladyheather/heathgps.cpp
// Function: parse_prs_fc2()
void parse_prs_fc2()
{
int life;
double val;

   // frequency control eeprom settings
   log_packet_id("frequency control eeprom");

   if(get_msg_field()) {  // power cycles
      prs_pwr_cycles = atoi(msg_field);
      have_prs_fc2 |= 0x01;
   }
   else ++bad_prs_val;

   if(get_msg_field()) {
      prs_fc_writes = atoi(msg_field);
      have_prs_fc2 |= 0x02;

      life = prs_fc_writes;  // updated around twice a day (manual says daily)
      if(prs_fc_writes > prs_pwr_cycles) life -= prs_pwr_cycles;
      scpi_life = (life * 12);  // updated around twice a day (manual says daily)
      have_lifetime = 1;
   }
   else ++bad_prs_val;

   if(get_msg_field()) {
      prs_ee_fc1 = atoi(msg_field);
   }
   else ++bad_prs_val;

   if(get_msg_field()) {
      prs_ee_fc2 = atoi(msg_field);
   }
   else ++bad_prs_val;

   val = (double) (prs_ee_fc1 - 2048) * 1000.0;
   val += (double) (prs_ee_fc2 - 2048); // DAC reference setting
   val *= 1.5;
   prs_ee_fc_ppt = (val * 1.0E-12);
   val /= 1000.0;
   prs_fc_ref = val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0xc644a(%rip), %rdi     # 0x186e89
callq 0x7add0
callq 0xb0bd0
cmpl $0x0, %eax
je 0xc0a7c
leaq 0x2da1cb(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, %ecx
leaq 0x1b929d(%rip), %rax    # 0x279d00
movl %ecx, (%rax)
leaq 0x1b920c(%rip), %rax    # 0x279c78
movl (%rax), %ecx
orl $0x1, %ecx
leaq 0x1b9200(%rip), %rax    # 0x279c78
movl %ecx, (%rax)
jmp 0xc0a8b
movl 0x30b382(%rip), %eax    # 0x3cbe04
addl $0x1, %eax
movl %eax, 0x30b379(%rip)    # 0x3cbe04
callq 0xb0bd0
cmpl $0x0, %eax
je 0xc0b0e
leaq 0x2da184(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, %ecx
leaq 0x1b925a(%rip), %rax    # 0x279d04
movl %ecx, (%rax)
leaq 0x1b91c5(%rip), %rax    # 0x279c78
movl (%rax), %ecx
orl $0x2, %ecx
leaq 0x1b91b9(%rip), %rax    # 0x279c78
movl %ecx, (%rax)
leaq 0x1b923c(%rip), %rax    # 0x279d04
movl (%rax), %eax
movl %eax, -0x4(%rbp)
leaq 0x1b9230(%rip), %rax    # 0x279d04
movl (%rax), %eax
leaq 0x1b9223(%rip), %rcx    # 0x279d00
cmpl (%rcx), %eax
jle 0xc0af2
leaq 0x1b9218(%rip), %rax    # 0x279d00
movl (%rax), %ecx
movl -0x4(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x4(%rbp)
imull $0xc, -0x4(%rbp), %ecx
leaq 0x2abb3f(%rip), %rax    # 0x36c63c
movl %ecx, (%rax)
leaq 0x2ab9a2(%rip), %rax    # 0x36c4a8
movl $0x1, (%rax)
jmp 0xc0b1d
movl 0x30b2f0(%rip), %eax    # 0x3cbe04
addl $0x1, %eax
movl %eax, 0x30b2e7(%rip)    # 0x3cbe04
callq 0xb0bd0
cmpl $0x0, %eax
je 0xc0b40
leaq 0x2da0f2(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, %ecx
leaq 0x1b91bc(%rip), %rax    # 0x279cf8
movl %ecx, (%rax)
jmp 0xc0b4f
movl 0x30b2be(%rip), %eax    # 0x3cbe04
addl $0x1, %eax
movl %eax, 0x30b2b5(%rip)    # 0x3cbe04
callq 0xb0bd0
cmpl $0x0, %eax
je 0xc0b72
leaq 0x2da0c0(%rip), %rdi    # 0x39ac20
callq 0x95c0
movl %eax, %ecx
leaq 0x1b918e(%rip), %rax    # 0x279cfc
movl %ecx, (%rax)
jmp 0xc0b81
movl 0x30b28c(%rip), %eax    # 0x3cbe04
addl $0x1, %eax
movl %eax, 0x30b283(%rip)    # 0x3cbe04
leaq 0x1b9170(%rip), %rax    # 0x279cf8
movl (%rax), %eax
subl $0x800, %eax            # imm = 0x800
cvtsi2sd %eax, %xmm0
movsd 0xae495(%rip), %xmm1    # 0x16f030
mulsd %xmm1, %xmm0
movsd %xmm0, -0x10(%rbp)
leaq 0x1b9151(%rip), %rax    # 0x279cfc
movl (%rax), %eax
subl $0x800, %eax            # imm = 0x800
cvtsi2sd %eax, %xmm0
addsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
movsd 0xae510(%rip), %xmm0    # 0x16f0d8
mulsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
movsd 0xc201e(%rip), %xmm0    # 0x182bf8
mulsd -0x10(%rbp), %xmm0
leaq 0x1b924a(%rip), %rax    # 0x279e30
movsd %xmm0, (%rax)
movsd -0x10(%rbp), %xmm0
movsd 0xae439(%rip), %xmm1    # 0x16f030
divsd %xmm1, %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
movsd %xmm0, 0x31046b(%rip)   # 0x3d1078
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)