// File: /workspace/github_cpp_makefile_star2_O3/0asa[P]TTree-source/Scorer.cpp
// Function: Scorer::getBestGroupScore(std::vector<unsigned int, std::allocator<unsigned int>>&, std::vector<unsigned int, std::allocator<unsigned int>>&, unsigned int, int, int)
ScoreInfo Scorer::getBestGroupScore(std::vector<unsigned int> &obj, std::vector<unsigned int> &group, unsigned int internalComplexity, int treeType, int kint) {
	Score score;
	ScoreInfo si;
	Learner *weak[group.size()];

	for (int g = 0 ; g < group.size() ; ++g) {
		if (treeType == RANDOMTTSTUMP || treeType == EXTRATTSTUMP)
			weak[g] = new GStump(db);
		else {
			weak[g] = new ClassicTree(db,1,kint);
			weak[g]->setMaxComplexity(internalComplexity);
			((ClassicTree*)weak[g])->setLearnFonction(EXTRATREE);
		}
	}
	

	for (int g = 0 ; g < group.size() ; ++g) {
		std::vector<unsigned int> attcand = ((BlockDB*)db)->getGroup(group[g]);
		getGroupScore(weak[g],obj,attcand,si,treeType);
	}
	
	for (int g = 0; g < group.size() ; ++g) {
		
		if (weak[g] != si.weak) {
			if (treeType == RANDOMTTSTUMP || treeType == EXTRATTSTUMP) {
				delete ((GStump*)weak[g]);
			} else {
				delete weak[g];
			}
		} else
			si.group = group[g];
	}
	//if (si.group != -1)
	//	fprintf(stderr,"si.group = %0.4d\tsi.Score = %0.6f\tsi.th = %0.6f\n",si.group,si.score,si.threshold);
	return si;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, -0x30(%rbp)
movl %r8d, -0x3c(%rbp)
movq %rcx, %r14
movq %rdx, -0x48(%rbp)
movq %rsi, %r13
movq %rdi, -0x38(%rbp)
callq 0x134e0
movq (%r14), %rdi
movq 0x8(%r14), %rcx
movq %rsp, %rbx
movq %rcx, %rdx
subq %rdi, %rdx
leaq 0xf(,%rdx,2), %rdx
andq $-0x10, %rdx
subq %rdx, %rbx
movq %rbx, %rsp
cmpq %rdi, %rcx
je 0x1369a
movq -0x30(%rbp), %rax
addl $-0x5, %eax
movl %eax, -0x40(%rbp)
xorl %r15d, %r15d
cmpl $0x1, -0x40(%rbp)
ja 0x1361b
movl $0x80, %edi
callq 0x3200
movq %rax, %r12
movq (%r13), %rsi
movq %rax, %rdi
callq 0xea84
movq %r12, (%rbx,%r15,8)
jmp 0x1367d
movl $0x170, %edi            # imm = 0x170
callq 0x3200
movq %rax, %r12
movq (%r13), %rsi
movq %rax, %rdi
movl $0x1, %edx
movl 0x10(%rbp), %ecx
callq 0xa068
movq %r12, (%rbx,%r15,8)
movq %r12, %rdi
movl -0x3c(%rbp), %esi
callq 0x10592
leaq -0x8566(%rip), %rax     # 0xb0ec
movq %rax, 0x160(%r12)
movq $0x0, 0x168(%r12)
movabsq $0x4552544152545845, %rax # imm = 0x4552544152545845
movq %rax, 0x5c(%r12)
movw $0x45, 0x64(%r12)
incq %r15
movq (%r14), %rdi
movq 0x8(%r14), %rcx
movq %rcx, %rdx
subq %rdi, %rdx
sarq $0x2, %rdx
cmpq %r15, %rdx
ja 0x135f6
cmpq %rdi, %rcx
movq -0x38(%rbp), %rax
je 0x1377b
xorl %r15d, %r15d
leaq -0x60(%rbp), %r12
movq (%r13), %rsi
movl (%rdi,%r15,4), %edx
movq %r12, %rdi
callq 0x7ff4
movq (%rbx,%r15,8), %rsi
movq -0x48(%rbp), %rdx
movq %r12, %rcx
movq -0x38(%rbp), %r8
movq -0x30(%rbp), %r9
callq 0x137c6
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x136eb
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x3210
incq %r15
movq (%r14), %rdi
movq 0x8(%r14), %rcx
movq %rcx, %rdx
subq %rdi, %rdx
sarq $0x2, %rdx
cmpq %r15, %rdx
ja 0x136ae
cmpq %rdi, %rcx
movq -0x38(%rbp), %rax
je 0x1377b
movq -0x30(%rbp), %rcx
addl $-0x5, %ecx
movq %rcx, -0x30(%rbp)
xorl %r15d, %r15d
movq (%rbx,%r15,8), %r12
cmpq (%rax), %r12
je 0x1373e
cmpl $0x1, -0x30(%rbp)
ja 0x13747
testq %r12, %r12
je 0x13737
movq %r12, %rdi
callq 0xeb72
movl $0x80, %esi
jmp 0x13759
movl (%rdi,%r15,4), %ecx
movl %ecx, 0x18(%rax)
jmp 0x13765
testq %r12, %r12
je 0x13754
movq %r12, %rdi
callq 0x10528
movl $0x58, %esi
movq %r12, %rdi
callq 0x3210
movq -0x38(%rbp), %rax
incq %r15
movq (%r14), %rdi
movq 0x8(%r14), %rcx
subq %rdi, %rcx
sarq $0x2, %rcx
cmpq %r15, %rcx
ja 0x1371b
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x170, %esi            # imm = 0x170
jmp 0x1379c
movq %rax, %rbx
movl $0x80, %esi
movq %r12, %rdi
jmp 0x137b9
movq %rax, %rbx
jmp 0x137be
movq %rax, %rbx
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x137be
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x3210
movq %rbx, %rdi
callq 0x3320