// File: /workspace/github_cpp_makefile_star2_O1/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), %rcx
movzbl (%rsi,%rcx), %eax
testl %eax, %eax
je 0x294e5
cmpl $0x23, %eax
je 0x294fc
cmpl $0x5b, %eax
jne 0x2950c
movq %r14, %rdi
movq %r15, %rcx
callq 0xafc0
jmp 0x295b2
leaq 0x13663(%rip), %rdi     # 0x3cb4f
callq 0xa1f0
movq %r14, %rdi
movq %rax, %rsi
jmp 0x29655
movq %r14, %rdi
movq %r15, %rcx
callq 0xa970
jmp 0x295b2
movsbl 0x1(%rsi,%rcx), %edi
incq %rcx
cmpl $0x2b, %eax
jne 0x2954a
testb %dil, %dil
je 0x2954a
leal -0x3a(%rdi), %r9d
cmpl $-0xa, %r9d
setb %r9b
cmpb $0x2e, %dil
setne %r10b
andb %r9b, %r10b
cmpb $0x1, %r10b
jne 0x2954a
movl %ecx, (%rdx)
movq %r14, %rdi
movq %r15, %rcx
callq 0xaf10
jmp 0x295b2
cmpl $0x2d, %eax
jne 0x2959a
testb %dil, %dil
je 0x2959a
movl %edi, %r9d
addl $-0x3a, %r9d
cmpl $-0xa, %r9d
setb %r9b
cmpb $0x2e, %dil
setne %dil
andb %r9b, %dil
cmpb $0x1, %dil
jne 0x2959a
movl %ecx, (%rdx)
movq %r14, %rdi
movq %r15, %rcx
callq 0xaf10
testl %eax, %eax
jne 0x295b6
movsd (%r15), %xmm0
xorps 0xd97f(%rip), %xmm0     # 0x36f10
movlps %xmm0, (%r15)
jmp 0x29621
addb $-0x61, %al
movq %r14, %rdi
movq %r15, %rcx
cmpb $0x19, %al
ja 0x295ad
callq 0xa1c0
jmp 0x295b2
callq 0xb6d0
testl %eax, %eax
je 0x29621
movl %eax, %ebx
movq 0x1a9a1(%rip), %r15     # 0x43f60
movslq 0xd670(%r15), %rax
cmpq $0x30, %rax
jg 0x296a9
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%r15,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x119f7(%rip), %rsi     # 0x3afe1
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 0x296a5
movsd (%r15), %xmm0
ucomisd %xmm0, %xmm0
jp 0x296b6
movq %xmm0, %rax
btrq $0x3f, %rax
xorl %ebx, %ebx
movabsq $0x7ff0000000000000, %rcx # imm = 0x7FF0000000000000
cmpq %rcx, %rax
jne 0x296a9
leaq 0x1354e(%rip), %rsi     # 0x3cba0
movq %r14, %rdi
xorl %eax, %eax
callq 0xa850
movq 0x1a8fd(%rip), %r14     # 0x43f60
movl $0x0, 0xd670(%r14)
leaq 0xc6d0(%r14), %rdi
leaq 0x11965(%rip), %rsi     # 0x3afe1
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 0x134bc(%rip), %rsi     # 0x3cb79
jmp 0x29652
nop