// File: /workspace/github_c_makefile_star2_O0/cbouilla[P]AES-attacks-finder/EquationAES.c
// Function: MakeMC
int MakeMC(Equation *Eq, int state1, int state2)
{
	int i,j,k,pos;
	pos=0;
	for (i = 0; i < 4; i++)
	{
		for (j = 0; j < 4; j++)
		{
			Eq[pos]=malloc(sizeof(EQUATION));
			Eq[pos]->nV=5;
			Eq[pos]->var=malloc(5*sizeof(int));
			Eq[pos]->coefV=malloc(5*sizeof(unsigned char));
			for (k = 0; k < 4; k++) Eq[pos]->var[k]=16*state1+4*i+k;
			Eq[pos]->var[k]=16*state2+4*i+j;
			Eq[pos]->coefV[k]=1;
			Eq[pos]->coefV[j]=0x02;
			Eq[pos]->coefV[(j+1)%4]=0x03;
			Eq[pos]->coefV[(j+2)%4]=0x01;
			Eq[pos]->coefV[(j+3)%4]=0x01;
			Eq[pos]->nS=0;
			Eq[pos]->S=NULL;
			Eq[pos]->sbox=NULL;
			pos++;
		}
	}
	return pos;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0x4, -0x14(%rbp)
jge 0x8801
movl $0x0, -0x18(%rbp)
cmpl $0x4, -0x18(%rbp)
jge 0x87f1
movl $0x38, %edi
callq 0x21c0
movq %rax, %rdx
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl $0x5, (%rax)
movl $0x14, %edi
callq 0x21c0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, 0x8(%rax)
movl $0x5, %edi
callq 0x21c0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, 0x10(%rax)
movl $0x0, -0x1c(%rbp)
cmpl $0x4, -0x1c(%rbp)
jge 0x86c0
movl -0xc(%rbp), %edx
shll $0x4, %edx
movl -0x14(%rbp), %eax
shll $0x2, %eax
addl %eax, %edx
addl -0x1c(%rbp), %edx
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rax
movslq -0x1c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x8687
movl -0x10(%rbp), %edx
shll $0x4, %edx
movl -0x14(%rbp), %eax
shll $0x2, %eax
addl %eax, %edx
addl -0x18(%rbp), %edx
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rax
movslq -0x1c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x10(%rax), %rax
movslq -0x1c(%rbp), %rcx
movb $0x1, (%rax,%rcx)
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x10(%rax), %rax
movslq -0x18(%rbp), %rcx
movb $0x2, (%rax,%rcx)
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl $0x4, %ecx
cltd
idivl %ecx
movq -0x38(%rbp), %rax
movslq %edx, %rcx
movb $0x3, (%rax,%rcx)
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movl -0x18(%rbp), %eax
addl $0x2, %eax
movl $0x4, %ecx
cltd
idivl %ecx
movq -0x30(%rbp), %rax
movslq %edx, %rcx
movb $0x1, (%rax,%rcx)
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
movl -0x18(%rbp), %eax
addl $0x3, %eax
movl $0x4, %ecx
cltd
idivl %ecx
movq -0x28(%rbp), %rax
movslq %edx, %rcx
movb $0x1, (%rax,%rcx)
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl $0x0, 0x18(%rax)
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq $0x0, 0x20(%rax)
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq $0x0, 0x30(%rax)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x8611
jmp 0x87f3
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x8600
movl -0x20(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)