// File: /workspace/github_c_makefile_star2_O1/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, %r13d
movq %rsi, %rbx
movq %rdi, 0x8(%rsp)
xorl %eax, %eax
movq %rax, 0x10(%rsp)
movq %rax, (%rsp)
movq %rsi, %rdi
movl %edx, %esi
callq 0x151e8
movq %rax, 0x10(%rsp)
movq %rbx, %rdi
movl %r13d, %esi
callq 0x151e8
testq %rax, %rax
je 0x8a7ea
movq %rax, %rcx
movl $0x1, 0x20(%rcx)
movq 0x10(%rcx), %rcx
testq %rcx, %rcx
jne 0x8a7da
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2fd59
leaq 0x469bf(%rip), %rax     # 0xd11c0
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %esi, %esi
movq 0x8(%rsp), %rdx
callq *0x348(%rax)
movq %rax, %r15
movq %rax, %rdi
callq 0x1c583
movl %eax, (%r12)
movq %rsp, %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1c787
movq (%rbx), %rdi
callq 0x2fa14
movq %r13, 0x18(%rsp)
leal (,%r13,2), %ebx
cmpl %ebx, %eax
je 0x8a865
movq (%rsp), %rdi
callq 0x2fa14
leaq 0x23b99(%rip), %rdi     # 0xae3f3
movl %eax, %esi
movl %ebx, %edx
xorl %eax, %eax
callq 0x4030
movq (%rsp), %r12
movl $0x0, %r13d
testq %r12, %r12
je 0x8a8d3
xorl %r13d, %r13d
leaq 0x20(%rsp), %rbp
xorl %r14d, %r14d
movq %r12, %rdi
callq 0x2eaca
movl %eax, %ebx
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
movq 0x8(%rsp), %rcx
movq %rbp, %r8
leaq 0x4691d(%rip), %rax     # 0xd11c0
callq *0x350(%rax)
movl 0x38(%rsp), %eax
cmpl %eax, %ebx
je 0x8a8bb
cmpl $0x1, 0x20(%r12)
adcl $0x0, %r13d
cmpl %eax, %ebx
jne 0x8a8c9
cmpl $0x1, 0x20(%r12)
sbbl $-0x1, %r14d
movq 0x10(%r12), %r12
testq %r12, %r12
jne 0x8a87f
subl %r14d, %r13d
movq (%rsp), %rdi
callq 0x2f616
movq $0x0, (%rsp)
leaq 0x47f82(%rip), %rax     # 0xd2870
movq (%rax), %rdx
movl $0x3fd, %edi            # imm = 0x3FD
movq %r15, %rsi
callq 0x4d52
cvtsi2sd %r13d, %xmm0
cvtsi2sdl 0x18(%rsp), %xmm1
divsd %xmm1, %xmm0
andpd 0x188cb(%rip), %xmm0    # 0xa31e0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq