// File: /workspace/github_cpp_makefile_star2_O2/sundale[P]gcode/rs274ngc/interp_check.cc
// Function: Interp::check_g_codes(block_struct*, setup_struct*)
int Interp::check_g_codes(block_pointer block,   //!< pointer to a block to be checked
                         setup_pointer settings)        //!< pointer to machine settings
{
  int mode0, mode1;
  int p_int;

  mode0 = block->g_modes[0];
  mode1 = block->g_modes[1];
  if (mode0 == -1) {
  } else if (mode0 == G_4) {
    CHKS((block->p_number == -1.0), NCE_DWELL_TIME_MISSING_WITH_G4);
  } else if (mode0 == G_10) {
    p_int = (int) (block->p_number + 0.0001);
    CHKS((block->l_number != 2 && block->l_number != 1 && block->l_number != 20 && block->l_number != 10), "Line with G10 does not have L1, L10, L2, or L20");
    CHKS((((block->p_number + 0.0001) - p_int) > 0.0002),  "P value not an integer with G10");
    CHKS((((block->l_number == 2 || block->l_number == 20) && ((p_int < 1) || (p_int > 9)))), "P value out of range with G10 L2 or G10 L20");
    CHKS((((block->l_number == 1 || block->l_number == 10) && p_int < 1)), "P value out of range with G10 L1 or G10 L10");
  } else if (mode0 == G_28) {
  } else if (mode0 == G_30) {
  } else if (mode0 == G_5_3) { 
      CHKS(((mode1 != G_5_2) && (mode1 != -1)), _("Between G5.2 and G5.3 codes, only additional G5.2 codes are allowed."));
  } else if (mode1 == G_5_2){
  } else if (mode0 == G_28_1 || mode0 == G_30_1) {
  } else if (mode0 == G_53) {
    CHKS(((block->motion_to_be != G_0) && (block->motion_to_be != G_1)),
        NCE_MUST_USE_G0_OR_G1_WITH_G53);
    CHKS(((block->g_modes[3] == G_91) ||
         ((block->g_modes[3] != G_90) &&
          (settings->distance_mode == MODE_INCREMENTAL))),
        NCE_CANNOT_USE_G53_INCREMENTAL);
  } else if (mode0 == G_92) {
  } else if ((mode0 == G_92_1) || (mode0 == G_92_2) || (mode0 == G_92_3)) {
  } else
    ERS(NCE_BUG_BAD_G_CODE_MODAL_GROUP_0);
  return INTERP_OK;
}

// Assembly:
movl 0x150(%rsi), %ecx
xorl %eax, %eax
cmpl $-0x1, %ecx
je 0xd25b
cmpl $0x12c, %ecx            # imm = 0x12C
je 0xd25b
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x154(%rsi), %edi
cmpl $0x35, %ecx
je 0xd0d4
cmpl $0x64, %ecx
je 0xd0fd
cmpl $0x118, %ecx            # imm = 0x118
je 0xd255
cmpl $0x28, %ecx
jne 0xd150
movsd 0x210(%rsi), %xmm0
ucomisd 0x227b1(%rip), %xmm0    # 0x2f870
jne 0xd255
jp 0xd255
leaq 0x227a6(%rip), %rdi     # 0x2f878
jmp 0xd0ed
cmpl $-0x1, %edi
je 0xd255
cmpl $0x34, %edi
je 0xd255
leaq 0x2284e(%rip), %rdi     # 0x2f93b
callq 0xb220
movq %rbx, %rdi
movq %rax, %rsi
jmp 0xd217
movl 0x1c8(%rsi), %ecx
cmpl $0x14, %ecx
ja 0xd1ef
movl $0x100406, %edx         # imm = 0x100406
btl %ecx, %edx
jae 0xd1ef
movsd 0x210(%rsi), %xmm0
addsd 0x22736(%rip), %xmm0    # 0x2f860
cvttsd2si %xmm0, %edx
cvtsi2sd %edx, %xmm1
subsd %xmm1, %xmm0
ucomisd 0x2272a(%rip), %xmm0    # 0x2f868
jbe 0xd1cf
leaq 0x22778(%rip), %rsi     # 0x2f8c3
jmp 0xd214
cmpl $0x34, %edi
je 0xd255
cmpl $0x119, %ecx            # imm = 0x119
je 0xd255
cmpl $0x12d, %ecx            # imm = 0x12D
je 0xd255
cmpl $0x398, %ecx            # imm = 0x398
je 0xd255
cmpl $0x212, %ecx            # imm = 0x212
jne 0xd25c
movl 0x1d8(%rsi), %ecx
testl %ecx, %ecx
je 0xd19c
cmpl $0xa, %ecx
jne 0xd273
movl 0x15c(%rsi), %ecx
cmpl $0x384, %ecx            # imm = 0x384
je 0xd255
cmpl $0x38e, %ecx            # imm = 0x38E
je 0xd1c3
cmpl $0x1, 0x668(%rdx)
jne 0xd255
leaq 0x227d1(%rip), %rdi     # 0x2f99b
jmp 0xd0ed
cmpl $0x1, %ecx
je 0xd1f8
cmpl $0x14, %ecx
je 0xd1de
cmpl $0x2, %ecx
jne 0xd1fe
addl $-0xa, %edx
cmpl $-0xa, %edx
ja 0xd255
leaq 0x226f6(%rip), %rsi     # 0x2f8e3
jmp 0xd214
leaq 0x2269d(%rip), %rsi     # 0x2f893
jmp 0xd214
testl %edx, %edx
jg 0xd255
jmp 0xd20d
cmpl $0xa, %ecx
sete %cl
testl %edx, %edx
setle %dl
testb %dl, %cl
je 0xd255
leaq 0x226fb(%rip), %rsi     # 0x2f90f
movq %rbx, %rdi
xorl %eax, %eax
callq 0xb8e0
movl $0xc6d0, %edi           # imm = 0xC6D0
addq 0x2fd36(%rip), %rdi     # 0x3cf60
leaq 0x22b28(%rip), %rsi     # 0x2fd59
pushq $0x50
popq %rdx
callq 0xb940
movq 0x2fd20(%rip), %rax     # 0x3cf60
andw $0x0, 0xc71f(%rax)
movl $0x1, 0xd670(%rax)
pushq $0x5
popq %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
addl $0xfffffc67, %ecx       # imm = 0xFFFFFC67
cmpl $0x3, %ecx
jb 0xd255
leaq 0x22748(%rip), %rdi     # 0x2f9b6
jmp 0xd0ed
leaq 0x22706(%rip), %rdi     # 0x2f980
jmp 0xd0ed
nop