// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/dataset.c
// Function: create_instance
Instanceptr create_instance(Datasetptr dataset, char *myline, int withnoise)
{
 /*!Last Changed 07.01.2007 added sublist and continuous data*/
 /*!Last Changed 08.05.2004 can now handle exceptions*/
 /*!Last Changed 10.03.2004 Extended to regression*/
 /*!Last Changed 02.02.2004 added safemalloc*/
 Instanceptr currentinstance, subinstance, firstinstance;
 int j, k, unknown, tmp, cno, framecount, currentframe = 0;
 char st1[4];
 char *st, tmpline[READLINELENGTH];
 if (is_line_comment(myline))
   return NULL;
 strcpy(tmpline, myline);
 st1[0] = dataset->separator;
 st1[1] = '\n';
 st1[2] = '\0';
 if (dataset->storetype == STORE_MULTILABEL)
   currentinstance = empty_multi_label_instance(dataset->featurecount, dataset->classno);
 else
   currentinstance = empty_instance(dataset->featurecount);
 firstinstance = currentinstance;
 j = 0;
 k = 0;
 st = (char *) strtok(tmpline, st1);
 if (dataset->storetype == STORE_SEQUENTIAL)
  {
   currentinstance->values[0].stringindex = listindex(st, dataset->features[0].strings, dataset->features[0].valuecount);
   cno = currentinstance->values[0].stringindex;
   if (cno == -1)
     printf(m1263, myline, st);
   st = (char *) strtok(NULL, st1);
   framecount = atoi(st);
   currentframe = 0;
   st = (char *) strtok(NULL, st1);
   j = 1;
   k = 1;
  }
 while (st)
  {
   if (dataset->availability[j])
    {
     if (strcmp(st, "?") == 0)
       unknown = 1;
     else
       unknown = 0;
     if (k < dataset->featurecount)
      {
       switch (dataset->features[k].type){
         case INTEGER :if (!unknown)
                         currentinstance->values[k].intvalue = atoi(st);
                       else
                         currentinstance->values[k].intvalue = ISELL;
                       break;
         case REGDEF  :
         case REAL    :if (!unknown)
                         currentinstance->values[k].floatvalue = (double)atof(st);
                       else
                         currentinstance->values[k].floatvalue = ISELL;
                       break;
         case STRING  :if (!unknown)
                        {
                         tmp = listindex(st, dataset->features[k].strings, dataset->features[k].valuecount);
                         if (tmp == -1)
                           printf(m1262, st, k);
                         else
                           currentinstance->values[k].stringindex = tmp;
                        }
                       else
                         currentinstance->values[k].stringindex = -1;
                       break;
         case CLASSDEF:currentinstance->values[k].stringindex = listindex(st, dataset->features[k].strings, dataset->features[k].valuecount);
                       if (currentinstance->values[k].stringindex == -1)
                         printf(m1263, myline, st);
                       if (withnoise && get_parameter_f("noiselevel") > 0.0)
                         if (produce_random_value(0.0, 1.0) < get_parameter_f("noiselevel"))
                           currentinstance->values[k].stringindex = myrand() % dataset->features[k].valuecount;
                       break;
         default      :printf(m1238, dataset->features[k].type);
                       break;
       }
      }
     else
       if (dataset->storetype == STORE_MULTILABEL)
         currentinstance->class_labels[k - dataset->classdefno] = atoi(st);
     k++;
    }
   st = (char *) strtok(NULL, st1);
   j++;
   if (k == dataset->featurecount && dataset->storetype == STORE_SEQUENTIAL && st)
    {
     subinstance = empty_instance(dataset->featurecount);
     if (currentframe == 0)
       currentinstance->sublist = subinstance;
     else
       currentinstance->next = subinstance;
     subinstance->values[0].stringindex = cno;
     currentframe++;
     j = 1;
     k = 1;
     currentinstance = subinstance;
    }
  }
 if (k == dataset->featurecount || (k == dataset->featurecount + dataset->classno && dataset->storetype == STORE_MULTILABEL))
   return firstinstance;
 else
   return NULL;  
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x7a190, %rsp          # imm = 0x7A190
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl $0x0, -0x54(%rbp)
movq -0x18(%rbp), %rdi
callq 0x532e0
cmpl $0x0, %eax
je 0x22c68
movq $0x0, -0x8(%rbp)
jmp 0x23185
leaq -0x7a180(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x4220
movq -0x10(%rbp), %rax
movb 0x1a8(%rax), %al
movb %al, -0x58(%rbp)
movb $0xa, -0x57(%rbp)
movb $0x0, -0x56(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x4, 0x140713c(%rax)
jne 0x22cb6
movq -0x10(%rbp), %rax
movl 0x1bc(%rax), %edi
movq -0x10(%rbp), %rax
movl 0x10(%rax), %esi
callq 0x22be0
movq %rax, -0x28(%rbp)
jmp 0x22cc9
movq -0x10(%rbp), %rax
movl 0x1bc(%rax), %edi
callq 0x1e140
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x40(%rbp)
leaq -0x7a180(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x4230
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x2, 0x140713c(%rax)
jne 0x22d9c
movq -0x60(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x30f08, %rsi          # imm = 0x30F08
addq $0x20, %rsi
movq -0x10(%rbp), %rax
movl 0x30f20(%rax), %edx
callq 0x54910
movl %eax, %ecx
movq -0x28(%rbp), %rax
movq (%rax), %rax
movl %ecx, (%rax)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movl (%rax), %eax
movl %eax, -0x4c(%rbp)
cmpl $-0x1, -0x4c(%rbp)
jne 0x22d59
movq -0x18(%rbp), %rsi
movq -0x60(%rbp), %rdx
leaq 0xc1216(%rip), %rdi     # 0xe3f68
movb $0x0, %al
callq 0x4030
leaq -0x58(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x4230
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
callq 0x41c0
movl %eax, -0x50(%rbp)
movl $0x0, -0x54(%rbp)
leaq -0x58(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x4230
movq %rax, -0x60(%rbp)
movl $0x1, -0x3c(%rbp)
movl $0x1, -0x40(%rbp)
jmp 0x22d9e
cmpq $0x0, -0x60(%rbp)
je 0x2313f
movq -0x10(%rbp), %rax
movslq -0x3c(%rbp), %rcx
cmpl $0x0, 0x1c4(%rax,%rcx,4)
je 0x2309f
movq -0x60(%rbp), %rdi
leaq 0xc0eed(%rip), %rsi     # 0xe3cb7
callq 0x4210
cmpl $0x0, %eax
jne 0x22ddd
movl $0x1, -0x44(%rbp)
jmp 0x22de4
movl $0x0, -0x44(%rbp)
movl -0x40(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x1bc(%rcx), %eax
jge 0x23061
movq -0x10(%rbp), %rax
movslq -0x40(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
movl 0x30f08(%rax,%rcx), %eax
movq %rax, -0x7a188(%rbp)
subq $0x4, %rax
ja 0x23037
movq -0x7a188(%rbp), %rax
leaq 0xc02f8(%rip), %rcx     # 0xe3124
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x0, -0x44(%rbp)
jne 0x22e56
movq -0x60(%rbp), %rdi
callq 0x41c0
movl %eax, %edx
movq -0x28(%rbp), %rax
movq (%rax), %rax
movslq -0x40(%rbp), %rcx
movl %edx, (%rax,%rcx,8)
jmp 0x22e68
movq -0x28(%rbp), %rax
movq (%rax), %rax
movslq -0x40(%rbp), %rcx
movl $0x75bcd15, (%rax,%rcx,8) # imm = 0x75BCD15
jmp 0x2305f
cmpl $0x0, -0x44(%rbp)
jne 0x22e8e
movq -0x60(%rbp), %rdi
callq 0x4100
movq -0x28(%rbp), %rax
movq (%rax), %rax
movslq -0x40(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x22ea6
movq -0x28(%rbp), %rax
movq (%rax), %rax
movslq -0x40(%rbp), %rcx
movsd 0xbfaf7(%rip), %xmm0    # 0xe2998
movsd %xmm0, (%rax,%rcx,8)
jmp 0x2305f
cmpl $0x0, -0x44(%rbp)
jne 0x22f25
movq -0x60(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x30f08, %rsi          # imm = 0x30F08
movslq -0x40(%rbp), %rax
imulq $0x340, %rax, %rax      # imm = 0x340
addq %rax, %rsi
addq $0x20, %rsi
movq -0x10(%rbp), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movslq -0x40(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
movl 0x18(%rax), %edx
callq 0x54910
movl %eax, -0x48(%rbp)
cmpl $-0x1, -0x48(%rbp)
jne 0x22f12
movq -0x60(%rbp), %rsi
movl -0x40(%rbp), %edx
leaq 0xc109c(%rip), %rdi     # 0xe3fa5
movb $0x0, %al
callq 0x4030
jmp 0x22f23
movl -0x48(%rbp), %edx
movq -0x28(%rbp), %rax
movq (%rax), %rax
movslq -0x40(%rbp), %rcx
movl %edx, (%rax,%rcx,8)
jmp 0x22f37
movq -0x28(%rbp), %rax
movq (%rax), %rax
movslq -0x40(%rbp), %rcx
movl $0xffffffff, (%rax,%rcx,8) # imm = 0xFFFFFFFF
jmp 0x2305f
movq -0x60(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x30f08, %rsi          # imm = 0x30F08
movslq -0x40(%rbp), %rax
imulq $0x340, %rax, %rax      # imm = 0x340
addq %rax, %rsi
addq $0x20, %rsi
movq -0x10(%rbp), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movslq -0x40(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
movl 0x18(%rax), %edx
callq 0x54910
movl %eax, %edx
movq -0x28(%rbp), %rax
movq (%rax), %rax
movslq -0x40(%rbp), %rcx
movl %edx, (%rax,%rcx,8)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movslq -0x40(%rbp), %rcx
cmpl $-0x1, (%rax,%rcx,8)
jne 0x22fb4
movq -0x18(%rbp), %rsi
movq -0x60(%rbp), %rdx
leaq 0xc0fbb(%rip), %rdi     # 0xe3f68
movb $0x0, %al
callq 0x4030
cmpl $0x0, -0x1c(%rbp)
je 0x23035
leaq 0xc0260(%rip), %rdi     # 0xe3221
callq 0x79040
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x23035
xorps %xmm0, %xmm0
movsd 0xbf03e(%rip), %xmm1    # 0xe2018
callq 0x545a0
movsd %xmm0, -0x7a190(%rbp)
leaq 0xc0233(%rip), %rdi     # 0xe3221
callq 0x79040
movsd -0x7a190(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x23033
movb $0x0, %al
callq 0x54550
movq -0x10(%rbp), %rcx
addq $0x30f08, %rcx          # imm = 0x30F08
movslq -0x40(%rbp), %rdx
imulq $0x340, %rdx, %rdx      # imm = 0x340
addq %rdx, %rcx
cltd
idivl 0x18(%rcx)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movslq -0x40(%rbp), %rcx
movl %edx, (%rax,%rcx,8)
jmp 0x23035
jmp 0x2305f
movq -0x10(%rbp), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movslq -0x40(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
movl (%rax), %esi
leaq 0xbff96(%rip), %rdi     # 0xe2fee
movb $0x0, %al
callq 0x4030
jmp 0x23096
movq -0x10(%rbp), %rax
cmpl $0x4, 0x140713c(%rax)
jne 0x23094
movq -0x60(%rbp), %rdi
callq 0x41c0
movl %eax, %edx
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x40(%rbp), %ecx
movq -0x10(%rbp), %rsi
subl 0x1407128(%rsi), %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x23096
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
leaq -0x58(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x4230
movq %rax, -0x60(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movl -0x40(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x1bc(%rcx), %eax
jne 0x2313a
movq -0x10(%rbp), %rax
cmpl $0x2, 0x140713c(%rax)
jne 0x2313a
cmpq $0x0, -0x60(%rbp)
je 0x2313a
movq -0x10(%rbp), %rax
movl 0x1bc(%rax), %edi
callq 0x1e140
movq %rax, -0x30(%rbp)
cmpl $0x0, -0x54(%rbp)
jne 0x23103
movq -0x30(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x28(%rax)
jmp 0x2310f
movq -0x30(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movl -0x4c(%rbp), %ecx
movq -0x30(%rbp), %rax
movq (%rax), %rax
movl %ecx, (%rax)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
movl $0x1, -0x3c(%rbp)
movl $0x1, -0x40(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x22d9e
movl -0x40(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x1bc(%rcx), %eax
je 0x23173
movl -0x40(%rbp), %eax
movq -0x10(%rbp), %rcx
movl 0x1bc(%rcx), %ecx
movq -0x10(%rbp), %rdx
addl 0x10(%rdx), %ecx
cmpl %ecx, %eax
jne 0x2317d
movq -0x10(%rbp), %rax
cmpl $0x4, 0x140713c(%rax)
jne 0x2317d
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x23185
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x7a190, %rsp          # imm = 0x7A190
popq %rbp
retq
nopw %cs:(%rax,%rax)