// File: /workspace/github_cpp_makefile_star2_O2/sundale[P]gcode/rs274ngc/rs274ngc_pre.cc
// Function: Interp::read(char const*)
int Interp::read(const char *command)  //!< may be NULL or a string to read
{
  static char name[] = "Interp::read";
  int read_status;

  if (_setup.probe_flag == ON) {
    CHKS((GET_EXTERNAL_QUEUE_EMPTY() == 0),
        NCE_QUEUE_IS_NOT_EMPTY_AFTER_PROBING);
    set_probe_data(&_setup);
    _setup.probe_flag = OFF;
  }
  if (_setup.toolchange_flag == ON) {
    CHKS((GET_EXTERNAL_QUEUE_EMPTY() == 0),
         _("Queue is not empty after tool change"));
    refresh_actual_position(&_setup);
    load_tool_table();
    _setup.toolchange_flag = OFF;
  }
  if (_setup.input_flag == ON) {
    CHKS((GET_EXTERNAL_QUEUE_EMPTY() == 0),
        NCE_QUEUE_IS_NOT_EMPTY_AFTER_INPUT);
    if (_setup.input_digital == ON) { // we are checking for a digital input
	_setup.parameters[5399] =
	    GET_EXTERNAL_DIGITAL_INPUT(_setup.input_index,
				      (_setup.parameters[5399] != 0.0));
    } else { // checking for analog input
	_setup.parameters[5399] =
	    GET_EXTERNAL_ANALOG_INPUT(_setup.input_index, _setup.parameters[5399]);
    }
    _setup.input_flag = OFF;
  }
  CHKN(((command == NULL) && (_setup.file_pointer == NULL)),
      INTERP_FILE_NOT_OPEN);

  if(_setup.file_pointer)
  {
     _setup.block1.offset = ftell(_setup.file_pointer);
  }

  read_status =
    read_text(command, _setup.file_pointer, _setup.linetext,
              _setup.blocktext, &_setup.line_length);

  if (read_status == INTERP_ERROR && _setup.skipping_to_sub) {
    free(_setup.skipping_to_sub);
    _setup.skipping_to_sub = 0;
  }

  if(command)logDebug("%s:[cmd]:|%s|", name, command);
  else logDebug("%s:|%s|", name, _setup.linetext);

  if ((read_status == INTERP_EXECUTE_FINISH)
      || (read_status == INTERP_OK)) {
    if (_setup.line_length != 0) {
      CHP(parse_line(_setup.blocktext, &(_setup.block1), &_setup));
    }

    else // Blank line (zero length)
    {
          /* RUM - this case reached when the block delete '/' character 
             is used, or READ_FULL_COMMENT is OFF and a comment is the
             only content of a line. 
             If a block o-type is in effect, block->o_number needs to be 
             incremented to allow o-extensions to work. 
             Note that the the block is 'refreshed' by init_block(),
             not created new, so this is a legal operation on block1. */
        if (_setup.block1.o_type != O_none)
        {
            // Clear o_type, this isn't line isn't a command...
            _setup.block1.o_type = 0;
            // increment o_number
            _setup.block1.o_number++;
        }
    }
  } else if (read_status == INTERP_ENDFILE);
  else
    ERP(read_status);
  return read_status;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %r14
movq 0x115db(%rip), %rbx     # 0x3cf60
cmpb $0x1, 0xc680(%rbx)
jne 0x2b9ad
callq 0xc470
testl %eax, %eax
je 0x2ba22
movq %r14, %rdi
movq %rbx, %rsi
callq 0xb540
movb $0x0, 0xc680(%rbx)
cmpb $0x1, 0xc682(%rbx)
jne 0x2b9d9
callq 0xc470
testl %eax, %eax
je 0x2ba2b
movq %r14, %rdi
movq %rbx, %rsi
callq 0xbea0
movq %r14, %rdi
callq 0xc200
movb $0x0, 0xc682(%rbx)
cmpb $0x1, 0xc681(%rbx)
jne 0x2ba8d
callq 0xc470
testl %eax, %eax
je 0x2ba34
movl 0xc684(%rbx), %edi
movsd 0xc078(%rbx), %xmm0
cmpb $0x1, 0xc688(%rbx)
jne 0x2ba79
xorpd %xmm1, %xmm1
cmpneqsd %xmm1, %xmm0
movq %xmm0, %rsi
andl $0x1, %esi
callq 0xbf40
cvtsi2sd %eax, %xmm0
jmp 0x2ba7e
leaq 0xb430(%rip), %rdi      # 0x36e59
jmp 0x2ba3b
leaq 0xb448(%rip), %rdi      # 0x36e7a
jmp 0x2ba3b
leaq 0xb464(%rip), %rdi      # 0x36e9f
callq 0xb220
movq %rax, %rsi
xorl %eax, %eax
callq 0xb8e0
leaq 0xc6d0(%rbx), %rdi
leaq 0xb635(%rip), %rsi      # 0x3708d
pushq $0x50
popq %rdx
callq 0xb940
andw $0x0, 0xc71f(%rbx)
movl $0x1, 0xd670(%rbx)
pushq $0x5
jmp 0x2bbcc
callq 0xb950
movsd %xmm0, 0xc078(%rbx)
movb $0x0, 0xc681(%rbx)
movq 0x1680(%rbx), %rdi
movq %r15, %rax
orq %rdi, %rax
jne 0x2bacb
leaq 0xc6d0(%rbx), %rdi
leaq 0xb5e3(%rip), %rsi      # 0x3708d
pushq $0x50
popq %rdx
callq 0xb940
andw $0x0, 0xc71f(%rbx)
movl $0x1, 0xd670(%rbx)
pushq $0x4
jmp 0x2bbcc
testq %rdi, %rdi
je 0x2bae5
callq 0xb030
movq %rax, 0x3f0(%rbx)
movq 0x1680(%rbx), %rdx
jmp 0x2bae7
xorl %edx, %edx
leaq 0x1698(%rbx), %rcx
leaq 0x4f8(%rbx), %r13
leaq 0x1694(%rbx), %r9
movq %r14, %rdi
movq %r15, %rsi
movq %r13, %r8
callq 0xb380
movl %eax, %r12d
cmpl $0x5, %eax
sete %al
movq 0xef78(%rbx), %rdi
testq %rdi, %rdi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x2bb34
callq 0xbde0
andq $0x0, 0xef78(%rbx)
movl 0x1b6b4(%rbx), %eax
testq %r15, %r15
je 0x2bb72
testl %eax, %eax
jle 0x2bbb7
callq 0xc0b0
leaq 0x121c1(%rip), %r10     # 0x3dd10
leaq 0xb371(%rip), %rsi      # 0x36ec7
leaq 0xaed5(%rip), %r8       # 0x36a32
movq %r14, %rdi
xorl %edx, %edx
movl %eax, %ecx
movl $0x34c, %r9d            # imm = 0x34C
xorl %eax, %eax
pushq %r15
pushq %r10
jmp 0x2bbb0
testl %eax, %eax
jle 0x2bbb7
callq 0xc0b0
movl $0x1698, %r10d          # imm = 0x1698
addq 0x113d8(%rip), %r10     # 0x3cf60
leaq 0x12181(%rip), %r11     # 0x3dd10
leaq 0xb352(%rip), %rsi      # 0x36ee8
leaq 0xae95(%rip), %r8       # 0x36a32
movq %r14, %rdi
xorl %edx, %edx
movl %eax, %ecx
movl $0x34d, %r9d            # imm = 0x34D
xorl %eax, %eax
pushq %r10
pushq %r11
callq 0xc5e0
popq %rax
popq %rcx
testl $0xfffffffd, %r12d      # imm = 0xFFFFFFFD
je 0x2bbe0
cmpl $0x3, %r12d
jne 0x2bc5f
pushq $0x3
popq %r12
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x0, 0x1694(%rbx)
je 0x2bcb6
leaq 0x130(%rbx), %rdx
movq %r14, %rdi
movq %r13, %rsi
movq %rbx, %rcx
callq 0xbd30
testl %eax, %eax
je 0x2bbce
movl %eax, %r14d
movslq 0xd670(%rbx), %rax
cmpq $0x30, %rax
jg 0x2bc57
imulq $0x50, %rax, %rax
leaq (%rbx,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0xb461(%rip), %rsi      # 0x3708d
pushq $0x50
popq %rdx
callq 0xb940
movslq 0xd670(%rbx), %rax
imulq $0x50, %rax, %rcx
xorl %edx, %edx
movb %dl, 0xc71f(%rbx,%rcx)
incl %eax
movl %eax, 0xd670(%rbx)
movb %dl, 0xc720(%rbx,%rcx)
movl %r14d, %r12d
jmp 0x2bbce
movslq 0xd670(%rbx), %rax
cmpq $0x30, %rax
jg 0x2bbce
imulq $0x50, %rax, %rax
leaq (%rbx,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0xb407(%rip), %rsi      # 0x3708d
pushq $0x50
popq %rdx
callq 0xb940
movslq 0xd670(%rbx), %rax
imulq $0x50, %rax, %rcx
xorl %edx, %edx
movb %dl, 0xc71f(%rbx,%rcx)
incl %eax
movl %eax, 0xd670(%rbx)
movb %dl, 0xc720(%rbx,%rcx)
jmp 0x2bbce
cmpl $0x0, 0x3f8(%rbx)
je 0x2bbce
andl $0x0, 0x3f8(%rbx)
incl 0x3fc(%rbx)
jmp 0x2bbce
nop