// File: sundale[P]gcode/rs274ngc/interp_convert.cc
// Function: Interp::convert_modal_0(int, block_struct*, setup_struct*)
int Interp::convert_modal_0(int code,    //!< G code, must be from group 0                
                           block_pointer block, //!< pointer to a block of RS274/NGC instructions
                           setup_pointer settings)      //!< pointer to machine settings                 
{

  if (code == G_10) {
      if(block->l_number == 1 || block->l_number == 10)
          CHP(convert_setup_tool(block, settings));
      else
          CHP(convert_setup(block, settings));
  } else if ((code == G_28) || (code == G_30)) {
    CHP(convert_home(code, block, settings));
  } else if ((code == G_28_1) || (code == G_30_1)) {
    CHP(convert_savehome(code, block, settings));
  } else if ((code == G_92) || (code == G_92_1) ||
             (code == G_92_2) || (code == G_92_3)) {
    CHP(convert_axis_offsets(code, block, settings));
  } else if (code == G_5_3) {
    CHP(convert_nurbs(code, block, settings));
  } else if ((code == G_4) || (code == G_53));  /* handled elsewhere */
  else
    ERS(NCE_BUG_CODE_NOT_G4_G10_G28_G30_G53_OR_G92_SERIES);
  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 $0x64, -0x14(%rbp)
jne 0x243c1
movq -0x20(%rbp), %rax
cmpl $0x1, 0x1c8(%rax)
je 0x241f7
movq -0x20(%rbp), %rax
cmpl $0xa, 0x1c8(%rax)
jne 0x242db
jmp 0x241f9
movq -0x48(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x10550
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x242d4
jmp 0x24219
movq 0x62d40(%rip), %rax     # 0x86f60
cmpl $0x31, 0xd670(%rax)
jge 0x242c9
movq 0x62d2c(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rax
movq 0x62d1e(%rip), %rdi     # 0x86f60
addq $0xc6d0, %rdi           # imm = 0xC6D0
imulq $0x50, %rax, %rax
addq %rax, %rdi
leaq 0x5675c(%rip), %rsi     # 0x7a9b3
movl $0x50, %edx
callq 0x10840
movq 0x62cf8(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x62cea(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x4f(%rax)
movq 0x62cd2(%rip), %rax     # 0x86f60
movl 0xd670(%rax), %ecx
addl $0x1, %ecx
movq 0x62cc2(%rip), %rax     # 0x86f60
movl %ecx, 0xd670(%rax)
movq 0x62cb5(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x62ca7(%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 0x248b2
jmp 0x242d6
jmp 0x243bc
jmp 0x242dd
movq -0x48(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x10cb0
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x30(%rbp)
je 0x243b8
jmp 0x242fd
movq 0x62c5c(%rip), %rax     # 0x86f60
cmpl $0x31, 0xd670(%rax)
jge 0x243ad
movq 0x62c48(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rax
movq 0x62c3a(%rip), %rdi     # 0x86f60
addq $0xc6d0, %rdi           # imm = 0xC6D0
imulq $0x50, %rax, %rax
addq %rax, %rdi
leaq 0x56678(%rip), %rsi     # 0x7a9b3
movl $0x50, %edx
callq 0x10840
movq 0x62c14(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x62c06(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x4f(%rax)
movq 0x62bee(%rip), %rax     # 0x86f60
movl 0xd670(%rax), %ecx
addl $0x1, %ecx
movq 0x62bde(%rip), %rax     # 0x86f60
movl %ecx, 0xd670(%rax)
movq 0x62bd1(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x62bc3(%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 0x248b2
jmp 0x243ba
jmp 0x243bc
jmp 0x248ab
cmpl $0x118, -0x14(%rbp)     # imm = 0x118
je 0x243d7
cmpl $0x12c, -0x14(%rbp)     # imm = 0x12C
jne 0x244be
jmp 0x243d9
movq -0x48(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x117f0
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x244b7
jmp 0x243fc
movq 0x62b5d(%rip), %rax     # 0x86f60
cmpl $0x31, 0xd670(%rax)
jge 0x244ac
movq 0x62b49(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rax
movq 0x62b3b(%rip), %rdi     # 0x86f60
addq $0xc6d0, %rdi           # imm = 0xC6D0
imulq $0x50, %rax, %rax
addq %rax, %rdi
leaq 0x56579(%rip), %rsi     # 0x7a9b3
movl $0x50, %edx
callq 0x10840
movq 0x62b15(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x62b07(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x4f(%rax)
movq 0x62aef(%rip), %rax     # 0x86f60
movl 0xd670(%rax), %ecx
addl $0x1, %ecx
movq 0x62adf(%rip), %rax     # 0x86f60
movl %ecx, 0xd670(%rax)
movq 0x62ad2(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x62ac4(%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 0x248b2
jmp 0x244b9
jmp 0x248a9
cmpl $0x119, -0x14(%rbp)     # imm = 0x119
je 0x244d4
cmpl $0x12d, -0x14(%rbp)     # imm = 0x12D
jne 0x245bb
jmp 0x244d6
movq -0x48(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x10650
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x38(%rbp)
je 0x245b4
jmp 0x244f9
movq 0x62a60(%rip), %rax     # 0x86f60
cmpl $0x31, 0xd670(%rax)
jge 0x245a9
movq 0x62a4c(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rax
movq 0x62a3e(%rip), %rdi     # 0x86f60
addq $0xc6d0, %rdi           # imm = 0xC6D0
imulq $0x50, %rax, %rax
addq %rax, %rdi
leaq 0x5647c(%rip), %rsi     # 0x7a9b3
movl $0x50, %edx
callq 0x10840
movq 0x62a18(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x62a0a(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x4f(%rax)
movq 0x629f2(%rip), %rax     # 0x86f60
movl 0xd670(%rax), %ecx
addl $0x1, %ecx
movq 0x629e2(%rip), %rax     # 0x86f60
movl %ecx, 0xd670(%rax)
movq 0x629d5(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x629c7(%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 0x248b2
jmp 0x245b6
jmp 0x248a7
cmpl $0x398, -0x14(%rbp)     # imm = 0x398
je 0x245e3
cmpl $0x399, -0x14(%rbp)     # imm = 0x399
je 0x245e3
cmpl $0x39a, -0x14(%rbp)     # imm = 0x39A
je 0x245e3
cmpl $0x39b, -0x14(%rbp)     # imm = 0x39B
jne 0x246ca
jmp 0x245e5
movq -0x48(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x122c0
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x246c3
jmp 0x24608
movq 0x62951(%rip), %rax     # 0x86f60
cmpl $0x31, 0xd670(%rax)
jge 0x246b8
movq 0x6293d(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rax
movq 0x6292f(%rip), %rdi     # 0x86f60
addq $0xc6d0, %rdi           # imm = 0xC6D0
imulq $0x50, %rax, %rax
addq %rax, %rdi
leaq 0x5636d(%rip), %rsi     # 0x7a9b3
movl $0x50, %edx
callq 0x10840
movq 0x62909(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x628fb(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x4f(%rax)
movq 0x628e3(%rip), %rax     # 0x86f60
movl 0xd670(%rax), %ecx
addl $0x1, %ecx
movq 0x628d3(%rip), %rax     # 0x86f60
movl %ecx, 0xd670(%rax)
movq 0x628c6(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x628b8(%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 0x248b2
jmp 0x246c5
jmp 0x248a5
cmpl $0x35, -0x14(%rbp)
jne 0x247bb
jmp 0x246d6
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 0x247b4
jmp 0x246f9
movq 0x62860(%rip), %rax     # 0x86f60
cmpl $0x31, 0xd670(%rax)
jge 0x247a9
movq 0x6284c(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rax
movq 0x6283e(%rip), %rdi     # 0x86f60
addq $0xc6d0, %rdi           # imm = 0xC6D0
imulq $0x50, %rax, %rax
addq %rax, %rdi
leaq 0x5627c(%rip), %rsi     # 0x7a9b3
movl $0x50, %edx
callq 0x10840
movq 0x62818(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x6280a(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x4f(%rax)
movq 0x627f2(%rip), %rax     # 0x86f60
movl 0xd670(%rax), %ecx
addl $0x1, %ecx
movq 0x627e2(%rip), %rax     # 0x86f60
movl %ecx, 0xd670(%rax)
movq 0x627d5(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x627c7(%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 0x248b2
jmp 0x247b6
jmp 0x248a3
cmpl $0x28, -0x14(%rbp)
je 0x247ca
cmpl $0x212, -0x14(%rbp)     # imm = 0x212
jne 0x247cf
jmp 0x248a1
jmp 0x247d1
leaq 0x5621a(%rip), %rdi     # 0x7a9f2
callq 0x10380
movq -0x48(%rbp), %rdi
movq %rax, %rsi
movb $0x0, %al
callq 0x10df0
movq 0x6276e(%rip), %rax     # 0x86f60
movl $0x0, 0xd670(%rax)
movq 0x6275d(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rax
movq 0x6274f(%rip), %rdi     # 0x86f60
addq $0xc6d0, %rdi           # imm = 0xC6D0
imulq $0x50, %rax, %rax
addq %rax, %rdi
leaq 0x5618d(%rip), %rsi     # 0x7a9b3
movl $0x50, %edx
callq 0x10840
movq 0x62729(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x6271b(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, 0x4f(%rax)
movq 0x62703(%rip), %rax     # 0x86f60
movl 0xd670(%rax), %ecx
addl $0x1, %ecx
movq 0x626f3(%rip), %rax     # 0x86f60
movl %ecx, 0xd670(%rax)
movq 0x626e6(%rip), %rax     # 0x86f60
movslq 0xd670(%rax), %rcx
movq 0x626d8(%rip), %rax     # 0x86f60
addq $0xc6d0, %rax           # imm = 0xC6D0
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movb $0x0, (%rax)
movl $0x5, -0x4(%rbp)
jmp 0x248b2
jmp 0x248a3
jmp 0x248a5
jmp 0x248a7
jmp 0x248a9
jmp 0x248ab
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)