// File: /workspace/github_cpp_makefile_star2_O1/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 0xc091
cmpl $-0x1, %ecx
je 0xc267
cmpl $0x28, %ecx
je 0xc12f
cmpl $0x35, %ecx
jne 0xc0ae
cmpl $-0x1, %edi
je 0xc267
cmpl $0x34, %edi
je 0xc267
leaq 0x2a8af(%rip), %rdi     # 0x3693b
jmp 0xc152
cmpl $0x64, %ecx
je 0xc0e0
cmpl $0x118, %ecx            # imm = 0x118
je 0xc267
cmpl $0x12c, %ecx            # imm = 0x12C
je 0xc267
cmpl $0x34, %edi
je 0xc267
cmpl $0x211, %ecx            # imm = 0x211
jg 0xc18d
cmpl $0x119, %ecx            # imm = 0x119
je 0xc267
cmpl $0x12d, %ecx            # imm = 0x12D
je 0xc267
jmp 0xc26e
movl 0x1c8(%rsi), %ecx
cmpl $0x14, %ecx
ja 0xc1eb
movl $0x100406, %edx         # imm = 0x100406
btl %ecx, %edx
jae 0xc1eb
movsd 0x210(%rsi), %xmm0
addsd 0x2a753(%rip), %xmm0    # 0x36860
cvttsd2si %xmm0, %edx
cvtsi2sd %edx, %xmm1
subsd %xmm1, %xmm0
ucomisd 0x2a747(%rip), %xmm0    # 0x36868
jbe 0xc162
leaq 0x2a799(%rip), %rsi     # 0x368c3
jmp 0xc215
movsd 0x210(%rsi), %xmm0
ucomisd 0x2a731(%rip), %xmm0    # 0x36870
jne 0xc267
jp 0xc267
leaq 0x2a726(%rip), %rdi     # 0x36878
callq 0xa1f0
movq %rbx, %rdi
movq %rax, %rsi
jmp 0xc218
cmpl $0x1, %ecx
je 0xc1f9
cmpl $0x14, %ecx
je 0xc179
cmpl $0x2, %ecx
jne 0xc1ff
leal -0xa(%rdx), %esi
cmpl $-0xa, %esi
ja 0xc1f4
leaq 0x2a75b(%rip), %rsi     # 0x368e3
jmp 0xc215
cmpl $0x398, %ecx            # imm = 0x398
je 0xc267
cmpl $0x212, %ecx            # imm = 0x212
jne 0xc26e
movl 0x1d8(%rsi), %ecx
testl %ecx, %ecx
je 0xc1b8
cmpl $0xa, %ecx
jne 0xc285
movl 0x15c(%rsi), %ecx
cmpl $0x384, %ecx            # imm = 0x384
je 0xc267
cmpl $0x38e, %ecx            # imm = 0x38E
je 0xc1df
cmpl $0x1, 0x668(%rdx)
jne 0xc267
leaq 0x2a7b5(%rip), %rdi     # 0x3699b
jmp 0xc152
leaq 0x2a6a1(%rip), %rsi     # 0x36893
jmp 0xc215
cmpl $0x1, %ecx
jne 0xc1ff
testl %edx, %edx
jg 0xc267
jmp 0xc20e
cmpl $0xa, %ecx
sete %cl
testl %edx, %edx
setle %dl
testb %dl, %cl
je 0xc267
leaq 0x2a6fa(%rip), %rsi     # 0x3690f
movq %rbx, %rdi
xorl %eax, %eax
callq 0xa850
movq 0x37d3a(%rip), %rdi     # 0x43f60
movl $0x0, 0xd670(%rdi)
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0x2ab1b(%rip), %rsi     # 0x36d59
movl $0x50, %edx
callq 0xa8a0
movq 0x37d11(%rip), %rax     # 0x43f60
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 0xc267
leaq 0x2a736(%rip), %rdi     # 0x369b6
jmp 0xc152
leaq 0x2a6f4(%rip), %rdi     # 0x36980
jmp 0xc152
nop