// File: /workspace/github_cpp_makefile_star2_O1/adamiaonr[P]rid-analytics/src/rid-analytics.cpp
// Function: RID_Analytics::add_fwd(RID_Router*, int, Path_State*, std::vector<RID_Analytics::fwd_decision, std::allocator<RID_Analytics::fwd_decision>>)
void RID_Analytics::add_fwd(
    RID_Router * router,
    int in_iface,
    Path_State * state,
    std::vector<RID_Analytics::fwd_decision> fwd_decisions) {

    // forwarding file
    // forwarding header : 'from\tinprob\tinto\t<router-0>\t<router-1>\t....\t<router-n>\n'
    this->output_file[2] << router->get_id() 
        << "\t" << state->get_in_iface_prob() 
        << "\t" << router->get_next_hop(in_iface).router->get_id();

    // add routers attached to ifaces of router
    std::map<std::string, __float080> neighbor_probs;
    for (unsigned int i = 0; i < fwd_decisions.size(); i++) {

        std::string neighbor_id = fwd_decisions[i].next_router->get_id();
        neighbor_probs[neighbor_id] = fwd_decisions[i].state->get_in_iface_prob();
    }

    // add line to forwarding file
    for (auto const& r : this->routers) {
        if (neighbor_probs.count(r.second->get_id()) > 0)
            this->output_file[2] << "\t" << neighbor_probs[r.second->get_id()];
        else
            this->output_file[2] << "\t" << 0.0;
    }
    this->output_file[2] << "\n";
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %r8, %r14
movq %rcx, %r12
movl %edx, %ebp
movq %rsi, %r15
movl $0x400, %ebx            # imm = 0x400
movq %rdi, 0x30(%rsp)
addq 0x98(%rdi), %rbx
leaq 0x48(%rsp), %rax
movq %rax, -0x10(%rax)
movq (%rsi), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq 0x38(%rsp), %r13
movq %r13, %rdi
callq 0x1c27c
movq (%r13), %rsi
movq 0x8(%r13), %rdx
movq %rbx, %rdi
callq 0x4400
fldz
movq %rax, %r13
fstp %st(0)
leaq 0xb6fc(%rip), %rsi      # 0x316f6
movl $0x1, %edx
movq %rax, %rdi
callq 0x4400
fldz
fstp %st(0)
movq %r12, %rdi
callq 0x1f418
fstpt (%rsp)
movq %r13, %rdi
callq 0x41f0
fldz
movq %rax, %r12
fstp %st(0)
leaq 0xb6ca(%rip), %rsi      # 0x316f6
movl $0x1, %edx
movq %rax, %rdi
callq 0x4400
fldz
fstp %st(0)
movzbl %bpl, %eax
movq 0x30(%r15), %rcx
leaq (%rax,%rax,4), %rax
shll $0x5, %eax
movq 0x90(%rcx,%rax), %rax
leaq 0x20(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %rdi
callq 0x1c27c
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %r12, %rdi
callq 0x4400
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0x2609a
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x43a0
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x260b6
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x43a0
leaq 0x40(%rsp), %rcx
movl $0x0, (%rcx)
xorl %eax, %eax
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
movq (%r14), %rax
cmpq %rax, 0x8(%r14)
je 0x26161
movl $0x1, %ebx
xorl %ebp, %ebp
leaq 0x10(%rsp), %r15
leaq 0x38(%rsp), %r12
shlq $0x5, %rbp
movq 0x8(%rax,%rbp), %rax
movq %r13, 0x10(%rsp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x1c27c
movq (%r14), %rax
movq 0x18(%rax,%rbp), %rdi
callq 0x1f418
fstpt 0x6c(%rsp)
movq %r12, %rdi
movq %r15, %rsi
callq 0x286c4
fldt 0x6c(%rsp)
fstpt (%rax)
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0x2614a
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x43a0
movl %ebx, %ebp
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
incl %ebx
cmpq %rbp, %rcx
ja 0x260f1
movq 0x30(%rsp), %rax
movq 0x68(%rax), %r14
leaq 0x58(%rax), %r12
cmpq %r12, %r14
je 0x26271
leaq 0x10(%rsp), %r15
movq 0x40(%r14), %rax
movq %r13, 0x10(%rsp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x1c27c
leaq 0x38(%rsp), %rdi
movq %r15, %rsi
callq 0x299c0
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0x261be
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x43a0
movq 0x30(%rsp), %rax
movq 0x98(%rax), %rbp
movl $0x400, %eax            # imm = 0x400
addq %rax, %rbp
leaq 0x40(%rsp), %rax
cmpq %rax, %rbx
je 0x2623e
movl $0x1, %edx
movq %rbp, %rdi
leaq 0xb50b(%rip), %rsi      # 0x316f6
callq 0x4400
movq 0x40(%r14), %rax
movq %r13, 0x10(%rsp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x1c27c
leaq 0x38(%rsp), %rdi
movq %r15, %rsi
callq 0x28740
fldt (%rax)
fstpt (%rsp)
movq %rbp, %rdi
callq 0x41f0
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0x2625d
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x43a0
jmp 0x2625d
movl $0x1, %edx
movq %rbp, %rdi
leaq 0xb4a9(%rip), %rsi      # 0x316f6
callq 0x4400
xorps %xmm0, %xmm0
movq %rbp, %rdi
callq 0x4630
movq %r14, %rdi
callq 0x42b0
movq %rax, %r14
cmpq %r12, %rax
jne 0x2617c
movl $0x400, %edi            # imm = 0x400
movq 0x30(%rsp), %rax
addq 0x98(%rax), %rdi
leaq 0xb429(%rip), %rsi      # 0x316b2
movl $0x1, %edx
callq 0x4400
leaq 0x38(%rsp), %rdi
callq 0x28a2a
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x262f9
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0x262d1
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x43a0
jmp 0x262d1
jmp 0x262ce
fstp %st(0)
movq %rax, %rbx
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x26322
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x43a0
jmp 0x26322
jmp 0x262f9
jmp 0x262f9
jmp 0x262fe
jmp 0x262f9
jmp 0x262fe
movq %rax, %rbx
jmp 0x26318
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0x26318
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x43a0
leaq 0x38(%rsp), %rdi
callq 0x28a2a
movq %rbx, %rdi
callq 0x4700