// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x7a1a0, %rsp          # imm = 0x7A1A0
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movl $0x0, -0x44(%rbp)
leaq 0xe3f24(%rip), %rax     # 0x105848
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x1db80
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x21952
leaq 0xc21fa(%rip), %rdi     # 0xe3b3c
movb $0x0, %al
callq 0x4030
movq -0x10(%rbp), %rdi
callq 0x21250
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq -0x18(%rbp), %rax
movsbl (%rax), %ecx
callq 0x1e640
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movl $0x1, 0x1407120(%rax)
movq -0x40(%rbp), %rax
movl $0x0, 0x1b8(%rax)
movl -0x1c(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x1407128(%rax)
movl $0x0, -0x48(%rbp)
cmpl $0x32, -0x48(%rbp)
jge 0x219c2
movq -0x40(%rbp), %rax
movslq -0x48(%rbp), %rcx
movl $0x0, 0x1407140(%rax,%rcx,4)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x2199e
movq -0x28(%rbp), %rdi
movq -0x40(%rbp), %rdx
addq $0x18, %rdx
movq -0x40(%rbp), %rcx
addq $0x10, %rcx
leaq 0xc3c45(%rip), %rsi     # 0xe5622
callq 0x54bf0
movq -0x40(%rbp), %rax
cmpl $0x32, 0x10(%rax)
jle 0x21a0d
movq -0x40(%rbp), %rax
movl 0x10(%rax), %esi
leaq 0xc21a6(%rip), %rdi     # 0xe3ba0
movb $0x0, %al
callq 0x4030
movl $0x0, -0x4(%rbp)
jmp 0x220dd
movq 0x10(%rbp), %rdi
callq 0x46f50
movq %rax, -0x7a190(%rbp)
movq -0x40(%rbp), %rdi
callq 0x1fc90
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
leaq 0xc6771(%rip), %rsi     # 0xe81a6
callq 0x40c0
movq %rax, -0x7a188(%rbp)
cmpq $0x0, -0x7a188(%rbp)
jne 0x21a7b
movq -0x58(%rbp), %rsi
leaq 0xc2175(%rip), %rdi     # 0xe3bcb
movb $0x0, %al
callq 0x4030
movq -0x40(%rbp), %rdi
callq 0x1b710
movq -0x58(%rbp), %rdi
callq 0x52e80
movl $0x0, -0x4(%rbp)
jmp 0x220dd
leaq -0x7a180(%rbp), %rdi
movq -0x7a188(%rbp), %rdx
movl $0x7a120, %esi          # imm = 0x7A120
callq 0x40f0
cmpq $0x0, %rax
je 0x21e23
leaq -0x7a180(%rbp), %rdi
callq 0x4150
subq $0x1, %rax
movb $0x0, -0x7a180(%rbp,%rax)
leaq -0x7a180(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x4230
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
je 0x21d63
movq -0x60(%rbp), %rdi
leaq 0xc21d8(%rip), %rsi     # 0xe3cb7
callq 0x4210
cmpl $0x0, %eax
jne 0x21b15
movq -0x40(%rbp), %rdi
callq 0x1b710
movq -0x58(%rbp), %rdi
callq 0x52e80
leaq 0xc21b7(%rip), %rdi     # 0xe3cb9
movb $0x0, %al
callq 0x4030
movl $0x0, -0x4(%rbp)
jmp 0x220dd
movq -0x40(%rbp), %rax
movl 0x1b8(%rax), %eax
cmpl -0x1c(%rbp), %eax
jne 0x21c74
movq -0x40(%rbp), %rax
cmpl $0x0, 0x10(%rax)
je 0x21c43
movq -0x40(%rbp), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movq -0x40(%rbp), %rcx
movslq 0x1b8(%rcx), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
movl $0x3, (%rax)
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
movq -0x40(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x21bde
movq -0x40(%rbp), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movq -0x40(%rbp), %rcx
movslq 0x1407128(%rcx), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
movslq -0x48(%rbp), %rcx
movq 0x20(%rax,%rcx,8), %rdi
movq -0x40(%rbp), %rax
movslq -0x48(%rbp), %rcx
movq 0x18(%rax,%rcx,8), %rsi
callq 0x54ba0
movq %rax, %rdx
movq -0x40(%rbp), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movq -0x40(%rbp), %rcx
movslq 0x1407128(%rcx), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
movslq -0x48(%rbp), %rcx
movq %rdx, 0x20(%rax,%rcx,8)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x21b62
movq -0x40(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x40(%rbp), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movq -0x40(%rbp), %rdx
movslq 0x1407128(%rdx), %rdx
imulq $0x340, %rdx, %rdx      # imm = 0x340
addq %rdx, %rax
movl %ecx, 0x18(%rax)
movq -0x40(%rbp), %rax
movq %rax, -0x7a198(%rbp)
movq -0x60(%rbp), %rdi
movq -0x40(%rbp), %rsi
addq $0x18, %rsi
movq -0x40(%rbp), %rax
movl 0x10(%rax), %edx
callq 0x54910
movl %eax, %ecx
movq -0x7a198(%rbp), %rax
movslq %ecx, %rcx
movl $0x1, 0x1407140(%rax,%rcx,4)
jmp 0x21c68
movq -0x40(%rbp), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movq -0x40(%rbp), %rcx
movslq 0x1b8(%rcx), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
movl $0x4, (%rax)
movl $0x1, -0x44(%rbp)
jmp 0x21d14
movq -0x7a190(%rbp), %rdi
movq -0x40(%rbp), %rax
movl 0x1b8(%rax), %esi
callq 0x46ef0
cmpl $0x0, %eax
je 0x21cb6
movq -0x40(%rbp), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movq -0x40(%rbp), %rcx
movslq 0x1b8(%rcx), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
movl $0x1, (%rax)
jmp 0x21d12
movq -0x60(%rbp), %rdi
callq 0x53bd0
cmpl $0x0, %eax
je 0x21ceb
movq -0x40(%rbp), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movq -0x40(%rbp), %rcx
movslq 0x1b8(%rcx), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
movl $0x0, (%rax)
jmp 0x21d10
movq -0x40(%rbp), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movq -0x40(%rbp), %rcx
movslq 0x1b8(%rcx), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
movl $0x2, (%rax)
jmp 0x21d12
jmp 0x21d14
movq -0x40(%rbp), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movq -0x40(%rbp), %rcx
movslq 0x1b8(%rcx), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
movl $0x1, 0x1c(%rax)
movq -0x40(%rbp), %rax
movl 0x1b8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x1b8(%rax)
movq -0x18(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x4230
movq %rax, -0x60(%rbp)
jmp 0x21ac9
cmpl $0x0, -0x44(%rbp)
jne 0x21da2
movq -0x40(%rbp), %rax
cmpl $-0x1, 0x1407128(%rax)
je 0x21da2
movq -0x40(%rbp), %rdi
callq 0x1b710
movq -0x58(%rbp), %rdi
callq 0x52e80
leaq 0xc1f55(%rip), %rdi     # 0xe3ce4
movb $0x0, %al
callq 0x4030
movl $0x0, -0x4(%rbp)
jmp 0x220dd
movq -0x40(%rbp), %rax
cmpl $0x1, 0x1b8(%rax)
jg 0x21ddb
movq -0x40(%rbp), %rdi
callq 0x1b710
movq -0x58(%rbp), %rdi
callq 0x52e80
leaq 0xc1f51(%rip), %rdi     # 0xe3d19
movb $0x0, %al
callq 0x4030
movl $0x0, -0x4(%rbp)
jmp 0x220dd
movq -0x40(%rbp), %rax
cmpl $0x61a8, 0x1b8(%rax)    # imm = 0x61A8
jle 0x21e21
movq -0x40(%rbp), %rdi
callq 0x1b710
movq -0x58(%rbp), %rdi
callq 0x52e80
movq -0x40(%rbp), %rax
movl 0x1b8(%rax), %esi
leaq 0xc1f3e(%rip), %rdi     # 0xe3d4c
movb $0x0, %al
callq 0x4030
movl $0x0, -0x4(%rbp)
jmp 0x220dd
jmp 0x21e4f
movq -0x40(%rbp), %rdi
callq 0x1b710
movq -0x58(%rbp), %rdi
callq 0x52e80
leaq 0xc1f3e(%rip), %rdi     # 0xe3d7a
movb $0x0, %al
callq 0x4030
movl $0x0, -0x4(%rbp)
jmp 0x220dd
jmp 0x21e51
leaq -0x7a180(%rbp), %rdi
movq -0x7a188(%rbp), %rdx
movl $0x7a120, %esi          # imm = 0x7A120
callq 0x40f0
cmpq $0x0, %rax
je 0x2204c
leaq -0x7a180(%rbp), %rdi
callq 0x4150
cmpq $0x1, %rax
ja 0x21e87
jmp 0x21e51
leaq -0x7a180(%rbp), %rdi
callq 0x4150
subq $0x1, %rax
movb $0x0, -0x7a180(%rbp,%rax)
movq -0x40(%rbp), %rax
movl 0x1407120(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x1407120(%rax)
leaq -0x7a180(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x4230
movq %rax, -0x60(%rbp)
movl $0x0, -0x48(%rbp)
cmpq $0x0, -0x60(%rbp)
je 0x21ff8
movq -0x60(%rbp), %rdi
leaq 0xc1dd4(%rip), %rsi     # 0xe3cb7
callq 0x4210
cmpl $0x0, %eax
je 0x21fd9
movq -0x40(%rbp), %rax
movslq -0x48(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
movl 0x30f08(%rax,%rcx), %eax
movl %eax, -0x7a19c(%rbp)
testl %eax, %eax
je 0x21f23
jmp 0x21f13
movl -0x7a19c(%rbp), %eax
subl $0x3, %eax
je 0x21f5f
jmp 0x21fd7
movq -0x60(%rbp), %rdi
callq 0x53bd0
cmpl $0x0, %eax
jne 0x21f5d
movq -0x60(%rbp), %rdi
callq 0x53b00
cmpl $0x0, %eax
je 0x21f5d
movq -0x40(%rbp), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movslq -0x48(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
movl $0x2, (%rax)
jmp 0x21fd7
movq -0x60(%rbp), %rdi
movq -0x40(%rbp), %rsi
addq $0x18, %rsi
movq -0x40(%rbp), %rax
movl 0x10(%rax), %edx
callq 0x54910
movl %eax, -0x4c(%rbp)
cmpl $-0x1, -0x4c(%rbp)
jne 0x21fbc
movq -0x40(%rbp), %rax
movl 0x1407120(%rax), %esi
movl -0x48(%rbp), %edx
addl $0x1, %edx
leaq 0xc1c8f(%rip), %rdi     # 0xe3c26
movb $0x0, %al
callq 0x4030
movq -0x40(%rbp), %rdi
callq 0x1b710
movq -0x58(%rbp), %rdi
callq 0x52e80
movl $0x0, -0x4(%rbp)
jmp 0x220dd
movq -0x40(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movl 0x1407140(%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, 0x1407140(%rax,%rcx,4)
jmp 0x21fd7
jmp 0x21fd9
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
movq -0x18(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x4230
movq %rax, -0x60(%rbp)
jmp 0x21ecd
movl -0x48(%rbp), %eax
movq -0x40(%rbp), %rcx
cmpl 0x1b8(%rcx), %eax
je 0x22047
movq -0x40(%rbp), %rdi
callq 0x1b710
movq -0x58(%rbp), %rdi
callq 0x52e80
movq -0x40(%rbp), %rax
movl 0x1407120(%rax), %esi
movq -0x40(%rbp), %rax
movl 0x1b8(%rax), %edx
leaq 0xc1d77(%rip), %rdi     # 0xe3dab
movb $0x0, %al
callq 0x4030
movl $0x0, -0x4(%rbp)
jmp 0x220dd
jmp 0x21e51
movq -0x40(%rbp), %rax
movl 0x1b8(%rax), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x1bc(%rax)
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
movq -0x40(%rbp), %rcx
cmpl 0x1bc(%rcx), %eax
jge 0x22094
movq -0x40(%rbp), %rax
movslq -0x48(%rbp), %rcx
movl $0x1, 0x1c4(%rax,%rcx,4)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x22067
movq -0x7a188(%rbp), %rdi
callq 0x4250
movq -0x40(%rbp), %rax
movl $0x0, (%rax)
movq -0x40(%rbp), %rdi
callq 0x1eaf0
leaq 0xc1ba9(%rip), %rdi     # 0xe3c63
movb $0x0, %al
callq 0x4030
movq -0x58(%rbp), %rdi
callq 0x52e80
movq -0x7a190(%rbp), %rdi
callq 0x46e50
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x7a1a0, %rsp          # imm = 0x7A1A0
popq %rbp
retq
nopl (%rax)