// File: /workspace/github_cpp_makefile_star2_O2/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 0x23c3d
cmpl $0x23, %ecx
je 0x23c54
cmpl $0x5b, %ecx
jne 0x23c64
movq %r14, %rdi
movq %r15, %rcx
callq 0xc0f0
jmp 0x23d0f
leaq 0x11f00(%rip), %rdi     # 0x35b44
callq 0xb220
movq %r14, %rdi
movq %rax, %rsi
jmp 0x23da1
movq %r14, %rdi
movq %r15, %rcx
callq 0xba20
jmp 0x23d0f
movsbl 0x1(%rsi,%rax), %edi
incq %rax
cmpl $0x2b, %ecx
jne 0x23ca1
testb %dil, %dil
je 0x23ca1
movl %edi, %ecx
addl $-0x3a, %ecx
cmpl $-0xa, %ecx
setb %cl
cmpb $0x2e, %dil
setne %dil
andb %cl, %dil
cmpb $0x1, %dil
jne 0x23d04
movl %eax, (%rdx)
movq %r14, %rdi
movq %r15, %rcx
callq 0xc040
jmp 0x23d0f
cmpl $0x2d, %ecx
jne 0x23cef
testb %dil, %dil
je 0x23cef
movl %edi, %ecx
addl $-0x3a, %ecx
cmpl $-0xa, %ecx
setb %cl
cmpb $0x2e, %dil
setne %dil
andb %cl, %dil
cmpb $0x1, %dil
jne 0x23d04
movl %eax, (%rdx)
movq %r14, %rdi
movq %r15, %rcx
callq 0xc040
testl %eax, %eax
jne 0x23d13
movsd (%r15), %xmm0
xorpd 0xc22b(%rip), %xmm0     # 0x2ff10
movlpd %xmm0, (%r15)
jmp 0x23d76
addb $-0x61, %cl
cmpb $0x19, %cl
ja 0x23d04
movq %r14, %rdi
movq %r15, %rcx
callq 0xb1e0
jmp 0x23d0f
movq %r14, %rdi
movq %r15, %rcx
callq 0xc840
testl %eax, %eax
je 0x23d71
movl %eax, %ebx
movq 0x19244(%rip), %r15     # 0x3cf60
movslq 0xd670(%r15), %rax
cmpq $0x30, %rax
jg 0x23de6
imulq $0x50, %rax, %rax
leaq (%r15,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x1029e(%rip), %rsi     # 0x33fe1
pushq $0x50
popq %rdx
callq 0xb940
movslq 0xd670(%r15), %rax
imulq $0x50, %rax, %rcx
leaq (%r15,%rcx), %r14
addq $0xc720, %r14           # imm = 0xC720
movb $0x0, -0x1(%r14)
incl %eax
movl %eax, 0xd670(%r15)
jmp 0x23de2
movsd (%r15), %xmm0
ucomisd %xmm0, %xmm0
jp 0x23df3
movq %xmm0, %rax
btrq $0x3f, %rax
xorl %ebx, %ebx
movabsq $0x7ff0000000000000, %rcx # imm = 0x7FF0000000000000
cmpq %rcx, %rax
jne 0x23de6
leaq 0x11df7(%rip), %rsi     # 0x35b95
movq %r14, %rdi
xorl %eax, %eax
callq 0xb8e0
movq 0x191b1(%rip), %r14     # 0x3cf60
leaq 0xc6d0(%r14), %rdi
leaq 0x10224(%rip), %rsi     # 0x33fe1
pushq $0x50
popq %rdx
callq 0xb940
movb $0x0, 0xc71f(%r14)
movl $0x1, 0xd670(%r14)
addq $0xc720, %r14           # imm = 0xC720
pushq $0x5
popq %rbx
movb $0x0, (%r14)
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x11d74(%rip), %rsi     # 0x35b6e
jmp 0x23d9e