// File: /workspace/github_c_makefile_star2_O0/cbouilla[P]AES-attacks-finder/SysEqLin.c
// Function: ConversionSys2
Equation * ConversionSys2(int *X, int n, SysEqLin E) // Convertit un SysEqLin en système d'équations
{
	/* Propriété speciale :
	 *		- le resulat a 2*E->b Equation
	 * 		- le resultat est à lire Eq[i] = Eq[ i + E->b], Eq[i] est en les variables X, 0 <= i < E->b
	 */
	 
	Tri(X,n);
	Equation * __restrict Eq=malloc(2*E->b*sizeof(Equation));
	int i;
	for (i = 0; i < E->b; i++)
	{
		Eq[i]=NulEq();
		Eq[i+E->b]=NulEq();
		int pos=0,j;
		for (j = 0; j < VARIABLES; j++)
		{
			int l;
			if (pos<n && j==X[pos])
			{
				l=i;
				pos++;
			}
			else l=i+E->b;
			int k;
			for (k = 0; k < E->gen; k++)
			{
				Equation tmp=varEq(j);
				if (k!=0)
				{
					Equation tmp1=appliqueS(tmp,k-1);
					freeEq(tmp);
					tmp=tmp1;
				}
				Equation tmp1=mulEq(E->mat[E->gen*E->lignevar[j]+k][i],tmp);
				freeEq(tmp);
				tmp=addEq(tmp1,Eq[l]);
				freeEq(Eq[l]);
				freeEq(tmp1);
				Eq[l]=tmp;
			}
		}
	}
	return Eq;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x2e10
movq -0x18(%rbp), %rax
movl 0xc(%rax), %eax
shll %eax
movslq %eax, %rdi
shlq $0x3, %rdi
callq 0x21c0
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jge 0x1217f
callq 0x5850
movq %rax, %rdx
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
callq 0x5850
movq %rax, %rdx
movq -0x20(%rbp), %rax
movl -0x24(%rbp), %ecx
movq -0x18(%rbp), %rsi
addl 0xc(%rsi), %ecx
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
leaq 0x2b290(%rip), %rcx     # 0x3d2c8
cmpl (%rcx), %eax
jge 0x1216f
movl -0x28(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x12069
movl -0x2c(%rbp), %eax
movq -0x8(%rbp), %rcx
movslq -0x28(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jne 0x12069
movl -0x24(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x12076
movl -0x24(%rbp), %eax
movq -0x18(%rbp), %rcx
addl 0xc(%rcx), %eax
movl %eax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x1215f
movl -0x2c(%rbp), %edi
callq 0x5da0
movq %rax, -0x40(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x120c6
movq -0x40(%rbp), %rdi
movl -0x34(%rbp), %eax
subl $0x1, %eax
movzbl %al, %esi
callq 0x6ce0
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
callq 0x5900
movq -0x48(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movl 0x10(%rcx), %ecx
movq -0x18(%rbp), %rdx
movq 0x18(%rdx), %rdx
movslq -0x2c(%rbp), %rsi
imull (%rdx,%rsi,4), %ecx
addl -0x34(%rbp), %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x24(%rbp), %rcx
movb (%rax,%rcx), %al
movq -0x40(%rbp), %rsi
movzbl %al, %edi
callq 0x5ea0
movq %rax, -0x50(%rbp)
movq -0x40(%rbp), %rdi
callq 0x5900
movq -0x50(%rbp), %rdi
movq -0x20(%rbp), %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x6900
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x5900
movq -0x50(%rbp), %rdi
callq 0x5900
movq -0x40(%rbp), %rdx
movq -0x20(%rbp), %rax
movslq -0x30(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x1207d
jmp 0x12161
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x1202e
jmp 0x12171
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x11fdf
movq -0x20(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)