// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_rftg_voltages()
void parse_rftg_voltages()
{
double ctrl;
int b1,b2,b3,b4;

   log_packet_id("Packet 0x23 (voltages)");

   ctrl = ((double) (u16) tsip_word()) / 3276.8;  // counter?
   b1 = tsip_byte(); 
   b2 = tsip_byte(); 
   b3 = tsip_byte(); 
   b4 = tsip_byte(); 

   // these two are only sent by the XO unit
   if(rftg_unit != 0) {
      rftg_adc = ((double) (u16) tsip_word()) / 3276.8;  // counter?
      rftg_dac_5min = ((double) (u16) tsip_word()) / 3276.8;  // counter?
   }

   dac_voltage = (DATA_SIZE) ctrl;
   have_dac = 1;
   temperature = (DATA_SIZE) (((double)b1 * 1.5024) - 273.0);
   have_temperature = 103;

   if(rftg_unit == 0) {
      ant_v1 = ((double) b2) / 15.44571833;  // lamp V
      ant_v2 = ((double) b3) / 15.44571833;  // xtal V
      plot[SIX].units = "--";       // meaningless number for Rb unit
      plot[SIX].plot_id = "---";
      plot[SEVEN].plot_id = "LampV";
      plot[EIGHT].plot_id = "OcxoV";
   }
   else {
      ant_v1 = ((double) b2) / 50.0486431;   // fault1 V
      ant_v2 = ((double) b3) / 50.0486431;   // fault2 V
      plot[SIX].units = "mA";
      plot[SIX].plot_id = "AntI";
      plot[SEVEN].plot_id = "AntV1";
      plot[EIGHT].plot_id = "AntV2";
   }
   ant_ma = (ant_v2 - ant_v1) * 100.0;  // antenna current

   rftg_oscv = ((double) b4) / 7.121011923;
   have_ant_v1 = have_ant_v2 = have_ant_ma = 1;

//sprintf(debug_text3, "rftg23: %.5f %d->%.5f %d->%.5f %d->%.5f %d->%.5f  adc:%.5f  dac5:%.5f", ctrl, b1,temperature, b2,ant_v1, b3,ant_v2, b4,rftg_oscv, rftg_adc,rftg_dac_5min);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x9abde(%rip), %rdi     # 0x12341e
callq 0x58e77
callq 0x588f0
movl %eax, %r13d
callq 0x587d1
movl %eax, %r15d
cmpl $0x100, %eax            # imm = 0x100
jb 0x88866
leaq 0x1b670d(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587d1
movl %eax, %r14d
cmpl $0x100, %eax            # imm = 0x100
jb 0x8887f
leaq 0x1b66f4(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587d1
movl %eax, %r12d
cmpl $0x100, %eax            # imm = 0x100
jb 0x88898
leaq 0x1b66db(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
callq 0x587d1
movl %eax, %ebx
cmpl $0x100, %eax            # imm = 0x100
jb 0x888b0
leaq 0x1b66c3(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
leaq 0x2850fd(%rip), %rsi    # 0x30d9b4
cmpl $0x0, (%rsi)
je 0x88904
callq 0x588f0
movzwl %ax, %eax
cvtsi2sd %eax, %xmm0
divsd 0x95d98(%rip), %xmm0    # 0x11e668
leaq 0x2851a9(%rip), %rax    # 0x30da80
movsd %xmm0, (%rax)
callq 0x588f0
leaq 0x2850cd(%rip), %rsi    # 0x30d9b4
movzwl %ax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x95d6f(%rip), %xmm0    # 0x11e668
leaq 0x285188(%rip), %rax    # 0x30da88
movsd %xmm0, (%rax)
movzwl %r13w, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x95d51(%rip), %xmm0    # 0x11e668
leaq 0x2840e2(%rip), %rax    # 0x30ca00
movsd %xmm0, (%rax)
leaq 0x2849d3(%rip), %rdx    # 0x30d2fc
movl $0x1, %eax
movl $0xff, %ecx
andl %ecx, %r15d
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
mulsd 0x95d2a(%rip), %xmm0    # 0x11e670
movl %eax, (%rdx)
addsd 0x95d28(%rip), %xmm0    # 0x11e678
leaq 0x2840c1(%rip), %rdx    # 0x30ca18
movsd %xmm0, (%rdx)
leaq 0x2848ea(%rip), %rdx    # 0x30d24c
movl $0x67, (%rdx)
andl %ecx, %r14d
andl %ecx, %r12d
xorl %edx, %edx
cmpl $0x0, (%rsi)
cvtsi2sd %r14d, %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %r12d, %xmm0
sete %dl
leaq 0x96096(%rip), %rsi     # 0x11ea20
movsd (%rsi,%rdx,8), %xmm2
leaq 0xaa579(%rip), %rdx     # 0x132f0f
leaq 0xa6614(%rip), %rsi     # 0x12efb1
cmoveq %rdx, %rsi
leaq 0x82441(%rip), %rdx     # 0x10ade9
leaq 0x9542a(%rip), %rdi     # 0x11ddd9
cmoveq %rdx, %rdi
leaq 0x9aa7b(%rip), %rdx     # 0x123435
leaq 0x9541d(%rip), %r8      # 0x11ddde
cmoveq %rdx, %r8
leaq 0x879a0(%rip), %rdx     # 0x11036c
leaq 0x879f1(%rip), %r9      # 0x1103c4
cmoveq %rdx, %r9
divsd %xmm2, %xmm1
leaq 0x285076(%rip), %rdx    # 0x30da58
movsd %xmm1, (%rdx)
divsd %xmm2, %xmm0
leaq 0x28506f(%rip), %rdx    # 0x30da60
movsd %xmm0, (%rdx)
leaq 0xd5334(%rip), %rdx     # 0x15dd30
movq %rsi, 0x830(%rdx)
movq %rdi, 0x828(%rdx)
movq %r8, 0x910(%rdx)
subsd %xmm1, %xmm0
mulsd 0x80643(%rip), %xmm0    # 0x109060
movq %r9, 0x9f8(%rdx)
leaq 0x28503d(%rip), %rdx    # 0x30da68
movsd %xmm0, (%rdx)
andl %ecx, %ebx
xorps %xmm0, %xmm0
cvtsi2sd %ebx, %xmm0
divsd 0x95c40(%rip), %xmm0    # 0x11e680
leaq 0x285049(%rip), %rcx    # 0x30da90
movsd %xmm0, (%rcx)
leaq 0x285026(%rip), %rcx    # 0x30da78
movl %eax, (%rcx)
leaq 0x285019(%rip), %rcx    # 0x30da74
movl %eax, (%rcx)
leaq 0x28500c(%rip), %rcx    # 0x30da70
movl %eax, (%rcx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq