// File: /workspace/github_cpp_makefile_star2_O3/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 0xc390
movl $0xfffffcdf, %eax       # imm = 0xFFFFFCDF
addl 0x154(%rsi), %eax
cmpl $0x62, %eax
ja 0xc390
leaq 0x27661(%rip), %rdi     # 0x339ec
jmp 0xc805
cmpb $0x1, 0x10(%rsi)
jne 0xc3b2
movl $0xfffffcdf, %eax       # imm = 0xFFFFFCDF
addl 0x154(%rsi), %eax
cmpl $0x62, %eax
ja 0xc3b2
leaq 0x2765f(%rip), %rdi     # 0x33a0c
jmp 0xc805
cmpb $0x1, 0x20(%rsi)
jne 0xc3d4
movl $0xfffffcdf, %eax       # imm = 0xFFFFFCDF
addl 0x154(%rsi), %eax
cmpl $0x62, %eax
ja 0xc3d4
leaq 0x2765c(%rip), %rdi     # 0x33a2b
jmp 0xc805
cmpb $0x1, 0x138(%rsi)
jne 0xc3ff
movl $0xfffffe66, %eax       # imm = 0xFFFFFE66
addl 0x16c(%rsi), %eax
cmpl $0xb, %eax
ja 0xc55e
movl $0xc03, %edx            # imm = 0xC03
btl %eax, %edx
jae 0xc55e
cmpl $0x2f8, %ecx            # imm = 0x2F8
je 0xc422
cmpb $0x0, 0x139(%rsi)
je 0xc422
movl 0x1f4(%rsi), %eax
addl $-0x42, %eax
cmpl $0x3, %eax
jae 0xc4f0
cmpb $0x1, 0x190(%rsi)
jne 0xc451
cmpl $0x2f8, %ecx            # imm = 0x2F8
sete %al
cmpl $0x1ae, 0x170(%rsi)     # imm = 0x1AE
sete %dl
orb %al, %dl
jne 0xc451
leaq 0x27664(%rip), %rdi     # 0x33ab0
jmp 0xc805
movb 0x198(%rsi), %dl
cmpb $0x1, %dl
jne 0xc47b
cmpl $0x33, %ecx
ja 0xc4fc
movl %ecx, %eax
movabsq $0xc000040100000, %rdi  # imm = 0xC000040100000
btq %rax, %rdi
jae 0xc4fc
movb 0x1a8(%rsi), %dil
cmpb $0x1, %dil
jne 0xc4a7
cmpl $0x33, %ecx
ja 0xc52d
movl %ecx, %eax
movabsq $0xc000040100000, %r8   # imm = 0xC000040100000
btq %rax, %r8
jae 0xc52d
movb 0x1b8(%rsi), %r8b
cmpb $0x1, %r8b
jne 0xc588
cmpl $0x149, %ecx            # imm = 0x149
jle 0xc57a
leal -0x14a(%rcx), %eax
cmpl $0x2, %eax
jb 0xc588
cmpl $0x2f8, %ecx            # imm = 0x2F8
je 0xc588
cmpl $0x366, %ecx            # imm = 0x366
je 0xc588
jmp 0xc640
leaq 0x2758b(%rip), %rdi     # 0x33a82
jmp 0xc805
cmpl $0x2f8, %ecx            # imm = 0x2F8
je 0xc47b
cmpl $0x366, %ecx            # imm = 0x366
je 0xc47b
cmpl $0x64, 0x150(%rsi)
je 0xc47b
leaq 0x275ac(%rip), %rdi     # 0x33ad4
jmp 0xc805
cmpl $0x2f8, %ecx            # imm = 0x2F8
je 0xc4a7
cmpl $0x366, %ecx            # imm = 0x366
je 0xc4a7
cmpl $0x64, 0x150(%rsi)
je 0xc4a7
leaq 0x275b7(%rip), %rdi     # 0x33b10
jmp 0xc805
cmpl $0x3c0, 0x188(%rsi)     # imm = 0x3C0
je 0xc3ff
leaq 0x274d5(%rip), %rdi     # 0x33a4a
jmp 0xc805
cmpl $0x14, %ecx
je 0xc588
cmpl $0x1e, %ecx
jne 0xc640
leal -0x37b(%rcx), %eax
cmpl $-0x52, %eax
ja 0xc5e1
cmpl $-0x1, 0x1c8(%rsi)
je 0xc5e1
cmpl $0x34, %ecx
je 0xc5e1
cmpl $0x2da, %ecx            # imm = 0x2DA
je 0xc5e1
cmpl $0x2f8, %ecx            # imm = 0x2F8
je 0xc5e1
cmpl $0x64, 0x150(%rsi)
je 0xc5e1
movl $0xfffffe66, %r9d       # imm = 0xFFFFFE66
addl 0x16c(%rsi), %r9d
cmpl $0xb, %r9d
ja 0xc86f
movl $0xc03, %r10d           # imm = 0xC03
btl %r9d, %r10d
jae 0xc86f
cmpb $0x1, 0x218(%rsi)
jne 0xc68d
movl 0x150(%rsi), %r9d
cmpl $0x28, %r9d
je 0xc68d
cmpl $0x64, %r9d
je 0xc68d
cmpl $0x280, 0x184(%rsi)     # imm = 0x280
je 0xc68d
cmpl $0x333, %ecx            # imm = 0x333
jle 0xc64c
leal -0x35c(%rcx), %r9d
cmpl $0x1e, %r9d
ja 0xc636
movl $0x40100001, %r10d      # imm = 0x40100001
btl %r9d, %r10d
jb 0xc68d
cmpl $0x334, %ecx            # imm = 0x334
je 0xc68d
jmp 0xc65e
leaq 0x27504(%rip), %rdi     # 0x33b4b
jmp 0xc805
cmpl $0x32, %ecx
je 0xc68d
cmpl $0x34, %ecx
je 0xc68d
cmpl $0x2f8, %ecx            # imm = 0x2F8
je 0xc68d
movl 0x204(%rsi), %r9d
addl $-0x32, %r9d
cmpl $0x4, %r9d
jb 0xc68d
movl 0x1f4(%rsi), %r9d
addl $-0x3e, %r9d
cmpl $0x5, %r9d
jb 0xc68d
cmpl $0x1, 0x20c(%rsi)
jne 0xc891
movsd 0x220(%rsi), %xmm0
ucomisd 0x271d3(%rip), %xmm0    # 0x33870
jne 0xc6a1
jnp 0xc6ba
cmpl $0x32, %ecx
je 0xc6ba
cmpl $0x2da, %ecx            # imm = 0x2DA
je 0xc6ba
cmpl $0x33e, %ecx            # imm = 0x33E
jne 0xc79d
cmpb $0x1, 0x229(%rsi)
jne 0xc70b
cmpl $0x14, %ecx
je 0xc70b
cmpl $0x1e, %ecx
je 0xc70b
cmpl $0x2f8, %ecx            # imm = 0x2F8
je 0xc70b
cmpl $-0x51, %eax
setae %al
cmpl $0x2da, %ecx            # imm = 0x2DA
sete %r9b
orb %al, %r9b
jne 0xc70b
movl 0x16c(%rsi), %eax
cmpl $0x19b, %eax            # imm = 0x19B
je 0xc70b
cmpl $0x1a5, %eax            # imm = 0x1A5
je 0xc70b
cmpl $0x64, 0x150(%rsi)
jne 0xc885
xorpd %xmm0, %xmm0
ucomisd 0x238(%rsi), %xmm0
jbe 0xc731
cmpl $0x3c0, 0x188(%rsi)     # imm = 0x3C0
jne 0xc731
leaq 0x275a2(%rip), %rdi     # 0x33cce
jmp 0xc805
movl %ecx, %eax
andl $-0x2, %eax
cmpl $0x14a, %eax            # imm = 0x14A
jne 0xc76a
testb %r8b, %r8b
je 0xc7fe
movsd 0x148(%rsi), %xmm0
ucomisd 0x2711a(%rip), %xmm0    # 0x33870
jne 0xc75e
jnp 0xc85a
leaq 0x2759f(%rip), %rdi     # 0x33d04
jmp 0xc805
xorl %eax, %eax
cmpl $0x2f8, %ecx            # imm = 0x2F8
jne 0xc853
movsd 0x210(%rsi), %xmm0
ucomisd 0x270e8(%rip), %xmm0    # 0x33870
jne 0xc85e
jp 0xc85e
leaq 0x27586(%rip), %rdi     # 0x33d21
jmp 0xc805
cmpl $0x2f8, %ecx            # imm = 0x2F8
je 0xc6ba
cmpl $0x1, 0x20c(%rsi)
je 0xc6ba
movl 0x1f4(%rsi), %r9d
addl $-0x42, %r9d
cmpl $0x3, %r9d
jb 0xc6ba
cmpl $0x64, 0x150(%rsi)
je 0xc6ba
cmpl $0x3d, 0x1f8(%rsi)
je 0xc6ba
cmpl $0x280, 0x184(%rsi)     # imm = 0x280
je 0xc6ba
leaq 0x27459(%rip), %rdi     # 0x33c55
jmp 0xc805
leaq 0x274e1(%rip), %rdi     # 0x33ce6
callq 0xa1f0
movq %rbx, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xa850
movl $0xc6d0, %edi           # imm = 0xC6D0
addq 0x3473d(%rip), %rdi     # 0x40f60
leaq 0x27622(%rip), %rsi     # 0x33e4c
movl $0x50, %edx
callq 0xa8a0
movq 0x34725(%rip), %rax     # 0x40f60
movw $0x0, 0xc71f(%rax)
movl $0x1, 0xd670(%rax)
movl $0x5, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
xorl %eax, %eax
jmp 0xc853
andb %dil, %dl
testb %r8b, %dl
jne 0xc853
leaq 0x274cc(%rip), %rdi     # 0x33d39
jmp 0xc805
cmpl $0x42, 0x1f4(%rsi)
je 0xc5e1
leaq 0x27301(%rip), %rdi     # 0x33b84
jmp 0xc805
leaq 0x2741f(%rip), %rdi     # 0x33cab
jmp 0xc805
leaq 0x27347(%rip), %rdi     # 0x33bdf
jmp 0xc805
nopl (%rax)