// File: /workspace/github_c_makefile_star2_O3/johsteffens[P]beth/lib/bcore/bcore_hmap.c
// Function: bcore_hmap_tpto_s_copy
void bcore_hmap_tpto_s_copy( bcore_hmap_tpto_s* o, const bcore_hmap_tpto_s* src )
{
    const bcore_inst_s* inst_p = o->type ? bcore_inst_s_get_typed( o->type ) : NULL;
    for( uz_t i = 0; i < o->size; i++ )
    {
        if( o->nodes[ i ].val ) bcore_inst_p_discard( inst_p, o->nodes[ i ].val );
    }
    o->nodes = bcore_alloc( o->nodes, 0 );
    o->flags = bcore_alloc( o->flags, 0 );
    o->size  = 0;

    o->nodes = bcore_u_memzero( sizeof( bcore_hnode_tpto_s ), o->nodes, src->size );
    inst_p = src->type ? bcore_inst_s_get_typed( src->type ) : NULL;
    for( uz_t i = 0; i < src->size; i++ )
    {
        const bcore_hnode_tpto_s* src_node = &src->nodes[ i ];
              bcore_hnode_tpto_s* dst_node =   &o->nodes[ i ];

        dst_node->key = src_node->key;
        if( src_node->val )
        {
            dst_node->val = bcore_inst_p_clone( inst_p, src_node->val );
        }
    }

    o->type = src->type;
    o->size = src->size;
    o->depth_limit = src->depth_limit;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rdi), %r12
testq %r12, %r12
je 0xcb1eb
leaq 0xd1305(%rip), %rax     # 0x19c468
movl (%rax), %ecx
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %rcx
movq 0x20(%rax,%rcx,8), %rdx
movq 0x18(%rax,%rcx,8), %rcx
andq %r12, %rcx
shlq $0x4, %rcx
leaq (%rdx,%rcx), %rax
movq (%rdx,%rcx), %rdx
movl $0x8, %ecx
cmpq %r12, %rdx
je 0xcb1b9
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %r12, %rdx
je 0xcb1b9
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %r12, %rdx
je 0xcb1b9
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %r12, %rdx
jne 0xcb1c2
movq (%rax,%rcx), %r15
testq %r15, %r15
jne 0xcb1ee
movabsq $0x782b96602f424981, %rdi # imm = 0x782B96602F424981
movq %r12, %rsi
callq 0xe9bc5
movq %rax, %r15
leaq 0xd128a(%rip), %rdi     # 0x19c468
movq %r12, %rsi
movq %rax, %rdx
callq 0x115fac
jmp 0xcb1ee
xorl %r15d, %r15d
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0xcb227
movl $0x8, %r12d
xorl %r13d, %r13d
movq 0x10(%rbx), %rcx
movq (%rcx,%r12), %rsi
testq %rsi, %rsi
je 0xcb21b
movq %r15, %rdi
callq *0xb8(%r15)
movq 0x20(%rbx), %rax
incq %r13
addq $0x10, %r12
cmpq %rax, %r13
jb 0xcb200
movq 0x10(%rbx), %rdi
xorl %r15d, %r15d
xorl %esi, %esi
callq 0xbe7b1
movq %rax, 0x10(%rbx)
movq 0x18(%rbx), %rdi
xorl %esi, %esi
callq 0xbe7b1
movq %rax, 0x18(%rbx)
movq $0x0, 0x20(%rbx)
movq 0x10(%rbx), %rsi
movq 0x20(%r14), %rdx
movl $0x10, %edi
callq 0xbe825
movq %rax, 0x10(%rbx)
movq 0x8(%r14), %r12
testq %r12, %r12
je 0xcb300
leaq 0xd11ee(%rip), %rax     # 0x19c468
movl (%rax), %ecx
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %rcx
movq 0x20(%rax,%rcx,8), %rdx
movq 0x18(%rax,%rcx,8), %rcx
andq %r12, %rcx
shlq $0x4, %rcx
leaq (%rdx,%rcx), %rax
movq (%rdx,%rcx), %rdx
movl $0x8, %ecx
cmpq %r12, %rdx
je 0xcb2d0
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %r12, %rdx
je 0xcb2d0
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %r12, %rdx
je 0xcb2d0
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %r12, %rdx
jne 0xcb2d9
movq (%rax,%rcx), %r15
testq %r15, %r15
jne 0xcb300
movabsq $0x782b96602f424981, %rdi # imm = 0x782B96602F424981
movq %r12, %rsi
callq 0xe9bc5
movq %rax, %r15
leaq 0xd1173(%rip), %rdi     # 0x19c468
movq %r12, %rsi
movq %rax, %rdx
callq 0x115fac
movq 0x20(%r14), %rax
testq %rax, %rax
je 0xcb34e
movl $0x8, %r12d
xorl %r13d, %r13d
movq 0x10(%r14), %rcx
movq 0x10(%rbx), %rbp
movq -0x8(%rcx,%r12), %rdx
movq %rdx, -0x8(%rbp,%r12)
movq (%rcx,%r12), %rsi
testq %rsi, %rsi
je 0xcb340
movq %r15, %rdi
callq *0xc0(%r15)
movq %rax, (%rbp,%r12)
movq 0x20(%r14), %rax
incq %r13
addq $0x10, %r12
cmpq %rax, %r13
jb 0xcb312
jmp 0xcb350
xorl %eax, %eax
movq 0x8(%r14), %rcx
movq %rcx, 0x8(%rbx)
movq %rax, 0x20(%rbx)
movq 0x28(%r14), %rax
movq %rax, 0x28(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq