// File: adamiaonr[P]rid-analytics/src/graph.cpp
// Function: get_edge_str(char*, Node*, int, Node*, int, int, double)
void get_edge_str(
    char * edge_str,
    Node * prev_node, int prev_depth, 
    Node * next_node, int next_depth,
    int breadth,
    double prob_val) {

    std::string output;

    int prev_node_type_int = get_node_type_int(prev_node);
    //int next_node_type_int = get_node_type_int(next_node);

    // initial part of edge
    // output = NODE_CHARS[get_node_type_int(prev_node)] + std::to_string(prev_depth) + std::to_string((breadth / 1)) + " -> " 
    //     + NODE_CHARS[next_node_type_int] + std::to_string(next_depth) + std::to_string((breadth * 3 + next_node_type_int)); 
    if (prev_node_type_int == ORI_NODE_INT) {

        output = NODE_CHARS[prev_node_type_int] + std::to_string(prev_depth) + std::to_string((breadth / 1)) + " -> ";

    } else {

        output = prev_node->get_uid() + " -> ";
    }
    
    output += next_node->get_uid();

    // printf("Graph::get_edge_str(): adding edge for %s(%d, %d) -> %s(%d, %d). edge_str = %s\n",
    //     NODE_CHARS[get_node_type_int(prev_node)], prev_depth, breadth,
    //     NODE_CHARS[get_node_type_int(next_node)], next_depth, (breadth * 3 + next_node_type_int),
    //     output.c_str());

    // appropriately format probability value
    char prob_val_str[MAX_STRING_SIZE];
    snprintf(prob_val_str, MAX_STRING_SIZE, "%-.5E", prob_val);
    // add probability value as 'label' and 'weight'
    output += "[label =\"" + std::string(prob_val_str) + "\", weight=\"" + std::string(prob_val_str) + "\"];\n";

    snprintf(edge_str, MAX_STRING_SIZE, "%s", output.c_str());
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2f0, %rsp            # imm = 0x2F0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl %r9d, -0x28(%rbp)
movsd %xmm0, -0x30(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x5730
movq -0x10(%rbp), %rdi
callq 0x30a10
movl %eax, -0x2c0(%rbp)
jmp 0x31141
movl -0x2c0(%rbp), %eax
movl %eax, -0x54(%rbp)
cmpl $0x5, -0x54(%rbp)
jne 0x312ad
movslq -0x54(%rbp), %rcx
leaq 0x51451(%rip), %rax     # 0x825b0
movq (%rax,%rcx,8), %rax
movq %rax, -0x2c8(%rbp)
movl -0x14(%rbp), %esi
leaq -0xe8(%rbp), %rdi
callq 0x31bb0
jmp 0x3117b
movq -0x2c8(%rbp), %rsi
leaq -0xc8(%rbp), %rdi
leaq -0xe8(%rbp), %rdx
callq 0x31a70
jmp 0x31197
movl -0x28(%rbp), %esi
leaq -0x108(%rbp), %rdi
callq 0x31bb0
jmp 0x311a8
leaq -0xa8(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
leaq -0x108(%rbp), %rdx
callq 0x31ae0
jmp 0x311c4
leaq 0x32316(%rip), %rdx     # 0x634e1
leaq -0x88(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x31d00
jmp 0x311e0
leaq -0x50(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x5600
leaq -0x88(%rbp), %rdi
callq 0x52f0
leaq -0xa8(%rbp), %rdi
callq 0x52f0
leaq -0x108(%rbp), %rdi
callq 0x52f0
leaq -0xc8(%rbp), %rdi
callq 0x52f0
leaq -0xe8(%rbp), %rdi
callq 0x52f0
jmp 0x31322
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x315de
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x3129c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x31290
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x31284
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x52f0
leaq -0x108(%rbp), %rdi
callq 0x52f0
leaq -0xc8(%rbp), %rdi
callq 0x52f0
leaq -0xe8(%rbp), %rdi
callq 0x52f0
jmp 0x315de
movq -0x10(%rbp), %rsi
leaq -0x148(%rbp), %rdi
callq 0x31d80
jmp 0x312bf
leaq 0x3221b(%rip), %rdx     # 0x634e1
leaq -0x128(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0x31d00
jmp 0x312db
leaq -0x50(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x5600
leaq -0x128(%rbp), %rdi
callq 0x52f0
leaq -0x148(%rbp), %rdi
callq 0x52f0
jmp 0x31322
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x148(%rbp), %rdi
callq 0x52f0
jmp 0x315de
movq -0x20(%rbp), %rsi
leaq -0x168(%rbp), %rdi
callq 0x31d80
jmp 0x31334
leaq -0x50(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0x5650
jmp 0x31346
leaq -0x168(%rbp), %rdi
callq 0x52f0
movsd -0x30(%rbp), %xmm0
leaq 0x32188(%rip), %rdx     # 0x634e6
leaq -0x1f0(%rbp), %rdi
movq %rdi, -0x2d8(%rbp)
movl $0x80, %esi
movb $0x1, %al
callq 0x5830
leaq -0x291(%rbp), %rdi
movq %rdi, -0x2d0(%rbp)
callq 0x5930
movq -0x2d8(%rbp), %rsi
movq -0x2d0(%rbp), %rdx
leaq -0x290(%rbp), %rdi
callq 0x30320
jmp 0x313a7
leaq 0x3213e(%rip), %rsi     # 0x634ec
leaq -0x270(%rbp), %rdi
leaq -0x290(%rbp), %rdx
callq 0x31a70
jmp 0x313c3
leaq 0x3212c(%rip), %rdx     # 0x634f6
leaq -0x250(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0x31d00
jmp 0x313df
leaq -0x2b9(%rbp), %rdi
movq %rdi, -0x2e0(%rbp)
callq 0x5930
movq -0x2e0(%rbp), %rdx
leaq -0x2b8(%rbp), %rdi
leaq -0x1f0(%rbp), %rsi
callq 0x30320
jmp 0x3140e
leaq -0x230(%rbp), %rdi
leaq -0x250(%rbp), %rsi
leaq -0x2b8(%rbp), %rdx
callq 0x31ae0
jmp 0x3142a
leaq 0x320d1(%rip), %rdx     # 0x63502
leaq -0x210(%rbp), %rdi
leaq -0x230(%rbp), %rsi
callq 0x31d00
jmp 0x31446
leaq -0x50(%rbp), %rdi
leaq -0x210(%rbp), %rsi
callq 0x5650
jmp 0x31458
leaq -0x210(%rbp), %rdi
callq 0x52f0
leaq -0x230(%rbp), %rdi
callq 0x52f0
leaq -0x2b8(%rbp), %rdi
callq 0x52f0
leaq -0x2b9(%rbp), %rdi
callq 0x5510
leaq -0x250(%rbp), %rdi
callq 0x52f0
leaq -0x270(%rbp), %rdi
callq 0x52f0
leaq -0x290(%rbp), %rdi
callq 0x52f0
leaq -0x291(%rbp), %rdi
callq 0x5510
movq -0x8(%rbp), %rax
movq %rax, -0x2e8(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x51d0
movq -0x2e8(%rbp), %rdi
movq %rax, %rcx
movl $0x80, %esi
leaq 0x31ffc(%rip), %rdx     # 0x634de
movb $0x0, %al
callq 0x5830
leaq -0x50(%rbp), %rdi
callq 0x52f0
addq $0x2f0, %rsp            # imm = 0x2F0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x52f0
jmp 0x315de
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x315d2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x315c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x315ba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x315a2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x31596
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x3158a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x210(%rbp), %rdi
callq 0x52f0
leaq -0x230(%rbp), %rdi
callq 0x52f0
leaq -0x2b8(%rbp), %rdi
callq 0x52f0
leaq -0x2b9(%rbp), %rdi
callq 0x5510
leaq -0x250(%rbp), %rdi
callq 0x52f0
leaq -0x270(%rbp), %rdi
callq 0x52f0
leaq -0x290(%rbp), %rdi
callq 0x52f0
leaq -0x291(%rbp), %rdi
callq 0x5510
leaq -0x50(%rbp), %rdi
callq 0x52f0
movq -0x60(%rbp), %rdi
callq 0x5920