// File: /workspace/github_cpp_makefile_star2_O3/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 0x1bdb4
movq (%r13), %rsi
movq 0x8(%r13), %rdx
movq %rbx, %rdi
callq 0x4400
fldz
movq %rax, %r13
fstp %st(0)
leaq 0xa9ea(%rip), %rsi      # 0x304d6
movl $0x1, %edx
movq %rax, %rdi
callq 0x4400
fldz
fstp %st(0)
movq %r12, %rdi
callq 0x1ef86
fstpt (%rsp)
movq %r13, %rdi
callq 0x41f0
fldz
movq %rax, %r12
fstp %st(0)
leaq 0xa9b8(%rip), %rsi      # 0x304d6
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 0x1bdb4
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %r12, %rdi
callq 0x4400
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0x25b8c
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x43a0
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x25ba8
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 0x25c53
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 0x1bdb4
movq (%r14), %rax
movq 0x18(%rax,%rbp), %rdi
callq 0x1ef86
fstpt 0x6c(%rsp)
movq %r12, %rdi
movq %r15, %rsi
callq 0x281e8
fldt 0x6c(%rsp)
fstpt (%rax)
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0x25c3c
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 0x25be3
movq 0x30(%rsp), %rax
movq 0x68(%rax), %r14
leaq 0x58(%rax), %r12
cmpq %r12, %r14
je 0x25d63
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 0x1bdb4
leaq 0x38(%rsp), %rdi
movq %r15, %rsi
callq 0x294ec
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0x25cb0
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 0x25d30
movl $0x1, %edx
movq %rbp, %rdi
leaq 0xa7f9(%rip), %rsi      # 0x304d6
callq 0x4400
movq 0x40(%r14), %rax
movq %r13, 0x10(%rsp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x1bdb4
leaq 0x38(%rsp), %rdi
movq %r15, %rsi
callq 0x28264
fldt (%rax)
fstpt (%rsp)
movq %rbp, %rdi
callq 0x41f0
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0x25d4f
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x43a0
jmp 0x25d4f
movl $0x1, %edx
movq %rbp, %rdi
leaq 0xa797(%rip), %rsi      # 0x304d6
callq 0x4400
xorps %xmm0, %xmm0
movq %rbp, %rdi
callq 0x4630
movq %r14, %rdi
callq 0x42b0
movq %rax, %r14
cmpq %r12, %rax
jne 0x25c6e
movl $0x400, %edi            # imm = 0x400
movq 0x30(%rsp), %rax
addq 0x98(%rax), %rdi
leaq 0xa717(%rip), %rsi      # 0x30492
movl $0x1, %edx
callq 0x4400
leaq 0x38(%rsp), %rdi
callq 0x2854e
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x25deb
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0x25dc3
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x43a0
jmp 0x25dc3
jmp 0x25dc0
fstp %st(0)
movq %rax, %rbx
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x25e14
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x43a0
jmp 0x25e14
jmp 0x25deb
jmp 0x25deb
jmp 0x25df0
jmp 0x25deb
jmp 0x25df0
movq %rax, %rbx
jmp 0x25e0a
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0x25e0a
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x43a0
leaq 0x38(%rsp), %rdi
callq 0x2854e
movq %rbx, %rdi
callq 0x4700