// File: /workspace/github_cpp_makefile_star2_O2/sundale[P]gcode/rs274ngc/interp_execute.cc
// Function: Interp::execute_block(block_struct*, setup_struct*)
int Interp::execute_block(block_pointer block,   //!< pointer to a block of RS274/NGC instructions
                         setup_pointer settings)        //!< pointer to machine settings                 
{
  int status;

  block->line_number = settings->sequence_number;

  if (block->comment[0] != 0) {
    CHP(convert_comment(block->comment));
  }
  if (block->g_modes[14] != -1) {
    CHP(convert_spindle_mode(block, settings));
  }
  if (block->g_modes[5] != -1) {
    CHP(convert_feed_mode(block->g_modes[5], settings));
  }
  if (block->f_number > -1.0) {
    if (settings->feed_mode != INVERSE_TIME) {
      CHP(convert_feed_rate(block, settings));
    }
    /* INVERSE_TIME is handled elsewhere */
  }
  if (block->s_number > -1.0) {
    CHP(convert_speed(block, settings));
  }
  if (block->t_number != -1) {
    CHP(convert_tool_select(block, settings));
  }
  CHP(convert_m(block, settings));
  CHP(convert_g(block, settings));
  if (block->m_modes[4] != -1) {        /* converts m0, m1, m2, m30, or m60 */
    status = convert_stop(block, settings);
    if (status == INTERP_EXIT)
      return INTERP_EXIT;
    else if (status != INTERP_OK)
      ERP(status);
  }
  if (settings->probe_flag == ON)
    return INTERP_EXECUTE_FINISH;

  if (settings->input_flag == ON)
    return INTERP_EXECUTE_FINISH;

  if (settings->toolchange_flag == ON)
    return INTERP_EXECUTE_FINISH;

  return INTERP_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
movl 0xc6b4(%rdx), %eax
movl %eax, 0x1d0(%rsi)
cmpb $0x0, 0x30(%rsi)
je 0x21674
leaq 0x30(%r15), %rsi
movq %r12, %rdi
callq 0xc570
testl %eax, %eax
jne 0x21747
cmpl $-0x1, 0x188(%r15)
je 0x21694
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xbf50
testl %eax, %eax
jne 0x21747
movl 0x164(%r15), %esi
cmpl $-0x1, %esi
je 0x216b3
movq %r12, %rdi
movq %r14, %rdx
callq 0xb990
testl %eax, %eax
jne 0x21747
movsd 0x148(%r15), %xmm0
ucomisd 0xe1ac(%rip), %xmm0     # 0x2f870
jbe 0x216e2
cmpl $0x1, 0x670(%r14)
je 0x216e2
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xc6b0
testl %eax, %eax
jne 0x21747
movsd 0x238(%r15), %xmm0
ucomisd 0xe17d(%rip), %xmm0     # 0x2f870
jbe 0x21707
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xb790
testl %eax, %eax
jne 0x21747
cmpl $-0x1, 0x240(%r15)
je 0x21723
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xc540
testl %eax, %eax
jne 0x21747
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xbeb0
testl %eax, %eax
jne 0x21747
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xb160
testl %eax, %eax
je 0x217ac
movl %eax, %ebx
movq 0x1b810(%rip), %r14     # 0x3cf60
movslq 0xd670(%r14), %rax
cmpq $0x30, %rax
jg 0x217a1
imulq $0x50, %rax, %rax
leaq (%r14,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x11f34(%rip), %rsi     # 0x336a7
pushq $0x50
popq %rdx
callq 0xb940
movslq 0xd670(%r14), %rax
imulq $0x50, %rax, %rcx
xorl %edx, %edx
movb %dl, 0xc71f(%r14,%rcx)
incl %eax
movl %eax, 0xd670(%r14)
movb %dl, 0xc720(%r14,%rcx)
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
cmpl $-0x1, 0x1f0(%r15)
je 0x217d4
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xc390
testl %eax, %eax
je 0x217d4
movl %eax, %ebx
cmpl $0x1, %eax
je 0x217a1
jmp 0x21749
pushq $0x2
popq %rbx
cmpb $0x0, 0xc680(%r14)
jne 0x217a1
cmpb $0x0, 0xc681(%r14)
jne 0x217a1
movzbl 0xc682(%r14), %ebx
addl %ebx, %ebx
jmp 0x217a1
nop