// File: /workspace/github_cpp_makefile_star2_O3/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 0xad52(%rip), %rdx      # 0x304d7
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %rdx, %rsi
callq 0x18bc0
movq 0x8(%r15), %rdx
cmpl $0xc, %ebp
jae 0x257bb
movl %ebp, %eax
leaq 0xbbe1(%rip), %rsi      # 0x31388
movslq (%rsi,%rax,4), %rcx
addq %rsi, %rcx
leaq 0xbc03(%rip), %rsi      # 0x313b8
movq (%rsi,%rax,8), %r8
jmp 0x257c8
movl $0x2, %r8d
leaq 0xb910(%rip), %rcx      # 0x310d8
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 0x1bdb4
addq $0x200, %r14            # imm = 0x200
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq %r14, %rdi
callq 0x4400
movq %rax, %rbx
leaq 0xacbb(%rip), %rsi      # 0x304d6
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 0xac92(%rip), %rsi      # 0x304d6
movl $0x1, %edx
movq %rax, %rdi
callq 0x4400
fldt 0x64(%rsp)
fstpt (%rsp)
movq %rbx, %rdi
callq 0x41f0
movq %rax, %rbx
leaq 0xac6c(%rip), %rsi      # 0x304d6
movl $0x1, %edx
movq %rax, %rdi
callq 0x4400
fldt 0x58(%rsp)
fstpt (%rsp)
movq %rbx, %rdi
callq 0x41f0
leaq 0xac05(%rip), %rsi      # 0x30492
movl $0x1, %edx
movq %rax, %rdi
callq 0x4400
movq 0x38(%rsp), %rdi
cmpq %r15, %rdi
je 0x258b1
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x43a0
movq 0x18(%rsp), %rdi
cmpq %r12, %rdi
je 0x258c8
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x43a0
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x258d7
movq %rax, %rbx
jmp 0x258f6
movq %rax, %rbx
movq 0x38(%rsp), %rdi
cmpq %r15, %rdi
je 0x258f6
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x43a0
movq 0x18(%rsp), %rdi
cmpq %r12, %rdi
je 0x2590d
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x43a0
movq %rbx, %rdi
callq 0x4700