// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x170, %rsp            # imm = 0x170
movsd %xmm0, 0x28(%rsp)
movl %r9d, %ebp
movq %rcx, %r14
movl %edx, %r15d
movq %rsi, %r12
movq %rdi, %rbx
leaq 0xa0(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq %rsi, %rdi
callq 0x16e8e
cmpl $0x5, %eax
jne 0x173b7
movq 0x2415e(%rip), %r12     # 0x3b478
leaq 0x50(%rsp), %rdi
movl %r15d, %esi
callq 0x17947
leaq 0x70(%rsp), %rdi
leaq 0x50(%rsp), %rdx
movq %r12, %rsi
callq 0x178bc
leaq 0x30(%rsp), %rdi
movl %ebp, %esi
callq 0x17947
leaq 0x8(%rsp), %rdi
leaq 0x70(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x178e0
leaq 0x13310(%rip), %rdx     # 0x2a670
leaq 0xf0(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x179a0
leaq 0x90(%rsp), %rdi
leaq 0xf0(%rsp), %r15
movq %r15, %rsi
callq 0x4460
movq %r15, %rdi
callq 0x41c0
leaq 0x8(%rsp), %rdi
callq 0x41c0
leaq 0x30(%rsp), %rdi
callq 0x41c0
leaq 0x70(%rsp), %rdi
callq 0x41c0
leaq 0x50(%rsp), %rdi
jmp 0x17406
addq $0x28, %r12
leaq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x4510
leaq 0x132a1(%rip), %rdx     # 0x2a670
leaq 0xf0(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x179a0
leaq 0x90(%rsp), %rdi
leaq 0xf0(%rsp), %r15
movq %r15, %rsi
callq 0x4460
movq %r15, %rdi
callq 0x41c0
leaq 0x8(%rsp), %rdi
callq 0x41c0
addq $0x28, %r14
leaq 0xf0(%rsp), %rdi
movq %r14, %rsi
callq 0x4510
leaq 0x90(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x4790
leaq 0xf0(%rsp), %rdi
callq 0x41c0
leaq 0x1322d(%rip), %rdx     # 0x2a675
leaq 0xf0(%rsp), %r14
movl $0x80, %esi
movq %r14, %rdi
movsd 0x28(%rsp), %xmm0
movb $0x1, %al
callq 0x4630
leaq 0xd0(%rsp), %rdi
leaq 0x7(%rsp), %rdx
movq %r14, %rsi
callq 0x16c66
leaq 0x131fa(%rip), %rsi     # 0x2a67b
leaq 0x30(%rsp), %rdi
leaq 0xd0(%rsp), %rdx
callq 0x178bc
leaq 0x131eb(%rip), %rdx     # 0x2a685
leaq 0x50(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x179a0
leaq 0xb0(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
leaq 0x6(%rsp), %rdx
callq 0x16c66
leaq 0x70(%rsp), %rdi
leaq 0x50(%rsp), %rsi
leaq 0xb0(%rsp), %rdx
callq 0x178e0
leaq 0x131b0(%rip), %rdx     # 0x2a691
leaq 0x8(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x179a0
leaq 0x90(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x4790
leaq 0x8(%rsp), %rdi
callq 0x41c0
leaq 0x70(%rsp), %rdi
callq 0x41c0
leaq 0xb0(%rsp), %rdi
callq 0x41c0
leaq 0x50(%rsp), %rdi
callq 0x41c0
leaq 0x30(%rsp), %rdi
callq 0x41c0
leaq 0xd0(%rsp), %rdi
callq 0x41c0
leaq 0x90(%rsp), %r14
movq (%r14), %rcx
leaq 0x13117(%rip), %rdx     # 0x2a66d
movl $0x80, %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x4630
movq %r14, %rdi
callq 0x41c0
addq $0x170, %rsp            # imm = 0x170
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x41c0
jmp 0x1758f
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x41c0
jmp 0x1759e
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x41c0
jmp 0x175b7
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
jmp 0x17616
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
jmp 0x17616
jmp 0x17631
jmp 0x17631
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x41c0
jmp 0x175d4
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x41c0
jmp 0x175e3
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0x41c0
jmp 0x175f5
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x41c0
jmp 0x17604
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x41c0
leaq 0xd0(%rsp), %rdi
callq 0x41c0
jmp 0x17634
movq %rax, %rbx
jmp 0x1760e
jmp 0x17631
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
jmp 0x17616
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x41c0
movq %rbx, %rdi
callq 0x4700
nop