// File: /workspace/github_c_makefile_star2_O1/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 $0x98, %rsp
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%rdi), %rdi
xorl %esi, %esi
callq 0xc8315
movq %rax, 0x8(%r14)
movq 0x10(%r14), %rdi
xorl %esi, %esi
callq 0xc8315
movq %rax, 0x10(%r14)
movq $0x0, 0x18(%r14)
movq %rbx, 0x28(%rsp)
movq (%rbx), %rbx
leaq 0xd44f0(%rip), %rax     # 0x1a8e20
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 0xd498a
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %rbx, %rdx
je 0xd498a
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %rbx, %rdx
je 0xd498a
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %rbx, %rdx
jne 0xd4ee8
movq (%rax,%rcx), %r13
testq %r13, %r13
jne 0xd49ba
movabsq $-0x5073d588c3beb52e, %rdi # imm = 0xAF8C2A773C414AD2
movq %rbx, %rsi
callq 0xf3f85
movq %rax, %r13
leaq 0xd4471(%rip), %rdi     # 0x1a8e20
movq %rbx, %rsi
movq %rax, %rdx
callq 0x12128c
movq %r13, %rdi
movq 0x28(%rsp), %rsi
callq 0xf837b
movq %rax, 0x20(%rsp)
testq %rax, %rax
je 0xd4ec8
cmpb $0x0, 0x43(%r13)
movq %r13, 0x48(%rsp)
je 0xd4c61
movq %r13, %rdi
movq 0x28(%rsp), %rsi
callq 0xf86fe
movq %rax, %rbp
leaq 0xd56fc(%rip), %rax     # 0x1aa0f8
movl (%rax), %ecx
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %rcx
movq 0x20(%rax,%rcx,8), %rdx
movq 0x18(%rax,%rcx,8), %rcx
andq %rbp, %rcx
shlq $0x4, %rcx
leaq (%rdx,%rcx), %rax
movq (%rdx,%rcx), %rdx
movl $0x8, %ecx
cmpq %rbp, %rdx
je 0xd4a56
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %rbp, %rdx
je 0xd4a56
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %rbp, %rdx
je 0xd4a56
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %rbp, %rdx
jne 0xd4ef0
movq (%rax,%rcx), %rbx
testq %rbx, %rbx
jne 0xd4a86
movabsq $0x541d0401d4dcff33, %rdi # imm = 0x541D0401D4DCFF33
movq %rbp, %rsi
callq 0xf3f85
movq %rax, %rbx
leaq 0xd567d(%rip), %rdi     # 0x1aa0f8
movq %rbp, %rsi
movq %rax, %rdx
callq 0x12128c
movq $0x0, 0x18(%rsp)
movq %rbx, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x10d7a8
testb %al, %al
je 0xd4ed1
movq $0x0, 0x18(%rsp)
movq %rbx, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x10d7e8
cmpq $0x0, 0x20(%rsp)
jle 0xd4ed1
movq %rax, %r15
movq $0x0, 0x18(%rsp)
xorl %ebp, %ebp
leaq 0x50(%rsp), %rdi
movq %r13, %rsi
movq 0x28(%rsp), %rdx
movq %rbp, %rcx
callq 0xf83a3
movq 0x50(%rsp), %rdx
leaq 0x80(%rsp), %rdi
movq %rbx, %rsi
movq %r15, %rcx
callq 0x10ca2c
movups 0x80(%rsp), %xmm0
movaps %xmm0, 0x30(%rsp)
movq 0x90(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x38(%rsp), %r12
movq 0x8(%r12), %r13
movabsq $0x57ef6ea4efc111b5, %rax # imm = 0x57EF6EA4EFC111B5
cmpq %rax, %r13
je 0xd4bc8
leaq 0xd4711(%rip), %rdx     # 0x1a9250
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 0xd4b98
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %r13, %rdx
je 0xd4b98
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %r13, %rdx
je 0xd4b98
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %r13, %rdx
jne 0xd4c59
movq (%rax,%rcx), %r12
testq %r12, %r12
jne 0xd4bc8
movabsq $0x57ef6ea4efc111b5, %rdi # imm = 0x57EF6EA4EFC111B5
movq %r13, %rsi
callq 0xf3f85
movq %rax, %r12
leaq 0xd4693(%rip), %rdi     # 0x1a9250
movq %r13, %rsi
movq %rax, %rdx
callq 0x12128c
movq 0x30(%rsp), %rsi
movq %r12, %rdi
callq 0x1013a2
movq %rax, %r12
testb $0x2, 0x40(%rsp)
je 0xd4bf7
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x30(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x112485
testq %r12, %r12
movq 0x48(%rsp), %r13
je 0xd4c19
movq %r14, %rdi
movq %r12, %rsi
callq 0xd2a8c
cmpq 0x18(%r14), %rax
jae 0xd4c19
incq 0x18(%rsp)
jmp 0xd4c27
movq %r14, %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0xd2be9
testb $0x2, 0x60(%rsp)
je 0xd4c46
movq 0x60(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x50(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x112485
incq %rbp
cmpq %rbp, 0x20(%rsp)
jne 0xd4ad4
jmp 0xd4ed1
xorl %r12d, %r12d
jmp 0xd4b9c
cmpq $0x0, 0x20(%rsp)
jle 0xd4ec8
movq $0x0, 0x18(%rsp)
leaq 0xd547b(%rip), %rbp     # 0x1aa0f8
xorl %ebx, %ebx
movq %r12, %r15
leaq 0x50(%rsp), %rdi
movq %r13, %rsi
movq 0x28(%rsp), %rdx
movq %rbx, %rcx
callq 0xf83a3
movq 0x58(%rsp), %rax
testq %rax, %rax
je 0xd4ca7
movq 0x8(%rax), %r12
jmp 0xd4caa
xorl %r12d, %r12d
movl (%rbp), %eax
cltq
leaq (%rax,%rax,2), %rax
movq 0x20(%rbp,%rax,8), %rcx
movq 0x18(%rbp,%rax,8), %rdx
andq %r12, %rdx
shlq $0x4, %rdx
leaq (%rcx,%rdx), %rax
movq (%rcx,%rdx), %rdx
movl $0x8, %ecx
cmpq %r12, %rdx
je 0xd4d04
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %r12, %rdx
je 0xd4d04
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %r12, %rdx
je 0xd4d04
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %r12, %rdx
jne 0xd4eb8
movq (%rax,%rcx), %r13
testq %r13, %r13
jne 0xd4d30
movabsq $0x541d0401d4dcff33, %rdi # imm = 0x541D0401D4DCFF33
movq %r12, %rsi
callq 0xf3f85
movq %rax, %r13
movq %rbp, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x12128c
movq 0x50(%rsp), %rsi
movq %r13, %rdi
movq %r15, %r12
movq %r15, %rdx
callq 0x10d7a8
testb %al, %al
je 0xd4e71
movq 0x50(%rsp), %rdx
leaq 0x68(%rsp), %rdi
movq %r13, %rsi
movq %r12, %rcx
callq 0x10d818
movups 0x68(%rsp), %xmm0
movaps %xmm0, 0x30(%rsp)
movq 0x78(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x38(%rsp), %r13
movq 0x8(%r13), %r12
movabsq $0x57ef6ea4efc111b5, %rax # imm = 0x57EF6EA4EFC111B5
cmpq %rax, %r12
je 0xd4e20
leaq 0xd44b9(%rip), %rdx     # 0x1a9250
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 0xd4df0
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %r12, %rdx
je 0xd4df0
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %r12, %rdx
je 0xd4df0
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %r12, %rdx
jne 0xd4ec0
movq (%rax,%rcx), %r13
testq %r13, %r13
jne 0xd4e20
movabsq $0x57ef6ea4efc111b5, %rdi # imm = 0x57EF6EA4EFC111B5
movq %r12, %rsi
callq 0xf3f85
movq %rax, %r13
leaq 0xd443b(%rip), %rdi     # 0x1a9250
movq %r12, %rsi
movq %rax, %rdx
callq 0x12128c
movq 0x30(%rsp), %rsi
movq %r13, %rdi
callq 0x1013a2
movq %rax, %r12
testb $0x2, 0x40(%rsp)
je 0xd4e4f
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x30(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x112485
testq %r12, %r12
movq 0x48(%rsp), %r13
je 0xd4e78
movq %r14, %rdi
movq %r12, %rsi
callq 0xd2a8c
cmpq 0x18(%r14), %rax
jae 0xd4e78
incq 0x18(%rsp)
jmp 0xd4e86
movq 0x48(%rsp), %r13
jmp 0xd4e89
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0xd2be9
movq %r15, %r12
testb $0x2, 0x60(%rsp)
je 0xd4ea8
movq 0x60(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x50(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x112485
incq %rbx
cmpq %rbx, 0x20(%rsp)
jne 0xd4c7f
jmp 0xd4ed1
xorl %r13d, %r13d
jmp 0xd4d08
xorl %r13d, %r13d
jmp 0xd4df4
movq $0x0, 0x18(%rsp)
movq 0x18(%rsp), %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r13d, %r13d
jmp 0xd498e
xorl %ebx, %ebx
jmp 0xd4a5a