// File: /workspace/github_cpp_makefile_star2_O2/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 0x6901(%rip), %rdi      # 0x103a8
callq 0x77b0
movq 0x100(%rbx), %r15
movq %rbx, (%rsp)
leaq 0xf0(%rbx), %rbp
leaq 0x571f(%rip), %r14      # 0xf1e4
leaq 0x5d3b(%rip), %r12      # 0xf807
leaq 0x5d3d(%rip), %r13      # 0xf810
xorl %esi, %esi
cmpq %rbp, %r15
je 0x9b12
leal 0x1(%rsi), %ebx
movq %r14, %rdi
xorl %eax, %eax
callq 0x7060
movq 0x20(%r15), %rsi
movq %r12, %rdi
xorl %eax, %eax
callq 0x7060
movq 0x40(%r15), %rsi
movq %r13, %rdi
xorl %eax, %eax
callq 0x7060
movq %r15, %rdi
callq 0x72f0
movq %rax, %r15
movl %ebx, %esi
jmp 0x9ad5
leaq 0x68ad(%rip), %rdi      # 0x103c6
callq 0x77b0
movq (%rsp), %rbx
movq 0xb0(%rbx), %rsi
leaq 0x5ce8(%rip), %rdi      # 0xf818
xorl %eax, %eax
callq 0x7060
movq 0xb8(%rbx), %rsi
leaq 0x5ce4(%rip), %rdi      # 0xf829
xorl %eax, %eax
callq 0x7060
movl 0xc0(%rbx), %esi
leaq 0x5ce1(%rip), %rdi      # 0xf83a
xorl %eax, %eax
callq 0x7060
movq 0xb0(%rbx), %rax
testq %rax, %rax
je 0x9b70
movq %rax, 0x48(%rbx)
movq 0xb8(%rbx), %rax
testq %rax, %rax
je 0x9b80
movq %rax, 0x50(%rbx)
cmpl $0x0, 0xc0(%rbx)
js 0x9bab
leaq 0x684b(%rip), %rdi      # 0x103db
callq 0x77b0
movl 0xc0(%rbx), %eax
cmpl $0x6, %eax
ja 0x9bab
pushq $0x6c
popq %rcx
btl %eax, %ecx
jae 0x9bab
movl %eax, 0x18(%rbx)
cmpq $0x0, 0x30(%rbx)
setne %al
cmpq $0x0, 0x48(%rbx)
setne %cl
andb %al, %cl
leaq 0x688a(%rip), %rax      # 0x1044e
leaq 0x6849(%rip), %rdi      # 0x10414
cmovneq %rax, %rdi
movzbl %cl, %ebp
callq 0x77b0
cmpq $0x0, 0x30(%rbx)
je 0x9c00
cmpl $0x0, 0x18(%rbx)
je 0x9bf4
leaq 0x68c7(%rip), %rdi      # 0x104b2
callq 0x77b0
incl %ebp
jmp 0x9c00
leaq 0x6885(%rip), %rdi      # 0x10480
callq 0x77b0
cmpq $0x0, 0x48(%rbx)
je 0x9c29
cmpl $0x0, 0x18(%rbx)
je 0x9c1b
leaq 0x68d9(%rip), %rdi      # 0x104ed
callq 0x77b0
jmp 0x9c29
leaq 0x6906(%rip), %rdi      # 0x10528
callq 0x77b0
incl %ebp
movq 0x70(%rbx), %rax
leaq 0x60(%rbx), %r15
movl 0x1c(%rbx), %r12d
xorl %r14d, %r14d
cmpq %r15, %rax
je 0x9c5d
cmpl $0x2, %r12d
setne %cl
cmpl $0x2, 0x24(%rax)
sete %dl
andb %cl, %dl
movzbl %dl, %ecx
addl %ecx, %r14d
movq %rax, %rdi
callq 0x72f0
jmp 0x9c38
testl %r14d, %r14d
je 0x9c83
leaq 0x5be2(%rip), %rdi      # 0xf84b
movl %r14d, %esi
xorl %eax, %eax
callq 0x7060
leaq 0x68ef(%rip), %rdi      # 0x10569
callq 0x77b0
incl %ebp
jmp 0x9cb9
leaq 0x5bf6(%rip), %rdi      # 0xf880
xorl %eax, %eax
callq 0x7060
movl 0x1c(%rbx), %eax
cmpl $0x1, %eax
jne 0x9ca8
leaq 0x68b9(%rip), %rdi      # 0x10559
callq 0x77b0
movl 0x1c(%rbx), %eax
cmpl $0x2, %eax
jne 0x9cb9
leaq 0x68ad(%rip), %rdi      # 0x10561
callq 0x77b0
leaq 0x5bf1(%rip), %rdi      # 0xf8b1
movl %ebp, %esi
xorl %eax, %eax
callq 0x7060
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq