// File: /workspace/github_cpp_makefile_star2_O2/JenTus[P]TCEM/src_TCEM/allocator.cc
// Function: Cide::allocator::degreeVersionOne(long long)
double allocator::degreeVersionOne(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);
        }

        seedSet.clear();
        seedScores.clear();
        set<int> rednodes;
        set<int> bluenodes;
        int testt;


        while ((int) seedSet.size() < k_r) {
            pair<int, double> pairVal = heap.top();
            heap.pop();
            bestNodeID = pairVal.first;
            seedSet.push_back(bestNodeID);
            rednodes.insert(bestNodeID);
        }


        while ((int) seedSet.size() < k_r + k_b) {
            pair<int, double> pairVal = heap.top();
            heap.pop();
            bestNodeID = pairVal.first;
            seedSet.push_back(bestNodeID);
            bluenodes.insert(bestNodeID);
        }

        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 one is " << totalscore*n << endl;

        std::ostringstream streamObj1;
        streamObj1 << std::fixed << std::setprecision(2)<<totalscore*n;

        writeInMasterOutputFile("DegreeVersionOne", 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, (%rsp)
movq %rdi, %rbx
callq 0x31c0
movq %rax, %r13
leaq 0x70(%rsp), %r14
andq $0x0, 0x10(%r14)
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
xorl %r12d, %r12d
leaq 0x170(%rsp), %r15
movslq 0x68(%rbx), %rax
cmpq %rax, %r12
jge 0x51c5
movq 0xd8(%rbx), %rax
movsd (%rax,%r12,8), %xmm0
movl %r12d, 0x170(%rsp)
movsd %xmm0, 0x178(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x8764
incq %r12
jmp 0x518e
movq 0xa8(%rbx), %rax
cmpq %rax, 0xb0(%rbx)
je 0x51dc
movq %rax, 0xb0(%rbx)
movq %r13, 0x10(%rsp)
movq 0xc0(%rbx), %rax
cmpq %rax, 0xc8(%rbx)
je 0x51f8
movq %rax, 0xc8(%rbx)
leaq 0xc8(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq 0x98(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq 0xa8(%rbx), %r12
leaq 0x70(%rsp), %r14
leaq 0x8(%rsp), %r13
leaq 0xc0(%rsp), %rbp
movq 0xb0(%rbx), %rax
subq 0xa8(%rbx), %rax
shrq $0x2, %rax
cmpl %eax, 0x78(%rbx)
jle 0x528f
movq 0x70(%rsp), %rax
movl (%rax), %r15d
movq %r14, %rdi
callq 0x877a
movl %r15d, 0x8(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x854e
movq %rbp, %rdi
movq %r13, %rsi
callq 0x98b4
jmp 0x524b
leaq 0x70(%rsp), %r13
leaq 0x8(%rsp), %rbp
leaq 0x90(%rsp), %r14
movq 0xb0(%rbx), %rax
subq 0xa8(%rbx), %rax
shrq $0x2, %rax
movl 0x7c(%rbx), %ecx
addl 0x78(%rbx), %ecx
cmpl %eax, %ecx
jle 0x52ea
movq 0x70(%rsp), %rax
movl (%rax), %r15d
movq %r13, %rdi
callq 0x877a
movl %r15d, 0x8(%rsp)
movq %r12, %rdi
movq %rbp, %rsi
callq 0x854e
movq %r14, %rdi
movq %rbp, %rsi
callq 0x98b4
jmp 0x52a1
movq 0xd8(%rsp), %rsi
leaq 0x58(%rsp), %rdi
leaq 0x170(%rsp), %rcx
leaq 0xc8(%rsp), %rdx
callq 0x86a2
movq 0xa8(%rsp), %rsi
leaq 0x40(%rsp), %rdi
leaq 0x170(%rsp), %rcx
leaq 0x98(%rsp), %rdx
callq 0x86a2
movq 0x58(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x9b85
movq 0x40(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0x9b85
xorl %r13d, %r13d
movq (%rsp), %rax
testq %rax, %rax
movl $0x0, %r15d
cmovgq %rax, %r15
leaq 0x170(%rsp), %r12
leaq 0x20(%rsp), %rbp
xorl %r14d, %r14d
subq $0x1, %r15
jb 0x541f
movq 0xae8(%rbx), %rdi
xorl %esi, %esi
callq 0x856c
movq (%rax), %rax
movq 0x18(%rax), %rsi
addq %r13, %rsi
movq %r12, %rdi
callq 0x86d4
movq 0xae8(%rbx), %rdi
pushq $0x1
popq %rsi
callq 0x856c
movq (%rax), %rax
movq 0x18(%rax), %rsi
addq %r13, %rsi
movq %rbp, %rdi
callq 0x86d4
movq 0x170(%rsp), %rdi
movq 0x178(%rsp), %rsi
callq 0x9b85
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0x9b85
leaq 0x58(%rsp), %rdi
movq %r12, %rsi
callq 0x8721
testq %rax, %rax
je 0x5406
leaq 0x40(%rsp), %rdi
movq %rbp, %rsi
callq 0x8721
cmpq $0x1, %rax
sbbl $-0x1, %r14d
movq %rbp, %rdi
callq 0x8e40
movq %r12, %rdi
callq 0x8e40
addq $0x18, %r13
jmp 0x5370
callq 0x31c0
subq 0x10(%rsp), %rax
cvtsi2sd %rax, %xmm0
divsd 0x8d0a(%rip), %xmm0     # 0xe140
addsd 0x8(%rbx), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0xb70(%rbx)
callq 0xadf0
movss %xmm0, 0xb74(%rbx)
movq 0xfb7d(%rip), %rdi      # 0x14fd8
leaq 0x8e48(%rip), %rsi      # 0xe2aa
callq 0x32c0
cvtsi2ss %r14d, %xmm1
cvtsi2ssq (%rsp), %xmm0
divss %xmm0, %xmm1
cvtsi2ssl 0x68(%rbx), %xmm0
movss %xmm1, (%rsp)
mulss %xmm1, %xmm0
movq %rax, %rdi
callq 0x31f0
movq %rax, %rdi
callq 0x3150
leaq 0x170(%rsp), %rdi
callq 0x33f0
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)
cvtsi2ssl 0x68(%rbx), %xmm0
mulss (%rsp), %xmm0
callq 0x31f0
leaq 0x8ddc(%rip), %rsi      # 0xe2c8
leaq 0x20(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x3100
movss 0xb70(%rbx), %xmm0
movss %xmm0, 0x10(%rsp)
movss 0xb74(%rbx), %xmm0
movss %xmm0, 0x1c(%rsp)
leaq 0x178(%rsp), %rsi
leaq 0xf0(%rsp), %rdi
callq 0x34b0
leaq 0x140(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0x8b5e
leaq 0x110(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x8b5e
leaq 0x20(%rsp), %rsi
leaq 0xf0(%rsp), %rdx
leaq 0x140(%rsp), %rcx
leaq 0x110(%rsp), %r8
movq %rbx, %rdi
movss 0x10(%rsp), %xmm0
movss 0x1c(%rsp), %xmm1
callq 0x7ec8
leaq 0x110(%rsp), %rdi
callq 0x8d86
leaq 0x140(%rsp), %rdi
callq 0x8d86
leaq 0xf0(%rsp), %rdi
callq 0x3130
leaq 0x20(%rsp), %rdi
callq 0x3130
cvtss2sd (%rsp), %xmm0
movsd %xmm0, (%rsp)
leaq 0x170(%rsp), %rdi
callq 0x30b0
leaq 0x40(%rsp), %rdi
callq 0x8e40
leaq 0x58(%rsp), %rdi
callq 0x8e40
leaq 0x90(%rsp), %rdi
callq 0x8d86
leaq 0xc0(%rsp), %rdi
callq 0x8d86
leaq 0x70(%rsp), %rdi
callq 0x8d9a
movsd (%rsp), %xmm0
addq $0x2e8, %rsp            # imm = 0x2E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x110(%rsp), %rdi
callq 0x8d86
jmp 0x5633
movq %rax, %rbx
leaq 0x140(%rsp), %rdi
callq 0x8d86
jmp 0x5645
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
callq 0x3130
jmp 0x5657
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x3130
jmp 0x5668
jmp 0x5665
movq %rax, %rbx
leaq 0x170(%rsp), %rdi
callq 0x30b0
jmp 0x56b4
jmp 0x5689
movq %rax, %rbx
jmp 0x56be
jmp 0x5695
jmp 0x5689
jmp 0x5689
movq %rax, %rbx
jmp 0x56e2
movq %rax, %rbx
jmp 0x56b4
movq %rax, %rbx
jmp 0x56a7
jmp 0x5695
movq %rax, %rbx
jmp 0x56c8
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x8e40
leaq 0x170(%rsp), %rdi
callq 0x8e40
leaq 0x40(%rsp), %rdi
callq 0x8e40
leaq 0x58(%rsp), %rdi
callq 0x8e40
leaq 0x90(%rsp), %rdi
callq 0x8d86
leaq 0xc0(%rsp), %rdi
callq 0x8d86
leaq 0x70(%rsp), %rdi
callq 0x8d9a
movq %rbx, %rdi
callq 0x3560