// File: /workspace/github_cpp_makefile_star2_O2/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 $0x1a8, %rsp            # imm = 0x1A8
movq %r9, 0xa8(%rsp)
movq %r8, %r13
movl %ecx, %ebx
movq %rdx, %rbp
movq %rsi, %r15
movq %rdi, %r12
fldz
fstpt 0x70(%rsp)
leaq 0xd0(%rsp), %r14
pushq $0x6
popq %rsi
leaq 0x70(%rsp), %rdx
leaq 0x100(%rsp), %rcx
movq %r14, %rdi
callq 0x18df8
movq %r12, %rdi
movq %r15, %rsi
movq %r13, 0x38(%rsp)
movq %r13, %rdx
movq %r14, %rcx
movq %rbp, 0x48(%rsp)
movq %rbp, %r8
callq 0x1ff14
movq %r15, 0x30(%rsp)
leaq 0x60(%r15), %rax
movq %rax, 0x130(%rsp)
movq %r12, 0x50(%rsp)
leaq 0x20(%r12), %rax
movq %rax, 0xa0(%rsp)
movzbl %bl, %eax
imulq $0x18, %rax, %rax
addq $-0x18, %rax
movq %rax, 0x138(%rsp)
movq $0x0, 0x20(%rsp)
pushq $0x1
popq %rbp
movl $0x138, %eax            # imm = 0x138
movq %rax, 0xf8(%rsp)
leaq 0x70(%rsp), %r14
fldz
fld %st(0)
fstpt 0xec(%rsp)
fld %st(0)
fstpt 0x58(%rsp)
fstpt 0x124(%rsp)
xorl %r13d, %r13d
movq 0x30(%rsp), %rax
movzbl 0x24(%rax), %eax
cmpq %rax, %rbp
jae 0x208ca
movq 0x50(%rsp), %rax
movq 0x80(%rax), %rsi
movq %r14, %rdi
callq 0x4510
movq %r14, %r15
movq %r14, %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x16ca1
movq 0x30(%rsp), %rdi
movl %ebp, %esi
movl %eax, %edx
callq 0x1fb9c
movl %eax, %ebx
movq %r15, %r14
movq %r15, %rdi
callq 0x41c0
testb %bl, %bl
cmovnel %ebp, %r13d
movq 0x48(%rsp), %rdi
callq 0x1abc4
testl %eax, %eax
jle 0x20533
movq 0x50(%rsp), %rax
movl 0x4(%rax), %eax
testl %eax, %eax
je 0x20572
testb $0x2, %al
je 0x208b0
movq 0x38(%rsp), %rax
movq (%rax), %rax
movq 0x20(%rsp), %rcx
movq 0x18(%rax,%rcx), %rax
fldt 0x20(%rax)
fldt 0x58(%rsp)
fxch %st(1)
fucompi %st(1), %st
fstp %st(0)
jbe 0x204d5
fldt (%rax)
fstpt 0x124(%rsp)
fldt 0x10(%rax)
fstpt 0x58(%rsp)
movq 0x130(%rsp), %rdi
xorl %esi, %esi
callq 0x1905e
xorl %ecx, %ecx
testq %rdx, (%rax)
sete %cl
movq 0x38(%rsp), %rax
movq (%rax), %rax
movq 0x20(%rsp), %rdx
movq 0x18(%rax,%rdx), %rax
shll $0x4, %ecx
fldt 0x10(%rcx,%rax)
fstpt 0xec(%rsp)
fldt (%rax)
fstpt 0x64(%rsp)
movq %r14, %rdi
movq 0x30(%rsp), %rsi
callq 0x4510
movq 0xa0(%rsp), %rdi
movq %r14, %rsi
callq 0x21b0e
movq (%rax), %rax
movb (%rax,%rbp), %bl
movq %r14, %rdi
callq 0x41c0
movq 0x38(%rsp), %rax
movq (%rax), %rax
movq 0x20(%rsp), %rcx
movq 0x18(%rax,%rcx), %rax
fldt (%rax)
movq 0xd0(%rsp), %rax
testb %bl, %bl
je 0x205f9
addq $0x30, %rax
jmp 0x205fd
movq 0x38(%rsp), %rax
movq (%rax), %rax
movq 0x20(%rsp), %rcx
movq 0x18(%rax,%rcx), %rax
fldt 0x20(%rax)
fldz
fxch %st(1)
fucomi %st(1), %st
fstp %st(1)
jbe 0x205f2
fstpt (%rsp)
movq 0x50(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0x48(%rsp), %rdx
callq 0x1fffc
jmp 0x208b0
movq 0x38(%rsp), %rax
movq (%rax), %rax
movq 0x20(%rsp), %rcx
movq 0x18(%rax,%rcx), %rax
fldt 0x20(%rax)
fstpt 0x64(%rsp)
movq %r14, %rdi
movq 0x30(%rsp), %rsi
callq 0x4510
movq 0xa0(%rsp), %rdi
movq %r14, %rsi
callq 0x21b0e
movq (%rax), %rax
xorl %ebx, %ebx
cmpb $0x0, (%rax,%rbp)
sete %bl
movq %r14, %rdi
callq 0x41c0
movq 0x38(%rsp), %rax
movq (%rax), %rax
movq 0x20(%rsp), %rcx
movq 0x18(%rax,%rcx), %rcx
fldt (%rcx)
movq 0xd0(%rsp), %rax
shll $0x4, %ebx
fldt 0x30(%rbx,%rax)
faddp %st, %st(1)
fstpt 0x30(%rbx,%rax)
fldt 0x20(%rcx)
fldt (%rcx)
fsubrp %st, %st(1)
addq $0x10, %rax
jmp 0x205fd
fstp %st(0)
jmp 0x208b0
addq $0x40, %rax
fldt (%rax)
faddp %st, %st(1)
fstpt (%rax)
fldz
fldt 0x64(%rsp)
fucompi %st(1), %st
fstp %st(0)
jne 0x20615
jnp 0x208ad
movl $0x90, %edi
callq 0x43c0
movq %rax, %r12
movq 0x50(%rsp), %rax
movzbl (%rax), %edx
movq %r12, %rdi
movq 0x30(%rsp), %rsi
callq 0x1aa7c
movq 0x48(%rsp), %rdi
callq 0x1ab16
incl %eax
movq %r12, %rdi
movl %eax, %esi
callq 0x1ab12
movq 0xa8(%rsp), %rax
movq (%rax), %rax
movq 0x20(%rsp), %rcx
leaq (%rax,%rcx), %rsi
addq $0x18, %rsi
movq 0x50(%rsp), %rax
movzbl (%rax), %edx
movq %r12, %rdi
callq 0x1ab2e
fldt 0x64(%rsp)
fstpt (%rsp)
movq %r12, %rdi
callq 0x1ab22
fldt 0x64(%rsp)
fstpt (%rsp)
movq %r12, %rdi
callq 0x1ab70
movq 0x48(%rsp), %rdi
callq 0x1abc4
decl %eax
movq %r12, %rdi
movl %eax, %esi
callq 0x1abbc
movq 0x30(%rsp), %rax
movq 0x30(%rax), %rax
movq 0xf8(%rsp), %rcx
leaq (%rax,%rcx), %rsi
addq $-0x38, %rsi
movq 0x30(%rsi), %rax
movq %rax, 0xb0(%rsp)
movzbl 0x38(%rsi), %eax
movl %eax, 0x9c(%rsp)
movq %r12, %rdi
callq 0x1abac
movq 0x20(%rsp), %rax
cmpq %rax, 0x138(%rsp)
je 0x2086a
movq 0xb0(%rsp), %rax
cmpq 0x30(%rsp), %rax
je 0x2086a
movq 0x1a8a2(%rip), %rdi     # 0x3afb0
leaq 0xacba(%rip), %rsi      # 0x2b3cf
callq 0x43a0
movq %rax, %rdi
leaq 0xac26(%rip), %rsi      # 0x2b34a
callq 0x43a0
movq %rax, %r14
movq %r15, %rbx
movq %r15, %rdi
movq 0x30(%rsp), %rsi
callq 0x4510
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4360
movq %rax, %rdi
leaq 0xab12(%rip), %rsi      # 0x2b263
callq 0x43a0
movq %rax, %rdi
movl %ebp, %esi
callq 0x46d0
movq %rax, %rdi
leaq 0xabe7(%rip), %rsi      # 0x2b351
callq 0x43a0
movq %rax, %r14
leaq 0x100(%rsp), %rbx
movq %rbx, %rdi
movq 0xb0(%rsp), %rsi
callq 0x4510
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4360
movq %rax, %rdi
leaq 0xaac4(%rip), %rsi      # 0x2b263
callq 0x43a0
movq %rax, %rdi
movl 0x9c(%rsp), %esi
callq 0x46d0
movq %rax, %rdi
leaq 0x70a1(%rip), %rsi      # 0x2785e
callq 0x43a0
movq %rax, %rdi
leaq 0xab8e(%rip), %rsi      # 0x2b35a
callq 0x43a0
fldt 0x64(%rsp)
fstpt (%rsp)
movq %rax, %rdi
callq 0x4220
movq %rax, %rdi
leaq 0xab90(%rip), %rsi      # 0x2b37a
callq 0x43a0
movq %rax, %r14
movq %r12, %rdi
callq 0x1abc4
movq %r14, %rdi
movl %eax, %esi
callq 0x46d0
movq %rax, %rdi
callq 0x41e0
leaq 0x100(%rsp), %rdi
callq 0x41c0
movq %r15, %rdi
callq 0x41c0
movq 0x30(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0xb0(%rsp), %rax
movq %rax, 0x78(%rsp)
movq %r15, %r14
movl %ebp, 0x80(%rsp)
movl 0x9c(%rsp), %eax
movl %eax, 0x84(%rsp)
movq %r12, 0x88(%rsp)
movq 0x1e0(%rsp), %rdi
movq %r15, %rsi
callq 0x21b74
jmp 0x208b0
movq 0x1a73f(%rip), %rdi     # 0x3afb0
leaq 0xab0b(%rip), %rsi      # 0x2b383
callq 0x43a0
movq %rax, %rdi
leaq 0xab29(%rip), %rsi      # 0x2b3b0
callq 0x43a0
movq %rax, %rdi
callq 0x41e0
movq %r12, %rdi
addq $0x50, %rdi
callq 0x195d0
movl $0x90, %esi
movq %r12, %rdi
callq 0x43d0
movq %r15, %r14
incq %rbp
addq $0xa0, 0xf8(%rsp)
addq $0x18, 0x20(%rsp)
jmp 0x203ec
movq 0x50(%rsp), %r15
movl 0x4(%r15), %eax
testl %eax, %eax
je 0x20b43
andl $0x3, %eax
cmpl $0x3, %eax
movq 0x30(%rsp), %r14
je 0x20b87
cmpl $0x2, %eax
jne 0x20f05
fldt 0x58(%rsp)
fldt 0x124(%rsp)
fsubr %st, %st(1)
fxch %st(1)
fstpt 0x20(%rsp)
fldt 0xec(%rsp)
fsubp %st, %st(1)
fstpt 0x64(%rsp)
xorl %eax, %eax
leaq 0x70(%rsp), %r15
leaq 0x100(%rsp), %rbp
xorl %r14d, %r14d
movl %r14d, %r14d
movq 0x1e0(%rsp), %rdx
movq (%rdx), %rcx
movq 0x8(%rdx), %rdx
subq %rcx, %rdx
sarq $0x5, %rdx
cmpq %r14, %rdx
jbe 0x20daf
movq %r14, %r12
shlq $0x5, %r12
cmpl %r13d, 0x10(%rcx,%r12)
jne 0x20b3b
addq %r12, %rcx
movq 0x18(%rcx), %rdi
fldt 0x58(%rsp)
fstpt (%rsp)
callq 0x1ab22
movq 0x1e0(%rsp), %rax
movq (%rax), %rax
movq 0x18(%rax,%r12), %rdi
fldt 0x58(%rsp)
fstpt (%rsp)
callq 0x1ab70
movq 0x1a61f(%rip), %rdi     # 0x3afb0
leaq 0xaa79(%rip), %rsi      # 0x2b411
callq 0x43a0
movq %rax, %rdi
leaq 0xa9a3(%rip), %rsi      # 0x2b34a
callq 0x43a0
movq %rax, %rbx
movq %r15, %rdi
movq 0x30(%rsp), %rsi
callq 0x4510
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4360
movq %rax, %rdi
leaq 0xa892(%rip), %rsi      # 0x2b263
callq 0x43a0
movq %rax, %rdi
movl %r13d, %esi
callq 0x46d0
movq %rax, %rdi
leaq 0xa966(%rip), %rsi      # 0x2b351
callq 0x43a0
movq %rax, %rbx
movq 0x1e0(%rsp), %rax
movq (%rax), %rax
movq 0x8(%rax,%r12), %rsi
movq %rbp, %rdi
callq 0x4510
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x4360
movq %rax, %rdi
leaq 0xa843(%rip), %rsi      # 0x2b263
callq 0x43a0
movq 0x1e0(%rsp), %rcx
movq (%rcx), %rcx
movl 0x14(%rcx,%r12), %esi
movq %rax, %rdi
callq 0x46d0
movq %rax, %rdi
leaq 0x6e17(%rip), %rsi      # 0x2785e
callq 0x43a0
movq %rax, %rdi
leaq 0xa904(%rip), %rsi      # 0x2b35a
callq 0x43a0
fldt 0x58(%rsp)
fstpt (%rsp)
movq %rax, %rdi
callq 0x4220
movq %rax, %rdi
leaq 0xa8f5(%rip), %rsi      # 0x2b369
callq 0x43a0
movq %rax, %rbx
movq 0x1e0(%rsp), %rax
movq (%rax), %rax
movq 0x18(%rax,%r12), %rdi
callq 0x1ab16
movq %rbx, %rdi
movl %eax, %esi
callq 0x46d0
movq %rax, %rdi
leaq 0xa8d5(%rip), %rsi      # 0x2b37a
callq 0x43a0
movq %rax, %rbx
movq 0x1e0(%rsp), %rax
movq (%rax), %rax
movq 0x18(%rax,%r12), %rdi
callq 0x1abc4
movq %rbx, %rdi
movl %eax, %esi
callq 0x46d0
movq %rax, %rdi
callq 0x41e0
movq %rbp, %rdi
callq 0x41c0
movq %r15, %rdi
callq 0x41c0
fldz
fldt 0x20(%rsp)
fucompi %st(1), %st
fstp %st(0)
jbe 0x20b25
movq 0x48(%rsp), %rdi
callq 0x1ab16
movl %eax, 0xbc(%rsp)
fildl 0xbc(%rsp)
fstpt 0x10(%rsp)
fldt 0x20(%rsp)
fstpt (%rsp)
movq 0x50(%rsp), %rdi
movq 0x30(%rsp), %rsi
pushq $0xa
popq %rdx
callq 0x1fa66
movq 0xd0(%rsp), %rax
fldt 0x10(%rax)
fldt 0x64(%rsp)
faddp %st, %st(1)
fstpt 0x10(%rax)
movb $0x1, %al
incl %r14d
jmp 0x20927
movq 0x48(%rsp), %rdi
callq 0x1ab8a
movq 0x30(%rsp), %r14
movq 0xd0(%rsp), %rax
fldt 0x30(%rax)
fsubrp %st, %st(1)
fldt 0x40(%rax)
fsubrp %st, %st(1)
movq 0x38(%rsp), %rcx
movq (%rcx), %rcx
movq (%rcx), %rcx
fldt (%rcx)
fsubrp %st, %st(1)
fldz
fxch %st(1)
fucomi %st(1), %st
fxch %st(1)
fcmovnbe %st(1), %st
fstp %st(1)
fstpt 0x50(%rax)
jmp 0x20f05
movq 0x48(%rsp), %rdi
callq 0x1ab8a
movq 0xd0(%rsp), %rcx
fldt 0x30(%rcx)
fsubrp %st, %st(1)
fldt 0x40(%rcx)
fsubrp %st, %st(1)
movq 0x38(%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 0x20(%rsp)
fxch %st(1)
fcmovnbe %st(1), %st
fstp %st(1)
fstpt 0x50(%rcx)
jbe 0x20c5e
movq 0x48(%rsp), %rdi
callq 0x1ab16
movl %eax, %ebx
movq %r15, %rdi
movq %r14, %rsi
callq 0x1f8ba
addl %ebx, %eax
movl %eax, 0xcc(%rsp)
fildl 0xcc(%rsp)
fldt 0x20(%rsp)
fstpt (%rsp)
fstpt 0x10(%rsp)
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x1fa66
movq %r15, %rdi
movq %r14, %rsi
callq 0x1f8ba
movl %eax, 0xc8(%rsp)
fildl 0xc8(%rsp)
fstpt 0x10(%rsp)
fldt 0x20(%rsp)
fstpt (%rsp)
pushq $0x2
popq %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x1fa66
movq 0xd0(%rsp), %rax
fldt 0x10(%rax)
fldt 0x20(%rsp)
faddp %st, %st(1)
fstpt 0x10(%rax)
movq 0x38(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rax
fldt 0x20(%rax)
fldz
fxch %st(1)
fucompi %st(1), %st
fstp %st(0)
jbe 0x20f05
leaq 0x70(%rsp), %rdi
movq %r14, %rsi
callq 0x4510
movq 0x80(%r15), %rsi
leaq 0x100(%rsp), %rdi
callq 0x4510
leaq 0x70(%rsp), %rdi
leaq 0x100(%rsp), %rsi
callq 0x2179d
testb %al, %al
je 0x20eee
leaq 0x188(%rsp), %rdi
movq %r14, %rsi
callq 0x4510
leaq 0x188(%rsp), %rsi
movq 0xa0(%rsp), %rdi
callq 0x21b0e
movq (%rax), %rax
movb (%rax), %bl
leaq 0x188(%rsp), %rdi
callq 0x41c0
leaq 0x100(%rsp), %rdi
callq 0x41c0
leaq 0x70(%rsp), %rdi
callq 0x41c0
testb %bl, %bl
jne 0x20f05
movq 0x38(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rax
fldt 0x20(%rax)
movq 0xd0(%rsp), %rcx
fldt 0x40(%rcx)
faddp %st, %st(1)
fstpt 0x40(%rcx)
fldt 0x20(%rax)
fstpt 0x20(%rsp)
movq 0x48(%rsp), %rdi
callq 0x1ab16
movl %eax, %ebx
movq %r15, %rdi
movq %r14, %rsi
callq 0x1f8ba
addl %ebx, %eax
incl %eax
movl %eax, 0xc4(%rsp)
fildl 0xc4(%rsp)
fldt 0x20(%rsp)
fstpt (%rsp)
fstpt 0x10(%rsp)
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x1fa66
movq 0x38(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rax
fldt 0x20(%rax)
fstpt 0x20(%rsp)
movq %r15, %rdi
movq %r14, %rsi
callq 0x1f8ba
movl %eax, 0xc0(%rsp)
fildl 0xc0(%rsp)
fstpt 0x10(%rsp)
fldt 0x20(%rsp)
fstpt (%rsp)
pushq $0x2
popq %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x1fa66
jmp 0x20f05
fldt 0x58(%rsp)
fldz
fxch %st(1)
fucompi %st(1), %st
fstp %st(0)
setbe %cl
orb %cl, %al
testb $0x1, %al
movq 0x30(%rsp), %r14
movq 0x50(%rsp), %r15
jne 0x20e23
leaq 0x170(%rsp), %rdi
movq 0xa8(%rsp), %rsi
callq 0x21b9a
movq 0x1e0(%rsp), %rax
movq %rax, 0x10(%rsp)
fldt 0x58(%rsp)
fstpt (%rsp)
leaq 0x170(%rsp), %rcx
pushq $0x1
popq %r9
movq %r15, %rdi
movq %r14, %rsi
movq 0x48(%rsp), %rdx
movl %r13d, %r8d
callq 0x20066
leaq 0x170(%rsp), %rdi
callq 0x191e2
leaq 0x70(%rsp), %rdi
movq %r14, %rsi
callq 0x4510
leaq 0x70(%rsp), %rsi
movq 0xa0(%rsp), %rdi
callq 0x21b0e
movq (%rax), %rax
cmpb $0x0, (%rax)
jne 0x20efb
fldt 0x58(%rsp)
fldt 0xec(%rsp)
fsubp %st, %st(1)
fldz
fld %st(1)
fstpt 0x20(%rsp)
fxch %st(1)
fucompi %st(1), %st
fstp %st(0)
jbe 0x20efb
movq 0x38(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rax
fldt 0x20(%rax)
fstpt 0x38(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x41c0
fldz
fldt 0x38(%rsp)
fucompi %st(1), %st
fstp %st(0)
jbe 0x20f05
leaq 0x158(%rsp), %rdi
movq 0xa8(%rsp), %rsi
callq 0x21b9a
movq 0x1e0(%rsp), %rax
movq %rax, 0x10(%rsp)
fldt 0x20(%rsp)
fstpt (%rsp)
leaq 0x158(%rsp), %rcx
pushq $0x2
popq %r9
movq %r15, %rdi
movq %r14, %rsi
movq 0x48(%rsp), %rdx
movl %r13d, %r8d
callq 0x20066
leaq 0x158(%rsp), %rdi
callq 0x191e2
jmp 0x20f05
leaq 0x100(%rsp), %rdi
callq 0x41c0
leaq 0x70(%rsp), %rdi
callq 0x41c0
leaq 0x140(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x19582
leaq 0x140(%rsp), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x1fbe0
leaq 0x140(%rsp), %rdi
callq 0x195d0
leaq 0xd0(%rsp), %rdi
callq 0x195d0
xorl %eax, %eax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x158(%rsp), %rdi
jmp 0x20f87
movq %rax, %rbx
leaq 0x188(%rsp), %rdi
callq 0x41c0
jmp 0x20ff7
jmp 0x20ff4
movq %rax, %rbx
leaq 0x170(%rsp), %rdi
callq 0x191e2
jmp 0x21013
jmp 0x21006
jmp 0x20fef
jmp 0x20fef
jmp 0x21006
jmp 0x20fef
fstp %st(0)
jmp 0x20fef
fstp %st(0)
jmp 0x20fef
jmp 0x20fef
movq %rax, %rbx
leaq 0x140(%rsp), %rdi
callq 0x195d0
jmp 0x21013
jmp 0x20fef
jmp 0x20fef
jmp 0x21006
jmp 0x20fef
jmp 0x20fef
jmp 0x20fef
jmp 0x20fef
jmp 0x21006
movq %rax, %rbx
movl $0x90, %esi
movq %r12, %rdi
callq 0x43d0
jmp 0x21013
jmp 0x20fef
jmp 0x21006
jmp 0x21006
jmp 0x20fef
jmp 0x21006
jmp 0x21006
jmp 0x20fef
jmp 0x20fef
jmp 0x20ff4
jmp 0x20fef
jmp 0x20fef
movq %rax, %rbx
jmp 0x21013
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
callq 0x41c0
jmp 0x21009
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x41c0
leaq 0xd0(%rsp), %rdi
callq 0x195d0
movq %rbx, %rdi
callq 0x4700