// File: /workspace/github_cpp_makefile_star2_O1/Manca[P]algorithms1/./assignment4.hpp
// Function: assignment4::computeSCC(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void computeSCC(const string& fileName)
    {
        cout << "***** ASSIGNMENT4 MAIN TEST CASE *****" << endl;
        // load from file
        Graph G, Grev;
        ifstream file(fileName, ios::in);
        for (int i = 1; i < NUM_NODES; i++)
        {
            G[i] = std::vector<int>();
            Grev[i] = std::vector<int>();
        }
        
        cout << "Reading file..." << endl;
        std::chrono::steady_clock::time_point start = std::chrono::steady_clock::now();
        if (file.is_open())
        {
            std::string rawInput;
            int tail, head;
            while (getline(file, rawInput))
            {
                std::istringstream is(rawInput);

                is >> tail;
                is >> head;
                
                G[tail].push_back(head);
                Grev[head].push_back(tail);
            }
            file.close();
        }
        std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();
        std::cout << "Done. Time took to read the whole file and construct two graphs: "
        << std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count()
        << "ms.\n";
        
        // initialize global vars
        _seen       = seenList(G.size() + 1, 0);
        _times      = timesList(G.size() + 1, 0);
        _leaders    = leadersList(G.size() + 1, 0);
 
        DFSLoop(Grev);
        
        Graph newGraph = constructNewGraph(G, _times);
        DFSLoop(newGraph);
        
        sort(_leaders.begin(), _leaders.end());
        std::vector<SCC> SCCs;
        int el = _leaders[1];
        int elCnt = 1;
        for (size_t i = 2; i < _leaders.size(); i++)
        {
            if (_leaders[i] == el)
                elCnt++;
            else
            {
                SCC scc;
                scc.leader = el;
                scc.numNodes = elCnt;
                SCCs.push_back(scc);
                
                el = _leaders[i];
                elCnt = 1;
            }
        }
        // last SCC
        SCC scc;
        scc.leader = el;
        scc.numNodes = elCnt;
        SCCs.push_back(scc);
        
        cout << " Total number of SCCs is: " << SCCs.size() << endl << "Top 5 are: " << endl;
        
        // Let's just sort them in descending order by number of components
        sort(SCCs.begin(), SCCs.end(), compareByNumSCCs);
        
        for (int i = 0; i < 5; i++)
        {
            cout << "SCC with leader " << SCCs[i].leader << " has " << SCCs[i].numNodes << " nodes." << endl;
        }
        
        // Correct result is: 434821,968,459,313,211
        assert(SCCs[0].numNodes == 434821);
        assert(SCCs[1].numNodes == 968);
        assert(SCCs[2].numNodes == 459);
        assert(SCCs[3].numNodes == 313);
        assert(SCCs[4].numNodes == 211);
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x428, %rsp            # imm = 0x428
movq %rdi, %r14
movq 0xa1fe(%rip), %rbx      # 0xdfd8
leaq 0x63cf(%rip), %rsi      # 0xa1b0
movl $0x26, %edx
movq %rbx, %rdi
callq 0x2200
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2140
leaq 0x48(%rsp), %rax
xorl %ecx, %ecx
movl %ecx, (%rax)
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
leaq 0x78(%rsp), %rax
movl %ecx, (%rax)
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
leaq 0x220(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movl $0x8, %edx
callq 0x22b0
leaq 0xa0(%rsp), %r14
movl $0x1, (%r14)
leaq 0x40(%rsp), %r15
leaq 0x70(%rsp), %r12
movq %r15, %rdi
movq %r14, %rsi
callq 0x6240
movq (%rax), %rdi
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
testq %rdi, %rdi
je 0x3e9c
callq 0x21b0
movq %r12, %rdi
movq %r14, %rsi
callq 0x6240
movq (%rax), %rdi
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
testq %rdi, %rdi
je 0x3ec2
callq 0x21b0
movl 0xa0(%rsp), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0xa0(%rsp)
cmpl $0xd5cc2, %eax          # imm = 0xD5CC2
jl 0x3e76
movq 0xa0f7(%rip), %r14      # 0xdfd8
leaq 0x62ef(%rip), %rsi      # 0xa1d7
movl $0xf, %edx
movq %r14, %rdi
callq 0x2200
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
movq 0xa0c5(%rip), %rdi      # 0xdfd8
callq 0x2030
movq %rax, %rdi
callq 0x2140
callq 0x2240
movq %rax, 0x38(%rsp)
leaq 0x298(%rsp), %rdi
callq 0x2070
testb %al, %al
je 0x4072
leaq 0x20(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x10(%rsp), %r12
leaq 0xa0(%rsp), %r13
leaq 0x8(%rsp), %rbp
leaq 0x34(%rsp), %r14
movq 0xa05f(%rip), %r15      # 0xdfd0
movq 0x220(%rsp), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2340
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x4051
movq %r13, %rdi
movq %r12, %rsi
movl $0x8, %edx
callq 0x22e0
movq %r13, %rdi
movq %rbp, %rsi
callq 0x2110
movq %r13, %rdi
movq %r14, %rsi
callq 0x2110
leaq 0x40(%rsp), %rdi
movq %rbp, %rsi
callq 0x6240
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0x3ff7
movl 0x34(%rsp), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rax)
jmp 0x4002
movq %rax, %rdi
movq %r14, %rdx
callq 0x739e
leaq 0x70(%rsp), %rdi
movq %r14, %rsi
callq 0x6240
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0x4029
movl 0x8(%rsp), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rax)
jmp 0x4034
movq %rax, %rdi
movq %rbp, %rdx
callq 0x739e
movq %r13, %rdi
movq %r15, %rsi
callq 0x2270
leaq 0x118(%rsp), %rdi
callq 0x20a0
jmp 0x3f71
leaq 0x220(%rsp), %rdi
callq 0x2060
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x4072
callq 0x21b0
callq 0x2240
movq %rax, %rbx
movq 0x9f57(%rip), %rdi      # 0xdfd8
leaq 0x615f(%rip), %rsi      # 0xa1e7
movl $0x41, %edx
callq 0x2200
subq 0x38(%rsp), %rbx
movabsq $0x431bde82d7b634db, %rcx # imm = 0x431BDE82D7B634DB
movq %rbx, %rax
imulq %rcx
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x12, %rdx
addq %rdx, %rsi
movq 0x9f1c(%rip), %rdi      # 0xdfd8
callq 0x21c0
leaq 0x6161(%rip), %rsi      # 0xa229
movl $0x4, %edx
movq %rax, %rdi
callq 0x2200
movq 0x68(%rsp), %rsi
incq %rsi
leaq 0x10(%rsp), %rdx
movl $0x0, (%rdx)
leaq 0xa0(%rsp), %rdi
leaq 0x8(%rsp), %rcx
callq 0x62a4
movq 0xa10f(%rip), %rdi      # 0xe210
movaps 0xa0(%rsp), %xmm0
movq 0xb0(%rsp), %rax
movq %rdi, 0xa0(%rsp)
movups 0xa0f8(%rip), %xmm1     # 0xe218
movaps %xmm0, 0xa0e9(%rip)     # 0xe210
movq %rax, 0xa0f2(%rip)      # 0xe220
movups %xmm1, 0xa8(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0xa0(%rsp)
movq $0x0, 0xb0(%rsp)
testq %rdi, %rdi
je 0x4157
callq 0x21b0
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x4169
callq 0x21b0
movq 0x68(%rsp), %rsi
incq %rsi
leaq 0x10(%rsp), %rdx
movl $0x0, (%rdx)
leaq 0xa0(%rsp), %rdi
leaq 0x8(%rsp), %rcx
callq 0x62a4
movq 0xa05b(%rip), %rdi      # 0xe1f0
movaps 0xa0(%rsp), %xmm0
movq 0xb0(%rsp), %rax
movq %rdi, 0xa0(%rsp)
movups 0xa044(%rip), %xmm1     # 0xe1f8
movaps %xmm0, 0xa035(%rip)     # 0xe1f0
movq %rax, 0xa03e(%rip)      # 0xe200
movups %xmm1, 0xa8(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0xa0(%rsp)
movq $0x0, 0xb0(%rsp)
testq %rdi, %rdi
je 0x41eb
callq 0x21b0
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x41fd
callq 0x21b0
movq 0x68(%rsp), %rsi
incq %rsi
leaq 0x10(%rsp), %rdx
movl $0x0, (%rdx)
leaq 0xa0(%rsp), %rdi
leaq 0x8(%rsp), %rcx
callq 0x62a4
movq 0xa007(%rip), %rdi      # 0xe230
movaps 0xa0(%rsp), %xmm0
movq 0xb0(%rsp), %rax
movq %rdi, 0xa0(%rsp)
movups 0x9ff0(%rip), %xmm1     # 0xe238
movaps %xmm0, 0x9fe1(%rip)     # 0xe230
movq %rax, 0x9fea(%rip)      # 0xe240
movups %xmm1, 0xa8(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0xa0(%rsp)
movq $0x0, 0xb0(%rsp)
testq %rdi, %rdi
je 0x427f
callq 0x21b0
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x4291
callq 0x21b0
leaq 0x70(%rsp), %rdi
callq 0x2b35
leaq 0x9f4e(%rip), %rdx      # 0xe1f0
leaq 0xa0(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x2c0a
leaq 0xa0(%rsp), %rdi
callq 0x2b35
movq 0x9f68(%rip), %rbx      # 0xe230
movq 0x9f69(%rip), %r14      # 0xe238
cmpq %r14, %rbx
je 0x4301
movq %r14, %rax
subq %rbx, %rax
sarq $0x2, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7f17
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7ffa
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x9f17(%rip), %rdx      # 0xe230
movl 0x4(%rdx), %eax
movq 0x9f15(%rip), %rsi      # 0xe238
subq %rdx, %rsi
movl $0x1, %ecx
cmpq $0x9, %rsi
jb 0x43a7
movl $0x2, %r15d
leaq 0x10(%rsp), %rbx
leaq 0x8(%rsp), %r14
cmpl %eax, (%rdx,%r15,4)
jne 0x434b
incl %ecx
jmp 0x438a
movl %eax, 0x8(%rsp)
movl %ecx, 0xc(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x436f
movq 0x8(%rsp), %rax
movq %rax, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x437a
movq %rbx, %rdi
movq %r14, %rdx
callq 0x826a
movq 0x9eaf(%rip), %rax      # 0xe230
movl (%rax,%r15,4), %eax
movl $0x1, %ecx
incq %r15
movq 0x9ea4(%rip), %rsi      # 0xe238
movq 0x9e95(%rip), %rdx      # 0xe230
subq %rdx, %rsi
sarq $0x2, %rsi
cmpq %rsi, %r15
jb 0x4341
movl %eax, 0x8(%rsp)
movl %ecx, 0xc(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x43cb
movq 0x8(%rsp), %rax
movq %rax, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x43da
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x826a
movq 0x9bf7(%rip), %rdi      # 0xdfd8
leaq 0x5e46(%rip), %rsi      # 0xa22e
movl $0x1a, %edx
callq 0x2200
movq 0x18(%rsp), %rsi
subq 0x10(%rsp), %rsi
sarq $0x3, %rsi
movq 0x9bd1(%rip), %rdi      # 0xdfd8
callq 0x2130
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2140
movq %rax, %rbx
leaq 0x5e09(%rip), %rsi      # 0xa249
movl $0xb, %edx
movq %rax, %rdi
callq 0x2200
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2140
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %r14
cmpq %r14, %rbx
je 0x44be
movq %r14, %rax
subq %rbx, %rax
sarq $0x3, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
leaq -0x171b(%rip), %rcx     # 0x2d86
movq %rbx, %rdi
movq %r14, %rsi
callq 0x839f
leaq -0x172d(%rip), %rdx     # 0x2d86
movq %rbx, %rdi
movq %r14, %rsi
callq 0x84d0
xorl %ebp, %ebp
movq 0x9b11(%rip), %rbx      # 0xdfd8
leaq 0x5c94(%rip), %r14      # 0xa162
leaq 0x5c9e(%rip), %r15      # 0xa173
leaq 0x5c9d(%rip), %r12      # 0xa179
movl $0x10, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2200
movq 0x10(%rsp), %rax
movl (%rax,%rbp,8), %esi
movq %rbx, %rdi
callq 0x2300
movq %rax, %r13
movl $0x5, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x2200
movq 0x10(%rsp), %rax
movl 0x4(%rax,%rbp,8), %esi
movq %r13, %rdi
callq 0x2300
movq %rax, %r13
movl $0x7, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x2200
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
movq %r13, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2140
incq %rbp
cmpq $0x5, %rbp
jne 0x44dc
movq 0x10(%rsp), %rdi
cmpl $0x6a285, 0x4(%rdi)     # imm = 0x6A285
jne 0x45f4
cmpl $0x3c8, 0xc(%rdi)       # imm = 0x3C8
jne 0x4613
cmpl $0x1cb, 0x14(%rdi)      # imm = 0x1CB
jne 0x4632
cmpl $0x139, 0x1c(%rdi)      # imm = 0x139
jne 0x4651
cmpl $0xd3, 0x24(%rdi)
jne 0x4670
testq %rdi, %rdi
je 0x45b4
callq 0x21b0
leaq 0xa0(%rsp), %rdi
callq 0x6c8e
leaq 0x220(%rsp), %rdi
callq 0x2080
leaq 0x70(%rsp), %rdi
callq 0x6c8e
leaq 0x40(%rsp), %rdi
callq 0x6c8e
addq $0x428, %rsp            # imm = 0x428
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5c5a(%rip), %rdi      # 0xa255
leaq 0x5a8d(%rip), %rsi      # 0xa08f
leaq 0x5c67(%rip), %rcx      # 0xa270
movl $0x16c, %edx            # imm = 0x16C
callq 0x2120
leaq 0x5c83(%rip), %rdi      # 0xa29d
leaq 0x5a6e(%rip), %rsi      # 0xa08f
leaq 0x5c48(%rip), %rcx      # 0xa270
movl $0x16d, %edx            # imm = 0x16D
callq 0x2120
leaq 0x5c7c(%rip), %rdi      # 0xa2b5
leaq 0x5a4f(%rip), %rsi      # 0xa08f
leaq 0x5c29(%rip), %rcx      # 0xa270
movl $0x16e, %edx            # imm = 0x16E
callq 0x2120
leaq 0x5c75(%rip), %rdi      # 0xa2cd
leaq 0x5a30(%rip), %rsi      # 0xa08f
leaq 0x5c0a(%rip), %rcx      # 0xa270
movl $0x16f, %edx            # imm = 0x16F
callq 0x2120
leaq 0x5c6e(%rip), %rdi      # 0xa2e5
leaq 0x5a11(%rip), %rsi      # 0xa08f
leaq 0x5beb(%rip), %rcx      # 0xa270
movl $0x170, %edx            # imm = 0x170
callq 0x2120
jmp 0x46b2
jmp 0x46b9
jmp 0x46b9
jmp 0x46b9
jmp 0x46b9
movq %rax, %rbx
jmp 0x4724
jmp 0x46b9
jmp 0x46b9
movq %rax, %rbx
jmp 0x470a
jmp 0x46f8
jmp 0x46b9
jmp 0x46f8
jmp 0x46b2
movq %rax, %rbx
jmp 0x46e2
jmp 0x46b9
movq %rax, %rbx
jmp 0x4717
movq %rax, %rbx
movq 0x9908(%rip), %rsi      # 0xdfd0
leaq 0xa0(%rsp), %rdi
callq 0x2270
leaq 0x118(%rsp), %rdi
callq 0x20a0
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x4717
callq 0x21b0
jmp 0x4717
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x470a
callq 0x21b0
leaq 0xa0(%rsp), %rdi
callq 0x6c8e
leaq 0x220(%rsp), %rdi
callq 0x2080
leaq 0x70(%rsp), %rdi
callq 0x6c8e
leaq 0x40(%rsp), %rdi
callq 0x6c8e
movq %rbx, %rdi
callq 0x2310