// File: /workspace/github_cpp_makefile_star2_O1/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 0x74df(%rip), %rdi      # 0xf310
callq 0x5580
movq 0x100(%rbx), %r14
movq %rbx, (%rsp)
leaq 0xf0(%rbx), %rbp
cmpq %rbp, %r14
je 0x7e9f
leaq 0x62f8(%rip), %r15      # 0xe14c
leaq 0x6914(%rip), %r12      # 0xe76f
leaq 0x6916(%rip), %r13      # 0xe778
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 0x7e64
leaq 0x7488(%rip), %rdi      # 0xf32e
callq 0x5580
movq (%rsp), %rbx
movq 0xb0(%rbx), %rsi
leaq 0x68c3(%rip), %rdi      # 0xe780
xorl %eax, %eax
callq 0x5060
movq 0xb8(%rbx), %rsi
leaq 0x68bf(%rip), %rdi      # 0xe791
xorl %eax, %eax
callq 0x5060
movl 0xc0(%rbx), %esi
leaq 0x68bc(%rip), %rdi      # 0xe7a2
xorl %eax, %eax
callq 0x5060
movq 0xb0(%rbx), %rax
testq %rax, %rax
je 0x7efd
movq %rax, 0x48(%rbx)
movq 0xb8(%rbx), %rax
testq %rax, %rax
je 0x7f0d
movq %rax, 0x50(%rbx)
cmpl $0x0, 0xc0(%rbx)
js 0x7f49
leaq 0x7426(%rip), %rdi      # 0xf343
callq 0x5580
movl 0xc0(%rbx), %eax
addl $-0x2, %eax
cmpl $0x4, %eax
ja 0x7f49
movl $0x1b, %ecx
btl %eax, %ecx
jae 0x7f49
movl %eax, %eax
leaq 0x61ad(%rip), %rcx      # 0xe0f0
movl (%rcx,%rax,4), %eax
movl %eax, 0x18(%rbx)
cmpq $0x0, 0x30(%rbx)
setne %al
cmpq $0x0, 0x48(%rbx)
setne %cl
andb %al, %cl
leaq 0x7454(%rip), %rax      # 0xf3b6
leaq 0x7413(%rip), %rdi      # 0xf37c
cmovneq %rax, %rdi
movzbl %cl, %ebp
callq 0x5580
cmpq $0x0, 0x30(%rbx)
je 0x7f9e
cmpl $0x0, 0x18(%rbx)
je 0x7f92
leaq 0x7491(%rip), %rdi      # 0xf41a
callq 0x5580
incl %ebp
jmp 0x7f9e
leaq 0x744f(%rip), %rdi      # 0xf3e8
callq 0x5580
cmpq $0x0, 0x48(%rbx)
je 0x7fc7
cmpl $0x0, 0x18(%rbx)
je 0x7fb9
leaq 0x74a3(%rip), %rdi      # 0xf455
callq 0x5580
jmp 0x7fc7
leaq 0x74d0(%rip), %rdi      # 0xf490
callq 0x5580
incl %ebp
movq 0x70(%rbx), %rax
leaq 0x60(%rbx), %r15
cmpq %r15, %rax
je 0x8000
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 0x7fdb
jmp 0x8003
xorl %r14d, %r14d
testl %r14d, %r14d
je 0x8029
leaq 0x67a4(%rip), %rdi      # 0xe7b3
movl %r14d, %esi
xorl %eax, %eax
callq 0x5060
leaq 0x74b1(%rip), %rdi      # 0xf4d1
callq 0x5580
incl %ebp
jmp 0x805b
leaq 0x67b8(%rip), %rdi      # 0xe7e8
xorl %eax, %eax
callq 0x5060
cmpl $0x1, 0x1c(%rbx)
jne 0x8049
leaq 0x747d(%rip), %rdi      # 0xf4c1
callq 0x5580
cmpl $0x2, 0x1c(%rbx)
jne 0x805b
leaq 0x7473(%rip), %rdi      # 0xf4c9
callq 0x5580
leaq 0x67b7(%rip), %rdi      # 0xe819
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