// File: /workspace/github_c_makefile_star2_O2/johsteffens[P]beth/lib/bcore/bcore_spect_compare.c
// Function: compare_generic
static s2_t compare_generic( const bcore_compare_s* p, vc_t obj1, vc_t obj2 )
{
    if( obj1 == obj2 ) return  0;
    if( obj1 == NULL ) return  1;
    if( obj2 == NULL ) return -1;
    if( bcore_via_p_is_leaf( p->via, NULL ) || p->o_type == TYPEOF_st_s )
    {
        return compare_leaf_or_string( p->o_type, obj1, obj2 );
    }

    if( bcore_via_p_is_pure_array( p->via, NULL ) )
    {
        const bcore_array_s* arr_p = bcore_array_s_get_typed( p->via->header.o_type );
        uz_t size1 = bcore_array_p_get_size( arr_p, obj1 );
        uz_t size2 = bcore_array_p_get_size( arr_p, obj2 );
        if( size1 != size2 ) return size1 < size2 ? 1 : -1;
        for( uz_t j = 0; j < size1; j++ )
        {
            s2_t c = bcore_compare_sr( arr_p->get( arr_p, obj1, j ), arr_p->get( arr_p, obj2, j ) );
            if( c != 0 ) return c;
        }
        return 0;
    }

    const bcore_via_s* via = p->via;
    for( uz_t i = 0; i < via->size; i++ )
    {
        s2_t c = bcore_compare_sr( bcore_via_p_iget( via, obj1, i ), bcore_via_p_iget( via, obj2, i ) );
        if( c != 0 ) return c;
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
cmpq %rdx, %rsi
je 0x819d7
movq %rsi, %r14
testq %rsi, %rsi
je 0x818ab
movq %rdx, %rbx
testq %rdx, %rdx
je 0x818af
movq %rdi, %r15
movq 0x10(%rdi), %rdi
xorl %esi, %esi
callq 0x8b18c
movq 0x8(%r15), %rdi
testb %al, %al
jne 0x8188f
movabsq $-0x503db0e6e1c2e704, %rax # imm = 0xAFC24F191E3D18FC
cmpq %rax, %rdi
movq %rax, %rdi
jne 0x818b7
movq %r14, %rsi
movq %rbx, %rdx
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8216d
pushq $0x1
jmp 0x818b1
pushq $-0x1
popq %rax
jmp 0x819d9
movq 0x10(%r15), %rdi
xorl %esi, %esi
callq 0x8b194
movq 0x10(%r15), %r15
testb %al, %al
je 0x8196d
movq 0x8(%r15), %rdi
callq 0x823e9
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
callq 0x7c954
movq %rax, %r12
movq %r15, %rdi
movq %rbx, %rsi
callq 0x7c954
cmpq %rax, %r12
jne 0x819eb
xorl %r13d, %r13d
leaq 0x68(%rsp), %rbp
cmpq %r13, %r12
je 0x819d7
leaq 0x80(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %r13, %rcx
callq *0x30(%r15)
movq %rbp, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movq %r13, %rcx
callq *0x30(%r15)
movq 0x78(%rsp), %rax
movq %rax, 0x28(%rsp)
movups 0x68(%rsp), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x90(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x80(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x80fa8
incq %r13
testl %eax, %eax
je 0x81904
jmp 0x819d9
xorl %r12d, %r12d
leaq 0x50(%rsp), %r13
leaq 0x38(%rsp), %rbp
cmpq 0x20(%r15), %r12
jae 0x819d7
movq %r13, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %r12, %rcx
callq 0x8a459
movq %rbp, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x8a459
movq 0x48(%rsp), %rax
movq %rax, 0x28(%rsp)
movups 0x38(%rsp), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x50(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x80fa8
incq %r12
testl %eax, %eax
je 0x8197a
jmp 0x819d9
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rcx
xorl %eax, %eax
cmpq %rcx, %r12
adcl $-0x1, %eax
orl $0x1, %eax
jmp 0x819d9