// File: /workspace/github_c_makefile_star2_O3/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, %r14
movq %rcx, %rbx
movq %rdx, %rbp
movq %rsi, (%rsp)
movq %rdi, %r13
leaq 0xbe7c8(%rip), %r12     # 0xd5878
movq (%r12), %r15
testq %r15, %r15
je 0x170e6
movq 0x8(%r15), %rdi
movq %r13, %rsi
callq 0x4260
testl %eax, %eax
je 0x170d2
movq 0x1407270(%r15), %r15
jmp 0x170b4
leaq 0x905c0(%rip), %rdi     # 0xa7699
callq 0x4090
movq %r13, %rdi
callq 0x173c4
movq %r13, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
movl $0x20, %ecx
callq 0x155f1
movq %rax, %rbx
movl $0x3, 0x140713c(%rax)
leaq 0x1407218(%rax), %rdx
leaq 0x1407268(%rax), %rcx
leaq 0x919d3(%rip), %rbp     # 0xa8aee
movq %r14, %rdi
movq %rbp, %rsi
callq 0x3b4c1
leaq 0x1407140(%rbx), %r15
xorl %r14d, %r14d
movl $0xc8, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x4050
leaq 0x18(%rbx), %rdx
leaq 0x10(%rbx), %r13
movq (%rsp), %rdi
movq %rbp, %rsi
movq %rdx, 0x18(%rsp)
movq %r13, %rcx
callq 0x3b4c1
movl 0x10(%rbx), %esi
cmpl $0x33, %esi
jl 0x17176
leaq 0x8fdcc(%rip), %rdi     # 0xa6f36
xorl %eax, %eax
callq 0x4030
jmp 0x173af
movq %rbx, %rdi
callq 0x16542
movq %rax, %rbp
leaq 0x947d3(%rip), %rsi     # 0xab95b
movq %rax, %rdi
callq 0x40f0
testq %rax, %rax
je 0x172f2
movq %rax, %r14
movq %r15, 0x10(%rsp)
movq $0x0, (%rsp)
leaq 0x20(%rsp), %r15
movq %r15, %rdi
movl $0x7a120, %esi          # imm = 0x7A120
movq %r14, %rdx
callq 0x4120
testq %rax, %rax
je 0x17262
movq %r15, %rdi
callq 0x4190
cmpq $0x2, %rax
jb 0x171ae
movq %rbp, 0x8(%rsp)
movb $0x0, -0x1(%rax,%r15)
movq %r15, %rdi
leaq 0x914fb(%rip), %rsi     # 0xa86e5
callq 0x4280
testq %rax, %rax
je 0x1724e
xorl %ebp, %ebp
cmpl $0x1, %ebp
je 0x17211
testl %ebp, %ebp
jne 0x17239
movq %rax, %rdi
callq 0x4200
cmpl (%rsp), %eax
je 0x17239
jmp 0x1736a
movl (%r13), %edx
testl %edx, %edx
je 0x17239
movq %rax, %rdi
movq 0x18(%rsp), %rsi
callq 0x3b355
cmpl $-0x1, %eax
je 0x17383
cltq
movq 0x10(%rsp), %rcx
incl (%rcx,%rax,4)
incl %ebp
xorl %edi, %edi
leaq 0x914a1(%rip), %rsi     # 0xa86e5
callq 0x4280
testq %rax, %rax
jne 0x171f6
movq (%rsp), %rax
incl %eax
movq %rax, (%rsp)
movq 0x8(%rsp), %rbp
jmp 0x171ae
movq %r14, %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)
movl 0x10(%rbx), %eax
testl %eax, %eax
je 0x17316
movl $0x3, 0x31248(%rbx)
jle 0x172ea
xorl %r14d, %r14d
movq 0x31268(%rbx,%r14,8), %rdi
movq 0x18(%rbx,%r14,8), %rsi
callq 0x3b494
movq %rax, 0x31268(%rbx,%r14,8)
incq %r14
movslq 0x10(%rbx), %rax
cmpq %rax, %r14
jl 0x172c4
movl %eax, 0x31260(%rbx)
jmp 0x17320
leaq 0x8fc68(%rip), %rdi     # 0xa6f61
xorl %r14d, %r14d
movq %rbp, %rsi
xorl %eax, %eax
callq 0x4030
movq %rbx, %rdi
callq 0x1376b
movq %rbp, %rdi
jmp 0x173aa
movl $0x4, 0x31248(%rbx)
movq (%r12), %rax
testq %rax, %rax
je 0x1733f
movq %rax, %r12
movq 0x1407270(%rax), %rax
testq %rax, %rax
jne 0x17329
addq $0x1407270, %r12        # imm = 0x1407270
movq %rbx, (%r12)
movq $0x0, 0x1407210(%rbx)
leaq 0x903a7(%rip), %rdi     # 0xa76fc
callq 0x4090
movq %rbp, %rdi
callq 0x3a180
movl $0x1, %r14d
jmp 0x173af
movq (%rsp), %rsi
incl %esi
leaq 0x8fc08(%rip), %rdi     # 0xa6f7f
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x4030
jmp 0x1739d
leaq 0x8fc32(%rip), %rdi     # 0xa6fbc
xorl %r14d, %r14d
movq (%rsp), %rsi
movl $0x1, %edx
xorl %eax, %eax
callq 0x4030
movq %rbx, %rdi
callq 0x1376b
movq 0x8(%rsp), %rdi
callq 0x3a180
movl %r14d, %eax
addq $0x7a148, %rsp          # imm = 0x7A148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq