// File: /workspace/github_c_makefile_star2_O3/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, 0x28(%rsp)
movl (%rsi), %eax
movl %eax, 0xc(%rsp)
movq %rdx, 0x30(%rsp)
movl (%rdx), %eax
movl %eax, 0x14(%rsp)
movq %rcx, 0x38(%rsp)
movl (%rcx), %eax
movl %eax, 0x10(%rsp)
movq %r8, 0x40(%rsp)
movl (%r8), %eax
movl %eax, 0x18(%rsp)
leaq 0x59d20(%rip), %rax     # 0xd5870
movq (%rax), %rax
movslq 0x10(%rax), %rdi
shlq $0x2, %rdi
leaq 0x34241(%rip), %rsi     # 0xafda3
movl $0x4, %edx
callq 0x3a0e1
movq %rax, %rbp
testq %r13, %r13
je 0x7bc55
leaq 0x80(%rsp), %rax
movq (%rax), %rcx
movq %rcx, 0x20(%rsp)
movl 0x14(%rax), %eax
movl %eax, 0x1c(%rsp)
leaq 0x59cda(%rip), %rax     # 0xd5870
movq (%rax), %rax
cmpl $0x0, 0x10(%rax)
jle 0x7bbb5
xorl %ecx, %ecx
movl $0x0, (%rbp,%rcx,4)
incq %rcx
movslq 0x10(%rax), %rdx
cmpq %rdx, %rcx
jl 0x7bba1
movq %r13, %rdi
callq 0x2f33a
movl %eax, %ebx
cmpq $0x0, 0x20(%rsp)
je 0x7bc11
movb $0x1, %r12b
movq 0x20(%rsp), %r15
movq 0x18(%r15), %r14
testq %r14, %r14
je 0x7bbed
movq %r13, %rdi
movq %r14, %rsi
callq 0x7af32
testl %eax, %eax
je 0x7bc02
movq 0x48(%r14), %r14
jmp 0x7bbd3
movslq (%r15), %rax
incl (%rbp,%rax,4)
movq 0x30(%r15), %r15
xorl %r12d, %r12d
testq %r15, %r15
jne 0x7bbcf
jmp 0x7bc24
movq 0x30(%r15), %r15
testq %r15, %r15
jne 0x7bbcf
testb $0x1, %r12b
je 0x7bc24
incl 0x14(%rsp)
xorl %eax, %eax
cmpl 0x1c(%rsp), %ebx
setne %al
addl %eax, 0x18(%rsp)
jmp 0x7bc48
incl 0xc(%rsp)
leaq 0x59c41(%rip), %rax     # 0xd5870
movq (%rax), %rax
movl 0x10(%rax), %esi
movq %rbp, %rdi
callq 0x38002
xorl %ecx, %ecx
cmpl %eax, %ebx
setne %cl
addl %ecx, 0x10(%rsp)
movq 0x10(%r13), %r13
testq %r13, %r13
jne 0x7bb8f
movq %rbp, %rdi
callq 0x3a180
movq 0x28(%rsp), %rax
movl 0xc(%rsp), %ecx
movl %ecx, (%rax)
movq 0x30(%rsp), %rax
movl 0x14(%rsp), %ecx
movl %ecx, (%rax)
movq 0x38(%rsp), %rax
movl 0x10(%rsp), %ecx
movl %ecx, (%rax)
movq 0x40(%rsp), %rax
movl 0x18(%rsp), %ecx
movl %ecx, (%rax)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq