// File: nompelis[P]INTecplotLib/intecplot.cpp
// Function: inTec_File::ParseLoop()
int inTec_File::ParseLoop()
{
#ifdef _DEBUG_
   printf(" i Inside \"ParseLoop()\" \n");
#endif

   if( istate != 1 ) {
      printf(" e File not in a reading state\n");
      return(1);
   }

   char *buf=NULL;
   size_t ibuf_size=0;
   char *buf2=NULL;
   size_t ibuf_size2=0;

   while( !feof( fp ) ) {
      int ic;

      // information about the position in the file
      ipos = ftell( fp );
#ifdef _DEBUG_
      printf(" i Position in file at %ld bytes\n", ipos );
#endif

      // prepare the buffer
      memset( buf, '\0', ibuf_size );
      // read a line of data; get count of bytes read
      ic = inUtils_ReadTextline( &ibuf_size, &buf, fp );
      //// check for errors (negative numbers)
#ifdef _DEBUG3_
      printf("IC= %d, STRING: \"%s\"\n", ic, buf );
#endif

      // copy the string
      if( ibuf_size > ibuf_size2 ) {
//// need a temporary variable here in order to free the memory...
         buf2 = (char *) realloc( buf2, ibuf_size );
         ///// check for errors
         ibuf_size2 = ibuf_size;
      }
      memcpy( buf2, buf, ibuf_size );

      // store string
      if( ic > 0 ) {
         // increase line count
         ++iline;

         // store string in strings map
         // (Presently making the "line number" the key of hte mapping, but
         // it may be more useful to put the position in the file in bytes.)
         strings[ iline ] = buf;
#ifdef _DEBUG2_
         printf(" i Added to strings line %ld \n", iline );
#endif
         // show the line
         printf(" [%ld]  %s", iline, buf );
      }

      // sanitize the line
      inUtils_TrimLeadingSpaceTextline( buf2 );

      // determine what this line signifies
      int itype = IdentifyComponent( buf2 );
      int iret;
#ifdef _DEBUG_
      if( itype == Comment ) printf(" i Component is a comment line \n");
      if( itype == Title ) printf(" i Component is a title line \n");
      if( itype == Filetype ) printf(" i Component is a filetype line \n");
      if( itype == Variables ) printf(" i Component is a variables line \n");
      if( itype == Zone ) printf(" i Component is a zone \n");
      if( itype == Text ) printf(" i Component is a text \n");
      if( itype == Geometry ) printf(" i Component is a geometry \n");
#endif
      if( itype == Title ) iret = ParseComponent_Header( 1, buf2 );
      if( itype == Filetype ) iret = ParseComponent_Header( 2, buf2 );
      if( itype == Variables ) iret = ParseComponent_Header( 3, buf2 );
      if( itype == Zone ) iret = ParseComponent_Zone();
      if( itype == Text ) iret = ParseComponent_Text();
      if( itype == Geometry ) iret = ParseComponent_Geometry();

      // check return code (iret)


   }


   // drop the buffer
   free( buf );
   free( buf2 );

   return(0);
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0xa7df(%rip), %rdi      # 0x29379
movb $0x0, %al
callq 0x13070
movq 0x8(%rsp), %rax
cmpl $0x1, 0x8(%rax)
je 0x1ebc7
leaq 0xa7a6(%rip), %rdi      # 0x29359
movb $0x0, %al
callq 0x13070
movl $0x1, 0x54(%rsp)
jmp 0x1ee8f
movq $0x0, 0x40(%rsp)
movq $0x0, 0x38(%rsp)
movq $0x0, 0x30(%rsp)
movq $0x0, 0x28(%rsp)
movq 0x8(%rsp), %rax
movq 0x110(%rax), %rdi
callq 0x14990
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x1ec0d
jmp 0x1ee73
movq 0x8(%rsp), %rax
movq 0x110(%rax), %rdi
callq 0x13030
movq %rax, %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x128(%rax)
movq 0x128(%rax), %rsi
leaq 0xa758(%rip), %rdi      # 0x29393
movb $0x0, %al
callq 0x13070
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %rdx
xorl %esi, %esi
callq 0x13770
movq 0x8(%rsp), %rax
movq 0x110(%rax), %rdx
leaq 0x38(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x136b0
movl %eax, 0x24(%rsp)
movq 0x38(%rsp), %rax
cmpq 0x28(%rsp), %rax
jbe 0x1ec9c
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rsi
callq 0x14b50
movq %rax, 0x30(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x30(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x38(%rsp), %rdx
callq 0x13c70
cmpl $0x0, 0x24(%rsp)
jle 0x1ed22
movq 0x8(%rsp), %rax
movq 0x120(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x120(%rax)
movq 0x40(%rsp), %rcx
movq %rcx, (%rsp)
movq %rax, %rdi
addq $0x130, %rdi            # imm = 0x130
movq 0x120(%rax), %rax
movq %rax, 0x18(%rsp)
leaq 0x18(%rsp), %rsi
callq 0x148b0
movq (%rsp), %rsi
movq %rax, %rdi
callq 0x146a0
movq 0x8(%rsp), %rax
movq 0x120(%rax), %rsi
movq 0x40(%rsp), %rdx
leaq 0xa69a(%rip), %rdi      # 0x293b5
movb $0x0, %al
callq 0x13070
movq 0x30(%rsp), %rdi
callq 0x13060
movq 0x8(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x142b0
movl %eax, 0x14(%rsp)
cmpl $0x64, 0x14(%rsp)
jne 0x1ed54
leaq 0xa673(%rip), %rdi      # 0x293c0
movb $0x0, %al
callq 0x13070
cmpl $0xb, 0x14(%rsp)
jne 0x1ed69
leaq 0xa67f(%rip), %rdi      # 0x293e1
movb $0x0, %al
callq 0x13070
cmpl $0xc, 0x14(%rsp)
jne 0x1ed7e
leaq 0xa689(%rip), %rdi      # 0x29400
movb $0x0, %al
callq 0x13070
cmpl $0xd, 0x14(%rsp)
jne 0x1ed93
leaq 0xa696(%rip), %rdi      # 0x29422
movb $0x0, %al
callq 0x13070
cmpl $0x15, 0x14(%rsp)
jne 0x1eda8
leaq 0xa6a4(%rip), %rdi      # 0x29445
movb $0x0, %al
callq 0x13070
cmpl $0x1f, 0x14(%rsp)
jne 0x1edbd
leaq 0xa6a8(%rip), %rdi      # 0x2945e
movb $0x0, %al
callq 0x13070
cmpl $0x29, 0x14(%rsp)
jne 0x1edd2
leaq 0xa6ac(%rip), %rdi      # 0x29477
movb $0x0, %al
callq 0x13070
cmpl $0xb, 0x14(%rsp)
jne 0x1edf1
movq 0x8(%rsp), %rdi
movq 0x30(%rsp), %rdx
movl $0x1, %esi
callq 0x14450
movl %eax, 0x10(%rsp)
cmpl $0xc, 0x14(%rsp)
jne 0x1ee10
movq 0x8(%rsp), %rdi
movq 0x30(%rsp), %rdx
movl $0x2, %esi
callq 0x14450
movl %eax, 0x10(%rsp)
cmpl $0xd, 0x14(%rsp)
jne 0x1ee2f
movq 0x8(%rsp), %rdi
movq 0x30(%rsp), %rdx
movl $0x3, %esi
callq 0x14450
movl %eax, 0x10(%rsp)
cmpl $0x15, 0x14(%rsp)
jne 0x1ee44
movq 0x8(%rsp), %rdi
callq 0x13520
movl %eax, 0x10(%rsp)
cmpl $0x1f, 0x14(%rsp)
jne 0x1ee59
movq 0x8(%rsp), %rdi
callq 0x15060
movl %eax, 0x10(%rsp)
cmpl $0x29, 0x14(%rsp)
jne 0x1ee6e
movq 0x8(%rsp), %rdi
callq 0x13670
movl %eax, 0x10(%rsp)
jmp 0x1ebeb
movq 0x40(%rsp), %rdi
callq 0x14380
movq 0x30(%rsp), %rdi
callq 0x14380
movl $0x0, 0x54(%rsp)
movl 0x54(%rsp), %eax
addq $0x58, %rsp
retq
nopl (%rax,%rax)