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

   // analog data
   log_packet_id("analog data");

   if(i < 0) return;
   if(i > 19) return;

   if(get_msg_field()) {
      if(!strchr(msg_field, '.')) ++bad_prs_val;

      val = atof(msg_field);
      if     (i == 1) val *= 10.0;    // scale readings to actual values
      else if(i == 2) val *= 10.0;
      else if(i == 3) val *= 10.0;
      else if(i == 4) val *= 10.0;
      else if(i == 9) val *= 4.0;
      else if(i == 10) val *= 100.0;
      else if(i == 16) val *= 4.0;
      else if(i == 17) val *= 4.0;
      else if(i == 18) val *= 4.0;

      prs_ad[i] = val;
      have_prs_ad |= (1 << i);

      if((i == 1) || (i == 2)) {  // average of power readings
         prs_ad_pwr = ((prs_ad[1]+prs_ad[2])/2.0);  
      }
      else if(i == 10) {  // case temperature
         temperature = (DATA_SIZE) prs_ad[i];
         have_temperature = 104;
      }
      else if((i == 11) || (i == 12) || (i == 13)) { // average of thermistor readings
         prs_ad_therm = ((prs_ad[11]+prs_ad[12]+prs_ad[13])/3.0);  
      }
   }
   else ++bad_prs_val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x4(%rbp)
leaq 0xc5b8d(%rip), %rdi     # 0x186f7f
callq 0x7add0
cmpl $0x0, -0x4(%rbp)
jge 0xc1402
jmp 0xc165b
cmpl $0x13, -0x4(%rbp)
jle 0xc140d
jmp 0xc165b
callq 0xb0bd0
cmpl $0x0, %eax
je 0xc164c
leaq 0x2d97fe(%rip), %rdi    # 0x39ac20
movl $0x2e, %esi
callq 0x9100
cmpq $0x0, %rax
jne 0xc1441
movl 0x30a9cc(%rip), %eax    # 0x3cbe04
addl $0x1, %eax
movl %eax, 0x30a9c3(%rip)    # 0x3cbe04
leaq 0x2d97d8(%rip), %rdi    # 0x39ac20
callq 0x9480
movsd %xmm0, -0x10(%rbp)
cmpl $0x1, -0x4(%rbp)
jne 0xc146f
movsd 0xadc60(%rip), %xmm0    # 0x16f0c0
mulsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
jmp 0xc1556
cmpl $0x2, -0x4(%rbp)
jne 0xc148c
movsd 0xadc43(%rip), %xmm0    # 0x16f0c0
mulsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
jmp 0xc1554
cmpl $0x3, -0x4(%rbp)
jne 0xc14a9
movsd 0xadc26(%rip), %xmm0    # 0x16f0c0
mulsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
jmp 0xc1552
cmpl $0x4, -0x4(%rbp)
jne 0xc14c6
movsd 0xadc09(%rip), %xmm0    # 0x16f0c0
mulsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
jmp 0xc1550
cmpl $0x9, -0x4(%rbp)
jne 0xc14e0
movsd 0xb01fc(%rip), %xmm0    # 0x1716d0
mulsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
jmp 0xc154e
cmpl $0xa, -0x4(%rbp)
jne 0xc14fa
movsd 0xadb62(%rip), %xmm0    # 0x16f050
mulsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
jmp 0xc154c
cmpl $0x10, -0x4(%rbp)
jne 0xc1514
movsd 0xb01c8(%rip), %xmm0    # 0x1716d0
mulsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
jmp 0xc154a
cmpl $0x11, -0x4(%rbp)
jne 0xc152e
movsd 0xb01ae(%rip), %xmm0    # 0x1716d0
mulsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
jmp 0xc1548
cmpl $0x12, -0x4(%rbp)
jne 0xc1546
movsd 0xb0194(%rip), %xmm0    # 0x1716d0
mulsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
jmp 0xc1548
jmp 0xc154a
jmp 0xc154c
jmp 0xc154e
jmp 0xc1550
jmp 0xc1552
jmp 0xc1554
jmp 0xc1556
movsd -0x10(%rbp), %xmm0
movslq -0x4(%rbp), %rcx
leaq 0x1b881a(%rip), %rax    # 0x279d80
movsd %xmm0, (%rax,%rcx,8)
movl -0x4(%rbp), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, %ecx
leaq 0x1b874a(%rip), %rax    # 0x279cc8
orl (%rax), %ecx
leaq 0x1b8741(%rip), %rax    # 0x279cc8
movl %ecx, (%rax)
cmpl $0x1, -0x4(%rbp)
je 0xc1595
cmpl $0x2, -0x4(%rbp)
jne 0xc15c9
leaq 0x1b87e4(%rip), %rax    # 0x279d80
movsd 0x8(%rax), %xmm0
leaq 0x1b87d8(%rip), %rax    # 0x279d80
addsd 0x10(%rax), %xmm0
movsd 0xadb9b(%rip), %xmm1    # 0x16f150
divsd %xmm1, %xmm0
leaq 0x1b8878(%rip), %rax    # 0x279e38
movsd %xmm0, (%rax)
jmp 0xc164a
cmpl $0xa, -0x4(%rbp)
jne 0xc15f9
movslq -0x4(%rbp), %rcx
leaq 0x1b87a6(%rip), %rax    # 0x279d80
movsd (%rax,%rcx,8), %xmm0
leaq 0x2aa612(%rip), %rax    # 0x36bbf8
movsd %xmm0, (%rax)
leaq 0x2aae3b(%rip), %rax    # 0x36c42c
movl $0x68, (%rax)
jmp 0xc1648
cmpl $0xb, -0x4(%rbp)
je 0xc160b
cmpl $0xc, -0x4(%rbp)
je 0xc160b
cmpl $0xd, -0x4(%rbp)
jne 0xc1646
leaq 0x1b876e(%rip), %rax    # 0x279d80
movsd 0x58(%rax), %xmm0
leaq 0x1b8762(%rip), %rax    # 0x279d80
addsd 0x60(%rax), %xmm0
leaq 0x1b8756(%rip), %rax    # 0x279d80
addsd 0x68(%rax), %xmm0
movsd 0xadba9(%rip), %xmm1    # 0x16f1e0
divsd %xmm1, %xmm0
leaq 0x1b87fe(%rip), %rax    # 0x279e40
movsd %xmm0, (%rax)
jmp 0xc1648
jmp 0xc164a
jmp 0xc165b
movl 0x30a7b2(%rip), %eax    # 0x3cbe04
addl $0x1, %eax
movl %eax, 0x30a7a9(%rip)    # 0x3cbe04
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)