// File: /workspace/github_c_makefile_star2_O2/johsteffens[P]beth/lib/bcore/bcore_hmap.c
// Function: u3vd_set
static bcore_hnode_u3vd_s* u3vd_set( const bcore_hmap_u3vd_s* o, bcore_hnode_u3vd_s node, uz_t depth ) // sets new node
{
    if( o->size == 0 ) return NULL;
    uz_t mask = o->size - 1;
    node.flag_trace = 0;
    if( depth == o->depth_limit ) return NULL;

    bcore_hnode_u3vd_s* node1 = NULL;
    if( o->h1 )
    {
        node1 = &o->data[ o->h1( node.key ) & mask ];
        if( node1->key == 0 )
        {
            *node1 = node;
            return node1;
        }
    }

    bcore_hnode_u3vd_s* node2 = NULL;
    if( o->h2 )
    {
        node2 = &o->data[ o->h2( node.key ) & mask ];
        if( node2->key == 0 )
        {
            *node2 = node;
            return node2;
        }
    }

    bcore_hnode_u3vd_s* node3 = NULL;
    if( o->h3 )
    {
        node3 = &o->data[ o->h3( node.key ) & mask ];
        if( node3->key == 0 )
        {
            *node3 = node;
            return node3;
        }
    }

    if( node1 && !node1->flag_trace )
    {
        node1->flag_trace = 1;
        if( u3vd_set( o, *node1, depth + 1 ) )
        {
            *node1 = node;
            return node1;
        }
        else
        {
            node1->flag_trace = 0;
        }
    }

    if( node2 && !node2->flag_trace )
    {
        node2->flag_trace = 1;
        if( u3vd_set( o, *node2, depth + 1 ) )
        {
            *node2 = node;
            return node2;
        }
        else
        {
            node2->flag_trace = 0;
        }
    }

    if( node3 && !node3->flag_trace )
    {
        node3->flag_trace = 1;
        if( u3vd_set( o, *node3, depth + 1 ) )
        {
            *node3 = node;
            return node3;
        }
        else
        {
            node3->flag_trace = 0;
        }
    }

    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq 0x10(%rdi), %rbp
testq %rbp, %rbp
je 0x66dca
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x60(%rsp), %r15
movb $0x0, 0x8(%r15)
cmpq %rsi, 0x20(%rdi)
jne 0x66ddf
xorl %r15d, %r15d
movq %r15, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
decq %rbp
movq 0x28(%r14), %rax
testq %rax, %rax
je 0x66e12
movq 0x8(%r14), %r13
movq (%r15), %rdi
callq *%rax
andq %rbp, %rax
imulq $0x18, %rax, %rax
movq %r15, %rcx
leaq (%rax,%r13), %r15
cmpq $0x0, (%r13,%rax)
je 0x66e7b
movq %r15, %r13
movq %rcx, %r15
jmp 0x66e15
xorl %r13d, %r13d
movq 0x30(%r14), %rax
testq %rax, %rax
je 0x66e46
movq 0x8(%r14), %r12
movq (%r15), %rdi
callq *%rax
andq %rbp, %rax
imulq $0x18, %rax, %rax
movq %r15, %rcx
leaq (%r12,%rax), %r15
cmpq $0x0, (%r12,%rax)
je 0x66e7b
movq %r15, 0x20(%rsp)
movq %rcx, %r15
jmp 0x66e4f
movq $0x0, 0x20(%rsp)
movq 0x38(%r14), %rax
testq %rax, %rax
je 0x66e8f
movq 0x8(%r14), %r12
movq (%r15), %rdi
callq *%rax
andq %rbp, %rax
imulq $0x18, %rax, %rax
movq %r15, %rcx
leaq (%r12,%rax), %r15
cmpq $0x0, (%r12,%rax)
je 0x66e7b
movq %rcx, %r12
jmp 0x66e95
movq 0x10(%rcx), %rax
movq %rax, 0x10(%r15)
movups (%rcx), %xmm0
movups %xmm0, (%r15)
jmp 0x66dcd
movq %r15, %r12
xorl %r15d, %r15d
testq %r13, %r13
je 0x66ece
cmpb $0x0, 0x8(%r13)
jne 0x66ece
movb $0x1, 0x8(%r13)
leaq 0x1(%rbx), %rsi
movq 0x10(%r13), %rax
movq %rax, 0x10(%rsp)
movups (%r13), %xmm0
movups %xmm0, (%rsp)
movq %r14, %rdi
callq 0x66d9d
testq %rax, %rax
jne 0x66f07
movb $0x0, 0x8(%r13)
movq 0x20(%rsp), %r13
testq %r13, %r13
je 0x66f27
cmpb $0x0, 0x8(%r13)
jne 0x66f27
movb $0x1, 0x8(%r13)
leaq 0x1(%rbx), %rsi
movq 0x10(%r13), %rax
movq %rax, 0x10(%rsp)
movups (%r13), %xmm0
movups %xmm0, (%rsp)
movq %r14, %rdi
callq 0x66d9d
testq %rax, %rax
je 0x66f22
movq 0x10(%r12), %rax
movq %rax, 0x10(%r13)
movups (%r12), %xmm0
movups %xmm0, (%r13)
movq %r13, %r15
jmp 0x66dcd
movb $0x0, 0x8(%r13)
testq %r15, %r15
je 0x66dca
cmpb $0x0, 0x8(%r15)
jne 0x66dca
movb $0x1, 0x8(%r15)
incq %rbx
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x66d9d
testq %rax, %rax
je 0x66f77
movq 0x10(%r12), %rax
movq %rax, 0x10(%r15)
movups (%r12), %xmm0
jmp 0x66e86
movb $0x0, 0x8(%r15)
jmp 0x66dca