// File: /workspace/github_c_makefile_star2_O0/cbouilla[P]AES-attacks-finder/Symetric.c
// Function: UpdateSymetricStructure
void UpdateSymetricStructure(Symetric_structure S, SysEqLin E)
{
	if (S!=NULL && S->n_message>1)
	{
		const int NombreDeVariables = E->a/E->gen;
		int i;
		for (i = 0; i < NombreDeVariables; i++)
		{
			printf("\rUpdateSymetricStructure : %d %%",(i*100)/NombreDeVariables);
			fflush(stdout);
			const int v = E->varligne[i];
			const int pos = S->position_by_var[v];
			const int mes = S->message_by_var[v];
			if (mes)
			{
				const int w = S->var_by_message[0][pos];
				if (E->lignevar[w]>=NombreDeVariables)
				{
					int j;
					for (j = 0; j < S->n_message; j++) S->var_by_message[j][pos] = v;
					S->message_by_var[v]=0;
				}
			}
			else
			{
				const int w = S->var_by_message[1][pos];
				if (E->lignevar[w]>=NombreDeVariables)
				{
					int j;
					for (j = 1; j < S->n_message; j++) S->var_by_message[j][pos] = v;
				}
			}
		}
		/*for (i = 0; i < S->n_message; i++)
		{
			int j;
			for (j = 0; j < S->n_var_by_message; j++)
			{
				printf("%03d ",S->var_by_message[i][j]);
			}
			printf("\n");
		}
		getchar();
		printf("\n");*/
		
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x23e3b
movq -0x8(%rbp), %rax
cmpl $0x1, 0xc(%rax)
jle 0x23e3b
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x10(%rbp), %rcx
cltd
idivl 0x10(%rcx)
movl %eax, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x23e39
imull $0x64, -0x18(%rbp), %eax
cltd
idivl -0x14(%rbp)
movl %eax, %esi
leaq 0x1537e(%rip), %rdi     # 0x3907d
movb $0x0, %al
callq 0x2100
movq 0x192bb(%rip), %rax     # 0x3cfc8
movq (%rax), %rdi
callq 0x21d0
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x18(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x1c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x1c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x23dc5
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
movslq -0x20(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x28(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x14(%rbp), %eax
jl 0x23dc3
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jge 0x23db0
movl -0x1c(%rbp), %edx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x23d80
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x1c(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
jmp 0x23e29
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movslq -0x20(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x30(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x14(%rbp), %eax
jl 0x23e27
movl $0x1, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jge 0x23e25
movl -0x1c(%rbp), %edx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x23df5
jmp 0x23e27
jmp 0x23e29
jmp 0x23e2b
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x23ce2
jmp 0x23e3b
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)