// File: /workspace/github_cpp_makefile_star2_O3/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, %r12
movq %rdi, %rbx
movl 0x118(%rdi), %eax
cmpl $0x2, %eax
je 0x7f43
testl %eax, %eax
jne 0x7f59
movl $0x1, 0x118(%rbx)
jmp 0x7f59
movl $0x3, 0x118(%rbx)
leaq 0x764e(%rip), %rdi      # 0xf5a2
callq 0x5570
movq %r12, %rax
movzbl (%rax), %ecx
cmpl $0x63, %ecx
jg 0x7f74
cmpl $0x44, %ecx
je 0x7f79
testl %ecx, %ecx
je 0x7f81
cmpl $0xa, %ecx
jne 0x7f7c
jmp 0x7f81
cmpl $0x64, %ecx
jne 0x7f7c
movb $0x65, (%rax)
incq %rax
jmp 0x7f5c
movl 0x118(%rbx), %eax
cmpl $0x1, %eax
jne 0x815b
leaq 0x6946(%rip), %rsi      # 0xe8dd
leaq 0x10(%rsp), %rdx
movq %r12, 0x30(%rsp)
movq %r12, %rdi
callq 0x5680
testq %rax, %rax
je 0x8150
leaq 0x58(%rbx), %r15
leaq 0x18(%rsp), %r12
leaq 0x691b(%rip), %rbp      # 0xe8dd
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 0x804c
movq 0x120(%rbx), %rcx
movsd %xmm0, (%r14,%rcx,8)
incl %eax
movl %eax, 0x130(%rbx)
cmpl 0x20(%rbx), %eax
jne 0x813a
incq %rcx
movq %rcx, 0x120(%rbx)
cmpq 0x48(%rbx), %rcx
jne 0x8130
movq $0x0, 0x120(%rbx)
leaq 0x75c3(%rip), %rdi      # 0xf5f1
callq 0x5570
cmpl $0x0, 0x18(%rbx)
je 0x8129
movl $0x2, 0x118(%rbx)
jmp 0x8130
movsd %xmm0, 0x28(%rsp)
incl %eax
movl %eax, 0x8(%rsp)
movq %r15, %rdi
leaq 0x8(%rsp), %rsi
callq 0x53d0
movl (%rax), %eax
cmpl $0x1, %eax
je 0x80af
cmpl $0x2, %eax
movsd 0x28(%rsp), %xmm0
jne 0x80ed
movq 0x128(%rbx), %rcx
movsd %xmm0, (%r14,%rcx,8)
incq %rcx
movq %rcx, 0x128(%rbx)
movl 0x130(%rbx), %eax
cmpq 0x50(%rbx), %rcx
jne 0x80f3
incl %eax
movl %eax, 0x130(%rbx)
movq $0x0, 0x128(%rbx)
jmp 0x80f3
movq 0x120(%rbx), %rcx
movsd 0x28(%rsp), %xmm0
movsd %xmm0, (%r14,%rcx,8)
incq %rcx
movq %rcx, 0x120(%rbx)
movl 0x130(%rbx), %eax
cmpq 0x48(%rbx), %rcx
jne 0x80f3
incl %eax
movl %eax, 0x130(%rbx)
movq $0x0, 0x120(%rbx)
jmp 0x80f3
movl 0x130(%rbx), %eax
cmpl 0x20(%rbx), %eax
jne 0x813a
movl $0x0, 0x130(%rbx)
leaq 0x74c3(%rip), %rdi      # 0xf5cc
callq 0x5570
cmpl $0x0, 0x18(%rbx)
je 0x8120
movl $0x2, 0x118(%rbx)
jmp 0x813a
movl $0x3, 0x8(%rbx)
jmp 0x813a
movl $0x3, 0x8(%rbx)
movl $0x0, 0x130(%rbx)
xorl %edi, %edi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x5680
testq %rax, %rax
jne 0x7fc7
movl 0x118(%rbx), %eax
movq 0x30(%rsp), %r12
cmpl $0x3, %eax
jne 0x82d8
movl 0x18(%rbx), %ecx
xorl %eax, %eax
cmpl $0x2, %ecx
jne 0x8191
leaq 0x677f(%rip), %rsi      # 0xe8f4
leaq 0x10(%rsp), %rdx
leaq 0x18(%rsp), %rcx
leaq 0x8(%rsp), %r8
movq %r12, %rdi
xorl %eax, %eax
callq 0x5340
movl 0x18(%rbx), %ecx
cmpl $0x3, %ecx
jne 0x81be
leaq 0x6753(%rip), %rsi      # 0xe8f0
leaq 0x10(%rsp), %rdx
leaq 0x18(%rsp), %rcx
leaq 0x8(%rsp), %r8
leaq 0x20(%rsp), %r9
movq %r12, %rdi
xorl %eax, %eax
callq 0x5340
movl 0x18(%rbx), %ecx
cmpl $0x5, %ecx
jne 0x81eb
leaq 0x6726(%rip), %rsi      # 0xe8f0
leaq 0x10(%rsp), %rdx
leaq 0x18(%rsp), %rcx
leaq 0x8(%rsp), %r8
leaq 0x20(%rsp), %r9
movq %r12, %rdi
xorl %eax, %eax
callq 0x5340
movl 0x18(%rbx), %ecx
cmpl $0x6, %ecx
jne 0x8235
leaq 0x38(%rsp), %r10
leaq 0x40(%rsp), %r11
leaq 0x48(%rsp), %r14
leaq 0x50(%rsp), %r15
leaq 0x66d5(%rip), %rsi      # 0xe8e0
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 0x5340
addq $0x20, %rsp
testl %eax, %eax
jle 0x82c4
cmpl $0x3, %eax
jb 0x82b1
movq 0x138(%rbx), %rcx
imulq 0xa8(%rbx), %rcx
movq 0xa0(%rbx), %rdx
movq 0x10(%rsp), %rsi
movq %rsi, (%rdx,%rcx,8)
movq 0x18(%rsp), %rsi
movq %rsi, 0x8(%rdx,%rcx,8)
movq 0x8(%rsp), %rsi
movq %rsi, 0x10(%rdx,%rcx,8)
cmpl $0x3, %eax
je 0x82b1
movq 0x20(%rsp), %rsi
movq %rsi, 0x18(%rdx,%rcx,8)
cmpl $0x8, %eax
jb 0x82b1
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 0x82cb
movq 0x138(%rbx), %rax
cmpq 0x50(%rbx), %rax
jne 0x82d8
movl $0x3, 0x8(%rbx)
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop