// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x150(%rsi), %ecx
movl 0x154(%rsi), %edi
xorl %eax, %eax
cmpl $0x63, %ecx
jg 0xc059
cmpl $-0x1, %ecx
je 0xc217
cmpl $0x28, %ecx
je 0xc0f7
cmpl $0x35, %ecx
jne 0xc076
cmpl $-0x1, %edi
je 0xc217
cmpl $0x34, %edi
je 0xc217
leaq 0x278e7(%rip), %rdi     # 0x3393b
jmp 0xc11a
cmpl $0x64, %ecx
je 0xc0a8
cmpl $0x118, %ecx            # imm = 0x118
je 0xc217
cmpl $0x12c, %ecx            # imm = 0x12C
je 0xc217
cmpl $0x34, %edi
je 0xc217
cmpl $0x211, %ecx            # imm = 0x211
jg 0xc152
cmpl $0x119, %ecx            # imm = 0x119
je 0xc217
cmpl $0x12d, %ecx            # imm = 0x12D
je 0xc217
jmp 0xc21e
movl 0x1c8(%rsi), %ecx
cmpl $0x14, %ecx
ja 0xc1ac
movl $0x100406, %edx         # imm = 0x100406
btl %ecx, %edx
jae 0xc1ac
movsd 0x210(%rsi), %xmm0
addsd 0x2778b(%rip), %xmm0    # 0x33860
cvttsd2si %xmm0, %edx
cvtsi2sd %edx, %xmm1
subsd %xmm1, %xmm0
ucomisd 0x2777f(%rip), %xmm0    # 0x33868
jbe 0xc12a
leaq 0x277d1(%rip), %rsi     # 0x338c3
jmp 0xc1d1
movsd 0x210(%rsi), %xmm0
ucomisd 0x27769(%rip), %xmm0    # 0x33870
jne 0xc217
jp 0xc217
leaq 0x2775e(%rip), %rdi     # 0x33878
callq 0xa1f0
movq %rbx, %rdi
movq %rax, %rsi
jmp 0xc1d4
cmpl $0x1, %ecx
je 0xc1b5
cmpl $0x14, %ecx
je 0xc13d
cmpl $0x2, %ecx
jne 0xc1bb
addl $-0xa, %edx
cmpl $-0xa, %edx
ja 0xc217
leaq 0x27793(%rip), %rsi     # 0x338e3
jmp 0xc1d1
cmpl $0x398, %ecx            # imm = 0x398
je 0xc217
cmpl $0x212, %ecx            # imm = 0x212
jne 0xc21e
movl 0x1d8(%rsi), %ecx
testl %ecx, %ecx
je 0xc17d
cmpl $0xa, %ecx
jne 0xc235
movl 0x15c(%rsi), %ecx
cmpl $0x384, %ecx            # imm = 0x384
je 0xc217
cmpl $0x38e, %ecx            # imm = 0x38E
je 0xc1a0
cmpl $0x1, 0x668(%rdx)
jne 0xc217
leaq 0x277f4(%rip), %rdi     # 0x3399b
jmp 0xc11a
leaq 0x276e0(%rip), %rsi     # 0x33893
jmp 0xc1d1
testl %edx, %edx
jg 0xc217
jmp 0xc1ca
cmpl $0xa, %ecx
sete %cl
testl %edx, %edx
setle %dl
testb %dl, %cl
je 0xc217
leaq 0x2773e(%rip), %rsi     # 0x3390f
movq %rbx, %rdi
xorl %eax, %eax
callq 0xa850
movl $0xc6d0, %edi           # imm = 0xC6D0
addq 0x34d79(%rip), %rdi     # 0x40f60
leaq 0x27b6b(%rip), %rsi     # 0x33d59
movl $0x50, %edx
callq 0xa8a0
movq 0x34d61(%rip), %rax     # 0x40f60
movw $0x0, 0xc71f(%rax)
movl $0x1, 0xd670(%rax)
movl $0x5, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
addl $0xfffffc67, %ecx       # imm = 0xFFFFFC67
cmpl $0x3, %ecx
jb 0xc217
leaq 0x27786(%rip), %rdi     # 0x339b6
jmp 0xc11a
leaq 0x27744(%rip), %rdi     # 0x33980
jmp 0xc11a
nop