// File: /workspace/github_cpp_makefile_star2_O2/davmac314[P]dinit/src/../dasynq/include/dasynq/btree_set.h
// Function: dasynq::btree_set<void*, int, std::less<int>, 8>::repop_node(dasynq::btree_set<void*, int, std::less<int>, 8>::septnode*, int)
void repop_node(septnode *sept, int children) noexcept
    {
        start:
        septnode *parent = sept->parent;
        if (parent == nullptr) {
            // It's the root node, so don't worry about it, unless empty
            if (sept->hn_p[0] == nullptr) {
                root_sept = nullptr;
                left_sept = nullptr;
                release_sept(sept);
            }
            return;
        }

        // Find a suitable sibling to the left or right:
        if (parent->children[0] == sept) {
            // take right sibling
            septnode *rsibling = parent->children[1];
            if (rsibling->num_vals() + children + 1 <= N) {
                // We can merge
                merge(sept, rsibling, 0);
                if (sept->parent != nullptr) {
                    children = sept->parent->num_vals();
                    if (children < N/2) {
                        sept = sept->parent;
                        goto start;
                    }
                }
            }
            else {
                sept->hn_p[children] = parent->hn_p[0];
                sept->prio[children] = parent->prio[0];
                sept->hn_p[children]->parent = sept;
                sept->children[children + 1] = rsibling->children[0];
                if (sept->children[children + 1]) sept->children[children + 1]->parent = sept;

                parent->hn_p[0] = rsibling->hn_p[0];
                parent->prio[0] = rsibling->prio[0];
                parent->hn_p[0]->parent = parent;

                rsibling->shift_elems_left(1, 0, N-1);
                rsibling->hn_p[N-1] = nullptr;
                return;
            }
        }
        else {
            // find left sibling
            int i;
            for (i = 1; i < N; i++) {
                if (parent->children[i] == sept) {
                    break;
                }
            }

            septnode *lsibling = parent->children[i-1];
            int lchildren = lsibling->num_vals();
            if (lchildren + children + 1 <= N) {
                // merge
                merge(lsibling, sept, i - 1);
                if (lsibling->parent != nullptr) {
                    children = lsibling->parent->num_vals();
                    if (children < N/2) {
                        sept = lsibling->parent;
                        goto start;
                    }
                }
            }
            else {
                sept->shift_elems_right(0, 1, children);

                sept->hn_p[0] = parent->hn_p[i - 1];
                sept->prio[0] = parent->prio[i - 1];
                sept->hn_p[0]->parent = sept;
                sept->children[0] = lsibling->children[lchildren];
                if (sept->children[0]) sept->children[0]->parent = sept;

                parent->hn_p[i - 1] = lsibling->hn_p[lchildren - 1];
                parent->prio[i - 1] = lsibling->prio[lchildren - 1];
                parent->hn_p[i - 1]->parent = parent;
                lsibling->hn_p[lchildren - 1] = nullptr;

                return;
            }
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, 0x8(%rsp)
movq 0xa8(%rbx), %r14
testq %r14, %r14
je 0x580d
cmpq %rbx, 0x60(%r14)
je 0x574d
xorl %r13d, %r13d
movq %r15, 0x10(%rsp)
cmpq $0x7, %r13
je 0x57a1
cmpq %rbx, 0x68(%r14,%r13,8)
je 0x57a7
incq %r13
jmp 0x573b
movq 0x68(%r14), %r12
movq %r12, %rdi
callq 0x58f4
addl %r15d, %eax
cmpl $0x7, %eax
jg 0x588e
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x590e
movq 0xa8(%rbx), %rdi
testq %rdi, %rdi
je 0x58e4
callq 0x58f4
cmpl $0x4, %eax
jge 0x58e4
movl %eax, %r15d
addq $0xa8, %rbx
jmp 0x5805
pushq $0x7
popq %rax
movl %eax, %r13d
movslq %r13d, %r15
movq 0x60(%r14,%r15,8), %r12
movq %r12, %rdi
callq 0x58f4
movl %eax, %ebp
movq 0x10(%rsp), %rcx
leal (%rcx,%rbp), %eax
cmpl $0x7, %eax
jg 0x5837
movq 0x8(%rsp), %rdi
movq %r12, %rsi
movq %rbx, %rdx
movl %r13d, %ecx
callq 0x590e
movq 0xa8(%r12), %rdi
testq %rdi, %rdi
je 0x58e4
callq 0x58f4
cmpl $0x4, %eax
jge 0x58e4
movl %eax, %r15d
addq $0xa8, %r12
movq %r12, %rbx
movq (%rbx), %rbx
jmp 0x571d
cmpq $0x0, 0x20(%rbx)
jne 0x58e4
xorps %xmm0, %xmm0
movq 0x8(%rsp), %rcx
movups %xmm0, (%rcx)
movq 0x10(%rcx), %rax
movq %rax, 0xa8(%rbx)
movq %rbx, 0x10(%rcx)
jmp 0x58e4
pushq $0x1
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5aa0
movq 0x20(%r14,%r15,8), %rax
movq %rax, 0x20(%rbx)
movl (%r14,%r15,4), %ecx
movl %ecx, (%rbx)
movq %rbx, 0x8(%rax)
movslq %ebp, %rax
movq 0x60(%r12,%rax,8), %rcx
movq %rcx, 0x60(%rbx)
testq %rcx, %rcx
je 0x586f
movq %rbx, 0xa8(%rcx)
movq 0x18(%r12,%rax,8), %rcx
movq %rcx, 0x20(%r14,%r15,8)
movl -0x4(%r12,%rax,4), %edx
movl %edx, (%r14,%r15,4)
movq %r14, 0x8(%rcx)
andq $0x0, 0x18(%r12,%rax,8)
jmp 0x58e4
movq 0x20(%r14), %rax
movslq %r15d, %rcx
movq %rax, 0x20(%rbx,%rcx,8)
movl (%r14), %edx
movl %edx, (%rbx,%rcx,4)
movq %rbx, 0x8(%rax)
movq 0x60(%r12), %rax
movq %rax, 0x68(%rbx,%rcx,8)
testq %rax, %rax
je 0x58ba
movq %rbx, 0xa8(%rax)
movq 0x20(%r12), %rax
movq %rax, 0x20(%r14)
movl (%r12), %ecx
movl %ecx, (%r14)
movq %r14, 0x8(%rax)
pushq $0x1
popq %rsi
pushq $0x7
popq %rcx
movq %r12, %rdi
xorl %edx, %edx
callq 0x5a3e
andq $0x0, 0x58(%r12)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop