// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0xd0(%rbp)
movq %rdi, -0xc8(%rbp)
movq %rsi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x30(%rbp), %rdi
callq 0x45340
cmpq $0x0, -0x30(%rbp)
jne 0x4508e
movq -0xd0(%rbp), %rdi
callq 0x8a380
jmp 0x4532b
movq $0x0, -0x38(%rbp)
movq $-0x1, -0x40(%rbp)
movb $0x1, -0x41(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jae 0x452fe
movq -0x30(%rbp), %rax
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x450ec
cmpq $0x0, -0x40(%rbp)
jl 0x450ec
movq -0x38(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x453b0
movq %rax, -0xd8(%rbp)
jmp 0x450f7
xorl %eax, %eax
movq %rax, -0xd8(%rbp)
jmp 0x450f7
movq -0xd8(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x4511e
leaq -0x30(%rbp), %rdi
callq 0x45450
movq %rax, %rdi
callq 0x453e0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x4512e
movb $0x0, -0x41(%rbp)
jmp 0x452fe
leaq -0x70(%rbp), %rdi
callq 0x8a380
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x50(%rbp), %rcx
movabsq $-0x20efc6351cd3a688, %rdx # imm = 0xDF1039CAE32C5978
cmpq %rdx, (%rax,%rcx,8)
jne 0x45232
leaq -0x30(%rbp), %rdi
callq 0x45450
movq %rax, %rsi
movabsq $-0x196aeddfdbdcdb38, %rdi # imm = 0xE6951220242324C8
callq 0xd13b0
testb $0x1, %al
jne 0x4517f
movb $0x0, -0x41(%rbp)
jmp 0x452fe
leaq -0x30(%rbp), %rdi
callq 0x45450
movq %rax, %rdi
callq 0x438f0
movq %rax, -0x78(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x50(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x88(%rbp)
movq -0x78(%rbp), %rdi
movq -0x80(%rbp), %rsi
callq 0x45470
movq %rax, -0x90(%rbp)
movq -0x88(%rbp), %rax
cmpq -0x90(%rbp), %rax
jb 0x451ec
movb $0x0, -0x41(%rbp)
jmp 0x452fe
movq -0x78(%rbp), %rsi
movq -0x80(%rbp), %rdx
movq -0x88(%rbp), %rcx
leaq -0xa8(%rbp), %rdi
callq 0x441b0
movq -0xa8(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0x60(%rbp)
movq $0x0, -0x38(%rbp)
jmp 0x4529c
movq -0x38(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x50(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
callq 0x454a0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jge 0x45263
movb $0x0, -0x41(%rbp)
jmp 0x452fe
movq -0x38(%rbp), %rsi
movq -0x58(%rbp), %rdx
movq -0x40(%rbp), %rcx
leaq -0xc0(%rbp), %rdi
callq 0x454d0
movq -0xc0(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0xb0(%rbp), %rax
movq %rax, -0x60(%rbp)
leaq -0x30(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x45510
movq -0x70(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x452eb
movq -0xd0(%rbp), %rdi
callq 0x8a380
jmp 0x4532b
jmp 0x452ed
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x450aa
testb $0x1, -0x41(%rbp)
jne 0x4530d
leaq -0x30(%rbp), %rdi
callq 0x45560
movq -0xd0(%rbp), %rax
movq -0x30(%rbp), %rcx
movq %rcx, (%rax)
movq -0x28(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0xc8(%rbp), %rax
addq $0xf0, %rsp
popq %rbp
retq
nopl (%rax,%rax)