// File: /workspace/github_cpp_makefile_star2_O3/sundale[P]gcode/rs274ngc/interp_read.cc
// Function: Interp::read_real_value(char*, int*, double*, double*)
int Interp::read_real_value(char *line,  //!< string: line of RS274/NGC code being processed
                           int *counter,        //!< pointer to a counter for position on the line 
                           double *double_ptr,  //!< pointer to double to be read                  
                           double *parameters)  //!< array of system parameters                    
{
  char c, c1;

  c = line[*counter];
  CHKS((c == 0), NCE_NO_CHARACTERS_FOUND_IN_READING_REAL_VALUE);

  c1 = line[*counter+1];

  if (c == '[')
    CHP(read_real_expression(line, counter, double_ptr, parameters));
  else if (c == '#')
  {
    CHP(read_parameter(line, counter, double_ptr, parameters));
  }
  else if (c == '+' && c1 && !isdigit(c1) && c1 != '.')
  {
    (*counter)++;
    CHP(read_real_value(line, counter, double_ptr, parameters));
  }
  else if (c == '-' && c1 && !isdigit(c1) && c1 != '.')
  {
    (*counter)++;
    CHP(read_real_value(line, counter, double_ptr, parameters));
    *double_ptr = -*double_ptr;
  }
  else if ((c >= 'a') && (c <= 'z'))
    CHP(read_unary(line, counter, double_ptr, parameters));
  else
    CHP(read_real_number(line, counter, double_ptr));

  CHKS(isnan(*double_ptr),
          "Calculation resulted in 'not a number'");
  CHKS(isinf(*double_ptr),
          "Calculation resulted in 'infinity'");

  return INTERP_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rdi, %r14
movslq (%rdx), %rax
movzbl (%rsi,%rax), %ecx
testl %ecx, %ecx
je 0x2642f
cmpl $0x23, %ecx
je 0x26446
cmpl $0x5b, %ecx
jne 0x26456
movq %r14, %rdi
movq %r15, %rcx
callq 0xafc0
jmp 0x26501
leaq 0x1370e(%rip), %rdi     # 0x39b44
callq 0xa1f0
movq %r14, %rdi
movq %rax, %rsi
jmp 0x2659d
movq %r14, %rdi
movq %r15, %rcx
callq 0xa970
jmp 0x26501
movsbl 0x1(%rsi,%rax), %edi
incq %rax
cmpl $0x2b, %ecx
jne 0x26493
testb %dil, %dil
je 0x26493
movl %edi, %ecx
addl $-0x3a, %ecx
cmpl $-0xa, %ecx
setb %cl
cmpb $0x2e, %dil
setne %dil
andb %cl, %dil
cmpb $0x1, %dil
jne 0x264f6
movl %eax, (%rdx)
movq %r14, %rdi
movq %r15, %rcx
callq 0xaf10
jmp 0x26501
cmpl $0x2d, %ecx
jne 0x264e1
testb %dil, %dil
je 0x264e1
movl %edi, %ecx
addl $-0x3a, %ecx
cmpl $-0xa, %ecx
setb %cl
cmpb $0x2e, %dil
setne %dil
andb %cl, %dil
cmpb $0x1, %dil
jne 0x264f6
movl %eax, (%rdx)
movq %r14, %rdi
movq %r15, %rcx
callq 0xaf10
testl %eax, %eax
jne 0x26505
movsd (%r15), %xmm0
xorpd 0xda39(%rip), %xmm0     # 0x33f10
movlpd %xmm0, (%r15)
jmp 0x26572
addb $-0x61, %cl
cmpb $0x19, %cl
ja 0x264f6
movq %r14, %rdi
movq %r15, %rcx
callq 0xa1c0
jmp 0x26501
movq %r14, %rdi
movq %r15, %rcx
callq 0xb6d0
testl %eax, %eax
je 0x2656d
movl %eax, %ebx
movq 0x1aa52(%rip), %r15     # 0x40f60
movslq 0xd670(%r15), %rax
cmpq $0x30, %rax
jg 0x265e6
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%r15,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x11aa8(%rip), %rsi     # 0x37fe1
movl $0x50, %edx
callq 0xa8a0
movslq 0xd670(%r15), %rax
leaq (%rax,%rax,4), %rcx
shlq $0x4, %rcx
leaq (%r15,%rcx), %r14
addq $0xc720, %r14           # imm = 0xC720
movb $0x0, -0x1(%r14)
incl %eax
movl %eax, 0xd670(%r15)
jmp 0x265e2
movsd (%r15), %xmm0
ucomisd %xmm0, %xmm0
jp 0x265f3
movq %xmm0, %rax
btrq $0x3f, %rax
xorl %ebx, %ebx
movabsq $0x7ff0000000000000, %rcx # imm = 0x7FF0000000000000
cmpq %rcx, %rax
jne 0x265e6
leaq 0x135fb(%rip), %rsi     # 0x39b95
movq %r14, %rdi
xorl %eax, %eax
callq 0xa850
movq 0x1a9b5(%rip), %r14     # 0x40f60
leaq 0xc6d0(%r14), %rdi
leaq 0x11a28(%rip), %rsi     # 0x37fe1
movl $0x50, %edx
callq 0xa8a0
movb $0x0, 0xc71f(%r14)
movl $0x1, 0xd670(%r14)
addq $0xc720, %r14           # imm = 0xC720
movl $0x5, %ebx
movb $0x0, (%r14)
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x13574(%rip), %rsi     # 0x39b6e
jmp 0x2659a