// File: /workspace/github_cpp_makefile_star2_O1/sundale[P]gcode/rs274ngc/interp_read.cc
// Function: Interp::read_real_expression(char*, int*, double*, double*)
int Interp::read_real_expression(char *line,     //!< string: line of RS274/NGC code being processed
                                int *counter,   //!< pointer to a counter for position on the line 
                                double *value,  //!< pointer to double to be computed              
                                double *parameters)     //!< array of system parameters                    
{
  double values[MAX_STACK];
  int operators[MAX_STACK];
  int stack_index;

  CHKS((line[*counter] != '['), NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED);
  *counter = (*counter + 1);
  CHP(read_real_value(line, counter, values, parameters));
  CHP(read_operation(line, counter, operators));
  stack_index = 1;
  for (; operators[0] != RIGHT_BRACKET;) {
    CHP(read_real_value(line, counter, values + stack_index, parameters));
    CHP(read_operation(line, counter, operators + stack_index));
    if (precedence(operators[stack_index]) >
        precedence(operators[stack_index - 1]))
      stack_index++;
    else {                      /* precedence of latest operator is <= previous precedence */

      for (; precedence(operators[stack_index]) <=
           precedence(operators[stack_index - 1]);) {
        CHP(execute_binary((values + stack_index - 1),
                           operators[stack_index - 1],
                           (values + stack_index)));
        operators[stack_index - 1] = operators[stack_index];
        if ((stack_index > 1) &&
            (precedence(operators[stack_index - 1]) <=
             precedence(operators[stack_index - 2])))
          stack_index--;
        else
          break;
      }
    }
  }
  *value = values[0];
  return INTERP_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdi, %r13
movslq (%rdx), %rax
cmpb $0x5b, (%rsi,%rax)
jne 0x298be
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
incl %eax
movl %eax, (%rdx)
leaq -0xc0(%rbp), %rcx
movq %r13, %rdi
callq 0xaf10
movl %eax, -0x2c(%rbp)
testl %eax, %eax
je 0x2991d
movq 0x1a703(%rip), %rbx     # 0x43f60
movslq 0xd670(%rbx), %rax
cmpq $0x30, %rax
jg 0x299ac
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%rbx,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x117fb(%rip), %rsi     # 0x3b083
movl $0x50, %edx
callq 0xa8a0
movslq 0xd670(%rbx), %rax
leaq (%rax,%rax,4), %rcx
shlq $0x4, %rcx
xorl %edx, %edx
movb %dl, 0xc71f(%rbx,%rcx)
incl %eax
movl %eax, 0xd670(%rbx)
movb %dl, 0xc720(%rbx,%rcx)
jmp 0x299ac
leaq 0x10992(%rip), %rdi     # 0x3a257
callq 0xa1f0
movq %r13, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xa850
movq 0x1a682(%rip), %rbx     # 0x43f60
movl $0x0, 0xd670(%rbx)
leaq 0xc6d0(%rbx), %rdi
leaq 0x1178d(%rip), %rsi     # 0x3b083
movl $0x50, %edx
callq 0xa8a0
movw $0x0, 0xc71f(%rbx)
movl $0x1, 0xd670(%rbx)
movl $0x5, %eax
jmp 0x299af
leaq -0x80(%rbp), %rcx
movq %r13, %rdi
movq %r12, %rsi
movq %r15, -0x48(%rbp)
movq %r15, %rdx
callq 0xb000
movl %eax, %r15d
testl %eax, %eax
movq %r12, -0x50(%rbp)
je 0x299a7
movq %rbx, %r12
movq 0x1a618(%rip), %rbx     # 0x43f60
movslq 0xd670(%rbx), %rax
cmpq $0x30, %rax
jg 0x299a0
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%rbx,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x11714(%rip), %rsi     # 0x3b083
movl $0x50, %edx
callq 0xa8a0
movslq 0xd670(%rbx), %rax
leaq (%rax,%rax,4), %rcx
shlq $0x4, %rcx
xorl %edx, %edx
movb %dl, 0xc71f(%rbx,%rcx)
incl %eax
movl %eax, 0xd670(%rbx)
movb %dl, 0xc720(%rbx,%rcx)
movl %r15d, -0x2c(%rbp)
movq %r12, %rbx
testl %r15d, %r15d
je 0x299c1
movl -0x2c(%rbp), %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, -0x88(%rbp)
cmpl $0xa, -0x80(%rbp)
movq -0x48(%rbp), %rdx
jne 0x299e9
movsd -0xc0(%rbp), %xmm0
movq -0x88(%rbp), %rax
movsd %xmm0, (%rax)
xorl %eax, %eax
jmp 0x299af
movq 0x1a570(%rip), %r14     # 0x43f60
movl $0x1, %eax
movq %r13, -0x58(%rbp)
movq %rbx, -0x40(%rbp)
movl %eax, -0x30(%rbp)
cltq
movq %rax, -0x38(%rbp)
leaq -0xc0(,%rax,8), %r12
addq %rbp, %r12
movq %r13, %rdi
movq -0x50(%rbp), %rsi
movq %r12, %rcx
movq %rbx, %r8
callq 0xaf10
movl %eax, %r15d
testl %eax, %eax
je 0x29a89
movslq 0xd670(%r14), %rax
cmpq $0x30, %rax
jg 0x29a85
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%r14,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
movl $0x50, %edx
leaq 0x1162d(%rip), %rsi     # 0x3b083
callq 0xa8a0
movslq 0xd670(%r14), %rax
leaq (%rax,%rax,4), %rcx
shlq $0x4, %rcx
xorl %edx, %edx
movb %dl, 0xc71f(%r14,%rcx)
incl %eax
movl %eax, 0xd670(%r14)
movb %dl, 0xc720(%r14,%rcx)
movl %r15d, -0x2c(%rbp)
testl %r15d, %r15d
jne 0x299ac
movq -0x38(%rbp), %rax
leaq -0x80(,%rax,4), %rcx
addq %rbp, %rcx
movq %r13, %rdi
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
callq 0xb000
movl %eax, %r15d
testl %eax, %eax
je 0x29b17
movslq 0xd670(%r14), %rax
cmpq $0x30, %rax
jg 0x29b13
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%r14,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
movl $0x50, %edx
leaq 0x1159f(%rip), %rsi     # 0x3b083
callq 0xa8a0
movslq 0xd670(%r14), %rax
leaq (%rax,%rax,4), %rcx
shlq $0x4, %rcx
xorl %edx, %edx
movb %dl, 0xc71f(%r14,%rcx)
incl %eax
movl %eax, 0xd670(%r14)
movb %dl, 0xc720(%r14,%rcx)
movl %r15d, -0x2c(%rbp)
testl %r15d, %r15d
jne 0x299ac
movq %r12, -0x60(%rbp)
movq -0x38(%rbp), %r12
movl -0x80(%rbp,%r12,4), %esi
movq %r13, %rdi
callq 0xa110
movl %eax, %r14d
movl -0x84(%rbp,%r12,4), %esi
movq %r13, %rdi
callq 0xa110
cmpl %eax, %r14d
jle 0x29b57
movl -0x30(%rbp), %eax
incl %eax
jmp 0x29c79
testl %r12d, %r12d
movl %r12d, %ecx
movl $0x1, %eax
cmovgl %eax, %ecx
movl %ecx, -0x30(%rbp)
movl -0x80(%rbp,%r12,4), %ebx
movq %r13, %rdi
movl %ebx, %esi
callq 0xa110
movl %eax, %r15d
movq %r12, -0x38(%rbp)
movl -0x84(%rbp,%r12,4), %r14d
movq %r13, %rdi
movl %r14d, %esi
callq 0xa110
cmpl %eax, %r15d
jg 0x29c71
movq -0x60(%rbp), %rcx
leaq -0x8(%rcx), %r15
movq %r13, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0xa250
movl %eax, %r12d
testl %eax, %eax
movq 0x1a3a4(%rip), %r14     # 0x43f60
je 0x29c1d
movslq 0xd670(%r14), %rax
cmpq $0x30, %rax
jg 0x29c19
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%r14,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
movl $0x50, %edx
leaq 0x11499(%rip), %rsi     # 0x3b083
callq 0xa8a0
movslq 0xd670(%r14), %rax
leaq (%rax,%rax,4), %rcx
shlq $0x4, %rcx
xorl %edx, %edx
movb %dl, 0xc71f(%r14,%rcx)
incl %eax
movl %eax, 0xd670(%r14)
movb %dl, 0xc720(%r14,%rcx)
movl %r12d, -0x2c(%rbp)
testl %r12d, %r12d
jne 0x299ac
movq -0x38(%rbp), %r12
movl %ebx, -0x84(%rbp,%r12,4)
cmpq $0x2, %r12
jl 0x29c93
movq -0x58(%rbp), %r13
movq %r13, %rdi
movl %ebx, %esi
callq 0xa110
movl %eax, %r14d
movl -0x88(%rbp,%r12,4), %esi
movq %r13, %rdi
callq 0xa110
decq %r12
movq %r15, -0x60(%rbp)
cmpl %eax, %r14d
jle 0x29b68
incl %r12d
movl %r12d, %eax
jmp 0x29c75
movq -0x38(%rbp), %rax
movq -0x40(%rbp), %rbx
movq 0x1a2e0(%rip), %r14     # 0x43f60
cmpl $0xa, -0x80(%rbp)
movq -0x48(%rbp), %rdx
jne 0x299fd
jmp 0x299d2
movq -0x58(%rbp), %r13
movq -0x40(%rbp), %rbx
movl -0x30(%rbp), %eax
jmp 0x29c80