// File: /workspace/github_c_makefile_star2_O1/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 0x18248
movq %rdx, %r15
movl %esi, %ebp
movq %rdi, %rbx
cmpb $0x0, 0x18(%rdi)
je 0x18257
movq 0x20(%rbx), %rdi
movl %ebp, %esi
movq %r15, %rdx
callq 0x181a5
movq %rax, %r12
cmpb $0x0, 0x1a278(%rip)     # 0x32458
je 0x18290
callq 0x6fb4
movq %rax, %r14
movq %r12, 0x20(%rax)
movq 0x28(%rbx), %rdi
movl %ebp, %esi
movq %r15, %rdx
callq 0x181a5
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)
movl 0xc(%rbx), %eax
movl %eax, 0xc(%r14)
movl 0x10(%rbx), %eax
movl %eax, 0x10(%r14)
movl 0x14(%rbx), %eax
movl %eax, 0x14(%r14)
movb $0x1, 0x1a215(%rip)     # 0x32458
jmp 0x18324
movb $0x0, 0x1a209(%rip)     # 0x32458
xorl %r14d, %r14d
jmp 0x18324
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 0x182dc
movb $0x0, 0x1a1cd(%rip)     # 0x32458
jmp 0x18340
movq 0x28(%rbx), %rdi
movl %ebp, %esi
movq %r15, %rdx
callq 0x181a5
movq %rax, %r15
cmpb $0x1, 0x1a1b0(%rip)     # 0x32458
jne 0x18330
callq 0x6fb4
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 0x18308
movb $0x1, 0x1a175(%rip)     # 0x32458
callq 0x6fb4
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)
movl 0xc(%rbx), %eax
movl %eax, 0xc(%r14)
movl 0x10(%rbx), %eax
movl %eax, 0x10(%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 0x7060
movq %r15, %rdi
callq 0x7060
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x7054