// File: /workspace/github_c_makefile_star2_O2/cbouilla[P]AES-attacks-finder/Search.c
// Function: GenerateSolver_manual
Solver GenerateSolver_manual(int T, Solver *B1, int N1, SysEqLin E, string_list_t *variable_names) // Search manuelle
{
	int i,N;
	Solver B,*B1_tmp,tmp;

	for (i = 0; i < N1; i++)
	{
		printf(" Solver %d (%d || %d || %d): ",i,B1[i]->temps,B1[i]->memoire,B1[i]->sortie);
		PrintVarSolver2(B1[i],variable_names);
	}
	do
	{
		printf("index of guessed solver : ");
		scanf(" %d",&i);
		getchar();
	} while (i<0 || i>=N1);
	//i=rand()%N1;
	N=N1-1;
	B=B1[i];
	B1[i]=B1[N];
	B1[N]=B;
	B=copySolver(B);
	B1_tmp=malloc(N*sizeof(Solver));
	for (i = 0; i < N; i++) B1_tmp[i]=copySolver(B1[i]);
	while (B->sortie<T && N>0)
	{
		for (i = 0; i < N; i++)
		{
			tmp=UnionSpeciale(B1_tmp[i],B,E);
			if (tmp->sortie>T || tmp->temps>T)
			{
				printf("Something wrong - 2204 - Search.c");
				getchar();
			}
			freeSolver(B1_tmp[i]);
			B1_tmp[i]=tmp;
		}
		N=ReduireSolvers(B1_tmp,N,E);
		TriFusion1(B1_tmp,N);
		if (B1_tmp[0]->sortie<=B->sortie)
		{
			freeSolver(B);
			tmp=B1_tmp[0];
			N--;
			B1_tmp[0]=B1_tmp[N];
			B=PropagateSolver2(tmp,E,B1,N1);
			freeSolver(tmp);
			for (i = 0; i < N; i++) freeSolver(B1_tmp[i]);
			N=0;
			int *test,Ntest;
			for (i = 0; i < N1; i++)
			{
				test=UnionListesTriees(B->var,B->Nvar,B1[i]->var,B1[i]->Nvar,&Ntest);
				free(test);
				if (Ntest>B->Nvar) B1_tmp[N++]=copySolver(B1[i]);
			}			
		}
		else
		{
			for (i = 0; i < N; i++)
			{
				printf(" Solver %d : ",i);
				PrintVarSolver2(B1_tmp[i]->fils1,variable_names);
			}
			do
			{
				printf("index of guessed solver : ? ");
				scanf(" %d",&i);
				getchar();
			} while (i<0 || i>=N);
			freeSolver(B);
			B=B1_tmp[i];
			N--;
			B1_tmp[i]=B1_tmp[N];
		}
	}
	if (B->Nvar<T || B->memoire>1 || B->temps>T)
	{
		printf("Something wrong - 2249 - Search.c : %d %d %d\n",B->memoire,B->temps,B->sortie);
		PrintVarSolver(B);
		getchar();
	}
	printf(" Solver built (%d || %d || %d): ",B->temps,B->memoire,B->sortie);
	PrintVarSolver2(B,variable_names);
	getchar();
	for (i = 0; i < N; i++) freeSolver(B1_tmp[i]);
	free(B1_tmp);
	return B;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, 0x10(%rsp)
movq %rcx, %r14
movl %edx, %r13d
movq %rsi, 0x8(%rsp)
movl %edi, %ebp
testl %edx, %edx
movl $0x0, %r12d
cmovgl %edx, %r12d
xorl %r15d, %r15d
movq 0x8(%rsp), %rbx
cmpq %r15, %r12
je 0x14f63
movq (%rbx,%r15,8), %rax
movl 0xc(%rax), %edx
movl 0x10(%rax), %ecx
movl 0x14(%rax), %r8d
leaq 0x15c5a(%rip), %rdi     # 0x2aba0
movl %r15d, %esi
xorl %eax, %eax
callq 0x2110
movq (%rbx,%r15,8), %rdi
movq 0x10(%rsp), %rsi
callq 0x6cc9
incq %r15
jmp 0x14f2c
leaq 0x4(%rsp), %rbx
movl %r12d, (%rbx)
leaq 0x15c4c(%rip), %r15     # 0x2abbe
leaq 0x15c23(%rip), %r12     # 0x2ab9c
movq %r15, %rdi
xorl %eax, %eax
callq 0x2110
movq %r12, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2220
callq 0x2170
movl 0x4(%rsp), %eax
testl %eax, %eax
sets %cl
cmpl %r13d, %eax
setge %dl
orb %cl, %dl
jne 0x14f79
leal -0x1(%r13), %r15d
movq 0x8(%rsp), %rdx
movq (%rdx,%rax,8), %rdi
movq %r13, 0x20(%rsp)
movslq %r13d, %r12
movq -0x8(%rdx,%r12,8), %rcx
movq %rcx, (%rdx,%rax,8)
movq %rdi, -0x8(%rdx,%r12,8)
callq 0x6846
movq %rax, %rbx
leaq -0x8(,%r12,8), %rdi
callq 0x21c0
movq %rax, %r13
xorl %eax, %eax
movl %eax, 0x4(%rsp)
cmpl %r15d, %eax
jge 0x151f0
cltq
movq 0x8(%rsp), %rcx
movq (%rcx,%rax,8), %rdi
callq 0x6846
movslq 0x4(%rsp), %rcx
movq %rax, (%r13,%rcx,8)
leal 0x1(%rcx), %eax
jmp 0x14fe5
testl %r15d, %r15d
jle 0x151fb
xorl %eax, %eax
movl %eax, 0x4(%rsp)
cmpl %r15d, %eax
jge 0x15076
cltq
movq (%r13,%rax,8), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x74ac
movq %rax, %r12
cmpl %ebp, 0x14(%rax)
jg 0x15046
cmpl %ebp, 0xc(%r12)
jle 0x15059
leaq 0x15b8c(%rip), %rdi     # 0x2abd9
xorl %eax, %eax
callq 0x2110
callq 0x2170
movslq 0x4(%rsp), %rax
movq (%r13,%rax,8), %rdi
callq 0x6852
movslq 0x4(%rsp), %rax
movq %r12, (%r13,%rax,8)
incl %eax
jmp 0x1501c
movq %r13, %rdi
movl %r15d, %esi
movq %r14, %rdx
callq 0x7717
movl %eax, %r15d
movq %r13, %rdi
movl %eax, %esi
callq 0x6f82
movq (%r13), %rax
movl 0x14(%rax), %eax
movslq %r15d, %r12
cmpl 0x14(%rbx), %eax
jle 0x15134
xorl %esi, %esi
movl %esi, 0x4(%rsp)
cmpl %r15d, %esi
jge 0x150dd
leaq 0x15b45(%rip), %rdi     # 0x2abfb
xorl %eax, %eax
callq 0x2110
movslq 0x4(%rsp), %rax
movq (%r13,%rax,8), %rax
movq 0x20(%rax), %rdi
movq 0x10(%rsp), %rsi
callq 0x6cc9
movl 0x4(%rsp), %esi
incl %esi
jmp 0x150a6
leaq 0x15b25(%rip), %rdi     # 0x2ac09
xorl %eax, %eax
callq 0x2110
leaq 0x15aaa(%rip), %rdi     # 0x2ab9c
leaq 0x4(%rsp), %rsi
xorl %eax, %eax
callq 0x2220
callq 0x2170
movl 0x4(%rsp), %eax
testl %eax, %eax
js 0x150dd
cmpl %r15d, %eax
jge 0x150dd
movq %rbx, %rdi
callq 0x6852
movslq 0x4(%rsp), %rax
movq (%r13,%rax,8), %rbx
decl %r15d
movq -0x8(%r13,%r12,8), %rcx
movq %rcx, (%r13,%rax,8)
jmp 0x151f0
movq %rbx, %rdi
callq 0x6852
movq (%r13), %r15
movq %r12, %rax
decl %r12d
movq -0x8(%r13,%rax,8), %rax
movq %rax, (%r13)
movq %r15, %rdi
movq %r14, %rsi
movq 0x8(%rsp), %rdx
movq 0x20(%rsp), %rcx
callq 0x788d
movq %rax, %rbx
movq %r15, %rdi
callq 0x6852
xorl %eax, %eax
movl %eax, 0x4(%rsp)
cmpl %r12d, %eax
jge 0x1518e
cltq
movq (%r13,%rax,8), %rdi
callq 0x6852
movl 0x4(%rsp), %eax
incl %eax
jmp 0x15171
xorl %eax, %eax
xorl %r15d, %r15d
movq 0x8(%rsp), %r12
movl %eax, 0x4(%rsp)
cmpl 0x20(%rsp), %eax
jge 0x151f0
movq (%rbx), %rdi
movl 0x8(%rbx), %esi
cltq
movq (%r12,%rax,8), %rax
movq (%rax), %rdx
movl 0x8(%rax), %ecx
leaq 0x1c(%rsp), %r8
callq 0x2440
movq %rax, %rdi
callq 0x2030
movl 0x1c(%rsp), %eax
cmpl 0x8(%rbx), %eax
jle 0x151e8
movslq 0x4(%rsp), %rax
movq (%r12,%rax,8), %rdi
callq 0x6846
movslq %r15d, %rcx
incl %r15d
movq %rax, (%r13,%rcx,8)
movl 0x4(%rsp), %eax
incl %eax
jmp 0x15193
movl 0x14(%rbx), %ecx
cmpl %ebp, %ecx
jl 0x15011
movl 0x10(%rbx), %edx
cmpl %ebp, 0x8(%rbx)
setl %al
cmpl $0x2, %edx
setge %sil
orb %al, %sil
jne 0x15217
movl 0xc(%rbx), %esi
cmpl %ebp, %esi
jle 0x15242
movl 0xc(%rbx), %eax
leaq 0x15a05(%rip), %rdi     # 0x2ac26
movl %edx, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0x2110
movq %rbx, %rdi
callq 0x6c8b
callq 0x2170
movl 0xc(%rbx), %esi
movl 0x10(%rbx), %edx
movl 0x14(%rbx), %ecx
leaq 0x15a0b(%rip), %rdi     # 0x2ac54
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x2110
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
callq 0x6cc9
callq 0x2170
movl %ebp, 0x4(%rsp)
cmpl %r15d, %ebp
jge 0x15282
movslq %ebp, %rax
movq (%r13,%rax,8), %rdi
callq 0x6852
movl 0x4(%rsp), %ebp
incl %ebp
jmp 0x15264
movq %r13, %rdi
callq 0x2030
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq