// File: /workspace/github_c_makefile_star2_O2/johsteffens[P]beth/lib/bcore/bcore.xo.c
// Function: x_stamp_path_s_set_sr_ret_in_t
sr_s x_stamp_path_s_set_sr_ret_in_t( const x_stamp_path_s* o, tp_t t, x_inst* inst, sr_s sr_src )
{
    // bcore_x_stamp.h:343:1
    BLM_INIT_LEVEL(0);
    sr_s sr0 = sr_twc(t, inst );
    
    sr_s src_hook;BLM_T_INIT_SPUSH(sr_s, &src_hook);;
    src_hook = sr_src;
    sr_s_set_strong(&(sr_src),false );
    
    if( !sr0.o ) BLM_RETURNV(sr_s, sr_null())
    
    if( o->size == 0 && sr_src.o ) bcore_inst_x_copy_typed( sr0, sr_s_type(&(sr_src)), sr_src.o );
    
    const bcore_via_s* p = NULL;
    sz_t index = -1;
    
    bl_t found = true;
    
    for(sz_t i = 0; i < o->size; i++ )
    {
        bcore_via* via = ((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 ) );
            bcore_array* array =((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; }
    
            if( i + 1 == o->size ) bcore_array_p_set( p_array, array, arr_index, sr_src );
    
            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; }
    
            if( i + 1 == o->size ) bcore_via_p_iset( p, via, index, sr_src );
    
            sr1 = bcore_via_p_iget( p, via, index );
        }
        sr_down( sr0 );
        sr0 = sr1;
        if( !sr0.o ) BLM_RETURNV(sr_s, sr_null())
    }
    
    if( !found ) sr_s_clear(&(sr0));
    
    BLM_RETURNV(sr_s, sr0)
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x100(%rsp), %rbp
leaq 0xe8a65(%rip), %rax     # 0x117dd0
movq (%rax), %rsi
leaq 0x80(%rsp), %r13
movq %r13, %rdi
callq 0x717f5
andq $0x0, 0x10(%r13)
movq %r15, 0x20(%rsp)
testq %r12, %r12
je 0x2f397
movq %r12, %rdi
callq 0x8cd25
jmp 0x2f399
xorl %eax, %eax
movq %rax, 0x28(%rsp)
movq $0x1, 0x30(%rsp)
leaq 0xb0(%rsp), %r12
movq %r12, %rdi
callq 0x8d1bc
leaq 0x80(%rsp), %rdi
movabsq $0x79b76918ff0af12a, %rsi # imm = 0x79B76918FF0AF12A
movq %r12, %rdx
callq 0x71998
movups (%rbp), %xmm0
movaps %xmm0, (%r12)
movq 0x10(%rbp), %rax
movq %rax, 0x10(%r12)
andb $-0x3, 0x10(%rbp)
testq %r15, %r15
je 0x2f418
cmpq $0x0, 0x10(%r14)
sete %al
movq (%rbp), %r12
testq %r12, %r12
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x2f489
movq 0x8(%rbp), %rax
testq %rax, %rax
je 0x2f420
movq 0x8(%rax), %r13
jmp 0x2f423
xorps %xmm0, %xmm0
jmp 0x2f68a
xorl %r13d, %r13d
movups 0x20(%rsp), %xmm0
movaps %xmm0, 0x40(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x48(%rsp), %rdi
movq 0x8(%rdi), %rax
movabsq $0x782b96602f424981, %rcx # imm = 0x782B96602F424981
cmpq %rcx, %rax
je 0x2f45a
movq %rax, %rdi
callq 0x36702
movq %rax, %rdi
movq 0x40(%rsp), %rsi
movq %r13, %rdx
movq %r12, %rcx
callq 0x58386
testb $0x2, 0x50(%rsp)
je 0x2f489
movq 0x50(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x40(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x8cdc1
movq %rbx, 0x60(%rsp)
pushq $-0x1
popq %rbp
xorl %ebx, %ebx
xorl %r13d, %r13d
cmpq 0x10(%r14), %rbx
jae 0x2f66a
testq %r13, %r13
je 0x2f4ba
testq %rbp, %rbp
js 0x2f4ba
movq %r13, %rdi
movq %rbp, %rsi
callq 0x2f25a
testq %rax, %rax
jne 0x2f4da
movq 0x28(%rsp), %rax
testq %rax, %rax
je 0x2f4ca
movq 0x8(%rax), %rdi
jmp 0x2f4cc
xorl %edi, %edi
callq 0x2f2a4
testq %rax, %rax
je 0x2f660
movq %rax, %r13
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 0x2f513
movq 0x28(%rsp), %r12
testq %r12, %r12
je 0x2f586
movq 0x8(%r12), %rsi
jmp 0x2f588
movq %r13, %rdi
movq %r15, %rsi
callq 0x8ae97
testq %rax, %rax
js 0x2f660
movq %rax, %rbp
leaq 0x1(%rbx), %rax
cmpq 0x10(%r14), %rax
jne 0x2f55a
leaq 0x100(%rsp), %rcx
movq 0x10(%rcx), %rax
movq %rax, 0x10(%rsp)
movups (%rcx), %xmm0
movups %xmm0, (%rsp)
movq %r13, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x8a611
leaq 0x68(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbp, %rcx
callq 0x8a459
movq 0x78(%rsp), %rax
movq %rax, 0x50(%rsp)
movups 0x68(%rsp), %xmm0
movaps %xmm0, 0x40(%rsp)
jmp 0x2f61b
xorl %esi, %esi
movabsq $-0x196aeddfdbdcdb38, %rdi # imm = 0xE6951220242324C8
callq 0x79a8e
testb %al, %al
je 0x2f660
testq %r12, %r12
je 0x2f5ab
movq 0x8(%r12), %rdi
jmp 0x2f5ad
xorl %edi, %edi
callq 0x2e3db
movq %rax, %r13
movq 0x8(%r14), %rax
movq 0x8(%rax,%rbx,8), %r12
movq %r13, %rdi
movq %r15, %rsi
callq 0x7c954
cmpq %rax, %r12
jae 0x2f660
leaq 0x2(%rbx), %rax
cmpq 0x10(%r14), %rax
jne 0x2f602
leaq 0x100(%rsp), %rcx
movq 0x10(%rcx), %rax
movq %rax, 0x10(%rsp)
movups (%rcx), %xmm0
movups %xmm0, (%rsp)
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x7c988
incq %rbx
leaq 0x40(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x7c97c
xorl %r13d, %r13d
testb $0x2, 0x30(%rsp)
je 0x2f63a
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), %r15
testq %r15, %r15
je 0x2f682
incq %rbx
jmp 0x2f496
leaq 0x20(%rsp), %rdi
callq 0x2f2f4
movq 0x30(%rsp), %rax
movq 0x60(%rsp), %rbx
movq %rax, 0x10(%rbx)
movaps 0x20(%rsp), %xmm0
movups %xmm0, (%rbx)
jmp 0x2f692
xorps %xmm0, %xmm0
movq 0x60(%rsp), %rbx
movups %xmm0, (%rbx)
andq $0x0, 0x10(%rbx)
leaq 0x80(%rsp), %rdi
callq 0x71b64
movq %rbx, %rax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq