// File: /workspace/github_c_makefile_star2_O0/cbouilla[P]AES-attacks-finder/Search.c
// Function: ManualSearch
Solver ManualSearch(int T, Solver *B1, int N1, SysEqLin E, string_list_t *variable_names)
{
	int Alloue,N,i,N2,v_max;
	Solver *Candidat,tmp,tmp2;
	char c;
	Alloue=1000;
	Candidat=malloc(Alloue*sizeof(Solver));
	N=0;
	N2=N1/2;
	v_max=0;
	c='y';
	printf("Manual Search : \n");
	while (N<Alloue)
	{
		if (c=='y')
		{
			tmp=GenerateSolver_manual(T,B1,N1,E,variable_names);
			printf("Choose the next solver ? (y/n) :");
			scanf(" %c",&c);
			getchar();
		}
		else tmp=GenerateSolver(T,B1,N1,E);
		i=0;
		while (i < N)
		{
			tmp2=UnionSolver(Candidat[i],tmp,E);
			if (c=='o')
			{
				printf("Join (%d || %d || %d): ",tmp2->temps,tmp2->memoire,tmp2->sortie);
				PrintVarSolver2(tmp2,variable_names);
			}
			if (tmp2->temps<=T)
			{
				if (PlusInteressant2(Candidat[i],tmp2))
				{
					freeSolver(tmp2);
					break;
				}
				if (PlusInteressant2(tmp,tmp2))
				{
					N--;
					freeSolver(Candidat[i]);
					Candidat[i]=Candidat[N];
					freeSolver(tmp2);
				}
				else
				{
					printf("Two solvers were merged");
					printf("Join (%d || %d || %d): ",tmp2->temps,tmp2->memoire,tmp2->sortie);
					PrintVarSolver2(tmp2,variable_names);
					getchar();
					N--;
					freeSolver(Candidat[i]);
					Candidat[i]=Candidat[N];
					freeSolver(tmp);
					tmp=PropagateSolver2(tmp2,E,B1,N1);
					freeSolver(tmp2);
					i=0;
				}
			}
			else
			{
				freeSolver(tmp2);
				i++;
			}
		}
		if (i==N)
		{
			Candidat[N++]=tmp;
			v_max=max(v_max,tmp->Nvar);
			printf("Candidat %d (%d || %d || %d): ",i,tmp->temps,tmp->memoire,tmp->sortie);
			PrintVarSolver2(tmp,variable_names);
			if (N==Alloue)
			{
				i=0;
				while (i<N)
				{
					if (Candidat[i]->Nvar<=(T+v_max)/2)
					{
						freeSolver(Candidat[i]);
						N--;
						Candidat[i]=Candidat[N];
					}
					else i++;
				}
				if (N==Alloue)
				{
					Alloue=2*Alloue;
					Candidat=realloc(Candidat,Alloue*sizeof(Solver));
				}
			}		
		}
		else freeSolver(tmp);
		if (N==1 && Candidat[0]->Nvar==E->a/E->gen)
		{
			tmp=Candidat[0];
			free(Candidat);
			printf("Solution %d || %d : ",tmp->temps,tmp->memoire);
			PrintVarSolver(tmp);
			return tmp;
		}
	}
	for (i = 0; i < N; i++) freeSolver(Candidat[i]);
	free(Candidat);
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movl %edi, -0xc(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movl $0x3e8, -0x34(%rbp)     # imm = 0x3E8
movslq -0x34(%rbp), %rdi
shlq $0x3, %rdi
callq 0x21c0
movq %rax, -0x50(%rbp)
movl $0x0, -0x38(%rbp)
movl -0x1c(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
movb $0x79, -0x61(%rbp)
leaq 0x16601(%rip), %rdi     # 0x38eba
movb $0x0, %al
callq 0x2100
movl -0x38(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x22cd2
movsbl -0x61(%rbp), %eax
cmpl $0x79, %eax
jne 0x22917
movl -0xc(%rbp), %edi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %r8
callq 0x21c60
movq %rax, -0x58(%rbp)
leaq 0x165d5(%rip), %rdi     # 0x38ecc
movb $0x0, %al
callq 0x2100
leaq 0x1309d(%rip), %rdi     # 0x359a2
leaq -0x61(%rbp), %rsi
movb $0x0, %al
callq 0x2220
callq 0x2170
jmp 0x2292e
movl -0xc(%rbp), %edi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
movq -0x28(%rbp), %rcx
callq 0x21ae0
movq %rax, -0x58(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x38(%rbp), %eax
jge 0x22b2c
movq -0x50(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x58(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0xaa60
movq %rax, -0x60(%rbp)
movsbl -0x61(%rbp), %eax
cmpl $0x6f, %eax
jne 0x22997
movq -0x60(%rbp), %rax
movl 0xc(%rax), %esi
movq -0x60(%rbp), %rax
movl 0x10(%rax), %edx
movq -0x60(%rbp), %rax
movl 0x14(%rax), %ecx
leaq 0x1656a(%rip), %rdi     # 0x38eed
movb $0x0, %al
callq 0x2100
movq -0x60(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x99d0
movq -0x60(%rbp), %rax
movl 0xc(%rax), %eax
cmpl -0xc(%rbp), %eax
jg 0x22b15
movq -0x50(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x8(%rax), %eax
movq -0x60(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jl 0x229fd
movq -0x50(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x14(%rax), %eax
movq -0x60(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jg 0x229fd
movq -0x50(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl 0xc(%rax), %eax
movq -0x60(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jg 0x229fd
movq -0x60(%rbp), %rdi
callq 0x93b0
jmp 0x22b2c
movq -0x58(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x60(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jl 0x22a6d
movq -0x58(%rbp), %rax
movl 0x14(%rax), %eax
movq -0x60(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jg 0x22a6d
movq -0x58(%rbp), %rax
movl 0xc(%rax), %eax
movq -0x60(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jg 0x22a6d
movl -0x38(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x38(%rbp)
movq -0x50(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x93b0
movq -0x50(%rbp), %rax
movslq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq -0x50(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x60(%rbp), %rdi
callq 0x93b0
jmp 0x22b13
leaq 0x16491(%rip), %rdi     # 0x38f05
movb $0x0, %al
callq 0x2100
movq -0x60(%rbp), %rax
movl 0xc(%rax), %esi
movq -0x60(%rbp), %rax
movl 0x10(%rax), %edx
movq -0x60(%rbp), %rax
movl 0x14(%rax), %ecx
leaq 0x16456(%rip), %rdi     # 0x38eed
movb $0x0, %al
callq 0x2100
movq -0x60(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x99d0
callq 0x2170
movl -0x38(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x38(%rbp)
movq -0x50(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x93b0
movq -0x50(%rbp), %rax
movslq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq -0x50(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x58(%rbp), %rdi
callq 0x93b0
movq -0x60(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x1c(%rbp), %ecx
callq 0xb580
movq %rax, -0x58(%rbp)
movq -0x60(%rbp), %rdi
callq 0x93b0
movl $0x0, -0x3c(%rbp)
jmp 0x22b27
movq -0x60(%rbp), %rdi
callq 0x93b0
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x22935
movl -0x3c(%rbp), %eax
cmpl -0x38(%rbp), %eax
jne 0x22c56
movq -0x58(%rbp), %rdx
movq -0x50(%rbp), %rax
movl -0x38(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x38(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x44(%rbp), %eax
movq -0x58(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jle 0x22b66
movl -0x44(%rbp), %eax
movl %eax, -0x68(%rbp)
jmp 0x22b70
movq -0x58(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x68(%rbp)
movl -0x68(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x3c(%rbp), %esi
movq -0x58(%rbp), %rax
movl 0xc(%rax), %edx
movq -0x58(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x58(%rbp), %rax
movl 0x14(%rax), %r8d
leaq 0x16387(%rip), %rdi     # 0x38f1d
movb $0x0, %al
callq 0x2100
movq -0x58(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x99d0
movl -0x38(%rbp), %eax
cmpl -0x34(%rbp), %eax
jne 0x22c54
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x38(%rbp), %eax
jge 0x22c2d
movq -0x50(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x8(%rax), %eax
movl %eax, -0x6c(%rbp)
movl -0xc(%rbp), %eax
addl -0x44(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x6c(%rbp), %eax
cmpl %ecx, %eax
jg 0x22c22
movq -0x50(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x93b0
movl -0x38(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x38(%rbp)
movq -0x50(%rbp), %rax
movslq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq -0x50(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x22c2b
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x22bbd
movl -0x38(%rbp), %eax
cmpl -0x34(%rbp), %eax
jne 0x22c52
movl -0x34(%rbp), %eax
shll %eax
movl %eax, -0x34(%rbp)
movq -0x50(%rbp), %rdi
movslq -0x34(%rbp), %rsi
shlq $0x3, %rsi
callq 0x21f0
movq %rax, -0x50(%rbp)
jmp 0x22c54
jmp 0x22c5f
movq -0x58(%rbp), %rdi
callq 0x93b0
cmpl $0x1, -0x38(%rbp)
jne 0x22ccd
movq -0x50(%rbp), %rax
movq (%rax), %rax
movl 0x8(%rax), %eax
movl %eax, -0x70(%rbp)
movq -0x28(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x28(%rbp), %rcx
cltd
idivl 0x10(%rcx)
movl %eax, %ecx
movl -0x70(%rbp), %eax
cmpl %ecx, %eax
jne 0x22ccd
movq -0x50(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rdi
callq 0x2030
movq -0x58(%rbp), %rax
movl 0xc(%rax), %esi
movq -0x58(%rbp), %rax
movl 0x10(%rax), %edx
leaq 0x16289(%rip), %rdi     # 0x38f3c
movb $0x0, %al
callq 0x2100
movq -0x58(%rbp), %rdi
callq 0x9970
movq -0x58(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x22d0e
jmp 0x228c0
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x38(%rbp), %eax
jge 0x22cfd
movq -0x50(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x93b0
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x22cd9
movq -0x50(%rbp), %rdi
callq 0x2030
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)