// File: /workspace/github_cpp_makefile_star2_O1/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 0x31e29
movq %r14, %rdi
movq %r12, %rsi
callq 0xa130
testl %eax, %eax
je 0x31e2e
movl %eax, %r13d
jmp 0x32268
xorl %r15d, %r15d
jmp 0x31e34
movl $0x1, %r15d
movq 0x12125(%rip), %rbx     # 0x43f60
cmpl $0x0, 0x1b6b4(%rbx)
jle 0x31e6b
callq 0xaf80
leaq 0xbc13(%rip), %rsi      # 0x3da63
leaq 0xbc2b(%rip), %r8       # 0x3da82
movq %r14, %rdi
xorl %edx, %edx
movl %eax, %ecx
movl $0xdf, %r9d
xorl %eax, %eax
callq 0xb470
cmpl $0x0, 0x1b6b4(%rbx)
jle 0x31e9f
callq 0xaf80
movq %r12, (%rsp)
leaq 0xbc0e(%rip), %rsi      # 0x3da92
leaq 0xbbf7(%rip), %r8       # 0x3da82
movq %r14, %rdi
xorl %edx, %edx
movl %eax, %ecx
movl $0xe0, %r9d
xorl %eax, %eax
callq 0xb470
cmpl $0x0, 0x3fc(%rbx)
jne 0x31f07
cmpq $0x0, 0x400(%rbx)
jne 0x31f07
cmpq $0x0, 0xef70(%rbx)
je 0x32037
cmpl $0x0, 0x1b6b4(%rbx)
jle 0x32265
callq 0xaf80
movq 0xef70(%rbx), %rcx
movq %rcx, (%rsp)
leaq 0xbc1f(%rip), %rsi      # 0x3db03
leaq 0xbb97(%rip), %r8       # 0x3da82
xorl %r13d, %r13d
movq %r14, %rdi
xorl %edx, %edx
movl %eax, %ecx
movl $0x105, %r9d            # imm = 0x105
xorl %eax, %eax
callq 0xb470
jmp 0x32268
leaq 0x130(%rbx), %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq 0xb280
testl %eax, %eax
je 0x31f81
movl %eax, %r13d
movslq 0xd670(%rbx), %rax
cmpq $0x30, %rax
jg 0x32268
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%rbx,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0xc141(%rip), %rsi      # 0x3e08c
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 0x32268
cmpl $0x0, 0x1b6b4(%rbx)
jle 0x31fc1
callq 0xaf80
movl $0x680, %ecx            # imm = 0x680
addq 0x11fc5(%rip), %rcx     # 0x43f60
movq %rcx, (%rsp)
leaq 0xbb13(%rip), %rsi      # 0x3dab9
leaq 0xbad5(%rip), %r8       # 0x3da82
movq %r14, %rdi
xorl %edx, %edx
movl %eax, %ecx
movl $0xef, %r9d
xorl %eax, %eax
callq 0xb470
cmpl $0x0, 0x1b6b4(%rbx)
jle 0x31ff5
callq 0xaf80
movl %r15d, (%rsp)
leaq 0xbb09(%rip), %rsi      # 0x3dae3
leaq 0xbaa1(%rip), %r8       # 0x3da82
movq %r14, %rdi
xorl %edx, %edx
movl %eax, %ecx
movl $0xf0, %r9d
xorl %eax, %eax
callq 0xb470
xorl %r13d, %r13d
testq %r12, %r12
je 0x32268
cmpl $0x0, 0xef90(%rbx)
je 0x32268
movq %r14, %rdi
xorl %esi, %esi
callq 0xa130
testl %eax, %eax
jne 0x31e21
movq %r14, %rdi
xorl %esi, %esi
callq 0xadb0
testl %eax, %eax
jne 0x3227a
xorl %r13d, %r13d
jmp 0x32001
movslq 0xc0f0(%rbx), %rax
testq %rax, %rax
jle 0x32067
xorl %ecx, %ecx
movsd 0xc1c0(%rbx,%rcx,8), %xmm0
movslq 0xc0f4(%rbx,%rcx,4), %rdx
movsd %xmm0, 0x17c0(%rbx,%rdx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x32045
cmpl $0x0, 0x1b6b4(%rbx)
jle 0x320a0
callq 0xaf80
movl 0xc350(%rbx), %ecx
movl %ecx, (%rsp)
leaq 0xbaa6(%rip), %rsi      # 0x3db2b
leaq 0xb9f6(%rip), %r8       # 0x3da82
movq %r14, %rdi
xorl %edx, %edx
movl %eax, %ecx
movl $0x110, %r9d            # imm = 0x110
xorl %eax, %eax
callq 0xb470
cmpl $0x0, 0xc350(%rbx)
jle 0x32207
xorl %r12d, %r12d
cmpl $0x0, 0x1b6b4(%rbx)
jle 0x320e0
callq 0xaf80
movq %r14, %rdi
leaq 0xba9d(%rip), %rsi      # 0x3db65
xorl %edx, %edx
movl %eax, %ecx
leaq 0xb9af(%rip), %r8       # 0x3da82
movl $0x114, %r9d            # imm = 0x114
xorl %eax, %eax
callq 0xb470
cmpl $0x0, 0x1b6b4(%rbx)
jle 0x3211c
callq 0xaf80
movq 0xc358(%rbx,%r12,8), %rcx
movq %rcx, (%rsp)
movq %r14, %rdi
leaq 0xba82(%rip), %rsi      # 0x3db86
xorl %edx, %edx
movl %eax, %ecx
leaq 0xb973(%rip), %r8       # 0x3da82
movl $0x115, %r9d            # imm = 0x115
xorl %eax, %eax
callq 0xb470
movq 0xc358(%rbx,%r12,8), %rsi
movsd 0xc4e8(%rbx,%r12,8), %xmm0
movq %r14, %rdi
callq 0xb6a0
movl %eax, %r15d
testl %eax, %eax
je 0x32198
movslq 0xd670(%rbx), %rax
cmpq $0x30, %rax
jg 0x32195
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%rbx,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
movl $0x50, %edx
leaq 0xbf23(%rip), %rsi      # 0x3e08c
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, %r13d
testl %r15d, %r15d
jne 0x32268
cmpl $0x0, 0x1b6b4(%rbx)
jle 0x321e7
callq 0xaf80
movq 0xc358(%rbx,%r12,8), %rcx
movq %rcx, 0x10(%rsp)
movq %rcx, 0x8(%rsp)
movl %r12d, (%rsp)
movq %r14, %rdi
leaq 0xb9dd(%rip), %rsi      # 0x3dbac
xorl %edx, %edx
movl %eax, %ecx
leaq 0xb8a8(%rip), %r8       # 0x3da82
movl $0x11b, %r9d            # imm = 0x11B
xorl %eax, %eax
callq 0xb470
movq 0xc358(%rbx,%r12,8), %rdi
callq 0xacf0
incq %r12
movslq 0xc350(%rbx), %rax
cmpq %rax, %r12
jl 0x320b0
movl $0x0, 0xc350(%rbx)
cmpl $0x0, 0x1694(%rbx)
je 0x32265
leaq 0x130(%rbx), %r15
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0xa460
movl %eax, %r13d
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0xb600
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0xb5c0
movq %r14, %rdi
movq %rbx, %rsi
callq 0xad40
cmpl $0x3, %r13d
jae 0x31f20
jmp 0x32268
xorl %r13d, %r13d
movl %r13d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %r13d
xorl %eax, %eax
movb %al, 0x1698(%rbx)
movb %al, 0x4f8(%rbx)
movl %eax, 0x1694(%rbx)
movl %eax, 0xef90(%rbx)
movl %eax, 0xef50(%rbx)
movq $0x0, 0xef70(%rbx)
movl %eax, 0xfb28(%rbx)
callq 0xa090
jmp 0x31f20