// File: /workspace/github_cpp_makefile_star2_O1/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 $0x68, %rsp
movq %rsi, %r12
movq %rdi, %rbx
movl 0x118(%rdi), %eax
cmpl $0x2, %eax
je 0x80ab
testl %eax, %eax
jne 0x80c1
movl $0x1, 0x118(%rbx)
jmp 0x80c1
movl $0x3, 0x118(%rbx)
leaq 0x744e(%rip), %rdi      # 0xf50a
callq 0x5580
movq %r12, %rax
movzbl (%rax), %ecx
cmpl $0x63, %ecx
jg 0x80dc
cmpl $0x44, %ecx
je 0x80e1
testl %ecx, %ecx
je 0x80e9
cmpl $0xa, %ecx
jne 0x80e4
jmp 0x80e9
cmpl $0x64, %ecx
jne 0x80e4
movb $0x65, (%rax)
incq %rax
jmp 0x80c4
cmpl $0x1, 0x118(%rbx)
jne 0x82b6
leaq 0x6748(%rip), %rsi      # 0xe845
leaq 0x10(%rsp), %rdx
movq %r12, 0x30(%rsp)
movq %r12, %rdi
callq 0x5690
testq %rax, %rax
je 0x82b1
leaq 0x58(%rbx), %r15
leaq 0x128(%rbx), %rcx
movq %rcx, 0x40(%rsp)
leaq 0x120(%rbx), %rcx
movq %rcx, 0x38(%rsp)
leaq 0x18(%rsp), %r12
leaq 0x6705(%rip), %rbp      # 0xe845
leaq 0x10(%rsp), %r13
movq %rax, %rdi
movq %r12, %rsi
callq 0x52a0
movslq 0x130(%rbx), %rax
movq 0x88(%rbx), %rcx
movq (%rcx,%rax,8), %r14
cmpl $0x1, 0x1c(%rbx)
jne 0x81ca
movq 0x120(%rbx), %rcx
movsd %xmm0, (%r14,%rcx,8)
incl %eax
movl %eax, 0x130(%rbx)
cmpl 0x20(%rbx), %eax
jne 0x829b
incq %rcx
movq %rcx, 0x120(%rbx)
cmpq 0x48(%rbx), %rcx
jne 0x8291
movq $0x0, 0x120(%rbx)
leaq 0x73ad(%rip), %rdi      # 0xf559
callq 0x5580
cmpl $0x0, 0x18(%rbx)
je 0x828a
movl $0x2, 0x118(%rbx)
jmp 0x8291
movsd %xmm0, 0x28(%rsp)
incl %eax
movl %eax, 0x8(%rsp)
movq %r15, %rdi
leaq 0x8(%rsp), %rsi
callq 0x53e0
movl (%rax), %eax
cmpl $0x2, %eax
je 0x8257
cmpl $0x1, %eax
movsd 0x28(%rsp), %xmm0
jne 0x8224
movq 0x120(%rbx), %rcx
movsd %xmm0, (%r14,%rcx,8)
incq %rcx
movq %rcx, 0x120(%rbx)
movq 0x38(%rsp), %rax
cmpq 0x48(%rbx), %rcx
jne 0x8224
incl 0x130(%rbx)
movq $0x0, (%rax)
movl 0x130(%rbx), %eax
cmpl 0x20(%rbx), %eax
jne 0x829b
movl $0x0, 0x130(%rbx)
leaq 0x72f4(%rip), %rdi      # 0xf534
callq 0x5580
cmpl $0x0, 0x18(%rbx)
je 0x8281
movl $0x2, 0x118(%rbx)
jmp 0x829b
movq 0x128(%rbx), %rcx
movsd 0x28(%rsp), %xmm0
movsd %xmm0, (%r14,%rcx,8)
incq %rcx
movq %rcx, 0x128(%rbx)
movq 0x40(%rsp), %rax
cmpq 0x50(%rbx), %rcx
je 0x8217
jmp 0x8224
movl $0x3, 0x8(%rbx)
jmp 0x829b
movl $0x3, 0x8(%rbx)
movl $0x0, 0x130(%rbx)
xorl %edi, %edi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x5690
testq %rax, %rax
jne 0x8145
movq 0x30(%rsp), %r12
cmpl $0x3, 0x118(%rbx)
jne 0x8431
xorl %eax, %eax
cmpl $0x2, 0x18(%rbx)
jne 0x82eb
leaq 0x658a(%rip), %rsi      # 0xe85c
leaq 0x10(%rsp), %rdx
leaq 0x18(%rsp), %rcx
leaq 0x8(%rsp), %r8
movq %r12, %rdi
xorl %eax, %eax
callq 0x5350
cmpl $0x3, 0x18(%rbx)
jne 0x8316
leaq 0x6560(%rip), %rsi      # 0xe858
leaq 0x10(%rsp), %rdx
leaq 0x18(%rsp), %rcx
leaq 0x8(%rsp), %r8
leaq 0x20(%rsp), %r9
movq %r12, %rdi
xorl %eax, %eax
callq 0x5350
cmpl $0x5, 0x18(%rbx)
jne 0x8341
leaq 0x6535(%rip), %rsi      # 0xe858
leaq 0x10(%rsp), %rdx
leaq 0x18(%rsp), %rcx
leaq 0x8(%rsp), %r8
leaq 0x20(%rsp), %r9
movq %r12, %rdi
xorl %eax, %eax
callq 0x5350
cmpl $0x6, 0x18(%rbx)
jne 0x838c
leaq 0x48(%rsp), %r10
leaq 0x50(%rsp), %r11
leaq 0x58(%rsp), %r14
leaq 0x60(%rsp), %r15
leaq 0x64e6(%rip), %rsi      # 0xe848
leaq 0x10(%rsp), %rdx
leaq 0x18(%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 0x5350
addq $0x20, %rsp
testl %eax, %eax
jle 0x841d
movq 0x138(%rbx), %rcx
imulq 0xa8(%rbx), %rcx
cmpl $0x3, %eax
jl 0x83cc
movq 0x10(%rsp), %rdx
movq 0xa0(%rbx), %rsi
movq %rdx, (%rsi,%rcx,8)
movq 0x18(%rsp), %rdx
movq %rdx, 0x8(%rsi,%rcx,8)
movq 0x8(%rsp), %rdx
movq %rdx, 0x10(%rsi,%rcx,8)
cmpl $0x4, %eax
jl 0x83e2
movq 0x20(%rsp), %rdx
movq 0xa0(%rbx), %rsi
movq %rdx, 0x18(%rsi,%rcx,8)
cmpl $0x8, %eax
jl 0x8416
movq 0x60(%rsp), %rax
movq 0xa0(%rbx), %rdx
movq %rax, 0x20(%rdx,%rcx,8)
movq 0x58(%rsp), %rax
movq %rax, 0x28(%rdx,%rcx,8)
movq 0x50(%rsp), %rax
movq %rax, 0x30(%rdx,%rcx,8)
movq 0x48(%rsp), %rax
movq %rax, 0x38(%rdx,%rcx,8)
incq 0x138(%rbx)
movq 0x138(%rbx), %rax
cmpq 0x50(%rbx), %rax
jne 0x8431
movl $0x3, 0x8(%rbx)
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq