// File: /workspace/github_c_makefile_star2_O1/cbouilla[P]AES-attacks-finder/Equation.c
// Function: addEq
Equation addEq(Equation a, Equation b)
{	
	Equation p=malloc(sizeof(EQUATION));
	p->nV=a->nV+b->nV;
	if (p->nV!=0)
	{
		p->var=malloc(p->nV*sizeof(int));
		p->coefV=malloc(p->nV*sizeof(unsigned char));
		int i;
		for (i = 0; i < a->nV; i++)
		{
			p->var[i]=a->var[i];
			p->coefV[i]=a->coefV[i];
		}
		int k=a->nV;
		for (i = 0; i < b->nV; i++)
		{
			p->var[i+k]=b->var[i];
			p->coefV[i+k]=b->coefV[i];
		}
	}
	else
	{
		p->var=NULL;
		p->coefV=NULL;
	}
	p->nS=a->nS+b->nS;
	if (p->nS!=0)
	{
		p->S=malloc(p->nS*sizeof(Equation));
		p->coefS=malloc(p->nS*sizeof(unsigned char));
		p->sbox=malloc(p->nS*sizeof(unsigned char));
		int i;
		for (i = 0; i < a->nS; i++)
		{
			p->sbox[i]=a->sbox[i];
			p->coefS[i]=a->coefS[i];
			p->S[i]=copyEq(a->S[i]);
		}
		int k=a->nS;
		for (i = 0; i < b->nS; i++)
		{
			p->sbox[i+k]=b->sbox[i];
			p->coefS[i+k]=b->coefS[i];
			p->S[i+k]=copyEq(b->S[i]);
		}
	}
	else
	{
		p->S=NULL;
		p->coefS=NULL;
		p->sbox=NULL;
	}
	Equation pp=reduitEq(p);
	freeEq(p);
	return pp;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r15
movl $0x38, %edi
callq 0x21d0
movq %rax, %rbx
movslq (%r15), %rax
movslq (%r14), %r12
addq %rax, %r12
movl %r12d, (%rbx)
testl %r12d, %r12d
je 0x52d5
leaq (,%r12,4), %rdi
callq 0x21d0
movq %rax, 0x8(%rbx)
movq %r12, %rdi
callq 0x21d0
movq %rax, 0x10(%rbx)
movl (%r15), %ecx
testl %ecx, %ecx
jle 0x529e
xorl %eax, %eax
movq 0x8(%r15), %rcx
movl (%rcx,%rax,4), %ecx
movq 0x8(%rbx), %rdx
movl %ecx, (%rdx,%rax,4)
movq 0x10(%r15), %rcx
movb (%rcx,%rax), %cl
movq 0x10(%rbx), %rdx
movb %cl, (%rdx,%rax)
incq %rax
movslq (%r15), %rcx
cmpq %rcx, %rax
jl 0x5277
cmpl $0x0, (%r14)
jle 0x52dc
movslq %ecx, %rax
xorl %ecx, %ecx
movq 0x8(%r14), %rdx
movl (%rdx,%rcx,4), %edx
movq 0x8(%rbx), %rsi
movl %edx, (%rsi,%rax,4)
movq 0x10(%r14), %rdx
movb (%rdx,%rcx), %dl
movq 0x10(%rbx), %rsi
movb %dl, (%rsi,%rax)
incq %rcx
movslq (%r14), %rdx
incq %rax
cmpq %rdx, %rcx
jl 0x52a9
jmp 0x52dc
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rbx)
movslq 0x18(%r15), %rax
movslq 0x18(%r14), %r12
addq %rax, %r12
movl %r12d, 0x18(%rbx)
testl %r12d, %r12d
je 0x53bc
leaq (,%r12,8), %rdi
callq 0x21d0
movq %rax, 0x20(%rbx)
movq %r12, %rdi
callq 0x21d0
movq %rax, 0x28(%rbx)
movq %r12, %rdi
callq 0x21d0
movq %rax, 0x30(%rbx)
movl 0x18(%r15), %eax
testl %eax, %eax
jle 0x5369
xorl %r12d, %r12d
movq 0x30(%r15), %rax
movb (%rax,%r12), %al
movq 0x30(%rbx), %rcx
movb %al, (%rcx,%r12)
movq 0x28(%r15), %rax
movb (%rax,%r12), %al
movq 0x28(%rbx), %rcx
movb %al, (%rcx,%r12)
movq 0x20(%r15), %rax
movq (%rax,%r12,8), %rdi
callq 0x48c5
movq 0x20(%rbx), %rcx
movq %rax, (%rcx,%r12,8)
incq %r12
movslq 0x18(%r15), %rax
cmpq %rax, %r12
jl 0x5328
cmpl $0x0, 0x18(%r14)
jle 0x53cb
movslq %eax, %r15
xorl %r12d, %r12d
movq 0x30(%r14), %rax
movb (%rax,%r12), %al
movq 0x30(%rbx), %rcx
movb %al, (%rcx,%r15)
movq 0x28(%r14), %rax
movb (%rax,%r12), %al
movq 0x28(%rbx), %rcx
movb %al, (%rcx,%r15)
movq 0x20(%r14), %rax
movq (%rax,%r12,8), %rdi
callq 0x48c5
movq 0x20(%rbx), %rcx
movq %rax, (%rcx,%r15,8)
incq %r12
movslq 0x18(%r14), %rax
incq %r15
cmpq %rax, %r12
jl 0x5376
jmp 0x53cb
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rbx)
movq $0x0, 0x30(%rbx)
movq %rbx, %rdi
callq 0x4d1b
movq %rax, %r14
movq %rbx, %rdi
callq 0x484f
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq