// File: /workspace/github_cpp_makefile_star2_O2/nompelis[P]INTecplotLib/intecplot.cpp
// Function: inTec_Zone::ParseNumericData(char*)
int inTec_Zone::ParseNumericData( char *buf )
{
#ifdef _DEBUG2_
   printf(" i Parsing numeric data \n");
#endif
   // set the numeric parsing state when we first try to parse data
   if( iparse_num == 0 ) {
      iparse_num = 1;      // indicates that we are begining to parse data
   } else if( iparse_num == 1 ) {

   } else if( iparse_num == 2 ) {
      iparse_num = 3;
#ifdef _DEBUG_
   printf(" i Switched to parsing connectivity data \n");
#endif
   } else {
      // now that the check completed; reset bounds?????
   }


#ifdef _DEBUG2_
   printf(" --- String to parse: --->|%s|<---\n", buf );
#endif

   // clean-up all fortran double-precision formatting
   size_t i=0;
   while( buf[i] != '\0' && buf[i] != '\n' ) {
      if( buf[i] == 'd' || buf[i] == 'D' ) buf[i] = 'e';
   // if( buf[i] == ',' ) buf[i] = ' ';
      ++i;
   }

   // parse segments separated by spaces or commas (expecting reals/doubles)
   if( iparse_num == 1 ) {
      char *string,*token,*sr;
      for( i=0, string = buf; ; ++i, string = NULL ) {
         token = strtok_r( string, " ,", &sr );
         if( token == NULL ) break;
#ifdef _DEBUG2_
         printf(" --- token: --->|%s|<--- \n", token );
#endif

         char *c;
         double d = strtod( token, &c );
#ifdef _DEBUG2_
         printf(" --- value: %lf \n", d );
#endif

#ifdef _DEBUG2_
         // display internal counter states
         printf(" --- node_cnt: %ld  elem_cnt: %ld  var_cnt: %d (prior) \n",
                node_cnt, elem_cnt, var_cnt );
#endif

         // get pointer to data array for variable
         double *dp = var_vec[ var_cnt ];
#ifdef _DEBUG2_
         printf(" --- pointer: %p    (varloc.: %d) \n", dp,ivar_loc[var_cnt+1]);
#endif

         if( idatapack == 1 ) {   // POINT
            dp[ node_cnt ] = d;

            // update counters
            ++var_cnt;
            if( var_cnt == num_var ) {
               ++node_cnt;

               // check for a termination condition
               if( node_cnt == nodes ) {
                  node_cnt = 0;
#ifdef _DEBUG_
                  printf(" --- Parsing of variable data ending \n");
#endif
                  if( ietype != ORDERED ) {
                     iparse_num = 2;
                  } else {
                     // set state of zone to "loaded and ready" (ordered zone)
                     istate = 3;
                  }
               }

               var_cnt = 0;
            }

         } else {   // BLOCK
            int iloc = ivar_loc[ var_cnt+1 ];
            if( iloc == 1 ) {
               dp[ node_cnt ] = d;

               ++node_cnt;
               if( node_cnt == nodes ) {
                  ++var_cnt;
                  node_cnt = 0;
               }
            } else if( iloc == 2 ) {
               dp[ elem_cnt ] = d;

               ++elem_cnt;
               if( elem_cnt == elems ) {
                  ++var_cnt;
                  elem_cnt = 0;
               }
            } else {
               // I have not thought about how to do this...
            }

            // termination condition
            if( var_cnt == num_var ) {
               var_cnt = 0;
#ifdef _DEBUG_
               printf(" --- Parsing of numeric data ending \n");
#endif
               if( ietype != ORDERED ) {
                  iparse_num = 2;
               } else {
                  // set state of zone to "loaded and ready" (ordered zone)
                  istate = 3;
               }
            }
         }

      }  // strtok loop
   }  // iparse_num=1

   // parse segments separated by spaces (expecting connectivity in one line)
   if( iparse_num == 3 ) {
      unsigned long n1,n2,n3,n4,n5,n6,n7,n8;
      int ic=0;

      if( ietype == FETRIANGLE ) 
         ic = sscanf( buf, "%ld %ld %ld", &n1,&n2,&n3 );
      if( ietype == FEQUADRILATERAL ) 
         ic = sscanf( buf, "%ld %ld %ld %ld", &n1,&n2,&n3,&n4 );
      if( ietype == FETETRAHEDRON ) 
         ic = sscanf( buf, "%ld %ld %ld %ld", &n1,&n2,&n3,&n4 );
      if( ietype == FEBRICK ) 
         ic = sscanf( buf, "%ld %ld %ld %ld %ld %ld %ld %ld",
                            &n1,&n2,&n3,&n4,&n5,&n6,&n7,&n8 );

#ifdef _DEBUG2_
         printf(" --- Connectivity elements picked: %d \n", ic);
#endif
      if( ic > 0 ) {
         unsigned long n = ncon*icon_cnt;

         if( ic >= 3 ) {
            icon[ n+0 ] = n1;
            icon[ n+1 ] = n2;
            icon[ n+2 ] = n3;
         }
         if( ic >= 4 ) {
            icon[ n+3 ] = n4;
         }
         if( ic >= 8 ) {
            icon[ n+4 ] = n5;
            icon[ n+5 ] = n6;
            icon[ n+6 ] = n7;
            icon[ n+7 ] = n8;
         }

         icon_cnt += 1;
      }

      // indicate that the zone has been filled with data and is ready
      if( icon_cnt == elems ) istate = 3;
   }

   return(0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movl 0x118(%rdi), %eax
cmpl $0x2, %eax
je 0x9d09
testl %eax, %eax
jne 0x9d1f
movl $0x1, 0x118(%rbx)
jmp 0x9d1f
movl $0x3, 0x118(%rbx)
leaq 0x6888(%rip), %rdi      # 0x105a2
callq 0x77b0
movq %r14, %rax
movzbl (%rax), %ecx
cmpl $0x44, %ecx
je 0x9d3a
cmpl $0x64, %ecx
je 0x9d3a
testl %ecx, %ecx
je 0x9d42
cmpl $0xa, %ecx
jne 0x9d3d
jmp 0x9d42
movb $0x65, (%rax)
incq %rax
jmp 0x9d22
movq %r14, 0x28(%rsp)
movl 0x118(%rbx), %eax
cmpl $0x1, %eax
jne 0x9ef5
leaq 0x58(%rbx), %r15
leaq 0x5b7c(%rip), %r12      # 0xf8dd
leaq 0x18(%rsp), %r13
leaq 0x10(%rsp), %rbp
movq 0x28(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x7910
testq %rax, %rax
je 0x9eef
movq %rax, %rdi
movq %rbp, %rsi
callq 0x7390
movslq 0x130(%rbx), %rax
movq 0x88(%rbx), %rcx
movq (%rcx,%rax,8), %r14
cmpl $0x1, 0x1c(%rbx)
jne 0x9e06
movq 0x120(%rbx), %rcx
movsd %xmm0, (%r14,%rcx,8)
incl %eax
movl %eax, 0x130(%rbx)
cmpl 0x20(%rbx), %eax
jne 0x9ee8
incq %rcx
movq %rcx, 0x120(%rbx)
cmpq 0x48(%rbx), %rcx
jne 0x9ee1
andq $0x0, 0x120(%rbx)
leaq 0x6809(%rip), %rdi      # 0x105f1
callq 0x77b0
cmpl $0x0, 0x18(%rbx)
je 0x9eda
movl $0x2, 0x118(%rbx)
jmp 0x9ee1
movsd %xmm0, 0x30(%rsp)
incl %eax
movl %eax, 0x8(%rsp)
movq %r15, %rdi
leaq 0x8(%rsp), %rsi
callq 0x7550
movl (%rax), %eax
cmpl $0x1, %eax
je 0x9e66
cmpl $0x2, %eax
movsd 0x30(%rsp), %xmm0
jne 0x9ea1
movq 0x128(%rbx), %rcx
movsd %xmm0, (%r14,%rcx,8)
incq %rcx
movq %rcx, 0x128(%rbx)
movl 0x130(%rbx), %eax
cmpq 0x50(%rbx), %rcx
jne 0x9ea7
incl %eax
movl %eax, 0x130(%rbx)
andq $0x0, 0x128(%rbx)
jmp 0x9ea7
movq 0x120(%rbx), %rcx
movsd 0x30(%rsp), %xmm0
movsd %xmm0, (%r14,%rcx,8)
incq %rcx
movq %rcx, 0x120(%rbx)
movl 0x130(%rbx), %eax
cmpq 0x48(%rbx), %rcx
jne 0x9ea7
incl %eax
movl %eax, 0x130(%rbx)
andq $0x0, 0x120(%rbx)
jmp 0x9ea7
movl 0x130(%rbx), %eax
cmpl 0x20(%rbx), %eax
jne 0x9ee8
andl $0x0, 0x130(%rbx)
leaq 0x6712(%rip), %rdi      # 0x105cc
callq 0x77b0
cmpl $0x0, 0x18(%rbx)
je 0x9ed1
movl $0x2, 0x118(%rbx)
jmp 0x9ee8
movl $0x3, 0x8(%rbx)
jmp 0x9ee8
movl $0x3, 0x8(%rbx)
andl $0x0, 0x130(%rbx)
xorl %edi, %edi
jmp 0x9d70
movl 0x118(%rbx), %eax
cmpl $0x3, %eax
jne 0xa077
movl 0x18(%rbx), %ecx
xorl %eax, %eax
cmpl $0x2, %ecx
movq 0x28(%rsp), %r12
jne 0x9f30
leaq 0x59e0(%rip), %rsi      # 0xf8f4
leaq 0x18(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0x8(%rsp), %r8
movq %r12, %rdi
xorl %eax, %eax
callq 0x74a0
movl 0x18(%rbx), %ecx
cmpl $0x3, %ecx
jne 0x9f5d
leaq 0x59b4(%rip), %rsi      # 0xf8f0
leaq 0x18(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0x8(%rsp), %r8
leaq 0x20(%rsp), %r9
movq %r12, %rdi
xorl %eax, %eax
callq 0x74a0
movl 0x18(%rbx), %ecx
cmpl $0x5, %ecx
jne 0x9f8a
leaq 0x5987(%rip), %rsi      # 0xf8f0
leaq 0x18(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0x8(%rsp), %r8
leaq 0x20(%rsp), %r9
movq %r12, %rdi
xorl %eax, %eax
callq 0x74a0
movl 0x18(%rbx), %ecx
cmpl $0x6, %ecx
jne 0x9fd4
leaq 0x38(%rsp), %r10
leaq 0x40(%rsp), %r11
leaq 0x48(%rsp), %r14
leaq 0x50(%rsp), %r15
leaq 0x5936(%rip), %rsi      # 0xf8e0
leaq 0x18(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0x8(%rsp), %r8
leaq 0x20(%rsp), %r9
movq %r12, %rdi
xorl %eax, %eax
pushq %r10
pushq %r11
pushq %r14
pushq %r15
callq 0x74a0
addq $0x20, %rsp
testl %eax, %eax
jle 0xa063
cmpl $0x3, %eax
jb 0xa050
movq 0x138(%rbx), %rcx
imulq 0xa8(%rbx), %rcx
movq 0xa0(%rbx), %rdx
movq 0x18(%rsp), %rsi
movq %rsi, (%rdx,%rcx,8)
movq 0x10(%rsp), %rsi
movq %rsi, 0x8(%rdx,%rcx,8)
movq 0x8(%rsp), %rsi
movq %rsi, 0x10(%rdx,%rcx,8)
cmpl $0x3, %eax
je 0xa050
movq 0x20(%rsp), %rsi
movq %rsi, 0x18(%rdx,%rcx,8)
cmpl $0x8, %eax
jb 0xa050
movq 0x50(%rsp), %rax
movq %rax, 0x20(%rdx,%rcx,8)
movq 0x48(%rsp), %rax
movq %rax, 0x28(%rdx,%rcx,8)
movq 0x40(%rsp), %rax
movq %rax, 0x30(%rdx,%rcx,8)
movq 0x38(%rsp), %rax
movq %rax, 0x38(%rdx,%rcx,8)
movq 0x138(%rbx), %rax
incq %rax
movq %rax, 0x138(%rbx)
jmp 0xa06a
movq 0x138(%rbx), %rax
cmpq 0x50(%rbx), %rax
jne 0xa077
movl $0x3, 0x8(%rbx)
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq