// File: /workspace/github_cpp_makefile_star2_O3/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 0x23d8c
leaq 0x30(%r15), %rsi
movq %r12, %rdi
callq 0xb400
testl %eax, %eax
jne 0x23e5f
cmpl $-0x1, 0x188(%r15)
je 0x23dac
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xae40
testl %eax, %eax
jne 0x23e5f
movl 0x164(%r15), %esi
cmpl $-0x1, %esi
je 0x23dcb
movq %r12, %rdi
movq %r14, %rdx
callq 0xa8f0
testl %eax, %eax
jne 0x23e5f
movsd 0x148(%r15), %xmm0
ucomisd 0xfa94(%rip), %xmm0     # 0x33870
jbe 0x23dfa
cmpl $0x1, 0x670(%r14)
je 0x23dfa
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xb540
testl %eax, %eax
jne 0x23e5f
movsd 0x238(%r15), %xmm0
ucomisd 0xfa65(%rip), %xmm0     # 0x33870
jbe 0x23e1f
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xa740
testl %eax, %eax
jne 0x23e5f
cmpl $-0x1, 0x240(%r15)
je 0x23e3b
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xb3d0
testl %eax, %eax
jne 0x23e5f
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xada0
testl %eax, %eax
jne 0x23e5f
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xa150
testl %eax, %eax
je 0x23ece
movl %eax, %ebx
movq 0x1d0f8(%rip), %r14     # 0x40f60
movslq 0xd670(%r14), %rax
cmpq $0x30, %rax
jg 0x23ec3
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%r14,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x13818(%rip), %rsi     # 0x376a7
movl $0x50, %edx
callq 0xa8a0
movslq 0xd670(%r14), %rax
leaq (%rax,%rax,4), %rcx
shlq $0x4, %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 0x23ef6
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xb230
testl %eax, %eax
je 0x23ef6
movl %eax, %ebx
cmpl $0x1, %eax
je 0x23ec3
jmp 0x23e61
movl $0x2, %ebx
cmpb $0x0, 0xc680(%r14)
jne 0x23ec3
cmpb $0x0, 0xc681(%r14)
jne 0x23ec3
movzbl 0xc682(%r14), %ebx
addl %ebx, %ebx
jmp 0x23ec3
nop