// File: /workspace/github_c_makefile_star2_O0/johsteffens[P]beth/lib/bcore/bcore_spect_array.c
// Function: bcore_array_default_create_sorted_order_f
bcore_arr_uz_s* bcore_array_default_create_sorted_order_f( const bcore_array_s* p, const bcore_array* o, uz_t start, uz_t end, bcore_cmp_f cmp, s2_t direction )
{
    bcore_arr_uz_s* order = bcore_arr_uz_s_create();
    uz_t size = get_size( p, o );
    uz_t end_l = end < size ? end : size;
    if( start >= end_l ) return order;
    uz_t range = end_l - start;

    bcore_arr_uz_s_step_fill( order, 0, 1, range );

    if( bcore_array_p_is_of_links( p ) )
    {
        vc_t* data = ( vc_t* )bcore_array_p_get_c_data( p, o ) + start;
        uz_t* buf = bcore_un_alloc( sizeof( uz_t ), NULL, 0, range >> 1, NULL );
        buf_order_sort( data, order->data, range, buf, cmp, direction );
        bcore_un_alloc( sizeof( uz_t ), buf, range >> 1, 0, NULL );
    }
    else
    {
        const bcore_inst_s* item_p = bcore_array_p_is_mutable_mono_typed( p ) ? bcore_inst_s_get_typed( bcore_array_p_get_mono_type( p, o ) ) : p->item_p;
        uz_t unit_size = item_p->size;
        vc_t src = ( u0_t* )bcore_array_p_get_c_data( p, o ) + start * unit_size;
        vc_t* data = bcore_un_alloc( sizeof( vc_t ), NULL, 0, range, NULL );
        for( uz_t i = 0; i < range; i++ ) data[ i ] = ( u0_t* )src + i * unit_size;

        uz_t* buf = bcore_un_alloc( sizeof( uz_t ), NULL, 0, range >> 1, NULL );
        buf_order_sort( data, order->data, range, buf, cmp, direction );
        bcore_un_alloc( sizeof( uz_t ), buf,  range >> 1, 0, NULL );
        bcore_un_alloc( sizeof( vc_t ), data, range,      0, NULL );
    }

    for( uz_t i = 0; i < order->size; i++ ) order->data[ i ] += start;

    return order;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movl 0x10(%rbp), %eax
movq %r8, -0x18(%rbp)
movq %r9, -0x10(%rbp)
movq %rdi, -0x20(%rbp)
movq %rsi, -0x28(%rbp)
movq %rdx, -0x30(%rbp)
movq %rcx, -0x38(%rbp)
movb $0x0, %al
callq 0x8d8a0
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0xd5cd0
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x48(%rbp), %rax
jae 0xd9799
movq -0x38(%rbp), %rax
movq %rax, -0xa8(%rbp)
jmp 0xd97a4
movq -0x48(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x50(%rbp), %rax
jb 0xd97c6
movq -0x40(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xd9a40
movq -0x50(%rbp), %rax
subq -0x30(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x40(%rbp), %rdi
movq -0x58(%rbp), %rcx
xorl %eax, %eax
movl %eax, %esi
movl $0x1, %edx
callq 0x8db20
movq -0x20(%rbp), %rdi
callq 0xd88b0
testb $0x1, %al
jne 0xd97fa
jmp 0xd987f
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0xd7670
movq -0x30(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rcx
shrq %rcx
movl $0x8, %edi
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rsi
movq %r8, %rdx
callq 0x9d370
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x58(%rbp), %rdx
movq -0x68(%rbp), %rcx
movl 0x10(%rbp), %eax
movq -0x18(%rbp), %r8
movq -0x10(%rbp), %r9
movl %eax, (%rsp)
callq 0xd9a50
movq -0x68(%rbp), %rsi
movq -0x58(%rbp), %rdx
shrq %rdx
movl $0x8, %edi
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rcx
callq 0x9d370
jmp 0xd99ed
movq -0x20(%rbp), %rdi
callq 0xd81d0
testb $0x1, %al
jne 0xd988e
jmp 0xd98ac
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0xd8410
movq %rax, %rdi
callq 0xd46d0
movq %rax, -0xb0(%rbp)
jmp 0xd98bb
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0xd7670
movq -0x30(%rbp), %rcx
imulq -0x78(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x80(%rbp)
movq -0x58(%rbp), %rcx
movl $0x8, %edi
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rsi
movq %r8, %rdx
callq 0x9d370
movq %rax, -0x88(%rbp)
movq $0x0, -0x90(%rbp)
movq -0x90(%rbp), %rax
cmpq -0x58(%rbp), %rax
jae 0xd9960
movq -0x80(%rbp), %rdx
movq -0x90(%rbp), %rax
imulq -0x78(%rbp), %rax
addq %rax, %rdx
movq -0x88(%rbp), %rax
movq -0x90(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x90(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x90(%rbp)
jmp 0xd991a
movq -0x58(%rbp), %rcx
shrq %rcx
movl $0x8, %edi
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rsi
movq %r8, %rdx
callq 0x9d370
movq %rax, -0x98(%rbp)
movq -0x88(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x58(%rbp), %rdx
movq -0x98(%rbp), %rcx
movl 0x10(%rbp), %eax
movq -0x18(%rbp), %r8
movq -0x10(%rbp), %r9
movl %eax, (%rsp)
callq 0xd9a50
movq -0x98(%rbp), %rsi
movq -0x58(%rbp), %rdx
shrq %rdx
movl $0x8, %edi
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rcx
callq 0x9d370
movq -0x88(%rbp), %rsi
movq -0x58(%rbp), %rdx
movl $0x8, %edi
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rcx
callq 0x9d370
movq $0x0, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
movq -0x40(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jae 0xd9a38
movq -0x30(%rbp), %rdx
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movq -0xa0(%rbp), %rcx
addq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movq -0xa0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa0(%rbp)
jmp 0xd99f8
movq -0x40(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xc0, %rsp
popq %rbp
retq
nopl (%rax)