// File: /workspace/github_c_makefile_star2_O3/cbouilla[P]AES-attacks-finder/Symetric.c
// Function: SolverSymetrique
Solver SolverSymetrique(Solver B, const int decalage, Symetric_structure S)
{
	static unsigned char changement = 0;
	
	if (B!=NULL)
	{
		if (B->type!=0)
		{
			Solver B1 = SolverSymetrique(B->fils1,decalage,S);
			if (changement)
			{
				Solver out=NewSolver();
				out->fils1=B1;
				out->fils2=SolverSymetrique(B->fils2,decalage,S);
				out->var=UnionListesTriees(out->fils1->var,out->fils1->Nvar,out->fils2->var,out->fils2->Nvar,&out->Nvar);
				out->type=B->type;
				out->temps=B->temps;
				out->memoire=B->memoire;
				out->sortie=B->sortie;
				changement=1;
				return out;	
			}
			else
			{
				Solver B2 = SolverSymetrique(B->fils2,decalage,S);
				if (changement)
				{
					Solver out=NewSolver();
					out->fils1=B1;
					out->fils2=B2;
					out->var=UnionListesTriees(out->fils1->var,out->fils1->Nvar,out->fils2->var,out->fils2->Nvar,&out->Nvar);
					out->type=B->type;
					out->temps=B->temps;
					out->memoire=B->memoire;
					out->sortie=B->sortie;
					return out;	
				}
				else
				{
					freeSolver(B1);
					freeSolver(B2);
					return copySolver(B);
				}
			}
		}
		else
		{
			const int var = S->var_by_message[(decalage+S->message_by_var[B->var[0]])%S->n_message][S->position_by_var[B->var[0]]];
			if (B->var[0]!=var)
			{
				changement=1;
				Solver out=NewSolver();
				out->fils1=NULL;
				out->fils2=NULL;
				out->Nvar=1;
				out->var=malloc(sizeof(int));
				out->var[0]=var;
				out->type=B->type;
				out->temps=B->temps;
				out->memoire=B->memoire;
				out->sortie=B->sortie;
				return out;	
			}
			else
			{
				changement=0;
				return copySolver(B);
			}
		}
		
	}
	else
	{
		changement=0;
		return NULL;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testq %rdi, %rdi
je 0x184a3
movq %rdx, %r15
movl %esi, %ebp
movq %rdi, %rbx
cmpb $0x0, 0x18(%rdi)
je 0x184b2
movq 0x20(%rbx), %rdi
movl %ebp, %esi
movq %r15, %rdx
callq 0x18406
movq %rax, %r12
cmpb $0x0, 0x1a017(%rip)     # 0x32458
je 0x184eb
callq 0x7394
movq %rax, %r14
movq %r12, 0x20(%rax)
movq 0x28(%rbx), %rdi
movl %ebp, %esi
movq %r15, %rdx
callq 0x18406
movq %rax, 0x28(%r14)
movq 0x20(%r14), %rcx
movq (%rcx), %rdi
movl 0x8(%rcx), %esi
movq (%rax), %rdx
movl 0x8(%rax), %ecx
leaq 0x8(%r14), %r8
callq 0x2544
movq %rax, (%r14)
movb 0x18(%rbx), %al
movb %al, 0x18(%r14)
movq 0xc(%rbx), %rax
movq %rax, 0xc(%r14)
movl 0x14(%rbx), %eax
movl %eax, 0x14(%r14)
movb $0x1, 0x19fba(%rip)     # 0x32458
jmp 0x18575
movb $0x0, 0x19fae(%rip)     # 0x32458
xorl %r14d, %r14d
jmp 0x18575
movq (%r15), %rcx
movq 0x10(%r15), %rax
movq (%rbx), %rdx
movslq (%rdx), %rsi
addl (%rax,%rsi,4), %ebp
movl %ebp, %eax
cltd
idivl 0xc(%r15)
movslq %edx, %rax
movq (%rcx,%rax,8), %rax
movq 0x18(%r15), %rcx
movslq (%rcx,%rsi,4), %rcx
movl (%rax,%rcx,4), %ebp
cmpl %ebp, %esi
jne 0x18533
movb $0x0, 0x19f72(%rip)     # 0x32458
jmp 0x18591
movq 0x28(%rbx), %rdi
movl %ebp, %esi
movq %r15, %rdx
callq 0x18406
movq %rax, %r15
cmpb $0x1, 0x19f55(%rip)     # 0x32458
jne 0x18581
callq 0x7394
movq %rax, %r14
movq %r12, 0x20(%rax)
movq %r15, 0x28(%rax)
movq (%r12), %rdi
movl 0x8(%r12), %esi
movq (%r15), %rdx
movl 0x8(%r15), %ecx
leaq 0x8(%rax), %r8
callq 0x2544
movq %rax, (%r14)
jmp 0x1855f
movb $0x1, 0x19f1e(%rip)     # 0x32458
callq 0x7394
movq %rax, %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
movl $0x1, 0x8(%rax)
movl $0x4, %edi
callq 0x21d0
movq %rax, (%r14)
movl %ebp, (%rax)
movb 0x18(%rbx), %al
movb %al, 0x18(%r14)
movq 0xc(%rbx), %rax
movq %rax, 0xc(%r14)
movl 0x14(%rbx), %eax
movl %eax, 0x14(%r14)
movq %r14, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %rdi
callq 0x7447
movq %r15, %rdi
callq 0x7447
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x743b