// File: /workspace/github_cpp_makefile_star2_O1/millanek[P]Dsuite/Dsuite_fBranch.cpp
// Function: Tree::updateProgenyIds()
void Tree::updateProgenyIds() {
    // Determine the progeny of each branch (needed to know whether conditions are met, and for fossil constraints).
    // First of all, set progeniesComplete to 2 for all extinct and present branches.
    for (std::vector<Branch*>::iterator b = branches.begin(); b != branches.end(); b++) {
        if ((*b)->daughterId1 == "none") {
            (*b)->progeniesComplete = 2;
            (*b)->progenyIds.push_back((*b)->terminalSpeciesId);
        }
        // Set progenyPassedOn to true for the two root branches.
        if ((*b)->parentId == "treeOrigin") (*b)->progenyPassedOn = true;
    }
    bool allProgeniesComplete = false;
    while(!allProgeniesComplete) {
        std::vector<Branch*> newlyCompleted;
        for (std::vector<Branch*>::iterator b = branches.begin(); b != branches.end(); b++) {
            // Determine if the progeny of this branch is clear but has not been passed on to the parent yet.
            if ((*b)->progeniesComplete == 2 && (*b)->progenyPassedOn == false) {
                newlyCompleted.push_back(*b);
            }
        }
        if (newlyCompleted.size() == 0) allProgeniesComplete = true;
        for (std::vector<Branch*>::iterator b = newlyCompleted.begin(); b != newlyCompleted.end(); b++) {
            // Find parent, pass progeny+self on to parents progeny, add parent.progeniesComplete += 1, and change own progenyPassedOn to true.
            for (std::vector<Branch*>::iterator bb = branches.begin(); bb != branches.end(); bb++) {
                if ((*bb)->id == (*b)->parentId) {
                    (*b)->parentBranch = *bb;
                    (*bb)->progenyIds.insert((*bb)->progenyIds.end(), (*b)->progenyIds.begin(), (*b)->progenyIds.end() );
                    (*bb)->progeniesComplete++;
                    (*b)->progenyPassedOn = true;
                    break;
                }
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq 0x18(%rdi), %r12
cmpq 0x20(%rdi), %r12
je 0x25513
leaq 0x1db1e(%rip), %r14     # 0x42fcc
leaq 0x1dad7(%rip), %r15     # 0x42f8c
movq (%r12), %rdi
addq $0x40, %rdi
movq %r14, %rsi
callq 0x70f0
testl %eax, %eax
jne 0x254ea
movq (%r12), %rsi
movl $0x2, 0x110(%rsi)
leaq 0x80(%rsi), %rdi
addq $0x98, %rsi
callq 0xd92e
movq (%r12), %rdi
addq $0x20, %rdi
movq %r15, %rsi
callq 0x70f0
testl %eax, %eax
jne 0x25509
movq (%r12), %rax
movb $0x1, 0x114(%rax)
addq $0x8, %r12
cmpq 0x20(%rbx), %r12
jne 0x254b5
xorl %ebp, %ebp
movq %rbx, 0x20(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq 0x18(%rbx), %r15
cmpq 0x20(%rbx), %r15
je 0x25571
movq (%r15), %rax
cmpl $0x2, 0x110(%rax)
jne 0x2556b
cmpb $0x0, 0x114(%rax)
jne 0x2556b
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x25560
movq %rax, (%rsi)
addq $0x8, 0x8(%rsp)
jmp 0x2556b
movq %rsp, %rdi
movq %r15, %rdx
callq 0x35e7a
addq $0x8, %r15
jmp 0x2552e
movq (%rsp), %r15
movq 0x8(%rsp), %rax
movzbl %bpl, %ebp
cmpq %r15, %rax
movl $0x1, %eax
cmovel %eax, %ebp
movl %ebp, 0x1c(%rsp)
je 0x25628
movq 0x18(%rbx), %r13
movq 0x20(%rbx), %r12
cmpq %r12, %r13
je 0x25614
movq (%r15), %r14
movq 0x28(%r14), %rbp
movq (%r13), %rbx
movq 0x8(%rbx), %rdx
cmpq %rbp, %rdx
jne 0x255c9
testq %rdx, %rdx
je 0x255d4
movq 0x20(%r14), %rsi
movq (%rbx), %rdi
callq 0x7440
testl %eax, %eax
je 0x255d4
addq $0x8, %r13
cmpq %r12, %r13
jne 0x255a7
jmp 0x25614
movq %rbx, 0xb8(%r14)
movq (%r13), %rdi
movq 0x88(%rdi), %rsi
subq $-0x80, %rdi
movq (%r15), %rax
movq 0x80(%rax), %rdx
movq 0x88(%rax), %rcx
callq 0x35f56
movq (%r13), %rax
incl 0x110(%rax)
movq (%r15), %rax
movb $0x1, 0x114(%rax)
addq $0x8, %r15
cmpq 0x8(%rsp), %r15
movq 0x20(%rsp), %rbx
jne 0x25593
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x2563e
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x7420
movl 0x1c(%rsp), %ebp
testb $0x1, %bpl
je 0x2551a
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2565d
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x25676
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x7420
movq %rbx, %rdi
callq 0x7740