// File: 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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0xa8(%rax), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x9111
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0x910c
movq -0x48(%rbp), %rdi
movq $0x0, (%rdi)
movq $0x0, 0x8(%rdi)
movq -0x10(%rbp), %rsi
callq 0x9440
jmp 0x910a
jmp 0x910c
jmp 0x942c
movq -0x20(%rbp), %rax
movq 0x60(%rax), %rax
cmpq -0x10(%rbp), %rax
jne 0x9274
movq -0x20(%rbp), %rax
movq 0x68(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0x9470
addl -0x14(%rbp), %eax
addl $0x1, %eax
cmpl $0x8, %eax
jg 0x9198
movq -0x48(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rdx
xorl %ecx, %ecx
callq 0x94d0
movq -0x10(%rbp), %rax
cmpq $0x0, 0xa8(%rax)
je 0x9193
movq -0x10(%rbp), %rax
movq 0xa8(%rax), %rdi
callq 0x9470
movl %eax, -0x14(%rbp)
cmpl $0x4, -0x14(%rbp)
jge 0x9191
movq -0x10(%rbp), %rax
movq 0xa8(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x90cb
jmp 0x9193
jmp 0x926f
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rdx
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq %rdx, 0x20(%rax,%rcx,8)
movq -0x20(%rbp), %rax
movl (%rax), %edx
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x10(%rbp), %rcx
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rdx
movq 0x20(%rax,%rdx,8), %rax
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rax
movq 0x60(%rax), %rdx
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq %rdx, 0x60(%rax,%rcx,8)
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
cmpq $0x0, 0x60(%rax,%rcx,8)
je 0x921f
movq -0x10(%rbp), %rcx
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
movq 0x60(%rax,%rdx,8), %rax
movq %rcx, 0xa8(%rax)
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x28(%rbp), %rax
movl (%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x20(%rbp), %rcx
movq 0x20(%rcx), %rax
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rdi
movl $0x1, %esi
xorl %edx, %edx
movl $0x7, %ecx
callq 0x9770
jmp 0x925e
movq -0x28(%rbp), %rax
movq $0x0, 0x58(%rax)
jmp 0x942c
jmp 0x942c
movl $0x1, -0x2c(%rbp)
cmpl $0x8, -0x2c(%rbp)
jge 0x92a3
movq -0x20(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq 0x60(%rax,%rcx,8), %rax
cmpq -0x10(%rbp), %rax
jne 0x9296
jmp 0x92a3
jmp 0x9298
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x927b
movq -0x20(%rbp), %rax
movl -0x2c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq 0x60(%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0x9470
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
addl -0x14(%rbp), %eax
addl $0x1, %eax
cmpl $0x8, %eax
jg 0x932c
movq -0x48(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x10(%rbp), %rdx
movl -0x2c(%rbp), %ecx
subl $0x1, %ecx
callq 0x94d0
movq -0x38(%rbp), %rax
cmpq $0x0, 0xa8(%rax)
je 0x9327
movq -0x38(%rbp), %rax
movq 0xa8(%rax), %rdi
callq 0x9470
movl %eax, -0x14(%rbp)
cmpl $0x4, -0x14(%rbp)
jge 0x9325
movq -0x38(%rbp), %rax
movq 0xa8(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x90cb
jmp 0x9327
jmp 0x942a
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %ecx
xorl %esi, %esi
movl $0x1, %edx
callq 0x9820
jmp 0x9341
movq -0x20(%rbp), %rax
movl -0x2c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq 0x20(%rax,%rcx,8), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x20(%rbp), %rax
movl -0x2c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq 0x60(%rax,%rcx,8), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x60(%rax)
je 0x93b4
movq -0x10(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movq %rcx, 0xa8(%rax)
movq -0x38(%rbp), %rax
movl -0x3c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq 0x20(%rax,%rcx,8), %rdx
movq -0x20(%rbp), %rax
movl -0x2c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq %rdx, 0x20(%rax,%rcx,8)
movq -0x38(%rbp), %rax
movl -0x3c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq -0x20(%rbp), %rax
movl -0x2c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movq -0x20(%rbp), %rcx
movq -0x20(%rbp), %rax
movl -0x2c(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
movq 0x20(%rax,%rdx,8), %rax
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
movl -0x3c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq $0x0, 0x20(%rax,%rcx,8)
jmp 0x942c
jmp 0x942c
addq $0x50, %rsp
popq %rbp
retq
movq %rax, %rdi
callq 0x52b0
nopw (%rax,%rax)