// File: canzarlab[P]Trajan/src/generator.cpp
// Function: yule(int)
newick_node* yule(int n)
{
    newick_node* root = new newick_node;
    vector<newick_node*> L;
    L.push_back(root);
    while (L.size() < n)
    {
        newick_node* leaf1 = new newick_node;
        newick_node* leaf2 = new newick_node;
        newick_child* child = new newick_child(leaf1);
        child->next = new newick_child(leaf2);
        int i = rand() % L.size();
        L[i]->child = child;
        L[i] = leaf1;
        L.push_back(leaf2);
    }

    unsigned random[n];
    iota(random, random + n, 1);
    random_shuffle(random, random + n);
    for (int i = 0; i < L.size(); ++i)
        L[i]->taxon = to_string(random[i]);

    return root;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x190, %rsp            # imm = 0x190
movl %edi, -0x4(%rbp)
movl $0x38, %edi
callq 0x32a0
movq %rax, -0x118(%rbp)
movb $0x1, -0x45(%rbp)
leaq -0x31(%rbp), %rdi
movq %rdi, -0x110(%rbp)
callq 0x3460
movq -0x110(%rbp), %rdx
leaq 0xbb1e(%rip), %rsi      # 0xf1af
leaq -0x30(%rbp), %rdi
callq 0x4870
jmp 0x369c
movq -0x118(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
leaq -0x30(%rbp), %rsi
xorps %xmm0, %xmm0
callq 0x6b90
jmp 0x36b5
movb $0x0, -0x45(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x3190
leaq -0x31(%rbp), %rdi
callq 0x3300
movq -0x118(%rbp), %rax
movq %rax, -0x10(%rbp)
leaq -0x60(%rbp), %rdi
movq %rdi, -0x120(%rbp)
callq 0x4920
movq -0x120(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x4940
jmp 0x36f8
jmp 0x36fa
leaq -0x60(%rbp), %rdi
callq 0x49b0
movslq -0x4(%rbp), %rcx
cmpq %rcx, %rax
jae 0x3a88
movl $0x38, %edi
callq 0x32a0
movq %rax, -0x128(%rbp)
jmp 0x3723
movb $0x1, -0x8a(%rbp)
leaq -0x89(%rbp), %rdi
movq %rdi, -0x130(%rbp)
callq 0x3460
movq -0x130(%rbp), %rdx
leaq 0xba64(%rip), %rsi      # 0xf1af
leaq -0x88(%rbp), %rdi
callq 0x4870
jmp 0x3759
movq -0x128(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
leaq -0x88(%rbp), %rsi
xorps %xmm0, %xmm0
callq 0x6b90
jmp 0x3775
movb $0x0, -0x8a(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x3190
leaq -0x89(%rbp), %rdi
callq 0x3300
movq -0x128(%rbp), %rax
movq %rax, -0x68(%rbp)
movl $0x38, %edi
callq 0x32a0
movq %rax, -0x138(%rbp)
jmp 0x37b2
movb $0x1, -0xba(%rbp)
leaq -0xb9(%rbp), %rdi
movq %rdi, -0x140(%rbp)
callq 0x3460
movq -0x140(%rbp), %rdx
leaq 0xb9d5(%rip), %rsi      # 0xf1af
leaq -0xb8(%rbp), %rdi
callq 0x4870
jmp 0x37e8
movq -0x138(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
leaq -0xb8(%rbp), %rsi
xorps %xmm0, %xmm0
callq 0x6b90
jmp 0x3804
movb $0x0, -0xba(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x3190
leaq -0xb9(%rbp), %rdi
callq 0x3300
movq -0x138(%rbp), %rax
movq %rax, -0x98(%rbp)
movl $0x10, %edi
callq 0x32a0
movq %rax, -0x148(%rbp)
jmp 0x3844
movq -0x148(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x6b20
jmp 0x3856
movq -0x148(%rbp), %rax
movq %rax, -0xc8(%rbp)
movl $0x10, %edi
callq 0x32a0
movq %rax, -0x150(%rbp)
jmp 0x3877
movq -0x150(%rbp), %rdi
movq -0x98(%rbp), %rsi
callq 0x6b20
jmp 0x388c
movq -0x150(%rbp), %rcx
movq -0xc8(%rbp), %rax
movq %rcx, 0x8(%rax)
callq 0x30a0
cltq
movq %rax, -0x170(%rbp)
leaq -0x60(%rbp), %rdi
movq %rdi, -0x158(%rbp)
callq 0x49b0
movq -0x158(%rbp), %rdi
movq %rax, %rcx
movq -0x170(%rbp), %rax
xorl %edx, %edx
divq %rcx
movl %edx, %eax
movl %eax, -0xcc(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x168(%rbp)
movslq -0xcc(%rbp), %rsi
callq 0x49d0
movq -0x168(%rbp), %rcx
movq -0x158(%rbp), %rdi
movq (%rax), %rax
movq %rcx, (%rax)
movq -0x68(%rbp), %rax
movq %rax, -0x160(%rbp)
movslq -0xcc(%rbp), %rsi
callq 0x49d0
movq -0x160(%rbp), %rcx
movq -0x158(%rbp), %rdi
movq %rcx, (%rax)
leaq -0x98(%rbp), %rsi
callq 0x4940
jmp 0x393e
jmp 0x36fa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x3966
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x3190
leaq -0x31(%rbp), %rdi
callq 0x3300
testb $0x1, -0x45(%rbp)
jne 0x3977
jmp 0x3988
movq -0x118(%rbp), %rdi
movl $0x38, %esi
callq 0x32b0
jmp 0x3ba7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x3b9e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x39c4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x3190
leaq -0x89(%rbp), %rdi
callq 0x3300
testb $0x1, -0x8a(%rbp)
jne 0x39db
jmp 0x39ec
movq -0x128(%rbp), %rdi
movl $0x38, %esi
callq 0x32b0
jmp 0x3b9e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x3a17
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x3190
leaq -0xb9(%rbp), %rdi
callq 0x3300
testb $0x1, -0xba(%rbp)
jne 0x3a2e
jmp 0x3a3f
movq -0x138(%rbp), %rdi
movl $0x38, %esi
callq 0x32b0
jmp 0x3b9e
movq -0x148(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
movl $0x10, %esi
callq 0x32b0
jmp 0x3b9e
movq -0x150(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
movl $0x10, %esi
callq 0x32b0
jmp 0x3b9e
movl -0x4(%rbp), %eax
movq %rsp, %rcx
movq %rcx, -0xd8(%rbp)
leaq 0xf(,%rax,4), %rcx
andq $-0x10, %rcx
movq %rsp, %rdi
subq %rcx, %rdi
movq %rdi, -0x178(%rbp)
movq %rdi, %rsp
movq %rax, -0xe0(%rbp)
movslq -0x4(%rbp), %rax
leaq (%rdi,%rax,4), %rsi
movl $0x1, %edx
callq 0x49f0
jmp 0x3acc
movq -0x178(%rbp), %rdi
movslq -0x4(%rbp), %rax
leaq (%rdi,%rax,4), %rsi
callq 0x4a30
jmp 0x3ae2
movl $0x0, -0xe4(%rbp)
movslq -0xe4(%rbp), %rax
movq %rax, -0x180(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x49b0
movq %rax, %rcx
movq -0x180(%rbp), %rax
cmpq %rcx, %rax
jae 0x3b74
movq -0x178(%rbp), %rax
movslq -0xe4(%rbp), %rcx
movl (%rax,%rcx,4), %esi
leaq -0x108(%rbp), %rdi
callq 0x4ad0
jmp 0x3b31
movslq -0xe4(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x49d0
movq (%rax), %rdi
addq $0x8, %rdi
leaq -0x108(%rbp), %rsi
callq 0x3350
leaq -0x108(%rbp), %rdi
callq 0x3190
movl -0xe4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xe4(%rbp)
jmp 0x3aec
movq -0x10(%rbp), %rax
movq %rax, -0x188(%rbp)
movq -0xd8(%rbp), %rax
movq %rax, %rsp
leaq -0x60(%rbp), %rdi
callq 0x4bb0
movq -0x188(%rbp), %rax
movq %rbp, %rsp
popq %rbp
retq
leaq -0x60(%rbp), %rdi
callq 0x4bb0
movq -0x40(%rbp), %rdi
callq 0x3450