// File: /workspace/github_c_makefile_star2_O1/olcaytaner[P]Isell/dataset.c
// Function: generate_random_dataset
Datasetptr generate_random_dataset(char* name, int featurecount, char* featuretypes, int* featurevaluecounts, int numberofclasses)
{
 /*!Last Changed 15.03.2007 added selected field*/
 /*!Last Changed 24.09.2006 added string type*/
 /*!Last Changed 09.03.2006*/
 /*featurecount does not include the class definition feature*/
 int i, count;
 char st[3];
 Datasetptr newdataset;
 newdataset = empty_dataset(name, "random", "random.txt", ' ');
 newdataset->allfeatures = featurecount + 1;
 newdataset->featurecount = featurecount + 1;
 count = 1; /*For class feature*/
 for (i = 0; i < featurecount; i++)
   count += featurevaluecounts[i];
 newdataset->multifeaturecount = count;
 for (i = 0; i < featurecount + 1; i++)
   newdataset->availability[i] = YES;
 newdataset->classdefno = featurecount;
 newdataset->newclassdefno = count - 1;
 newdataset->classno = numberofclasses;
 for (i = 0; i < numberofclasses; i++)
  {
   sprintf(st, "%d", i);
   newdataset->classes[i] = strcopy(newdataset->classes[i], st);
  }
 for (i = 0; i < featurecount; i++)
  {
   switch (featuretypes[i])
    {
     case 'R':newdataset->features[i].max.floatvalue = 1.0;
              newdataset->features[i].min.floatvalue = -1.0;
              newdataset->features[i].type = REAL;
              newdataset->features[i].oldtype = REAL;
              newdataset->features[i].valuecount = 0;
              break;
     case 'D':newdataset->features[i].type = STRING;
              newdataset->features[i].oldtype = STRING;
              newdataset->features[i].valuecount = featurevaluecounts[i];
              break;
    }
   newdataset->features[i].selected = YES;
  }
 newdataset->features[featurecount].type = CLASSDEF; 
 newdataset->features[featurecount].oldtype = CLASSDEF; 
 newdataset->features[featurecount].valuecount = numberofclasses;
 for (i = 0; i < numberofclasses; i++)
  {
   sprintf(st, "%d", i);
   newdataset->features[featurecount].strings[i] = strcopy(newdataset->features[featurecount].strings[i], st);
  }
 return newdataset;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r8d, %ebp
movq %rcx, %r14
movq %rdx, 0x10(%rsp)
movl %esi, %r15d
leaq 0x8e243(%rip), %rsi     # 0xa3870
leaq 0x8e243(%rip), %rdx     # 0xa3877
movl $0x20, %ecx
callq 0x15559
movq %rax, %rbx
leal 0x1(%r15), %eax
movl %eax, 0x1b8(%rbx)
movl %eax, 0x1bc(%rbx)
movl %r15d, %r12d
movl $0x1, %ecx
testl %r15d, %r15d
jle 0x1566c
xorl %edx, %edx
addl (%r14,%rdx,4), %ecx
incq %rdx
cmpq %rdx, %r12
jne 0x15660
movq %r14, 0x20(%rsp)
movl %ecx, 0x1c0(%rbx)
testl %r15d, %r15d
js 0x15691
xorl %edx, %edx
movl $0x1, 0x1c4(%rbx,%rdx,4)
incq %rdx
cmpq %rdx, %rax
jne 0x1567e
movq %r15, 0x18(%rsp)
movl %r15d, 0x1407128(%rbx)
decl %ecx
movl %ecx, 0x1407138(%rbx)
movl %ebp, 0x10(%rbx)
movl %ebp, %r13d
movl %ebp, 0xc(%rsp)
testl %ebp, %ebp
jle 0x156ec
leaq 0x984a3(%rip), %r14     # 0xadb5d
leaq 0x9(%rsp), %rbp
xorl %r15d, %r15d
movq %rbp, %rdi
movq %r14, %rsi
movl %r15d, %edx
xorl %eax, %eax
callq 0x41b0
movq 0x18(%rbx,%r15,8), %rdi
movq %rbp, %rsi
callq 0x3a404
movq %rax, 0x18(%rbx,%r15,8)
incq %r15
cmpq %r15, %r13
jne 0x156c2
movq 0x18(%rsp), %r14
testl %r14d, %r14d
movl 0xc(%rsp), %r10d
movq 0x20(%rsp), %r11
movq 0x10(%rsp), %r15
jle 0x15777
leaq 0x30f08(%rbx), %rax
xorl %ecx, %ecx
movabsq $0x100000001, %rdx      # imm = 0x100000001
movabsq $0x3ff0000000000000, %rsi # imm = 0x3FF0000000000000
movabsq $-0x4010000000000000, %rdi # imm = 0xBFF0000000000000
movabsq $0x200000002, %r8       # imm = 0x200000002
movzbl (%r15,%rcx), %r9d
cmpl $0x44, %r9d
je 0x15757
cmpl $0x52, %r9d
jne 0x15762
movq %rsi, 0x10(%rax)
movq %rdi, 0x8(%rax)
movq %r8, (%rax)
xorl %r9d, %r9d
jmp 0x1575e
movq %rdx, (%rax)
movl (%r11,%rcx,4), %r9d
movl %r9d, 0x18(%rax)
movl $0x1, 0x1c(%rax)
incq %rcx
addq $0x340, %rax            # imm = 0x340
cmpq %rcx, %r12
jne 0x15736
movslq %r14d, %rax
imulq $0x340, %rax, %rax      # imm = 0x340
movabsq $0x300000003, %rcx      # imm = 0x300000003
movq %rcx, 0x30f08(%rbx,%rax)
movl %r10d, 0x30f20(%rbx,%rax)
testl %r10d, %r10d
jle 0x157e4
leaq (%rbx,%rax), %rbp
addq $0x30f08, %rbp          # imm = 0x30F08
leaq 0x983ab(%rip), %r14     # 0xadb5d
leaq 0x9(%rsp), %r15
xorl %r12d, %r12d
movq %r15, %rdi
movq %r14, %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0x41b0
movq 0x20(%rbp,%r12,8), %rdi
movq %r15, %rsi
callq 0x3a404
movq %rax, 0x20(%rbp,%r12,8)
incq %r12
cmpq %r12, %r13
jne 0x157ba
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq