// File: /workspace/github_c_makefile_star2_O3/olcaytaner[P]Isell/dataset.c
// Function: create_dataset
int create_dataset(char* datasetname, char* separator, int classdefno, char* classes, char* directoryname, char* filename, char* discretefeatures)
{
 /*!Last Changed 13.03.2007 added selected for features*/
 /*!Last Changed 19.08.2006 added regression definition*/
 /*!Last Changed 09.05.2005 changed including discrete feature definitions*/
 /*!Last Changed 02.02.2004 added safemalloc and safecalloc*/
 /*!Last Changed 31.01.2004*/
 Datasetptr tmp;
 int found = 0, i, classcode;
 char* fname, *st, myline[READLINELENGTH];
 FILE* infile;
 Intervalptr intervals;
 tmp = search_dataset(Datasets, datasetname);
 if (tmp)
  {
   printf(m1120);
   delete_dataset(datasetname);
  }
 tmp = empty_dataset(datasetname, directoryname, filename, separator[0]);
 tmp->datacount = 1;
 tmp->allfeatures = 0;
 tmp->classdefno = classdefno;
 for (i = 0; i < MAXCLASSES; i++)
   tmp->classcounts[i] = 0;
 stringlist(classes, ";", tmp->classes, &(tmp->classno));
 if (tmp->classno > MAXCLASSES)
  {
   printf(m1419, tmp->classno);
   return 0;
  }
 intervals = create_intervals(discretefeatures);
 fname = dataset_file_name(tmp);
 infile = fopen(fname, "r");
 if (!infile)
  {
   printf(m1121, fname);
   free_dataset(tmp);
   safe_free(fname);
   return 0;
  }
 if (fgets(myline,READLINELENGTH,infile))
  {
   myline[strlen(myline) - 1]='\0';
   st = strtok(myline, separator);
   while (st)
    {
     if (strcmp(st,"?") == 0)
      {
       free_dataset(tmp);
       safe_free(fname);
       printf(m1127);
       return 0;     
      }
     if (tmp->allfeatures == classdefno)
      {
       if (tmp->classno)
        {
         tmp->features[tmp->allfeatures].type = CLASSDEF;
         for (i = 0; i < tmp->classno; i++)
           tmp->features[tmp->classdefno].strings[i] = strcopy(tmp->features[tmp->classdefno].strings[i], tmp->classes[i]);
         tmp->features[tmp->classdefno].valuecount = tmp->classno;
         tmp->classcounts[listindex(st, tmp->classes, tmp->classno)] = 1;
        }
       else
         tmp->features[tmp->allfeatures].type = REGDEF;
       found = 1;
      }
     else
       if (is_in_interval(intervals, tmp->allfeatures))
         tmp->features[tmp->allfeatures].type = STRING;
       else
         if (isinteger(st))
           tmp->features[tmp->allfeatures].type = INTEGER;
         else
           tmp->features[tmp->allfeatures].type = REAL;
     tmp->features[tmp->allfeatures].selected = YES;
     tmp->allfeatures++;
     st = strtok(NULL, separator);
    }
   if (!found && tmp->classdefno != -1)
    {
     free_dataset(tmp);
     safe_free(fname);
     printf(m1125);
     return 0;     
    }
   if (tmp->allfeatures <= 1)
    {
     free_dataset(tmp);
     safe_free(fname);
     printf(m1123);
     return 0;
    }
   if (tmp->allfeatures > MAXFEATURES)
    {
     free_dataset(tmp);
     safe_free(fname);
     printf(m1421, tmp->allfeatures);
     return 0;
    }
  }
 else
  {
   free_dataset(tmp);
   safe_free(fname);
   printf(m1122);
   return 0;
  }
 while (fgets(myline, READLINELENGTH, infile))
  {
   if (strlen(myline) <= 1)
     continue;
   myline[strlen(myline) - 1] = '\0';
   tmp->datacount++;
   st = strtok(myline, separator);
   i = 0;
   while (st)
    {
     if (strcmp(st,"?") != 0)
       switch (tmp->features[i].type)
        {
         case  INTEGER:if (!isinteger(st) && isfloat(st))
                         tmp->features[i].type = REAL;
                       break;
         case CLASSDEF:classcode = listindex(st, tmp->classes, tmp->classno);
                       if (classcode == -1)
                        {
                         printf(m1260, tmp->datacount, i+1);
                         free_dataset(tmp);
                         safe_free(fname);
                         return 0;
                        }
                       else
                         tmp->classcounts[classcode]++;
                       break;
        }
     i++;
     st = strtok(NULL, separator);
    }
   if (i != tmp->allfeatures)
    {
     free_dataset(tmp);
     safe_free(fname);
     printf(m1261, tmp->datacount, tmp->allfeatures);
     return 0;          
    }
  }
 tmp->featurecount = tmp->allfeatures;
 for (i = 0; i < tmp->featurecount; i++)
   tmp->availability[i] = 1;
 fclose(infile);
 tmp->active = NO;
 add_dataset(tmp);
 printf(m1126);
 safe_free(fname);
 free_intervals(intervals);
 return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x7a178, %rsp          # imm = 0x7A178
movq %r9, %rbx
movq %r8, %r12
movq %rcx, %r14
movl %edx, (%rsp)
movq %rsi, %r15
movq %rdi, %rbp
leaq 0xbde79(%rip), %rax     # 0xd5878
movq (%rax), %r13
testq %r13, %r13
je 0x17a34
movq 0x8(%r13), %rdi
movq %rbp, %rsi
callq 0x4260
testl %eax, %eax
je 0x17a20
movq 0x1407270(%r13), %r13
jmp 0x17a02
leaq 0x8fc72(%rip), %rdi     # 0xa7699
callq 0x4090
movq %rbp, %rdi
callq 0x173c4
movsbl (%r15), %ecx
movq %rbp, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x155f1
movq %rax, %rbx
movl $0x1, 0x1407120(%rax)
movl $0x0, 0x1b8(%rax)
movl (%rsp), %eax
movl %eax, 0x1407128(%rbx)
leaq 0x1407140(%rbx), %r12
xorl %ebp, %ebp
movl $0xc8, %edx
movq %r12, %rdi
xorl %esi, %esi
callq 0x4050
leaq 0x18(%rbx), %rdx
leaq 0x10(%rbx), %rcx
leaq 0x91061(%rip), %rsi     # 0xa8aee
movq %r14, %rdi
movq %rdx, 0x28(%rsp)
movq %rcx, 0x30(%rsp)
callq 0x3b4c1
movl 0x10(%rbx), %esi
cmpl $0x33, %esi
jl 0x17aba
leaq 0x8f488(%rip), %rdi     # 0xa6f36
xorl %eax, %eax
callq 0x4030
jmp 0x17dcc
movq %r12, 0x48(%rsp)
movq %r15, 0x10(%rsp)
movq 0x7a1b0(%rsp), %rdi
callq 0x31a5a
movq %rax, %r13
movq %rbx, %rdi
callq 0x16542
movq %rax, %r12
leaq 0x93e75(%rip), %rsi     # 0xab95b
movq %rax, %rdi
callq 0x40f0
testq %rax, %rax
je 0x17ced
movq %rax, %r15
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movl $0x7a120, %esi          # imm = 0x7A120
movq %rax, %rdx
callq 0x4120
testq %rax, %rax
je 0x17d15
movq %r15, 0x18(%rsp)
movq %r14, %rdi
callq 0x4190
movb $0x0, -0x1(%rax,%r14)
movq %r14, %rdi
movq 0x10(%rsp), %r15
movq %r15, %rsi
callq 0x4280
testq %rax, %rax
je 0x17d3b
movq %rax, %rbp
movq %r12, 0x8(%rsp)
leaq 0x30f08(%rbx), %r14
movslq (%rsp), %rax
movq %rax, 0x38(%rsp)
imulq $0x340, %rax, %rax      # imm = 0x340
addq %rbx, %rax
addq $0x30f08, %rax          # imm = 0x30F08
movq %rax, 0x20(%rsp)
leaq 0x30f28(%rbx), %rax
movq %rax, 0x40(%rsp)
xorl %r12d, %r12d
cmpb $0x3f, (%rbp)
jne 0x17b90
cmpb $0x0, 0x1(%rbp)
je 0x17dac
movl 0x1b8(%rbx), %esi
cmpl (%rsp), %esi
jne 0x17c15
movq 0x30(%rsp), %rax
movl (%rax), %edx
testl %edx, %edx
je 0x17c3b
movq 0x20(%rsp), %rax
movl $0x3, (%rax)
movl 0x1407128(%rbx), %ecx
jle 0x17c7d
movq %r13, %r15
movq 0x40(%rsp), %r12
xorl %r13d, %r13d
movslq %ecx, %rax
imulq $0x340, %rax, %rax      # imm = 0x340
movq (%r12,%rax), %rdi
movq -0x30f10(%r12), %rsi
callq 0x3b494
movl 0x1407128(%rbx), %ecx
movslq %ecx, %rsi
imulq $0x340, %rsi, %rdx      # imm = 0x340
movq %rax, (%r12,%rdx)
incq %r13
movslq 0x10(%rbx), %rdx
addq $0x8, %r12
cmpq %rdx, %r13
jl 0x17bcc
movq %r15, %r13
movq 0x10(%rsp), %r15
jmp 0x17c80
movq %r13, %rdi
callq 0x31a3e
testl %eax, %eax
je 0x17c56
movl 0x1b8(%rbx), %ecx
movslq %ecx, %rdx
imulq $0x340, %rdx, %rax      # imm = 0x340
movl $0x1, (%r14,%rax)
jmp 0x17cb5
movq 0x20(%rsp), %rax
movl $0x4, (%rax)
movl $0x1, %r12d
movq 0x38(%rsp), %rdx
movl (%rsp), %ecx
jmp 0x17cb5
movq %rbp, %rdi
callq 0x3a938
movl 0x1b8(%rbx), %ecx
movslq %ecx, %rdx
imulq $0x340, %rdx, %rsi      # imm = 0x340
addq %r14, %rsi
testl %eax, %eax
je 0x17ce5
movl $0x0, (%rsi)
jmp 0x17cb5
movslq %ecx, %rsi
imulq $0x340, %rsi, %rax      # imm = 0x340
movl %edx, 0x18(%r14,%rax)
movq %rbp, %rdi
movq 0x28(%rsp), %rsi
callq 0x3b355
cltq
movl $0x1, 0x1407140(%rbx,%rax,4)
movl 0x1b8(%rbx), %ecx
movslq %ecx, %rdx
movl $0x1, %r12d
imulq $0x340, %rdx, %rax      # imm = 0x340
movl $0x1, 0x1c(%r14,%rax)
incl %ecx
movl %ecx, 0x1b8(%rbx)
xorl %edi, %edi
movq %r15, %rsi
callq 0x4280
movq %rax, %rbp
testq %rax, %rax
jne 0x17b80
jmp 0x17d31
movl $0x2, (%rsi)
jmp 0x17cb5
leaq 0x8f26d(%rip), %rdi     # 0xa6f61
xorl %ebp, %ebp
movq %r12, %rsi
xorl %eax, %eax
callq 0x4030
movq %rbx, %rdi
callq 0x1376b
movq %r12, %rdi
callq 0x3a180
jmp 0x17dcc
movq %rbx, %rdi
callq 0x1376b
movq %r12, %rdi
callq 0x3a180
leaq 0x8f8ad(%rip), %rdi     # 0xa75d9
jmp 0x17dc5
testl %r12d, %r12d
movq 0x8(%rsp), %r12
jne 0x17d5d
cmpl $-0x1, 0x1407128(%rbx)
je 0x17d5d
movq %rbx, %rdi
callq 0x1376b
movq %r12, %rdi
callq 0x3a180
leaq 0x8f8ae(%rip), %rdi     # 0xa7609
jmp 0x17dc5
movl 0x1b8(%rbx), %eax
cmpl $0x1, %eax
jg 0x17d81
movq %rbx, %rdi
callq 0x1376b
movq %r12, %rdi
callq 0x3a180
leaq 0x8f8be(%rip), %rdi     # 0xa763d
jmp 0x17dc5
cmpl $0x61a8, %eax           # imm = 0x61A8
jbe 0x17de0
movq %rbx, %rdi
callq 0x1376b
movq %r12, %rdi
callq 0x3a180
movl 0x1b8(%rbx), %esi
leaq 0x8f254(%rip), %rdi     # 0xa6ff9
xorl %ebp, %ebp
jmp 0x17aae
movq %rbx, %rdi
callq 0x1376b
movq 0x8(%rsp), %rdi
callq 0x3a180
leaq 0x8f8aa(%rip), %rdi     # 0xa766f
callq 0x4090
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x7a178, %rsp          # imm = 0x7A178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x50(%rsp), %rbp
movq %rbp, %rdi
movl $0x7a120, %esi          # imm = 0x7A120
movq 0x18(%rsp), %rdx
callq 0x4120
testq %rax, %rax
je 0x17f0f
movq %rbx, %rax
addq $0x30f08, %rax          # imm = 0x30F08
movq %rax, (%rsp)
movq %r12, 0x8(%rsp)
movq %rbp, %rdi
callq 0x4190
cmpq $0x1, %rax
jbe 0x17ef4
movb $0x0, -0x1(%rax,%rbp)
incl 0x1407120(%rbx)
movq %rbp, %rdi
movq %r15, %rsi
callq 0x4280
testq %rax, %rax
je 0x17edf
movq %rax, %r14
movl $0x1, %r15d
movq (%rsp), %r12
cmpb $0x3f, (%r14)
jne 0x17e5d
cmpb $0x0, 0x1(%r14)
je 0x17eb3
movl (%r12), %eax
cmpl $0x3, %eax
je 0x17e8c
testl %eax, %eax
jne 0x17eb3
movq %r14, %rdi
callq 0x3a938
testl %eax, %eax
jne 0x17eb3
movq %r14, %rdi
callq 0x3a8ed
testl %eax, %eax
je 0x17eb3
movl $0x2, (%r12)
jmp 0x17eb3
movq 0x30(%rsp), %rax
movl (%rax), %edx
movq %r14, %rdi
movq 0x28(%rsp), %rsi
callq 0x3b355
cmpl $-0x1, %eax
je 0x18088
cltq
movq 0x48(%rsp), %rcx
incl (%rcx,%rax,4)
xorl %edi, %edi
movq 0x10(%rsp), %rsi
callq 0x4280
movq %rax, %r14
incl %r15d
addq $0x340, %r12            # imm = 0x340
testq %rax, %rax
jne 0x17e50
decl %r15d
movq 0x8(%rsp), %r12
jmp 0x17ee2
xorl %r15d, %r15d
cmpl 0x1b8(%rbx), %r15d
movq 0x10(%rsp), %r15
jne 0x180b3
movq %rbp, %rdi
movl $0x7a120, %esi          # imm = 0x7A120
movq 0x18(%rsp), %rdx
callq 0x4120
testq %rax, %rax
jne 0x17e12
movslq 0x1b8(%rbx), %rcx
movl %ecx, 0x1bc(%rbx)
testq %rcx, %rcx
movq 0x18(%rsp), %rdi
jle 0x1802f
leal 0x3(%rcx), %eax
decq %rcx
movq %rcx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
shrl $0x2, %eax
shlq $0x4, %rax
movdqa 0x8e4e7(%rip), %xmm1    # 0xa6430
movdqa 0x8e4ef(%rip), %xmm2    # 0xa6440
xorl %ecx, %ecx
movdqa 0x8e4f5(%rip), %xmm3    # 0xa6450
pxor %xmm3, %xmm0
pcmpeqd %xmm4, %xmm4
movdqa 0x8e4f5(%rip), %xmm5    # 0xa6460
movdqa %xmm2, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
movd %xmm6, %edx
notl %edx
testb $0x1, %dl
je 0x17faa
movl $0x1, 0x1c4(%rbx,%rcx)
pxor %xmm4, %xmm6
pextrw $0x4, %xmm6, %edx
testb $0x1, %dl
je 0x17fc3
movl $0x1, 0x1c8(%rbx,%rcx)
movdqa %xmm1, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
pxor %xmm4, %xmm6
pextrw $0x0, %xmm6, %edx
testb $0x1, %dl
je 0x18005
movl $0x1, 0x1cc(%rbx,%rcx)
pextrw $0x4, %xmm6, %edx
testb $0x1, %dl
je 0x1801a
movl $0x1, 0x1d0(%rbx,%rcx)
paddq %xmm5, %xmm2
paddq %xmm5, %xmm1
addq $0x10, %rcx
cmpq %rcx, %rax
jne 0x17f6b
callq 0x42a0
movl $0x0, (%rbx)
leaq 0xbd837(%rip), %rcx     # 0xd5878
movq (%rcx), %rax
testq %rax, %rax
je 0x1805f
movq %rax, %rcx
movq 0x1407270(%rax), %rax
testq %rax, %rax
jne 0x18049
addq $0x1407270, %rcx        # imm = 0x1407270
movq %rbx, (%rcx)
leaq 0x8f693(%rip), %rdi     # 0xa76fc
callq 0x4090
movq %r12, %rdi
callq 0x3a180
movq %r13, %rdi
callq 0x31a10
movl $0x1, %ebp
jmp 0x17dcc
movl 0x1407120(%rbx), %esi
leaq 0x8ef27(%rip), %rdi     # 0xa6fbc
xorl %ebp, %ebp
movl %r15d, %edx
xorl %eax, %eax
callq 0x4030
movq %rbx, %rdi
callq 0x1376b
movq 0x8(%rsp), %rdi
jmp 0x17d0b
movq %rbx, %rdi
callq 0x1376b
movq %r12, %rdi
callq 0x3a180
movl 0x1407120(%rbx), %esi
movl 0x1b8(%rbx), %edx
leaq 0x8ef51(%rip), %rdi     # 0xa7027
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x4030
jmp 0x17dcc