// File: /workspace/github_c_makefile_star2_O1/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), %r15d
movq %rcx, 0x38(%rsp)
movl (%rcx), %eax
movl %eax, 0x10(%rsp)
movq %r8, 0x40(%rsp)
movl (%r8), %r14d
leaq 0x58619(%rip), %r12     # 0xd2870
movq (%r12), %rax
movslq 0x10(%rax), %rdi
shlq $0x2, %rdi
leaq 0x32a61(%rip), %rsi     # 0xacccb
movl $0x4, %edx
callq 0x390f5
movq %rax, %rbp
testq %r13, %r13
je 0x7a361
leaq 0x80(%rsp), %rax
movq (%rax), %rcx
movq %rcx, 0x20(%rsp)
movl 0x14(%rax), %eax
movl %eax, 0x14(%rsp)
movq (%r12), %rax
cmpl $0x0, 0x10(%rax)
jle 0x7a2b7
xorl %ecx, %ecx
movl $0x0, (%rbp,%rcx,4)
incq %rcx
movslq 0x10(%rax), %rdx
cmpq %rdx, %rcx
jl 0x7a2a3
movq %r13, %rdi
callq 0x2eaca
movl %eax, %ebx
cmpq $0x0, 0x20(%rsp)
je 0x7a345
movl %r15d, 0x18(%rsp)
movl %r14d, 0x1c(%rsp)
xorl %r12d, %r12d
movq 0x20(%rsp), %r15
movq 0x18(%r15), %r14
testq %r14, %r14
je 0x7a2f9
movq %r13, %rdi
movq %r14, %rsi
callq 0x795f2
testl %eax, %eax
je 0x7a306
movq 0x48(%r14), %r14
jmp 0x7a2df
movslq (%r15), %rax
incl (%rbp,%rax,4)
movl $0x1, %r12d
movq 0x30(%r15), %r15
testq %r15, %r15
jne 0x7a2db
testl %r12d, %r12d
movl 0x1c(%rsp), %r14d
movl 0x18(%rsp), %r15d
leaq 0x5854d(%rip), %r12     # 0xd2870
je 0x7a345
incl 0xc(%rsp)
movq (%r12), %rax
movl 0x10(%rax), %esi
movq %rbp, %rdi
callq 0x37504
xorl %ecx, %ecx
cmpl %eax, %ebx
setne %cl
addl %ecx, 0x10(%rsp)
jmp 0x7a354
incl %r15d
xorl %eax, %eax
cmpl 0x14(%rsp), %ebx
setne %al
addl %eax, %r14d
movq 0x10(%r13), %r13
testq %r13, %r13
jne 0x7a297
movq %rbp, %rdi
callq 0x39194
movq 0x28(%rsp), %rax
movl 0xc(%rsp), %ecx
movl %ecx, (%rax)
movq 0x30(%rsp), %rax
movl %r15d, (%rax)
movq 0x38(%rsp), %rax
movl 0x10(%rsp), %ecx
movl %ecx, (%rax)
movq 0x40(%rsp), %rax
movl %r14d, (%rax)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq