// File: 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:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0xf11b(%rip), %rdi      # 0x28a15
movb $0x0, %al
callq 0x13070
movl $0x0, 0x5c(%rsp)
movl $0x0, 0x54(%rsp)
movq $0x0, 0x48(%rsp)
movq $0x0, 0x40(%rsp)
leaq 0x38(%rsp), %rdi
callq 0x13660
movq 0x8(%rsp), %rdi
addq $0xe8, %rdi
callq 0x14600
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x8(%rsp), %rdi
addq $0xe8, %rdi
callq 0x13980
movq %rax, 0x28(%rsp)
leaq 0x38(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x13d70
testb $0x1, %al
jne 0x1997b
jmp 0x199fd
movl 0x54(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x54(%rsp)
leaq 0xe704(%rip), %rdi      # 0x28093
movb $0x0, %al
callq 0x13070
leaq 0x38(%rsp), %rdi
callq 0x13c00
movq %rax, %rdi
callq 0x134f0
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rsi
leaq 0xf07b(%rip), %rdi      # 0x28a34
movb $0x0, %al
callq 0x13070
leaq 0x38(%rsp), %rdi
callq 0x13c00
movq %rax, %rdi
addq $0x20, %rdi
callq 0x134f0
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rsi
leaq 0xf056(%rip), %rdi      # 0x28a3d
movb $0x0, %al
callq 0x13070
leaq 0x38(%rsp), %rdi
callq 0x14ef0
jmp 0x1994d
leaq 0xf041(%rip), %rdi      # 0x28a45
movb $0x0, %al
callq 0x13070
movq 0x8(%rsp), %rax
movq 0xb0(%rax), %rsi
leaq 0xf03d(%rip), %rdi      # 0x28a5b
movb $0x0, %al
callq 0x13070
movq 0x8(%rsp), %rax
movq 0xb8(%rax), %rsi
leaq 0xf034(%rip), %rdi      # 0x28a6c
movb $0x0, %al
callq 0x13070
movq 0x8(%rsp), %rax
movl 0xc0(%rax), %esi
leaq 0xf02c(%rip), %rdi      # 0x28a7d
movb $0x0, %al
callq 0x13070
movq 0x8(%rsp), %rax
cmpq $0x0, 0xb0(%rax)
jbe 0x19a77
movq 0x8(%rsp), %rax
movq 0xb0(%rax), %rcx
movq %rcx, 0x48(%rax)
movq 0x8(%rsp), %rax
cmpq $0x0, 0xb8(%rax)
jbe 0x19a96
movq 0x8(%rsp), %rax
movq 0xb8(%rax), %rcx
movq %rcx, 0x50(%rax)
movq 0x8(%rsp), %rax
cmpl $-0x1, 0xc0(%rax)
jle 0x19b1c
leaq 0xefe3(%rip), %rdi      # 0x28a8e
movb $0x0, %al
callq 0x13070
movq 0x8(%rsp), %rax
cmpl $0x2, 0xc0(%rax)
jne 0x19acc
movq 0x8(%rsp), %rax
movl $0x2, 0x18(%rax)
movq 0x8(%rsp), %rax
cmpl $0x5, 0xc0(%rax)
jne 0x19ae6
movq 0x8(%rsp), %rax
movl $0x5, 0x18(%rax)
movq 0x8(%rsp), %rax
cmpl $0x3, 0xc0(%rax)
jne 0x19b00
movq 0x8(%rsp), %rax
movl $0x3, 0x18(%rax)
movq 0x8(%rsp), %rax
cmpl $0x6, 0xc0(%rax)
jne 0x19b1a
movq 0x8(%rsp), %rax
movl $0x6, 0x18(%rax)
jmp 0x19b1c
movq 0x8(%rsp), %rax
movl $0x0, 0x58(%rsp)
cmpq $0x0, 0x30(%rax)
jbe 0x19b5f
movq 0x8(%rsp), %rax
cmpq $0x0, 0x48(%rax)
jbe 0x19b5f
leaq 0xef85(%rip), %rdi      # 0x28ac8
movb $0x0, %al
callq 0x13070
movl $0x1, 0x58(%rsp)
movl 0x5c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
jmp 0x19b6d
leaq 0xef95(%rip), %rdi      # 0x28afb
movb $0x0, %al
callq 0x13070
movq 0x8(%rsp), %rax
movl $0x0, 0x58(%rsp)
cmpq $0x0, 0x30(%rax)
jbe 0x19bbf
movq 0x8(%rsp), %rax
cmpl $0x0, 0x18(%rax)
je 0x19baf
leaq 0xefa3(%rip), %rdi      # 0x28b36
movb $0x0, %al
callq 0x13070
movl $0x1, 0x58(%rsp)
movl 0x5c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
jmp 0x19bbd
leaq 0xefbc(%rip), %rdi      # 0x28b72
movb $0x0, %al
callq 0x13070
jmp 0x19bbf
movq 0x8(%rsp), %rax
movl $0x0, 0x58(%rsp)
cmpq $0x0, 0x48(%rax)
jbe 0x19c11
movq 0x8(%rsp), %rax
cmpl $0x0, 0x18(%rax)
jne 0x19c01
leaq 0xefc0(%rip), %rdi      # 0x28ba5
movb $0x0, %al
callq 0x13070
movl $0x1, 0x58(%rsp)
movl 0x5c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
jmp 0x19c0f
leaq 0xefcf(%rip), %rdi      # 0x28bd7
movb $0x0, %al
callq 0x13070
jmp 0x19c11
movl $0x0, 0x58(%rsp)
leaq 0x20(%rsp), %rdi
callq 0x14e30
movq 0x8(%rsp), %rdi
addq $0x58, %rdi
callq 0x14e00
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x8(%rsp), %rdi
addq $0x58, %rdi
callq 0x141e0
movq %rax, 0x10(%rsp)
leaq 0x20(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x14950
testb $0x1, %al
jne 0x19c68
jmp 0x19c9c
leaq 0x20(%rsp), %rdi
callq 0x14290
cmpl $0x2, 0x4(%rax)
jne 0x19c8e
movq 0x8(%rsp), %rax
cmpl $0x2, 0x1c(%rax)
je 0x19c8e
movl 0x58(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x58(%rsp)
jmp 0x19c90
leaq 0x20(%rsp), %rdi
callq 0x13940
jmp 0x19c40
cmpl $0x0, 0x58(%rsp)
je 0x19cd0
movl 0x58(%rsp), %esi
leaq 0xef65(%rip), %rdi      # 0x28c13
movb $0x0, %al
callq 0x13070
leaq 0xef8c(%rip), %rdi      # 0x28c48
movb $0x0, %al
callq 0x13070
movl 0x5c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
jmp 0x19d12
leaq 0xefab(%rip), %rdi      # 0x28c82
movb $0x0, %al
callq 0x13070
movq 0x8(%rsp), %rax
cmpl $0x1, 0x1c(%rax)
jne 0x19cf7
leaq 0xefc3(%rip), %rdi      # 0x28cb3
movb $0x0, %al
callq 0x13070
movq 0x8(%rsp), %rax
cmpl $0x2, 0x1c(%rax)
jne 0x19d10
leaq 0xefb3(%rip), %rdi      # 0x28cbc
movb $0x0, %al
callq 0x13070
jmp 0x19d12
movl 0x5c(%rsp), %esi
leaq 0xefa8(%rip), %rdi      # 0x28cc5
movb $0x0, %al
callq 0x13070
movl 0x5c(%rsp), %eax
addq $0x68, %rsp
retq
nopl (%rax)