// File: /workspace/github_cpp_makefile_star2_O3/JenTus[P]TCEM/src_TCEM/allocator.cc
// Function: Cide::allocator::degreeVersionTwo(long long)
double allocator::degreeVersionTwo(int64 rcSampleSize) {


        clock_t begin = clock();
        priority_queue<pair<int, double>, vector<pair<int, double>>, CompareBySecond> heap;

        float totalscore = 0;
        int bestNodeID;
//
        for (int i = 0; i < n; i++) {
            double val = (double) nodeDegree[i];
            std::pair<int, double> pairVal(std::make_pair(i, val));
            heap.push(pairVal);
        }

        std::set<int> rednodes, bluenodes;
        seedSet.clear();
        seedScores.clear();
        //std::set<int> rrRed;
        //std::set<int> rrBlue;
        //int testt;

        //rrRed.reserve(n*k_r);
        //rrBlue.reserve(n*k_b);

        while ((int) seedSet.size() < k_r + k_r) {
            pair<int, double> pairVal = heap.top();
            heap.pop();
            bestNodeID = pairVal.first;
           // for (int j = 0; j < hyperG[bestNodeID].size(); ++j) {
           //     int id = hyperG[bestNodeID][j];
           //     rrRed.insert(id);
           // }

            seedSet.push_back(bestNodeID);
            rednodes.insert(bestNodeID);

            pairVal = heap.top();
            heap.pop();
            bestNodeID = pairVal.first;
           // for (int j = 0; j < hyperG[bestNodeID + n].size(); ++j) {
           //     int id = hyperG[bestNodeID + n][j];
           //     rrBlue.insert(id);
           // }

            seedSet.push_back(bestNodeID);
            bluenodes.insert(bestNodeID);
        }

        while ((int) seedSet.size() < k_r + k_b) {
            pair<int, double> pairVal = heap.top();
            heap.pop();
            bestNodeID = pairVal.first;
           // for (int l = 0; l < hyperG[bestNodeID + n].size(); ++l) {
           //     int id = hyperG[bestNodeID + n][l];
           //     rrBlue.insert(id);
           // }
            seedSet.push_back(bestNodeID);
            bluenodes.insert(bestNodeID);
        }

        /*

        vector<int> rrRedV(rrRed.begin(), rrRed.end());
        vector<int> rrBlueV(rrBlue.begin(), rrBlue.end());

        std::sort(rrRedV.begin(), rrRedV.end());
        std::sort(rrBlueV.begin(), rrBlueV.end());

        testt = intersection_size(rrRedV, rrBlueV);
        cout << "intersection is " << testt;
        */

        int redbluecount = 0;

        vector<int> s1(rednodes.begin(), rednodes.end());
        vector<int> s2(bluenodes.begin(), bluenodes.end());
        sort(s1.begin(), s1.end());
        sort(s2.begin(), s2.end());


        for (int i = 0; i < rcSampleSize; ++i) {
            vector<int> RedList = rcList->at(0)->hyperGT[i];
            vector<int> BlueList = rcList->at(1)->hyperGT[i];

            sort(RedList.begin(), RedList.end());
            sort(BlueList.begin(), BlueList.end());

            if(intersection_size(s1, RedList) >= 1){
                if(intersection_size(s2, BlueList) >= 1){
                    redbluecount +=1;
                }
            }
        }


        //cout << " redBluecount is " << redbluecount << endl;

        totalscore = (float) redbluecount / (float) rcSampleSize;

        // end of extra results
        clock_t end = clock();
        totalDuration = double(end - begin) / CLOCKS_PER_SEC + duration_common; // in seconds
        totalMemory = getCurrentMemoryUsage(); // in MB


        cout << "Total score of degree two is " << totalscore*n << endl;
        std::ostringstream streamObj1;
        streamObj1 << std::fixed << std::setprecision(2)<<totalscore*n;

        writeInMasterOutputFile("DegreeVersionTwo", totalDuration,  totalMemory, streamObj1.str(), rednodes, bluenodes);
        return totalscore;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2e8, %rsp            # imm = 0x2E8
movq %rsi, %r14
movq %rdi, %rbx
callq 0x31d0
movq %rax, 0x18(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x70(%rsp)
movq $0x0, 0x80(%rsp)
cmpl $0x0, 0x68(%rbx)
jle 0x6d62
xorl %r13d, %r13d
leaq 0x70(%rsp), %r15
leaq 0x170(%rsp), %r12
movq 0xd8(%rbx), %rax
movsd (%rax,%r13,8), %xmm0
movl %r13d, 0x170(%rsp)
movsd %xmm0, 0x178(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0xaf6e
incq %r13
movslq 0x68(%rbx), %rax
cmpq %rax, %r13
jl 0x6d2d
leaq 0xc8(%rsp), %rcx
xorl %eax, %eax
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq 0x98(%rsp), %rcx
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
movq 0xa8(%rbx), %rax
cmpq %rax, 0xb0(%rbx)
je 0x6daf
movq %rax, 0xb0(%rbx)
leaq 0xa8(%rbx), %rbp
movq 0xc0(%rbx), %rax
cmpq %rax, 0xc8(%rbx)
je 0x6dcd
movq %rax, 0xc8(%rbx)
movq 0xb0(%rbx), %rax
subq 0xa8(%rbx), %rax
shrq $0x2, %rax
movl 0x78(%rbx), %ecx
addl %ecx, %ecx
cmpl %eax, %ecx
jle 0x6e99
leaq 0x70(%rsp), %rdi
movq (%rdi), %rax
movl (%rax), %r15d
callq 0xb008
movl %r15d, 0xc(%rsp)
movq 0xb0(%rbx), %rsi
cmpq 0xb8(%rbx), %rsi
je 0x6e21
movl %r15d, (%rsi)
addq $0x4, %rsi
movq %rsi, 0xb0(%rbx)
jmp 0x6e2e
leaq 0xc(%rsp), %rdx
movq %rbp, %rdi
callq 0xbd60
leaq 0xc0(%rsp), %rdi
leaq 0xc(%rsp), %rsi
callq 0xbf5a
leaq 0x70(%rsp), %rdi
movq (%rdi), %rax
movl (%rax), %r15d
callq 0xb008
movl %r15d, 0xc(%rsp)
movq 0xb0(%rbx), %rsi
cmpq 0xb8(%rbx), %rsi
je 0x6e75
movl %r15d, (%rsi)
addq $0x4, %rsi
movq %rsi, 0xb0(%rbx)
jmp 0x6e82
leaq 0xc(%rsp), %rdx
movq %rbp, %rdi
callq 0xbd60
leaq 0x90(%rsp), %rdi
leaq 0xc(%rsp), %rsi
callq 0xbf5a
jmp 0x6dcd
movq %r14, 0x10(%rsp)
leaq 0x70(%rsp), %r15
leaq 0xc(%rsp), %r12
leaq 0x90(%rsp), %r13
movq 0xb0(%rbx), %rax
subq 0xa8(%rbx), %rax
shrq $0x2, %rax
movl 0x7c(%rbx), %ecx
addl 0x78(%rbx), %ecx
cmpl %eax, %ecx
jle 0x6f19
movq 0x70(%rsp), %rax
movl (%rax), %r14d
movq %r15, %rdi
callq 0xb008
movl %r14d, 0xc(%rsp)
movq 0xb0(%rbx), %rsi
cmpq 0xb8(%rbx), %rsi
je 0x6f01
movl %r14d, (%rsi)
addq $0x4, %rsi
movq %rsi, 0xb0(%rbx)
jmp 0x6f0c
movq %rbp, %rdi
movq %r12, %rdx
callq 0xbd60
movq %r13, %rdi
movq %r12, %rsi
callq 0xbf5a
jmp 0x6eb0
movq 0xd8(%rsp), %rsi
leaq 0x58(%rsp), %rdi
leaq 0x170(%rsp), %rcx
leaq 0xc8(%rsp), %rdx
callq 0xaeb4
movq 0xa8(%rsp), %rsi
leaq 0x40(%rsp), %rdi
leaq 0x170(%rsp), %rcx
leaq 0x98(%rsp), %rdx
callq 0xaeb4
movq 0x10(%rsp), %r14
movq 0x58(%rsp), %r15
movq 0x60(%rsp), %r12
cmpq %r12, %r15
je 0x6f9e
movq %r12, %rax
subq %r15, %rax
sarq $0x2, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r15, %rdi
movq %r12, %rsi
callq 0xc1e6
movq %r15, %rdi
movq %r12, %rsi
callq 0xc2c9
movq 0x40(%rsp), %r15
movq 0x48(%rsp), %r12
cmpq %r12, %r15
je 0x6fda
movq %r12, %rax
subq %r15, %rax
sarq $0x2, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r15, %rdi
movq %r12, %rsi
callq 0xc1e6
movq %r15, %rdi
movq %r12, %rsi
callq 0xc2c9
testq %r14, %r14
jle 0x71d9
xorl %r12d, %r12d
leaq 0x20(%rsp), %r13
movl $0x0, 0x8(%rsp)
movq 0xae8(%rbx), %rcx
movq (%rcx), %rax
cmpq %rax, 0x8(%rcx)
je 0x7458
movq (%rax), %rax
leaq (%r12,%r12,2), %r15
shlq $0x3, %r15
movq 0x18(%rax), %rsi
addq %r15, %rsi
leaq 0x170(%rsp), %rdi
callq 0xaeee
movq 0xae8(%rbx), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq $0x1, %rdx
jbe 0x746a
movq 0x8(%rax), %rax
addq 0x18(%rax), %r15
movq %r13, %rdi
movq %r15, %rsi
callq 0xaeee
movq 0x170(%rsp), %r15
movq 0x178(%rsp), %rbp
cmpq %rbp, %r15
je 0x709a
movq %rbp, %rax
subq %r15, %rax
sarq $0x2, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r15, %rdi
movq %rbp, %rsi
callq 0xc1e6
movq %r15, %rdi
movq %rbp, %rsi
callq 0xc2c9
movq 0x20(%rsp), %r15
movq 0x28(%rsp), %rbp
cmpq %rbp, %r15
je 0x70d6
movq %rbp, %rax
subq %r15, %rax
sarq $0x2, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r15, %rdi
movq %rbp, %rsi
callq 0xc1e6
movq %r15, %rdi
movq %rbp, %rsi
callq 0xc2c9
movq 0x58(%rsp), %rax
movq 0x60(%rsp), %rcx
movq 0x170(%rsp), %rdi
movq 0x178(%rsp), %rdx
cmpq %rcx, %rax
setne %sil
cmpq %rdx, %rdi
setne %r8b
andb %sil, %r8b
cmpb $0x1, %r8b
jne 0x71a1
xorl %esi, %esi
movq %rdi, %r8
movl (%rax), %r9d
movl (%r8), %r10d
cmpl %r10d, %r9d
jge 0x7121
addq $0x4, %rax
jmp 0x712e
jg 0x712a
incq %rsi
addq $0x4, %rax
addq $0x4, %r8
cmpq %rcx, %rax
je 0x7138
cmpq %rdx, %r8
jne 0x7110
movq 0x20(%rsp), %rax
testq %rsi, %rsi
je 0x71a6
movq 0x40(%rsp), %rcx
movq 0x48(%rsp), %rdx
movq 0x28(%rsp), %rsi
cmpq %rdx, %rcx
setne %r8b
cmpq %rsi, %rax
setne %r9b
andb %r8b, %r9b
cmpb $0x1, %r9b
jne 0x71a6
xorl %r8d, %r8d
movq %rax, %r9
movl (%rcx), %r10d
movl (%r9), %r11d
cmpl %r11d, %r10d
jge 0x717f
addq $0x4, %rcx
jmp 0x718c
jg 0x7188
incq %r8
addq $0x4, %rcx
addq $0x4, %r9
cmpq %rdx, %rcx
je 0x7196
cmpq %rsi, %r9
jne 0x716e
testq %r8, %r8
je 0x71a6
incl 0x8(%rsp)
jmp 0x71a6
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x71bb
movq %rax, %rdi
callq 0x32c0
movq 0x170(%rsp), %rdi
testq %rdi, %rdi
je 0x71c5
callq 0x32c0
incq %r12
cmpq %r14, %r12
jne 0x6ff3
cvtsi2ssl 0x8(%rsp), %xmm0
jmp 0x71dc
xorps %xmm0, %xmm0
movss %xmm0, 0x8(%rsp)
callq 0x31d0
subq 0x18(%rsp), %rax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd 0xaf74(%rip), %xmm0     # 0x12170
addsd 0x8(%rbx), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0xb70(%rbx)
callq 0xd418
movss %xmm0, 0xb74(%rbx)
movq 0x10db7(%rip), %rdi     # 0x17fd8
leaq 0xb0d9(%rip), %rsi      # 0x12301
movl $0x1d, %edx
callq 0x3340
xorps %xmm0, %xmm0
cvtsi2ss %r14, %xmm0
cvtsi2ssl 0x68(%rbx), %xmm1
movss 0x8(%rsp), %xmm2
divss %xmm0, %xmm2
movss %xmm2, 0x8(%rsp)
mulss %xmm2, %xmm1
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
movq 0x10d77(%rip), %rdi     # 0x17fd8
callq 0x3500
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x32d0
movsbl %al, %esi
movq %r14, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31e0
leaq 0x170(%rsp), %rdi
callq 0x3410
leaq 0x170(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rcx
movl $0xfffffefb, %edx       # imm = 0xFFFFFEFB
andl 0x188(%rsp,%rcx), %edx
orl $0x4, %edx
movl %edx, 0x188(%rsp,%rcx)
movq -0x18(%rax), %rax
movq $0x2, 0x178(%rsp,%rax)
xorps %xmm0, %xmm0
cvtsi2ssl 0x68(%rbx), %xmm0
mulss 0x8(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
callq 0x3500
leaq 0x30(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0xb026(%rip), %rsi      # 0x1231f
leaq 0xb02f(%rip), %rdx      # 0x1232f
leaq 0x20(%rsp), %rdi
callq 0xb3fa
movss 0xb70(%rbx), %xmm0
movss %xmm0, 0x18(%rsp)
movss 0xb74(%rbx), %xmm0
movss %xmm0, 0x10(%rsp)
leaq 0x178(%rsp), %rsi
leaq 0xf0(%rsp), %rdi
callq 0x34f0
leaq 0x140(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0xb490
leaq 0x110(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0xb490
leaq 0x20(%rsp), %rsi
leaq 0xf0(%rsp), %rdx
leaq 0x140(%rsp), %rcx
leaq 0x110(%rsp), %r8
movq %rbx, %rdi
movss 0x18(%rsp), %xmm0
movss 0x10(%rsp), %xmm1
callq 0xa4c4
leaq 0x110(%rsp), %rdi
callq 0xb65e
leaq 0x140(%rsp), %rdi
callq 0xb65e
leaq 0x100(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x73c6
callq 0x32c0
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x73d5
callq 0x32c0
movq 0x10bf4(%rip), %rsi     # 0x17fd0
leaq 0x170(%rsp), %rdi
callq 0x3170
leaq 0x1e0(%rsp), %rdi
callq 0x30e0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x7405
callq 0x32c0
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x7414
callq 0x32c0
leaq 0x90(%rsp), %rdi
callq 0xb65e
leaq 0xc0(%rsp), %rdi
callq 0xb65e
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x743d
callq 0x32c0
xorps %xmm0, %xmm0
cvtss2sd 0x8(%rsp), %xmm0
addq $0x2e8, %rsp            # imm = 0x2E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb130(%rip), %rdi      # 0x1258f
xorl %esi, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x3490
leaq 0xb11e(%rip), %rdi      # 0x1258f
movl $0x1, %esi
xorl %eax, %eax
callq 0x3490
movq %rax, %rbx
leaq 0x110(%rsp), %rdi
callq 0xb65e
jmp 0x7492
movq %rax, %rbx
leaq 0x140(%rsp), %rdi
callq 0xb65e
jmp 0x74a4
movq %rax, %rbx
leaq 0x100(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x74bf
callq 0x32c0
jmp 0x74bf
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x74d5
callq 0x32c0
jmp 0x74d5
jmp 0x74d2
movq %rax, %rbx
movq 0x10af4(%rip), %rsi     # 0x17fd0
leaq 0x170(%rsp), %rdi
callq 0x3170
leaq 0x1e0(%rsp), %rdi
callq 0x30e0
jmp 0x753c
jmp 0x750e
movq %rax, %rbx
jmp 0x754b
jmp 0x755e
jmp 0x750e
jmp 0x750e
jmp 0x750e
jmp 0x7509
movq %rax, %rbx
jmp 0x752a
movq %rax, %rbx
jmp 0x753c
movq %rax, %rbx
jmp 0x757b
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x752a
callq 0x32c0
movq 0x170(%rsp), %rdi
testq %rdi, %rdi
je 0x753c
callq 0x32c0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x754b
callq 0x32c0
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x7561
callq 0x32c0
jmp 0x7561
jmp 0x755e
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0xb65e
leaq 0xc0(%rsp), %rdi
callq 0xb65e
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x758a
callq 0x32c0
movq %rbx, %rdi
callq 0x35c0