// File: /workspace/github_c_makefile_star2_O1/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 $0x68, %rsp
movq %rcx, %r12
movq %rsi, 0x58(%rsp)
movq %rdi, %r14
testq %rdx, %rdx
je 0x5cf61
movq %rdx, %rdi
callq 0x1123e1
movq %rax, %rsi
jmp 0x5cf63
xorl %esi, %esi
testq %r12, %r12
je 0x5d341
movq 0x58(%rsp), %rax
cmpq $0x0, 0x10(%rax)
je 0x5d352
movl $0x1, %eax
movq %rax, 0x48(%rsp)
movb $0x1, %al
movq %rax, 0x18(%rsp)
movq $-0x1, %r8
xorl %ebx, %ebx
xorl %r15d, %r15d
movq %r14, 0x60(%rsp)
testq %rbx, %rbx
je 0x5cff2
movl $0x0, %eax
testq %r8, %r8
js 0x5cff4
movq 0x20(%rbx), %r9
cmpq %r8, %r9
ja 0x5cfe3
leaq 0xed336(%rip), %rdi     # 0x14a2f3
movq %rsi, %r13
leaq 0xed2f9(%rip), %rsi     # 0x14a2c0
movl $0x5c, %edx
leaq 0xed301(%rip), %rcx     # 0x14a2d4
movq %r8, %rbp
xorl %eax, %eax
callq 0xc80f6
movq %rbp, %r8
movq %r13, %rsi
movq 0x30(%rbx), %rax
imulq $0x38, %r8, %rcx
movq 0x20(%rax,%rcx), %rax
jmp 0x5cff4
xorl %eax, %eax
movq %rax, %rbx
testq %rax, %rax
jne 0x5d0ba
testq %rsi, %rsi
je 0x5d00b
movq 0x8(%rsi), %r13
jmp 0x5d00e
xorl %r13d, %r13d
leaq 0x14d0e3(%rip), %rdx    # 0x1aa0f8
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 0x5d06e
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %r13, %rdx
je 0x5d06e
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %r13, %rdx
je 0x5d06e
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %r13, %rdx
jne 0x5d332
movq (%rax,%rcx), %rbx
testq %rbx, %rbx
jne 0x5d0ba
movabsq $0x541d0401d4dcff33, %rdi # imm = 0x541D0401D4DCFF33
movq %rsi, 0x40(%rsp)
movq %r13, %rsi
movq %r12, %rbp
movq %r14, %r12
movq %r8, %r14
callq 0xf3f85
movq %rax, %rbx
leaq 0x14d057(%rip), %rdi    # 0x1aa0f8
movq %r13, %rsi
movq %rax, %rdx
callq 0x12128c
movq %r14, %r8
movq %r12, %r14
movq %rbp, %r12
movq 0x40(%rsp), %rsi
movl $0x2, %ebp
testq %rbx, %rbx
je 0x5d0f3
movq 0x58(%rsp), %rax
movq 0x8(%rax), %rax
movq (%rax,%r15,8), %rdx
movabsq $-0x20efc6351cd3a688, %rax # imm = 0xDF1039CAE32C5978
cmpq %rax, %rdx
jne 0x5d103
testq %rsi, %rsi
movq %r8, 0x20(%rsp)
je 0x5d14d
movq %rsi, %r13
movq 0x8(%rsi), %rsi
jmp 0x5d152
movq $0x0, 0x18(%rsp)
xorl %ebx, %ebx
jmp 0x5d31a
movq %rsi, %r13
movq %rbx, %rdi
movq %r12, %rsi
callq 0x10d7e8
movq %rax, %r8
testq %rax, %rax
js 0x5d184
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
movq %r12, 0x50(%rsp)
movq %r12, %rdx
movq %r8, 0x20(%rsp)
movq %r8, %rcx
callq 0x10ca2c
movq 0x28(%rsp), %r12
movq 0x30(%rsp), %rcx
movq 0x38(%rsp), %rdx
movq %r13, %rsi
jmp 0x5d2aa
movq %rsi, %r13
xorl %esi, %esi
movabsq $-0x196aeddfdbdcdb38, %rdi # imm = 0xE6951220242324C8
callq 0xf3e2a
testb %al, %al
je 0x5d173
movq %r13, %rsi
testq %r13, %r13
je 0x5d195
movq 0x8(%rsi), %r13
jmp 0x5d198
movq $0x0, 0x18(%rsp)
movq %r13, %rsi
jmp 0x5d315
movq $0x0, 0x18(%rsp)
movq %r13, %rsi
jmp 0x5d31a
xorl %r13d, %r13d
movq %r12, 0x50(%rsp)
leaq 0x14bc7c(%rip), %rdx    # 0x1a8e20
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
movq %rsi, 0x40(%rsp)
je 0x5d202
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %r13, %rdx
je 0x5d202
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %r13, %rdx
je 0x5d202
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %r13, %rdx
jne 0x5d339
movq (%rax,%rcx), %r12
testq %r12, %r12
jne 0x5d232
movabsq $-0x5073d588c3beb52e, %rdi # imm = 0xAF8C2A773C414AD2
movq %r13, %rsi
callq 0xf3f85
movq %rax, %r12
leaq 0x14bbf9(%rip), %rdi    # 0x1a8e20
movq %r13, %rsi
movq %rax, %rdx
callq 0x12128c
movq 0x58(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax,%r15,8), %r13
movq %r12, %rdi
movq 0x50(%rsp), %r14
movq %r14, %rsi
callq 0xf837b
xorl %ebp, %ebp
cmpq %rax, %r13
jae 0x5d283
leaq 0x28(%rsp), %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %r13, %rcx
movq %rax, %rbx
callq 0xf83a3
movq %rbx, %rax
movq 0x28(%rsp), %r12
movq 0x30(%rsp), %rcx
movq 0x38(%rsp), %rdx
xorl %ebx, %ebx
jmp 0x5d298
movl $0x2, %ebp
xorl %r12d, %r12d
xorl %ecx, %ecx
xorl %edx, %edx
movq $0x0, 0x18(%rsp)
movq 0x40(%rsp), %rsi
incq %r15
cmpq %rax, %r13
movq 0x60(%rsp), %r14
jae 0x5d310
movq 0x50(%rsp), %rax
movq %rax, 0x28(%rsp)
movq %rsi, 0x30(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x38(%rsp)
testb $0x2, %al
je 0x5d2eb
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %rcx, %r13
movq %rdx, %rbp
callq 0x112485
movq %rbp, %rdx
movq %r13, %rcx
xorl %ebp, %ebp
testq %r12, %r12
jne 0x5d306
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movq $0x0, 0x10(%r14)
movl $0x1, %ebp
movq %rcx, %rsi
movq %rdx, 0x48(%rsp)
jmp 0x5d315
movq 0x50(%rsp), %r12
movq 0x20(%rsp), %r8
testl %ebp, %ebp
jne 0x5d362
incq %r15
movq 0x58(%rsp), %rax
cmpq 0x10(%rax), %r15
jb 0x5cf9e
jmp 0x5d35d
xorl %ebx, %ebx
jmp 0x5d072
xorl %r12d, %r12d
jmp 0x5d206
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movq $0x0, 0x10(%r14)
jmp 0x5d3b9
movb $0x1, %dl
movl $0x1, %ecx
movb $0x1, %al
jmp 0x5d372
movl $0x2, %ebp
cmpl $0x2, %ebp
sete %al
movq 0x48(%rsp), %rcx
movq 0x18(%rsp), %rdx
testb %al, %al
je 0x5d3b9
testb $0x1, %dl
jne 0x5d3ae
movq %r12, 0x28(%rsp)
movq %rsi, 0x30(%rsp)
movq %rcx, 0x38(%rsp)
testb $0x2, %cl
je 0x5d3a7
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x112485
xorl %r12d, %r12d
xorl %esi, %esi
xorl %ecx, %ecx
movq %r12, (%r14)
movq %rsi, 0x8(%r14)
movq %rcx, 0x10(%r14)
movq %r14, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq