// File: /workspace/github_cpp_makefile_star2_O3/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 0x1267b(%rip), %rbx     # 0x40f60
cmpb $0x1, 0xc680(%rbx)
jne 0x2e90d
callq 0xb310
testl %eax, %eax
je 0x2e985
movq %r14, %rdi
movq %rbx, %rsi
callq 0xa500
movb $0x0, 0xc680(%rbx)
cmpb $0x1, 0xc682(%rbx)
jne 0x2e939
callq 0xb310
testl %eax, %eax
je 0x2e98e
movq %r14, %rdi
movq %rbx, %rsi
callq 0xad90
movq %r14, %rdi
callq 0xb0c0
movb $0x0, 0xc682(%rbx)
cmpb $0x1, 0xc681(%rbx)
jne 0x2e9f6
callq 0xb310
testl %eax, %eax
je 0x2e997
movl 0xc684(%rbx), %edi
movsd 0xc078(%rbx), %xmm0
cmpb $0x1, 0xc688(%rbx)
jne 0x2e9e2
xorpd %xmm1, %xmm1
cmpneqsd %xmm1, %xmm0
movq %xmm0, %rsi
andl $0x1, %esi
callq 0xae30
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
jmp 0x2e9e7
leaq 0xc4cd(%rip), %rdi      # 0x3ae59
jmp 0x2e99e
leaq 0xc4e5(%rip), %rdi      # 0x3ae7a
jmp 0x2e99e
leaq 0xc501(%rip), %rdi      # 0x3ae9f
callq 0xa1f0
movq %rax, %rsi
xorl %eax, %eax
callq 0xa850
leaq 0xc6d0(%rbx), %rdi
leaq 0xc6d2(%rip), %rsi      # 0x3b08d
movl $0x50, %edx
callq 0xa8a0
movw $0x0, 0xc71f(%rbx)
movl $0x1, 0xd670(%rbx)
movl $0x5, %eax
jmp 0x2ec46
callq 0xa8b0
movsd %xmm0, 0xc078(%rbx)
movb $0x0, 0xc681(%rbx)
movq 0x1680(%rbx), %rdi
movq %r15, %rax
orq %rdi, %rax
jne 0x2ea3a
leaq 0xc6d0(%rbx), %rdi
leaq 0xc67a(%rip), %rsi      # 0x3b08d
movl $0x50, %edx
callq 0xa8a0
movw $0x0, 0xc71f(%rbx)
movl $0x1, 0xd670(%rbx)
movl $0x4, %eax
jmp 0x2ec46
testq %rdi, %rdi
je 0x2ea54
callq 0xa030
movq %rax, 0x3f0(%rbx)
movq 0x1680(%rbx), %rdx
jmp 0x2ea56
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 0xa340
movl %eax, %r12d
cmpl $0x5, %eax
sete %al
movq 0xef78(%rbx), %rdi
testq %rdi, %rdi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x2eaa6
callq 0xacf0
movq $0x0, 0xef78(%rbx)
movl 0x1b6b4(%rbx), %eax
testq %r15, %r15
je 0x2eae4
testl %eax, %eax
jle 0x2eb2b
callq 0xaf80
leaq 0x1318f(%rip), %r10     # 0x41c50
leaq 0xc3ff(%rip), %rsi      # 0x3aec7
leaq 0xbf63(%rip), %r8       # 0x3aa32
movq %r14, %rdi
xorl %edx, %edx
movl %eax, %ecx
movl $0x34c, %r9d            # imm = 0x34C
xorl %eax, %eax
pushq %r15
pushq %r10
jmp 0x2eb22
testl %eax, %eax
jle 0x2eb2b
callq 0xaf80
movl $0x1698, %r10d          # imm = 0x1698
addq 0x12466(%rip), %r10     # 0x40f60
leaq 0x1314f(%rip), %r11     # 0x41c50
leaq 0xc3e0(%rip), %rsi      # 0x3aee8
leaq 0xbf23(%rip), %r8       # 0x3aa32
movq %r14, %rdi
xorl %edx, %edx
movl %eax, %ecx
movl $0x34d, %r9d            # imm = 0x34D
xorl %eax, %eax
pushq %r10
pushq %r11
callq 0xb470
addq $0x10, %rsp
testl $0xfffffffd, %r12d      # imm = 0xFFFFFFFD
je 0x2eba4
movl $0x3, %eax
cmpl $0x3, %r12d
je 0x2ec46
movslq 0xd670(%rbx), %rax
cmpq $0x30, %rax
jg 0x2ec43
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%rbx,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0xc51f(%rip), %rsi      # 0x3b08d
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 0x2ec43
cmpl $0x0, 0x1694(%rbx)
je 0x2ec2a
leaq 0x130(%rbx), %rdx
movq %r14, %rdi
movq %r13, %rsi
movq %rbx, %rcx
callq 0xac40
movl %eax, %r14d
movl %r12d, %eax
testl %r14d, %r14d
je 0x2ec46
movslq 0xd670(%rbx), %rax
cmpq $0x30, %rax
jg 0x2ec25
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%rbx,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0xc499(%rip), %rsi      # 0x3b08d
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 %r14d, %eax
jmp 0x2ec46
cmpl $0x0, 0x3f8(%rbx)
je 0x2ec43
movl $0x0, 0x3f8(%rbx)
incl 0x3fc(%rbx)
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop