// File: /workspace/github_cpp_makefile_star2_O1/JenTus[P]TCEM/src_TCEM/allocator.cc
// Function: Cide::allocator::rcGreedy(long long, bool)
double allocator::rcGreedy(int64 rcSampleSize, bool extraResults) {
        // For initialization the k_r and k_b, to delete later.

        double totalExpScore = 0;
        std::vector<double> ExpScore(n*n, 0); // use to store hyper_degreepairs

        int bestPairID = -1, bestRedNodeID = -1, bestBlueNodeID = -1;
        std::vector<int> isValidRed = std::vector<int>(n,tao);
        std::vector<int> isValidBlue = std::vector<int>(n,1);
        std::vector<bool> isCovered = std::vector<bool>(rcSampleSize, false);
        std::set<int> rednodes;
        std::set<int> bluenodes;

        int flag_red = 0;

        clock_t begin = clock();

        for (int i = 0; i < n; i++){
            for (int j = 0; j < n; j++){
                if (i != j){
                    ExpScore[i*n + j] = hyper_degreepairs[i*n + j];
                }
            }
        }

        seedSet.clear();
        seedScores.clear(); // seedScores should be cleared as well.

        while ((int)seedSet.size() < k_b) {

            double tempsum = accumulate(ExpScore.begin(), ExpScore.end(), 0.01);
            if(tempsum < 1){
                break;
            }
            // here I use the vector to store the results, but can use the priority queue.
            //bestPairID = std::max_element(ExpScore.begin(), ExpScore.end()) - ExpScore.begin();
            bestPairID = std::distance(ExpScore.begin(), std::max_element(ExpScore.begin(), ExpScore.end()));
            //cout << "bestPairID is " << bestPairID   <<endl;
            bestRedNodeID = (int) bestPairID / n;
            rednodes.insert(bestRedNodeID);
            bestBlueNodeID = (int) bestPairID % n;
            bluenodes.insert(bestBlueNodeID);

            // if can not select, then just pop out
            if (isValidRed[bestRedNodeID] == 0 || isValidBlue[bestBlueNodeID] == 0) {
                ExpScore[bestPairID] = 0;
                continue;
            }

            // push
            seedSet.push_back(bestPairID); // store
            //cout << "ExpScore is " << ExpScore[bestPairID] << "rc sample size is " <<rcSampleSize << "n is " << n << endl;
            seedScores.push_back(ExpScore[bestPairID]); // store score, dividing later

            // make update
            isValidRed[bestRedNodeID] -= 1;
            isValidRed[bestBlueNodeID] = 0;
            isValidBlue[bestBlueNodeID] = 0;
            isValidBlue[bestRedNodeID] = 0;

            if(isValidRed[bestRedNodeID] <= 0){
                for (int i = 0; i < n; ++i) {
                   ExpScore[bestRedNodeID*n + i] = 0;
                }
            }

            for (int i = 0; i < n; ++i) {
               ExpScore[i*n + bestBlueNodeID]  = 0;
               ExpScore[i*n + bestRedNodeID]  = 0;
               ExpScore[bestBlueNodeID*n + i] = 0;
            }

            // if red nodes reaches k_r
            if(rednodes.size() == k_r && flag_red == 0){
                for (int i = 0; i < n; ++i) {
                    if(rednodes.count(i) == 0){
                        isValidRed[i] = 0;
                        for (int j = 0; j < n; ++j) {
                           ExpScore[i*n + j] = 0;
                        }
                    }
                }
                flag_red = 1;
            }

//            cout << "sum of Expscore is " << accumulate(ExpScore.begin(), ExpScore.end(), 0) << endl;

            // update the ExpScore of the pairs whose marginal gain change due to the best pair selection
            int tmpsize = hyperGpairs[bestPairID].size();
            for (int j = 0; j < tmpsize; j++) {
                int rcID = hyperGpairs[bestPairID][j]; // get the rcID
                if(isCovered[rcID] == false){ // ensure not to repeatedly --
                    int ttmpsize = hyperGTpairs[rcID].size();
                    for (int z = 0; z < ttmpsize; z++) {
                        int pairID = hyperGTpairs[rcID][z];
                        if (ExpScore[pairID] != 0) {
                            ExpScore[pairID]--;
                        }
                    }
                    isCovered[rcID] = true;
                }
           }
        } // end of while k loop

        for (int i1 = 0; i1 < seedScores.size(); ++i1) {
           totalExpScore += seedScores[i1];
        }

        int covercount = 0;
        for (int l = 0; l < isCovered.size(); ++l) {
            if(isCovered[l])
                covercount++;
        }


        ///////////// produce the additional results here
        ////////////  Remember should write the f function results not the g function result.
        if(extraResults) {

        cout << "totalExpScore is: " << totalExpScore << " cover is " << covercount << " sample size is " << rcSampleSize << endl;

            clock_t end = clock();

            //cout << "total tdem time taken (in seconds) " << totalDuration << " total memory (in mb) " << totalMemory << endl;
            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;
                    }
                }
            }

            totalDuration = double(end - begin) / CLOCKS_PER_SEC + duration_common; // in seconds
            totalMemory = getCurrentMemoryUsage(); // in MB

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

            cout << "Total score of Greedy is " << totalscore*n << "  g result is " << totalExpScore / (float) rcSampleSize *n  << endl;

            std::ostringstream streamObj1;
            streamObj1 << std::fixed << std::setprecision(2)<<totalscore*n << "(" << totalExpScore/(float) rcSampleSize*n << ")";

            writeInMasterOutputFile("Greedy", totalDuration,  totalMemory, streamObj1.str(), rednodes, bluenodes);

        } // end of extra results
        
        return totalExpScore / (double)rcSampleSize;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x368, %rsp            # imm = 0x368
movl %edx, %ebx
movq %rsi, 0x20(%rsp)
movq %rdi, %r14
movl 0x68(%rdi), %esi
imull %esi, %esi
leaq 0x1f0(%rsp), %rdx
movq $0x0, (%rdx)
leaq 0x30(%rsp), %rdi
leaq 0xc8(%rsp), %rcx
callq 0xab98
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, 0xc(%rsp)
movl %eax, 0x14(%rsp)
movl %eax, 0x10(%rsp)
movslq 0x68(%r14), %rsi
leaq 0x80(%r14), %rdx
leaq 0x128(%rsp), %rdi
leaq 0x1f0(%rsp), %rcx
callq 0xad32
movslq 0x68(%r14), %rsi
leaq 0x1f0(%rsp), %rdx
movl $0x1, (%rdx)
leaq 0x110(%rsp), %rdi
leaq 0xc8(%rsp), %rcx
callq 0xad32
movl %ebx, 0x4c(%rsp)
leaq 0x1f0(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0x50(%rsp), %rdi
leaq 0xc8(%rsp), %rcx
movq 0x20(%rsp), %rsi
callq 0xaea6
leaq 0xd0(%rsp), %r12
xorl %eax, %eax
movl %eax, (%r12)
movq %rax, 0x8(%r12)
movq %r12, 0x10(%r12)
movq %r12, 0x18(%r12)
movq %rax, 0x20(%r12)
leaq 0x148(%rsp), %rcx
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
callq 0x31d0
movq %rax, 0xf8(%rsp)
movslq 0x68(%r14), %rax
testq %rax, %rax
jle 0x954f
leaq (,%rax,8), %rcx
xorl %edx, %edx
xorl %esi, %esi
movq 0x30(%rsp), %rdi
addq %rdx, %rdi
movq 0xb58(%r14), %r8
addq %rdx, %r8
xorl %r9d, %r9d
cmpq %r9, %rsi
je 0x953c
movsd (%r8,%r9,8), %xmm0
movsd %xmm0, (%rdi,%r9,8)
incq %r9
cmpq %r9, %rax
jne 0x952b
incq %rsi
addq %rcx, %rdx
cmpq %rax, %rsi
jne 0x9516
movq 0xa8(%r14), %rax
cmpq %rax, 0xb0(%r14)
je 0x9566
movq %rax, 0xb0(%r14)
movq 0xc0(%r14), %rax
cmpq %rax, 0xc8(%r14)
je 0x957d
movq %rax, 0xc8(%r14)
leaq 0xa8(%r14), %rax
movq %rax, 0x108(%rsp)
leaq 0xc0(%r14), %rax
movq %rax, 0x100(%rsp)
xorl %r15d, %r15d
leaq 0xc8(%rsp), %r13
movl $0x0, 0x18(%rsp)
movq 0xb0(%r14), %rax
subq 0xa8(%r14), %rax
shrq $0x2, %rax
cmpl %eax, 0x7c(%r14)
jle 0x99d6
movq 0x30(%rsp), %rcx
movq 0x38(%rsp), %rdx
cmpq %rdx, %rcx
je 0x9602
movsd 0x8b97(%rip), %xmm0     # 0x12178
movq %rcx, %rax
addsd (%rax), %xmm0
addq $0x8, %rax
cmpq %rdx, %rax
jne 0x95e4
movsd 0x8b57(%rip), %xmm1     # 0x12150
ucomisd %xmm0, %xmm1
seta %bl
jmp 0x9604
movb $0x1, %bl
testb %bl, %bl
jne 0x99ce
cmpq %rdx, %rcx
sete %al
leaq 0x8(%rcx), %rsi
cmpq %rdx, %rsi
sete %dil
orb %al, %dil
movq %rcx, %rax
jne 0x9644
movq %rcx, %rdi
movsd (%rsi), %xmm0
ucomisd (%rdi), %xmm0
movq %rsi, %rax
ja 0x9638
movq %rdi, %rax
addq $0x8, %rsi
movq %rax, %rdi
cmpq %rdx, %rsi
jne 0x9628
subq %rcx, %rax
shrq $0x3, %rax
movl %eax, 0xc(%rsp)
cltd
idivl 0x68(%r14)
movl %eax, 0x14(%rsp)
movq %r13, %rdi
leaq 0x14(%rsp), %rsi
callq 0xbfa4
movl 0xc(%rsp), %eax
cltd
idivl 0x68(%r14)
movl %edx, 0x10(%rsp)
leaq 0x140(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0xbfa4
movslq 0x14(%rsp), %rax
movq 0x128(%rsp), %rcx
cmpl $0x0, (%rcx,%rax,4)
je 0x96cd
movslq 0x10(%rsp), %rax
movq 0x110(%rsp), %rcx
cmpl $0x0, (%rcx,%rax,4)
je 0x96cd
movq 0xb0(%r14), %rsi
cmpq 0xb8(%r14), %rsi
je 0x96e4
movl 0xc(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0xb0(%r14)
jmp 0x96f6
movslq 0xc(%rsp), %rax
movq 0x30(%rsp), %rcx
movq $0x0, (%rcx,%rax,8)
jmp 0x99ce
movq 0x108(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0xbdaa
movslq 0xc(%rsp), %rdx
shlq $0x3, %rdx
addq 0x30(%rsp), %rdx
movq 0xc8(%r14), %rsi
cmpq 0xd0(%r14), %rsi
je 0x9729
movsd (%rdx), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0xc8(%r14)
jmp 0x9736
movq 0x100(%rsp), %rdi
callq 0xc0b4
movb %bl, 0x8(%rsp)
movslq 0x14(%rsp), %rax
movq 0x128(%rsp), %rbp
decl (%rbp,%rax,4)
movslq 0x10(%rsp), %rax
movl %r15d, (%rbp,%rax,4)
movslq 0x10(%rsp), %rax
movq 0x110(%rsp), %rcx
movl %r15d, (%rcx,%rax,4)
movslq 0x14(%rsp), %rax
movl %r15d, (%rcx,%rax,4)
movslq 0x14(%rsp), %rbx
cmpl %r15d, (%rbp,%rbx,4)
jg 0x979f
movslq 0x68(%r14), %rdx
testq %rdx, %rdx
jle 0x979f
movq %rdx, %rdi
imulq %rbx, %rdi
shlq $0x3, %rdi
addq 0x30(%rsp), %rdi
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x3180
movslq 0x68(%r14), %rax
testq %rax, %rax
jle 0x97df
movslq 0x10(%rsp), %rcx
movq 0x30(%rsp), %rdx
movq %rcx, %rsi
imulq %rax, %rsi
leaq (%rdx,%rsi,8), %rsi
leaq (,%rax,8), %rdi
xorl %r8d, %r8d
movq %r15, (%rdx,%rcx,8)
movq %r15, (%rdx,%rbx,8)
movq %r15, (%rsi,%r8,8)
incq %r8
addq %rdi, %rdx
cmpq %r8, %rax
jne 0x97c8
movslq 0x78(%r14), %rax
cmpq %rax, 0xf0(%rsp)
sete %al
cmpl $0x0, 0x18(%rsp)
sete %cl
andb %al, %cl
cmpb $0x1, %cl
movb 0x8(%rsp), %bl
jne 0x98af
movl $0x1, 0x18(%rsp)
cmpl $0x0, 0x68(%r14)
jle 0x98af
movq 0xd8(%rsp), %rbx
movq 0x30(%rsp), %r15
xorl %r13d, %r13d
movq %r12, %rax
testq %rbx, %rbx
je 0x9851
movq %rbx, %rcx
movq %r12, %rax
movslq 0x20(%rcx), %rdx
xorl %esi, %esi
cmpq %rdx, %r13
setg %sil
cmovleq %rcx, %rax
movq 0x10(%rcx,%rsi,8), %rcx
testq %rcx, %rcx
jne 0x9836
movq %r12, %rcx
cmpq %r12, %rax
je 0x9867
movslq 0x20(%rax), %rcx
cmpq %rcx, %r13
cmovlq %r12, %rax
movq %rax, %rcx
cmpq %r12, %rcx
jne 0x9894
movl $0x0, (%rbp,%r13,4)
movslq 0x68(%r14), %rdx
testq %rdx, %rdx
jle 0x9894
movq %r13, %rax
imulq %rdx, %rax
leaq (%r15,%rax,8), %rdi
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x3180
incq %r13
movslq 0x68(%r14), %rax
cmpq %rax, %r13
jl 0x9828
xorl %r15d, %r15d
leaq 0xc8(%rsp), %r13
movb 0x8(%rsp), %bl
movslq 0xc(%rsp), %rax
movq 0xb40(%r14), %rcx
leaq (%rax,%rax,2), %rdx
movq (%rcx,%rdx,8), %rax
movq 0x8(%rcx,%rdx,8), %rdx
subq %rax, %rdx
shrq $0x2, %rdx
testl %edx, %edx
jle 0x99ce
movq 0x50(%rsp), %rsi
movq 0xb28(%r14), %rcx
movq %rcx, 0x28(%rsp)
movq 0x30(%rsp), %r8
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
xorl %r9d, %r9d
movabsq $-0x8000000000000000, %rdi # imm = 0x8000000000000000
movslq (%rax,%r9,4), %rcx
leaq 0x3f(%rcx), %rbx
testq %rcx, %rcx
cmovnsq %rcx, %rbx
sarq $0x6, %rbx
leaq 0x3f(%rdi), %r11
andq %rcx, %r11
xorl %r10d, %r10d
cmpq %rdi, %r11
setbe %r10b
movl $0x1, %r11d
shlq %cl, %r11
leaq (%rsi,%rbx,8), %rbx
movq -0x8(%rbx,%r10,8), %r13
btq %rcx, %r13
jb 0x99b3
movq %r12, %rdi
movq %r14, %r12
leaq (%rcx,%rcx,2), %r14
movq 0x28(%rsp), %r15
movq (%r15,%r14,8), %rcx
movq 0x8(%r15,%r14,8), %rbp
subq %rcx, %rbp
shrq $0x2, %rbp
testl %ebp, %ebp
jle 0x9994
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
xorl %r15d, %r15d
movslq (%rcx,%r15,4), %r14
movsd (%r8,%r14,8), %xmm0
ucomisd 0x881e(%rip), %xmm0     # 0x12198
jne 0x997e
jnp 0x998c
addsd 0x880a(%rip), %xmm0     # 0x12190
movsd %xmm0, (%r8,%r14,8)
incq %r15
cmpq %r15, %rbp
jne 0x9968
leaq -0x8(,%r10,8), %rcx
orq %r13, %r11
movq %r11, (%rbx,%rcx)
movq %r12, %r14
movq %rdi, %r12
movabsq $-0x8000000000000000, %rdi # imm = 0x8000000000000000
incq %r9
cmpq %rdx, %r9
jne 0x9900
xorl %r15d, %r15d
leaq 0xc8(%rsp), %r13
movb 0x8(%rsp), %bl
testb %bl, %bl
je 0x95ae
movq 0xc0(%r14), %rax
movq 0xc8(%r14), %rcx
subq %rax, %rcx
je 0x9a0a
sarq $0x3, %rcx
cmpq $0x1, %rcx
adcq $0x0, %rcx
xorpd %xmm0, %xmm0
xorl %edx, %edx
addsd (%rax,%rdx,8), %xmm0
incq %rdx
cmpq %rdx, %rcx
jne 0x99fb
jmp 0x9a0e
xorpd %xmm0, %xmm0
movsd %xmm0, 0x28(%rsp)
movq 0x50(%rsp), %rax
movq 0x60(%rsp), %rcx
movl 0x68(%rsp), %edx
subq %rax, %rcx
shlq $0x3, %rcx
addq %rdx, %rcx
je 0x9a4e
xorl %edx, %edx
xorl %ebx, %ebx
movq %rdx, %rsi
shrq $0x6, %rsi
movq (%rax,%rsi,8), %rsi
btq %rdx, %rsi
adcl $0x0, %ebx
incq %rdx
cmpq %rdx, %rcx
ja 0x9a32
jmp 0x9a50
xorl %ebx, %ebx
cmpb $0x0, 0x4c(%rsp)
je 0xa0c0
movq 0xe576(%rip), %rdi      # 0x17fd8
leaq 0x8810(%rip), %rsi      # 0x12279
movl $0x12, %edx
callq 0x3340
movq 0xe55e(%rip), %rdi      # 0x17fd8
movsd 0x28(%rsp), %xmm0
callq 0x3500
movq %rax, %r15
leaq 0x87fd(%rip), %rsi      # 0x1228c
movl $0xa, %edx
movq %rax, %rdi
callq 0x3340
movq %r15, %rdi
movl %ebx, %esi
callq 0x3580
movq %rax, %rbx
leaq 0x87e7(%rip), %rsi      # 0x12297
movl $0x10, %edx
movq %rax, %rdi
callq 0x3340
movq %rbx, %rdi
movq 0x20(%rsp), %rsi
callq 0x3100
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x32d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31e0
callq 0x31d0
movq %rax, %rbx
movq 0xe0(%rsp), %rsi
leaq 0xb0(%rsp), %rdi
leaq 0x1f0(%rsp), %rcx
movq %r12, %rdx
callq 0xaf0e
movq 0x158(%rsp), %rsi
leaq 0x98(%rsp), %rdi
leaq 0x1f0(%rsp), %rcx
leaq 0x148(%rsp), %rdx
callq 0xaf0e
movq 0xb0(%rsp), %r15
movq 0xb8(%rsp), %r12
cmpq %r12, %r15
je 0x9b83
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 0x98(%rsp), %r15
movq 0xa0(%rsp), %r12
cmpq %r12, %r15
je 0x9bc5
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
cmpq $0x0, 0x20(%rsp)
jle 0x9ddf
movq %rbx, 0x18(%rsp)
xorl %ebx, %ebx
leaq 0x78(%rsp), %r12
xorl %r15d, %r15d
movq 0xae8(%r14), %rcx
movq (%rcx), %rax
cmpq %rax, 0x8(%rcx)
je 0xa15b
movq (%rax), %rax
leaq (%rbx,%rbx,2), %r13
shlq $0x3, %r13
movq 0x18(%rax), %rsi
addq %r13, %rsi
leaq 0x1f0(%rsp), %rdi
callq 0xaf48
movq 0xae8(%r14), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq $0x1, %rdx
jbe 0xa16d
movq 0x8(%rax), %rax
addq 0x18(%rax), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0xaf48
movq 0x1f0(%rsp), %r13
movq 0x1f8(%rsp), %rbp
cmpq %rbp, %r13
je 0x9c87
movq %rbp, %rax
subq %r13, %rax
sarq $0x2, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r13, %rdi
movq %rbp, %rsi
callq 0xc229
movq %r13, %rdi
movq %rbp, %rsi
callq 0xc30c
movq 0x78(%rsp), %r13
movq 0x80(%rsp), %rbp
cmpq %rbp, %r13
je 0x9cc6
movq %rbp, %rax
subq %r13, %rax
sarq $0x2, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r13, %rdi
movq %rbp, %rsi
callq 0xc229
movq %r13, %rdi
movq %rbp, %rsi
callq 0xc30c
movq 0xb0(%rsp), %rax
movq 0xb8(%rsp), %rcx
movq 0x1f0(%rsp), %rdx
movq 0x1f8(%rsp), %rsi
cmpq %rcx, %rax
setne %dil
cmpq %rsi, %rdx
setne %r8b
andb %dil, %r8b
cmpb $0x1, %r8b
jne 0x9d9e
xorl %edi, %edi
movl (%rax), %r8d
movl (%rdx), %r9d
cmpl %r9d, %r8d
jge 0x9d14
addq $0x4, %rax
jmp 0x9d21
jg 0x9d1d
incq %rdi
addq $0x4, %rax
addq $0x4, %rdx
cmpq %rcx, %rax
je 0x9d2b
cmpq %rsi, %rdx
jne 0x9d03
testq %rdi, %rdi
je 0x9d9e
movq 0x98(%rsp), %rax
movq 0xa0(%rsp), %rcx
movq 0x78(%rsp), %rdx
movq 0x80(%rsp), %rsi
cmpq %rcx, %rax
setne %dil
cmpq %rsi, %rdx
setne %r9b
andb %dil, %r9b
xorl %r8d, %r8d
cmpb $0x1, %r9b
jne 0x9d9b
xorl %edi, %edi
movl (%rax), %r8d
movl (%rdx), %r9d
cmpl %r9d, %r8d
jge 0x9d7a
addq $0x4, %rax
jmp 0x9d87
jg 0x9d83
incq %rdi
addq $0x4, %rax
addq $0x4, %rdx
cmpq %rcx, %rax
je 0x9d91
cmpq %rsi, %rdx
jne 0x9d69
xorl %r8d, %r8d
testq %rdi, %rdi
setne %r8b
addl %r8d, %r15d
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x9dad
callq 0x32c0
movq 0x1f0(%rsp), %rdi
testq %rdi, %rdi
je 0x9dbf
callq 0x32c0
incq %rbx
cmpq 0x20(%rsp), %rbx
jne 0x9be0
cvtsi2ss %r15d, %xmm0
movss %xmm0, 0x8(%rsp)
movq 0x18(%rsp), %rbx
jmp 0x9de9
xorpd %xmm0, %xmm0
movss %xmm0, 0x8(%rsp)
subq 0xf8(%rsp), %rbx
xorps %xmm0, %xmm0
cvtsi2sd %rbx, %xmm0
divsd 0x836f(%rip), %xmm0     # 0x12170
addsd 0x8(%r14), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0xb70(%r14)
callq 0xd4f4
movss %xmm0, 0xb74(%r14)
movq 0xe1af(%rip), %rdi      # 0x17fd8
leaq 0x8478(%rip), %rsi      # 0x122a8
movl $0x19, %edx
callq 0x3340
cvtsi2ssq 0x20(%rsp), %xmm2
xorps %xmm0, %xmm0
cvtsi2ssl 0x68(%r14), %xmm0
movss 0x8(%rsp), %xmm1
movss %xmm2, 0x18(%rsp)
divss %xmm2, %xmm1
movss %xmm1, 0x8(%rsp)
mulss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
movq 0xe169(%rip), %rdi      # 0x17fd8
callq 0x3500
movq %rax, %rbx
leaq 0x8444(%rip), %rsi      # 0x122c2
movl $0xe, %edx
movq %rax, %rdi
callq 0x3340
xorps %xmm0, %xmm0
cvtss2sd 0x18(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
divsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsi2sdl 0x68(%r14), %xmm0
movsd %xmm1, 0x18(%rsp)
mulsd %xmm1, %xmm0
movq %rbx, %rdi
callq 0x3500
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x32d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31e0
leaq 0x1f0(%rsp), %rdi
callq 0x3410
leaq 0x1f0(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rcx
movl $0xfffffefb, %edx       # imm = 0xFFFFFEFB
andl 0x208(%rsp,%rcx), %edx
orl $0x4, %edx
movl %edx, 0x208(%rsp,%rcx)
movq -0x18(%rax), %rax
movq $0x2, 0x1f8(%rsp,%rax)
xorps %xmm0, %xmm0
cvtsi2ssl 0x68(%r14), %xmm0
movss 0x8(%rsp), %xmm1
mulss %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
callq 0x3500
movq %rax, %rbx
leaq 0x8383(%rip), %rsi      # 0x122d1
movl $0x1, %edx
movq %rax, %rdi
callq 0x3340
xorps %xmm1, %xmm1
cvtsi2sdl 0x68(%r14), %xmm1
movsd 0x18(%rsp), %xmm0
mulsd %xmm1, %xmm0
movq %rbx, %rdi
callq 0x3500
leaq 0x8884(%rip), %rsi      # 0x12801
movl $0x1, %edx
movq %rax, %rdi
callq 0x3340
leaq 0x88(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x8336(%rip), %rsi      # 0x122d3
leaq 0x8335(%rip), %rdx      # 0x122d9
leaq 0x78(%rsp), %rdi
callq 0xb452
movss 0xb70(%r14), %xmm0
movss %xmm0, 0x8(%rsp)
movss 0xb74(%r14), %xmm0
movss %xmm0, 0x18(%rsp)
leaq 0x1f8(%rsp), %rsi
leaq 0x170(%rsp), %rdi
callq 0x34f0
leaq 0x1c0(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0xb4e2
leaq 0x190(%rsp), %rdi
leaq 0x140(%rsp), %rsi
callq 0xb4e2
leaq 0x78(%rsp), %rsi
leaq 0x170(%rsp), %rdx
leaq 0x1c0(%rsp), %rcx
leaq 0x190(%rsp), %r8
movq %r14, %rdi
movss 0x8(%rsp), %xmm0
movss 0x18(%rsp), %xmm1
callq 0xa536
leaq 0x190(%rsp), %rdi
callq 0xb6b0
leaq 0x1c0(%rsp), %rdi
callq 0xb6b0
leaq 0x180(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa06c
callq 0x32c0
movq 0x78(%rsp), %rdi
cmpq %r15, %rdi
je 0xa07b
callq 0x32c0
movq 0xdf4e(%rip), %rsi      # 0x17fd0
leaq 0x1f0(%rsp), %rdi
callq 0x3170
leaq 0x260(%rsp), %rdi
callq 0x30e0
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0xa0ae
callq 0x32c0
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0xa0c0
callq 0x32c0
leaq 0x140(%rsp), %rdi
callq 0xb6b0
leaq 0xc8(%rsp), %rdi
callq 0xb6b0
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0xa102
callq 0x32c0
xorl %eax, %eax
movq %rax, 0x50(%rsp)
movl %eax, 0x58(%rsp)
movq %rax, 0x60(%rsp)
movl %eax, 0x68(%rsp)
movq %rax, 0x70(%rsp)
movq 0x110(%rsp), %rdi
testq %rdi, %rdi
je 0xa114
callq 0x32c0
movq 0x128(%rsp), %rdi
testq %rdi, %rdi
je 0xa126
callq 0x32c0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xa135
callq 0x32c0
xorps %xmm1, %xmm1
cvtsi2sdq 0x20(%rsp), %xmm1
movsd 0x28(%rsp), %xmm0
divsd %xmm1, %xmm0
addq $0x368, %rsp            # imm = 0x368
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8435(%rip), %rdi      # 0x12597
xorl %esi, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x3490
leaq 0x8423(%rip), %rdi      # 0x12597
movl $0x1, %esi
xorl %eax, %eax
callq 0x3490
movq %rax, %rbx
leaq 0x190(%rsp), %rdi
callq 0xb6b0
jmp 0xa195
movq %rax, %rbx
leaq 0x1c0(%rsp), %rdi
callq 0xb6b0
jmp 0xa1a7
movq %rax, %rbx
leaq 0x180(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa1c2
callq 0x32c0
jmp 0xa1c2
movq %rax, %rbx
movq 0x78(%rsp), %rdi
cmpq %r15, %rdi
je 0xa1fe
callq 0x32c0
jmp 0xa1fe
jmp 0xa1fb
jmp 0xa22e
movq %rax, %rbx
jmp 0xa26e
jmp 0xa233
movq %rax, %rbx
jmp 0xa2c2
movq %rax, %rbx
jmp 0xa2d4
movq %rax, %rbx
jmp 0xa2e6
jmp 0xa22e
movq %rax, %rbx
movq 0xddcb(%rip), %rsi      # 0x17fd0
leaq 0x1f0(%rsp), %rdi
callq 0x3170
leaq 0x260(%rsp), %rdi
callq 0x30e0
jmp 0xa25c
jmp 0xa22e
jmp 0xa233
jmp 0xa22e
jmp 0xa229
movq %rax, %rbx
jmp 0xa24a
movq %rax, %rbx
jmp 0xa25c
movq %rax, %rbx
jmp 0xa280
movq %rax, %rbx
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0xa24a
callq 0x32c0
movq 0x1f0(%rsp), %rdi
testq %rdi, %rdi
je 0xa25c
callq 0x32c0
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0xa26e
callq 0x32c0
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0xa280
callq 0x32c0
leaq 0x140(%rsp), %rdi
callq 0xb6b0
leaq 0xc8(%rsp), %rdi
callq 0xb6b0
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0xa2c2
callq 0x32c0
xorl %eax, %eax
movq %rax, 0x50(%rsp)
movl %eax, 0x58(%rsp)
movq %rax, 0x60(%rsp)
movl %eax, 0x68(%rsp)
movq %rax, 0x70(%rsp)
movq 0x110(%rsp), %rdi
testq %rdi, %rdi
je 0xa2d4
callq 0x32c0
movq 0x128(%rsp), %rdi
testq %rdi, %rdi
je 0xa2e6
callq 0x32c0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xa2f5
callq 0x32c0
movq %rbx, %rdi
callq 0x35c0
nop