// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x7a168, %rsp          # imm = 0x7A168
movq %r9, %rbx
movq %r8, %r13
movq %rcx, %r12
movq %rdx, 0x8(%rsp)
movq %rsi, 0x10(%rsp)
movq %rdi, %rbp
leaq 0xbd766(%rip), %rax     # 0xd5878
movq (%rax), %r14
testq %r14, %r14
je 0x18147
movq 0x8(%r14), %rdi
movq %rbp, %rsi
callq 0x4260
testl %eax, %eax
je 0x18133
movq 0x1407270(%r14), %r14
jmp 0x18115
leaq 0x8f55f(%rip), %rdi     # 0xa7699
callq 0x4090
movq %rbp, %rdi
callq 0x173c4
movq 0x10(%rsp), %rax
movsbl (%rax), %ecx
movq %rbp, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x155f1
movq %rax, %rbx
movl $0x0, 0x1407120(%rax)
movq 0x8(%rsp), %rax
movl %eax, 0x1b8(%rbx)
movl %eax, 0x1bc(%rbx)
movl $0x2, 0x140713c(%rbx)
movl %eax, %ebp
testl %eax, %eax
jle 0x1829a
movq 0x8(%rsp), %rax
addl $0x3, %eax
leaq -0x1(%rbp), %rcx
movq %rcx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
shrl $0x2, %eax
shlq $0x4, %rax
movdqa 0x8e27c(%rip), %xmm1    # 0xa6430
movdqa 0x8e284(%rip), %xmm2    # 0xa6440
xorl %ecx, %ecx
movdqa 0x8e28a(%rip), %xmm3    # 0xa6450
pxor %xmm3, %xmm0
pcmpeqd %xmm4, %xmm4
movdqa 0x8e28a(%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 0x18215
movl $0x1, 0x1c4(%rbx,%rcx)
pxor %xmm4, %xmm6
pextrw $0x4, %xmm6, %edx
testb $0x1, %dl
je 0x1822e
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 0x18270
movl $0x1, 0x1cc(%rbx,%rcx)
pextrw $0x4, %xmm6, %edx
testb $0x1, %dl
je 0x18285
movl $0x1, 0x1d0(%rbx,%rcx)
paddq %xmm5, %xmm2
paddq %xmm5, %xmm1
addq $0x10, %rcx
cmpq %rcx, %rax
jne 0x181d6
movq 0x7a1a0(%rsp), %r13
movl $0x0, 0x1407128(%rbx)
leaq 0x1407140(%rbx), %rdi
movl $0xc8, %edx
movq %rdi, 0x30(%rsp)
xorl %esi, %esi
callq 0x4050
leaq 0x18(%rbx), %rdx
leaq 0x10(%rbx), %rcx
leaq 0x9081b(%rip), %rsi     # 0xa8aee
movq %r12, %rdi
movq %rdx, 0x38(%rsp)
callq 0x3b4c1
movl 0x10(%rbx), %eax
testl %eax, %eax
je 0x18324
movl $0x3, 0x30f08(%rbx)
jle 0x1831c
xorl %r14d, %r14d
movq 0x30f28(%rbx,%r14,8), %rdi
movq 0x18(%rbx,%r14,8), %rsi
callq 0x3b494
movq %rax, 0x30f28(%rbx,%r14,8)
incq %r14
movslq 0x10(%rbx), %rax
cmpq %rax, %r14
jl 0x182f6
movl %eax, 0x30f20(%rbx)
jmp 0x1832e
movl $0x4, 0x30f08(%rbx)
movl $0x1, 0x30f24(%rbx)
movq %r13, %rdi
callq 0x31a5a
movq %rax, %r12
cmpl $0x2, 0x8(%rsp)
jl 0x18383
leaq 0x31248(%rbx), %r15
movl $0x1, %r14d
movl $0x1, 0x1c(%r15)
movq %r12, %rdi
movl %r14d, %esi
callq 0x31a3e
xorl %ecx, %ecx
testl %eax, %eax
setne %cl
movl %ecx, (%r15)
incq %r14
addq $0x340, %r15            # imm = 0x340
cmpq %r14, %rbp
jne 0x18357
movq %rbx, %rdi
callq 0x16542
movq %rax, %r14
leaq 0x935c6(%rip), %rsi     # 0xab95b
movq %rax, %rdi
callq 0x40f0
testq %rax, %rax
je 0x1856b
movq %rax, %r13
movq %r14, (%rsp)
leaq 0x40(%rsp), %r14
movq %r14, %rdi
movl $0x7a120, %esi          # imm = 0x7A120
movq %rax, %rdx
callq 0x4120
testq %rax, %rax
movq 0x10(%rsp), %rbp
je 0x1850e
movq %rbx, %rax
addq $0x30f08, %rax          # imm = 0x30F08
movq %rax, 0x20(%rsp)
movl $0x1, %r15d
movq %r13, 0x28(%rsp)
movq %r14, %rdi
callq 0x4190
cmpq $0x1, %rax
jbe 0x184f5
incl 0x1407120(%rbx)
movq %r14, %rdi
callq 0x4190
movb $0x0, -0x1(%rax,%r14)
movq %r14, %rdi
movq %rbp, %rsi
callq 0x4280
movl 0x10(%rbx), %edx
movq %rax, %rdi
movq 0x38(%rsp), %rsi
callq 0x3b355
cmpl $-0x1, %eax
je 0x1858b
cltq
movq 0x30(%rsp), %rcx
incl (%rcx,%rax,4)
xorl %r13d, %r13d
xorl %edi, %edi
movq %rbp, %rsi
callq 0x4280
movq %rax, %rdi
callq 0x4200
movl %eax, 0x1c(%rsp)
xorl %edi, %edi
movq %rbp, %rsi
callq 0x4280
testq %rax, %rax
je 0x184de
movq %rax, %r14
xorl %r13d, %r13d
movl $0x1, %ebp
movq %r12, %rdi
movl %ebp, %esi
callq 0x31a3e
testl %eax, %eax
jne 0x184aa
movq %r14, %rdi
callq 0x3a938
testl %eax, %eax
jne 0x184aa
movslq %ebp, %rax
imulq $0x340, %rax, %rax      # imm = 0x340
movq 0x20(%rsp), %rcx
cmpl $0x2, (%rcx,%rax)
je 0x184aa
addq 0x20(%rsp), %rax
movl $0x2, (%rax)
incl %ebp
xorl %eax, %eax
cmpl 0x8(%rsp), %ebp
sete %al
cmovel %r15d, %ebp
addl %eax, %r13d
xorl %edi, %edi
movq 0x10(%rsp), %rsi
callq 0x4280
movq %rax, %r14
testq %rax, %rax
jne 0x18470
cmpl $0x1, %ebp
jne 0x185b6
movq 0x10(%rsp), %rbp
movl 0x1c(%rsp), %edx
cmpl %edx, %r13d
movq 0x28(%rsp), %r13
leaq 0x40(%rsp), %r14
jne 0x1859e
movq %r14, %rdi
movl $0x7a120, %esi          # imm = 0x7A120
movq %r13, %rdx
callq 0x4120
testq %rax, %rax
jne 0x183e9
movq %r13, %rdi
callq 0x42a0
movl $0x0, (%rbx)
leaq 0xbd355(%rip), %rcx     # 0xd5878
movq (%rcx), %rax
testq %rax, %rax
movq (%rsp), %r14
je 0x18545
movq %rax, %rcx
movq 0x1407270(%rax), %rax
testq %rax, %rax
jne 0x1852f
addq $0x1407270, %rcx        # imm = 0x1407270
movq %rbx, (%rcx)
leaq 0x8f1ad(%rip), %rdi     # 0xa76fc
callq 0x4090
movq %r14, %rdi
callq 0x3a180
movq %r12, %rdi
callq 0x31a10
movl $0x1, %ebp
jmp 0x185e2
leaq 0x8e9ef(%rip), %rdi     # 0xa6f61
xorl %ebp, %ebp
movq %r14, %rsi
xorl %eax, %eax
callq 0x4030
movq %rbx, %rdi
callq 0x1376b
movq %r14, %rdi
jmp 0x185d5
movl 0x1407120(%rbx), %esi
leaq 0x8ea24(%rip), %rdi     # 0xa6fbc
xorl %ebp, %ebp
xorl %edx, %edx
jmp 0x185ad
movl 0x1407120(%rbx), %esi
leaq 0x8ead5(%rip), %rdi     # 0xa7080
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x4030
jmp 0x185c9
leaq 0x8ea97(%rip), %rdi     # 0xa7054
xorl %ebp, %ebp
movl %r13d, %esi
xorl %eax, %eax
callq 0x4030
movq %rbx, %rdi
callq 0x1376b
movq (%rsp), %rdi
callq 0x3a180
movq %r12, %rdi
callq 0x31a10
movl %ebp, %eax
addq $0x7a168, %rsp          # imm = 0x7A168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq