// File: /workspace/github_cpp_makefile_star2_O2/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
leal -0x17e(%rax), %ecx
cmpl $0x4, %ecx
jb 0x132d4
leal -0x14a(%rax), %ecx
cmpl $0x2, %ecx
jb 0x132c5
testl %eax, %eax
je 0x132c5
cmpl $0xa, %eax
je 0x132c5
cmpl $0x14, %eax
je 0x132e6
cmpl $0x1e, %eax
je 0x132e6
cmpl $0x2da, %eax            # imm = 0x2DA
je 0x13318
cmpl $0x320, %eax            # imm = 0x320
je 0x132f5
cmpl $0x2f8, %eax            # imm = 0x2F8
jne 0x1330d
movq %r14, %rdi
movl %eax, %esi
movq %rbx, %rcx
callq 0xb320
jmp 0x13325
movq %r14, %rdi
movq %rdx, %rsi
movl %eax, %edx
movq %rbx, %rcx
callq 0xc630
jmp 0x13325
movq %r14, %rdi
movl %eax, %esi
movq %rbx, %rcx
callq 0xbb20
jmp 0x13325
leaq 0x1ec4d(%rip), %rdi     # 0x31f49
callq 0xc4d0
movl $0x320, 0x1798(%rbx)    # imm = 0x320
jmp 0x13385
leal -0x321(%rax), %ecx
cmpl $0x62, %ecx
ja 0x1338e
movq %r14, %rdi
movl %eax, %esi
movq %rbx, %rcx
callq 0xb430
testl %eax, %eax
je 0x13385
movl %eax, %ebx
movq 0x29c2e(%rip), %r14     # 0x3cf60
movslq 0xd670(%r14), %rax
cmpq $0x30, %rax
jg 0x13387
imulq $0x50, %rax, %rax
leaq (%r14,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x1d43f(%rip), %rsi     # 0x30794
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)
jmp 0x13387
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
movl %eax, %ecx
andl $-0x2, %ecx
cmpl $0x32, %ecx
jne 0x133aa
movq %r14, %rdi
movl %eax, %esi
movq %rbx, %rcx
callq 0xb150
jmp 0x13325
cmpl $0x34, %eax
jne 0x133c2
pushq $0x34
popq %rsi
movq %r14, %rdi
movq %rbx, %rcx
callq 0xc5d0
jmp 0x13325
leaq 0x1eba5(%rip), %rdi     # 0x31f6e
callq 0xb220
movq %r14, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xb8e0
movq 0x29b7e(%rip), %rbx     # 0x3cf60
leaq 0xc6d0(%rbx), %rdi
leaq 0x1d3a4(%rip), %rsi     # 0x30794
pushq $0x50
popq %rdx
callq 0xb940
andw $0x0, 0xc71f(%rbx)
movl $0x1, 0xd670(%rbx)
pushq $0x5
popq %rbx
jmp 0x13387