// File: /workspace/github_c_makefile_star2_O3/ComplexNetworks-DCC-FCUP[P]gtrieScanner/Conditions.cpp
// Function: Conditions::symmetryConditions(Graph*, std::__cxx11::list<std::pair<int, int>, std::allocator<std::pair<int, int>>>*)
void Conditions::symmetryConditions(Graph *g, list<iPair> *cond) {
  int i, j, k, vvsize, size = g->numNodes();
  iPair p;
  VVsmallNode vv;

  cond->clear();
  findAutomorphisms(g, &vv);

  vvsize = vv.size();
  bool broken[vvsize];
  for (i=0; i<vvsize; i++) broken[i]=false;
  
  for (i=0; i<size; i++) {
    vvsize = vv.size();
    for (j=0; j<vvsize; j++)
      if (!broken[j] && vv[j][i] != i) 
	break;
      
      // There are still nodes not fixed
      if (j<vvsize)
	for (k=i+1; k<size; k++) 
	  for (j=0; j<int(vv.size()); j++)
	    if (!broken[j] && vv[j][i] == k) {
	      p.first  = i;
	      p.second = k;
	      //printf("%d < %d\n", p.first, p.second);
	      cond->push_back(p);
	      break;
	    }
      
      // Reduce set of automorphisms to set that fix 'i'
      for (j=0; j<vvsize; j++)	
	if (vv[j][i] != i)
	  broken[j]=true;
  }

  for (j=0; j<vvsize; j++)
    delete [] vv[j];
  
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r15
movq %rdi, %r14
movq (%rdi), %rax
callq *0x40(%rax)
movl %eax, %ebx
xorps %xmm0, %xmm0
leaq -0x40(%rbp), %r12
movaps %xmm0, (%r12)
movq $0x0, 0x10(%r12)
movq %r15, -0x60(%rbp)
movq %r15, %rdi
callq 0x6cdc
movq %r14, %rdi
movq %r12, %rsi
callq 0x64e6
movq %rsp, -0x58(%rbp)
movq -0x38(%rbp), %r15
subq -0x40(%rbp), %r15
sarq $0x3, %r15
movl %r15d, %eax
movq %rsp, %r14
addq $0xf, %rax
andq $-0x10, %rax
subq %rax, %r14
movq %r14, %rsp
testl %r15d, %r15d
jle 0x6b4d
movl %r15d, %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movq %r14, %rdi
xorl %esi, %esi
callq 0x2120
testl %ebx, %ebx
jle 0x6c6d
movl %ebx, %eax
movq %rax, -0x48(%rbp)
movl $0x1, %esi
xorl %ebx, %ebx
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %r15
subq %rax, %r15
shrq $0x3, %r15
testl %r15d, %r15d
jle 0x6c5d
movq %rsi, -0x50(%rbp)
movq %r15, -0x68(%rbp)
movl %r15d, %r13d
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
xorl %ecx, %ecx
cmpb $0x0, (%r14,%rcx)
jne 0x6ba5
movq (%rax,%rcx,8), %rdx
movsbq (%rdx,%rbx), %rdx
movl %edx, %edx
cmpq %rdx, %rbx
jne 0x6baf
incq %rcx
cmpq %rcx, %r13
jne 0x6b8e
jmp 0x6c2d
leaq 0x1(%rbx), %rax
movq -0x50(%rbp), %r12
cmpq -0x48(%rbp), %rax
jae 0x6c2d
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
subq %rax, %rcx
shrq $0x3, %rcx
testl %ecx, %ecx
jle 0x6c24
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
xorl %edx, %edx
cmpb $0x0, (%r14,%rdx)
jne 0x6bef
movq (%rax,%rdx,8), %rsi
movsbq (%rsi,%rbx), %rsi
movl %esi, %esi
cmpq %rsi, %r12
je 0x6bf9
incq %rdx
cmpq %rdx, %rcx
jne 0x6bd8
jmp 0x6c24
movl $0x18, %edi
callq 0x21f0
movq %r12, %rcx
shlq $0x20, %rcx
orq %rbx, %rcx
movq %rcx, 0x10(%rax)
movq %rax, %rdi
movq -0x60(%rbp), %r15
movq %r15, %rsi
callq 0x2070
incq 0x10(%r15)
incq %r12
cmpq -0x48(%rbp), %r12
jne 0x6bbd
movq -0x68(%rbp), %r15
testl %r15d, %r15d
movq -0x50(%rbp), %rsi
jle 0x6c5d
movq -0x40(%rbp), %rax
xorl %ecx, %ecx
movq (%rax,%rcx,8), %rdx
movsbq (%rdx,%rbx), %rdx
movl %edx, %edx
cmpq %rdx, %rbx
je 0x6c55
movb $0x1, (%r14,%rcx)
incq %rcx
cmpq %rcx, %r13
jne 0x6c40
incq %rbx
incq %rsi
cmpq -0x48(%rbp), %rbx
jne 0x6b62
testl %r15d, %r15d
jle 0x6c92
movl %r15d, %ebx
xorl %r14d, %r14d
movq -0x40(%rbp), %rax
movq (%rax,%r14,8), %rdi
testq %rdi, %rdi
je 0x6c8a
callq 0x2290
incq %r14
cmpq %r14, %rbx
jne 0x6c78
movq -0x58(%rbp), %rsp
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x6cab
movq -0x30(%rbp), %rsi
subq %rdi, %rsi
callq 0x2200
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6cbc
movq %rax, %rbx
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x6cd4
movq -0x30(%rbp), %rsi
subq %rdi, %rsi
callq 0x2200
movq %rbx, %rdi
callq 0x2370