// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/statistics.c
// Function: connected_components
int connected_components(Linkptr edges, int nodecount)
{
 /*Last Changed 12.03.2004*/
 int** components, i, j, *counts, compcount = 0, compf, comps;
 Linkptr e;
 components = (int **)safemalloc_2d(sizeof(int *), sizeof(int), nodecount, nodecount, "connected_components", 3);
 counts = (int *)safemalloc(nodecount * sizeof(int), "connected_components", 4);
 for (i = 0; i < nodecount; i++)
  {
   components[i][0] = i;
   counts[i] = 1;
  }
 e = edges;
 while (e)
  {
   for (i = 0; i < nodecount; i++)
     for (j = 0; j < counts[i]; j++)
       if (components[i][j] == e->from)
        {
         compf = i;
         i = nodecount;
         break;
        }
   for (i = 0; i < nodecount; i++)
     for (j = 0; j < counts[i]; j++)
       if (components[i][j] == e->to)
        {
         comps = i;
         i = nodecount;
         break;
        }
   if (compf != comps)
    {
     components[compf] = alloc(components[compf], (counts[compf] + counts[comps]) * sizeof(int), counts[compf] + counts[comps]);
     for (i = 0; i < counts[comps]; i++)
       components[compf][counts[compf] + i] = components[comps][i];
     counts[compf] = counts[compf] + counts[comps];
     safe_free(components[comps]);
     counts[comps] = 0;
    }
   e = e->next;
  }
 for (i = 0; i < nodecount; i++)
   if (counts[i] > 0)
     safe_free(components[i]);
 safe_free(components);
 for (i = 0; i < nodecount; i++)
   if (counts[i] > 0)
     compcount++;
 safe_free(counts);
 return compcount;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0xc(%rbp), %edx
movl -0xc(%rbp), %ecx
movl $0x8, %edi
movl $0x4, %esi
leaq 0x2b319(%rip), %r8      # 0xeddb6
movl $0x3, %r9d
callq 0x53120
movq %rax, -0x18(%rbp)
movslq -0xc(%rbp), %rdi
shlq $0x2, %rdi
leaq 0x2b2fb(%rip), %rsi     # 0xeddb6
movl $0x4, %edx
callq 0x52d70
movq %rax, -0x28(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0xc2b03
movl -0x1c(%rbp), %ecx
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movl %ecx, (%rax)
movq -0x28(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl $0x1, (%rax,%rcx,4)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xc2ad0
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0xc2cef
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0xc2b7f
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x28(%rbp), %rcx
movslq -0x1c(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0xc2b72
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x40(%rbp), %rcx
cmpl (%rcx), %eax
jne 0xc2b65
movl -0x1c(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x1c(%rbp)
jmp 0xc2b72
jmp 0xc2b67
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xc2b2c
jmp 0xc2b74
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xc2b1d
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0xc2be9
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x28(%rbp), %rcx
movslq -0x1c(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0xc2bdc
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x40(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jne 0xc2bcf
movl -0x1c(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x1c(%rbp)
jmp 0xc2bdc
jmp 0xc2bd1
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xc2b95
jmp 0xc2bde
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xc2b86
movl -0x30(%rbp), %eax
cmpl -0x34(%rbp), %eax
je 0xc2cde
movq -0x18(%rbp), %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x28(%rbp), %rax
movslq -0x30(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x28(%rbp), %rcx
movslq -0x34(%rbp), %rdx
addl (%rcx,%rdx,4), %eax
movslq %eax, %rsi
shlq $0x2, %rsi
movq -0x28(%rbp), %rax
movslq -0x30(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x28(%rbp), %rax
movslq -0x34(%rbp), %rcx
addl (%rax,%rcx,4), %edx
callq 0x52d10
movq %rax, %rdx
movq -0x18(%rbp), %rax
movslq -0x30(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x28(%rbp), %rcx
movslq -0x34(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0xc2c9d
movq -0x18(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x1c(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x18(%rbp), %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x28(%rbp), %rcx
movslq -0x30(%rbp), %rsi
movl (%rcx,%rsi,4), %ecx
addl -0x1c(%rbp), %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xc2c4f
movq -0x28(%rbp), %rax
movslq -0x30(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x28(%rbp), %rax
movslq -0x34(%rbp), %rcx
addl (%rax,%rcx,4), %edx
movq -0x28(%rbp), %rax
movslq -0x30(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x18(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x52e80
movq -0x28(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0xc2b0b
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0xc2d2a
movq -0x28(%rbp), %rax
movslq -0x1c(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jle 0xc2d1d
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x52e80
jmp 0xc2d1f
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xc2cf6
movq -0x18(%rbp), %rdi
callq 0x52e80
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0xc2d66
movq -0x28(%rbp), %rax
movslq -0x1c(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jle 0xc2d59
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xc2d5b
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xc2d3a
movq -0x28(%rbp), %rdi
callq 0x52e80
movl -0x2c(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)