// File: /workspace/github_c_makefile_star2_O1/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 $0x38, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rax
callq *0x40(%rax)
movl %eax, %r15d
xorps %xmm0, %xmm0
leaq -0x40(%rbp), %r12
movaps %xmm0, (%r12)
movq $0x0, 0x10(%r12)
movq %rbx, -0x50(%rbp)
movq %rbx, %rdi
callq 0x6bca
movq %r14, %rdi
movq %r12, %rsi
callq 0x6396
movq %rsp, -0x48(%rbp)
movq -0x38(%rbp), %rbx
subq -0x40(%rbp), %rbx
sarq $0x3, %rbx
movl %ebx, %eax
movq %rsp, %r14
addq $0xf, %rax
andq $-0x10, %rax
subq %rax, %r14
movq %r14, %rsp
testl %ebx, %ebx
jle 0x6a31
movl %ebx, %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movq %r14, %rdi
xorl %esi, %esi
callq 0x2120
movq %rbx, %r8
testl %r15d, %r15d
jle 0x6b5a
movl %r15d, %r13d
movl $0x1, %r9d
xorl %ebx, %ebx
movq -0x50(%rbp), %r15
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %r8
subq %rax, %r8
shrq $0x3, %r8
testl %r8d, %r8d
jle 0x6b1a
movl %r8d, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
xorl %edx, %edx
cmpb $0x0, (%r14,%rdx)
jne 0x6a86
movq (%rax,%rdx,8), %rsi
movsbq (%rsi,%rbx), %rsi
movl %esi, %esi
cmpq %rsi, %rbx
jne 0x6a93
incq %rdx
cmpq %rdx, %rcx
jne 0x6a6f
jmp 0x6b1a
leaq 0x1(%rbx), %rax
movq %r9, %r12
cmpq %r13, %rax
movq %r8, -0x60(%rbp)
movq %r9, -0x58(%rbp)
jae 0x6b1a
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
subq %rax, %rcx
shrq $0x3, %rcx
testl %ecx, %ecx
jle 0x6b12
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
xorl %edx, %edx
cmpb $0x0, (%r14,%rdx)
jne 0x6ad9
movq (%rax,%rdx,8), %rsi
movsbq (%rsi,%rbx), %rsi
movl %esi, %esi
cmpq %rsi, %r12
je 0x6ae3
incq %rdx
cmpq %rdx, %rcx
jne 0x6ac2
jmp 0x6b12
movl $0x18, %edi
callq 0x21f0
movq %r12, %rcx
shlq $0x20, %rcx
orq %rbx, %rcx
movq %rcx, 0x10(%rax)
movq %rax, %rdi
movq %r15, %rsi
callq 0x2070
incq 0x10(%r15)
movq -0x60(%rbp), %r8
movq -0x58(%rbp), %r9
incq %r12
cmpq %r13, %r12
jne 0x6aa7
testl %r8d, %r8d
jle 0x6b4b
movq -0x40(%rbp), %rax
movl %r8d, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
xorl %edx, %edx
movq (%rax,%rdx,8), %rsi
movsbq (%rsi,%rbx), %rsi
movl %esi, %esi
cmpq %rsi, %rbx
je 0x6b43
movb $0x1, (%r14,%rdx)
incq %rdx
cmpq %rdx, %rcx
jne 0x6b2e
incq %rbx
incq %r9
cmpq %r13, %rbx
jne 0x6a4c
testl %r8d, %r8d
jle 0x6b7f
movl %r8d, %ebx
xorl %r14d, %r14d
movq -0x40(%rbp), %rax
movq (%rax,%r14,8), %rdi
testq %rdi, %rdi
je 0x6b77
callq 0x2290
incq %r14
cmpq %r14, %rbx
jne 0x6b65
movq -0x48(%rbp), %rsp
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x6b98
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 0x6ba9
movq %rax, %rbx
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x6bc1
movq -0x30(%rbp), %rsi
subq %rdi, %rsi
callq 0x2200
movq %rbx, %rdi
callq 0x2370
nop