// File: /workspace/github_cpp_makefile_star2_O2/canzarlab[P]Trajan/src/generator.cpp
// Function: uniform(int)
newick_node* uniform(int n)
{
    unsigned random[n], size = 2;
    iota(random, random + n, 1);
    random_shuffle(random, random + n);

    newick_node* leaf1 = new newick_node(to_string(random[0]));
    newick_node* leaf2 = new newick_node(to_string(random[1]));
    newick_child* child = new newick_child(leaf1);
    child->next = new newick_child(leaf2);

    newick_node* root = new newick_node("", 0, child);
    vector<pair<newick_node*, newick_node*>> E;
    E.emplace_back(root, leaf1);
    E.emplace_back(root, leaf2);

    for (int k = 0; k < n - 2; k++)
    {
        int i = rand() % E.size();
        leaf1 = new newick_node(to_string(random[size++]));
        leaf2 = new newick_node("", 0, new newick_child(E[i].second));
        leaf2->child->next = new newick_child(leaf1);

        newick_child* pchild = E[i].first->child;
        if (pchild->node == E[i].second)
            pchild->node = leaf2;
        else
            pchild->next->node = leaf2;

        E.emplace_back(leaf2, leaf1);
        E.emplace_back(leaf2, E[i].second);
        E[i].second = leaf2;
    }
    return root;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %edi, %r14d
movl %edi, %eax
movq %rsp, %rbx
leaq 0xf(,%rax,4), %rax
andq $-0x10, %rax
subq %rax, %rbx
movq %rbx, %rsp
movslq %edi, %rax
leaq (%rbx,%rax,4), %rsi
shlq $0x2, %rax
pushq $0x1
popq %rcx
xorl %edx, %edx
cmpq %rdx, %rax
je 0x27c1
movl %ecx, (%rbx,%rdx)
incl %ecx
addq $0x4, %rdx
jmp 0x27b1
movq %rbx, %rdi
callq 0x2e87
pushq $0x38
popq %rdi
callq 0x21e0
movq %rax, %r15
movl (%rbx), %esi
leaq -0x80(%rbp), %rdi
callq 0x2ee4
leaq -0x80(%rbp), %rsi
xorps %xmm0, %xmm0
movq %r15, %rdi
xorl %edx, %edx
callq 0x3568
leaq -0x80(%rbp), %rdi
callq 0x20e0
movq %r15, -0x40(%rbp)
pushq $0x38
popq %rdi
callq 0x21e0
movq %rax, %r15
movl 0x4(%rbx), %esi
leaq -0x80(%rbp), %rdi
callq 0x2ee4
leaq -0x80(%rbp), %rsi
xorps %xmm0, %xmm0
movq %r15, %rdi
xorl %edx, %edx
callq 0x3568
leaq -0x80(%rbp), %rdi
callq 0x20e0
movq %r15, -0x38(%rbp)
pushq $0x10
popq %rdi
callq 0x21e0
movq %rax, %r15
movq -0x40(%rbp), %rsi
movq %rax, %rdi
callq 0x3540
pushq $0x10
popq %rdi
callq 0x21e0
movq %rax, %r12
movq -0x38(%rbp), %rsi
movq %rax, %rdi
callq 0x3540
movq %r12, 0x8(%r15)
pushq $0x38
popq %rdi
callq 0x21e0
movq %rax, %r12
leaq 0x3939(%rip), %rsi      # 0x61af
leaq -0x80(%rbp), %rdi
leaq -0x60(%rbp), %rdx
callq 0x2e2e
leaq -0x80(%rbp), %rsi
xorps %xmm0, %xmm0
movq %r12, %rdi
movq %r15, %rdx
callq 0x3568
movq %rbx, -0x90(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x20e0
leaq -0x88(%rbp), %rsi
movq %r12, (%rsi)
xorps %xmm0, %xmm0
leaq -0x60(%rbp), %rdi
movaps %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
leaq -0x40(%rbp), %rdx
callq 0x2f24
leaq -0x60(%rbp), %rdi
leaq -0x88(%rbp), %rsi
leaq -0x38(%rbp), %rdx
callq 0x2f24
cmpl $0x3, %r14d
pushq $0x2
popq %rax
cmovgel %r14d, %eax
movq %rax, -0x98(%rbp)
pushq $0x2
popq %r15
leaq -0x80(%rbp), %rbx
cmpq %r15, -0x98(%rbp)
je 0x2a39
callq 0x2080
cltq
movq -0x58(%rbp), %rcx
subq -0x60(%rbp), %rcx
sarq $0x4, %rcx
xorl %edx, %edx
divq %rcx
movq %rdx, %r13
pushq $0x38
popq %rdi
callq 0x21e0
movq %rax, %r12
movq -0x90(%rbp), %rax
movl (%rax,%r15,4), %esi
movq %rbx, %r14
movq %rbx, %rdi
callq 0x2ee4
xorps %xmm0, %xmm0
movq %r12, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x3568
movq %r12, -0x40(%rbp)
movq %r14, %rdi
callq 0x20e0
pushq $0x38
popq %rdi
callq 0x21e0
movq %rax, %r12
movq %rbx, %rdi
leaq 0x3840(%rip), %rsi      # 0x61af
leaq -0x29(%rbp), %rdx
callq 0x2e2e
pushq $0x10
popq %rdi
callq 0x21e0
movq %rax, %r14
movslq %r13d, %r13
movq -0x60(%rbp), %rax
shlq $0x4, %r13
movq 0x8(%rax,%r13), %rsi
movq %r14, %rdi
callq 0x3540
xorps %xmm0, %xmm0
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x3568
movq %r12, -0x38(%rbp)
movq %rbx, %rdi
callq 0x20e0
pushq $0x10
popq %rdi
callq 0x21e0
movq %rax, %r14
movq -0x40(%rbp), %rsi
movq %rax, %rdi
callq 0x3540
movq -0x38(%rbp), %rax
movq (%rax), %rcx
movq %r14, 0x8(%rcx)
movq -0x60(%rbp), %rdx
movq (%rdx,%r13), %rcx
movq (%rcx), %rcx
movq (%rcx), %rsi
cmpq 0x8(%rdx,%r13), %rsi
leaq -0x60(%rbp), %r14
leaq -0x38(%rbp), %r12
je 0x29fb
movq 0x8(%rcx), %rcx
movq %rax, (%rcx)
movq %r14, %rdi
movq %r12, %rsi
leaq -0x40(%rbp), %rdx
callq 0x2f24
movq -0x60(%rbp), %rax
leaq (%rax,%r13), %rdx
addq $0x8, %rdx
movq %r14, %rdi
movq %r12, %rsi
callq 0x2f24
movq -0x38(%rbp), %rax
movq -0x60(%rbp), %rcx
movq %rax, 0x8(%rcx,%r13)
incq %r15
jmp 0x28f5
movq -0x88(%rbp), %rbx
leaq -0x60(%rbp), %rdi
callq 0x33b6
movq %rbx, %rax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x20e0
jmp 0x2a6c
movq %rax, %rbx
pushq $0x38
jmp 0x2a75
movq %rax, %rbx
pushq $0x10
popq %rsi
movq %r12, %rdi
jmp 0x2a9d
movq %rax, %rbx
pushq $0x10
jmp 0x2a99
jmp 0x2a86
jmp 0x2a94
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x20e0
jmp 0x2a97
movq %rax, %rbx
pushq $0x38
popq %rsi
movq %r15, %rdi
callq 0x21f0
jmp 0x2af1
jmp 0x2ae5
jmp 0x2ab5
movq %rax, %rbx
pushq $0x10
popq %rsi
movq %r14, %rdi
jmp 0x2ade
jmp 0x2acc
movq %rax, %rbx
jmp 0x2ad8
movq %rax, %rbx
pushq $0x10
popq %rsi
movq %r14, %rdi
callq 0x21f0
jmp 0x2acf
jmp 0x2ae5
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x20e0
pushq $0x38
popq %rsi
movq %r12, %rdi
callq 0x21f0
jmp 0x2ae8
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x33b6
movq %rbx, %rdi
callq 0x2330