// File: /workspace/github_c_makefile_star2_O3/johsteffens[P]beth/lib/bcore/bcore_hmap.c
// Function: bcore_hmap_tpuz_s_from_array
sz_t bcore_hmap_tpuz_s_from_array( bcore_hmap_tpuz_s* o, bcore_array* array, tp_t member_name )
{
    bcore_hmap_tpuz_s_clear( o );
    sz_t dup_count = 0;
    const bcore_array_s* array_p = bcore_array_s_get_aware( array );
    sz_t size = bcore_array_p_get_size( array_p, array );
    if( size == 0 ) return 0;

    if( bcore_array_p_is_mono_typed( array_p ) ) // faster code for mono-typed arrays
    {
        const bcore_via_s* via_p = bcore_via_s_get_typed( bcore_array_p_get_mono_type( array_p, array ) );
        if( bcore_via_p_nexists( via_p, NULL, member_name ) )
        {
            uz_t member_index = bcore_via_p_nget_index( via_p, NULL, member_name );

            for( sz_t i = 0; i < size; i++ )
            {
                sr_s element = bcore_array_p_get( array_p, array, i );
                tp_t key = bcore_hash_x_get_tp( bcore_via_p_iget( via_p, element.o, member_index ) );
                if( bcore_hmap_tpuz_s_exists( o, key ) )
                {
                    dup_count++;
                }
                else
                {
                    bcore_hmap_tpuz_s_set( o, key, i );
                }
                sr_down( element );
            }
        }
    }
    else // generic code for all array types
    {
        for( sz_t i = 0; i < size; i++ )
        {
            sr_s element = bcore_array_p_get( array_p, array, i );
            const bcore_via_s* via_p = bcore_via_s_get_typed( sr_s_type( &element ) );

            if( bcore_via_p_nexists( via_p, element.o, member_name ) )
            {
                tp_t key = bcore_hash_x_get_tp( bcore_via_p_nget( via_p, element.o, member_name ) );
                if( bcore_hmap_tpuz_s_exists( o, key ) )
                {
                    dup_count++;
                }
                else
                {
                    bcore_hmap_tpuz_s_set( o, key, i );
                }
            }

            sr_down( element );
        }
    }
    return dup_count;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdx, %r13
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%rdi), %rdi
xorl %esi, %esi
callq 0xbe7b1
movq %rax, 0x8(%r14)
movq 0x10(%r14), %rdi
xorl %esi, %esi
callq 0xbe7b1
movq %rax, 0x10(%r14)
movq $0x0, 0x18(%r14)
movq %rbx, 0x38(%rsp)
movq (%rbx), %rbx
leaq 0xd13a7(%rip), %rax     # 0x19be20
movl (%rax), %ecx
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %rcx
movq 0x20(%rax,%rcx,8), %rdx
movq 0x18(%rax,%rcx,8), %rcx
andq %rbx, %rcx
shlq $0x4, %rcx
leaq (%rdx,%rcx), %rax
movq (%rdx,%rcx), %rdx
movl $0x8, %ecx
cmpq %rbx, %rdx
je 0xcaacf
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %rbx, %rdx
je 0xcaacf
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %rbx, %rdx
je 0xcaacf
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %rbx, %rdx
jne 0xcaad8
movq (%rax,%rcx), %r15
testq %r15, %r15
jne 0xcaaff
movabsq $-0x5073d588c3beb52e, %rdi # imm = 0xAF8C2A773C414AD2
movq %rbx, %rsi
callq 0xe9bc5
movq %rax, %r15
leaq 0xd132c(%rip), %rdi     # 0x19be20
movq %rbx, %rsi
movq %rax, %rdx
callq 0x115fac
movq %r15, %rdi
movq 0x38(%rsp), %rsi
callq 0xede4d
movq %rax, 0x30(%rsp)
testq %rax, %rax
je 0xcafda
cmpb $0x0, 0x43(%r15)
movq %r13, 0x28(%rsp)
je 0xcad97
movq %r15, %rdi
movq 0x38(%rsp), %rsi
callq 0xee1d0
movq %rax, %r12
leaq 0xd25b7(%rip), %rax     # 0x19d0f8
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 0xcab97
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %r12, %rdx
je 0xcab97
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %r12, %rdx
je 0xcab97
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %r12, %rdx
jne 0xcaba0
movq (%rax,%rcx), %rbx
testq %rbx, %rbx
jne 0xcabc7
movabsq $0x541d0401d4dcff33, %rdi # imm = 0x541D0401D4DCFF33
movq %r12, %rsi
callq 0xe9bc5
movq %rax, %rbx
leaq 0xd253c(%rip), %rdi     # 0x19d0f8
movq %r12, %rsi
movq %rax, %rdx
callq 0x115fac
movq $0x0, 0x20(%rsp)
movq %rbx, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x102b4b
testb %al, %al
je 0xcafe3
movq $0x0, 0x20(%rsp)
movq %rbx, %rdi
xorl %esi, %esi
movq 0x28(%rsp), %rdx
callq 0x102b8b
movq %rax, 0x28(%rsp)
cmpq $0x0, 0x30(%rsp)
jle 0xcafe3
movq $0x0, 0x20(%rsp)
xorl %ebp, %ebp
leaq 0x60(%rsp), %rdi
movq %r15, %rsi
movq 0x38(%rsp), %rdx
movq %rbp, %rcx
callq 0xede75
movq 0x60(%rsp), %rdx
leaq 0x90(%rsp), %rdi
movq %rbx, %rsi
movq 0x28(%rsp), %rcx
callq 0x101e10
movups 0x90(%rsp), %xmm0
movaps %xmm0, 0x40(%rsp)
movq 0xa0(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x48(%rsp), %r12
movq 0x8(%r12), %r13
movabsq $0x57ef6ea4efc111b5, %rax # imm = 0x57EF6EA4EFC111B5
cmpq %rax, %r13
je 0xcad0b
leaq 0xd15ca(%rip), %rdx     # 0x19c250
movl (%rdx), %eax
cltq
leaq (%rax,%rax,2), %rax
movq 0x20(%rdx,%rax,8), %rcx
movq 0x18(%rdx,%rax,8), %rdx
andq %r13, %rdx
shlq $0x4, %rdx
leaq (%rcx,%rdx), %rax
movq (%rcx,%rdx), %rdx
movl $0x8, %ecx
cmpq %r13, %rdx
je 0xcacdb
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %r13, %rdx
je 0xcacdb
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %r13, %rdx
je 0xcacdb
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %r13, %rdx
jne 0xcace4
movq (%rax,%rcx), %r12
testq %r12, %r12
jne 0xcad0b
movabsq $0x57ef6ea4efc111b5, %rdi # imm = 0x57EF6EA4EFC111B5
movq %r13, %rsi
callq 0xe9bc5
movq %rax, %r12
leaq 0xd1550(%rip), %rdi     # 0x19c250
movq %r13, %rsi
movq %rax, %rdx
callq 0x115fac
movq 0x40(%rsp), %rsi
movq %r12, %rdi
callq 0xf6c0f
movq %rax, %r12
testb $0x2, 0x50(%rsp)
je 0xcad3a
movq 0x50(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x40(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x107590
testq %r12, %r12
je 0xcad57
movq %r14, %rdi
movq %r12, %rsi
callq 0xc886b
cmpq 0x18(%r14), %rax
jae 0xcad57
incq 0x20(%rsp)
jmp 0xcad65
movq %r14, %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0xc8a20
testb $0x2, 0x70(%rsp)
je 0xcad84
movq 0x70(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x60(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x107590
incq %rbp
cmpq %rbp, 0x30(%rsp)
jne 0xcac19
jmp 0xcafe3
cmpq $0x0, 0x30(%rsp)
jle 0xcafda
movq $0x0, 0x20(%rsp)
leaq 0xd2345(%rip), %r13     # 0x19d0f8
xorl %ebx, %ebx
leaq 0x60(%rsp), %rdi
movq %r15, %rsi
movq 0x38(%rsp), %rdx
movq %rbx, %rcx
callq 0xede75
movq 0x68(%rsp), %rax
testq %rax, %rax
je 0xcadda
movq 0x8(%rax), %r12
jmp 0xcaddd
xorl %r12d, %r12d
movl (%r13), %eax
cltq
leaq (%rax,%rax,2), %rax
movq 0x20(%r13,%rax,8), %rcx
movq 0x18(%r13,%rax,8), %rdx
andq %r12, %rdx
shlq $0x4, %rdx
leaq (%rcx,%rdx), %rax
movq (%rcx,%rdx), %rdx
movl $0x8, %ecx
cmpq %r12, %rdx
je 0xcae34
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %r12, %rdx
je 0xcae34
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %r12, %rdx
je 0xcae34
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %r12, %rdx
jne 0xcae3d
movq (%rax,%rcx), %rbp
testq %rbp, %rbp
jne 0xcae60
movabsq $0x541d0401d4dcff33, %rdi # imm = 0x541D0401D4DCFF33
movq %r12, %rsi
callq 0xe9bc5
movq %rax, %rbp
movq %r13, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x115fac
movq 0x60(%rsp), %rsi
movq %rbp, %rdi
movq 0x28(%rsp), %r12
movq %r12, %rdx
callq 0x102b4b
testb %al, %al
je 0xcafab
movq 0x60(%rsp), %rdx
leaq 0x78(%rsp), %rdi
movq %rbp, %rsi
movq %r12, %rcx
callq 0x102bbb
movups 0x78(%rsp), %xmm0
movaps %xmm0, 0x40(%rsp)
movq 0x88(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x48(%rsp), %rbp
movq 0x8(%rbp), %r12
movabsq $0x57ef6ea4efc111b5, %rax # imm = 0x57EF6EA4EFC111B5
cmpq %rax, %r12
je 0xcaf51
leaq 0xd1384(%rip), %rdx     # 0x19c250
movl (%rdx), %eax
cltq
leaq (%rax,%rax,2), %rax
movq 0x20(%rdx,%rax,8), %rcx
movq 0x18(%rdx,%rax,8), %rdx
andq %r12, %rdx
shlq $0x4, %rdx
leaq (%rcx,%rdx), %rax
movq (%rcx,%rdx), %rdx
movl $0x8, %ecx
cmpq %r12, %rdx
je 0xcaf21
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %r12, %rdx
je 0xcaf21
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %r12, %rdx
je 0xcaf21
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %r12, %rdx
jne 0xcaf2a
movq (%rax,%rcx), %rbp
testq %rbp, %rbp
jne 0xcaf51
movabsq $0x57ef6ea4efc111b5, %rdi # imm = 0x57EF6EA4EFC111B5
movq %r12, %rsi
callq 0xe9bc5
movq %rax, %rbp
leaq 0xd130a(%rip), %rdi     # 0x19c250
movq %r12, %rsi
movq %rax, %rdx
callq 0x115fac
movq 0x40(%rsp), %rsi
movq %rbp, %rdi
callq 0xf6c0f
movq %rax, %r12
testb $0x2, 0x50(%rsp)
je 0xcaf80
movq 0x50(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x40(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x107590
testq %r12, %r12
je 0xcaf9d
movq %r14, %rdi
movq %r12, %rsi
callq 0xc886b
cmpq 0x18(%r14), %rax
jae 0xcaf9d
incq 0x20(%rsp)
jmp 0xcafab
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0xc8a20
testb $0x2, 0x70(%rsp)
je 0xcafca
movq 0x70(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x60(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x107590
incq %rbx
cmpq %rbx, 0x30(%rsp)
jne 0xcadb5
jmp 0xcafe3
movq $0x0, 0x20(%rsp)
movq 0x20(%rsp), %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq