// File: /workspace/github_cpp_makefile_star2_O2/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 $0x48, %rsp
movl %r9d, %r14d
movl %r8d, -0x3c(%rbp)
movq %rcx, %rbx
movq %rdx, -0x48(%rbp)
movq %rsi, %r13
movq %rdi, -0x38(%rbp)
callq 0x105b4
movq (%rbx), %rdi
movq 0x8(%rbx), %rcx
movq %rcx, %rdx
subq %rdi, %rdx
movq %rsp, %r15
leaq 0xf(,%rdx,2), %rdx
andq $-0x10, %rdx
subq %rdx, %r15
movq %r15, %rsp
movq %r14, -0x50(%rbp)
leal -0x5(%r14), %eax
movl %eax, -0x2c(%rbp)
xorl %r14d, %r14d
movq %rcx, %rdx
subq %rdi, %rdx
sarq $0x2, %rdx
cmpq %r14, %rdx
jbe 0x1078d
cmpl $0x1, -0x2c(%rbp)
ja 0x10721
movl $0x80, %edi
callq 0x3200
movq %rax, %r12
movq (%r13), %rsi
movq %rax, %rdi
callq 0xc7cc
movq %r12, (%r15,%r14,8)
jmp 0x1077e
movl $0x170, %edi            # imm = 0x170
callq 0x3200
movq %rax, %r12
movq (%r13), %rsi
movq %rax, %rdi
pushq $0x1
popq %rdx
movl 0x10(%rbp), %ecx
callq 0x8c40
movq %r12, (%r15,%r14,8)
movq %r12, %rdi
movl -0x3c(%rbp), %esi
callq 0xdec6
leaq -0x6e10(%rip), %rax     # 0x9946
movq %rax, 0x160(%r12)
andq $0x0, 0x168(%r12)
movabsq $0x4552544152545845, %rax # imm = 0x4552544152545845
movq %rax, 0x5c(%r12)
movw $0x45, 0x64(%r12)
incq %r14
movq (%rbx), %rdi
movq 0x8(%rbx), %rcx
jmp 0x106e9
xorl %r14d, %r14d
leaq -0x68(%rbp), %r12
movq %rcx, %rdx
subq %rdi, %rdx
sarq $0x2, %rdx
cmpq %r14, %rdx
jbe 0x107df
movq (%r13), %rsi
movl (%rdi,%r14,4), %edx
movq %r12, %rdi
callq 0x7206
movq (%r15,%r14,8), %rsi
movq -0x48(%rbp), %rdx
movq %r12, %rcx
movq -0x38(%rbp), %r8
movq -0x50(%rbp), %r9
callq 0x10892
movq %r12, %rdi
callq 0x6886
incq %r14
movq (%rbx), %rdi
movq 0x8(%rbx), %rcx
jmp 0x10794
xorl %r14d, %r14d
pushq $0x58
popq %r13
movq -0x38(%rbp), %rax
subq %rdi, %rcx
sarq $0x2, %rcx
cmpq %r14, %rcx
jbe 0x1084d
movq (%r15,%r14,8), %r12
cmpq (%rax), %r12
je 0x1081c
cmpl $0x1, -0x2c(%rbp)
ja 0x10825
testq %r12, %r12
je 0x10812
movq %r12, %rdi
callq 0xc888
movl $0x80, %esi
movq %r12, %rdi
jmp 0x10838
movl (%rdi,%r14,4), %ecx
movl %ecx, 0x18(%rax)
jmp 0x10841
testq %r12, %r12
je 0x10832
movq %r12, %rdi
callq 0xde70
movq %r12, %rdi
movq %r13, %rsi
callq 0x3210
movq -0x38(%rbp), %rax
incq %r14
movq (%rbx), %rdi
movq 0x8(%rbx), %rcx
jmp 0x107ea
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 0x1086e
movq %rax, %rbx
movl $0x80, %esi
movq %r12, %rdi
callq 0x3210
jmp 0x10889
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0x6886
jmp 0x10889
movq %rax, %rbx
movq %rbx, %rdi
callq 0x3330
nop