// File: /workspace/github_cpp_makefile_star2_O1/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 0x41ea
xorl %ebx, %ebx
leaq -0x80(%rbp), %r14
leaq -0x88(%rbp), %r12
movl 0x8(%r13), %eax
movl %eax, -0x88(%rbp)
leaq 0x10(%r13), %rsi
movq %r14, %rdi
callq 0x4cc4
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq %r12, %rdx
callq 0x59d8
cmpq -0x58(%rbp), %rax
jne 0x41c3
movl -0x88(%rbp), %esi
movq -0x68(%rbp), %rdi
leaq -0x60(%rbp), %rdx
leaq -0x40(%rbp), %rcx
callq 0x3e16
incl %ebx
movq -0x80(%rbp), %rdi
cmpq %r14, %rdi
je 0x41e1
movq (%rdi), %r15
movl $0x18, %esi
callq 0x2160
movq %r15, %rdi
cmpq %r14, %r15
jne 0x41cc
movq (%r13), %r13
testq %r13, %r13
jne 0x417e
movq -0x40(%rbp), %r14
movq -0x38(%rbp), %r15
cmpq %r15, %r14
je 0x4224
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 0x5d45
movq %r14, %rdi
movq %r15, %rsi
callq 0x5e26
movq 0x5da5(%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), %r15
movq -0x38(%rbp), %r12
cmpq %r12, %r15
je 0x42ae
movq 0x5d60(%rip), %rbx      # 0x9fd0
movl (%r15), %esi
movq %rbx, %rdi
callq 0x2250
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
addq $0x4, %r15
cmpq %r12, %r15
jne 0x4270
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x42c3
movq -0x30(%rbp), %rsi
subq %rdi, %rsi
callq 0x2160
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x42d8
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 0x4310
jmp 0x42ed
jmp 0x4310
movq %rax, %rbx
movq -0x80(%rbp), %rdi
cmpq %r14, %rdi
je 0x4313
movq (%rdi), %r15
movl $0x18, %esi
callq 0x2160
movq %r15, %rdi
cmpq %r14, %r15
jne 0x42f9
jmp 0x4313
movq %rax, %rbx
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x4328
movq -0x30(%rbp), %rsi
subq %rdi, %rsi
callq 0x2160
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x433d
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x2160
movq %rbx, %rdi
callq 0x2260
nop