// File: /workspace/github_cpp_makefile_star2_O3/adamiaonr[P]rid-analytics/src/path-state.cpp
// Function: Path_State::to_string()
char * Path_State::to_string() {

    // using calloc() since node_str will be returned
    char * node_str = (char *) calloc(MAX_PATH_STATE_STRING_SIZE, sizeof(char));
    char status[MAX_PATH_STATE_STRING_SIZE];

    switch(this->path_status) {

        case OUTCOME_CORRECT_DELIVERY:
            snprintf(status, MAX_PATH_STATE_STRING_SIZE, "CORRECT_DELIVERY");
            break;
        case OUTCOME_INCORRECT_DELIVERY:
            snprintf(status, MAX_PATH_STATE_STRING_SIZE, "INCORRECT_DELIVERY");
            break;
        case OUTCOME_HARD_FALLBACK_DELIVERY:
            snprintf(status, MAX_PATH_STATE_STRING_SIZE, "HARD_FALLBACK_DELIVERY");
        case OUTCOME_SOFT_FALLBACK_FWD:
            snprintf(status, MAX_PATH_STATE_STRING_SIZE, "SOFT_FALLBACK_FWD");
            break;
        case OUTCOME_FEEDBACK_DELIVERY:
            snprintf(status, MAX_PATH_STATE_STRING_SIZE, "FEEDBACK_DELIVERY");
            break;
        // case OUTCOME_FALLBACK_RELAY:
        //     snprintf(status, MAX_PATH_STATE_STRING_SIZE, "FALLBACK_RELAY");
        //     break;
        case OUTCOME_PACKET_DROP:
            snprintf(status, MAX_PATH_STATE_STRING_SIZE, "PACKET_DROP");
            break;
        case OUTCOME_TTL_DROP:
            snprintf(status, MAX_PATH_STATE_STRING_SIZE, "TTL_DROP");
            break;
        case STATUS_TP:
            snprintf(status, MAX_PATH_STATE_STRING_SIZE, "STATUS_TP");
            break;
        case STATUS_FP:
            snprintf(status, MAX_PATH_STATE_STRING_SIZE, "STATUS_FP");
            break;
        case STATUS_TN:
            snprintf(status, MAX_PATH_STATE_STRING_SIZE, "STATUS_TN");
            break;
        default:
            snprintf(status, MAX_PATH_STATE_STRING_SIZE, "UNKNOWN");
            break;
    }

    snprintf(
        node_str, MAX_PATH_STATE_STRING_SIZE, 
        "ROUTER[%s] : [PROB : %-.5LE][PATH_LENGTH : %-5d][OUTCOME: %s]",
        this->router->get_id().c_str(),
        this->path_prob, this->path_length, status);

    return node_str;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdi, %r14
movl $0x80, %edi
movl $0x1, %esi
callq 0x4280
movq %rax, %rbx
movl 0x10(%r14), %eax
cmpq $0xa, %rax
ja 0x1f07d
leaq 0x11848(%rip), %rcx     # 0x3084c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movups 0x11866(%rip), %xmm0    # 0x3087a
movaps %xmm0, 0x10(%rsp)
movb $0x0, 0x20(%rsp)
jmp 0x1f101
movabsq $0x445f54454b434150, %rax # imm = 0x445F54454B434150
movq %rax, 0x10(%rsp)
movl $0x504f52, 0x18(%rsp)   # imm = 0x504F52
jmp 0x1f101
movups 0x11832(%rip), %xmm0    # 0x30878
movaps %xmm0, 0x10(%rsp)
movl $0x595245, 0x1f(%rsp)   # imm = 0x595245
jmp 0x1f101
movabsq $0x504f52445f4c5454, %rax # imm = 0x504F52445F4C5454
movq %rax, 0x10(%rsp)
movb $0x0, 0x18(%rsp)
jmp 0x1f101
movabsq $0x545f535554415453, %rax # imm = 0x545F535554415453
jmp 0x1f0f5
movabsq $0x4e574f4e4b4e55, %rax # imm = 0x4E574F4E4B4E55
movq %rax, 0x10(%rsp)
jmp 0x1f101
movups 0x117f6(%rip), %xmm0    # 0x3088b
movaps %xmm0, 0x10(%rsp)
movabsq $0x59524556494c45, %rax # imm = 0x59524556494C45
movq %rax, 0x1f(%rsp)
movups 0x117f2(%rip), %xmm0    # 0x308a2
movaps %xmm0, 0x10(%rsp)
movw $0x44, 0x20(%rsp)
jmp 0x1f101
movups 0x117ef(%rip), %xmm0    # 0x308b4
movaps %xmm0, 0x10(%rsp)
movw $0x59, 0x20(%rsp)
jmp 0x1f101
movabsq $0x545f535554415453, %rax # imm = 0x545F535554415453
movq %rax, 0x10(%rsp)
movw $0x4e, 0x18(%rsp)
jmp 0x1f101
movabsq $0x465f535554415453, %rax # imm = 0x465F535554415453
movq %rax, 0x10(%rsp)
movw $0x50, 0x18(%rsp)
movq (%r14), %rax
leaq 0xa8(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x98(%rsp), %r15
movq %r15, %rdi
callq 0x1bdb4
movq (%r15), %rcx
fldt 0x20(%r14)
movl 0xc(%r14), %r8d
fstpt (%rsp)
leaq 0x117b9(%rip), %rdx     # 0x308f9
leaq 0x10(%rsp), %r9
movl $0x80, %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x4620
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x1f16c
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x43a0
movq %rbx, %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop