// File: 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
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x24(%rbp)
xorl %eax, %eax
cmpq -0x18(%rbp), %rax
je 0x70fd1
movq -0x38(%rbp), %rdi
movl $0x1, -0x24(%rbp)
movq -0x18(%rbp), %rsi
callq 0x10210
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x70fcf
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x7180c
jmp 0x70fd1
jmp 0x70fd3
xorl %eax, %eax
movq 0x15f84(%rip), %rcx     # 0x86f60
cmpl 0x1b6b4(%rcx), %eax
jge 0x7100c
callq 0x11950
movq -0x38(%rbp), %rdi
movl %eax, %ecx
leaq 0xe8c5(%rip), %rsi      # 0x7f8bb
xorl %edx, %edx
leaq 0xe8db(%rip), %r8       # 0x7f8da
movl $0xdf, %r9d
movb $0x0, %al
callq 0x12050
jmp 0x7100e
jmp 0x71010
xorl %eax, %eax
movq 0x15f47(%rip), %rcx     # 0x86f60
cmpl 0x1b6b4(%rcx), %eax
jge 0x71051
callq 0x11950
movq -0x38(%rbp), %rdi
movl %eax, %ecx
movq -0x18(%rbp), %rax
leaq 0xe8b3(%rip), %rsi      # 0x7f8ea
xorl %edx, %edx
leaq 0xe89a(%rip), %r8       # 0x7f8da
movl $0xe0, %r9d
movq %rax, (%rsp)
movb $0x0, %al
callq 0x12050
jmp 0x71053
movq 0x15f06(%rip), %rax     # 0x86f60
cmpl $0x0, 0x3fc(%rax)
jne 0x71078
movq 0x15ef6(%rip), %rax     # 0x86f60
cmpq $0x0, 0x400(%rax)
je 0x71344
jmp 0x7107a
movq -0x38(%rbp), %rdi
movq 0x15edb(%rip), %rdx     # 0x86f60
movq %rdx, %rsi
addq $0x130, %rsi            # imm = 0x130
callq 0x11db0
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
je 0x7115e
jmp 0x710a3
movq 0x15eb6(%rip), %rax     # 0x86f60
cmpl $0x31, 0xd670(%rax)
jge 0x71153
movq 0x15ea2(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rax
movq 0x15e94(%rip), %rdi     # 0x86f60
addq $0xc6d0, %rdi           # imm = 0xC6D0
imulq $0x50, %rax, %rax
addq %rax, %rdi
leaq 0xe830(%rip), %rsi      # 0x7f911
movl $0x50, %edx
callq 0x10840
movq 0x15e6e(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x15e60(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x4f(%rax)
movq 0x15e48(%rip), %rax     # 0x86f60
movl 0xd670(%rax), %ecx
addl $0x1, %ecx
movq 0x15e38(%rip), %rax     # 0x86f60
movl %ecx, 0xd670(%rax)
movq 0x15e2b(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x15e1d(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, (%rax)
movl -0x28(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x7180c
jmp 0x71160
jmp 0x71162
xorl %eax, %eax
movq 0x15df5(%rip), %rcx     # 0x86f60
cmpl 0x1b6b4(%rcx), %eax
jge 0x711ac
callq 0x11950
movq -0x38(%rbp), %rdi
movl %eax, %ecx
leaq 0xe7ae(%rip), %rsi      # 0x7f933
xorl %edx, %edx
leaq 0xe74c(%rip), %r8       # 0x7f8da
movl $0xef, %r9d
movq 0x15dc5(%rip), %rax     # 0x86f60
addq $0x680, %rax            # imm = 0x680
movq %rax, (%rsp)
movb $0x0, %al
callq 0x12050
jmp 0x711ae
jmp 0x711b0
xorl %eax, %eax
movq 0x15da7(%rip), %rcx     # 0x86f60
cmpl 0x1b6b4(%rcx), %eax
jge 0x711ef
callq 0x11950
movq -0x38(%rbp), %rdi
movl %eax, %ecx
movl -0x24(%rbp), %eax
leaq 0xe787(%rip), %rsi      # 0x7f95d
xorl %edx, %edx
leaq 0xe6fb(%rip), %r8       # 0x7f8da
movl $0xf0, %r9d
movl %eax, (%rsp)
movb $0x0, %al
callq 0x12050
jmp 0x711f1
jmp 0x711f3
xorl %eax, %eax
cmpl $0x0, -0x24(%rbp)
movb %al, -0x39(%rbp)
je 0x71212
movq 0x15d5b(%rip), %rax     # 0x86f60
cmpl $0x0, 0xef90(%rax)
setne %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x7121e
jmp 0x71338
movq -0x38(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x10210
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x7123f
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x7180c
movq -0x38(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x11630
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x71333
movq -0x38(%rbp), %rdi
callq 0x10a10
movl -0x1c(%rbp), %eax
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x7132f
jmp 0x71274
movq 0x15ce5(%rip), %rax     # 0x86f60
cmpl $0x31, 0xd670(%rax)
jge 0x71324
movq 0x15cd1(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rax
movq 0x15cc3(%rip), %rdi     # 0x86f60
addq $0xc6d0, %rdi           # imm = 0xC6D0
imulq $0x50, %rax, %rax
addq %rax, %rdi
leaq 0xe65f(%rip), %rsi      # 0x7f911
movl $0x50, %edx
callq 0x10840
movq 0x15c9d(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x15c8f(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x4f(%rax)
movq 0x15c77(%rip), %rax     # 0x86f60
movl 0xd670(%rax), %ecx
addl $0x1, %ecx
movq 0x15c67(%rip), %rax     # 0x86f60
movl %ecx, 0xd670(%rax)
movq 0x15c5a(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x15c4c(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, (%rax)
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x7180c
jmp 0x71331
jmp 0x71333
jmp 0x711f3
movl $0x0, -0x4(%rbp)
jmp 0x7180c
movq 0x15c15(%rip), %rax     # 0x86f60
cmpq $0x0, 0xef70(%rax)
je 0x713b0
jmp 0x71357
xorl %eax, %eax
movq 0x15c00(%rip), %rcx     # 0x86f60
cmpl 0x1b6b4(%rcx), %eax
jge 0x713a2
callq 0x11950
movq -0x38(%rbp), %rdi
movl %eax, %ecx
movq 0x15be6(%rip), %rax     # 0x86f60
movq 0xef70(%rax), %rax
leaq 0xe5f5(%rip), %rsi      # 0x7f97d
xorl %edx, %edx
leaq 0xe549(%rip), %r8       # 0x7f8da
movl $0x105, %r9d            # imm = 0x105
movq %rax, (%rsp)
movb $0x0, %al
callq 0x12050
jmp 0x713a4
movl $0x0, -0x4(%rbp)
jmp 0x7180c
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq 0x15b9f(%rip), %rcx     # 0x86f60
cmpl 0xc0f0(%rcx), %eax
jge 0x7140b
movslq -0x20(%rbp), %rcx
movq 0x15b8c(%rip), %rax     # 0x86f60
movsd 0xc1c0(%rax,%rcx,8), %xmm0
movslq -0x20(%rbp), %rcx
movq 0x15b78(%rip), %rax     # 0x86f60
movslq 0xc0f4(%rax,%rcx,4), %rcx
movq 0x15b69(%rip), %rax     # 0x86f60
movsd %xmm0, 0x17c0(%rax,%rcx,8)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x713b7
jmp 0x7140d
xorl %eax, %eax
movq 0x15b4a(%rip), %rcx     # 0x86f60
cmpl 0x1b6b4(%rcx), %eax
jge 0x71456
callq 0x11950
movq -0x38(%rbp), %rdi
movl %eax, %ecx
movq 0x15b30(%rip), %rax     # 0x86f60
movl 0xc350(%rax), %eax
leaq 0xe568(%rip), %rsi      # 0x7f9a5
xorl %edx, %edx
leaq 0xe494(%rip), %r8       # 0x7f8da
movl $0x110, %r9d            # imm = 0x110
movl %eax, (%rsp)
movb $0x0, %al
callq 0x12050
jmp 0x71458
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq 0x15af7(%rip), %rcx     # 0x86f60
cmpl 0xc350(%rcx), %eax
jge 0x7169f
jmp 0x71477
xorl %eax, %eax
movq 0x15ae0(%rip), %rcx     # 0x86f60
cmpl 0x1b6b4(%rcx), %eax
jge 0x714b0
callq 0x11950
movq -0x38(%rbp), %rdi
movl %eax, %ecx
leaq 0xe545(%rip), %rsi      # 0x7f9df
xorl %edx, %edx
leaq 0xe437(%rip), %r8       # 0x7f8da
movl $0x114, %r9d            # imm = 0x114
movb $0x0, %al
callq 0x12050
jmp 0x714b2
jmp 0x714b4
xorl %eax, %eax
movq 0x15aa3(%rip), %rcx     # 0x86f60
cmpl 0x1b6b4(%rcx), %eax
jge 0x71504
callq 0x11950
movq -0x38(%rbp), %rdi
movl %eax, %ecx
movslq -0x20(%rbp), %rdx
movq 0x15a85(%rip), %rax     # 0x86f60
movq 0xc358(%rax,%rdx,8), %rax
leaq 0xe516(%rip), %rsi      # 0x7fa00
xorl %edx, %edx
leaq 0xe3e7(%rip), %r8       # 0x7f8da
movl $0x115, %r9d            # imm = 0x115
movq %rax, (%rsp)
movb $0x0, %al
callq 0x12050
jmp 0x71506
jmp 0x71508
movq -0x38(%rbp), %rdi
movslq -0x20(%rbp), %rcx
movq 0x15a49(%rip), %rax     # 0x86f60
movq 0xc358(%rax,%rcx,8), %rsi
movslq -0x20(%rbp), %rcx
movq 0x15a36(%rip), %rax     # 0x86f60
movsd 0xc4e8(%rax,%rcx,8), %xmm0
callq 0x12340
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x30(%rbp)
je 0x71602
jmp 0x71547
movq 0x15a12(%rip), %rax     # 0x86f60
cmpl $0x31, 0xd670(%rax)
jge 0x715f7
movq 0x159fe(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rax
movq 0x159f0(%rip), %rdi     # 0x86f60
addq $0xc6d0, %rdi           # imm = 0xC6D0
imulq $0x50, %rax, %rax
addq %rax, %rdi
leaq 0xe38c(%rip), %rsi      # 0x7f911
movl $0x50, %edx
callq 0x10840
movq 0x159ca(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x159bc(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x4f(%rax)
movq 0x159a4(%rip), %rax     # 0x86f60
movl 0xd670(%rax), %ecx
addl $0x1, %ecx
movq 0x15994(%rip), %rax     # 0x86f60
movl %ecx, 0xd670(%rax)
movq 0x15987(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x15979(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, (%rax)
movl -0x30(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x7180c
jmp 0x71604
jmp 0x71606
xorl %eax, %eax
movq 0x15951(%rip), %rcx     # 0x86f60
cmpl 0x1b6b4(%rcx), %eax
jge 0x71677
callq 0x11950
movq -0x38(%rbp), %rdi
movl %eax, %ecx
movl -0x20(%rbp), %r11d
movslq -0x20(%rbp), %rdx
movq 0x1592f(%rip), %rax     # 0x86f60
movq 0xc358(%rax,%rdx,8), %r10
movslq -0x20(%rbp), %rdx
movq 0x1591c(%rip), %rax     # 0x86f60
movq 0xc358(%rax,%rdx,8), %rax
leaq 0xe3d3(%rip), %rsi      # 0x7fa26
xorl %edx, %edx
leaq 0xe27e(%rip), %r8       # 0x7f8da
movl $0x11b, %r9d            # imm = 0x11B
movl %r11d, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movb $0x0, %al
callq 0x12050
jmp 0x71679
movslq -0x20(%rbp), %rcx
movq 0x158dc(%rip), %rax     # 0x86f60
movq 0xc358(%rax,%rcx,8), %rdi
callq 0x114b0
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x7145f
movq 0x158ba(%rip), %rax     # 0x86f60
movl $0x0, 0xc350(%rax)
movq 0x158a9(%rip), %rax     # 0x86f60
cmpl $0x0, 0x1694(%rax)
je 0x717ff
movq -0x38(%rbp), %rdi
movq 0x15891(%rip), %rdx     # 0x86f60
movq %rdx, %rsi
addq $0x130, %rsi            # imm = 0x130
callq 0x106c0
movq -0x38(%rbp), %rdi
movl %eax, -0x1c(%rbp)
movq 0x15874(%rip), %rdx     # 0x86f60
movq %rdx, %rsi
addq $0x130, %rsi            # imm = 0x130
callq 0x12270
movq -0x38(%rbp), %rdi
movq 0x1585a(%rip), %rdx     # 0x86f60
movq %rdx, %rsi
addq $0x130, %rsi            # imm = 0x130
callq 0x12200
movq -0x38(%rbp), %rdi
movq 0x15840(%rip), %rsi     # 0x86f60
callq 0x11560
cmpl $0x0, -0x1c(%rbp)
je 0x717fd
cmpl $0x2, -0x1c(%rbp)
je 0x717fd
cmpl $0x1, -0x1c(%rbp)
je 0x717fd
jmp 0x71745
movq 0x15814(%rip), %rax     # 0x86f60
cmpl $0x31, 0xd670(%rax)
jge 0x717f5
movq 0x15800(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rax
movq 0x157f2(%rip), %rdi     # 0x86f60
addq $0xc6d0, %rdi           # imm = 0xC6D0
imulq $0x50, %rax, %rax
addq %rax, %rdi
leaq 0xe18e(%rip), %rsi      # 0x7f911
movl $0x50, %edx
callq 0x10840
movq 0x157cc(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x157be(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x4f(%rax)
movq 0x157a6(%rip), %rax     # 0x86f60
movl 0xd670(%rax), %ecx
addl $0x1, %ecx
movq 0x15796(%rip), %rax     # 0x86f60
movl %ecx, 0xd670(%rax)
movq 0x15789(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x1577b(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, (%rax)
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x7180c
jmp 0x71806
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)