// File: /workspace/github_cpp_makefile_star2_O2/sundale[P]gcode/rs274ngc/rs274ngc_pre.cc
// Function: Interp::execute(char const*)
int Interp::execute(const char *command)
{
  int status;
  int n;
  int MDImode = 0;

  if (NULL != command) {
    MDImode = 1;
    status = read(command);
    if (status != INTERP_OK) {
      return status;
    }
  }

  logDebug("MDImode = 1");
  logDebug("Interp::execute(%s)", command);
  // process control functions -- will skip if skipping
  //  if (_setup.block1.o_number != 0)
  if ((_setup.block1.o_number != 0) || (_setup.block1.o_name != 0) )
    {
      CHP(convert_control_functions(&(_setup.block1), &_setup));

#if 1
      // let MDI code call subroutines.
      // !!!KL not clear what happens if last execution failed while in
      // !!!KL a subroutine

      // NOTE: the last executed file will still be open, because "close"
      // is really a lazy close.
    
      logDebug("!!!KL Open file is:%s:", _setup.filename);
      logDebug("MDImode = %d", MDImode);
      while(MDImode && _setup.call_level) // we are still in a subroutine
      {
          status = read(0);  // reads from current file and calls parse
          if (status != INTERP_OK)
	    {
               return status;
	    }
          status = execute();  // special handling for mdi errors
          if (status != INTERP_OK) {
               reset();
               CHP(status);
          }
      }
#endif
      return INTERP_OK;
    }

  // skip if skipping
  if(_setup.skipping_o)
    {
      logDebug("skipping to line: %d", _setup.skipping_o);
      return INTERP_OK;
    }

  for (n = 0; n < _setup.parameter_occurrence; n++)
  {  // copy parameter settings from parameter buffer into parameter table
    _setup.parameters[_setup.parameter_numbers[n]]
          = _setup.parameter_values[n];
  }

  logDebug("_setup.named_parameter_occurrence = %d",
           _setup.named_parameter_occurrence);
  for (n = 0; n < _setup.named_parameter_occurrence; n++)
  {  // copy parameter settings from parameter buffer into parameter table

      logDebug("storing param");
      logDebug("storing param:|%s|", _setup.named_parameters[n]);
    CHP(store_named_param(_setup.named_parameters[n],
                          _setup.named_parameter_values[n]));

    // free the string
      logDebug("freeing param[%d]:|%s|:0x%x", n, _setup.named_parameters[n],
               _setup.named_parameters[n]);
    free(_setup.named_parameters[n]);
  }

  _setup.named_parameter_occurrence = 0;

  if (_setup.line_length != 0) {        /* line not blank */
    status = execute_block(&(_setup.block1), &_setup);
    write_g_codes(&(_setup.block1), &_setup);
    write_m_codes(&(_setup.block1), &_setup);
    write_settings(&_setup);
    if ((status != INTERP_OK) &&
        (status != INTERP_EXECUTE_FINISH) && (status != INTERP_EXIT))
      ERP(status);
  } else                        /* blank line is OK */
    status = INTERP_OK;
  return status;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r12
movq %rdi, %r14
testq %rsi, %rsi
je 0x2b58f
movq %r14, %rdi
movq %r12, %rsi
callq 0xb140
testl %eax, %eax
je 0x2b594
movl %eax, %r15d
jmp 0x2b94b
xorl %r13d, %r13d
jmp 0x2b598
pushq $0x1
popq %r13
movq 0x119c1(%rip), %rbx     # 0x3cf60
cmpl $0x0, 0x1b6b4(%rbx)
jle 0x2b603
callq 0xc0b0
leaq 0xb45f(%rip), %rsi      # 0x36a13
leaq 0xb477(%rip), %r8       # 0x36a32
movq %r14, %rdi
xorl %edx, %edx
movl %eax, %ecx
movl $0xdf, %r9d
xorl %eax, %eax
callq 0xc5e0
cmpl $0x0, 0x1b6b4(%rbx)
jle 0x2b603
callq 0xc0b0
movq %r12, (%rsp)
leaq 0xb45a(%rip), %rsi      # 0x36a42
leaq 0xb443(%rip), %r8       # 0x36a32
movq %r14, %rdi
xorl %edx, %edx
movl %eax, %ecx
movl $0xe0, %r9d
xorl %eax, %eax
callq 0xc5e0
cmpl $0x0, 0x3fc(%rbx)
jne 0x2b66b
cmpq $0x0, 0x400(%rbx)
jne 0x2b66b
cmpq $0x0, 0xef70(%rbx)
je 0x2b78c
cmpl $0x0, 0x1b6b4(%rbx)
jle 0x2b948
callq 0xc0b0
movq 0xef70(%rbx), %rcx
movq %rcx, (%rsp)
leaq 0xb46b(%rip), %rsi      # 0x36ab3
leaq 0xb3e3(%rip), %r8       # 0x36a32
xorl %r15d, %r15d
movq %r14, %rdi
xorl %edx, %edx
movl %eax, %ecx
movl $0x105, %r9d            # imm = 0x105
xorl %eax, %eax
callq 0xc5e0
jmp 0x2b94b
leaq 0x130(%rbx), %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq 0xc3e0
testl %eax, %eax
je 0x2b6db
movl %eax, %r15d
movslq 0xd670(%rbx), %rax
cmpq $0x30, %rax
jg 0x2b94b
imulq $0x50, %rax, %rax
leaq (%rbx,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0xb991(%rip), %rsi      # 0x3703c
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 0x2b94b
cmpl $0x0, 0x1b6b4(%rbx)
jle 0x2b74a
callq 0xc0b0
leaq 0x680(%rbx), %rcx
movq %rcx, (%rsp)
leaq 0xb36e(%rip), %rsi      # 0x36a69
leaq 0xb330(%rip), %r8       # 0x36a32
movq %r14, %rdi
xorl %edx, %edx
movl %eax, %ecx
movl $0xef, %r9d
xorl %eax, %eax
callq 0xc5e0
cmpl $0x0, 0x1b6b4(%rbx)
jle 0x2b74a
callq 0xc0b0
movl %r13d, (%rsp)
leaq 0xb364(%rip), %rsi      # 0x36a93
leaq 0xb2fc(%rip), %r8       # 0x36a32
movq %r14, %rdi
xorl %edx, %edx
movl %eax, %ecx
movl $0xf0, %r9d
xorl %eax, %eax
callq 0xc5e0
xorl %r15d, %r15d
testq %r12, %r12
je 0x2b94b
cmpl $0x0, 0xef90(%rbx)
je 0x2b94b
movq %r14, %rdi
xorl %esi, %esi
callq 0xb140
testl %eax, %eax
jne 0x2b587
movq %r14, %rdi
xorl %esi, %esi
callq 0xbec0
testl %eax, %eax
jne 0x2b95d
xorl %r15d, %r15d
jmp 0x2b756
movl 0xc0f0(%rbx), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
cmpq %rcx, %rax
je 0x2b7bd
movsd 0xc1c0(%rbx,%rcx,8), %xmm0
movslq 0xc0f4(%rbx,%rcx,4), %rdx
movsd %xmm0, 0x17c0(%rbx,%rdx,8)
incq %rcx
jmp 0x2b799
cmpl $0x0, 0x1b6b4(%rbx)
jle 0x2b7f6
callq 0xc0b0
movl 0xc350(%rbx), %ecx
movl %ecx, (%rsp)
leaq 0xb300(%rip), %rsi      # 0x36adb
leaq 0xb250(%rip), %r8       # 0x36a32
movq %r14, %rdi
xorl %edx, %edx
movl %eax, %ecx
movl $0x110, %r9d            # imm = 0x110
xorl %eax, %eax
callq 0xc5e0
leaq 0xb235(%rip), %r13      # 0x36a32
xorl %r12d, %r12d
movslq 0xc350(%rbx), %rax
cmpq %rax, %r12
jge 0x2b8ed
cmpl $0x0, 0x1b6b4(%rbx)
jle 0x2b874
callq 0xc0b0
movq %r14, %rdi
leaq 0xb2ed(%rip), %rsi      # 0x36b15
xorl %edx, %edx
movl %eax, %ecx
movq %r13, %r8
movl $0x114, %r9d            # imm = 0x114
xorl %eax, %eax
callq 0xc5e0
cmpl $0x0, 0x1b6b4(%rbx)
jle 0x2b874
callq 0xc0b0
movq 0xc358(%rbx,%r12,8), %rcx
movq %rcx, (%rsp)
movq %r14, %rdi
leaq 0xb2d6(%rip), %rsi      # 0x36b36
xorl %edx, %edx
movl %eax, %ecx
movq %r13, %r8
movl $0x115, %r9d            # imm = 0x115
xorl %eax, %eax
callq 0xc5e0
movq 0xc358(%rbx,%r12,8), %rsi
movsd 0xc4e8(%rbx,%r12,8), %xmm0
movq %r14, %rdi
callq 0xc810
testl %eax, %eax
jne 0x2b681
cmpl $0x0, 0x1b6b4(%rbx)
jle 0x2b8d8
callq 0xc0b0
movq 0xc358(%rbx,%r12,8), %rcx
movq %rcx, 0x10(%rsp)
movq %rcx, 0x8(%rsp)
movl %r12d, (%rsp)
movq %r14, %rdi
leaq 0xb298(%rip), %rsi      # 0x36b5c
xorl %edx, %edx
movl %eax, %ecx
movq %r13, %r8
movl $0x11b, %r9d            # imm = 0x11B
xorl %eax, %eax
callq 0xc5e0
movq 0xc358(%rbx,%r12,8), %rdi
callq 0xbde0
incq %r12
jmp 0x2b800
andl $0x0, 0xc350(%rbx)
cmpl $0x0, 0x1694(%rbx)
je 0x2b948
leaq 0x130(%rbx), %r12
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0xb4a0
movl %eax, %r15d
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0xc770
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0xc730
movq %r14, %rdi
movq %rbx, %rsi
callq 0xbe40
cmpl $0x3, %r15d
jae 0x2b684
jmp 0x2b94b
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %r15d
callq 0xb6a0
jmp 0x2b684