// File: /workspace/github_cpp_makefile_star2_O2/sundale[P]gcode/rs274ngc/interp_check.cc
// Function: Interp::check_other_codes(block_struct*)
int Interp::check_other_codes(block_pointer block)       //!< pointer to a block of RS274/NGC instructions
{
  int motion;

  motion = block->motion_to_be;
  if (block->a_flag != OFF) {
    CHKS(((block->g_modes[1] > G_80) && (block->g_modes[1] < G_90)),
        NCE_CANNOT_PUT_AN_A_IN_CANNED_CYCLE);
  }
  if (block->b_flag != OFF) {
    CHKS(((block->g_modes[1] > G_80) && (block->g_modes[1] < G_90)),
        NCE_CANNOT_PUT_A_B_IN_CANNED_CYCLE);
  }
  if (block->c_flag != OFF) {
    CHKS(((block->g_modes[1] > G_80) && (block->g_modes[1] < G_90)),
        NCE_CANNOT_PUT_A_C_IN_CANNED_CYCLE);
  }
  if (block->d_flag == ON) {
    CHKS(((block->g_modes[7] != G_41) && (block->g_modes[7] != G_42) &&
        (block->g_modes[7] != G_41_1) && (block->g_modes[7] != G_42_1) &&
	(block->g_modes[14] != G_96)),
        _("D word with no G41, G41.1, G42, G42.1, or G96 to use it"));
  }

  if (block->e_flag == ON) {
    CHKS(((motion != G_76) && (block->m_modes[5] != 66) && 
      (block->m_modes[5] != 67) && (block->m_modes[5] != 68)),
       _("E word with no G76, M66, M67 or M68 to use it"));
  }

  if (block->h_flag == ON) {
    CHKS((block->g_modes[8] != G_43 && motion != G_76),
      _("H word with no G43 or G76 to use it"));
  }

  if (block->i_flag == ON) {    /* could still be useless if yz_plane arc */
    CHKS(((motion != G_2) && (motion != G_3) && (motion != G_5) && (motion != G_5_1) &&
          (motion != G_76) && (motion != G_87) && (block->g_modes[0] != G_10)),
        _("I word with no G2, G3, G5, G5.1, G10, G76, or G87 to use it"));
  }

  if (block->j_flag == ON) {    /* could still be useless if xz_plane arc */
    CHKS(((motion != G_2) && (motion != G_3) && (motion != G_5) && (motion != G_5_1) && 
          (motion != G_76) && (motion != G_87) && (block->g_modes[0] != G_10)),
        _("J word with no G2, G3, G5, G5.1, G10, G76 or G87 to use it"));
  }

  if (block->k_flag == ON) {    /* could still be useless if xy_plane arc */
    CHKS(((motion != G_2) && (motion != G_3) && (motion != G_33) &&
        (motion != G_33_1) && (motion != G_76) && (motion != G_87)),
        _("K word with no G2, G3, G33, G33.1, G76, or G87 to use it"));
  }

  if (block->l_number != -1) {
    CHKS((((motion < G_81) || (motion > G_89)) && (motion != G_76) &&
         (motion != G_5_2) && (motion != G_73) &&
         (block->g_modes[0] != G_10) &&
         (block->g_modes[7] != G_41) && (block->g_modes[7] != G_41_1) &&
         (block->g_modes[7] != G_42) && (block->g_modes[7] != G_42_1) &&
	 (block->m_modes[5] != 66)),
         _("L word with no G10, cutter compensation, canned cycle, digital/analog input, or NURBS code"));
  }

  if (block->p_flag == ON) {
      CHKS(((block->g_modes[0] != G_10) && (block->g_modes[0] != G_4) && (block->g_modes[13] != G_64) &&
          (motion != G_76) && (motion != G_82) && (motion != G_86) && (motion != G_88) && 
          (motion != G_89) && (motion != G_5) && (motion != G_5_2) &&
          (block->m_modes[9] != 50) && (block->m_modes[9] != 51) && (block->m_modes[9] != 52) &&
          (block->m_modes[9] != 53) && (block->m_modes[5] != 62) && (block->m_modes[5] != 63) &&
          (block->m_modes[5] != 64) && (block->m_modes[5] != 65) && (block->m_modes[5] != 66) &&
          (block->user_m != 1)),
          _("P word with no G4 G10 G64 G5 G5.2 G76 G82 G86 G88 G89"
            " or M50 M51 M52 M53 M62 M63 M64 M65 M66 or user M code to use it"));
  }

  if (block->q_number != -1.0) {
      CHKS((motion != G_83) && (motion != G_73) && (motion != G_5) && (block->user_m != 1) && (motion != G_76) &&
          (block->m_modes[5] != 66) && (block->m_modes[5] != 67) && (block->m_modes[5] != 68) && 
          (block->g_modes[0] != G_10) && (block->m_modes[6] != 61) && (block->g_modes[13] != G_64), 
          _("Q word with no G5, G10, G64, G73, G76, G83, M66, M67, M68 or user M code that uses it"));
  }

  if (block->r_flag == ON) {
    CHKS(((motion != G_2) && (motion != G_3) && (motion != G_76) &&
         ((motion < G_81) || (motion > G_89)) && (motion != G_73) && 
         (block->g_modes[7] != G_41_1) && (block->g_modes[7] != G_42_1) &&
         (block->g_modes[0] != G_10)),
        NCE_R_WORD_WITH_NO_G_CODE_THAT_USES_IT);
  }

  if (block->s_number < 0) {
    CHKS((block->g_modes[14] == G_96), NCE_S_WORD_MISSING_WITH_G96);
  }

  if (motion == G_33 || motion == G_33_1) {
    CHKS((block->k_flag == OFF), NCE_K_WORD_MISSING_WITH_G33);
    CHKS((block->f_number != -1), NCE_F_WORD_USED_WITH_G33);
  }

  if (motion == G_76) {
    // pitch
    CHKS((block->p_number == -1), NCE_P_WORD_MISSING_WITH_G76);

    CHKS((block->i_flag == OFF || block->j_flag == OFF || block->k_flag == OFF),
            NCE_I_J_OR_K_WORDS_MISSING_WITH_G76);
  }

  return INTERP_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x1d8(%rsi), %ecx
cmpb $0x1, (%rsi)
jne 0xd3be
movl $0xfffffcdf, %eax       # imm = 0xFFFFFCDF
addl 0x154(%rsi), %eax
cmpl $0x62, %eax
ja 0xd3be
leaq 0x22633(%rip), %rdi     # 0x2f9ec
jmp 0xd82c
cmpb $0x1, 0x10(%rsi)
jne 0xd3e0
movl $0xfffffcdf, %eax       # imm = 0xFFFFFCDF
addl 0x154(%rsi), %eax
cmpl $0x62, %eax
ja 0xd3e0
leaq 0x22631(%rip), %rdi     # 0x2fa0c
jmp 0xd82c
cmpb $0x1, 0x20(%rsi)
jne 0xd402
movl $0xfffffcdf, %eax       # imm = 0xFFFFFCDF
addl 0x154(%rsi), %eax
cmpl $0x62, %eax
ja 0xd402
leaq 0x2262e(%rip), %rdi     # 0x2fa2b
jmp 0xd82c
cmpb $0x1, 0x138(%rsi)
jne 0xd42d
movl $0xfffffe66, %eax       # imm = 0xFFFFFE66
addl 0x16c(%rsi), %eax
cmpl $0xb, %eax
ja 0xd67c
movl $0xc03, %edx            # imm = 0xC03
btl %eax, %edx
jae 0xd67c
cmpl $0x2f8, %ecx            # imm = 0x2F8
je 0xd450
cmpb $0x0, 0x139(%rsi)
je 0xd450
movl 0x1f4(%rsi), %eax
addl $-0x42, %eax
cmpl $0x3, %eax
jae 0xd60e
cmpb $0x1, 0x190(%rsi)
jne 0xd47f
cmpl $0x2f8, %ecx            # imm = 0x2F8
sete %al
cmpl $0x1ae, 0x170(%rsi)     # imm = 0x1AE
sete %dl
orb %al, %dl
jne 0xd47f
leaq 0x22636(%rip), %rdi     # 0x2fab0
jmp 0xd82c
movb 0x198(%rsi), %dl
movl %ecx, %eax
movabsq $0xc000040100000, %r8   # imm = 0xC000040100000
cmpb $0x1, %dl
jne 0xd4a9
cmpl $0x33, %ecx
ja 0xd61a
btq %rax, %r8
jae 0xd61a
movb 0x1a8(%rsi), %dil
cmpb $0x1, %dil
jne 0xd4c9
cmpl $0x33, %ecx
ja 0xd64b
btq %rax, %r8
jae 0xd64b
movb 0x1b8(%rsi), %r8b
cmpb $0x1, %r8b
jne 0xd4ff
leal -0x14a(%rcx), %eax
cmpl $0x2, %eax
jb 0xd4ff
cmpl $0x14, %ecx
je 0xd4ff
cmpl $0x1e, %ecx
je 0xd4ff
cmpl $0x2f8, %ecx            # imm = 0x2F8
je 0xd4ff
cmpl $0x366, %ecx            # imm = 0x366
jne 0xd698
leal -0x37b(%rcx), %eax
cmpl $-0x52, %eax
ja 0xd558
cmpl $-0x1, 0x1c8(%rsi)
je 0xd558
cmpl $0x34, %ecx
je 0xd558
cmpl $0x2da, %ecx            # imm = 0x2DA
je 0xd558
cmpl $0x2f8, %ecx            # imm = 0x2F8
je 0xd558
cmpl $0x64, 0x150(%rsi)
je 0xd558
movl $0xfffffe66, %r9d       # imm = 0xFFFFFE66
addl 0x16c(%rsi), %r9d
cmpl $0xb, %r9d
ja 0xd891
movl $0xc03, %r10d           # imm = 0xC03
btl %r9d, %r10d
jae 0xd891
cmpb $0x1, 0x218(%rsi)
jne 0xd6b4
movl 0x150(%rsi), %r9d
cmpl $0x28, %r9d
je 0xd6b4
cmpl $0x64, %r9d
je 0xd6b4
cmpl $0x280, 0x184(%rsi)     # imm = 0x280
je 0xd6b4
leal -0x35c(%rcx), %r9d
cmpl $0x1e, %r9d
jbe 0xd6a4
cmpl $0x32, %ecx
je 0xd6b4
cmpl $0x34, %ecx
je 0xd6b4
cmpl $0x2f8, %ecx            # imm = 0x2F8
je 0xd6b4
cmpl $0x334, %ecx            # imm = 0x334
je 0xd6b4
movl 0x204(%rsi), %r9d
addl $-0x32, %r9d
cmpl $0x4, %r9d
jb 0xd6b4
movl 0x1f4(%rsi), %r9d
addl $-0x3e, %r9d
cmpl $0x5, %r9d
jb 0xd6b4
cmpl $0x1, 0x20c(%rsi)
je 0xd6b4
leaq 0x225d6(%rip), %rdi     # 0x2fbdf
jmp 0xd82c
leaq 0x2246d(%rip), %rdi     # 0x2fa82
jmp 0xd82c
cmpl $0x2f8, %ecx            # imm = 0x2F8
je 0xd4a9
cmpl $0x366, %ecx            # imm = 0x366
je 0xd4a9
cmpl $0x64, 0x150(%rsi)
je 0xd4a9
leaq 0x2248e(%rip), %rdi     # 0x2fad4
jmp 0xd82c
cmpl $0x2f8, %ecx            # imm = 0x2F8
je 0xd4c9
cmpl $0x366, %ecx            # imm = 0x366
je 0xd4c9
cmpl $0x64, 0x150(%rsi)
je 0xd4c9
leaq 0x22499(%rip), %rdi     # 0x2fb10
jmp 0xd82c
cmpl $0x3c0, 0x188(%rsi)     # imm = 0x3C0
je 0xd42d
leaq 0x223b7(%rip), %rdi     # 0x2fa4a
jmp 0xd82c
leaq 0x224ac(%rip), %rdi     # 0x2fb4b
jmp 0xd82c
movl $0x40100001, %r10d      # imm = 0x40100001
btl %r9d, %r10d
jae 0xd5a1
movsd 0x220(%rsi), %xmm0
ucomisd 0x221ac(%rip), %xmm0    # 0x2f870
jne 0xd6c8
jnp 0xd6e1
cmpl $0x32, %ecx
je 0xd6e1
cmpl $0x2da, %ecx            # imm = 0x2DA
je 0xd6e1
cmpl $0x33e, %ecx            # imm = 0x33E
jne 0xd7c4
cmpb $0x1, 0x229(%rsi)
jne 0xd732
cmpl $0x14, %ecx
je 0xd732
cmpl $0x1e, %ecx
je 0xd732
cmpl $0x2f8, %ecx            # imm = 0x2F8
je 0xd732
cmpl $-0x51, %eax
setae %al
cmpl $0x2da, %ecx            # imm = 0x2DA
sete %r9b
orb %al, %r9b
jne 0xd732
movl 0x16c(%rsi), %eax
cmpl $0x19b, %eax            # imm = 0x19B
je 0xd732
cmpl $0x1a5, %eax            # imm = 0x1A5
je 0xd732
cmpl $0x64, 0x150(%rsi)
jne 0xd8a7
xorpd %xmm0, %xmm0
ucomisd 0x238(%rsi), %xmm0
jbe 0xd758
cmpl $0x3c0, 0x188(%rsi)     # imm = 0x3C0
jne 0xd758
leaq 0x2257b(%rip), %rdi     # 0x2fcce
jmp 0xd82c
movl %ecx, %eax
andl $-0x2, %eax
cmpl $0x14a, %eax            # imm = 0x14A
jne 0xd791
testb %r8b, %r8b
je 0xd825
movsd 0x148(%rsi), %xmm0
ucomisd 0x220f3(%rip), %xmm0    # 0x2f870
jne 0xd785
jnp 0xd87c
leaq 0x22578(%rip), %rdi     # 0x2fd04
jmp 0xd82c
xorl %eax, %eax
cmpl $0x2f8, %ecx            # imm = 0x2F8
jne 0xd875
movsd 0x210(%rsi), %xmm0
ucomisd 0x220c1(%rip), %xmm0    # 0x2f870
jne 0xd880
jp 0xd880
leaq 0x2255f(%rip), %rdi     # 0x2fd21
jmp 0xd82c
cmpl $0x2f8, %ecx            # imm = 0x2F8
je 0xd6e1
cmpl $0x1, 0x20c(%rsi)
je 0xd6e1
movl 0x1f4(%rsi), %r9d
addl $-0x42, %r9d
cmpl $0x3, %r9d
jb 0xd6e1
cmpl $0x64, 0x150(%rsi)
je 0xd6e1
cmpl $0x3d, 0x1f8(%rsi)
je 0xd6e1
cmpl $0x280, 0x184(%rsi)     # imm = 0x280
je 0xd6e1
leaq 0x22432(%rip), %rdi     # 0x2fc55
jmp 0xd82c
leaq 0x224ba(%rip), %rdi     # 0x2fce6
callq 0xb220
movq %rbx, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xb8e0
movl $0xc6d0, %edi           # imm = 0xC6D0
addq 0x2f716(%rip), %rdi     # 0x3cf60
leaq 0x225fb(%rip), %rsi     # 0x2fe4c
pushq $0x50
popq %rdx
callq 0xb940
movq 0x2f700(%rip), %rax     # 0x3cf60
andw $0x0, 0xc71f(%rax)
movl $0x1, 0xd670(%rax)
pushq $0x5
popq %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
xorl %eax, %eax
jmp 0xd875
andb %dil, %dl
testb %r8b, %dl
jne 0xd875
leaq 0x224aa(%rip), %rdi     # 0x2fd39
jmp 0xd82c
cmpl $0x42, 0x1f4(%rsi)
je 0xd558
leaq 0x222df(%rip), %rdi     # 0x2fb84
jmp 0xd82c
leaq 0x223fd(%rip), %rdi     # 0x2fcab
jmp 0xd82c
nop