// File: /workspace/github_cpp_makefile_star2_O3/adamiaonr[P]rid-analytics/src/rid-analytics.cpp
// Function: RID_Analytics::make_fwd_decision(RID_Router*, Path_State*, unsigned char, std::vector<std::vector<long double, std::allocator<long double>>, std::allocator<std::vector<long double, std::allocator<long double>>>>, std::vector<std::vector<long double, std::allocator<long double>>, std::allocator<std::vector<long double, std::allocator<long double>>>>, std::vector<RID_Analytics::fwd_decision, std::allocator<RID_Analytics::fwd_decision>>&)
int RID_Analytics::make_fwd_decision(
    RID_Router * router,
    Path_State * prev_state,
    uint8_t in_iface,
    std::vector<std::vector<__float080> > iface_probs,
    std::vector<std::vector<__float080> > out_fptree_probs,
    std::vector<RID_Analytics::fwd_decision> & fwd_decisions) {

    // IMPORTANT: here's what the 3 values in iface_probs[i][] carry
    //  - iface_probs[i][0] : P(L_i >  L_{~i}), i.e. the probability of an 'exclusive'
    //                        match at iface i.
    //                        this should be used for Single Match (SM) events
    //  - iface_probs[i][1] : P(L_i >= L_{~i}), Multiple Match (MM) situations which 
    //                        *DO NOT* involve the choice of iface 0.
    //                        this is useful when evaluating the probability of 
    //                        'fallback' events, in which we want to distinguish 
    //                        MM situations which involve / not involve local 
    //                        matches.
    //  - iface_probs[i][2] : P(L_i >= L_{~i}), multiple match situations which 
    //                        consider the involvement of iface 0.
    //                        this should be the maximum value of all iface[i][].

    // array to save avg. nr of events
    std::vector<__float080> events(EVENT_NUM, 0.0);

    // handle LLM events (iface 0)
    handle_llm(router, iface_probs, events, prev_state);

    // FIXME: special vars for soft fallback handling
    __float080 max_prob[3] = {0.0, 0.0, 0.0};
    int origin_iface = 0;
    // handle other events (iface > 0)
    for (int i = 1; i < router->get_iface_num(); i++) {

        if (on_path_to_origin(router, i, std::stoi(this->origin_server->get_id())))
            origin_iface = i;

        // check if the packet's ttl goes below 0 : if it does, end the path here
        // without adding a forwarding decision
        if ((prev_state->get_ttl() - 1) < 0) { 
            if (iface_probs[i][2] > 0.0)
                handle_ttl_drop(router, iface_probs[i][2], prev_state);
            continue;
        }

        // update the path probability (P(R_n) in the paper)
        __float080 path_prob = 0.0;
        if (this->mode == MMH_FLOOD) {

            // MMH_FLOOD uses P(L_i >= L_{~i}), w/ local matches
            path_prob = iface_probs[i][2];
            // SM event only considers P(L_i > L_{~i})

            if (this->tp_sizes[router->get_id()][i] > 0) {
                events[EVENT_SLMC] += iface_probs[i][0];
            } else {
                events[EVENT_SLMI] += iface_probs[i][0];
            }

            // MM event refers to P(L_i == L_{~i}), as such we do:
            //  P(L_i >= L_{~i}) - P(L_i > L_{~i})
            // FIXME : this will be used to calculate the avg. nr. of links 
            // used in 'flood' mode
            events[EVENT_MLM] += iface_probs[i][2] - iface_probs[i][0];

        } else if (((this->mode & 0x03) == HARD_FALLBACK)
            || ((this->mode & 0x03) == SOFT_FALLBACK)) {

            // as an approximation for the MM event probability, 
            // we use the iface which outputs the max. value of iface_probs[i][1]
            // FIXME: how do we explain this?
            if (max_prob[1] < iface_probs[i][2]) {

                max_prob[0] = iface_probs[i][0];
                max_prob[1] = iface_probs[i][1];

                // FIXME: workaround to get correct value of max_prob at start router
                if ((*router->get_blocked_ifaces())[0])
                    max_prob[2] = iface_probs[i][1];
                else
                    max_prob[2] = iface_probs[i][2];
            }

            // otherwise, use iface_probs[i][0]
            path_prob = iface_probs[i][0];
            if (this->tp_sizes[router->get_id()][i] > 0)
                events[EVENT_SLMC] += iface_probs[i][0];
            else
                events[EVENT_SLMI] += iface_probs[i][0];
        }

        // if path prob = 0.0, skip the addition of a fwd decision
        if (path_prob == 0.0) continue;

        // create a new path state
        Path_State * next_state = new Path_State(router, this->request_size);
        next_state->set_length(prev_state->get_length() + 1);
        // now, we deal with probabilities:
        //
        //  -# in_fptree_probs : the prob of having the packet 
        //     bound to a prefix tree of size s (no TP info)
        //
        //  -# in_iface_probs : the prob of having a packet 
        //     flow through iface i (takes TPs into account)
        //
        next_state->set_in_fptree_prob(&out_fptree_probs[i], this->request_size);
        next_state->set_path_prob(path_prob);
        next_state->set_in_iface_prob(path_prob);
        next_state->set_ttl(prev_state->get_ttl() - 1);

        // finally, we continue with the request path get the next hop router by iface
        RID_Router::nw_address next_hop = router->get_next_hop(i);
        // set the path's tree bitmask (by extracting the bitmask from the router's iface)
        next_state->set_tree_bitmasks(router->get_tree_bitmasks(i));

        // this can still happen (or can it?)
        // FIXME: this subtle condition is the one that actually terminates the run. 
        // FIXME: this could be the source of trouble.
        if (next_hop.router == router || i == in_iface) {
            std::cout << "RID_Analytics::make_fwd_decision() : [INFO] "
                << "found magic stopping condition" << std::endl;

            delete next_state;
            continue;
        }

        // add fwd_decision to fwd decision vector
        std::cout << "RID_Analytics::make_fwd_decision() : [INFO] saving fwd decision :"
            << "\n\tout[" << router->get_id() << "][" << i << "] -> in[" << next_hop.router->get_id() << "][" << (int) next_hop.iface << "]"
            << "\n\tpath prob = " << path_prob
            << "\n\tttl = " << (int) next_state->get_ttl() << std::endl;

        RID_Analytics::fwd_decision fd = {router, next_hop.router, i, next_hop.iface, next_state};
        fwd_decisions.push_back(fd);
    }

    // FIXME: special handling of SOFT_FALLBACK case
    if (this->mode == MMH_FLOOD) {

        events[EVENT_FPD] = std::max(
            (__float080) 0.0, 
            (prev_state->get_in_iface_prob() - events[EVENT_SLMC] - events[EVENT_SLMI] - iface_probs[0][0]));

    } else if ((this->mode & 0x03) == SOFT_FALLBACK) {

        bool updated = false;
        for (unsigned int k = 0; k < fwd_decisions.size(); k++) {

            if (fwd_decisions[k].out_iface == origin_iface) {

                // update fwd_decision on fwd decision vector
                fwd_decisions[k].state->set_path_prob(max_prob[1]);
                fwd_decisions[k].state->set_in_iface_prob(max_prob[1]);
                std::cout << "RID_Analytics::make_fwd_decision() : [INFO] updating fwd decision :"
                    << "\n\tout[" << router->get_id() << "][" << origin_iface << "] -> in[" << fwd_decisions[k].next_router->get_id() << "][" << (int) fwd_decisions[k].in_iface << "]"
                    << "\n\tpath prob = " << max_prob[1]
                    << "\n\tpath length = " << fwd_decisions[k].state->get_length()
                    << "\n\tttl = " << (int) fwd_decisions[k].state->get_ttl() << std::endl;

                // mark fwd decision over origin iface as 'updated'
                updated = true;

                // add 'soft fallback fwd' outcome w/ probability P(L_i == L_{~i})
                if ((max_prob[1] - max_prob[0]) > 0.0)
                    add_outcome(
                        router, 
                        OUTCOME_SOFT_FALLBACK_FWD, 
                        (max_prob[1] - max_prob[0]), 
                        prev_state->get_length());

                events[EVENT_MLM] += (max_prob[2] - max_prob[0]);
            }
        }

        // in case a fwd decision isn't updated above, add a new fwd decision
        if ((!updated) && (max_prob[1] > 0.0)) {
            add_fwd_decision(router, prev_state, out_fptree_probs, origin_iface, max_prob[1], 1, fwd_decisions);
        }

        // handle the case of having the request incorrectly delivered and 
        // recovered w/ a soft fallback (w/ +2 latency penalty)
        if ((!(this->tp_sizes[router->get_id()][0] > 0)) && ((max_prob[2] - max_prob[1]) > 0.0) && (iface_probs[0][2] > 0.0)) {
            add_fwd_decision(router, prev_state, out_fptree_probs, origin_iface, max_prob[2] - max_prob[1], 2, fwd_decisions);
        }

    } else if ((this->mode & 0x03) == HARD_FALLBACK) {

        __float080 mm_prob = std::max(
            (__float080) 0.0, 
            (prev_state->get_in_iface_prob() - events[EVENT_SLMC] - events[EVENT_SLMI] - iface_probs[0][2]));
        
        events[EVENT_FPD] = mm_prob;

        if (mm_prob > 0.0) {

            // 1) add correct delivery 
            add_outcome(
                router, 
                OUTCOME_CORRECT_DELIVERY, 
                (mm_prob), 
                prev_state->get_length() + get_origin_distance(router));

            // 2) register hard fallback activation
            add_outcome(
                router, 
                OUTCOME_HARD_FALLBACK_DELIVERY, 
                (mm_prob), 
                get_origin_distance(router));

            events[EVENT_MLM] += mm_prob;
        }

        if ((iface_probs[0][2] > 0.0) && (router->get_id() != origin_server->get_id()) && (!(this->tp_sizes[router->get_id()][0] > 0))) {

            events[EVENT_SLMI] += iface_probs[0][2];

            // 1) add correct delivery 
            add_outcome(
                router, 
                OUTCOME_CORRECT_DELIVERY, 
                iface_probs[0][2], 
                prev_state->get_length() + 1 + get_origin_distance(router));

            // 2) register hard fallback activation
            add_outcome(
                router, 
                OUTCOME_HARD_FALLBACK_DELIVERY, 
                iface_probs[0][2], 
                get_origin_distance(router));
        }
    }

    // // add fwd record to results
    // add_fwd(router, in_iface, prev_state, fwd_decisions);
    //  - add events probs to results
    add_events(router, events);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movq %r9, 0xc8(%rsp)
movq %r8, 0x70(%rsp)
movl %ecx, %r14d
movq %rdx, 0x58(%rsp)
movq %rsi, %rbx
movq %rdi, 0x28(%rsp)
movl $0x60, %edi
callq 0x4390
movq %rax, 0x108(%rsp)
leaq 0x60(%rax), %rdx
movq %rdx, 0x118(%rsp)
xorl %ecx, %ecx
fldz
fld %st(0)
fstpt (%rax,%rcx)
addq $0x10, %rcx
cmpq $0x60, %rcx
jne 0x263f4
fstpt 0xdc(%rsp)
movq %rax, 0x98(%rsp)
leaq 0x108(%rsp), %rcx
movq %rdx, 0x8(%rcx)
movq 0x28(%rsp), %rdi
movq %rbx, %rsi
movq 0x70(%rsp), %rdx
movq 0x58(%rsp), %r8
callq 0x25e1c
movl $0x0, 0x64(%rsp)
movq %rbx, 0x50(%rsp)
cmpb $0x2, 0x24(%rbx)
fldz
fld %st(0)
fstpt 0x8c(%rsp)
fstpt 0xfc(%rsp)
jb 0x26b65
movq 0x28(%rsp), %rax
addq $0x20, %rax
movq %rax, 0xd0(%rsp)
movzbl %r14b, %eax
movq 0x98(%rsp), %rcx
addq $0x10, %rcx
movq %rcx, 0x128(%rsp)
leaq (%rax,%rax,2), %rax
leaq -0x18(,%rax,8), %rax
movq %rax, 0x120(%rsp)
xorl %ebx, %ebx
fldz
movl $0x1, %r15d
movl $0x138, %ebp            # imm = 0x138
leaq 0x30(%rsp), %r14
fld %st(0)
fstpt 0xfc(%rsp)
fld %st(0)
fstpt 0x8c(%rsp)
fstpt 0xdc(%rsp)
movl $0x0, 0x64(%rsp)
movq 0x28(%rsp), %rax
movq 0x80(%rax), %rax
leaq 0x40(%rsp), %rcx
movq %rcx, 0x30(%rsp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x1bdb4
movq 0x30(%rsp), %r12
callq 0x4060
movq %rax, %r14
movl (%rax), %r13d
movl $0x0, (%rax)
movq %r12, %rdi
leaq 0xa0(%rsp), %rsi
movl $0xa, %edx
callq 0x4520
cmpq %r12, 0xa0(%rsp)
je 0x27406
movslq %eax, %rcx
cmpq %rax, %rcx
jne 0x27412
movl (%r14), %ecx
cmpl $0x22, %ecx
je 0x27412
testl %ecx, %ecx
jne 0x26550
movl %r13d, (%r14)
movq 0x50(%rsp), %rdi
movl %r15d, %esi
movl %eax, %edx
callq 0x25915
movl %eax, %r14d
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x2657e
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x43a0
testb %r14b, %r14b
movl 0x64(%rsp), %eax
cmovnel %r15d, %eax
movl %eax, 0x64(%rsp)
movq 0x58(%rsp), %rdi
callq 0x1efc0
leaq 0x30(%rsp), %r14
testl %eax, %eax
jle 0x2669b
movq 0x28(%rsp), %rax
movl 0x4(%rax), %eax
testl %eax, %eax
je 0x266d5
testb $0x2, %al
je 0x26b34
movq 0x70(%rsp), %rax
movq (%rax), %rax
movq 0x18(%rax,%rbx), %rax
fldt 0x20(%rax)
fldt 0x8c(%rsp)
fxch %st(1)
fucomi %st(1), %st
fstp %st(1)
fldt (%rax)
fstpt 0x80(%rsp)
jbe 0x26617
fldt 0x10(%rax)
movq 0x50(%rsp), %rax
movq 0x60(%rax), %rax
testb $0x1, (%rax)
fld %st(0)
fstpt 0x8c(%rsp)
fcmove %st(1), %st
fstp %st(1)
fstpt 0xdc(%rsp)
fldt 0x80(%rsp)
fstpt 0xfc(%rsp)
fldz
fstp %st(0)
leaq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x50(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x1bdb4
movq 0xd0(%rsp), %rdi
movq %r14, %rsi
callq 0x282e0
movq (%rax), %rax
movb (%rax,%r15), %r14b
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x2666d
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x43a0
xorl %eax, %eax
testb %r14b, %r14b
sete %al
movq 0x70(%rsp), %rcx
movq (%rcx), %rcx
movq 0x18(%rcx,%rbx), %rcx
fldt (%rcx)
shll $0x4, %eax
movq 0x98(%rsp), %rcx
addq %rcx, %rax
addq $0x30, %rax
jmp 0x2677b
movq 0x70(%rsp), %rax
movq (%rax), %rax
movq 0x18(%rax,%rbx), %rax
fldt 0x20(%rax)
fldz
fxch %st(1)
fucomi %st(1), %st
fstp %st(1)
jbe 0x26aa2
fstpt (%rsp)
movq 0x28(%rsp), %rdi
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdx
callq 0x25f68
jmp 0x26b34
movq 0x70(%rsp), %rax
movq (%rax), %rax
movq 0x18(%rax,%rbx), %rax
fldt 0x20(%rax)
fstpt 0x80(%rsp)
leaq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x50(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x1bdb4
movq 0xd0(%rsp), %rdi
movq %r14, %rsi
callq 0x282e0
movq (%rax), %rax
movb (%rax,%r15), %r14b
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x26740
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x43a0
xorl %eax, %eax
testb %r14b, %r14b
sete %al
movq 0x70(%rsp), %rcx
movq (%rcx), %rcx
movq 0x18(%rcx,%rbx), %rcx
fldt (%rcx)
shll $0x4, %eax
movq 0x98(%rsp), %rdx
fldt 0x30(%rax,%rdx)
faddp %st, %st(1)
fstpt 0x30(%rax,%rdx)
fldt 0x20(%rcx)
fldt (%rcx)
fsubrp %st, %st(1)
movq 0x128(%rsp), %rax
fldt (%rax)
faddp %st, %st(1)
fstpt (%rax)
fldz
fldt 0x80(%rsp)
fucompi %st(1), %st
fstp %st(0)
leaq 0x30(%rsp), %r14
jne 0x2679b
jnp 0x26b34
movl $0x90, %edi
callq 0x4390
movq %rax, %r12
movq 0x28(%rsp), %rax
movzbl (%rax), %edx
movq %r12, %rdi
movq 0x50(%rsp), %rsi
callq 0x1ee30
movq 0x58(%rsp), %rdi
callq 0x1ef10
incl %eax
movq %r12, %rdi
movl %eax, %esi
callq 0x1ef0c
movq 0xc8(%rsp), %rax
movq (%rax), %rax
leaq (%rax,%rbx), %rsi
addq $0x18, %rsi
movq 0x28(%rsp), %rax
movzbl (%rax), %edx
movq %r12, %rdi
callq 0x1ef28
fldt 0x80(%rsp)
fstpt (%rsp)
movq %r12, %rdi
callq 0x1ef1c
fldt 0x80(%rsp)
fstpt (%rsp)
movq %r12, %rdi
callq 0x1ef6c
movq 0x58(%rsp), %rdi
callq 0x1efc0
decl %eax
movq %r12, %rdi
movl %eax, %esi
callq 0x1efb8
movq 0x50(%rsp), %rax
movq 0x30(%rax), %rax
leaq (%rax,%rbp), %rsi
addq $-0x38, %rsi
movq 0x30(%rsi), %r14
movzbl 0x38(%rsi), %r13d
movq %r12, %rdi
callq 0x1efa8
cmpq %rbx, 0x120(%rsp)
je 0x26aa9
cmpq 0x50(%rsp), %r14
je 0x26aa9
movl $0x41, %edx
movq 0x18741(%rip), %rdi     # 0x3efb8
leaq 0xa991(%rip), %rsi      # 0x3120f
callq 0x4400
movl $0x6, %edx
movq 0x18729(%rip), %rdi     # 0x3efb8
leaq 0xa8f4(%rip), %rsi      # 0x3118a
callq 0x4400
movl %r13d, 0xc4(%rsp)
leaq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x50(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x30(%rsp), %rdi
callq 0x1bdb4
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq 0x186e1(%rip), %rdi     # 0x3efb8
callq 0x4400
movq %rax, %r13
movl $0x2, %edx
movq %rax, %rdi
leaq 0xa7b5(%rip), %rsi      # 0x310a3
callq 0x4400
movq %r13, %rdi
movl %r15d, %esi
callq 0x46d0
movq %rax, %r13
movl $0x8, %edx
movq %rax, %rdi
leaq 0xa881(%rip), %rsi      # 0x31191
callq 0x4400
leaq 0xb0(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0xa0(%rsp), %rdi
callq 0x1bdb4
movq 0xa0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
movq %r13, %rdi
callq 0x4400
movq %rax, %r13
movl $0x2, %edx
movq %rax, %rdi
leaq 0xa73d(%rip), %rsi      # 0x310a3
callq 0x4400
movq %r13, %rdi
movl 0xc4(%rsp), %esi
callq 0x46d0
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
leaq 0x6ed2(%rip), %rsi      # 0x2d85e
callq 0x4400
movl $0xe, %edx
movq %r13, %rdi
leaq 0xa7fa(%rip), %rsi      # 0x3119a
callq 0x4400
fldt 0x80(%rsp)
fstpt (%rsp)
movq %r13, %rdi
callq 0x41f0
movq %rax, %r13
movl $0x8, %edx
movq %rax, %rdi
leaq 0xa7f1(%rip), %rsi      # 0x311ba
callq 0x4400
movq %r12, %rdi
callq 0x1efc0
movq %r13, %rdi
movl %eax, %esi
callq 0x46d0
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x4370
movsbl %al, %esi
movq %r13, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x42a0
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x26a2f
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x43a0
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
movl 0xc4(%rsp), %r13d
je 0x26a53
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x43a0
movq 0x50(%rsp), %rax
movq %rax, 0x30(%rsp)
movq %r14, 0x38(%rsp)
movl %r15d, 0x40(%rsp)
movl %r13d, 0x44(%rsp)
movq %r12, 0x48(%rsp)
movq 0x1d0(%rsp), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x26b56
movups 0x30(%rsp), %xmm0
movups 0x40(%rsp), %xmm1
movups %xmm1, 0x10(%rsi)
movups %xmm0, (%rsi)
addq $0x20, 0x8(%rdi)
jmp 0x26b2f
fstp %st(0)
jmp 0x26b34
movl $0x2c, %edx
movq 0x18503(%rip), %rdi     # 0x3efb8
leaq 0xa707(%rip), %rsi      # 0x311c3
callq 0x4400
movl $0x1e, %edx
movq 0x184eb(%rip), %rdi     # 0x3efb8
leaq 0xa71c(%rip), %rsi      # 0x311f0
callq 0x4400
movq 0x184d8(%rip), %rcx     # 0x3efb8
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x4370
movsbl %al, %esi
movq 0x184ba(%rip), %rdi     # 0x3efb8
callq 0x4040
movq %rax, %rdi
callq 0x42a0
movq 0x50(%r12), %rdi
testq %rdi, %rdi
je 0x26b22
movq 0x60(%r12), %rsi
subq %rdi, %rsi
callq 0x43a0
movl $0x90, %esi
movq %r12, %rdi
callq 0x43a0
leaq 0x30(%rsp), %r14
incq %r15
movq 0x50(%rsp), %rax
movzbl 0x24(%rax), %eax
addq $0xa0, %rbp
addq $0x18, %rbx
cmpq %rax, %r15
jb 0x264d0
jmp 0x26b65
leaq 0x30(%rsp), %r14
movq %r14, %rdx
callq 0x29764
jmp 0x26b34
movq 0x28(%rsp), %rax
movl 0x4(%rax), %eax
testl %eax, %eax
je 0x26ee1
andl $0x3, %eax
cmpl $0x3, %eax
movq 0x50(%rsp), %rbx
movq 0x98(%rsp), %r14
je 0x26f25
cmpl $0x2, %eax
jne 0x2738e
movq 0x1d0(%rsp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
cmpq %rax, %rcx
je 0x270fa
leaq 0xb0(%rsp), %rbp
fldt 0x8c(%rsp)
fldt 0xfc(%rsp)
fsubr %st, %st(1)
fxch %st(1)
fstpt 0x80(%rsp)
fldt 0xdc(%rsp)
fsubp %st, %st(1)
fstpt 0xd0(%rsp)
movl $0x1, %ebx
xorl %r13d, %r13d
movq 0x183c9(%rip), %r15     # 0x3efb8
leaq 0xa4ad(%rip), %r12      # 0x310a3
xorl %edx, %edx
shlq $0x5, %r13
movl 0x64(%rsp), %esi
cmpl %esi, 0x10(%rax,%r13)
jne 0x26ec4
addq %r13, %rax
movq 0x18(%rax), %rdi
fldt 0x8c(%rsp)
fstpt (%rsp)
callq 0x1ef1c
movq 0x1d0(%rsp), %rax
movq (%rax), %rax
movq 0x18(%rax,%r13), %rdi
fldt 0x8c(%rsp)
fstpt (%rsp)
callq 0x1ef6c
movl $0x43, %edx
movq %r15, %rdi
leaq 0xa602(%rip), %rsi      # 0x31251
callq 0x4400
movl $0x6, %edx
movq %r15, %rdi
leaq 0xa527(%rip), %rsi      # 0x3118a
callq 0x4400
leaq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x50(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x30(%rsp), %rdi
callq 0x1bdb4
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq %r15, %rdi
callq 0x4400
movq %rax, %r14
movl $0x2, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x4400
movq %r14, %rdi
movl 0x64(%rsp), %esi
callq 0x46d0
movq %rax, %r14
movl $0x8, %edx
movq %rax, %rdi
leaq 0xa4c3(%rip), %rsi      # 0x31191
callq 0x4400
movq 0x1d0(%rsp), %rax
movq (%rax), %rax
movq 0x8(%rax,%r13), %rax
movq %rbp, 0xa0(%rsp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0xa0(%rsp), %rdi
callq 0x1bdb4
movq 0xa0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
movq %r14, %rdi
callq 0x4400
movq %rax, %r14
movl $0x2, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x4400
movq 0x1d0(%rsp), %rax
movq (%rax), %rax
movl 0x14(%rax,%r13), %esi
movq %r14, %rdi
callq 0x46d0
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0x6b07(%rip), %rsi      # 0x2d85e
callq 0x4400
movl $0xe, %edx
movq %r14, %rdi
leaq 0xa42f(%rip), %rsi      # 0x3119a
callq 0x4400
fldt 0x8c(%rsp)
fstpt (%rsp)
movq %r14, %rdi
callq 0x41f0
movq %rax, %r14
movl $0x10, %edx
movq %rax, %rdi
leaq 0xa415(%rip), %rsi      # 0x311a9
callq 0x4400
movq 0x1d0(%rsp), %rax
movq (%rax), %rax
movq 0x18(%rax,%r13), %rdi
callq 0x1ef10
movq %r14, %rdi
movl %eax, %esi
callq 0x46d0
movq %rax, %r14
movl $0x8, %edx
movq %rax, %rdi
leaq 0xa3f0(%rip), %rsi      # 0x311ba
callq 0x4400
movq 0x1d0(%rsp), %rax
movq (%rax), %rax
movq 0x18(%rax,%r13), %rdi
callq 0x1efc0
movq %r14, %rdi
movl %eax, %esi
callq 0x46d0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4370
movsbl %al, %esi
movq %r14, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x42a0
movq 0xa0(%rsp), %rdi
cmpq %rbp, %rdi
je 0x26e35
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x43a0
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x26e51
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x43a0
fldt 0x80(%rsp)
fldz
fxch %st(1)
fucompi %st(1), %st
fstp %st(0)
jbe 0x26e9c
movq 0x58(%rsp), %rdi
callq 0x1ef10
movl %eax, 0xe8(%rsp)
fildl 0xe8(%rsp)
fstpt 0x10(%rsp)
fldt 0x80(%rsp)
fstpt (%rsp)
movq 0x28(%rsp), %rdi
movq 0x50(%rsp), %rsi
movl $0xa, %edx
callq 0x2574a
movq 0x98(%rsp), %rax
fldt 0x10(%rax)
fldt 0xd0(%rsp)
faddp %st, %st(1)
fstpt 0x10(%rax)
movq 0x1d0(%rsp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
movb $0x1, %dl
movl %ebx, %r13d
movq %rcx, %rsi
subq %rax, %rsi
sarq $0x5, %rsi
incl %ebx
cmpq %r13, %rsi
ja 0x26bf8
jmp 0x270fc
movq 0x58(%rsp), %rdi
callq 0x1ef86
movq 0x50(%rsp), %rbx
movq 0x98(%rsp), %rcx
fldt 0x30(%rcx)
fsubrp %st, %st(1)
fldt 0x40(%rcx)
fsubrp %st, %st(1)
movq 0x70(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rax
fldt (%rax)
fsubrp %st, %st(1)
fldz
fxch %st(1)
fucomi %st(1), %st
fxch %st(1)
fcmovnbe %st(1), %st
fstp %st(1)
fstpt 0x50(%rcx)
jmp 0x2738e
movq 0x58(%rsp), %rdi
callq 0x1ef86
fldt 0x30(%r14)
fsubrp %st, %st(1)
fldt 0x40(%r14)
fsubrp %st, %st(1)
movq 0x70(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rax
fldt 0x20(%rax)
fsubrp %st, %st(1)
fldz
fxch %st(1)
fucomi %st(1), %st
fld %st(0)
fstpt 0x64(%rsp)
fxch %st(1)
fcmovnbe %st(1), %st
fstp %st(1)
fstpt 0x50(%r14)
jbe 0x26ffb
movq 0x58(%rsp), %rdi
callq 0x1ef10
movl %eax, %ebp
movq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq 0x25384
addl %ebp, %eax
movl %eax, 0xf8(%rsp)
fildl 0xf8(%rsp)
fldt 0x64(%rsp)
fstpt (%rsp)
fstpt 0x10(%rsp)
movq 0x28(%rsp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2574a
movq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq 0x25384
movl %eax, 0xf4(%rsp)
fildl 0xf4(%rsp)
fstpt 0x10(%rsp)
fldt 0x64(%rsp)
fstpt (%rsp)
movq 0x28(%rsp), %rdi
movq %rbx, %rsi
movl $0x2, %edx
callq 0x2574a
fldt 0x10(%r14)
fldt 0x64(%rsp)
faddp %st, %st(1)
fstpt 0x10(%r14)
movq 0x70(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rax
fldt 0x20(%rax)
fldz
fxch %st(1)
fucompi %st(1), %st
fstp %st(0)
jbe 0x2738e
leaq 0x40(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq 0x30(%rsp), %rdi
callq 0x1bdb4
movq 0x28(%rsp), %rax
movq 0x80(%rax), %rax
leaq 0xb0(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0xa0(%rsp), %rdi
callq 0x1bdb4
movq 0x38(%rsp), %rdx
cmpq 0xa8(%rsp), %rdx
jne 0x2708e
movq 0xa0(%rsp), %r14
testq %rdx, %rdx
je 0x2729a
movq 0x30(%rsp), %rdi
movq %r14, %rsi
callq 0x43b0
testl %eax, %eax
je 0x2729a
leaq 0x158(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq 0x148(%rsp), %rdi
callq 0x1bdb4
movq 0x28(%rsp), %rax
leaq 0x20(%rax), %rdi
leaq 0x148(%rsp), %rsi
callq 0x282e0
movq (%rax), %rax
cmpb $0x0, (%rax)
sete %bl
movq 0x148(%rsp), %rdi
cmpq %r14, %rdi
je 0x270ed
movq 0x158(%rsp), %rsi
incq %rsi
callq 0x43a0
movq 0xa0(%rsp), %r14
jmp 0x2729c
xorl %edx, %edx
testb $0x1, %dl
movq 0x50(%rsp), %rbx
movq 0x1d0(%rsp), %r14
jne 0x27173
fldz
fldt 0x8c(%rsp)
fucompi %st(1), %st
fstp %st(0)
jbe 0x27173
leaq 0x180(%rsp), %rdi
movq 0xc8(%rsp), %rsi
callq 0x2835c
movq %r14, 0x10(%rsp)
fldt 0x8c(%rsp)
fstpt (%rsp)
leaq 0x180(%rsp), %rcx
movq 0x28(%rsp), %rdi
movq %rbx, %rsi
movq 0x58(%rsp), %rdx
movl 0x64(%rsp), %r8d
movl $0x1, %r9d
callq 0x26000
leaq 0x180(%rsp), %rdi
callq 0x1dd38
leaq 0x40(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq 0x30(%rsp), %rdi
callq 0x1bdb4
movq 0x28(%rsp), %rax
leaq 0x20(%rax), %rdi
leaq 0x30(%rsp), %rsi
callq 0x282e0
movq (%rax), %rax
cmpb $0x0, (%rax)
fldz
jne 0x27278
fstp %st(0)
fldt 0xdc(%rsp)
fldt 0x8c(%rsp)
fsubrp %st, %st(1)
fldz
fld %st(1)
fstpt 0x80(%rsp)
fxch %st(1)
fucompi %st(1), %st
jbe 0x27278
movq 0x70(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rax
fldt 0x20(%rax)
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x2720b
fstp %st(1)
movq 0x40(%rsp), %rsi
incq %rsi
fstpt 0x70(%rsp)
callq 0x43a0
fldt 0x70(%rsp)
fldz
fxch %st(1)
fucompi %st(1), %st
fstp %st(0)
jbe 0x2738e
leaq 0x168(%rsp), %rdi
movq 0xc8(%rsp), %rsi
callq 0x2835c
movq 0x1d0(%rsp), %rax
movq %rax, 0x10(%rsp)
fldt 0x80(%rsp)
fstpt (%rsp)
leaq 0x168(%rsp), %rcx
movq 0x28(%rsp), %rdi
movq %rbx, %rsi
movq 0x58(%rsp), %rdx
movl 0x64(%rsp), %r8d
movl $0x2, %r9d
callq 0x26000
leaq 0x168(%rsp), %rdi
callq 0x1dd38
jmp 0x2738e
fstp %st(0)
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x2738e
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x43a0
jmp 0x2738e
xorl %ebx, %ebx
cmpq %r12, %r14
je 0x272b4
movq 0xb0(%rsp), %rsi
incq %rsi
movq %r14, %rdi
callq 0x43a0
movq 0x30(%rsp), %rdi
cmpq %r15, %rdi
je 0x272cb
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x43a0
testb %bl, %bl
movq 0x50(%rsp), %rbx
movq 0x98(%rsp), %rcx
je 0x2738e
movq 0x70(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rax
fldt 0x20(%rax)
fldt 0x40(%rcx)
faddp %st, %st(1)
fstpt 0x40(%rcx)
fldt 0x20(%rax)
fstpt 0x64(%rsp)
movq 0x58(%rsp), %rdi
callq 0x1ef10
movl %eax, %r14d
movq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq 0x25384
addl %r14d, %eax
incl %eax
movl %eax, 0xf0(%rsp)
fildl 0xf0(%rsp)
fldt 0x64(%rsp)
fstpt (%rsp)
fstpt 0x10(%rsp)
movq 0x28(%rsp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2574a
movq 0x70(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rax
fldt 0x20(%rax)
fstpt 0x64(%rsp)
movq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq 0x25384
movl %eax, 0xec(%rsp)
fildl 0xec(%rsp)
fstpt 0x10(%rsp)
fldt 0x64(%rsp)
fstpt (%rsp)
movq 0x28(%rsp), %rdi
movq %rbx, %rsi
movl $0x2, %edx
callq 0x2574a
leaq 0x130(%rsp), %rdi
leaq 0x108(%rsp), %rsi
callq 0x1e0c8
leaq 0x130(%rsp), %rdx
movq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq 0x2597a
movq 0x130(%rsp), %rdi
testq %rdi, %rdi
je 0x273d5
movq 0x140(%rsp), %rsi
subq %rdi, %rsi
callq 0x43a0
movq 0x108(%rsp), %rdi
testq %rdi, %rdi
je 0x273f2
movq 0x118(%rsp), %rsi
subq %rdi, %rsi
callq 0x43a0
xorl %eax, %eax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x900d(%rip), %rdi      # 0x3041a
callq 0x4250
leaq 0x9001(%rip), %rdi      # 0x3041a
callq 0x4580
movq %rax, %rbx
leaq 0x168(%rsp), %rdi
jmp 0x2747a
movq %rax, %rbx
movq 0x148(%rsp), %rdi
cmpq %r14, %rdi
je 0x27450
movq 0x158(%rsp), %rsi
incq %rsi
callq 0x43a0
jmp 0x27450
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
cmpq %r12, %rdi
je 0x27487
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x43a0
jmp 0x27487
movq %rax, %rbx
leaq 0x180(%rsp), %rdi
callq 0x1dd38
jmp 0x27587
movq %rax, %rbx
movq 0x30(%rsp), %rdi
cmpq %r15, %rdi
jne 0x2757a
jmp 0x27587
jmp 0x27538
jmp 0x27538
movq %rax, %rbx
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
jne 0x2757a
jmp 0x27587
jmp 0x27538
fstp %st(0)
jmp 0x27538
fstp %st(0)
jmp 0x27538
jmp 0x27538
jmp 0x27538
movq %rax, %rbx
movq 0x130(%rsp), %rdi
testq %rdi, %rdi
je 0x27587
movq 0x140(%rsp), %rsi
subq %rdi, %rsi
jmp 0x27582
jmp 0x27538
jmp 0x27538
jmp 0x27531
jmp 0x27538
jmp 0x27538
jmp 0x27531
movq %rax, %rbx
movl $0x90, %esi
movq %r12, %rdi
jmp 0x27582
jmp 0x27531
jmp 0x27538
jmp 0x27531
jmp 0x27538
jmp 0x27531
jmp 0x27531
jmp 0x27538
jmp 0x27538
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
jne 0x2754d
jmp 0x2756b
jmp 0x27538
movq %rax, %rbx
jmp 0x2756b
jmp 0x27538
movq %rax, %rbx
jmp 0x27587
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
cmpq %rbp, %rdi
je 0x2756b
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x43a0
jmp 0x2756b
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x2756b
movl %r13d, (%r14)
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x27587
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x43a0
movq 0x108(%rsp), %rdi
testq %rdi, %rdi
je 0x275a4
movq 0x118(%rsp), %rsi
subq %rdi, %rsi
callq 0x43a0
movq %rbx, %rdi
callq 0x4700