// File: /workspace/github_c_makefile_star2_O0/cbouilla[P]AES-attacks-finder/SysEqLin.c
// Function: Transform2
SysEqLin Transform2(Equation *Eq, int taille, int gen) // Transforme une système d'équations en SysEqLin
{
	Equation *A;
	SysEqLin E;
	int i,*dedans,j,NA;
	A=Linearise(Eq,taille,&NA); // Probablement inutile maintenant
#if DISPLAY_EQUATIONS==1
	for (i = 0; i < NA; i++)
	{
		printf("Eq[%d] : ",i);
		PrintEq(A[i]);
		printf("\n");
	}
#endif
	E=malloc(sizeof(SYSEQLIN));
	E->a=gen*VARIABLES;
	E->b=NA;
	E->gen=gen;
	E->mat=malloc(E->a*sizeof(unsigned char *));
	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(NA*sizeof(unsigned char));
		for (j = 0; j < NA; j++) E->mat[i][j]=0;
	}
	for (i = 0; i < NA; i++)
	{
		for (j = 0; j < A[i]->nV; j++)
		{
			E->mat[gen*A[i]->var[j]][i]^=A[i]->coefV[j];
			dedans[A[i]->var[j]]=1;
		}
		for (j = 0; j < A[i]->nS; j++)
		{
			E->mat[gen*A[i]->S[j]->var[0]+A[i]->sbox[j]+1][i]^=A[i]->coefS[j];
			dedans[A[i]->S[j]->var[0]]=1;
		}
		freeEq(A[i]);
	}
	free(A);
	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)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
leaq -0x38(%rbp), %rdx
callq 0x7750
movq %rax, -0x18(%rbp)
movl $0x40, %edi
callq 0x21c0
movq %rax, -0x20(%rbp)
movl -0x10(%rbp), %ecx
leaq 0x2cd3a(%rip), %rax     # 0x3d2c8
imull (%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0x38(%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 0x2ccfa(%rip), %rax     # 0x3d2c8
movslq (%rax), %rdi
shlq $0x2, %rdi
callq 0x21c0
movq %rax, -0x30(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
leaq 0x2ccd9(%rip), %rcx     # 0x3d2c8
cmpl (%rcx), %eax
jge 0x1060d
movq -0x30(%rbp), %rax
movslq -0x24(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x105e5
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x1067d
movslq -0x38(%rbp), %rdi
shlq $0x0, %rdi
callq 0x21c0
movq %rax, %rdx
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x24(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x38(%rbp), %eax
jge 0x10670
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x34(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x10646
jmp 0x10672
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x10614
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x38(%rbp), %eax
jge 0x10811
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x18(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
cmpl (%rcx), %eax
jge 0x10729
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x10(%rax), %rax
movslq -0x34(%rbp), %rcx
movzbl (%rax,%rcx), %esi
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl -0x10(%rbp), %ecx
movq -0x18(%rbp), %rdx
movslq -0x24(%rbp), %rdi
movq (%rdx,%rdi,8), %rdx
movq 0x8(%rdx), %rdx
movslq -0x34(%rbp), %rdi
imull (%rdx,%rdi,4), %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x24(%rbp), %rcx
movzbl (%rax,%rcx), %edx
xorl %esi, %edx
movb %dl, (%rax,%rcx)
movq -0x30(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movq 0x8(%rcx), %rcx
movslq -0x34(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
movl $0x1, (%rax,%rcx,4)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x10697
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x18(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
cmpl 0x18(%rcx), %eax
jge 0x107f2
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x28(%rax), %rax
movslq -0x34(%rbp), %rcx
movzbl (%rax,%rcx), %esi
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl -0x10(%rbp), %ecx
movq -0x18(%rbp), %rdx
movslq -0x24(%rbp), %rdi
movq (%rdx,%rdi,8), %rdx
movq 0x20(%rdx), %rdx
movslq -0x34(%rbp), %rdi
movq (%rdx,%rdi,8), %rdx
movq 0x8(%rdx), %rdx
imull (%rdx), %ecx
movq -0x18(%rbp), %rdx
movslq -0x24(%rbp), %rdi
movq (%rdx,%rdi,8), %rdx
movq 0x30(%rdx), %rdx
movslq -0x34(%rbp), %rdi
movzbl (%rdx,%rdi), %edx
addl %edx, %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x24(%rbp), %rcx
movzbl (%rax,%rcx), %edx
xorl %esi, %edx
movb %dl, (%rax,%rcx)
movq -0x30(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movq 0x20(%rcx), %rcx
movslq -0x34(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movq 0x8(%rcx), %rcx
movslq (%rcx), %rcx
movl $0x1, (%rax,%rcx,4)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x10730
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x5900
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x10684
movq -0x18(%rbp), %rdi
callq 0x2030
leaq 0x2caa7(%rip), %rax     # 0x3d2c8
movslq (%rax), %rdi
shlq $0x2, %rdi
callq 0x21c0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x20(%rax)
leaq 0x2ca89(%rip), %rax     # 0x3d2c8
movslq (%rax), %rdi
shlq $0x2, %rdi
callq 0x21c0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
leaq 0x2ca61(%rip), %rcx     # 0x3d2c8
cmpl (%rcx), %eax
jge 0x10888
movl -0x24(%rbp), %edx
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x24(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x1085d
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
leaq 0x2ca2f(%rip), %rcx     # 0x3d2c8
cmpl (%rcx), %eax
jge 0x108ba
movl -0x24(%rbp), %edx
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x24(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x1088f
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
leaq 0x2c9fd(%rip), %rcx     # 0x3d2c8
cmpl (%rcx), %eax
jge 0x1092a
movq -0x30(%rbp), %rax
movslq -0x24(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0x1091d
movq -0x20(%rbp), %rax
movl 0x8(%rax), %ecx
subl -0x10(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0x24(%rbp), %edi
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movl 0x8(%rax), %eax
cltd
idivl -0x10(%rbp)
movl %eax, %ecx
movq -0x40(%rbp), %rax
movslq %ecx, %rcx
movl (%rax,%rcx,4), %esi
movq -0x20(%rbp), %rdx
callq 0x10460
jmp 0x1091f
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x108c1
movq -0x20(%rbp), %rax
movb $0x0, 0x28(%rax)
movq -0x20(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)