// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/dataset.c
// Function: create_sequential_dataset
int create_sequential_dataset(char* datasetname, char* separator, int numfeatures, char* classes, char* directoryname, char* filename, char* discretefeatures)
{
 /*!Last Changed 09.05.2008*/
 Datasetptr tmp;
 int i, classcode, framecount, frameindex;
 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 = 0;
 tmp->allfeatures = numfeatures;
 tmp->featurecount = tmp->allfeatures;
 tmp->storetype = STORE_SEQUENTIAL;
 for (i = 0; i < tmp->featurecount; i++)
   tmp->availability[i] = YES;
 tmp->classdefno = 0;
 for (i = 0; i < MAXCLASSES; i++)
   tmp->classcounts[i] = 0;
 stringlist(classes, ";", tmp->classes, &(tmp->classno));
 if (tmp->classno)
  {
   tmp->features[0].type = CLASSDEF;
   for (i = 0; i < tmp->classno; i++)
     tmp->features[0].strings[i] = strcopy(tmp->features[0].strings[i], tmp->classes[i]);
   tmp->features[0].valuecount = tmp->classno;
  }
 else
   tmp->features[0].type = REGDEF;
 tmp->features[0].selected = YES;
 intervals = create_intervals(discretefeatures);
 for (i = 1; i < numfeatures; i++)
  {
   tmp->features[i].selected = YES;
   if (is_in_interval(intervals, i))
     tmp->features[i].type = STRING;
   else
     tmp->features[i].type = INTEGER;
  }
 fname = dataset_file_name(tmp);
 infile = fopen(fname, "r");
 if (!infile)
  {
   printf(m1121, fname);
   free_dataset(tmp);
   safe_free(fname);
   free_intervals(intervals);
   return 0;
  }
 while (fgets(myline, READLINELENGTH, infile))
  {
   if (strlen(myline) <= 1)
     continue;
   tmp->datacount++;
   myline[strlen(myline) - 1] = '\0';
   st = strtok(myline, separator);
   classcode = listindex(st, tmp->classes, tmp->classno);
   if (classcode == -1)
    {
     printf(m1260, tmp->datacount, 0);
     free_dataset(tmp);
     safe_free(fname);
     free_intervals(intervals);
     return 0;
    }
   else
     tmp->classcounts[classcode]++;
   st = strtok(NULL, separator);
   framecount = atoi(st);
   frameindex = 0;
   i = 1;
   st = strtok(NULL, separator);
   while (st)
    {
     if (!is_in_interval(intervals, i) && !isinteger(st) && tmp->features[i].type != REAL)
       tmp->features[i].type = REAL;
     i++;
     if (i == numfeatures)
      {
       i = 1;
       frameindex++;
      }
     st = strtok(NULL, separator);
    }
   if (i != 1)
    {
     printf(m1404, frameindex);
     free_dataset(tmp);
     safe_free(fname);
     free_intervals(intervals);
     return 0;     
    }
   if (frameindex != framecount)
    {
     printf(m1403, tmp->datacount, framecount);
     free_dataset(tmp);
     safe_free(fname);
     free_intervals(intervals);
     return 0;
    }
  }
 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 $0x7a190, %rsp          # imm = 0x7A190
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)
leaq 0xe372b(%rip), %rax     # 0x105848
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x1db80
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x2214b
leaq 0xc1a01(%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 $0x0, 0x1407120(%rax)
movl -0x1c(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x1b8(%rax)
movq -0x40(%rbp), %rax
movl 0x1b8(%rax), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x1bc(%rax)
movq -0x40(%rbp), %rax
movl $0x2, 0x140713c(%rax)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0x40(%rbp), %rcx
cmpl 0x1bc(%rcx), %eax
jge 0x221d8
movq -0x40(%rbp), %rax
movslq -0x44(%rbp), %rcx
movl $0x1, 0x1c4(%rax,%rcx,4)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x221ab
movq -0x40(%rbp), %rax
movl $0x0, 0x1407128(%rax)
movl $0x0, -0x44(%rbp)
cmpl $0x32, -0x44(%rbp)
jge 0x22211
movq -0x40(%rbp), %rax
movslq -0x44(%rbp), %rcx
movl $0x0, 0x1407140(%rax,%rcx,4)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x221ed
movq -0x28(%rbp), %rdi
movq -0x40(%rbp), %rdx
addq $0x18, %rdx
movq -0x40(%rbp), %rcx
addq $0x10, %rcx
leaq 0xc33f6(%rip), %rsi     # 0xe5622
callq 0x54bf0
movq -0x40(%rbp), %rax
cmpl $0x0, 0x10(%rax)
je 0x222af
movq -0x40(%rbp), %rax
movl $0x3, 0x30f08(%rax)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0x40(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x2229c
movq -0x40(%rbp), %rax
movslq -0x44(%rbp), %rcx
movq 0x30f28(%rax,%rcx,8), %rdi
movq -0x40(%rbp), %rax
movslq -0x44(%rbp), %rcx
movq 0x18(%rax,%rcx,8), %rsi
callq 0x54ba0
movq %rax, %rdx
movq -0x40(%rbp), %rax
movslq -0x44(%rbp), %rcx
movq %rdx, 0x30f28(%rax,%rcx,8)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x22250
movq -0x40(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x30f20(%rax)
jmp 0x222bd
movq -0x40(%rbp), %rax
movl $0x4, 0x30f08(%rax)
movq -0x40(%rbp), %rax
movl $0x1, 0x30f24(%rax)
movq 0x10(%rbp), %rdi
callq 0x46f50
movq %rax, -0x7a190(%rbp)
movl $0x1, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x2236f
movq -0x40(%rbp), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movslq -0x44(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
movl $0x1, 0x1c(%rax)
movq -0x7a190(%rbp), %rdi
movl -0x44(%rbp), %esi
callq 0x46ef0
cmpl $0x0, %eax
je 0x22341
movq -0x40(%rbp), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movslq -0x44(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
movl $0x1, (%rax)
jmp 0x2235f
movq -0x40(%rbp), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movslq -0x44(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
movl $0x0, (%rax)
jmp 0x22361
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x222e2
movq -0x40(%rbp), %rdi
callq 0x1fc90
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
leaq 0xc5e1f(%rip), %rsi     # 0xe81a6
callq 0x40c0
movq %rax, -0x7a188(%rbp)
cmpq $0x0, -0x7a188(%rbp)
jne 0x223d9
movq -0x58(%rbp), %rsi
leaq 0xc1823(%rip), %rdi     # 0xe3bcb
movb $0x0, %al
callq 0x4030
movq -0x40(%rbp), %rdi
callq 0x1b710
movq -0x58(%rbp), %rdi
callq 0x52e80
movq -0x7a190(%rbp), %rdi
callq 0x46e50
movl $0x0, -0x4(%rbp)
jmp 0x22682
jmp 0x223db
leaq -0x7a180(%rbp), %rdi
movq -0x7a188(%rbp), %rdx
movl $0x7a120, %esi          # imm = 0x7A120
callq 0x40f0
cmpq $0x0, %rax
je 0x22639
leaq -0x7a180(%rbp), %rdi
callq 0x4150
cmpq $0x1, %rax
ja 0x22411
jmp 0x223db
movq -0x40(%rbp), %rax
movl 0x1407120(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x1407120(%rax)
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)
movq -0x60(%rbp), %rdi
movq -0x40(%rbp), %rsi
addq $0x18, %rsi
movq -0x40(%rbp), %rax
movl 0x10(%rax), %edx
callq 0x54910
movl %eax, -0x48(%rbp)
cmpl $-0x1, -0x48(%rbp)
jne 0x224b5
movq -0x40(%rbp), %rax
movl 0x1407120(%rax), %esi
leaq 0xc17a4(%rip), %rdi     # 0xe3c26
xorl %edx, %edx
movb $0x0, %al
callq 0x4030
movq -0x40(%rbp), %rdi
callq 0x1b710
movq -0x58(%rbp), %rdi
callq 0x52e80
movq -0x7a190(%rbp), %rdi
callq 0x46e50
movl $0x0, -0x4(%rbp)
jmp 0x22682
movq -0x40(%rbp), %rax
movslq -0x48(%rbp), %rcx
movl 0x1407140(%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, 0x1407140(%rax,%rcx,4)
movq -0x18(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x4230
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
callq 0x41c0
movl %eax, -0x4c(%rbp)
movl $0x0, -0x50(%rbp)
movl $0x1, -0x44(%rbp)
movq -0x18(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x4230
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
je 0x225a9
movq -0x7a190(%rbp), %rdi
movl -0x44(%rbp), %esi
callq 0x46ef0
cmpl $0x0, %eax
jne 0x22572
movq -0x60(%rbp), %rdi
callq 0x53bd0
cmpl $0x0, %eax
jne 0x22572
movq -0x40(%rbp), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movslq -0x44(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
cmpl $0x2, (%rax)
je 0x22572
movq -0x40(%rbp), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movslq -0x44(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
movl $0x2, (%rax)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jne 0x22593
movl $0x1, -0x44(%rbp)
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
movq -0x18(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x4230
movq %rax, -0x60(%rbp)
jmp 0x2250a
cmpl $0x1, -0x44(%rbp)
je 0x225ea
movl -0x50(%rbp), %esi
leaq 0xc181f(%rip), %rdi     # 0xe3dd8
movb $0x0, %al
callq 0x4030
movq -0x40(%rbp), %rdi
callq 0x1b710
movq -0x58(%rbp), %rdi
callq 0x52e80
movq -0x7a190(%rbp), %rdi
callq 0x46e50
movl $0x0, -0x4(%rbp)
jmp 0x22682
movl -0x50(%rbp), %eax
cmpl -0x4c(%rbp), %eax
je 0x22634
movq -0x40(%rbp), %rax
movl 0x1407120(%rax), %esi
movl -0x4c(%rbp), %edx
leaq 0xc17fe(%rip), %rdi     # 0xe3e04
movb $0x0, %al
callq 0x4030
movq -0x40(%rbp), %rdi
callq 0x1b710
movq -0x58(%rbp), %rdi
callq 0x52e80
movq -0x7a190(%rbp), %rdi
callq 0x46e50
movl $0x0, -0x4(%rbp)
jmp 0x22682
jmp 0x223db
movq -0x7a188(%rbp), %rdi
callq 0x4250
movq -0x40(%rbp), %rax
movl $0x0, (%rax)
movq -0x40(%rbp), %rdi
callq 0x1eaf0
leaq 0xc1604(%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 $0x7a190, %rsp          # imm = 0x7A190
popq %rbp
retq
nop