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

    // don't add nodes which are impossible to reach...
    //if (prob_val == 0.0) return;

    char node_str[MAX_STRING_SIZE];
    char edge_str[MAX_STRING_SIZE];

    // 1) node declaration, i.e. variable name, label, color, etc.
    get_node_str(node_str, next_node, next_depth, breadth);
    this->graph_filestream << "\t" + std::string(node_str);

    // 2) edge connecting it from parent
    get_edge_str(edge_str, prev_node, prev_depth, next_node, next_depth, breadth, prob_val);
    this->graph_filestream << "\t" + std::string(edge_str) + "\n";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x230, %rsp            # imm = 0x230
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)
movq -0x8(%rbp), %rax
movq %rax, -0x210(%rbp)
movq -0x20(%rbp), %rsi
movl -0x24(%rbp), %edx
movl -0x28(%rbp), %ecx
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x200(%rbp)
callq 0x30aa0
movq -0x210(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x208(%rbp)
leaq -0x171(%rbp), %rdi
movq %rdi, -0x1f8(%rbp)
callq 0x5930
movq -0x200(%rbp), %rsi
movq -0x1f8(%rbp), %rdx
leaq -0x170(%rbp), %rdi
callq 0x30320
jmp 0x31680
leaq 0x31e80(%rip), %rsi     # 0x63507
leaq -0x150(%rbp), %rdi
leaq -0x170(%rbp), %rdx
callq 0x31a70
jmp 0x3169c
movq -0x208(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x5430
jmp 0x316b1
leaq -0x150(%rbp), %rdi
callq 0x52f0
leaq -0x170(%rbp), %rdi
callq 0x52f0
leaq -0x171(%rbp), %rdi
callq 0x5510
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movq -0x20(%rbp), %rcx
movl -0x24(%rbp), %r8d
movl -0x28(%rbp), %r9d
movsd -0x30(%rbp), %xmm0
leaq -0x130(%rbp), %rdi
movq %rdi, -0x220(%rbp)
callq 0x31100
movq -0x210(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x228(%rbp)
leaq -0x1e9(%rbp), %rdi
movq %rdi, -0x218(%rbp)
callq 0x5930
movq -0x220(%rbp), %rsi
movq -0x218(%rbp), %rdx
leaq -0x1e8(%rbp), %rdi
callq 0x30320
jmp 0x31741
leaq 0x31dbf(%rip), %rsi     # 0x63507
leaq -0x1c8(%rbp), %rdi
leaq -0x1e8(%rbp), %rdx
callq 0x31a70
jmp 0x3175d
leaq 0x31d5f(%rip), %rdx     # 0x634c3
leaq -0x1a8(%rbp), %rdi
leaq -0x1c8(%rbp), %rsi
callq 0x31d00
jmp 0x31779
movq -0x228(%rbp), %rdi
leaq -0x1a8(%rbp), %rsi
callq 0x5430
jmp 0x3178e
leaq -0x1a8(%rbp), %rdi
callq 0x52f0
leaq -0x1c8(%rbp), %rdi
callq 0x52f0
leaq -0x1e8(%rbp), %rdi
callq 0x52f0
leaq -0x1e9(%rbp), %rdi
callq 0x5510
addq $0x230, %rsp            # imm = 0x230
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x180(%rbp)
movl %eax, -0x184(%rbp)
jmp 0x31819
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x180(%rbp)
movl %eax, -0x184(%rbp)
jmp 0x3180d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x180(%rbp)
movl %eax, -0x184(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x52f0
leaq -0x170(%rbp), %rdi
callq 0x52f0
leaq -0x171(%rbp), %rdi
callq 0x5510
jmp 0x318a5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x180(%rbp)
movl %eax, -0x184(%rbp)
jmp 0x31899
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x180(%rbp)
movl %eax, -0x184(%rbp)
jmp 0x3188d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x180(%rbp)
movl %eax, -0x184(%rbp)
jmp 0x31881
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x180(%rbp)
movl %eax, -0x184(%rbp)
leaq -0x1a8(%rbp), %rdi
callq 0x52f0
leaq -0x1c8(%rbp), %rdi
callq 0x52f0
leaq -0x1e8(%rbp), %rdi
callq 0x52f0
leaq -0x1e9(%rbp), %rdi
callq 0x5510
movq -0x180(%rbp), %rdi
callq 0x5920
nopw %cs:(%rax,%rax)