// File: 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
subq $0xe0, %rsp
movq %rdi, -0x80(%rbp)
movq %rdi, %rax
movq %rax, -0x90(%rbp)
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl %r9d, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq -0x2c(%rbp), %rdi
callq 0xcdf0
movq -0x80(%rbp), %rdi
movb $0x0, -0x2d(%rbp)
callq 0x26ba0
jmp 0x26e77
movq -0x20(%rbp), %rdi
callq 0x8bf0
movq %rax, %rcx
movq %rcx, %rax
movq %rsp, %rdx
movq %rdx, -0x48(%rbp)
leaq 0xf(,%rcx,8), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x98(%rbp)
movq %rcx, %rsp
movq %rax, -0x50(%rbp)
movl $0x0, -0x54(%rbp)
movslq -0x54(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x20(%rbp), %rdi
callq 0x8bf0
movq %rax, %rcx
movq -0xa0(%rbp), %rax
cmpq %rcx, %rax
jae 0x2701f
cmpl $0x5, -0x28(%rbp)
je 0x26eeb
cmpl $0x6, -0x28(%rbp)
jne 0x26f75
movl $0x80, %edi
callq 0x3270
movq %rax, -0xa8(%rbp)
jmp 0x26efe
movq -0xa8(%rbp), %rdi
movq -0x88(%rbp), %rax
movq (%rax), %rsi
callq 0x1c590
jmp 0x26f16
movq -0x98(%rbp), %rax
movq -0xa8(%rbp), %rdx
movslq -0x54(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x2700f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x2720c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x27203
movq -0xa8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x80, %esi
callq 0x3280
jmp 0x27203
movl $0x170, %edi            # imm = 0x170
callq 0x3270
movq %rax, -0xb0(%rbp)
jmp 0x26f88
movq -0xb0(%rbp), %rdi
movq -0x88(%rbp), %rax
movq (%rax), %rsi
movl 0x10(%rbp), %ecx
movl $0x1, %edx
callq 0x132d0
jmp 0x26fa8
movq -0x98(%rbp), %rax
movq -0xb0(%rbp), %rdx
movslq -0x54(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movslq -0x54(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movl -0x24(%rbp), %esi
callq 0x20540
jmp 0x26fd0
movq -0x98(%rbp), %rax
movslq -0x54(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movl $0x3, %esi
callq 0x167d0
jmp 0x26feb
jmp 0x2700f
movq -0xb0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x170, %esi            # imm = 0x170
callq 0x3280
jmp 0x27203
jmp 0x27011
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x26eb4
movl $0x0, -0x58(%rbp)
movslq -0x58(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x20(%rbp), %rdi
callq 0x8bf0
movq %rax, %rcx
movq -0xb8(%rbp), %rax
cmpq %rcx, %rax
jae 0x270dd
movq -0x88(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xc0(%rbp)
movq -0x20(%rbp), %rdi
movslq -0x58(%rbp), %rsi
callq 0xcd80
movq -0xc0(%rbp), %rsi
movl (%rax), %edx
leaq -0x70(%rbp), %rdi
callq 0xf0e0
jmp 0x2707f
movq -0x80(%rbp), %r8
movq -0x88(%rbp), %rdi
movq -0x98(%rbp), %rax
movslq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movq -0x18(%rbp), %rdx
movl -0x28(%rbp), %r9d
leaq -0x70(%rbp), %rcx
callq 0x27220
jmp 0x270ac
leaq -0x70(%rbp), %rdi
callq 0x6830
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x27026
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x6830
jmp 0x27203
movl $0x0, -0x74(%rbp)
movslq -0x74(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x20(%rbp), %rdi
callq 0x8bf0
movq %rax, %rcx
movq -0xc8(%rbp), %rax
cmpq %rcx, %rax
jae 0x271d4
movq -0x80(%rbp), %rcx
movq -0x98(%rbp), %rax
movslq -0x74(%rbp), %rdx
movq (%rax,%rdx,8), %rax
cmpq (%rcx), %rax
je 0x271ab
cmpl $0x5, -0x28(%rbp)
je 0x27133
cmpl $0x6, -0x28(%rbp)
jne 0x2716e
movq -0x98(%rbp), %rax
movslq -0x74(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xd0(%rbp)
cmpq $0x0, %rax
je 0x2716c
movq -0xd0(%rbp), %rdi
callq 0x1c6f0
movq -0xd0(%rbp), %rdi
movl $0x80, %esi
callq 0x3280
jmp 0x271a9
movq -0x98(%rbp), %rax
movslq -0x74(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xd8(%rbp)
cmpq $0x0, %rax
je 0x271a7
movq -0xd8(%rbp), %rdi
callq 0x20460
movq -0xd8(%rbp), %rdi
movl $0x58, %esi
callq 0x3280
jmp 0x271a9
jmp 0x271c4
movq -0x20(%rbp), %rdi
movslq -0x74(%rbp), %rsi
callq 0xcd80
movq %rax, %rcx
movq -0x80(%rbp), %rax
movl (%rcx), %ecx
movl %ecx, 0x18(%rax)
jmp 0x271c6
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x270e4
movb $0x1, -0x2d(%rbp)
movq -0x48(%rbp), %rax
movq %rax, %rsp
testb $0x1, -0x2d(%rbp)
jne 0x271ee
movq -0x80(%rbp), %rdi
callq 0x12640
leaq -0x2c(%rbp), %rdi
callq 0xd410
movq -0x90(%rbp), %rax
movq %rbp, %rsp
popq %rbp
retq
movq -0x80(%rbp), %rdi
callq 0x12640
leaq -0x2c(%rbp), %rdi
callq 0xd410
movq -0x38(%rbp), %rdi
callq 0x33e0
nop