// File: /workspace/github_c_makefile_star2_O1/olcaytaner[P]Isell/dataset.c
// Function: create_kernel_dataset
int create_kernel_dataset(char* datasetname, char* classes, char* directoryname, char* datafilename, char* kernelfilename)
{
 Datasetptr tmp;
 int i, j, classcode;
 char* fname, *st, myline[READLINELENGTH];
 FILE* infile;
 tmp = search_dataset(Datasets, datasetname);
 if (tmp)
  {
   printf(m1120);
   delete_dataset(datasetname);
  }
 tmp = empty_dataset(datasetname, directoryname, datafilename, ' ');
 tmp->storetype = STORE_KERNEL;
 stringlist(kernelfilename, ";", tmp->kernelfiles, &(tmp->kernelcount));
 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;
  }
 fname = dataset_file_name(tmp);
 infile = fopen(fname, "r");
 if (!infile)
  {
   printf(m1121, fname);
   free_dataset(tmp);
   safe_free(fname);
   return 0;
  }
 j = 0;
 while (fgets(myline, READLINELENGTH, infile))
  {
   if (strlen(myline) <= 1)
     continue;
   myline[strlen(myline) - 1] = '\0';
   st = strtok(myline, " ");
   i = 0;
   while (st)
    {
     if (i == 0 && atoi(st) != j)
      {
       printf(m1475, j + 1);
       free_dataset(tmp);
       safe_free(fname);
       return 0;
      }
     if (i == 1 && tmp->classno)
      {
       classcode = listindex(st, tmp->classes, tmp->classno);
       if (classcode == -1)
        {
         printf(m1260, j, 1);
         free_dataset(tmp);
         safe_free(fname);
         return 0;
        }
       tmp->classcounts[classcode]++;
      }
     i++;
     st = strtok(NULL, " ");
    }
   j++;
  }
 fclose(infile);
 tmp->datacount = j;
 tmp->active = NO;
 tmp->classdefno = 1;
 tmp->featurecount = 2;
 tmp->features[0].type = REAL;
 tmp->features[0].min.floatvalue = 0.0;
 tmp->features[0].max.floatvalue = tmp->datacount - 1.0;
 if (tmp->classno)
  {
   tmp->features[1].type = CLASSDEF;
   for (i = 0; i < tmp->classno; i++)
     tmp->features[1].strings[i] = strcopy(tmp->features[1].strings[i], tmp->classes[i]);
   tmp->features[1].valuecount = tmp->classno;
  }
 else
   tmp->features[1].type = REGDEF;
 add_dataset(tmp);
 tmp->kernel = NULL;
 printf(m1126);
 safe_free(fname);
 return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x7a148, %rsp          # imm = 0x7A148
movq %r8, %rbp
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, 0x10(%rsp)
movq %rdi, %r13
leaq 0xbbaf3(%rip), %r15     # 0xd2878
movq (%r15), %r14
testq %r14, %r14
je 0x16dba
movq 0x8(%r14), %rdi
movq %r13, %rsi
callq 0x4260
testl %eax, %eax
je 0x16da6
movq 0x1407270(%r14), %r14
jmp 0x16d88
leaq 0x8d8aa(%rip), %rdi     # 0xa4657
callq 0x4090
movq %r13, %rdi
callq 0x170a0
movq %r13, %rdi
movq %r12, %rsi
movq %rbx, %rdx
movl $0x20, %ecx
callq 0x15559
movq %rax, %rbx
movl $0x3, 0x140713c(%rax)
leaq 0x1407218(%rax), %rdx
leaq 0x1407268(%rax), %rcx
leaq 0x8ec87(%rip), %r13     # 0xa5a76
movq %rbp, %rdi
movq %r13, %rsi
callq 0x3a431
leaq 0x1407140(%rbx), %rdi
xorl %ebp, %ebp
movl $0xc8, %edx
xorl %esi, %esi
callq 0x4050
leaq 0x18(%rbx), %rdx
leaq 0x10(%rbx), %rcx
movq 0x10(%rsp), %rdi
movq %r13, %rsi
movq %rdx, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
callq 0x3a431
movl 0x10(%rbx), %esi
cmpl $0x33, %esi
jl 0x16e49
leaq 0x8d0b5(%rip), %rdi     # 0xa3ef2
xorl %eax, %eax
callq 0x4030
jmp 0x1708c
movq %rbx, %rdi
callq 0x16285
movq %rax, %r12
leaq 0x91a34(%rip), %rsi     # 0xa888f
movq %rax, %rdi
callq 0x40f0
testq %rax, %rax
je 0x16fd5
movq %rax, %rbp
movq $0x0, (%rsp)
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movl $0x7a120, %esi          # imm = 0x7A120
movq %rbp, %rdx
callq 0x4120
testq %rax, %rax
je 0x16f41
movq %r14, %rdi
callq 0x4190
cmpq $0x2, %rax
jb 0x16e7c
movq %r12, 0x8(%rsp)
movb $0x0, -0x1(%rax,%r14)
movq %r14, %rdi
leaq 0x8e7d5(%rip), %rsi     # 0xa568d
callq 0x4280
testq %rax, %rax
je 0x16f2d
movq %rax, %r13
xorl %r12d, %r12d
cmpl $0x1, %r12d
je 0x16eea
testl %r12d, %r12d
jne 0x16f14
movq %r13, %rdi
callq 0x4200
cmpl (%rsp), %eax
jne 0x17049
cmpl $0x1, %r12d
jne 0x16f14
movq 0x10(%rsp), %rax
movl (%rax), %edx
testl %edx, %edx
je 0x16f14
movq %r13, %rdi
movq 0x18(%rsp), %rsi
callq 0x3a2c5
cmpl $-0x1, %eax
je 0x17061
cltq
incl 0x1407140(%rbx,%rax,4)
incl %r12d
xorl %edi, %edi
leaq 0x8e76d(%rip), %rsi     # 0xa568d
callq 0x4280
movq %rax, %r13
testq %rax, %rax
jne 0x16ec8
movq (%rsp), %rax
incl %eax
movq %rax, (%rsp)
movq 0x8(%rsp), %r12
jmp 0x16e7c
movq %rbp, %rdi
callq 0x42a0
movq (%rsp), %rcx
movl %ecx, 0x1407120(%rbx)
movl $0x0, (%rbx)
movl $0x1, 0x1407128(%rbx)
movl $0x2, %eax
movl %eax, 0x1bc(%rbx)
movl %eax, 0x30f08(%rbx)
decl %ecx
cvtsi2sd %ecx, %xmm0
movq $0x0, 0x30f10(%rbx)
movsd %xmm0, 0x30f18(%rbx)
cmpl $0x0, 0x10(%rbx)
je 0x16ff8
movl $0x3, 0x31248(%rbx)
movl 0x10(%rbx), %eax
testl %eax, %eax
jle 0x16fcd
xorl %r14d, %r14d
movq 0x31268(%rbx,%r14,8), %rdi
movq 0x18(%rbx,%r14,8), %rsi
callq 0x3a404
movq %rax, 0x31268(%rbx,%r14,8)
incq %r14
movslq 0x10(%rbx), %rax
cmpq %rax, %r14
jl 0x16fa7
movl %eax, 0x31260(%rbx)
jmp 0x17002
leaq 0x8cf41(%rip), %rdi     # 0xa3f1d
xorl %ebp, %ebp
movq %r12, %rsi
xorl %eax, %eax
callq 0x4030
movq %rbx, %rdi
callq 0x13765
movq %r12, %rdi
jmp 0x17087
movl $0x4, 0x31248(%rbx)
movq (%r15), %rax
testq %rax, %rax
je 0x17020
movq %rax, %r15
movq 0x1407270(%rax), %rax
testq %rax, %rax
jne 0x1700a
addq $0x1407270, %r15        # imm = 0x1407270
movq %rbx, (%r15)
movq $0x0, 0x1407210(%rbx)
leaq 0x8d685(%rip), %rdi     # 0xa46ba
callq 0x4090
movq %r12, %rdi
callq 0x39194
movl $0x1, %ebp
jmp 0x1708c
movq (%rsp), %rsi
incl %esi
leaq 0x8cee5(%rip), %rdi     # 0xa3f3b
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x4030
jmp 0x1707a
leaq 0x8cf10(%rip), %rdi     # 0xa3f78
xorl %ebp, %ebp
movq (%rsp), %rsi
movl $0x1, %edx
xorl %eax, %eax
callq 0x4030
movq %rbx, %rdi
callq 0x13765
movq 0x8(%rsp), %rdi
callq 0x39194
movl %ebp, %eax
addq $0x7a148, %rsp          # imm = 0x7A148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq