// File: /workspace/github_c_makefile_star2_O2/johsteffens[P]beth/lib/bcore/bcore.xo.c
// Function: x_stamp_path_s_get_sr_in_t
sr_s x_stamp_path_s_get_sr_in_t( const x_stamp_path_s* o, tp_t t, const x_inst* inst )
{
    // bcore_x_stamp.h:294:1
    
    sr_s sr0 = sr_twc(t, inst );
    if( !sr0.o ) return  sr_null();
    
    const bcore_via_s* p = NULL;
    sz_t index = -1;
    
    bl_t found = true;
    
    for(sz_t i = 0; i < o->size; i++ )
    {
        const bcore_via* via = ((const bcore_via*)(sr0.o));
        p = ( p && index >= 0 ) ? bcore_via_p_iget_via( p, via, index ) : NULL;
        if( !p ) p = bcore_via_s_get_typed( sr_s_type( &sr0 ) );
        if( !p ) { found = false; break; }
        sr_s sr1 = sr_null();
    
        if( o->data[ i ] == TYPEOF_x_stamp_path_s_array_index )
        {
            if( !bcore_spect_trait_supported( TYPEOF_bcore_array, sr_s_type( &sr0 ) ) ) { found = false; break; }
            const bcore_array_s* p_array = bcore_array_s_get_typed( sr_s_type( &sr0 ) );
            const bcore_array* array = ( const bcore_array* )via;
            i++;
            uz_t arr_index = o->data[ i ];
            uz_t arr_size = bcore_array_p_get_size( p_array, array );
            if( arr_index >= arr_size ) { found = false; break; }
            sr1 = bcore_array_p_get( p_array, array, arr_index );
            p = NULL;
        }
        else
        {
            index = bcore_via_p_nget_index( p, via, o->data[ i ] );
            if( index < 0 ) { found = false; break; }
            sr1 = bcore_via_p_iget( p, via, index );
        }
        sr_down( sr0 );
        sr0 = sr1;
        if( !sr0.o ) return  sr_null();
    }
    
    if( !found ) sr_s_clear(&(sr0));
    
    return  sr0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rcx, %r12
movq %rsi, %r14
movq %rdi, %rbx
movq %rcx, 0x20(%rsp)
testq %rdx, %rdx
je 0x2f083
movq %rdx, %rdi
callq 0x8cd25
jmp 0x2f085
xorl %eax, %eax
movq %rax, 0x28(%rsp)
movq $0x1, 0x30(%rsp)
testq %r12, %r12
je 0x2f209
movq %rbx, 0x38(%rsp)
pushq $-0x1
popq %r13
xorl %ebx, %ebx
xorl %ebp, %ebp
cmpq 0x10(%r14), %rbx
jae 0x2f223
testq %rbp, %rbp
je 0x2f0cd
testq %r13, %r13
js 0x2f0cd
movq %rbp, %rdi
movq %r13, %rsi
callq 0x2f25a
testq %rax, %rax
jne 0x2f0ed
movq 0x28(%rsp), %rax
testq %rax, %rax
je 0x2f0dd
movq 0x8(%rax), %rdi
jmp 0x2f0df
xorl %edi, %edi
callq 0x2f2a4
testq %rax, %rax
je 0x2f219
movq %rax, %rbp
andq $0x0, 0x50(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movq 0x8(%r14), %rax
movq (%rax,%rbx,8), %rdx
movabsq $-0x20efc6351cd3a688, %rax # imm = 0xDF1039CAE32C5978
cmpq %rax, %rdx
jne 0x2f125
movq 0x28(%rsp), %r15
testq %r15, %r15
je 0x2f165
movq 0x8(%r15), %rsi
jmp 0x2f167
movq %rbp, %rdi
movq %r12, %rsi
callq 0x8ae97
testq %rax, %rax
js 0x2f219
movq %rax, %r13
leaq 0x60(%rsp), %rdi
movq %rbp, %rsi
movq %r12, %rdx
movq %rax, %rcx
callq 0x8a459
movq 0x70(%rsp), %rax
movq %rax, 0x50(%rsp)
movups 0x60(%rsp), %xmm0
movaps %xmm0, 0x40(%rsp)
jmp 0x2f1c4
xorl %esi, %esi
movabsq $-0x196aeddfdbdcdb38, %rdi # imm = 0xE6951220242324C8
callq 0x79a8e
testb %al, %al
je 0x2f219
testq %r15, %r15
je 0x2f189
movq 0x8(%r15), %rdi
jmp 0x2f18b
xorl %edi, %edi
callq 0x2e3db
movq %rax, %rbp
movq 0x8(%r14), %rax
movq 0x8(%rax,%rbx,8), %r15
movq %rbp, %rdi
movq %r12, %rsi
callq 0x7c954
cmpq %rax, %r15
jae 0x2f219
incq %rbx
leaq 0x40(%rsp), %rdi
movq %rbp, %rsi
movq %r12, %rdx
movq %r15, %rcx
callq 0x7c97c
xorl %ebp, %ebp
testb $0x2, 0x30(%rsp)
je 0x2f1e3
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x20(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x8cdc1
movaps 0x40(%rsp), %xmm0
movaps %xmm0, 0x20(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x20(%rsp), %r12
testq %r12, %r12
je 0x2f23b
incq %rbx
jmp 0x2f0a9
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
andq $0x0, 0x10(%rbx)
movq %rbx, %rax
jmp 0x2f24b
leaq 0x20(%rsp), %rdi
callq 0x2f2f4
movq 0x30(%rsp), %rcx
movq 0x38(%rsp), %rax
movq %rcx, 0x10(%rax)
movaps 0x20(%rsp), %xmm0
movups %xmm0, (%rax)
jmp 0x2f24b
xorps %xmm0, %xmm0
movq 0x38(%rsp), %rax
movups %xmm0, (%rax)
andq $0x0, 0x10(%rax)
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq