// File: /workspace/github_c_makefile_star2_O2/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, %rbx
movq %rdi, %r15
movq (%rdi), %rax
callq *0x40(%rax)
andq $0x0, -0x30(%rbp)
movl %eax, %r14d
xorps %xmm0, %xmm0
leaq -0x50(%rbp), %r12
movaps %xmm0, (%r12)
andq $0x0, 0x10(%r12)
movq %rbx, -0x70(%rbp)
movq %rbx, %rdi
callq 0x664e
movq %r15, %rdi
movq %r12, %rsi
callq 0x5ed4
movq %rsp, -0x58(%rbp)
movq -0x48(%rbp), %r13
subq -0x50(%rbp), %r13
sarq $0x3, %r13
movl %r13d, %eax
movq %rsp, %r12
addq $0xf, %rax
andq $-0x10, %rax
subq %rax, %r12
movq %r12, %rsp
xorl %eax, %eax
testl %r13d, %r13d
movl $0x0, %ecx
cmovgl %r13d, %ecx
cmpq %rax, %rcx
je 0x64ef
movb $0x0, (%r12,%rax)
incq %rax
jmp 0x64e0
xorl %edi, %edi
testl %r14d, %r14d
movl $0x0, %eax
cmovgl %r14d, %eax
movq %rax, -0x68(%rbp)
xorl %ebx, %ebx
cmpq -0x68(%rbp), %rbx
je 0x65d8
movq -0x50(%rbp), %rax
movq -0x48(%rbp), %r13
subq %rax, %r13
shrq $0x3, %r13
testl %r13d, %r13d
movl $0x0, %r15d
cmovgl %r13d, %r15d
xorl %ecx, %ecx
cmpq %rcx, %r15
je 0x65af
cmpb $0x0, (%r12,%rcx)
jne 0x6547
movq (%rax,%rcx,8), %rdx
movsbq (%rdx,%rbx), %rdx
movl %edx, %edx
cmpq %rdx, %rbx
jne 0x654c
incq %rcx
jmp 0x652b
movq %r13, -0x60(%rbp)
movl %ebx, %r13d
incl %r13d
cmpl %r14d, %r13d
jge 0x65a7
movq -0x50(%rbp), %rax
movq -0x48(%rbp), %rcx
subq %rax, %rcx
shrq $0x3, %rcx
testl %ecx, %ecx
cmovlel %edi, %ecx
xorl %edx, %edx
cmpq %rdx, %rcx
je 0x6553
cmpb $0x0, (%r12,%rdx)
jne 0x658a
movq (%rax,%rdx,8), %rsi
movsbl (%rsi,%rbx), %esi
cmpl %esi, %r13d
je 0x658f
incq %rdx
jmp 0x6571
movl %ebx, -0x30(%rbp)
movl %r13d, -0x2c(%rbp)
movq -0x70(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x6666
xorl %edi, %edi
jmp 0x6553
movq -0x50(%rbp), %rax
movq -0x60(%rbp), %r13
xorl %ecx, %ecx
cmpq %rcx, %r15
je 0x65d0
movq (%rax,%rcx,8), %rdx
movsbq (%rdx,%rbx), %rdx
movl %edx, %edx
cmpq %rdx, %rbx
je 0x65cb
movb $0x1, (%r12,%rcx)
incq %rcx
jmp 0x65b1
incq %rbx
jmp 0x6503
xorl %ebx, %ebx
testl %r13d, %r13d
cmovlel %ebx, %r13d
cmpq %rbx, %r13
je 0x65fd
movq -0x50(%rbp), %rax
movq (%rax,%rbx,8), %rdi
testq %rdi, %rdi
je 0x65f8
callq 0x22b0
incq %rbx
jmp 0x65e1
movq -0x58(%rbp), %rsp
leaq -0x50(%rbp), %rdi
callq 0x67cc
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x661b
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x67cc
movq %rbx, %rdi
callq 0x23b0
nop