// File: /workspace/github_c_makefile_star2_O1/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 $0x38, %rsp
movq %r8, %r15
movq %rcx, %r12
movl %edx, %ebx
movq %rsi, %r13
movl %edi, %ebp
movl $0x0, 0x4(%rsp)
testl %edx, %edx
jle 0x169a1
leaq 0x1623d(%rip), %r14     # 0x2cba0
xorl %eax, %eax
movslq %eax, %rsi
movq (%r13,%rsi,8), %rax
movl 0xc(%rax), %edx
movl 0x10(%rax), %ecx
movl 0x14(%rax), %r8d
movq %r14, %rdi
xorl %eax, %eax
callq 0x2110
movslq 0x4(%rsp), %rax
movq (%r13,%rax,8), %rdi
movq %r15, %rsi
callq 0x74f1
movl 0x4(%rsp), %eax
incl %eax
movl %eax, 0x4(%rsp)
cmpl %ebx, %eax
jl 0x16965
movq %r13, 0x10(%rsp)
movq %r15, 0x20(%rsp)
leaq 0x1620c(%rip), %r14     # 0x2cbbe
leaq 0x161e3(%rip), %r13     # 0x2cb9c
leaq 0x4(%rsp), %r15
movq %r14, %rdi
xorl %eax, %eax
callq 0x2110
movq %r13, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x2230
callq 0x2180
movl 0x4(%rsp), %eax
testl %eax, %eax
sets %cl
cmpl %ebx, %eax
setge %dl
orb %cl, %dl
jne 0x169be
leal -0x1(%rbx), %r14d
movq 0x10(%rsp), %rdx
movq (%rdx,%rax,8), %rdi
movslq %ebx, %r15
movq -0x8(%rdx,%r15,8), %rcx
movq %rcx, (%rdx,%rax,8)
movq %rdi, -0x8(%rdx,%r15,8)
callq 0x7054
movq %rax, %r13
movq %rax, 0x8(%rsp)
leaq -0x8(,%r15,8), %rdi
callq 0x21d0
movq %rax, %r15
movl $0x0, 0x4(%rsp)
cmpl $0x2, %ebx
jl 0x16a5b
xorl %eax, %eax
cltq
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %rdi
callq 0x7054
movslq 0x4(%rsp), %rcx
movq %rax, (%r15,%rcx,8)
leal 0x1(%rcx), %eax
movl %eax, 0x4(%rsp)
cmpl %r14d, %eax
jl 0x16a36
movq 0x8(%rsp), %rdi
addq $0x14, %rdi
movl 0x14(%r13), %ecx
cmpl %ebp, %ecx
setge %al
cmpl $0x2, %ebx
setl %dl
orb %al, %dl
jne 0x16cad
movq %r12, 0x30(%rsp)
movq %rbx, 0x28(%rsp)
movq %rdi, 0x8(%rsp)
movl $0x0, 0x4(%rsp)
xorl %eax, %eax
cltq
movq (%r15,%rax,8), %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x7da7
movq %rax, %rbx
cmpl %ebp, 0x14(%rax)
jg 0x16ab2
cmpl %ebp, 0xc(%rbx)
jle 0x16ac5
leaq 0x16120(%rip), %rdi     # 0x2cbd9
xorl %eax, %eax
callq 0x2110
callq 0x2180
movslq 0x4(%rsp), %rax
movq (%r15,%rax,8), %rdi
callq 0x7060
movslq 0x4(%rsp), %rax
movq %rbx, (%r15,%rax,8)
incl %eax
movl %eax, 0x4(%rsp)
cmpl %r14d, %eax
jl 0x16a94
movq %r15, %rdi
movl %r14d, %esi
movq %r12, %rdx
callq 0x8006
movl %eax, %r14d
movq %r15, %rdi
movl %eax, %esi
callq 0x77f5
movq (%r15), %rax
movl 0x14(%rax), %eax
movslq %r14d, %rbx
movq 0x8(%rsp), %rcx
cmpl (%rcx), %eax
jle 0x16bc6
movq %rbx, 0x8(%rsp)
movl $0x0, 0x4(%rsp)
testl %r14d, %r14d
movq 0x20(%rsp), %rbx
leaq 0x160c7(%rip), %r12     # 0x2cbfb
jle 0x16b66
xorl %esi, %esi
movq %r12, %rdi
xorl %eax, %eax
callq 0x2110
movslq 0x4(%rsp), %rax
movq (%r15,%rax,8), %rax
movq 0x20(%rax), %rdi
movq %rbx, %rsi
callq 0x74f1
movl 0x4(%rsp), %esi
incl %esi
movl %esi, 0x4(%rsp)
cmpl %r14d, %esi
jl 0x16b38
leaq 0x1609c(%rip), %rbx     # 0x2cc09
leaq 0x16028(%rip), %r12     # 0x2cb9c
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2110
movq %r12, %rdi
leaq 0x4(%rsp), %rsi
xorl %eax, %eax
callq 0x2230
callq 0x2180
movl 0x4(%rsp), %eax
testl %eax, %eax
js 0x16b74
cmpl %r14d, %eax
jge 0x16b74
movq %r13, %rdi
callq 0x7060
movslq 0x4(%rsp), %rax
movq (%r15,%rax,8), %r13
decl %r14d
movq 0x8(%rsp), %rcx
movq -0x8(%r15,%rcx,8), %rcx
movq %rcx, (%r15,%rax,8)
jmp 0x16c93
movq %r13, %rdi
callq 0x7060
movq (%r15), %rdi
movq -0x8(%r15,%rbx,8), %rax
movq %rax, (%r15)
movq %rdi, %rbx
movq %r12, %rsi
movq 0x10(%rsp), %rdx
movq 0x28(%rsp), %rcx
callq 0x817d
movq %rax, %r13
movq %rbx, %rdi
callq 0x7060
movl $0x0, 0x4(%rsp)
cmpl $0x2, %r14d
jl 0x16c26
decl %r14d
xorl %eax, %eax
cltq
movq (%r15,%rax,8), %rdi
callq 0x7060
movl 0x4(%rsp), %eax
incl %eax
movl %eax, 0x4(%rsp)
cmpl %r14d, %eax
jl 0x16c0c
movl $0x0, 0x4(%rsp)
xorl %r14d, %r14d
xorl %eax, %eax
movq 0x28(%rsp), %rbx
movq (%r13), %rdi
movl 0x8(%r13), %esi
cltq
movq 0x10(%rsp), %r12
movq (%r12,%rax,8), %rax
movq (%rax), %rdx
movl 0x8(%rax), %ecx
leaq 0x1c(%rsp), %r8
callq 0x2544
movq %rax, %rdi
callq 0x2030
movl 0x1c(%rsp), %eax
cmpl 0x8(%r13), %eax
jle 0x16c85
movslq 0x4(%rsp), %rax
movq (%r12,%rax,8), %rdi
callq 0x7054
movslq %r14d, %rcx
incl %r14d
movq %rax, (%r15,%rcx,8)
movl 0x4(%rsp), %eax
incl %eax
movl %eax, 0x4(%rsp)
cmpl %ebx, %eax
jl 0x16c38
leaq 0x14(%r13), %rdi
movl 0x14(%r13), %ecx
cmpl %ebp, %ecx
jge 0x16cad
testl %r14d, %r14d
movq 0x30(%rsp), %r12
jg 0x16a85
cmpl %ebp, 0x8(%r13)
jl 0x16cc0
cmpl $0x1, 0x10(%r13)
jg 0x16cc0
cmpl %ebp, 0xc(%r13)
jle 0x16ce9
movl 0xc(%r13), %edx
movl 0x10(%r13), %esi
movq %rdi, %rbx
leaq 0x15f54(%rip), %rdi     # 0x2cc26
xorl %eax, %eax
callq 0x2110
movq %r13, %rdi
callq 0x74ad
callq 0x2180
movq %rbx, %rdi
movl 0xc(%r13), %esi
movl 0x10(%r13), %edx
movl (%rdi), %ecx
leaq 0x15f5a(%rip), %rdi     # 0x2cc54
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x2110
movq %r13, %rdi
movq 0x20(%rsp), %rsi
callq 0x74f1
callq 0x2180
movl $0x0, 0x4(%rsp)
testl %r14d, %r14d
jle 0x16d3d
movslq %ebx, %rax
movq (%r15,%rax,8), %rdi
callq 0x7060
movl 0x4(%rsp), %ebx
incl %ebx
movl %ebx, 0x4(%rsp)
cmpl %r14d, %ebx
jl 0x16d22
movq %r15, %rdi
callq 0x2030
movq %r13, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq