// File: /workspace/github_c_makefile_star2_O1/johsteffens[P]beth/xoico/src/xoico.xo.c
// Function: xoico_che_s_trans_typespec_array_subscript
er_t xoico_che_s_trans_typespec_array_subscript( xoico_che_s* o, x_source* source, xoico_che_result* result, const xoico_typespec_s* in_typespec, xoico_typespec_s* out_typespec )
{
    // xoico_che_trans_typespec.x:283:1
    BLM_INIT_LEVEL(0);
    BLM_TRY(x_source_parse_fa(source,"[" ))
    
    BLM_TRY(xoico_che_result_a_push_sc(result,"[" ))
    BLM_TRY(xoico_che_s_trans_expression(o,source, result, NULL ))
    BLM_TRY(x_source_parse_fa(source,"]" ))
    BLM_TRY(xoico_che_result_a_push_sc(result,"]" ))
    
    xoico_typespec_s* typespec = ((xoico_typespec_s*)BLM_LEVEL_T_PUSH(0,xoico_typespec_s,xoico_typespec_s_clone(in_typespec)));
    
    if( typespec->indirection == 0 )
    {
        if( in_typespec->type == ((tp_t)(TYPEOF_sc_t)) || in_typespec->type == ((tp_t)(TYPEOF_sd_t)) )
        {
            typespec->type = ((tp_t)(TYPEOF_u0_t));
        }
        else
        {
            BLM_RETURNV(er_t, x_source_parse_error_fa(source,"Array subscript requires indirection >= 1." ))
        }
    }
    else
    {
        typespec->indirection--;
    }
    
    BLM_TRY(xoico_che_s_trans_typespec_expression(o,source, result, typespec, out_typespec ))
    
    BLM_RETURNV(er_t, 0)
}

er_t xoico_che_s_trans_typespec_create( xoico_che_s* o, x_source* source, xoico_che_result* result, const xoico_typespec_s* in_typespec, xoico_typespec_s* out_typespec )
{
    // xoico_che_trans_typespec.x:324:1
    BLM_INIT_LEVEL(0);
    BLM_TRY(x_source_parse_fa(source,"!" ))
    
    //ignore in case indirection is 0;
    if( in_typespec->indirection > 0 )
    {
        if( !( in_typespec->indirection == 1 && in_typespec->flag_addressable ) )
        {
            BLM_RETURNV(er_t, x_source_parse_error_fa(source,"Create-Operator requires lvalue with addressable indirection of 1." ))
        }
    
        if( xoico_che_s_is_group( o,in_typespec->type ) )
        {
            BLM_RETURNV(er_t, x_source_parse_error_fa(source,"Create-Operator: lvalue is a group." ))
        }
    
        xoico_che_result* result_arg_obj = ((xoico_che_result*)BLM_LEVEL_A_PUSH(0,xoico_che_result_a_clone(result)));
        xoico_che_result_a_clear(result);
    
        sc_t sc_type = xoico_che_s_nameof(o,in_typespec->type );
        BLM_TRY(xoico_che_result_push_fa(result,"BCORE_PASS_CREATE(#<sc_t>,", sc_type ))
        xoico_che_result_a_push_result_d(result,((xoico_che_result*)bcore_fork(result_arg_obj)) );
        BLM_TRY(xoico_che_result_a_push_sc(result,")" ))
    }
    
    BLM_TRY(xoico_che_s_trans_typespec_expression(o,source, result, in_typespec, out_typespec ))
    BLM_RETURNV(er_t, 0)
}

er_t xoico_che_s_trans_typespec_test_presence( xoico_che_s* o, x_source* source, xoico_che_result* result, const xoico_typespec_s* in_typespec, xoico_typespec_s* out_typespec )
{
    // xoico_che_trans_typespec.x:363:1
    BLM_INIT_LEVEL(0);
    BLM_TRY(x_source_parse_fa(source,"?" ))
    
    //ignore in case indirection is 0;
    if( in_typespec->indirection > 0 )
    {
        if( in_typespec->indirection != 1 )
        {
            BLM_RETURNV(er_t, x_source_parse_error_fa(source,"Test-Operator requires lvalue with indirection of 1." ))
        }
    
        xoico_che_result* result_arg_obj = ((xoico_che_result*)BLM_LEVEL_A_PUSH(0,xoico_che_result_a_clone(result)));
        xoico_che_result_a_clear(result);
    
        sc_t sc_type = xoico_che_s_nameof(o,in_typespec->type );
        BLM_TRY(xoico_che_result_push_fa(result,"BCORE_PASS_TEST(#<sc_t>,", sc_type ))
        xoico_che_result_a_push_result_d(result,((xoico_che_result*)bcore_fork(result_arg_obj)) );
        BLM_TRY(xoico_che_result_a_push_sc(result,")" ))
    }
    
    BLM_TRY(xoico_che_s_trans_typespec_expression(o,source, result, in_typespec, out_typespec ))
    BLM_RETURNV(er_t, 0)
}

er_t xoico_che_s_trans_typespec_attach( xoico_che_s* o, x_source* source, xoico_che_result* result, const xoico_typespec_s* in_typespec, xoico_typespec_s* out_typespec )
{
    // xoico_che_trans_typespec.x:397:1
    BLM_INIT_LEVEL(0);
    if( in_typespec->indirection != 1 )
    {
        BLM_RETURNV(er_t, x_source_parse_error_fa(source,"Attach-Operator: lvalue with indirection of 1 expected." ))
    }
    
    if( !in_typespec->flag_addressable )
    {
        BLM_RETURNV(er_t, x_source_parse_error_fa(source,"Attach-Operator: Addressable lvalue expected." ))
    }
    
    BLM_TRY(x_source_parse_fa(source,"=<" ))
    
    xoico_che_result* result_arg_obj = ((xoico_che_result*)BLM_LEVEL_A_PUSH(0,xoico_che_result_a_clone(result)));
    xoico_che_result_a_clear(result);
    
    sc_t sc_type = xoico_che_s_nameof(o,in_typespec->type );
    BLM_TRY(xoico_che_result_push_fa(result,"#<sc_t>", sc_type ))
    
    xoico_typespec_s* typespec_rval = ((xoico_typespec_s*)BLM_LEVEL_T_PUSH(0,xoico_typespec_s,xoico_typespec_s_create()));
    if( xoico_che_s_is_group(o,in_typespec->type ) )
    {
        BLM_TRY(xoico_che_result_a_push_sc(result,"_a" ))
        BLM_TRY(xoico_che_result_a_push_sc(result,"_attach( &(" ))
        xoico_che_result_a_push_result_d(result,((xoico_che_result*)bcore_fork(result_arg_obj)) );
        BLM_TRY(xoico_che_result_push_fa(result,"), (#<sc_t>*)", sc_type ))
        BLM_TRY(xoico_che_result_a_push_sc(result,"(" ))
        BLM_TRY(xoico_che_s_trans_expression(o,source, result, typespec_rval ))
        BLM_TRY(xoico_che_result_a_push_sc(result,"))" ))
    }
    else
    {
        BLM_TRY(xoico_che_result_a_push_sc(result,"_attach( &(" ))
        xoico_che_result_a_push_result_d(result,((xoico_che_result*)bcore_fork(result_arg_obj)) );
        BLM_TRY(xoico_che_result_a_push_sc(result,"), " ))
        BLM_TRY(xoico_che_s_trans_expression(o,source, result, typespec_rval ))
        BLM_TRY(xoico_che_result_a_push_sc(result,")" ))
    }
    
    if( typespec_rval->type )
    {
        if( typespec_rval->indirection != 1 )
        {
            BLM_RETURNV(er_t, x_source_parse_error_fa(source,"Attach operator: rvalue with indirection '1' expected." ))
        }
    
        if( typespec_rval->access_class != TYPEOF_discardable )
        {
            BLM_RETURNV(er_t, x_source_parse_error_fa(source,"Attach operator: Discardable rvalue expected." ))
        }
    }
    
    if( out_typespec ) xoico_typespec_s_copy(out_typespec,in_typespec );
    BLM_RETURNV(er_t, 0)
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, %rbp
movq %rcx, %r15
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %r13
leaq 0x162fda(%rip), %rax    # 0x1a8dd0
movq (%rax), %rsi
leaq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0xe0431
movq $0x0, 0x10(%rbx)
leaq 0xf63cd(%rip), %rsi     # 0x13c1e2
movq %r12, %rdi
xorl %eax, %eax
callq 0xda10
movq %rax, %rbx
testq %rax, %rax
je 0x45e36
leaq 0x18(%rsp), %rdi
callq 0xe0b30
jmp 0x45f9b
movq %rbx, (%rsp)
movq %r15, 0x8(%rsp)
movq %r13, 0x10(%rsp)
movq %rbp, %r13
movq (%r14), %rbx
leaq 0x15c65f(%rip), %rax    # 0x1a24b0
movl 0x15c659(%rip), %ecx    # 0x1a24b0
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %rcx
movq 0x20(%rax,%rcx,8), %rdx
movq 0x18(%rax,%rcx,8), %rcx
andq %rbx, %rcx
shlq $0x4, %rcx
leaq (%rdx,%rcx), %rax
movq (%rdx,%rcx), %rdx
movl $0x8, %ecx
cmpq %rbx, %rdx
je 0x45eaf
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %rbx, %rdx
je 0x45eaf
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %rbx, %rdx
je 0x45eaf
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %rbx, %rdx
jne 0x45fad
movq (%rax,%rcx), %rbp
testq %rbp, %rbp
jne 0x45edf
movabsq $-0x3dfc7e0a250a30dc, %rdi # imm = 0xC20381F5DAF5CF24
movq %rbx, %rsi
callq 0xf3f85
movq %rax, %rbp
leaq 0x15c5dc(%rip), %rdi    # 0x1a24b0
movq %rbx, %rsi
movq %rax, %rdx
callq 0x12128c
leaq 0xf62fc(%rip), %rsi     # 0x13c1e2
movq %r14, %r15
movq %r14, %rdi
callq *0x20(%rbp)
movq %rax, %rbx
testq %rax, %rax
je 0x45f05
leaq 0x18(%rsp), %rdi
callq 0xe0b30
movq %rbx, (%rsp)
testq %rbx, %rbx
jne 0x45f97
movq %r13, %rbp
movq 0x10(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x3dbae
movq %rax, %rbx
testq %rax, %rax
je 0x45f3c
leaq 0x18(%rsp), %rdi
callq 0xe0b30
movq %rbx, (%rsp)
testq %rbx, %rbx
jne 0x45f97
leaq 0xfce57(%rip), %rsi     # 0x142d9f
movq %r12, %rdi
xorl %eax, %eax
callq 0xda10
movq %rax, %rbx
testq %rax, %rax
je 0x45f68
leaq 0x18(%rsp), %rdi
callq 0xe0b30
movq %rbx, (%rsp)
testq %rbx, %rbx
jne 0x45f97
leaq 0xfce2b(%rip), %rsi     # 0x142d9f
movq %r15, %rdi
callq 0x34bcc
movq %rax, %rbx
testq %rax, %rax
je 0x45f92
leaq 0x18(%rsp), %rdi
callq 0xe0b30
movq %rbx, (%rsp)
testq %rbx, %rbx
je 0x45fb4
movq (%rsp), %rbx
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
jmp 0x45eb3
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x101d1
leaq 0x18(%rsp), %rdi
movabsq $-0x641110359430e9c5, %rdx # imm = 0x9BEEEFCA6BCF163B
xorl %esi, %esi
movq %rax, %rcx
callq 0xe0676
movq 0x20(%rax), %rcx
testq %rcx, %rcx
je 0x45fec
decq %rcx
movq %rcx, 0x20(%rax)
jmp 0x4601c
movq 0x8(%rbx), %rcx
movabsq $0x230abe18cdeefc99, %rdx # imm = 0x230ABE18CDEEFC99
cmpq %rdx, %rcx
je 0x4600e
movabsq $-0x84b14e74a9e1ff0, %rdx # imm = 0xF7B4EB18B561E010
cmpq %rdx, %rcx
jne 0x4605a
movabsq $-0x73f6ae1ad309fd45, %rcx # imm = 0x8C0951E52CF602BB
movq %rcx, 0x8(%rax)
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %rax, %rcx
movq %rbp, %r8
callq 0x3cec1
movq %rax, %rbx
testq %rax, %rax
je 0x46046
leaq 0x18(%rsp), %rdi
callq 0xe0b30
movq %rbx, (%rsp)
testq %rbx, %rbx
movq (%rsp), %rbx
jne 0x45f9b
xorl %ebx, %ebx
jmp 0x45e27
leaq 0xf6271(%rip), %rsi     # 0x13c2d2
movq %r12, %rdi
xorl %eax, %eax
callq 0xddb2
movq %rax, %rbx
jmp 0x45e27