// File: /workspace/github_c_makefile_star2_O2/cbouilla[P]AES-attacks-finder/Solver.c
// Function: OptimizeSolver
Solver OptimizeSolver(Solver B, SysEqLin E) 
{
	/*
	 *  Fonction censée mettre en forme la solver avant implémentation.
	 * 	Plusieurs objectifs :
	 * 		- ne doit pas être trop longue.
	 * 		- avoir un maximum d'unions avec des solvers de type 0 (ie 1 variable)
	 * 		- essayer de supprimer les variables en commun
	 */
	  
	if (B==NULL || B->type==0) return copySolver(B); // cas simple : rien à faire
	
	if (B->type==2) // cas union sequentielle, on met en forme les deux parties.
	{
		SysEqLin F=EsachantX(B->fils2->var,B->fils2->Nvar,E);
		Solver B1=OptimizeSolver(B->fils1,F);
		freeSysEq(F);
		Solver B2=OptimizeSolver(B->fils2,E);
		if (B1==NULL) return B2;
		Solver tmp=NewSolver();
		tmp->var=UnionListesTriees(B1->var,B1->Nvar,B2->var,B2->Nvar,&(tmp->Nvar));
		tmp->sortie=B->sortie;
		tmp->temps=max(B2->temps,max(B2->sortie,0)+B1->temps);
		tmp->memoire=max(B1->memoire,B2->memoire);
		tmp->type=2;
		tmp->fils1=B1;
		tmp->fils2=B2;		
		return tmp;
	}
	
	if (B->fils2->sortie<=0) // la solver 2 a moins d'une solution -> passage au sequentiel
	{
		SysEqLin F=EsachantX(B->fils2->var,B->fils2->Nvar,E);
		Solver B2=AjusteSolver(B->fils1,F); // On met à jour la solver car maintenant les variables de la solver 2 sont connues
		Solver B1=OptimizeSolver(B2,F);
		freeSolver(B2);
		freeSysEq(F);
		B2=OptimizeSolver(B->fils2,E);
		if (B1==NULL) return B2;
		Solver tmp=NewSolver();
		tmp->var=UnionListesTriees(B1->var,B1->Nvar,B2->var,B2->Nvar,&(tmp->Nvar));
		tmp->sortie=B->sortie;
		tmp->temps=max(B2->temps,B1->temps);
		tmp->memoire=max(B1->memoire,B2->memoire);
		tmp->type=2;
		tmp->fils1=B1;
		tmp->fils2=B2;
		return tmp;
	}
	
	if (B->fils1->sortie<=0) // pareil que ci-dessus
	{
		SysEqLin F=EsachantX(B->fils1->var,B->fils1->Nvar,E);
		Solver B2=AjusteSolver(B->fils2,F);
		Solver B1=OptimizeSolver(B2,F);
		freeSolver(B2);
		freeSysEq(F);
		B2=OptimizeSolver(B->fils1,E);
		if (B1==NULL) return B2;
		Solver tmp=NewSolver();
		tmp->var=UnionListesTriees(B1->var,B1->Nvar,B2->var,B2->Nvar,&(tmp->Nvar));
		tmp->sortie=B->sortie;
		tmp->temps=max(B2->temps,B1->temps);
		tmp->memoire=max(B1->memoire,B2->memoire);
		tmp->type=2;
		//tmp->parents=1;
		tmp->fils1=B1;
		tmp->fils2=B2;
		if (tmp->Nvar!=B->Nvar)
		{
			printf("Gros bug 3");
			getchar();
		}
		return tmp;
	}
	
	if (B->sortie==B->fils1->sortie + B->fils2->sortie) // les deux solvers sont indépendantes -> passage au séquentiel
	{
		/* Les deux temps possibles */
		int t1=max(max(B->fils1->sortie,0) + B->fils2->temps, B->fils1->temps);
		int t2=max(max(B->fils2->sortie,0) + B->fils1->temps, B->fils2->temps);
		if (min(t1,t2)<=B->temps)
		{
			Solver tmp=NewSolver();
			tmp->var=UnionListesTriees(B->fils1->var,B->fils1->Nvar,B->fils2->var,B->fils2->Nvar,&(tmp->Nvar));
			tmp->sortie=B->sortie;
			tmp->type=2;
			//tmp->parents=1;
			Solver B1,B2;
			/* On choisit la meilleur option */
			if (t1<t2 || (t1==t2 && B->fils1->Nvar>=B->fils2->Nvar))
			{
				tmp->temps=t1;
				SysEqLin F=EsachantX(B->fils1->var,B->fils1->Nvar,E);
				B2=AjusteSolver(B->fils2,F);
				B1=OptimizeSolver(B2,F);
				freeSolver(B2);
				freeSysEq(F);
				B2=OptimizeSolver(B->fils1,E);
			}
			else
			{
				tmp->temps=t2;
				SysEqLin F=EsachantX(B->fils2->var,B->fils2->Nvar,E);
				B2=AjusteSolver(B->fils1,F);
				B1=OptimizeSolver(B2,F);
				freeSolver(B2);
				freeSysEq(F);
				B2=OptimizeSolver(B->fils2,E);
			}
			tmp->memoire=max(B1->memoire,B2->memoire);
			tmp->fils1=B1;
			tmp->fils2=B2;
			if (tmp->Nvar!=B->Nvar)
			{
				printf("Gros bug 4");
				getchar();
			}
			return tmp;
		}
	}

	/* Cas idéal */
	if (B->fils2->Nvar==1) 
	{
		Solver B1=OptimizeSolver(B->fils1,E);
		Solver B2=UnionSolver(B1,B->fils2,E);
		freeSolver(B1);
		return B2;
	}
	if (B->fils1->Nvar==1)
	{
		Solver B1=OptimizeSolver(B->fils2,E);
		Solver B2=UnionSolver(B1,B->fils1,E);
		freeSolver(B1);
		return B2;
	}

	/* Partie d'amélioration */

	// On est donc dans le cas d'une union de type 1, chacune des solvers à au moins 2 variables
	// On garde le fils1 pour l'énumération et on va chercher à diviser fils2

	int N1;	
	int *X1=DifferenceListesTriees(B->fils2->var,B->fils2->Nvar,B->fils1->var,B->fils1->Nvar,&N1);
	Solver *L1=malloc((N1+1)*sizeof(Solver));
	int i;
	for (i = 0; i < N1; i++) L1[i]=BaseSolver(X1[i],E);
	
	if (B->fils1->Nvar>=B->fils2->Nvar && N1<B->fils2->Nvar)
	{
		L1[N1]=copySolver(B->fils1);
		int N2;
		Solver *L2=ExhaustiveSearch(L1,N1+1,B->temps,B->memoire,&N2,E);
		Solver tmp=NULL;
		for (i = 0; i < N2; i++)
		{
			if (B->Nvar==L2[i]->Nvar) tmp=L2[i];
			else freeSolver(L2[i]);
		}
		free(L2);
		if (tmp!=NULL)
		{
			for (i = 0; i <= N1; i++) freeSolver(L1[i]);
			free(L1);
			free(X1);
			Solver B3=OptimizeSolver(tmp,E);
			freeSolver(tmp);
			return B3;
		}
	}
	
	Solver B1 = PropagateSolver2(B->fils1,E,L1,N1);
	free(X1);
	for (i = 0; i < N1; i++) freeSolver(L1[i]);
	free(L1);
	Solver B2 = copySolver(B->fils2);


	while (B2->type==1 && ContenuListesTriees(B2->fils2->var,B2->fils2->Nvar,B1->var,B1->Nvar))
	{
		Solver B3 = copySolver(B2->fils1);
		freeSolver(B2);
		B2 = B3;
	}
	while (B2->type==1 && ContenuListesTriees(B2->fils1->var,B2->fils1->Nvar,B1->var,B1->Nvar))
	{
		Solver B3 = copySolver(B2->fils2);
		freeSolver(B2);
		B2 = B3;
	}
	
	/* Partie qui foire, la fonction peut boucler indéfiniment */ 
	if (B2->type==1)
	{
		Solver B3 = UnionSolver(B1,B2->fils1,E);
		if (B3->temps<=B->temps)
		{
			Solver B4 = UnionSolver(B3,B2->fils2,E);
			freeSolver(B3);
			freeSolver(B2);
			freeSolver(B1);
			B1 = OptimizeSolver(B4,E);
			freeSolver(B4);
			return B1;
		}
		freeSolver(B3);
		B3 = UnionSolver(B1,B2->fils2,E);
		if (B3->temps<=B->temps)
		{
			Solver B4 = UnionSolver(B3,B2->fils1,E);
			freeSolver(B3);
			freeSolver(B2);
			freeSolver(B1);
			B1 = OptimizeSolver(B4,E);
			freeSolver(B4);
			return B1;
		}
		freeSolver(B3);			
	}
	if (B2->type==2)
	{
		X1=DifferenceListesTriees(B2->var,B2->Nvar,B1->var,B1->Nvar,&N1);
		L1=malloc((N1+1)*sizeof(Solver));
		for (i = 0; i < N1; i++) L1[i]=BaseSolver(X1[i],E);
		L1[N1]=copySolver(B1);
		int N2;
		Solver *L2=ExhaustiveSearch(L1,N1+1,B->temps,B2->sortie-1,&N2,E);
		Solver tmp=NULL;
		for (i = 0; i < N2; i++)
		{
			if (B->Nvar==L2[i]->Nvar) tmp=L2[i];
			else freeSolver(L2[i]);
		}
		free(L2);
		for (i = 0; i <= N1; i++) freeSolver(L1[i]);
		free(L1);
		free(X1);
		if (tmp!=NULL)
		{
			freeSolver(B1);
			freeSolver(B2);
			Solver B3=OptimizeSolver(tmp,E);
			freeSolver(tmp);
			return B3;
		}
	}

	/* Rien n'a marché */
	
	Solver B3 = OptimizeSolver(B1,E);
	freeSolver(B1);
	B1 = OptimizeSolver(B2,E);
	freeSolver(B2);
	B2 = UnionSolver(B3,B1,E);
	freeSolver(B3);
	freeSolver(B1);
	return B2;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
testq %rdi, %rdi
je 0x7eda
movq %rsi, %r14
movq %rdi, %rbx
movzbl 0x18(%rdi), %eax
cmpl $0x2, %eax
je 0x7ee1
testl %eax, %eax
jne 0x7f84
incl 0x1c(%rbx)
jmp 0x8194
xorl %ebx, %ebx
jmp 0x8194
movq 0x28(%rbx), %rax
movq (%rax), %rdi
movl 0x8(%rax), %esi
movq %r14, %rdx
callq 0xb021
movq %rax, %r12
movq 0x20(%rbx), %rdi
movq %rax, %rsi
callq 0x7ea8
movq %rax, %r15
movq %r12, %rdi
callq 0xb562
movq 0x28(%rbx), %rdi
movq %r14, %rsi
callq 0x7ea8
movq %rax, %r14
testq %r15, %r15
je 0x8191
callq 0x67a4
movq %rax, %r12
movq (%r15), %rdi
movl 0x8(%r15), %esi
movq (%r14), %rdx
movl 0x8(%r14), %ecx
leaq 0x8(%rax), %r8
callq 0x2440
movq %rax, (%r12)
movl 0x14(%rbx), %eax
movl %eax, 0x14(%r12)
movl 0x14(%r14), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovgl %eax, %ecx
addl 0xc(%r15), %ecx
movl 0xc(%r14), %eax
cmpl %ecx, %eax
cmovgl %eax, %ecx
movl %ecx, 0xc(%r12)
movl 0x10(%r15), %eax
movl 0x10(%r14), %ecx
cmpl %ecx, %eax
cmovgl %eax, %ecx
movl %ecx, 0x10(%r12)
jmp 0x80ad
movq 0x28(%rbx), %rdi
movl 0x14(%rdi), %r13d
testl %r13d, %r13d
jle 0x8002
leaq 0x28(%rbx), %r15
leaq 0x20(%rbx), %rbp
movq 0x20(%rbx), %rax
movl 0x14(%rax), %r12d
testl %r12d, %r12d
jle 0x80c5
leal (%r12,%r13), %ecx
cmpl %ecx, 0x14(%rbx)
jne 0x7fe0
movl 0xc(%rdi), %ecx
addl %ecx, %r12d
movl 0xc(%rax), %edx
cmpl %edx, %r12d
cmovlel %edx, %r12d
addl %edx, %r13d
cmpl %ecx, %r13d
cmovlel %ecx, %r13d
cmpl %r13d, %r12d
movl %r13d, %ecx
cmovll %r12d, %ecx
cmpl 0xc(%rbx), %ecx
jle 0x81dc
movl 0x8(%rdi), %esi
cmpl $0x1, %esi
jne 0x81a6
movq %rax, %rdi
movq %r14, %rsi
callq 0x7ea8
movq %rax, %rbx
movq (%r15), %rsi
jmp 0x81c1
movq (%rdi), %rax
movl 0x8(%rdi), %esi
movq %rax, %rdi
movq %r14, %rdx
callq 0xb021
movq %rax, %r12
movq 0x20(%rbx), %rdi
movq %rax, %rsi
callq 0x8723
movq %rax, %r13
movq %rax, %rdi
movq %r12, %rsi
callq 0x7ea8
movq %rax, %r15
movq %r13, %rdi
callq 0x6852
movq %r12, %rdi
callq 0xb562
movq 0x28(%rbx), %rdi
movq %r14, %rsi
callq 0x7ea8
movq %rax, %r14
testq %r15, %r15
je 0x8191
callq 0x67a4
movq %rax, %r12
movq (%r15), %rdi
movl 0x8(%r15), %esi
movq (%r14), %rdx
movl 0x8(%r14), %ecx
leaq 0x8(%rax), %r8
callq 0x2440
movq %rax, (%r12)
movl 0x14(%rbx), %eax
movl %eax, 0x14(%r12)
movq 0xc(%r15), %xmm0
movq 0xc(%r14), %xmm1
movdqa %xmm0, %xmm2
pcmpgtd %xmm1, %xmm2
pand %xmm2, %xmm0
pandn %xmm1, %xmm2
por %xmm0, %xmm2
movq %xmm2, 0xc(%r12)
movb $0x2, 0x18(%r12)
movq %r15, 0x20(%r12)
movq %r14, 0x28(%r12)
movq %r12, %rbx
jmp 0x8194
movq (%rax), %rdi
movl 0x8(%rax), %esi
movq %r14, %rdx
callq 0xb021
movq %rax, %r12
movq (%r15), %rdi
movq %rax, %rsi
callq 0x8723
movq %rax, %r13
movq %rax, %rdi
movq %r12, %rsi
callq 0x7ea8
movq %rax, %r15
movq %r13, %rdi
callq 0x6852
movq %r12, %rdi
callq 0xb562
movq (%rbp), %rdi
movq %r14, %rsi
callq 0x7ea8
movq %rax, %r12
testq %r15, %r15
je 0x80bd
callq 0x67a4
movq %rax, %r14
movq (%r15), %rdi
movl 0x8(%r15), %esi
movq (%r12), %rdx
movl 0x8(%r12), %ecx
leaq 0x8(%rax), %r8
callq 0x2440
movq %rax, (%r14)
movl 0x14(%rbx), %eax
movl %eax, 0x14(%r14)
movq 0xc(%r15), %xmm0
movq 0xc(%r12), %xmm1
movdqa %xmm0, %xmm2
pcmpgtd %xmm1, %xmm2
pand %xmm2, %xmm0
pandn %xmm1, %xmm2
por %xmm0, %xmm2
movq %xmm2, 0xc(%r14)
movb $0x2, 0x18(%r14)
movq %r15, 0x20(%r14)
movq %r12, 0x28(%r14)
movl 0x8(%r14), %eax
cmpl 0x8(%rbx), %eax
je 0x8191
leaq 0x1f17a(%rip), %rdi     # 0x272ff
xorl %eax, %eax
callq 0x2110
callq 0x2170
movq %r14, %rbx
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x8(%rax), %ecx
cmpl $0x1, %ecx
jne 0x8234
movq %r14, %rsi
callq 0x7ea8
movq %rax, %rbx
movq (%rbp), %rsi
movq %rax, %rdi
movq %r14, %rdx
callq 0x72e2
movq %rax, %r14
movq %rbx, %rdi
callq 0x6852
movq %r14, %rax
jmp 0x8197
movq %r15, 0x10(%rsp)
callq 0x67a4
movq %rax, %r15
movq 0x20(%rbx), %rax
movq 0x28(%rbx), %rcx
movq (%rax), %rdi
movl 0x8(%rax), %esi
movq (%rcx), %rdx
movl 0x8(%rcx), %ecx
leaq 0x8(%r15), %r8
callq 0x2440
movq %rax, (%r15)
movl 0x14(%rbx), %eax
movl %eax, 0x14(%r15)
movb $0x2, 0x18(%r15)
cmpl %r13d, %r12d
jge 0x830d
movq (%rbp), %rax
movl 0x8(%rax), %esi
movq 0x10(%rsp), %r13
movq %rbp, 0x8(%rsp)
jmp 0x8378
movq %r15, 0x10(%rsp)
movq %rbp, 0x8(%rsp)
movq (%rdi), %rdi
movq (%rax), %rdx
leaq 0x4(%rsp), %r15
movq %r15, %r8
callq 0x263f
movq %rax, %r13
movslq (%r15), %r15
leaq 0x8(,%r15,8), %rdi
callq 0x21c0
movq %rax, %r12
xorl %ebp, %ebp
movslq %r15d, %rax
cmpq %rax, %rbp
jge 0x828c
movl (%r13,%rbp,4), %edi
movq %r14, %rsi
callq 0x6d1e
movq %rax, (%r12,%rbp,8)
incq %rbp
movl 0x4(%rsp), %r15d
jmp 0x8269
movq 0x8(%rsp), %rcx
movq (%rcx), %rdi
movq 0x10(%rsp), %rcx
movq (%rcx), %rcx
movl 0x8(%rcx), %ecx
cmpl %ecx, 0x8(%rdi)
setl %dl
cmpl %ecx, %r15d
setge %cl
orb %dl, %cl
jne 0x8424
incl 0x1c(%rdi)
movq %rdi, (%r12,%rax,8)
incl %r15d
movl 0xc(%rbx), %edx
movl 0x10(%rbx), %ecx
leaq 0x24(%rsp), %r8
movq %r12, %rdi
movl %r15d, %esi
movq %r14, %r9
callq 0x142a0
movq %rax, %rbp
xorl %r15d, %r15d
movq $0x0, 0x18(%rsp)
movslq 0x24(%rsp), %rax
cmpq %rax, %r15
jge 0x8336
movl 0x8(%rbx), %eax
movq (%rbp,%r15,8), %rdi
cmpl 0x8(%rdi), %eax
jne 0x8303
movq %rdi, 0x18(%rsp)
jmp 0x8308
callq 0x6852
incq %r15
jmp 0x82e5
movq 0x10(%rsp), %rcx
movq (%rcx), %rax
jne 0x836a
movq (%rbp), %rcx
movl 0x8(%rcx), %edx
movl 0x8(%rax), %esi
cmpl %esi, %edx
jge 0x867a
movl %r13d, %r12d
movq %rbp, %r13
movq 0x10(%rsp), %rcx
jmp 0x8373
movq %rbp, %rdi
callq 0x2030
movq 0x18(%rsp), %r15
testq %r15, %r15
je 0x8417
xorl %ebx, %ebx
movslq 0x4(%rsp), %rax
cmpq %rax, %rbx
jg 0x8402
movq (%r12,%rbx,8), %rdi
callq 0x6852
incq %rbx
jmp 0x834e
movl 0x8(%rax), %esi
movl %r13d, %r12d
movq %rbp, %r13
movq %rcx, 0x8(%rsp)
movl %r12d, 0xc(%r15)
movq (%rax), %rdi
movq %r14, %rdx
callq 0xb021
movq %rax, %r12
movq (%r13), %rdi
movq %rax, %rsi
callq 0x8723
movq %rax, %r13
movq %rax, %rdi
movq %r12, %rsi
callq 0x7ea8
movq %rax, %rbp
movq %r13, %rdi
callq 0x6852
movq %r12, %rdi
callq 0xb562
movq 0x8(%rsp), %rax
movq (%rax), %rdi
movq %r14, %rsi
callq 0x7ea8
movl 0x10(%rbp), %ecx
movl 0x10(%rax), %edx
cmpl %edx, %ecx
cmovgl %ecx, %edx
movl %edx, 0x10(%r15)
movq %rbp, 0x20(%r15)
movq %rax, 0x28(%r15)
movl 0x8(%r15), %eax
cmpl 0x8(%rbx), %eax
je 0x83fa
leaq 0x1ef1c(%rip), %rdi     # 0x2730a
xorl %eax, %eax
callq 0x2110
callq 0x2170
movq %r15, %rbx
jmp 0x8194
movq %r12, %rdi
callq 0x2030
movq %r13, %rdi
callq 0x2030
jmp 0x866a
movq 0x8(%rsp), %rax
movq (%rax), %rdi
movl 0x4(%rsp), %r15d
movq %r14, %rsi
movq %r12, %rdx
movl %r15d, %ecx
callq 0x788d
movq %rax, %rbp
movq %r13, %rdi
callq 0x2030
xorl %r15d, %r15d
movslq 0x4(%rsp), %rax
cmpq %rax, %r15
jge 0x8458
movq (%r12,%r15,8), %rdi
callq 0x6852
incq %r15
jmp 0x8440
movq %r12, %rdi
callq 0x2030
movq 0x10(%rsp), %rax
movq (%rax), %r12
testq %r12, %r12
je 0x8472
incl 0x1c(%r12)
cmpb $0x1, 0x18(%r12)
jne 0x84e4
movq 0x28(%r12), %rax
movq (%rax), %rdi
movl 0x8(%rax), %esi
movq (%rbp), %rdx
movl 0x8(%rbp), %ecx
callq 0x2a3d
testl %eax, %eax
je 0x84e4
movq 0x20(%r12), %r15
testq %r15, %r15
je 0x84a3
incl 0x1c(%r15)
movq %r12, %rdi
callq 0x6852
movq %r15, %r12
jmp 0x8472
movq 0x20(%r12), %rax
movq (%rax), %rdi
movl 0x8(%rax), %esi
movq (%rbp), %rdx
movl 0x8(%rbp), %ecx
callq 0x2a3d
testl %eax, %eax
je 0x84ef
movq 0x28(%r12), %r15
testq %r15, %r15
je 0x84d9
incl 0x1c(%r15)
movq %r12, %rdi
callq 0x6852
movq %r15, %r12
movb 0x18(%r12), %al
cmpb $0x1, %al
je 0x84b0
jmp 0x854b
movb 0x18(%r12), %al
cmpb $0x1, %al
jne 0x854b
movq 0x20(%r12), %rsi
movq %rbp, %rdi
movq %r14, %rdx
callq 0x72e2
movq %rax, %r13
movl 0xc(%rax), %eax
cmpl 0xc(%rbx), %eax
jle 0x86db
movq %r13, %rdi
callq 0x6852
movq 0x28(%r12), %rsi
movq %rbp, %rdi
movq %r14, %rdx
callq 0x72e2
movq %rax, %r13
movl 0xc(%rax), %eax
cmpl 0xc(%rbx), %eax
jle 0x86e2
movq %r13, %rdi
callq 0x6852
movb 0x18(%r12), %al
cmpb $0x2, %al
jne 0x8689
movq (%r12), %rdi
movl 0x8(%r12), %esi
movq (%rbp), %rdx
movq %rbp, 0x8(%rsp)
movl 0x8(%rbp), %ecx
leaq 0x4(%rsp), %r13
movq %r13, %r8
callq 0x263f
movq %rax, 0x18(%rsp)
movslq (%r13), %r13
leaq 0x8(,%r13,8), %rdi
callq 0x21c0
movq %rax, %rbp
xorl %r15d, %r15d
movslq %r13d, %rsi
cmpq %rsi, %r15
jge 0x85b9
movq 0x18(%rsp), %rax
movl (%rax,%r15,4), %edi
movq %r14, %rsi
callq 0x6d1e
movq %rax, (%rbp,%r15,8)
incq %r15
movl 0x4(%rsp), %r13d
jmp 0x8591
movq 0x8(%rsp), %rax
incl 0x1c(%rax)
movq %rax, (%rbp,%rsi,8)
incl %esi
movl 0xc(%rbx), %edx
movl 0x14(%r12), %ecx
decl %ecx
leaq 0x20(%rsp), %r8
movq %rbp, %rdi
movq %r14, %r9
callq 0x142a0
movq %rax, %r13
xorl %r15d, %r15d
movq $0x0, 0x10(%rsp)
movslq 0x20(%rsp), %rax
cmpq %rax, %r15
jge 0x8619
movl 0x8(%rbx), %eax
movq (%r13,%r15,8), %rdi
cmpl 0x8(%rdi), %eax
jne 0x860f
movq %rdi, 0x10(%rsp)
jmp 0x8614
callq 0x6852
incq %r15
jmp 0x85f1
movq %r13, %rdi
callq 0x2030
xorl %ebx, %ebx
movq 0x10(%rsp), %r15
movslq 0x4(%rsp), %rax
cmpq %rax, %rbx
jg 0x8641
movq (%rbp,%rbx,8), %rdi
callq 0x6852
incq %rbx
jmp 0x8628
movq %rbp, %rdi
callq 0x2030
movq 0x18(%rsp), %rdi
callq 0x2030
testq %r15, %r15
je 0x8684
movq 0x8(%rsp), %rdi
callq 0x6852
movq %r12, %rdi
callq 0x6852
movq %r15, %rdi
movq %r14, %rsi
callq 0x7ea8
movq %rax, %rbx
jmp 0x86ce
movq %rcx, %rax
movl %edx, %esi
jmp 0x8225
movq 0x8(%rsp), %rbp
movq %rbp, %rdi
movq %r14, %rsi
callq 0x7ea8
movq %rax, %r13
movq %rbp, %rdi
callq 0x6852
movq %r12, %rdi
movq %r14, %rsi
callq 0x7ea8
movq %rax, %r15
movq %r12, %rdi
callq 0x6852
movq %r13, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x72e2
movq %rax, %rbx
movq %r13, %rdi
callq 0x6852
movq %r15, %rdi
callq 0x6852
jmp 0x8194
movq 0x28(%r12), %rsi
jmp 0x86e7
movq 0x20(%r12), %rsi
movq %r13, %rdi
movq %r14, %rdx
callq 0x72e2
movq %rbp, %rbx
movq %rax, %rbp
movq %r13, %rdi
callq 0x6852
movq %r12, %rdi
callq 0x6852
movq %rbx, %rdi
callq 0x6852
movq %rbp, %rdi
movq %r14, %rsi
callq 0x7ea8
movq %rax, %rbx
movq %rbp, %rdi
jmp 0x86d1