// File: /workspace/github_c_makefile_star2_O1/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
cmpq $0x0, 0x18(%rdi)
je 0xd5f81
movl $0x8, %r13d
xorl %r12d, %r12d
xorl %r14d, %r14d
movq 0x8(%rbx), %rax
movq (%rax,%r13), %rbp
testq %rbp, %rbp
je 0xd5f69
movq (%rbp), %r15
testq %r12, %r12
je 0xd5ecf
cmpq %r15, 0x8(%r12)
je 0xd5f5b
leaq 0xd3592(%rip), %rdx     # 0x1a9468
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 0xd5f2b
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %r15, %rdx
je 0xd5f2b
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %r15, %rdx
je 0xd5f2b
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %r15, %rdx
jne 0xd5f7c
movq (%rax,%rcx), %r12
testq %r12, %r12
jne 0xd5f5b
movabsq $0x782b96602f424981, %rdi # imm = 0x782B96602F424981
movq %r15, %rsi
callq 0xf3f85
movq %rax, %r12
leaq 0xd3518(%rip), %rdi     # 0x1a9468
movq %r15, %rsi
movq %rax, %rdx
callq 0x12128c
movq %r12, %rdi
movq %rbp, %rsi
callq *0xb8(%r12)
incq %r14
addq $0x10, %r13
cmpq 0x18(%rbx), %r14
jb 0xd5eaa
jmp 0xd5f84
xorl %r12d, %r12d
jmp 0xd5f2f
xorl %r12d, %r12d
movq 0x8(%rbx), %rdi
xorl %esi, %esi
callq 0xc8315
movq %rax, 0x8(%rbx)
movq 0x10(%rbx), %rdi
xorl %esi, %esi
callq 0xc8315
movq %rax, 0x10(%rbx)
movq $0x0, 0x18(%rbx)
movq 0x8(%rbx), %rsi
movq 0x8(%rsp), %r14
movq 0x18(%r14), %rdx
movl $0x10, %edi
callq 0xc8389
movq %r14, %rdi
movq %rbx, 0x10(%rsp)
movq %rax, 0x8(%rbx)
movq 0x18(%r14), %rax
testq %rax, %rax
je 0xd60e6
movl $0x8, %ebp
xorl %r13d, %r13d
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 0xd60cb
movq (%rax), %r15
testq %r12, %r12
je 0xd6019
cmpq %r15, 0x8(%r12)
je 0xd60aa
leaq 0xd3448(%rip), %rdx     # 0x1a9468
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 0xd6075
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %r15, %rdx
je 0xd6075
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %r15, %rdx
je 0xd6075
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %r15, %rdx
jne 0xd60e1
movq (%rax,%rcx), %r12
testq %r12, %r12
jne 0xd60aa
movabsq $0x782b96602f424981, %rdi # imm = 0x782B96602F424981
movq %r15, %rsi
callq 0xf3f85
movq %rax, %r12
leaq 0xd33ce(%rip), %rdi     # 0x1a9468
movq %r15, %rsi
movq %rax, %rdx
callq 0x12128c
movq 0x8(%rsp), %rdi
movq (%rbx,%rbp), %rsi
testq %rsi, %rsi
je 0xd60c5
movq %r12, %rdi
callq *0xc0(%r12)
movq 0x8(%rsp), %rdi
jmp 0xd60c7
xorl %eax, %eax
movq %rax, (%r14,%rbp)
incq %r13
movq 0x18(%rdi), %rax
addq $0x10, %rbp
cmpq %rax, %r13
jb 0xd5fe2
jmp 0xd60e6
xorl %r12d, %r12d
jmp 0xd6079
movq 0x10(%rsp), %rcx
movq %rax, 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