// File: 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
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x2490a
cmpl $0xa, -0x14(%rbp)
je 0x2490a
cmpl $0x14a, -0x14(%rbp)     # imm = 0x14A
je 0x2490a
cmpl $0x14b, -0x14(%rbp)     # imm = 0x14B
je 0x2490a
cmpl $0x2f8, -0x14(%rbp)     # imm = 0x2F8
jne 0x249f1
jmp 0x2490c
movq -0x48(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x104d0
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x249ea
jmp 0x2492f
movq 0x6262a(%rip), %rax     # 0x86f60
cmpl $0x31, 0xd670(%rax)
jge 0x249df
movq 0x62616(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rax
movq 0x62608(%rip), %rdi     # 0x86f60
addq $0xc6d0, %rdi           # imm = 0xC6D0
imulq $0x50, %rax, %rax
addq %rax, %rdi
leaq 0x560b3(%rip), %rsi     # 0x7aa20
movl $0x50, %edx
callq 0x10840
movq 0x625e2(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x625d4(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x4f(%rax)
movq 0x625bc(%rip), %rax     # 0x86f60
movl 0xd670(%rax), %ecx
addl $0x1, %ecx
movq 0x625ac(%rip), %rax     # 0x86f60
movl %ecx, 0xd670(%rax)
movq 0x6259f(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x62591(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, (%rax)
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x24ff6
jmp 0x249ec
jmp 0x24fef
cmpl $0x1e, -0x14(%rbp)
je 0x24a01
cmpl $0x14, -0x14(%rbp)
jne 0x24ae8
jmp 0x24a03
movq -0x48(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x11140
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x30(%rbp)
je 0x24ae1
jmp 0x24a26
movq 0x62533(%rip), %rax     # 0x86f60
cmpl $0x31, 0xd670(%rax)
jge 0x24ad6
movq 0x6251f(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rax
movq 0x62511(%rip), %rdi     # 0x86f60
addq $0xc6d0, %rdi           # imm = 0xC6D0
imulq $0x50, %rax, %rax
addq %rax, %rdi
leaq 0x55fbc(%rip), %rsi     # 0x7aa20
movl $0x50, %edx
callq 0x10840
movq 0x624eb(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x624dd(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x4f(%rax)
movq 0x624c5(%rip), %rax     # 0x86f60
movl 0xd670(%rax), %ecx
addl $0x1, %ecx
movq 0x624b5(%rip), %rax     # 0x86f60
movl %ecx, 0xd670(%rax)
movq 0x624a8(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x6249a(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, (%rax)
movl -0x30(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x24ff6
jmp 0x24ae3
jmp 0x24fed
cmpl $0x17e, -0x14(%rbp)     # imm = 0x17E
je 0x24b10
cmpl $0x17f, -0x14(%rbp)     # imm = 0x17F
je 0x24b10
cmpl $0x180, -0x14(%rbp)     # imm = 0x180
je 0x24b10
cmpl $0x181, -0x14(%rbp)     # imm = 0x181
jne 0x24bf7
jmp 0x24b12
movq -0x48(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl -0x14(%rbp), %edx
movq -0x28(%rbp), %rcx
callq 0x120b0
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x24bf0
jmp 0x24b35
movq 0x62424(%rip), %rax     # 0x86f60
cmpl $0x31, 0xd670(%rax)
jge 0x24be5
movq 0x62410(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rax
movq 0x62402(%rip), %rdi     # 0x86f60
addq $0xc6d0, %rdi           # imm = 0xC6D0
imulq $0x50, %rax, %rax
addq %rax, %rdi
leaq 0x55ead(%rip), %rsi     # 0x7aa20
movl $0x50, %edx
callq 0x10840
movq 0x623dc(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x623ce(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x4f(%rax)
movq 0x623b6(%rip), %rax     # 0x86f60
movl 0xd670(%rax), %ecx
addl $0x1, %ecx
movq 0x623a6(%rip), %rax     # 0x86f60
movl %ecx, 0xd670(%rax)
movq 0x62399(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x6238b(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, (%rax)
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x24ff6
jmp 0x24bf2
jmp 0x24feb
cmpl $0x320, -0x14(%rbp)     # imm = 0x320
jne 0x24c1f
leaq 0x55e57(%rip), %rdi     # 0x7aa5e
callq 0x11f00
movq -0x28(%rbp), %rax
movl $0x320, 0x1798(%rax)    # imm = 0x320
jmp 0x24fe9
cmpl $0x2da, -0x14(%rbp)     # imm = 0x2DA
je 0x24c42
cmpl $0x320, -0x14(%rbp)     # imm = 0x320
jle 0x24d29
cmpl $0x384, -0x14(%rbp)     # imm = 0x384
jge 0x24d29
jmp 0x24c44
movq -0x48(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x10620
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x38(%rbp)
je 0x24d22
jmp 0x24c67
movq 0x622f2(%rip), %rax     # 0x86f60
cmpl $0x31, 0xd670(%rax)
jge 0x24d17
movq 0x622de(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rax
movq 0x622d0(%rip), %rdi     # 0x86f60
addq $0xc6d0, %rdi           # imm = 0xC6D0
imulq $0x50, %rax, %rax
addq %rax, %rdi
leaq 0x55d7b(%rip), %rsi     # 0x7aa20
movl $0x50, %edx
callq 0x10840
movq 0x622aa(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x6229c(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x4f(%rax)
movq 0x62284(%rip), %rax     # 0x86f60
movl 0xd670(%rax), %ecx
addl $0x1, %ecx
movq 0x62274(%rip), %rax     # 0x86f60
movl %ecx, 0xd670(%rax)
movq 0x62267(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x62259(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, (%rax)
movl -0x38(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x24ff6
jmp 0x24d24
jmp 0x24fe7
cmpl $0x32, -0x14(%rbp)
je 0x24d39
cmpl $0x33, -0x14(%rbp)
jne 0x24e20
jmp 0x24d3b
movq -0x48(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x10220
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x24e19
jmp 0x24d5e
movq 0x621fb(%rip), %rax     # 0x86f60
cmpl $0x31, 0xd670(%rax)
jge 0x24e0e
movq 0x621e7(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rax
movq 0x621d9(%rip), %rdi     # 0x86f60
addq $0xc6d0, %rdi           # imm = 0xC6D0
imulq $0x50, %rax, %rax
addq %rax, %rdi
leaq 0x55c84(%rip), %rsi     # 0x7aa20
movl $0x50, %edx
callq 0x10840
movq 0x621b3(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x621a5(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x4f(%rax)
movq 0x6218d(%rip), %rax     # 0x86f60
movl 0xd670(%rax), %ecx
addl $0x1, %ecx
movq 0x6217d(%rip), %rax     # 0x86f60
movl %ecx, 0xd670(%rax)
movq 0x62170(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x62162(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, (%rax)
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x24ff6
jmp 0x24e1b
jmp 0x24fe5
cmpl $0x34, -0x14(%rbp)
jne 0x24f11
jmp 0x24e2c
movq -0x48(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x12040
movl %eax, -0x40(%rbp)
cmpl $0x0, -0x40(%rbp)
je 0x24f0a
jmp 0x24e4f
movq 0x6210a(%rip), %rax     # 0x86f60
cmpl $0x31, 0xd670(%rax)
jge 0x24eff
movq 0x620f6(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rax
movq 0x620e8(%rip), %rdi     # 0x86f60
addq $0xc6d0, %rdi           # imm = 0xC6D0
imulq $0x50, %rax, %rax
addq %rax, %rdi
leaq 0x55b93(%rip), %rsi     # 0x7aa20
movl $0x50, %edx
callq 0x10840
movq 0x620c2(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x620b4(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x4f(%rax)
movq 0x6209c(%rip), %rax     # 0x86f60
movl 0xd670(%rax), %ecx
addl $0x1, %ecx
movq 0x6208c(%rip), %rax     # 0x86f60
movl %ecx, 0xd670(%rax)
movq 0x6207f(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x62071(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, (%rax)
movl -0x40(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x24ff6
jmp 0x24f0c
jmp 0x24fe3
jmp 0x24f13
leaq 0x55b69(%rip), %rdi     # 0x7aa83
callq 0x10380
movq -0x48(%rbp), %rdi
movq %rax, %rsi
movb $0x0, %al
callq 0x10df0
movq 0x6202c(%rip), %rax     # 0x86f60
movl $0x0, 0xd670(%rax)
movq 0x6201b(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rax
movq 0x6200d(%rip), %rdi     # 0x86f60
addq $0xc6d0, %rdi           # imm = 0xC6D0
imulq $0x50, %rax, %rax
addq %rax, %rdi
leaq 0x55ab8(%rip), %rsi     # 0x7aa20
movl $0x50, %edx
callq 0x10840
movq 0x61fe7(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x61fd9(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x4f(%rax)
movq 0x61fc1(%rip), %rax     # 0x86f60
movl 0xd670(%rax), %ecx
addl $0x1, %ecx
movq 0x61fb1(%rip), %rax     # 0x86f60
movl %ecx, 0xd670(%rax)
movq 0x61fa4(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x61f96(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, (%rax)
movl $0x5, -0x4(%rbp)
jmp 0x24ff6
jmp 0x24fe5
jmp 0x24fe7
jmp 0x24fe9
jmp 0x24feb
jmp 0x24fed
jmp 0x24fef
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nop