// File: /workspace/github_c_makefile_star2_O2/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, %r12
movl %esi, %r13d
leaq 0x8243b(%rip), %rsi     # 0x96854
leaq 0x8243b(%rip), %rdx     # 0x9685b
pushq $0x20
popq %rcx
callq 0x1434b
movq %rax, %rbx
leal 0x1(%r13), %ecx
movl %ecx, 0x1b8(%rax)
movq %rax, 0x10(%rsp)
movl %ecx, 0x1bc(%rax)
xorl %ecx, %ecx
testl %r13d, %r13d
movl $0x0, %r15d
cmovgl %r13d, %r15d
pushq $0x1
popq %rax
cmpq %rcx, %r15
je 0x14460
addl (%r14,%rcx,4), %eax
incq %rcx
jmp 0x14452
movl %eax, 0x1c0(%rbx)
movslq %r13d, %rdx
xorl %ecx, %ecx
cmpq %rdx, %rcx
jg 0x14480
movl $0x1, 0x1c4(%rbx,%rcx,4)
incq %rcx
jmp 0x1446b
movq %rdx, 0x8(%rsp)
movq %r12, 0x18(%rsp)
movq %r14, 0x20(%rsp)
movl %r13d, 0x1407128(%rbx)
decl %eax
movl %eax, 0x1407138(%rbx)
testl %ebp, %ebp
movl $0x0, %r14d
cmovgl %ebp, %r14d
movl %ebp, 0x4(%rsp)
movl %ebp, 0x10(%rbx)
leaq 0x8c6a1(%rip), %r13     # 0xa0b59
leaq 0x1(%rsp), %rbp
xorl %r12d, %r12d
cmpq %r12, %r14
je 0x144ec
movq %rbp, %rdi
movq %r13, %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0x41b0
movq 0x18(%rbx,%r12,8), %rdi
movq %rbp, %rsi
callq 0x3604c
movq %rax, 0x18(%rbx,%r12,8)
incq %r12
jmp 0x144c0
movq 0x10(%rsp), %r10
addq $0x30f08, %r10          # imm = 0x30F08
xorl %eax, %eax
movabsq $0x100000001, %rcx      # imm = 0x100000001
movaps 0x81ff5(%rip), %xmm0    # 0x96500
movabsq $0x200000002, %rdx      # imm = 0x200000002
movq %r10, %rsi
movq 0x20(%rsp), %r8
movq 0x18(%rsp), %r9
cmpq %rax, %r15
je 0x1455e
movzbl (%r9,%rax), %edi
cmpl $0x44, %edi
je 0x14541
cmpl $0x52, %edi
jne 0x1454b
movups %xmm0, 0x8(%rsi)
movq %rdx, (%rsi)
xorl %edi, %edi
jmp 0x14548
movq %rcx, (%rsi)
movl (%r8,%rax,4), %edi
movl %edi, 0x18(%rsi)
movl $0x1, 0x1c(%rsi)
incq %rax
addq $0x340, %rsi            # imm = 0x340
jmp 0x14522
imulq $0x340, 0x8(%rsp), %rax # imm = 0x340
leaq (%r10,%rax), %rbp
movabsq $0x300000003, %rcx      # imm = 0x300000003
movq %rcx, (%r10,%rax)
movl 0x4(%rsp), %ecx
movl %ecx, 0x18(%r10,%rax)
leaq 0x8c5d0(%rip), %r13     # 0xa0b59
leaq 0x1(%rsp), %r15
xorl %r12d, %r12d
cmpq %r12, %r14
je 0x145bd
movq %r15, %rdi
movq %r13, %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0x41b0
movq 0x20(%rbp,%r12,8), %rdi
movq %r15, %rsi
callq 0x3604c
movq %rax, 0x20(%rbp,%r12,8)
incq %r12
jmp 0x14591
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq