// File: /workspace/github_cpp_makefile_star2_O1/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, -0x34(%rbp)
movq %rcx, %r14
movq %rdx, -0x48(%rbp)
movq %rsi, %r13
movq %rdi, -0x40(%rbp)
callq 0x1355c
movq 0x8(%r14), %rax
subq (%r14), %rax
leaq 0xf(,%rax,2), %rax
andq $-0x10, %rax
movq %rsp, %rbx
subq %rax, %rbx
movq %rbx, %rsp
movq 0x8(%r14), %rax
cmpq (%r14), %rax
je 0x13720
movq -0x30(%rbp), %rax
addl $-0x5, %eax
movl %eax, -0x38(%rbp)
xorl %r15d, %r15d
cmpl $0x1, -0x38(%rbp)
ja 0x136a7
movl $0x80, %edi
callq 0x3200
movq %rax, %r12
movq (%r13), %rsi
movq %rax, %rdi
callq 0xea74
movq %r12, (%rbx,%r15,8)
jmp 0x13709
movl $0x170, %edi            # imm = 0x170
callq 0x3200
movq %rax, %r12
movq (%r13), %rsi
movq %rax, %rdi
movl $0x1, %edx
movl 0x10(%rbp), %ecx
callq 0xa058
movq %r12, (%rbx,%r15,8)
movq %r12, %rdi
movl -0x34(%rbp), %esi
callq 0x105be
leaq -0x85fc(%rip), %rax     # 0xb0e2
movq %rax, 0x160(%r12)
movq $0x0, 0x168(%r12)
movabsq $0x4552544152545845, %rax # imm = 0x4552544152545845
movq %rax, 0x5c(%r12)
movw $0x45, 0x64(%r12)
incq %r15
movq 0x8(%r14), %rax
subq (%r14), %rax
sarq $0x2, %rax
cmpq %r15, %rax
ja 0x13682
movq (%r14), %rax
cmpq %rax, 0x8(%r14)
je 0x13783
xorl %r15d, %r15d
leaq -0x60(%rbp), %r12
movq (%r13), %rsi
movl (%rax,%r15,4), %edx
movq %r12, %rdi
callq 0x7f8c
movq (%rbx,%r15,8), %rsi
movq -0x48(%rbp), %rdx
movq %r12, %rcx
movq -0x40(%rbp), %r8
movq -0x30(%rbp), %r9
callq 0x1384a
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x1376d
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x3210
incq %r15
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r15, %rcx
ja 0x13730
movq (%r14), %rax
cmpq %rax, 0x8(%r14)
movq -0x40(%rbp), %r13
je 0x137fc
movq -0x30(%rbp), %rcx
addl $-0x5, %ecx
movq %rcx, -0x30(%rbp)
xorl %r15d, %r15d
movq (%rbx,%r15,8), %r12
cmpq (%r13), %r12
je 0x137c2
cmpl $0x1, -0x30(%rbp)
ja 0x137cc
testq %r12, %r12
je 0x137e6
movq %r12, %rdi
callq 0xeb78
movl $0x80, %esi
jmp 0x137de
movl (%rax,%r15,4), %eax
movl %eax, 0x18(%r13)
jmp 0x137e6
testq %r12, %r12
je 0x137e6
movq %r12, %rdi
callq 0x10554
movl $0x58, %esi
movq %r12, %rdi
callq 0x3210
incq %r15
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r15, %rcx
ja 0x1379e
movq %r13, %rax
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 0x13820
movq %rax, %rbx
movl $0x80, %esi
movq %r12, %rdi
jmp 0x1383d
movq %rax, %rbx
jmp 0x13842
movq %rax, %rbx
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x13842
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x3210
movq %rbx, %rdi
callq 0x3320