// File: /workspace/github_cpp_makefile_star2_O3/nompelis[P]INTecplotLib/intecplot.cpp
// Function: inTec_Zone::ConsistencyCheck()
int inTec_Zone::ConsistencyCheck (void )
{
#ifdef _DEBUG_
   printf(" i Inside ConsistencyCheck() \n");
#endif
   int iret=0,ierror;

#ifdef _DEBUG_
   // display all stored keywords as they were found after sanitized parsing
   int i=0;
   const char *string=NULL,*string2=NULL;
   std::map< std::string, std::string > :: iterator imap;
   for( imap = keywords.begin(); imap != keywords.end(); ++imap ) {
      printf("   %d  ", i++ );
      string = (*imap).first.c_str();
      printf("   %16s ", string );
      string2 = (*imap).second.c_str();
      printf("= \"%s\"\n", string2 );
   }
#endif

//HERE1 (consistency checks not fully tested)
   //
   // first check for old-style variables
   // (possibly set a variable indicating that OLD switches are present)
   //
#ifdef _DEBUG_
   printf(" --- Old variables: \n");
   printf("   iold_n: %ld \n", iold_n);
   printf("   iold_e: %ld \n", iold_e);
   printf("   iold_et: %d \n", iold_et);
#endif
   /// give precedence to old switches... (incomplete)
   if( iold_n > 0 ) nodes = iold_n;
   if( iold_e > 0 ) elems = iold_e;
   if( iold_et > -1 ) {
#ifdef _DEBUG_
      printf(" --- Overriding ZONETYPE keyword; the ET keyword exists \n");
#endif
      if( iold_et == FETRIANGLE ) {
         ietype = FETRIANGLE;
      }
      if( iold_et == FETETRAHEDRON ) {
         ietype = FETETRAHEDRON;
      }
      if( iold_et == FEQUADRILATERAL ) {
         ietype = FEQUADRILATERAL;
      }
      if( iold_et == FEBRICK ) {
         ietype = FEBRICK;
      }
   }


   //
   // check for consistency in "sanitized" state
   //
   ierror = 0;
   if( im > 0 && nodes > 0 ) {
      printf(" e Specified both \"im/jm/km\" and \"nodes\" in zone \n");
      ierror = 1;
      iret += 1;
   } else {
#ifdef _DEBUG_
      printf(" --- Either I/J/K or N/NODES specified exclusively; good \n");
#endif
   }

   ierror = 0;
   if( im > 0 ) {
      if( ietype != ORDERED ) {
         printf(" e Conflicting specification of ZONETYPE and data provided\n");
         ierror = 1;
         iret += 1;
      } else {
#ifdef _DEBUG_
         printf(" --- ZONETYPE is ORDERED and I is non-zero; good \n");
#endif
      }
   }

   ierror = 0;
   if( nodes > 0 ) {
      if( ietype == ORDERED ) {
         printf(" e Number of nodes provided for an ordered zone \n");
         ierror = 1;
         iret += 1;
      } else {
#ifdef _DEBUG_
         printf(" --- ZONETYPE is not ORDERED while NODES is non-zero; good\n");
#endif
      }
   }


   // loop over all variable locations and if there are cell-centered values
   // the sanity check is that data cannot be point (only block)
   ierror = 0;
   std::map< int, int > :: iterator it;
   for( it = ivar_loc.begin(); it != ivar_loc.end(); ++it ) {
      if( (*it).second == 2 && idatapack != 2 ) ierror += 1;
   }
   if( ierror != 0 ) {
      printf(" e VARLOCATION is cell-centered for %d variables...\n", ierror );
      printf("   ...but DATAPACKING specified as POINT (must be BLOCK)\n");
      iret += 1;
   } else {
#ifdef _DEBUG_
      printf(" --- VARLOCATION is compatible with DATAPACKING ");
      if( idatapack == 1 ) printf("(POINT)\n");
      if( idatapack == 2 ) printf("(BLOCK)\n");
#endif
   }




#ifdef _DEBUG_
   printf(" i Exiting ConsistencyCheck() (return %d) \n",iret);
#endif
//printf("EXITING IN CONSISTENCY CHECK...\n");exit(1);//HACK
   return( iret );
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x76cf(%rip), %rdi      # 0xf3a8
callq 0x5570
movq 0x100(%rbx), %r14
movq %rbx, (%rsp)
leaq 0xf0(%rbx), %rbp
cmpq %rbp, %r14
je 0x7d47
leaq 0x64e8(%rip), %r15      # 0xe1e4
leaq 0x6b04(%rip), %r12      # 0xe807
leaq 0x6b06(%rip), %r13      # 0xe810
xorl %esi, %esi
leal 0x1(%rsi), %ebx
movq %r15, %rdi
xorl %eax, %eax
callq 0x5060
movq 0x20(%r14), %rsi
movq %r12, %rdi
xorl %eax, %eax
callq 0x5060
movq 0x40(%r14), %rsi
movq %r13, %rdi
xorl %eax, %eax
callq 0x5060
movq %r14, %rdi
callq 0x5200
movq %rax, %r14
movl %ebx, %esi
cmpq %rbp, %rax
jne 0x7d0c
leaq 0x7678(%rip), %rdi      # 0xf3c6
callq 0x5570
movq (%rsp), %rbx
movq 0xb0(%rbx), %rsi
leaq 0x6ab3(%rip), %rdi      # 0xe818
xorl %eax, %eax
callq 0x5060
movq 0xb8(%rbx), %rsi
leaq 0x6aaf(%rip), %rdi      # 0xe829
xorl %eax, %eax
callq 0x5060
movl 0xc0(%rbx), %esi
leaq 0x6aac(%rip), %rdi      # 0xe83a
xorl %eax, %eax
callq 0x5060
movq 0xb0(%rbx), %rax
testq %rax, %rax
je 0x7da5
movq %rax, 0x48(%rbx)
movq 0xb8(%rbx), %rax
testq %rax, %rax
je 0x7db5
movq %rax, 0x50(%rbx)
cmpl $0x0, 0xc0(%rbx)
js 0x7de2
leaq 0x7616(%rip), %rdi      # 0xf3db
callq 0x5570
movl 0xc0(%rbx), %eax
cmpl $0x6, %eax
ja 0x7de2
movl $0x6c, %ecx
btl %eax, %ecx
jae 0x7de2
movl %eax, 0x18(%rbx)
cmpq $0x0, 0x30(%rbx)
setne %al
cmpq $0x0, 0x48(%rbx)
setne %cl
andb %al, %cl
leaq 0x7653(%rip), %rax      # 0xf44e
leaq 0x7612(%rip), %rdi      # 0xf414
cmovneq %rax, %rdi
movzbl %cl, %ebp
callq 0x5570
cmpq $0x0, 0x30(%rbx)
je 0x7e37
cmpl $0x0, 0x18(%rbx)
je 0x7e2b
leaq 0x7690(%rip), %rdi      # 0xf4b2
callq 0x5570
incl %ebp
jmp 0x7e37
leaq 0x764e(%rip), %rdi      # 0xf480
callq 0x5570
cmpq $0x0, 0x48(%rbx)
je 0x7e60
cmpl $0x0, 0x18(%rbx)
je 0x7e52
leaq 0x76a2(%rip), %rdi      # 0xf4ed
callq 0x5570
jmp 0x7e60
leaq 0x76cf(%rip), %rdi      # 0xf528
callq 0x5570
incl %ebp
movq 0x70(%rbx), %rax
leaq 0x60(%rbx), %r15
cmpq %r15, %rax
je 0x7ebd
movl 0x1c(%rbx), %r12d
xorl %r14d, %r14d
cmpl $0x2, %r12d
setne %cl
cmpl $0x2, 0x24(%rax)
sete %dl
andb %cl, %dl
movzbl %dl, %ecx
addl %ecx, %r14d
movq %rax, %rdi
callq 0x5200
cmpq %r15, %rax
jne 0x7e74
testl %r14d, %r14d
je 0x7ebd
leaq 0x69a8(%rip), %rdi      # 0xe84b
movl %r14d, %esi
xorl %eax, %eax
callq 0x5060
leaq 0x76b5(%rip), %rdi      # 0xf569
callq 0x5570
incl %ebp
jmp 0x7ef3
leaq 0x69bc(%rip), %rdi      # 0xe880
xorl %eax, %eax
callq 0x5060
movl 0x1c(%rbx), %eax
cmpl $0x1, %eax
jne 0x7ee2
leaq 0x767f(%rip), %rdi      # 0xf559
callq 0x5570
movl 0x1c(%rbx), %eax
cmpl $0x2, %eax
jne 0x7ef3
leaq 0x7673(%rip), %rdi      # 0xf561
callq 0x5570
leaq 0x69b7(%rip), %rdi      # 0xe8b1
movl %ebp, %esi
xorl %eax, %eax
callq 0x5060
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq