// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: get_adev_point(unsigned char, long)
double get_adev_point(u08 id, long i)
{
double val;
#define INTERVAL ((OFS_SIZE) 0.0)  //1.0

   if(adev_q_allocated == 0) return 0.0;

   id /= NUM_ADEV_TYPES;

   val = 0;
   if(id == PPS_ID) {   // return PPS value
      i = pps_adev_q_out + i;
//      if(i >= adev_q_size) i -= adev_q_size;
      while(i >= adev_q_size) i -= adev_q_size;
      if(i < 0) return 0.0;
      if(pps_adev_q == 0) return 0.0;
      val = pps_adev_q[i];
      if(luxor) val = INTERVAL + (val+pps_base_value);
      else      val = INTERVAL + (1.0e-9 * (val+pps_base_value));
   }
   else if(id == CHC_ID) {   // return CHC value
      i = chc_adev_q_out + i;
//      if(i >= adev_q_size) i -= adev_q_size;
      while(i >= adev_q_size) i -= adev_q_size;
      if(i < 0) return 0.0;
      if(chc_adev_q == 0) return 0.0;
      val = chc_adev_q[i];
      if(luxor) val = INTERVAL + (val+chc_base_value);
      else      val = INTERVAL + (1.0e-9 * (val+chc_base_value));
   }
   else if(id == CHD_ID) {   // return CHD value
      i = chd_adev_q_out + i;
//      if(i >= adev_q_size) i -= adev_q_size;
      while(i >= adev_q_size) i -= adev_q_size;
      if(i < 0) return 0.0;
      if(chd_adev_q == 0) return 0.0;
      val = chd_adev_q[i];
      if(luxor) val = INTERVAL + (val+chd_base_value);
      else      val = INTERVAL + (1.0e-9 * (val+chd_base_value));
   }
   else {      // return OSC value
      i = osc_adev_q_out + i;
//      if(i >= adev_q_size) i -= adev_q_size;
      while(i >= adev_q_size) i -= adev_q_size;
      if(i < 0) return 0.0;
      if(osc_adev_q == 0) return 0.0;
      val = osc_adev_q[i];
      if(luxor) val = INTERVAL + (val+osc_base_value);
      else if(TICC_USED) val = INTERVAL + (1.0e-9 * (val+osc_base_value));
      else if(0) val = INTERVAL + (1.0e-9 * (val+osc_base_value));  // aaattttt
      else val = INTERVAL + ((100.0 * 1.0e-9) * (val+osc_base_value));
   }

   return val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0x13bc33(%rip), %rax    # 0x23cce0
xorpd %xmm0, %xmm0
cmpl $0x0, (%rax)
je 0x101233
leal -0x5(%rdi), %ecx
leaq 0x13bc14(%rip), %rax    # 0x23ccd8
movq (%rax), %rax
cmpb $0x4, %cl
ja 0x10111b
leaq 0x13ba5d(%rip), %rcx    # 0x23cb30
movq (%rcx), %rcx
addq %rax, %rcx
addq %rsi, %rcx
subq %rax, %rcx
cmpq %rax, %rcx
jge 0x1010dc
testq %rcx, %rcx
js 0x101233
leaq 0x13ba2c(%rip), %rax    # 0x23cb20
movq (%rax), %rax
testq %rax, %rax
je 0x101233
leaq 0x13de37(%rip), %rdx    # 0x23ef3e
cmpb $0x0, (%rdx)
movsd (%rax,%rcx,8), %xmm0
leaq 0x12239a(%rip), %rax    # 0x2234b0
jmp 0x1011c3
leal -0xa(%rdi), %ecx
cmpb $0x4, %cl
ja 0x10116f
leaq 0x13baa6(%rip), %rcx    # 0x23cbd0
movq (%rcx), %rcx
addq %rax, %rcx
addq %rsi, %rcx
subq %rax, %rcx
cmpq %rax, %rcx
jge 0x101133
testq %rcx, %rcx
js 0x101233
leaq 0x13ba75(%rip), %rax    # 0x23cbc0
movq (%rax), %rax
testq %rax, %rax
je 0x101233
leaq 0x13dde0(%rip), %rdx    # 0x23ef3e
cmpb $0x0, (%rdx)
movsd (%rax,%rcx,8), %xmm0
leaq 0x122353(%rip), %rax    # 0x2234c0
jmp 0x1011c3
addb $-0xf, %dil
cmpb $0x4, %dil
ja 0x1011e9
leaq 0x13baa0(%rip), %rcx    # 0x23cc20
movq (%rcx), %rcx
addq %rax, %rcx
addq %rsi, %rcx
subq %rax, %rcx
cmpq %rax, %rcx
jge 0x101189
testq %rcx, %rcx
js 0x101233
leaq 0x13ba6f(%rip), %rax    # 0x23cc10
movq (%rax), %rax
testq %rax, %rax
je 0x101233
leaq 0x13dd8a(%rip), %rdx    # 0x23ef3e
cmpb $0x0, (%rdx)
movsd (%rax,%rcx,8), %xmm0
leaq 0x122305(%rip), %rax    # 0x2234c8
addsd (%rax), %xmm0
je 0x1011d3
xorpd %xmm1, %xmm1
addsd %xmm1, %xmm0
jmp 0x101233
mulsd 0x7f6d(%rip), %xmm0     # 0x109148
xorpd %xmm1, %xmm1
addsd %xmm0, %xmm1
movapd %xmm1, %xmm0
jmp 0x101233
leaq 0x13b990(%rip), %rcx    # 0x23cb80
movq (%rcx), %rcx
addq %rax, %rcx
addq %rsi, %rcx
subq %rax, %rcx
cmpq %rax, %rcx
jge 0x1011f9
testq %rcx, %rcx
js 0x101233
leaq 0x13b963(%rip), %rax    # 0x23cb70
movq (%rax), %rax
testq %rax, %rax
je 0x101233
movsd (%rax,%rcx,8), %xmm1
leaq 0x13dd1d(%rip), %rax    # 0x23ef3e
cmpb $0x0, (%rax)
je 0x101239
leaq 0x12228b(%rip), %rax    # 0x2234b8
addsd (%rax), %xmm1
jmp 0x10126f
addq $0x10, %rsp
popq %rbp
retq
leaq 0x117690(%rip), %rax    # 0x2188d0
cmpq $0x10000, (%rax)        # imm = 0x10000
je 0x10125c
movsd %xmm1, -0x8(%rbp)
callq 0x702e7
movsd -0x8(%rbp), %xmm1
testl %eax, %eax
je 0x101278
leaq 0x122255(%rip), %rax    # 0x2234b8
addsd (%rax), %xmm1
mulsd 0x7ed9(%rip), %xmm1     # 0x109148
xorpd %xmm0, %xmm0
jmp 0x1011cd
leaq 0x122239(%rip), %rax    # 0x2234b8
addsd (%rax), %xmm1
mulsd 0x2a565(%rip), %xmm1    # 0x12b7f0
jmp 0x10126f