// File: /workspace/github_c_makefile_star2_O1/olcaytaner[P]Isell/dataset.c
// Function: extract_definitions_of_dataset
void extract_definitions_of_dataset(char* datasetname)
{
 /*!Last Changed 09.05.2008 added time variant datasets*/
 /*!Last Changed 02.04.2005*/
 /*!Last Changed 31.01.2004*/
 Datasetptr tmp;
 int i, tmpi, framecount;
 FILE* infile;
 char* fname, myline[READLINELENGTH], *st, separators[2];
 double tmpf;
 tmp = search_dataset(Datasets, datasetname);
 if (!tmp)
  {
   printf(m1259, datasetname);
   return;
  }
 sprintf(separators,"%c",tmp->separator);
 fname = dataset_file_name(tmp);
 infile = fopen(fname, "r");
 if (!infile)
   return;
 for (i = 0; i < tmp->featurecount; i++)
   switch (tmp->features[i].type)
    {
     case  INTEGER:tmp->features[i].max.intvalue = -INT_MAX;
                   tmp->features[i].min.intvalue = +INT_MAX;
                   break;
     case     REAL:
     case   REGDEF:tmp->features[i].max.floatvalue = (double) -INT_MAX;
                   tmp->features[i].min.floatvalue = (double) +INT_MAX;
                   break;
     case   STRING:tmp->features[i].valuecount = 0;
                   break;
    }
 tmp->datacount = 0;
 while (fgets(myline, READLINELENGTH, infile))
  {
   myline[strlen(myline) - 1] = '\0';
   st = strtok(myline, separators);
   i = 0;
   if (tmp->storetype == STORE_SEQUENTIAL)
    {
     st = strtok(NULL, separators);
     framecount = atoi(st);
     st = strtok(NULL, separators);
     i++;
    }
   while (st)
    {
     switch (tmp->features[i].type)
      {
       case INTEGER:if (isinteger(st))
                     {
                      tmpi = atoi(st);
                      if (tmpi < tmp->features[i].min.intvalue)
                        tmp->features[i].min.intvalue = tmpi;
                      else
                        if (tmpi > tmp->features[i].max.intvalue)
                          tmp->features[i].max.intvalue = tmpi;
                     }
                    else                      
                      return;
                    break;
       case    REAL:
       case  REGDEF:if (isfloat(st))
                     {
                      tmpf = (double) atof(st);
                      if (tmpf < tmp->features[i].min.floatvalue)
                        tmp->features[i].min.floatvalue = tmpf;
                      else
                        if (tmpf > tmp->features[i].max.floatvalue)
                          tmp->features[i].max.floatvalue = tmpf;
                     }
                    else
                      return;
                    break;
       case  STRING:if (listindex(st, tmp->features[i].strings, tmp->features[i].valuecount) == -1)
                     {
                      tmp->features[i].strings[tmp->features[i].valuecount] = strcopy(tmp->features[i].strings[tmp->features[i].valuecount], st);
                      (tmp->features[i].valuecount)++;
                      if (tmp->features[i].valuecount > MAXVALUES)
                       {
                        printf(m1420, i + 1);
                        exit(0);
                       }
                     }
                    break;  
      }
     st = strtok(NULL, separators);
     i++;
     if (tmp->storetype == STORE_SEQUENTIAL && i == tmp->featurecount)
       i = 1;
    }
   (tmp->datacount)++;
  }
 fclose(infile);
 safe_free(fname);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x7a148, %rsp          # imm = 0x7A148
movq %rdi, %r14
leaq 0xbc56b(%rip), %rax     # 0xd2878
movq (%rax), %rbx
testq %rbx, %rbx
je 0x1632e
movq 0x8(%rbx), %rdi
movq %r14, %rsi
callq 0x4260
testl %eax, %eax
je 0x16330
movq 0x1407270(%rbx), %rbx
jmp 0x16310
xorl %ebx, %ebx
testq %rbx, %rbx
je 0x165bf
movb 0x1a8(%rbx), %al
movb %al, 0xe(%rsp)
movb $0x0, 0xf(%rsp)
movq %rbx, %rdi
callq 0x16285
leaq 0x92538(%rip), %rsi     # 0xa888f
movq %rax, 0x18(%rsp)
movq %rax, %rdi
callq 0x40f0
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x165ad
cmpl $0x0, 0x1bc(%rbx)
jle 0x163e8
leaq 0x30f20(%rbx), %rax
xorl %ecx, %ecx
leaq 0x8d0b9(%rip), %rdx     # 0xa3444
movabsq $-0x3e20000000400000, %rsi # imm = 0xC1DFFFFFFFC00000
movabsq $0x41dfffffffc00000, %rdi # imm = 0x41DFFFFFFFC00000
movl -0x18(%rax), %r8d
cmpq $0x4, %r8
ja 0x163d3
movslq (%rdx,%r8,4), %r8
addq %rdx, %r8
jmpq *%r8
movq %rsi, -0x8(%rax)
movq %rdi, -0x10(%rax)
jmp 0x163d3
movl $0x0, (%rax)
jmp 0x163d3
movl $0x80000001, -0x8(%rax) # imm = 0x80000001
movl $0x7fffffff, -0x10(%rax) # imm = 0x7FFFFFFF
incq %rcx
movslq 0x1bc(%rbx), %r8
addq $0x340, %rax            # imm = 0x340
cmpq %r8, %rcx
jl 0x1639f
movl $0x0, 0x1407120(%rbx)
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movl $0x7a120, %esi          # imm = 0x7A120
movq 0x10(%rsp), %rdx
callq 0x4120
testq %rax, %rax
je 0x16599
leaq 0x30f08(%rbx), %r15
leaq 0xe(%rsp), %r12
movq %r14, %rdi
callq 0x4190
movb $0x0, -0x1(%rax,%r14)
movq %r14, %rdi
movq %r12, %rsi
callq 0x4280
cmpl $0x2, 0x140713c(%rbx)
jne 0x16461
xorl %edi, %edi
movq %r12, %rsi
callq 0x4280
xorl %edi, %edi
movq %r12, %rsi
callq 0x4280
movq %rax, %r14
movl $0x1, %ebp
jmp 0x1656a
movq %rax, %r14
xorl %ebp, %ebp
jmp 0x1656a
movslq %ebp, %rax
imulq $0x340, %rax, %r13      # imm = 0x340
movl (%r15,%r13), %eax
cmpq $0x4, %rax
ja 0x16541
addq %r15, %r13
leaq 0x8cfcb(%rip), %rcx     # 0xa3458
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r14, %rdi
callq 0x398e1
testl %eax, %eax
je 0x165ad
movq %r14, %rdi
callq 0x4130
movsd 0x8(%r13), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x16527
movsd %xmm0, 0x8(%r13)
jmp 0x16541
leaq 0x20(%r13), %rsi
movl 0x18(%r13), %edx
movq %r14, %rdi
callq 0x3a2c5
cmpl $-0x1, %eax
jne 0x16541
movslq 0x18(%r13), %rax
movq 0x20(%r13,%rax,8), %rdi
movq %r14, %rsi
callq 0x3a404
movslq 0x18(%r13), %rcx
leal 0x1(%rcx), %edx
movq %rax, 0x20(%r13,%rcx,8)
movl %edx, 0x18(%r13)
cmpq $0x64, %rcx
jl 0x16541
jmp 0x165e1
movq %r14, %rdi
callq 0x3992c
testl %eax, %eax
je 0x165ad
movq %r14, %rdi
callq 0x4200
cmpl 0x8(%r13), %eax
jge 0x16537
movl %eax, 0x8(%r13)
jmp 0x16541
ucomisd 0x10(%r13), %xmm0
jbe 0x16541
movsd %xmm0, 0x10(%r13)
jmp 0x16541
cmpl 0x10(%r13), %eax
jle 0x16541
movl %eax, 0x10(%r13)
xorl %edi, %edi
movq %r12, %rsi
callq 0x4280
movq %rax, %r14
incl %ebp
cmpl $0x2, 0x140713c(%rbx)
jne 0x1656a
movl $0x1, %eax
cmpl 0x1bc(%rbx), %ebp
je 0x16568
movl %ebp, %eax
movl %eax, %ebp
testq %r14, %r14
jne 0x1646b
incl 0x1407120(%rbx)
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movl $0x7a120, %esi          # imm = 0x7A120
movq 0x10(%rsp), %rdx
callq 0x4120
testq %rax, %rax
jne 0x1641e
movq 0x10(%rsp), %rdi
callq 0x42a0
movq 0x18(%rsp), %rdi
callq 0x39194
addq $0x7a148, %rsp          # imm = 0x7A148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8d324(%rip), %rdi     # 0xa38ea
movq %r14, %rsi
xorl %eax, %eax
addq $0x7a148, %rsp          # imm = 0x7A148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4030
incl %ebp
leaq 0x8d31b(%rip), %rdi     # 0xa3905
movl %ebp, %esi
xorl %eax, %eax
callq 0x4030
xorl %edi, %edi
callq 0x40c0