// File: /workspace/github_cpp_makefile_star2_O1/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 0xc4be
movl $0xfffffcdf, %eax       # imm = 0xFFFFFCDF
addl 0x154(%rsi), %eax
cmpl $0x62, %eax
ja 0xc4be
leaq 0x2a533(%rip), %rdi     # 0x369ec
jmp 0xc938
cmpb $0x1, 0x10(%rsi)
jne 0xc4e0
movl $0xfffffcdf, %eax       # imm = 0xFFFFFCDF
addl 0x154(%rsi), %eax
cmpl $0x62, %eax
ja 0xc4e0
leaq 0x2a531(%rip), %rdi     # 0x36a0c
jmp 0xc938
cmpb $0x1, 0x20(%rsi)
jne 0xc502
movl $0xfffffcdf, %eax       # imm = 0xFFFFFCDF
addl 0x154(%rsi), %eax
cmpl $0x62, %eax
ja 0xc502
leaq 0x2a52e(%rip), %rdi     # 0x36a2b
jmp 0xc938
cmpb $0x1, 0x138(%rsi)
jne 0xc52d
movl $0xfffffe66, %eax       # imm = 0xFFFFFE66
addl 0x16c(%rsi), %eax
cmpl $0xb, %eax
ja 0xc68c
movl $0xc03, %edx            # imm = 0xC03
btl %eax, %edx
jae 0xc68c
cmpl $0x2f8, %ecx            # imm = 0x2F8
je 0xc550
cmpb $0x0, 0x139(%rsi)
je 0xc550
movl 0x1f4(%rsi), %eax
addl $-0x42, %eax
cmpl $0x3, %eax
jae 0xc61e
cmpb $0x1, 0x190(%rsi)
jne 0xc57f
cmpl $0x2f8, %ecx            # imm = 0x2F8
sete %al
cmpl $0x1ae, 0x170(%rsi)     # imm = 0x1AE
sete %dl
orb %al, %dl
jne 0xc57f
leaq 0x2a536(%rip), %rdi     # 0x36ab0
jmp 0xc938
movb 0x198(%rsi), %dl
cmpb $0x1, %dl
jne 0xc5a9
cmpl $0x33, %ecx
ja 0xc62a
movl %ecx, %eax
movabsq $0xc000040100000, %rdi  # imm = 0xC000040100000
btq %rax, %rdi
jae 0xc62a
movb 0x1a8(%rsi), %dil
cmpb $0x1, %dil
jne 0xc5d5
cmpl $0x33, %ecx
ja 0xc65b
movl %ecx, %eax
movabsq $0xc000040100000, %r8   # imm = 0xC000040100000
btq %rax, %r8
jae 0xc65b
movb 0x1b8(%rsi), %r8b
cmpb $0x1, %r8b
jne 0xc6b6
cmpl $0x149, %ecx            # imm = 0x149
jle 0xc6a8
leal -0x14a(%rcx), %eax
cmpl $0x2, %eax
jb 0xc6b6
cmpl $0x2f8, %ecx            # imm = 0x2F8
je 0xc6b6
cmpl $0x366, %ecx            # imm = 0x366
je 0xc6b6
jmp 0xc76e
leaq 0x2a45d(%rip), %rdi     # 0x36a82
jmp 0xc938
cmpl $0x2f8, %ecx            # imm = 0x2F8
je 0xc5a9
cmpl $0x366, %ecx            # imm = 0x366
je 0xc5a9
cmpl $0x64, 0x150(%rsi)
je 0xc5a9
leaq 0x2a47e(%rip), %rdi     # 0x36ad4
jmp 0xc938
cmpl $0x2f8, %ecx            # imm = 0x2F8
je 0xc5d5
cmpl $0x366, %ecx            # imm = 0x366
je 0xc5d5
cmpl $0x64, 0x150(%rsi)
je 0xc5d5
leaq 0x2a489(%rip), %rdi     # 0x36b10
jmp 0xc938
cmpl $0x3c0, 0x188(%rsi)     # imm = 0x3C0
je 0xc52d
leaq 0x2a3a7(%rip), %rdi     # 0x36a4a
jmp 0xc938
cmpl $0x14, %ecx
je 0xc6b6
cmpl $0x1e, %ecx
jne 0xc76e
leal -0x37b(%rcx), %eax
cmpl $-0x52, %eax
ja 0xc70f
cmpl $-0x1, 0x1c8(%rsi)
je 0xc70f
cmpl $0x34, %ecx
je 0xc70f
cmpl $0x2da, %ecx            # imm = 0x2DA
je 0xc70f
cmpl $0x2f8, %ecx            # imm = 0x2F8
je 0xc70f
cmpl $0x64, 0x150(%rsi)
je 0xc70f
movl $0xfffffe66, %r9d       # imm = 0xFFFFFE66
addl 0x16c(%rsi), %r9d
cmpl $0xb, %r9d
ja 0xc999
movl $0xc03, %r10d           # imm = 0xC03
btl %r9d, %r10d
jae 0xc999
cmpb $0x1, 0x218(%rsi)
jne 0xc7bb
movl 0x150(%rsi), %r9d
cmpl $0x28, %r9d
je 0xc7bb
cmpl $0x64, %r9d
je 0xc7bb
cmpl $0x280, 0x184(%rsi)     # imm = 0x280
je 0xc7bb
cmpl $0x333, %ecx            # imm = 0x333
jle 0xc77a
leal -0x35c(%rcx), %r9d
cmpl $0x1e, %r9d
ja 0xc764
movl $0x40100001, %r10d      # imm = 0x40100001
btl %r9d, %r10d
jb 0xc7bb
cmpl $0x334, %ecx            # imm = 0x334
je 0xc7bb
jmp 0xc78c
leaq 0x2a3d6(%rip), %rdi     # 0x36b4b
jmp 0xc938
cmpl $0x32, %ecx
je 0xc7bb
cmpl $0x34, %ecx
je 0xc7bb
cmpl $0x2f8, %ecx            # imm = 0x2F8
je 0xc7bb
movl 0x204(%rsi), %r9d
addl $-0x32, %r9d
cmpl $0x4, %r9d
jb 0xc7bb
movl 0x1f4(%rsi), %r9d
addl $-0x3e, %r9d
cmpl $0x5, %r9d
jb 0xc7bb
cmpl $0x1, 0x20c(%rsi)
jne 0xc9b8
movsd 0x220(%rsi), %xmm0
ucomisd 0x2a0a5(%rip), %xmm0    # 0x36870
jne 0xc7cf
jnp 0xc7e8
cmpl $0x32, %ecx
je 0xc7e8
cmpl $0x2da, %ecx            # imm = 0x2DA
je 0xc7e8
cmpl $0x33e, %ecx            # imm = 0x33E
jne 0xc8bf
cmpb $0x1, 0x229(%rsi)
jne 0xc839
cmpl $0x14, %ecx
je 0xc839
cmpl $0x1e, %ecx
je 0xc839
cmpl $0x2f8, %ecx            # imm = 0x2F8
je 0xc839
cmpl $-0x51, %eax
setae %al
cmpl $0x2da, %ecx            # imm = 0x2DA
sete %r9b
orb %al, %r9b
jne 0xc839
movl 0x16c(%rsi), %eax
cmpl $0x19b, %eax            # imm = 0x19B
je 0xc839
cmpl $0x1a5, %eax            # imm = 0x1A5
je 0xc839
cmpl $0x64, 0x150(%rsi)
jne 0xc9af
xorpd %xmm0, %xmm0
ucomisd 0x238(%rsi), %xmm0
jbe 0xc85f
cmpl $0x3c0, 0x188(%rsi)     # imm = 0x3C0
jne 0xc85f
leaq 0x2a474(%rip), %rdi     # 0x36cce
jmp 0xc938
movl %ecx, %eax
andl $-0x2, %eax
cmpl $0x14a, %eax            # imm = 0x14A
jne 0xc894
testb %r8b, %r8b
je 0xc920
movsd 0x148(%rsi), %xmm0
ucomisd 0x29fec(%rip), %xmm0    # 0x36870
jne 0xc888
jnp 0xc894
leaq 0x2a475(%rip), %rdi     # 0x36d04
jmp 0xc938
xorl %eax, %eax
cmpl $0x2f8, %ecx            # imm = 0x2F8
jne 0xc992
movsd 0x210(%rsi), %xmm0
ucomisd 0x29fbe(%rip), %xmm0    # 0x36870
jne 0xc929
jp 0xc929
leaq 0x2a464(%rip), %rdi     # 0x36d21
jmp 0xc938
cmpl $0x2f8, %ecx            # imm = 0x2F8
je 0xc7e8
cmpl $0x1, 0x20c(%rsi)
je 0xc7e8
movl 0x1f4(%rsi), %r9d
addl $-0x42, %r9d
cmpl $0x3, %r9d
jb 0xc7e8
cmpl $0x64, 0x150(%rsi)
je 0xc7e8
cmpl $0x3d, 0x1f8(%rsi)
je 0xc7e8
cmpl $0x280, 0x184(%rsi)     # imm = 0x280
je 0xc7e8
leaq 0x2a337(%rip), %rdi     # 0x36c55
jmp 0xc938
leaq 0x2a3bf(%rip), %rdi     # 0x36ce6
jmp 0xc938
andb %dil, %dl
testb %r8b, %dl
jne 0xc992
leaq 0x2a401(%rip), %rdi     # 0x36d39
callq 0xa1f0
movq %rbx, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xa850
movq 0x3760f(%rip), %rdi     # 0x43f60
movl $0x0, 0xd670(%rdi)
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x2a4e3(%rip), %rsi     # 0x36e4c
movl $0x50, %edx
callq 0xa8a0
movq 0x375e6(%rip), %rax     # 0x43f60
movw $0x0, 0xc71f(%rax)
movl $0x1, 0xd670(%rax)
movl $0x5, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
cmpl $0x42, 0x1f4(%rsi)
je 0xc70f
leaq 0x2a1d7(%rip), %rdi     # 0x36b84
jmp 0xc938
leaq 0x2a2f5(%rip), %rdi     # 0x36cab
jmp 0xc938
leaq 0x2a220(%rip), %rdi     # 0x36bdf
jmp 0xc938