// File: /workspace/github_cpp_makefile_star2_O3/aleperno[P]Datos/HashingPerceptron.cpp
// Function: HashingPerceptron::rate[abi:cxx11](char*)
vector<pair<string,float>> HashingPerceptron::rate(char* testPath)
{
	printf("Began to test the test set dataset\n");
	printf("\nIteration \t Errors \t Average \t Time \n");
	//Instancio el parser
	Parser* parser = new Parser();
	vector<pair<string,float>> aux_vec;
	ifstream testfile;
	testfile.open(testPath);
	//Elementos para informacion adicional
	int error_count = 0;
	int rev_counter = 0;
	clock_t inicio = clock();
	if(testfile.is_open())
	{
		string linea;
		while( getline(testfile,linea) )
		{
			rev_counter++;
			vector<string> tokenized_columns = parser->tokenizeColumns(linea);
			vector<string> tokenized_words = parser->tokenizeReviews(tokenized_columns[1]);

			string doc_id = tokenized_columns[0];

			vector<unsigned int> vec_review = this->getVector(tokenized_words);

			float score = this->dot_product(vec_review);
			score = this->sigmoid(score);

			//Supongo que todos los reviews son positivos
			if (score <= this->threshold) error_count++;

			pair<string,float> par_aux;
			par_aux = make_pair(doc_id,score);
			aux_vec.push_back(par_aux);	
		}
	}
	double final = clock();
	double secs = double(final - inicio) / CLOCKS_PER_SEC;
	float min = floor(secs/60);
	float sec = secs - min*60;
	printf("%d\t\t%d\t\t%0.5f\t\t%.0f:%.3f\n",1,error_count, 1.0 - (double)error_count/rev_counter,min,sec);
	fflush(stdout);
	delete parser;
	//vector<unsigned int> aux_vec = this->getVector(review);
	//float result = this->dot_product(aux_vec);
	//return this->sigmoid(result);
	return aux_vec;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x388, %rsp            # imm = 0x388
movq %rdx, %rbx
movq %rsi, -0x40(%rbp)
movq %rdi, %r12
leaq 0x290b(%rip), %rdi      # 0xa336
callq 0x3350
leaq 0x2922(%rip), %rdi      # 0xa359
callq 0x3350
movl $0x60, %edi
callq 0x3230
movq %rax, -0x50(%rbp)
movq %rax, %rdi
callq 0x3e80
xorpd %xmm0, %xmm0
movupd %xmm0, (%r12)
movq $0x0, 0x10(%r12)
leaq -0x3a8(%rbp), %rdi
callq 0x3280
leaq -0x3a8(%rbp), %rdi
movq %rbx, %rsi
movl $0x8, %edx
callq 0x3170
callq 0x3180
movq %rax, %rbx
leaq -0x330(%rbp), %rdi
callq 0x30c0
testb %al, %al
je 0x7da0
movq %rbx, -0xc0(%rbp)
movq %r12, -0x30(%rbp)
leaq -0xa8(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq $0x0, -0x48(%rbp)
leaq -0x188(%rbp), %r12
leaq -0x158(%rbp), %r15
xorl %r13d, %r13d
movq -0x3a8(%rbp), %rax
movq -0x18(%rax), %rdi
leaq -0x3a8(%rbp), %rbx
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3220
movsbl %al, %edx
movq %rbx, %rdi
leaq -0xb8(%rbp), %rsi
callq 0x3410
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
leaq -0x130(%rbp), %r14
jne 0x7dae
leaq -0x120(%rbp), %rbx
movq %rbx, -0x130(%rbp)
movq -0xb8(%rbp), %rsi
movq -0xb0(%rbp), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x3cbe
leaq -0xd8(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq %r14, %rdx
callq 0x4032
movq -0x130(%rbp), %rdi
cmpq %rbx, %rdi
je 0x7b70
callq 0x3210
movq -0xd8(%rbp), %rax
leaq -0x100(%rbp), %rbx
movq %rbx, -0x110(%rbp)
movq 0x20(%rax), %rsi
movq 0x28(%rax), %rdx
addq %rsi, %rdx
leaq -0x110(%rbp), %r14
movq %r14, %rdi
callq 0x3cbe
leaq -0xf0(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq %r14, %rdx
callq 0x41aa
movq -0x110(%rbp), %rdi
cmpq %rbx, %rdi
je 0x7bc3
callq 0x3210
movq -0xd8(%rbp), %rax
leaq -0x88(%rbp), %rcx
movq %rcx, -0x98(%rbp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x98(%rbp), %rdi
callq 0x3cbe
leaq -0x148(%rbp), %rbx
leaq -0x1a0(%rbp), %r14
movq %r14, %rdi
leaq -0xf0(%rbp), %rsi
callq 0x8014
movq %r12, %rdi
movq -0x40(%rbp), %rsi
movq %r14, %rdx
callq 0x7366
movq %r14, %rdi
callq 0x4b12
leaq -0x170(%rbp), %rdi
movq %r12, %rsi
callq 0x826c
movq -0x170(%rbp), %rdi
movq -0x168(%rbp), %rcx
movq %rcx, %rax
subq %rdi, %rax
je 0x7c6d
sarq $0x2, %rax
movq -0x40(%rbp), %rcx
movq 0x38(%rcx), %rcx
xorpd %xmm0, %xmm0
xorl %edx, %edx
movl (%rdi,%rdx,4), %esi
addss (%rcx,%rsi,4), %xmm0
incq %rdx
movl %edx, %esi
cmpq %rsi, %rax
ja 0x7c59
jmp 0x7c76
xorpd %xmm0, %xmm0
testq %rcx, %rcx
je 0x7c85
movss %xmm0, -0x34(%rbp)
callq 0x3210
movss -0x34(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
mulsd 0x2507(%rip), %xmm0     # 0xa198
callq 0x33f0
movsd 0x24f2(%rip), %xmm1     # 0xa190
addsd %xmm1, %xmm0
divsd %xmm0, %xmm1
cvtsd2ss %xmm1, %xmm1
movq -0x40(%rbp), %rax
movss 0x54(%rax), %xmm0
movss %xmm1, -0x34(%rbp)
ucomiss %xmm1, %xmm0
sbbl $-0x1, %r13d
leaq -0x68(%rbp), %rax
movq %rax, -0x78(%rbp)
movq $0x0, -0x70(%rbp)
movb $0x0, -0x68(%rbp)
movl $0x0, -0x58(%rbp)
movq %rbx, -0x158(%rbp)
movq -0x98(%rbp), %rsi
movq -0x90(%rbp), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x3cbe
movss -0x34(%rbp), %xmm0
movss %xmm0, -0x138(%rbp)
leaq -0x78(%rbp), %rdi
movq %r15, %rsi
callq 0x32b0
movss -0x138(%rbp), %xmm0
movss %xmm0, -0x58(%rbp)
movq -0x158(%rbp), %rdi
cmpq %rbx, %rdi
je 0x7d31
callq 0x3210
movq -0x30(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x83d2
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x7d50
callq 0x3210
movq -0x188(%rbp), %rdi
testq %rdi, %rdi
je 0x7d61
callq 0x3210
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x7d79
callq 0x3210
movq -0x48(%rbp), %rax
incl %eax
movq %rax, -0x48(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x4b12
leaq -0xd8(%rbp), %rdi
callq 0x4b12
jmp 0x7adb
xorl %r13d, %r13d
xorpd %xmm0, %xmm0
movsd %xmm0, -0x40(%rbp)
jmp 0x7dde
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
cmpq %rax, %rdi
je 0x7dc6
callq 0x3210
xorps %xmm0, %xmm0
cvtsi2sdl -0x48(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movq -0x30(%rbp), %r12
movq -0xc0(%rbp), %rbx
callq 0x3180
cvtsi2sd %rax, %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %rbx, %xmm0
subsd %xmm0, %xmm1
divsd 0x2384(%rip), %xmm1     # 0xa180
movsd %xmm1, -0x48(%rbp)
movapd %xmm1, %xmm0
divsd 0x237b(%rip), %xmm0     # 0xa188
callq 0x33b0
cvtsd2ss %xmm0, %xmm0
xorps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm1
mulss 0x237b(%rip), %xmm0     # 0xa1a0
cvtss2sd %xmm0, %xmm0
addsd -0x48(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm2
cvtsi2sd %r13d, %xmm3
divsd -0x40(%rbp), %xmm3
movsd 0x234c(%rip), %xmm0     # 0xa190
subsd %xmm3, %xmm0
cvtss2sd %xmm2, %xmm2
leaq 0x23c5(%rip), %rdi      # 0xa218
movl $0x1, %esi
movl %r13d, %edx
movb $0x3, %al
callq 0x3060
movq 0x614f(%rip), %rax      # 0xdfb8
movq (%rax), %rdi
callq 0x32a0
movq -0x50(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
leaq -0x3a8(%rbp), %rdi
callq 0x30d0
movq %r12, %rax
addq $0x388, %rsp            # imm = 0x388
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x7f8f
movq %rax, %rbx
jmp 0x7f9b
movq %rax, %rbx
movq -0x50(%rbp), %rdi
callq 0x3210
jmp 0x7fa3
jmp 0x7ebf
movq %rax, %rbx
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x7f15
callq 0x3210
jmp 0x7f15
movq %rax, %rbx
jmp 0x7f56
movq %rbx, %rcx
movq %rax, %rbx
movq -0x110(%rbp), %rdi
cmpq %rcx, %rdi
je 0x7f62
callq 0x3210
jmp 0x7f62
movq %rax, %rbx
jmp 0x7f62
movq %rbx, %rcx
movq %rax, %rbx
movq -0x130(%rbp), %rdi
cmpq %rcx, %rdi
je 0x7f73
callq 0x3210
jmp 0x7f73
movq %rax, %rbx
movq -0x188(%rbp), %rdi
testq %rdi, %rdi
je 0x7f3e
callq 0x3210
jmp 0x7f3e
movq %rax, %rbx
leaq -0x1a0(%rbp), %rdi
callq 0x4b12
jmp 0x7f3e
jmp 0x7f70
movq %rax, %rbx
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x7f56
callq 0x3210
leaq -0xf0(%rbp), %rdi
callq 0x4b12
leaq -0xd8(%rbp), %rdi
callq 0x4b12
jmp 0x7f73
movq %rax, %rbx
movq -0x30(%rbp), %r12
leaq -0xa8(%rbp), %rax
movq -0xb8(%rbp), %rdi
cmpq %rax, %rdi
je 0x7f8f
callq 0x3210
leaq -0x3a8(%rbp), %rdi
callq 0x30d0
movq %r12, %rdi
callq 0x3c66
movq %rbx, %rdi
callq 0x33e0
nop