// File: /workspace/github_c_makefile_star2_O3/johsteffens[P]beth/lib/bcore/bcore_hmap.c
// Function: bcore_hmap_tpaw_s_copy
void bcore_hmap_tpaw_s_copy( bcore_hmap_tpaw_s* o, const bcore_hmap_tpaw_s* src )
{
    const bcore_inst_s* inst_p = NULL;
    for( uz_t i = 0; i < o->size; i++ )
    {
        if( o->nodes[ i ].val )
        {
            vd_t val = o->nodes[ i ].val;
            tp_t type = *(aware_t*)val;
            if( !inst_p || inst_p->header.o_type != type ) inst_p = bcore_inst_s_get_typed( type );
            bcore_inst_p_discard( inst_p, 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_tpaw_s ), o->nodes, src->size );
    for( uz_t i = 0; i < src->size; i++ )
    {
        const bcore_hnode_tpaw_s* src_node = &src->nodes[ i ];
              bcore_hnode_tpaw_s* dst_node =   &o->nodes[ i ];

        dst_node->key = src_node->key;
        if( src_node->val )
        {
            vd_t val = src_node->val;
            tp_t type = *(aware_t*)val;
            if( !inst_p || inst_p->header.o_type != type ) inst_p = bcore_inst_s_get_typed( type );
            dst_node->val = bcore_inst_p_clone( inst_p, src_node->val );
        }
    }

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, 0x8(%rsp)
movq %rdi, %rbx
movq 0x18(%rdi), %rax
testq %rax, %rax
je 0xcc03a
movl $0x8, %r13d
xorl %r12d, %r12d
xorl %r14d, %r14d
movq 0x8(%rbx), %rcx
movq (%rcx,%r13), %rbp
testq %rbp, %rbp
je 0xcc028
movq (%rbp), %r15
testq %r12, %r12
je 0xcbf8a
cmpq %r15, 0x8(%r12)
je 0xcc016
leaq 0xd04d7(%rip), %rdx     # 0x19c468
movl (%rdx), %eax
cltq
leaq (%rax,%rax,2), %rax
movq 0x20(%rdx,%rax,8), %rcx
movq 0x18(%rdx,%rax,8), %rdx
andq %r15, %rdx
shlq $0x4, %rdx
leaq (%rcx,%rdx), %rax
movq (%rcx,%rdx), %rdx
movl $0x8, %ecx
cmpq %r15, %rdx
je 0xcbfe6
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %r15, %rdx
je 0xcbfe6
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %r15, %rdx
je 0xcbfe6
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %r15, %rdx
jne 0xcbfef
movq (%rax,%rcx), %r12
testq %r12, %r12
jne 0xcc016
movabsq $0x782b96602f424981, %rdi # imm = 0x782B96602F424981
movq %r15, %rsi
callq 0xe9bc5
movq %rax, %r12
leaq 0xd045d(%rip), %rdi     # 0x19c468
movq %r15, %rsi
movq %rax, %rdx
callq 0x115fac
movq %r12, %rdi
movq %rbp, %rsi
callq *0xb8(%r12)
movq 0x18(%rbx), %rax
incq %r14
addq $0x10, %r13
cmpq %rax, %r14
jb 0xcbf65
jmp 0xcc03d
xorl %r12d, %r12d
movq 0x8(%rbx), %rdi
xorl %r15d, %r15d
xorl %esi, %esi
callq 0xbe7b1
movq %rax, 0x8(%rbx)
movq 0x10(%rbx), %rdi
xorl %esi, %esi
callq 0xbe7b1
movq %rax, 0x10(%rbx)
movq $0x0, 0x18(%rbx)
movq 0x8(%rbx), %rsi
movq 0x8(%rsp), %r14
movq 0x18(%r14), %rdx
movl $0x10, %edi
callq 0xbe825
movq %r14, %rdi
movq %rbx, 0x10(%rsp)
movq %rax, 0x8(%rbx)
movq 0x18(%r14), %rax
testq %rax, %rax
je 0xcc19e
movl $0x8, %ebp
xorl %r13d, %r13d
movq %rax, %r15
movq 0x8(%rdi), %rbx
movq 0x10(%rsp), %rax
movq 0x8(%rax), %r14
movq -0x8(%rbx,%rbp), %rax
movq %rax, -0x8(%r14,%rbp)
movq (%rbx,%rbp), %rax
testq %rax, %rax
je 0xcc18e
movq (%rax), %r15
testq %r12, %r12
je 0xcc0d8
cmpq %r15, 0x8(%r12)
je 0xcc169
leaq 0xd0389(%rip), %rdx     # 0x19c468
movl (%rdx), %eax
cltq
leaq (%rax,%rax,2), %rax
movq 0x20(%rdx,%rax,8), %rcx
movq 0x18(%rdx,%rax,8), %rdx
andq %r15, %rdx
shlq $0x4, %rdx
leaq (%rcx,%rdx), %rax
movq (%rcx,%rdx), %rdx
movl $0x8, %ecx
cmpq %r15, %rdx
je 0xcc134
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %r15, %rdx
je 0xcc134
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %r15, %rdx
je 0xcc134
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %r15, %rdx
jne 0xcc13d
movq (%rax,%rcx), %r12
testq %r12, %r12
jne 0xcc169
movabsq $0x782b96602f424981, %rdi # imm = 0x782B96602F424981
movq %r15, %rsi
callq 0xe9bc5
movq %rax, %r12
leaq 0xd030f(%rip), %rdi     # 0x19c468
movq %r15, %rsi
movq %rax, %rdx
callq 0x115fac
movq 0x8(%rsp), %rdi
movq (%rbx,%rbp), %rsi
testq %rsi, %rsi
je 0xcc184
movq %r12, %rdi
callq *0xc0(%r12)
movq 0x8(%rsp), %rdi
jmp 0xcc186
xorl %eax, %eax
movq %rax, (%r14,%rbp)
movq 0x18(%rdi), %r15
incq %r13
addq $0x10, %rbp
cmpq %r15, %r13
jb 0xcc0a1
movq 0x10(%rsp), %rcx
movq %r15, 0x18(%rcx)
movq 0x20(%rdi), %rax
movq %rax, 0x20(%rcx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq