// File: /workspace/github_cpp_makefile_star2_O1/adamiaonr[P]rid-analytics/src/rid-analytics.cpp
// Function: RID_Analytics::add_outcome(RID_Router*, int, long double, long double)
void RID_Analytics::add_outcome(
    RID_Router * router,
    int outcome, 
    __float080 prob,
    __float080 latency) {

    // header : router\ttype\tprob\tlatency\n
    std::string code = "";
    switch (outcome) {

        case OUTCOME_CORRECT_DELIVERY:
            code = "cd";
            break;

        case OUTCOME_INCORRECT_DELIVERY:
            code = "id";
            break;

        case OUTCOME_SOFT_FALLBACK_FWD:
            code = "sff";
            break;

        case OUTCOME_SOFT_FALLBACK_AID_FWD:
            code = "sffid";
            break;

        case OUTCOME_HARD_FALLBACK_DELIVERY:
            code = "hfd";
            break;

        case OUTCOME_FEEDBACK_DELIVERY:
            code = "fed";
            break;

        case OUTCOME_PACKET_DROP:
            code = "dr";
            break;

        default:
            code = "uk";
            break;
    }

    // add line to outcome file
    this->output_file[1] << router->get_id() << "\t" 
        << code << "\t" << prob << "\t" << latency << "\n";
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x70, %rsp
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
fldt 0xb0(%rsp)
fstpt 0x58(%rsp)
fldt 0xa0(%rsp)
fstpt 0x64(%rsp)
leaq 0x28(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0xba64(%rip), %rdx      # 0x316f7
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %rdx, %rsi
callq 0x19074
movq 0x8(%r15), %rdx
cmpl $0xc, %ebp
jae 0x25cc9
movl %ebp, %eax
leaq 0xc8f3(%rip), %rsi      # 0x325a8
movslq (%rsi,%rax,4), %rcx
addq %rsi, %rcx
leaq 0xc915(%rip), %rsi      # 0x325d8
movq (%rsi,%rax,8), %r8
jmp 0x25cd6
movl $0x2, %r8d
leaq 0xc622(%rip), %rcx      # 0x322f8
leaq 0x18(%rsp), %rdi
xorl %esi, %esi
callq 0x45e0
movq 0x98(%r14), %r14
leaq 0x48(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq 0x38(%rsp), %rdi
callq 0x1c27c
addq $0x200, %r14            # imm = 0x200
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq %r14, %rdi
callq 0x4400
movq %rax, %rbx
leaq 0xb9cd(%rip), %rsi      # 0x316f6
movl $0x1, %edx
movq %rax, %rdi
callq 0x4400
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq %rbx, %rdi
callq 0x4400
movq %rax, %rbx
leaq 0xb9a4(%rip), %rsi      # 0x316f6
movl $0x1, %edx
movq %rax, %rdi
callq 0x4400
fldt 0x64(%rsp)
fstpt (%rsp)
movq %rbx, %rdi
callq 0x41f0
movq %rax, %rbx
leaq 0xb97e(%rip), %rsi      # 0x316f6
movl $0x1, %edx
movq %rax, %rdi
callq 0x4400
fldt 0x58(%rsp)
fstpt (%rsp)
movq %rbx, %rdi
callq 0x41f0
leaq 0xb917(%rip), %rsi      # 0x316b2
movl $0x1, %edx
movq %rax, %rdi
callq 0x4400
movq 0x38(%rsp), %rdi
cmpq %r15, %rdi
je 0x25dbf
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x43a0
movq 0x18(%rsp), %rdi
cmpq %r12, %rdi
je 0x25dd6
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x43a0
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x25de5
movq %rax, %rbx
jmp 0x25e04
movq %rax, %rbx
movq 0x38(%rsp), %rdi
cmpq %r15, %rdi
je 0x25e04
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x43a0
movq 0x18(%rsp), %rdi
cmpq %r12, %rdi
je 0x25e1b
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x43a0
movq %rbx, %rdi
callq 0x4700