// File: /workspace/github_cpp_makefile_star2_O3/guitld[P]Graph-Algorithms/source/Graph.cpp
// Function: Graph::connected_components()
void Graph::connected_components(){

     // Defining structures for the algorithm
     vector <int> visitedNodes;
     vector <int> componentsSize;
     int numberOfComponents = 0;

     // Looping through the graph. If the current vertex is not marked as visited, then it belongs to a new component
     for (auto node : adj_lists){
          if (find(visitedNodes.begin(), visitedNodes.end(), node.first) == visitedNodes.end()){
               // Calls a DFS to mark new nodes
               DFS_Util_Connected_Components(node.first, visitedNodes, componentsSize);
               numberOfComponents++;
          }
     }

     // Sorting the components in descending order
     sort(componentsSize.begin(), componentsSize.end(), greater<int>());
     cout << numberOfComponents << endl;
     for (auto elem : componentsSize){
          cout << elem << endl;
     }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
xorps %xmm0, %xmm0
movaps %xmm0, -0x60(%rbp)
xorl %ebx, %ebx
movq %rbx, -0x50(%rbp)
movq %rbx, -0x30(%rbp)
movaps %xmm0, -0x40(%rbp)
movq %rdi, -0x68(%rbp)
movq 0x10(%rdi), %r13
testq %r13, %r13
je 0x405e
leaq -0x80(%rbp), %r14
leaq -0x88(%rbp), %r12
movl 0x8(%r13), %eax
movl %eax, -0x88(%rbp)
leaq 0x10(%r13), %rsi
movq %r14, %rdi
callq 0x4b00
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq %r12, %rdx
callq 0x5811
cmpq -0x58(%rbp), %rax
jne 0x3ffb
movl -0x88(%rbp), %esi
movq -0x68(%rbp), %rdi
leaq -0x60(%rbp), %rdx
leaq -0x40(%rbp), %rcx
callq 0x3c9e
incl %ebx
movq -0x80(%rbp), %rdi
cmpq %r14, %rdi
je 0x4019
movq (%rdi), %r15
movl $0x18, %esi
callq 0x2160
movq %r15, %rdi
cmpq %r14, %r15
jne 0x4004
movq (%r13), %r13
testq %r13, %r13
jne 0x3fb6
movq -0x40(%rbp), %r14
movq -0x38(%rbp), %r15
cmpq %r15, %r14
je 0x4060
movq %r15, %rax
subq %r14, %rax
sarq $0x2, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x5b6f
movq %r14, %rdi
movq %r15, %rsi
callq 0x5c50
jmp 0x4060
xorl %ebx, %ebx
movq 0x5f69(%rip), %rdi      # 0x9fd0
movl %ebx, %esi
callq 0x2250
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
movq -0x40(%rbp), %rbx
movq -0x38(%rbp), %r12
cmpq %r12, %rbx
je 0x40ed
movq 0x5f24(%rip), %r14      # 0x9fd0
movl (%rbx), %esi
movq %r14, %rdi
callq 0x2250
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
addq $0x4, %rbx
cmpq %r12, %rbx
jne 0x40ac
movq -0x40(%rbp), %rbx
testq %rbx, %rbx
je 0x4101
movq -0x30(%rbp), %rsi
subq %rbx, %rsi
movq %rbx, %rdi
callq 0x2160
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x4116
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x2160
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x414e
jmp 0x412b
jmp 0x414e
movq %rax, %rbx
movq -0x80(%rbp), %rdi
cmpq %r14, %rdi
je 0x4151
movq (%rdi), %r15
movl $0x18, %esi
callq 0x2160
movq %r15, %rdi
cmpq %r14, %r15
jne 0x4137
jmp 0x4151
movq %rax, %rbx
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x4166
movq -0x30(%rbp), %rsi
subq %rdi, %rsi
callq 0x2160
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x417b
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x2160
movq %rbx, %rdi
callq 0x2260
nop