// File: /workspace/github_cpp_makefile_star2_O3/sundale[P]gcode/rs274ngc/interp_convert.cc
// Function: Interp::convert_motion(int, block_struct*, setup_struct*)
int Interp::convert_motion(int motion,   //!< g_code for a line, arc, canned cycle     
                          block_pointer block,  //!< pointer to a block of RS274 instructions 
                          setup_pointer settings)       //!< pointer to machine settings              
{

  if ((motion == G_0) || (motion == G_1) || (motion == G_33) || (motion == G_33_1) || (motion == G_76)) {
    CHP(convert_straight(motion, block, settings));
  } else if ((motion == G_3) || (motion == G_2)) {
    CHP(convert_arc(motion, block, settings));
  } else if (motion == G_38_2 || motion == G_38_3 || 
             motion == G_38_4 || motion == G_38_5) {
    CHP(convert_probe(block, motion, settings));
  } else if (motion == G_80) {
#ifdef DEBUG_EMC
    enqueue_COMMENT("interpreter: motion mode set to none");
#endif
    settings->motion_mode = G_80;
  } else if (motion == G_73 || ((motion > G_80) && (motion < G_90))) {
    CHP(convert_cycle(motion, block, settings));
  } else if ((motion == G_5) || (motion == G_5_1)) {
    CHP(convert_spline(motion, block, settings));
  } else if (motion == G_5_2) {
    CHP(convert_nurbs(motion, block, settings));
  } else {
    ERS(NCE_BUG_UNKNOWN_MOTION_CODE);
  }

  return INTERP_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rcx, %rbx
movl %esi, %eax
movq %rdi, %r14
cmpl $0x17d, %esi            # imm = 0x17D
jle 0x12710
cmpl $0x2d9, %eax            # imm = 0x2D9
jg 0x12725
leal -0x17e(%rax), %ecx
cmpl $0x4, %ecx
jae 0x12785
movq %r14, %rdi
movq %rdx, %rsi
movl %eax, %edx
movq %rbx, %rcx
callq 0xb4c0
jmp 0x127a1
cmpl $0x1d, %eax
jg 0x1273c
testl %eax, %eax
je 0x12747
cmpl $0xa, %eax
je 0x12747
cmpl $0x14, %eax
je 0x1275b
jmp 0x12785
cmpl $0x2da, %eax            # imm = 0x2DA
je 0x12794
cmpl $0x320, %eax            # imm = 0x320
je 0x1276a
cmpl $0x2f8, %eax            # imm = 0x2F8
je 0x12747
jmp 0x12785
leal -0x14a(%rax), %ecx
cmpl $0x2, %ecx
jae 0x12756
movq %r14, %rdi
movl %eax, %esi
movq %rbx, %rcx
callq 0xa2f0
jmp 0x127a1
cmpl $0x1e, %eax
jne 0x12785
movq %r14, %rdi
movl %eax, %esi
movq %rbx, %rcx
callq 0xaa60
jmp 0x127a1
leaq 0x237ce(%rip), %rdi     # 0x35f3f
callq 0xb370
movl $0x320, 0x1798(%rbx)    # imm = 0x320
jmp 0x1280b
leal -0x321(%rax), %ecx
cmpl $0x62, %ecx
ja 0x12814
movq %r14, %rdi
movl %eax, %esi
movq %rbx, %rcx
callq 0xa3f0
testl %eax, %eax
je 0x1280b
movl %eax, %ebx
movq 0x2e7b2(%rip), %r14     # 0x40f60
movslq 0xd670(%r14), %rax
cmpq $0x30, %rax
jg 0x1280d
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%r14,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x21fbf(%rip), %rsi     # 0x34794
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)
jmp 0x1280d
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
movl %eax, %ecx
andl $-0x2, %ecx
cmpl $0x32, %ecx
jne 0x12830
movq %r14, %rdi
movl %eax, %esi
movq %rbx, %rcx
callq 0xa140
jmp 0x127a1
cmpl $0x34, %eax
jne 0x1284a
movq %r14, %rdi
movl $0x34, %esi
movq %rbx, %rcx
callq 0xb460
jmp 0x127a1
leaq 0x23713(%rip), %rdi     # 0x35f64
callq 0xa1f0
movq %r14, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xa850
movq 0x2e6f6(%rip), %rbx     # 0x40f60
leaq 0xc6d0(%rbx), %rdi
leaq 0x21f1c(%rip), %rsi     # 0x34794
movl $0x50, %edx
callq 0xa8a0
movw $0x0, 0xc71f(%rbx)
movl $0x1, 0xd670(%rbx)
movl $0x5, %ebx
jmp 0x1280d
nop