// File: /workspace/github_c_makefile_star2_O0/cbouilla[P]AES-attacks-finder/SysEqLin.c
// Function: Transform
SysEqLin Transform(Equation *Eq, int taille, int gen) // Transforme une système d'équations en SysEqLin
{
	int i;
#if DISPLAY_EQUATIONS==1
	for (i = 0; i < taille; i++)
	{
		printf("Eq[%d] : ",i);
		PrintEq(Eq[i]);
		printf("\n");
	}
#endif
	SysEqLin E=malloc(sizeof(SYSEQLIN));
	E->a=gen*VARIABLES;
	E->b=taille;
	E->gen=gen;
	E->mat=malloc(E->a*sizeof(unsigned char *));
	int * __restrict dedans=malloc(VARIABLES*sizeof(int));
	for (i = 0; i < VARIABLES; i++) dedans[i]=0;
	for (i = 0; i < E->a; i++)
	{
		E->mat[i]=malloc(taille*sizeof(unsigned char));
		int j;
		for (j = 0; j < taille; j++) E->mat[i][j]=0;
	}
	for (i = 0; i < taille; i++)
	{
		int j;
		for (j = 0; j < Eq[i]->nV; j++)
		{
			E->mat[gen*Eq[i]->var[j]][i]^=Eq[i]->coefV[j];
			dedans[Eq[i]->var[j]]=1;
		}
		for (j = 0; j < Eq[i]->nS; j++)
		{
			E->mat[gen*Eq[i]->S[j]->var[0]+Eq[i]->sbox[j]+1][i]^=Eq[i]->coefS[j];
			dedans[Eq[i]->S[j]->var[0]]=1;
		}
	}
	E->varligne=malloc(VARIABLES*sizeof(int));
	E->lignevar=malloc(VARIABLES*sizeof(int));
	for (i = 0; i < VARIABLES; i++) E->varligne[i]=i;
	for (i = 0; i < VARIABLES; i++) E->lignevar[i]=i;
	for (i = 0; i < VARIABLES; i++)
	{
		if (dedans[i]==0)
		{
			E->a=E->a-gen;
			PermuterVar(i,E->varligne[E->a/gen],E);
		}
	}
	E->initialise=0;
	return E;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl $0x40, %edi
callq 0x21c0
movq %rax, -0x20(%rbp)
movl -0x10(%rbp), %ecx
leaq 0x2d1fe(%rip), %rax     # 0x3d2c8
imull (%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0xc(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0xc(%rax)
movl -0x10(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x20(%rbp), %rax
movslq 0x8(%rax), %rdi
shlq $0x3, %rdi
callq 0x21c0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
leaq 0x2d1be(%rip), %rax     # 0x3d2c8
movslq (%rax), %rdi
shlq $0x2, %rdi
callq 0x21c0
movq %rax, -0x28(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
leaq 0x2d19d(%rip), %rcx     # 0x3d2c8
cmpl (%rcx), %eax
jge 0x10149
movq -0x28(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x10121
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x101b9
movslq -0xc(%rbp), %rdi
shlq $0x0, %rdi
callq 0x21c0
movq %rax, %rdx
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x101ac
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x2c(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x10182
jmp 0x101ae
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x10150
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x1033e
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
movq -0x8(%rbp), %rcx
movslq -0x14(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
cmpl (%rcx), %eax
jge 0x10265
movq -0x8(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x10(%rax), %rax
movslq -0x30(%rbp), %rcx
movzbl (%rax,%rcx), %esi
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl -0x10(%rbp), %ecx
movq -0x8(%rbp), %rdx
movslq -0x14(%rbp), %rdi
movq (%rdx,%rdi,8), %rdx
movq 0x8(%rdx), %rdx
movslq -0x30(%rbp), %rdi
imull (%rdx,%rdi,4), %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x14(%rbp), %rcx
movzbl (%rax,%rcx), %edx
xorl %esi, %edx
movb %dl, (%rax,%rcx)
movq -0x28(%rbp), %rax
movq -0x8(%rbp), %rcx
movslq -0x14(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movq 0x8(%rcx), %rcx
movslq -0x30(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
movl $0x1, (%rax,%rcx,4)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x101d3
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
movq -0x8(%rbp), %rcx
movslq -0x14(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
cmpl 0x18(%rcx), %eax
jge 0x1032e
movq -0x8(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x28(%rax), %rax
movslq -0x30(%rbp), %rcx
movzbl (%rax,%rcx), %esi
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl -0x10(%rbp), %ecx
movq -0x8(%rbp), %rdx
movslq -0x14(%rbp), %rdi
movq (%rdx,%rdi,8), %rdx
movq 0x20(%rdx), %rdx
movslq -0x30(%rbp), %rdi
movq (%rdx,%rdi,8), %rdx
movq 0x8(%rdx), %rdx
imull (%rdx), %ecx
movq -0x8(%rbp), %rdx
movslq -0x14(%rbp), %rdi
movq (%rdx,%rdi,8), %rdx
movq 0x30(%rdx), %rdx
movslq -0x30(%rbp), %rdi
movzbl (%rdx,%rdi), %edx
addl %edx, %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x14(%rbp), %rcx
movzbl (%rax,%rcx), %edx
xorl %esi, %edx
movb %dl, (%rax,%rcx)
movq -0x28(%rbp), %rax
movq -0x8(%rbp), %rcx
movslq -0x14(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movq 0x20(%rcx), %rcx
movslq -0x30(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movq 0x8(%rcx), %rcx
movslq (%rcx), %rcx
movl $0x1, (%rax,%rcx,4)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x1026c
jmp 0x10330
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x101c0
leaq 0x2cf83(%rip), %rax     # 0x3d2c8
movslq (%rax), %rdi
shlq $0x2, %rdi
callq 0x21c0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x20(%rax)
leaq 0x2cf65(%rip), %rax     # 0x3d2c8
movslq (%rax), %rdi
shlq $0x2, %rdi
callq 0x21c0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
leaq 0x2cf3d(%rip), %rcx     # 0x3d2c8
cmpl (%rcx), %eax
jge 0x103ac
movl -0x14(%rbp), %edx
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x14(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x10381
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
leaq 0x2cf0b(%rip), %rcx     # 0x3d2c8
cmpl (%rcx), %eax
jge 0x103de
movl -0x14(%rbp), %edx
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x14(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x103b3
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
leaq 0x2ced9(%rip), %rcx     # 0x3d2c8
cmpl (%rcx), %eax
jge 0x1044e
movq -0x28(%rbp), %rax
movslq -0x14(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0x10441
movq -0x20(%rbp), %rax
movl 0x8(%rax), %ecx
subl -0x10(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0x14(%rbp), %edi
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movl 0x8(%rax), %eax
cltd
idivl -0x10(%rbp)
movl %eax, %ecx
movq -0x38(%rbp), %rax
movslq %ecx, %rcx
movl (%rax,%rcx,4), %esi
movq -0x20(%rbp), %rdx
callq 0x10460
jmp 0x10443
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x103e5
movq -0x20(%rbp), %rax
movb $0x0, 0x28(%rax)
movq -0x20(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq