// File: /workspace/github_cpp_makefile_star2_O2/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 %rbx
subq $0xb0, %rsp
movq %rdi, %r14
pushq $0x1
popq %rsi
movl $0x80, %edi
callq 0x42b0
movq %rax, %rbx
movl 0x10(%r14), %eax
cmpq $0xa, %rax
ja 0x1ac7d
leaq 0xfe08(%rip), %rcx      # 0x2aa0c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movups 0xfe26(%rip), %xmm0     # 0x2aa3a
movaps %xmm0, 0x10(%rsp)
movb $0x0, 0x20(%rsp)
jmp 0x1ad01
movabsq $0x445f54454b434150, %rax # imm = 0x445F54454B434150
movq %rax, 0x10(%rsp)
movl $0x504f52, 0x18(%rsp)   # imm = 0x504F52
jmp 0x1ad01
movups 0xfdf2(%rip), %xmm0     # 0x2aa38
movaps %xmm0, 0x10(%rsp)
movl $0x595245, 0x1f(%rsp)   # imm = 0x595245
jmp 0x1ad01
movabsq $0x504f52445f4c5454, %rax # imm = 0x504F52445F4C5454
movq %rax, 0x10(%rsp)
movb $0x0, 0x18(%rsp)
jmp 0x1ad01
movabsq $0x545f535554415453, %rax # imm = 0x545F535554415453
jmp 0x1acf5
movabsq $0x4e574f4e4b4e55, %rax # imm = 0x4E574F4E4B4E55
movq %rax, 0x10(%rsp)
jmp 0x1ad01
movups 0xfdb6(%rip), %xmm0     # 0x2aa4b
movaps %xmm0, 0x10(%rsp)
movabsq $0x59524556494c45, %rax # imm = 0x59524556494C45
movq %rax, 0x1f(%rsp)
movups 0xfdb2(%rip), %xmm0     # 0x2aa62
movaps %xmm0, 0x10(%rsp)
movw $0x44, 0x20(%rsp)
jmp 0x1ad01
movups 0xfdaf(%rip), %xmm0     # 0x2aa74
movaps %xmm0, 0x10(%rsp)
movw $0x59, 0x20(%rsp)
jmp 0x1ad01
movabsq $0x545f535554415453, %rax # imm = 0x545F535554415453
movq %rax, 0x10(%rsp)
movw $0x4e, 0x18(%rsp)
jmp 0x1ad01
movabsq $0x465f535554415453, %rax # imm = 0x465F535554415453
movq %rax, 0x10(%rsp)
movw $0x50, 0x18(%rsp)
movq (%r14), %rsi
leaq 0x90(%rsp), %r15
movq %r15, %rdi
callq 0x4510
movq (%r15), %rcx
fldt 0x20(%r14)
movl 0xc(%r14), %r8d
fstpt (%rsp)
leaq 0xfd90(%rip), %rdx      # 0x2aab9
leaq 0x10(%rsp), %r9
movl $0x80, %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x4630
movq %r15, %rdi
callq 0x41c0
movq %rbx, %rax
addq $0xb0, %rsp
popq %rbx
popq %r14
popq %r15
retq
nopl (%rax)