// File: /workspace/github_cpp_makefile_star2_O1/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 0x6d7e
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 0xafc8
incq %r13
movslq 0x68(%rbx), %rax
cmpq %rax, %r13
jl 0x6d49
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 0x6dcb
movq %rax, 0xb0(%rbx)
leaq 0xa8(%rbx), %rbp
movq 0xc0(%rbx), %rax
cmpq %rax, 0xc8(%rbx)
je 0x6de9
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 0x6eb5
leaq 0x70(%rsp), %rdi
movq (%rdi), %rax
movl (%rax), %r15d
callq 0xb066
movl %r15d, 0x8(%rsp)
movq 0xb0(%rbx), %rsi
cmpq 0xb8(%rbx), %rsi
je 0x6e3d
movl %r15d, (%rsi)
addq $0x4, %rsi
movq %rsi, 0xb0(%rbx)
jmp 0x6e4a
leaq 0x8(%rsp), %rdx
movq %rbp, %rdi
callq 0xbdaa
leaq 0xc0(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xbfa4
leaq 0x70(%rsp), %rdi
movq (%rdi), %rax
movl (%rax), %r15d
callq 0xb066
movl %r15d, 0x8(%rsp)
movq 0xb0(%rbx), %rsi
cmpq 0xb8(%rbx), %rsi
je 0x6e91
movl %r15d, (%rsi)
addq $0x4, %rsi
movq %rsi, 0xb0(%rbx)
jmp 0x6e9e
leaq 0x8(%rsp), %rdx
movq %rbp, %rdi
callq 0xbdaa
leaq 0x90(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xbfa4
jmp 0x6de9
movq %r14, 0x10(%rsp)
leaq 0x70(%rsp), %r15
leaq 0x8(%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 0x6f35
movq 0x70(%rsp), %rax
movl (%rax), %r14d
movq %r15, %rdi
callq 0xb066
movl %r14d, 0x8(%rsp)
movq 0xb0(%rbx), %rsi
cmpq 0xb8(%rbx), %rsi
je 0x6f1d
movl %r14d, (%rsi)
addq $0x4, %rsi
movq %rsi, 0xb0(%rbx)
jmp 0x6f28
movq %rbp, %rdi
movq %r12, %rdx
callq 0xbdaa
movq %r13, %rdi
movq %r12, %rsi
callq 0xbfa4
jmp 0x6ecc
movq 0xd8(%rsp), %rsi
leaq 0x58(%rsp), %rdi
leaq 0x170(%rsp), %rcx
leaq 0xc8(%rsp), %rdx
callq 0xaf0e
movq 0xa8(%rsp), %rsi
leaq 0x40(%rsp), %rdi
leaq 0x170(%rsp), %rcx
leaq 0x98(%rsp), %rdx
callq 0xaf0e
movq 0x10(%rsp), %r14
movq 0x58(%rsp), %r15
movq 0x60(%rsp), %r12
cmpq %r12, %r15
je 0x6fba
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 0xc229
movq %r15, %rdi
movq %r12, %rsi
callq 0xc30c
movq 0x40(%rsp), %r15
movq 0x48(%rsp), %r12
cmpq %r12, %r15
je 0x6ff6
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 0xc229
movq %r15, %rdi
movq %r12, %rsi
callq 0xc30c
testq %r14, %r14
jle 0x71e7
xorl %r12d, %r12d
xorl %r13d, %r13d
movq 0xae8(%rbx), %rcx
movq (%rcx), %rax
cmpq %rax, 0x8(%rcx)
je 0x7466
movq (%rax), %rax
leaq (%r12,%r12,2), %r15
shlq $0x3, %r15
movq 0x18(%rax), %rsi
addq %r15, %rsi
leaq 0x170(%rsp), %rdi
callq 0xaf48
movq 0xae8(%rbx), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq $0x1, %rdx
jbe 0x7478
movq 0x8(%rax), %rax
addq 0x18(%rax), %r15
leaq 0x20(%rsp), %rdi
movq %r15, %rsi
callq 0xaf48
movq 0x170(%rsp), %r15
movq 0x178(%rsp), %rbp
cmpq %rbp, %r15
je 0x70ae
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 0xc229
movq %r15, %rdi
movq %rbp, %rsi
callq 0xc30c
movq 0x20(%rsp), %r15
movq 0x28(%rsp), %rbp
cmpq %rbp, %r15
je 0x70ea
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 0xc229
movq %r15, %rdi
movq %rbp, %rsi
callq 0xc30c
movq 0x58(%rsp), %rax
movq 0x60(%rsp), %rcx
movq 0x170(%rsp), %rdx
movq 0x178(%rsp), %rsi
cmpq %rcx, %rax
setne %dil
cmpq %rsi, %rdx
setne %r8b
andb %dil, %r8b
cmpb $0x1, %r8b
jne 0x71b3
xorl %edi, %edi
movl (%rax), %r8d
movl (%rdx), %r9d
cmpl %r9d, %r8d
jge 0x7132
addq $0x4, %rax
jmp 0x713f
jg 0x713b
incq %rdi
addq $0x4, %rax
addq $0x4, %rdx
cmpq %rcx, %rax
je 0x7149
cmpq %rsi, %rdx
jne 0x7121
testq %rdi, %rdi
je 0x71b3
movq 0x40(%rsp), %rax
movq 0x48(%rsp), %rcx
movq 0x20(%rsp), %rdx
movq 0x28(%rsp), %rsi
cmpq %rcx, %rax
setne %dil
cmpq %rsi, %rdx
setne %r9b
andb %dil, %r9b
xorl %r8d, %r8d
cmpb $0x1, %r9b
jne 0x71b0
xorl %edi, %edi
movl (%rax), %r8d
movl (%rdx), %r9d
cmpl %r9d, %r8d
jge 0x718f
addq $0x4, %rax
jmp 0x719c
jg 0x7198
incq %rdi
addq $0x4, %rax
addq $0x4, %rdx
cmpq %rcx, %rax
je 0x71a6
cmpq %rsi, %rdx
jne 0x717e
xorl %r8d, %r8d
testq %rdi, %rdi
setne %r8b
addl %r8d, %r13d
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x71c2
callq 0x32c0
movq 0x170(%rsp), %rdi
testq %rdi, %rdi
je 0x71d4
callq 0x32c0
incq %r12
cmpq %r14, %r12
jne 0x7005
cvtsi2ss %r13d, %xmm0
jmp 0x71ea
xorps %xmm0, %xmm0
movss %xmm0, 0xc(%rsp)
callq 0x31d0
subq 0x18(%rsp), %rax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd 0xaf66(%rip), %xmm0     # 0x12170
addsd 0x8(%rbx), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0xb70(%rbx)
callq 0xd4f4
movss %xmm0, 0xb74(%rbx)
movq 0x10da9(%rip), %rdi     # 0x17fd8
leaq 0xb0d3(%rip), %rsi      # 0x12309
movl $0x1d, %edx
callq 0x3340
xorps %xmm0, %xmm0
cvtsi2ss %r14, %xmm0
cvtsi2ssl 0x68(%rbx), %xmm1
movss 0xc(%rsp), %xmm2
divss %xmm0, %xmm2
movss %xmm2, 0xc(%rsp)
mulss %xmm2, %xmm1
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
movq 0x10d69(%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 0xc(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
callq 0x3500
leaq 0x30(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0xb020(%rip), %rsi      # 0x12327
leaq 0xb029(%rip), %rdx      # 0x12337
leaq 0x20(%rsp), %rdi
callq 0xb452
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 0xb4e2
leaq 0x110(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0xb4e2
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 0xa536
leaq 0x110(%rsp), %rdi
callq 0xb6b0
leaq 0x140(%rsp), %rdi
callq 0xb6b0
leaq 0x100(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x73d4
callq 0x32c0
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x73e3
callq 0x32c0
movq 0x10be6(%rip), %rsi     # 0x17fd0
leaq 0x170(%rsp), %rdi
callq 0x3170
leaq 0x1e0(%rsp), %rdi
callq 0x30e0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x7413
callq 0x32c0
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x7422
callq 0x32c0
leaq 0x90(%rsp), %rdi
callq 0xb6b0
leaq 0xc0(%rsp), %rdi
callq 0xb6b0
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x744b
callq 0x32c0
xorps %xmm0, %xmm0
cvtss2sd 0xc(%rsp), %xmm0
addq $0x2e8, %rsp            # imm = 0x2E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb12a(%rip), %rdi      # 0x12597
xorl %esi, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x3490
leaq 0xb118(%rip), %rdi      # 0x12597
movl $0x1, %esi
xorl %eax, %eax
callq 0x3490
movq %rax, %rbx
leaq 0x110(%rsp), %rdi
callq 0xb6b0
jmp 0x74a0
movq %rax, %rbx
leaq 0x140(%rsp), %rdi
callq 0xb6b0
jmp 0x74b2
movq %rax, %rbx
leaq 0x100(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x74cd
callq 0x32c0
jmp 0x74cd
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x74e3
callq 0x32c0
jmp 0x74e3
jmp 0x74e0
movq %rax, %rbx
movq 0x10ae6(%rip), %rsi     # 0x17fd0
leaq 0x170(%rsp), %rdi
callq 0x3170
leaq 0x1e0(%rsp), %rdi
callq 0x30e0
jmp 0x754a
jmp 0x751c
movq %rax, %rbx
jmp 0x7559
jmp 0x756c
jmp 0x751c
jmp 0x751c
jmp 0x751c
jmp 0x7517
movq %rax, %rbx
jmp 0x7538
movq %rax, %rbx
jmp 0x754a
movq %rax, %rbx
jmp 0x7589
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x7538
callq 0x32c0
movq 0x170(%rsp), %rdi
testq %rdi, %rdi
je 0x754a
callq 0x32c0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x7559
callq 0x32c0
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x756f
callq 0x32c0
jmp 0x756f
jmp 0x756c
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0xb6b0
leaq 0xc0(%rsp), %rdi
callq 0xb6b0
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x7598
callq 0x32c0
movq %rbx, %rdi
callq 0x35c0