// File: /workspace/github_c_makefile_star2_O3/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 0x8b46
movq %rsi, %r14
movq %rdi, %rbx
movzbl 0x18(%rdi), %eax
cmpl $0x2, %eax
je 0x8b4d
testl %eax, %eax
jne 0x8bf0
incl 0x1c(%rbx)
jmp 0x8e00
xorl %ebx, %ebx
jmp 0x8e00
movq 0x28(%rbx), %rax
movq (%rax), %rdi
movl 0x8(%rax), %esi
movq %r14, %rdx
callq 0xc29a
movq %rax, %r12
movq 0x20(%rbx), %rdi
movq %rax, %rsi
callq 0x8b14
movq %rax, %r15
movq %r12, %rdi
callq 0xc82d
movq 0x28(%rbx), %rdi
movq %r14, %rsi
callq 0x8b14
movq %rax, %r14
testq %r15, %r15
je 0x8dfd
callq 0x7394
movq %rax, %r12
movq (%r15), %rdi
movl 0x8(%r15), %esi
movq (%r14), %rdx
movl 0x8(%r14), %ecx
leaq 0x8(%rax), %r8
callq 0x2544
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 0x8d19
movq 0x28(%rbx), %rdi
movl 0x14(%rdi), %r13d
testl %r13d, %r13d
jle 0x8c6e
leaq 0x28(%rbx), %r15
leaq 0x20(%rbx), %rbp
movq 0x20(%rbx), %rax
movl 0x14(%rax), %r12d
testl %r12d, %r12d
jle 0x8d31
leal (%r12,%r13), %ecx
cmpl %ecx, 0x14(%rbx)
jne 0x8c4c
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 0x8e48
movl 0x8(%rdi), %esi
cmpl $0x1, %esi
jne 0x8e12
movq %rax, %rdi
movq %r14, %rsi
callq 0x8b14
movq %rax, %rbx
movq (%r15), %rsi
jmp 0x8e2d
movq (%rdi), %rax
movl 0x8(%rdi), %esi
movq %rax, %rdi
movq %r14, %rdx
callq 0xc29a
movq %rax, %r12
movq 0x20(%rbx), %rdi
movq %rax, %rsi
callq 0x9401
movq %rax, %r13
movq %rax, %rdi
movq %r12, %rsi
callq 0x8b14
movq %rax, %r15
movq %r13, %rdi
callq 0x7447
movq %r12, %rdi
callq 0xc82d
movq 0x28(%rbx), %rdi
movq %r14, %rsi
callq 0x8b14
movq %rax, %r14
testq %r15, %r15
je 0x8dfd
callq 0x7394
movq %rax, %r12
movq (%r15), %rdi
movl 0x8(%r15), %esi
movq (%r14), %rdx
movl 0x8(%r14), %ecx
leaq 0x8(%rax), %r8
callq 0x2544
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 0x8e00
movq (%rax), %rdi
movl 0x8(%rax), %esi
movq %r14, %rdx
callq 0xc29a
movq %rax, %r12
movq (%r15), %rdi
movq %rax, %rsi
callq 0x9401
movq %rax, %r13
movq %rax, %rdi
movq %r12, %rsi
callq 0x8b14
movq %rax, %r15
movq %r13, %rdi
callq 0x7447
movq %r12, %rdi
callq 0xc82d
movq (%rbp), %rdi
movq %r14, %rsi
callq 0x8b14
movq %rax, %r12
testq %r15, %r15
je 0x8d29
callq 0x7394
movq %rax, %r14
movq (%r15), %rdi
movl 0x8(%r15), %esi
movq (%r12), %rdx
movl 0x8(%r12), %ecx
leaq 0x8(%rax), %r8
callq 0x2544
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 0x8dfd
leaq 0x2056e(%rip), %rdi     # 0x2935f
xorl %eax, %eax
callq 0x2110
callq 0x2180
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 0x8ea0
movq %r14, %rsi
callq 0x8b14
movq %rax, %rbx
movq (%rbp), %rsi
movq %rax, %rdi
movq %r14, %rdx
callq 0x7f14
movq %rax, %r14
movq %rbx, %rdi
callq 0x7447
movq %r14, %rax
jmp 0x8e03
movq %r15, 0x8(%rsp)
callq 0x7394
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 0x2544
movq %rax, (%r15)
movl 0x14(%rbx), %eax
movl %eax, 0x14(%r15)
movb $0x2, 0x18(%r15)
cmpl %r13d, %r12d
jge 0x8fdb
movq (%rbp), %rax
movl 0x8(%rax), %esi
movq 0x8(%rsp), %r13
movq %rbp, 0x10(%rsp)
jmp 0x9012
movq %r15, 0x8(%rsp)
movq (%rdi), %rdi
movq (%rax), %rdx
leaq 0x4(%rsp), %r15
movq %r15, %r8
callq 0x298a
movq %rax, %r13
movslq (%r15), %r15
leaq 0x8(,%r15,8), %rdi
callq 0x21d0
movq %rax, %r12
testq %r15, %r15
movq %rbp, 0x10(%rsp)
jle 0x8efd
xorl %ebp, %ebp
movl (%r13,%rbp,4), %edi
movq %r14, %rsi
callq 0x790b
movq %rax, (%r12,%rbp,8)
incq %rbp
movslq 0x4(%rsp), %r15
cmpq %r15, %rbp
jl 0x8eda
movq 0x10(%rsp), %rbp
movq (%rbp), %rdi
movq 0x8(%rsp), %rax
movq (%rax), %rax
movl 0x8(%rax), %eax
cmpl %eax, 0x8(%rdi)
setl %cl
cmpl %eax, %r15d
setge %al
orb %cl, %al
jne 0x90b1
incl 0x1c(%rdi)
movslq %r15d, %rax
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 %r8, %r15
movq %r14, %r9
callq 0x15ed7
movq %rax, %rbp
movl (%r15), %eax
testl %eax, %eax
jle 0x909c
xorl %r15d, %r15d
movq $0x0, 0x18(%rsp)
movl 0x8(%rbx), %ecx
movq (%rbp,%r15,8), %rdi
cmpl 0x8(%rdi), %ecx
jne 0x8f77
movq %rdi, 0x18(%rsp)
jmp 0x8f80
callq 0x7447
movl 0x24(%rsp), %eax
incq %r15
movslq %eax, %rcx
cmpq %rcx, %r15
jl 0x8f63
movq %rbp, %rdi
callq 0x2030
movq 0x18(%rsp), %r15
testq %r15, %r15
je 0x90a4
cmpl $0x0, 0x4(%rsp)
js 0x8fc6
movq $-0x1, %rbx
movq 0x8(%r12,%rbx,8), %rdi
callq 0x7447
movslq 0x4(%rsp), %rax
incq %rbx
cmpq %rax, %rbx
jl 0x8faf
movq %r12, %rdi
callq 0x2030
movq %r13, %rdi
callq 0x2030
jmp 0x9354
movq 0x8(%rsp), %rcx
movq (%rcx), %rax
jne 0x9004
movq (%rbp), %rcx
movl 0x8(%rcx), %edx
movl 0x8(%rax), %esi
cmpl %esi, %edx
jge 0x919a
movl %r13d, %r12d
movq %rbp, %r13
movq 0x8(%rsp), %rcx
jmp 0x900d
movl 0x8(%rax), %esi
movl %r13d, %r12d
movq %rbp, %r13
movq %rcx, 0x10(%rsp)
movl %r12d, 0xc(%r15)
movq (%rax), %rdi
movq %r14, %rdx
callq 0xc29a
movq %rax, %r12
movq (%r13), %rdi
movq %rax, %rsi
callq 0x9401
movq %rax, %r13
movq %rax, %rdi
movq %r12, %rsi
callq 0x8b14
movq %rax, %rbp
movq %r13, %rdi
callq 0x7447
movq %r12, %rdi
callq 0xc82d
movq 0x10(%rsp), %rax
movq (%rax), %rdi
movq %r14, %rsi
callq 0x8b14
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 0x9094
leaq 0x202e2(%rip), %rdi     # 0x2936a
xorl %eax, %eax
callq 0x2110
callq 0x2180
movq %r15, %rbx
jmp 0x8e00
movq %rbp, %rdi
callq 0x2030
movq 0x10(%rsp), %rax
movq (%rax), %rdi
movl 0x4(%rsp), %r15d
movq %r14, %rsi
movq %r12, %rdx
movl %r15d, %ecx
callq 0x84b9
movq %rax, %rbp
movq %r13, %rdi
callq 0x2030
cmpl $0x0, 0x4(%rsp)
jle 0x90ea
xorl %r15d, %r15d
movq (%r12,%r15,8), %rdi
callq 0x7447
incq %r15
movslq 0x4(%rsp), %rax
cmpq %rax, %r15
jl 0x90d4
movq %r12, %rdi
callq 0x2030
movq 0x8(%rsp), %rax
movq (%rax), %r13
testq %r13, %r13
je 0x9103
incl 0x1c(%r13)
movb 0x18(%r13), %al
cmpb $0x1, %al
jne 0x91fc
movq 0x28(%r13), %rax
movq (%rax), %rdi
movl 0x8(%rax), %esi
movq (%rbp), %rdx
movl 0x8(%rbp), %ecx
callq 0x2e80
testl %eax, %eax
je 0x9150
movq 0x20(%r13), %r12
testq %r12, %r12
je 0x9137
incl 0x1c(%r12)
movq %r13, %rdi
callq 0x7447
movb 0x18(%r12), %al
movq %r12, %r13
cmpb $0x1, %al
je 0x910f
jmp 0x91ff
movb 0x18(%r13), %al
cmpb $0x1, %al
jne 0x91fc
movq 0x20(%r13), %rax
movq (%rax), %rdi
movl 0x8(%rax), %esi
movq (%rbp), %rdx
movl 0x8(%rbp), %ecx
callq 0x2e80
testl %eax, %eax
je 0x91a4
movq 0x28(%r13), %r12
testq %r12, %r12
je 0x9184
incl 0x1c(%r12)
movq %r13, %rdi
callq 0x7447
movb 0x18(%r12), %al
movq %r12, %r13
cmpb $0x1, %al
je 0x915c
jmp 0x91ff
movq %rcx, %rax
movl %edx, %esi
jmp 0x8e91
movb 0x18(%r13), %al
cmpb $0x1, %al
jne 0x91fc
movq 0x20(%r13), %rsi
movq %rbp, %rdi
movq %r14, %rdx
callq 0x7f14
movq %rax, %r15
movl 0xc(%rax), %eax
cmpl 0xc(%rbx), %eax
jle 0x93be
movq %r15, %rdi
callq 0x7447
movq 0x28(%r13), %rsi
movq %rbp, %rdi
movq %r14, %rdx
callq 0x7f14
movq %rax, %r15
movl 0xc(%rax), %eax
cmpl 0xc(%rbx), %eax
jle 0x93c4
movq %r15, %rdi
callq 0x7447
movb 0x18(%r13), %al
movq %r13, %r12
cmpb $0x2, %al
jne 0x936c
movq (%r12), %rdi
movl 0x8(%r12), %esi
movq (%rbp), %rdx
movq %rbp, 0x18(%rsp)
movl 0x8(%rbp), %ecx
leaq 0x4(%rsp), %r15
movq %r15, %r8
callq 0x298a
movq %rax, 0x10(%rsp)
movslq (%r15), %r15
leaq 0x8(,%r15,8), %rdi
callq 0x21d0
movq %rax, %rbp
testq %r15, %r15
jle 0x9282
movq %r12, 0x8(%rsp)
xorl %r13d, %r13d
movq %rbp, %r12
movq 0x10(%rsp), %rbp
movl (%rbp,%r13,4), %edi
movq %r14, %rsi
callq 0x790b
movq %rax, (%r12,%r13,8)
incq %r13
movslq 0x4(%rsp), %r15
cmpq %r15, %r13
jl 0x9256
leal 0x1(%r15), %esi
movq %r12, %rbp
movq 0x8(%rsp), %r12
jmp 0x9286
leaq 0x1(%r15), %rsi
movq 0x18(%rsp), %rax
incl 0x1c(%rax)
movq %rax, (%rbp,%r15,8)
movl 0xc(%rbx), %edx
movl 0x14(%r12), %ecx
decl %ecx
leaq 0x20(%rsp), %r13
movq %rbp, %rdi
movq %r13, %r8
movq %r14, %r9
callq 0x15ed7
movq %rax, %r15
movl (%r13), %eax
testl %eax, %eax
jle 0x92f0
xorl %r13d, %r13d
movq $0x0, 0x8(%rsp)
movl 0x8(%rbx), %ecx
movq (%r15,%r13,8), %rdi
cmpl 0x8(%rdi), %ecx
jne 0x92da
movq %rdi, 0x8(%rsp)
jmp 0x92e3
callq 0x7447
movl 0x20(%rsp), %eax
incq %r13
movslq %eax, %rcx
cmpq %rcx, %r13
jl 0x92c7
jmp 0x92f9
movq $0x0, 0x8(%rsp)
movq %r15, %rdi
callq 0x2030
cmpl $0x0, 0x4(%rsp)
js 0x9326
movq $-0x1, %rbx
movq 0x8(%rbp,%rbx,8), %rdi
callq 0x7447
movslq 0x4(%rsp), %rax
incq %rbx
cmpq %rax, %rbx
jl 0x930f
movq %rbp, %rdi
callq 0x2030
movq 0x10(%rsp), %rdi
callq 0x2030
movq 0x8(%rsp), %r15
testq %r15, %r15
je 0x9367
movq 0x18(%rsp), %rdi
callq 0x7447
movq %r12, %rdi
callq 0x7447
movq %r15, %rdi
movq %r14, %rsi
callq 0x8b14
movq %rax, %rbx
movq %r15, %rdi
jmp 0x93b4
movq 0x18(%rsp), %rbp
movq %rbp, %rdi
movq %r14, %rsi
callq 0x8b14
movq %rax, %r15
movq %rbp, %rdi
callq 0x7447
movq %r12, %rdi
movq %r14, %rsi
callq 0x8b14
movq %rax, %r13
movq %r12, %rdi
callq 0x7447
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x7f14
movq %rax, %rbx
movq %r15, %rdi
callq 0x7447
movq %r13, %rdi
callq 0x7447
jmp 0x8e00
movq 0x28(%r13), %rsi
jmp 0x93c8
movq 0x20(%r13), %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0x7f14
movq %rax, %r12
movq %r15, %rdi
callq 0x7447
movq %r13, %rdi
callq 0x7447
movq %rbp, %rdi
callq 0x7447
movq %r12, %rdi
movq %r14, %rsi
callq 0x8b14
movq %rax, %rbx
movq %r12, %rdi
jmp 0x93b4