// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/rule.c
// Function: count_exceptions_for_ruleset
void count_exceptions_for_ruleset(Ruleset r, Instanceptr instances, int* C, int* U, int* fp, int* fn)
{
	/*!Last Changed 02.02.2004 added safemalloc*/
	/*!Last Changed 19.12.2003*/
	Instanceptr tmp = instances;
	Decisionruleptr rule;
	int iscovered, covered2 = *C, uncovered2 = *U, fp2 = *fp, fn2 = *fn, *classcoverings, i, classno, instanceclassno;
	classcoverings = (int *) safemalloc(current_dataset->classno * sizeof(int), "count_exceptions_for_ruleset", 4);
 while (tmp)
	 {
		 rule = r.start;
			iscovered = 0;
			for (i = 0; i < current_dataset->classno; i++)
				 classcoverings[i] = 0;
			instanceclassno = give_classno(tmp);
			while (rule)
			 {
				 if (rule_cover_instance(tmp, *rule))
					 {
						 iscovered = 1;
							classcoverings[rule->classno]++;
					 }
				 rule = rule->next;
			 }
			if (!iscovered)
			 {
				 uncovered2++;
				 if (instanceclassno != r.defaultclass)
						 fn2++;
			 }
			else
			 {
				 covered2++;
     classno = find_max_in_list(classcoverings, current_dataset->classno);
					if (instanceclassno != classno)
						 fp2++;
			 }
		 tmp = tmp -> next;
	 }
	safe_free(classcoverings);
	*C = covered2;
	*U = uncovered2;
	*fp = fp2;
	*fn = fn2;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %r13
movq %rsi, 0x20(%rsp)
movl (%rsi), %eax
movl %eax, 0x14(%rsp)
movq %rdx, 0x28(%rsp)
movl (%rdx), %eax
movl %eax, 0xc(%rsp)
movq %rcx, 0x30(%rsp)
movl (%rcx), %eax
movl %eax, 0x10(%rsp)
movq %r8, 0x38(%rsp)
movl (%r8), %eax
movl %eax, 0x8(%rsp)
leaq 0x5c320(%rip), %rax     # 0xcd870
movq (%rax), %rax
movslq 0x10(%rax), %rdi
shlq $0x2, %rdi
leaq 0x2e774(%rip), %rsi     # 0x9fcd6
pushq $0x4
popq %rdx
callq 0x34f59
movq %rax, %rbp
movq 0x80(%rsp), %rax
movq %rax, 0x40(%rsp)
movl 0x94(%rsp), %eax
movl %eax, 0x1c(%rsp)
pushq $0x1
popq %r12
testq %r13, %r13
je 0x71646
leaq 0x5c2d7(%rip), %rax     # 0xcd870
movq (%rax), %rax
xorl %ecx, %ecx
movslq 0x10(%rax), %rdx
cmpq %rdx, %rcx
jge 0x715b1
andl $0x0, (%rbp,%rcx,4)
incq %rcx
jmp 0x7159e
movq %r13, %rdi
callq 0x2b47e
movl %eax, 0x18(%rsp)
xorl %r15d, %r15d
movq 0x40(%rsp), %rbx
testq %rbx, %rbx
je 0x715fb
leaq 0x18(%rbx), %r14
movq (%r14), %r14
testq %r14, %r14
je 0x715eb
movq %r13, %rdi
movq %r14, %rsi
callq 0x7099c
addq $0x48, %r14
testl %eax, %eax
jne 0x715ce
jmp 0x715f5
movslq (%rbx), %rax
incl (%rbp,%rax,4)
movl %r12d, %r15d
movq 0x30(%rbx), %rbx
jmp 0x715c5
testl %r15d, %r15d
je 0x71628
incl 0x14(%rsp)
leaq 0x5c265(%rip), %rax     # 0xcd870
movq (%rax), %rax
movl 0x10(%rax), %esi
movq %rbp, %rdi
callq 0x336b5
xorl %ecx, %ecx
cmpl %eax, 0x18(%rsp)
setne %cl
addl %ecx, 0x10(%rsp)
jmp 0x7163d
incl 0xc(%rsp)
xorl %eax, %eax
movl 0x18(%rsp), %ecx
cmpl 0x1c(%rsp), %ecx
setne %al
addl %eax, 0x8(%rsp)
movq 0x10(%r13), %r13
jmp 0x71589
movq %rbp, %rdi
callq 0x34ff7
movq 0x20(%rsp), %rax
movl 0x14(%rsp), %ecx
movl %ecx, (%rax)
movq 0x28(%rsp), %rax
movl 0xc(%rsp), %ecx
movl %ecx, (%rax)
movq 0x30(%rsp), %rax
movl 0x10(%rsp), %ecx
movl %ecx, (%rax)
movq 0x38(%rsp), %rax
movl 0x8(%rsp), %ecx
movl %ecx, (%rax)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq