// File: /workspace/github_c_makefile_star2_O3/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 0xc7aac
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x60(%rsp), %r12
movb $0x0, 0x8(%r12)
cmpq %rsi, 0x20(%rdi)
jne 0xc7ac1
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 0xc7af1
movq 0x8(%r14), %r15
movq (%r12), %rdi
callq *%rax
andq %rbp, %rax
leaq (%rax,%rax,2), %rax
leaq (%r15,%rax,8), %r15
cmpq $0x0, (%r15)
je 0xc7c27
movq %r15, %r13
jmp 0xc7af4
xorl %r13d, %r13d
movq 0x30(%r14), %rax
testq %rax, %rax
je 0xc7b23
movq 0x8(%r14), %r15
movq (%r12), %rdi
callq *%rax
andq %rbp, %rax
leaq (%rax,%rax,2), %rax
leaq (%r15,%rax,8), %r15
cmpq $0x0, (%r15)
je 0xc7c27
movq %r15, 0x20(%rsp)
jmp 0xc7b2c
movq $0x0, 0x20(%rsp)
movq 0x38(%r14), %rax
testq %rax, %rax
je 0xc7b55
movq 0x8(%r14), %r15
movq (%r12), %rdi
callq *%rax
andq %rbp, %rax
leaq (%rax,%rax,2), %rax
leaq (%r15,%rax,8), %r15
cmpq $0x0, (%r15)
jne 0xc7b58
jmp 0xc7c27
xorl %r15d, %r15d
testq %r13, %r13
je 0xc7b91
cmpb $0x0, 0x8(%r13)
jne 0xc7b91
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 0xc7a7e
testq %rax, %rax
jne 0xc7bca
movb $0x0, 0x8(%r13)
movq 0x20(%rsp), %r13
testq %r13, %r13
je 0xc7bea
cmpb $0x0, 0x8(%r13)
jne 0xc7bea
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 0xc7a7e
testq %rax, %rax
je 0xc7be5
movq 0x10(%r12), %rax
movq %rax, 0x10(%r13)
movups (%r12), %xmm0
movups %xmm0, (%r13)
movq %r13, %r15
jmp 0xc7aaf
movb $0x0, 0x8(%r13)
testq %r15, %r15
je 0xc7aac
cmpb $0x0, 0x8(%r15)
jne 0xc7aac
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 0xc7a7e
testq %rax, %rax
je 0xc7c3e
movq 0x10(%r12), %rax
movq %rax, 0x10(%r15)
movups (%r12), %xmm0
movups %xmm0, (%r15)
jmp 0xc7aaf
movb $0x0, 0x8(%r15)
jmp 0xc7aac