// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/srm.c
// Function: vc_single_epsilon_estimate
double vc_single_epsilon_estimate(void* parameters, Datasetptr d, int n, int* nodecount)
{
 Instanceptr data, tmp, traindata = NULL, testdata = NULL;
 int misclassified1, misclassified2, realclassno;
 void* model;
 double pos[2]; 
 Prediction predicted;
 traindata = generate_random_data(d, n);
 data = generate_random_data(d, n);
 tmp = data;
 while (tmp)
  {
   tmp->isexception = YES;
   tmp = tmp->next;
  }
 merge_instancelist(&traindata, data);
 model = classification_algorithms[NBTREE - SELECTMAX].train_algorithm(&traindata, NULL, parameters);
 *nodecount = decisiontree_node_count((Decisionnodeptr) model);
 accumulate_instances_tree(&testdata, (Decisionnodeptr) model);
 if (data_size(testdata) != (2 * n))
   printf("Test data is not correctly accumulated %d %d\n", data_size(testdata), 2 * n);
 tmp = testdata;
 misclassified1 = 0;
 misclassified2 = 0;
 while (tmp)
  {
   realclassno = give_classno(tmp);
   predicted = classification_algorithms[NBTREE - SELECTMAX].test_algorithm(tmp, model, parameters, pos);
   if (realclassno != predicted.classno && !(tmp->isexception))
     misclassified1++;
   if (realclassno == predicted.classno && tmp->isexception)
     misclassified2++; 
   tmp = tmp->next;
  }
 deallocate(testdata);
 testdata = NULL;
 free_model_of_supervised_algorithm(NBTREE, model, current_dataset);
 return fabs((misclassified1 - misclassified2) / (n + 0.0));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rcx, %r12
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, 0x8(%rsp)
andq $0x0, (%rsp)
movq %rsi, %rdi
movl %edx, %esi
callq 0x13ff2
movq %rax, 0x18(%rsp)
movq %r15, %rdi
movl %ebx, %esi
callq 0x13ff2
movq %rax, %rcx
testq %rcx, %rcx
je 0x7f6c3
movl $0x1, 0x20(%rcx)
movq 0x10(%rcx), %rcx
jmp 0x7f6b1
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %rax, %rsi
callq 0x2c6e4
leaq 0x4cae6(%rip), %rax     # 0xcc1c0
xorl %r14d, %r14d
movq %r15, %rdi
xorl %esi, %esi
movq 0x8(%rsp), %rdx
callq *0x348(%rax)
movq %rax, %r15
movq %rax, %rdi
callq 0x1a8d0
movl %eax, (%r12)
movq %rsp, %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x1aad3
movq (%r12), %rdi
callq 0x2c3cc
movq %rbx, 0x10(%rsp)
leal (%rbx,%rbx), %ebp
cmpl %ebp, %eax
je 0x7f73a
movq (%rsp), %rdi
callq 0x2c3cc
leaq 0x21cbc(%rip), %rdi     # 0xa13eb
movl %eax, %esi
movl %ebp, %edx
xorl %eax, %eax
callq 0x4030
leaq 0x20(%rsp), %rbp
xorl %r13d, %r13d
movq (%r12), %r12
testq %r12, %r12
je 0x7f796
movq %r12, %rdi
callq 0x2b47e
movl %eax, %ebx
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
movq 0x8(%rsp), %rcx
movq %rbp, %r8
leaq 0x4ca51(%rip), %rax     # 0xcc1c0
callq *0x350(%rax)
movl 0x20(%r12), %eax
cmpl 0x38(%rsp), %ebx
jne 0x7f789
cmpl $0x1, %eax
sbbl $-0x1, %r14d
jmp 0x7f790
cmpl $0x1, %eax
adcl $0x0, %r13d
addq $0x10, %r12
jmp 0x7f742
movq (%rsp), %rdi
callq 0x2c010
andq $0x0, (%rsp)
leaq 0x4e0c5(%rip), %rax     # 0xcd870
movq (%rax), %rdx
movl $0x3fd, %edi            # imm = 0x3FD
movq %r15, %rsi
callq 0x4d2f
subl %r14d, %r13d
cvtsi2sd %r13d, %xmm0
cvtsi2sdl 0x10(%rsp), %xmm1
divsd %xmm1, %xmm0
andpd 0x16a0b(%rip), %xmm0    # 0x961e0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq