// File: /workspace/github_cpp_makefile_star2_O1/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 0x130bc
cmpl $0x2d9, %eax            # imm = 0x2D9
jg 0x130d1
leal -0x17e(%rax), %ecx
cmpl $0x4, %ecx
jae 0x13131
movq %r14, %rdi
movq %rdx, %rsi
movl %eax, %edx
movq %rbx, %rcx
callq 0xb4c0
jmp 0x1314d
cmpl $0x1d, %eax
jg 0x130e8
testl %eax, %eax
je 0x130f3
cmpl $0xa, %eax
je 0x130f3
cmpl $0x14, %eax
je 0x13107
jmp 0x13131
cmpl $0x2da, %eax            # imm = 0x2DA
je 0x13140
cmpl $0x320, %eax            # imm = 0x320
je 0x13116
cmpl $0x2f8, %eax            # imm = 0x2F8
je 0x130f3
jmp 0x13131
leal -0x14a(%rax), %ecx
cmpl $0x2, %ecx
jae 0x13102
movq %r14, %rdi
movl %eax, %esi
movq %rbx, %rcx
callq 0xa2f0
jmp 0x1314d
cmpl $0x1e, %eax
jne 0x13131
movq %r14, %rdi
movl %eax, %esi
movq %rbx, %rcx
callq 0xaa60
jmp 0x1314d
leaq 0x25e22(%rip), %rdi     # 0x38f3f
callq 0xb370
movl $0x320, 0x1798(%rbx)    # imm = 0x320
jmp 0x131b9
leal -0x321(%rax), %ecx
cmpl $0x62, %ecx
ja 0x131c2
movq %r14, %rdi
movl %eax, %esi
movq %rbx, %rcx
callq 0xa3f0
testl %eax, %eax
je 0x131b9
movl %eax, %ebx
movq 0x30e06(%rip), %r14     # 0x43f60
movslq 0xd670(%r14), %rax
cmpq $0x30, %rax
jg 0x131b5
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%r14,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x24613(%rip), %rsi     # 0x37794
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)
testl %ebx, %ebx
jne 0x131bb
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
movl %eax, %ecx
andl $-0x2, %ecx
cmpl $0x32, %ecx
jne 0x131de
movq %r14, %rdi
movl %eax, %esi
movq %rbx, %rcx
callq 0xa140
jmp 0x1314d
cmpl $0x34, %eax
jne 0x131f8
movq %r14, %rdi
movl $0x34, %esi
movq %rbx, %rcx
callq 0xb460
jmp 0x1314d
leaq 0x25d65(%rip), %rdi     # 0x38f64
callq 0xa1f0
movq %r14, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xa850
movq 0x30d48(%rip), %rbx     # 0x43f60
movl $0x0, 0xd670(%rbx)
leaq 0xc6d0(%rbx), %rdi
leaq 0x24564(%rip), %rsi     # 0x37794
movl $0x50, %edx
callq 0xa8a0
movw $0x0, 0xc71f(%rbx)
movl $0x1, 0xd670(%rbx)
movl $0x5, %ebx
jmp 0x131bb
nop