// File: /workspace/github_c_makefile_star2_O0/johsteffens[P]beth/xoico/src/xoico.xo.c
// Function: xoico_che_s_trans_builtin_t_scope
er_t xoico_che_s_trans_builtin_t_scope( xoico_che_s* o, x_source* source, const xoico_che_result* result_expr, const xoico_typespec_s* typespec_expr, xoico_che_result* result_out, xoico_typespec_s* typespec_out )
{
    // xoico_che_builtin.x:271:1
    BLM_INIT_LEVEL(0);
    bl_t has_arg = false;
    bl_t closing_bracket = true;
    
    sz_t level = 0;
    
    xoico_che_result_arr_s* result_type_expr = ((xoico_che_result_arr_s*)BLM_LEVEL_T_PUSH(0,xoico_che_result_arr_s,xoico_che_result_arr_s_create()));
    
    if( result_expr ) // member call
    {
        BLM_TRY(x_source_parse_fa(source," ( " ))
        xoico_che_result_a_clear(result_out);
        BLM_TRY(xoico_che_s_trans_expression(o,source,((xoico_che_result*)( result_type_expr)), NULL ))
        has_arg = x_source_parse_bl(source,"#?','" );
    }
    else // direct call
    {
        BLM_TRY(x_source_parse_fa(source,"scope ( " ))
        xoico_che_result_arr_s* result = ((xoico_che_result_arr_s*)BLM_LEVEL_T_PUSH(0,xoico_che_result_arr_s,xoico_che_result_arr_s_create()));
        xoico_typespec_s* typespec = ((xoico_typespec_s*)BLM_LEVEL_T_PUSH(0,xoico_typespec_s,xoico_typespec_s_create()));
        BLM_TRY(xoico_che_s_trans_expression(o,source,((xoico_che_result*)( result)), typespec ))
        typespec_expr = typespec;
        result_expr =((const xoico_che_result*)( result));
    
        BLM_TRY(x_source_parse_fa(source," , " ))
        BLM_TRY(xoico_che_s_trans_expression(o,source,((xoico_che_result*)( result_type_expr)), NULL ))
    
        has_arg = x_source_parse_bl(source,"#?','" );
    }
    
    if( typespec_expr->type == 0 ) BLM_RETURNV(er_t, x_source_parse_error_fa(source,"scope: Expression not tractable." ))
    if( typespec_expr->access_class != TYPEOF_discardable ) BLM_RETURNV(er_t, x_source_parse_error_fa(source,"scope: Expression is not discardable." ))
    xoico_typespec_s* typespec_scope = ((xoico_typespec_s*)BLM_LEVEL_T_PUSH(0,xoico_typespec_s,xoico_typespec_s_clone(typespec_expr)));
    typespec_scope->access_class = TYPEOF_mutable;
    
    BLM_TRY(xoico_che_result_a_push_sc(result_out,"((" ))
    
    if( has_arg )
    {
        BLM_TRY(x_source_parse_fa(source," " ))
        tp_t tp_identifier = xoico_che_s_get_identifier(o,source, true );
    
        if( xoico_che_s_is_var(o,tp_identifier ) )
        {
            level = xoico_che_stack_var_s_get_level(&(o->stack_var),tp_identifier );
        }
        else if( tp_identifier == ((tp_t)(TYPEOF_scope_local)) )
        {
            level = o->block_level;
        }
        else if( tp_identifier == ((tp_t)(TYPEOF_scope_func)) )
        {
            level = 0;
        }
        else
        {
            BLM_RETURNV(er_t, x_source_parse_error_fa(source,"scope: identifier '#<sc_t>' does not represent a variable.", xoico_che_s_nameof(o,tp_identifier ) ))
        }
    }
    
    if( closing_bracket ) BLM_TRY(x_source_parse_fa(source," )" ))
    
    if( typespec_scope->indirection != 1 ) BLM_RETURNV(er_t, x_source_parse_error_fa(source,"scope: Expression's indirection != 1." ))
    if( typespec_scope->flag_scope )       BLM_RETURNV(er_t, x_source_parse_error_fa(source,"scope: Target is already scoped." ))
    
    BLM_TRY(xoico_che_s_push_typespec(o,typespec_scope, result_out ))
    
    BLM_TRY(xoico_che_result_push_fa(result_out,")BLM_LEVEL_TV_PUSH(#<sz_t>,", level ))
    xoico_che_result_a_push_result_c(result_out,((const xoico_che_result*)(result_type_expr )));
    BLM_TRY(xoico_che_result_push_fa(result_out,"," ))
    xoico_che_result_a_push_result_c(result_out,result_expr );
    BLM_TRY(xoico_che_result_a_push_sc(result_out,"))" ))
    
    o->stack_block.adl.data[ level ]->use_blm = true;
    
    if( typespec_out )
    {
        xoico_typespec_s_copy(typespec_out,typespec_scope );
        typespec_out->flag_scope = true;
    }
    
    BLM_RETURNV(er_t, 0)
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1e0, %rsp            # imm = 0x1E0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
leaq 0x180406(%rip), %rax    # 0x1b2330
movq (%rax), %rax
movq %rax, -0x40(%rbp)
leaq -0x70(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0xbfe80
movq -0x78(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq $0x0, 0x10(%rax)
movb $0x0, -0x79(%rbp)
movb $0x1, -0x7a(%rbp)
movq $0x0, -0x88(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x1b8(%rbp)
callq 0x35ee0
movq -0x1b8(%rbp), %rdi
movq %rax, %rcx
xorl %eax, %eax
movl %eax, %esi
movabsq $-0x7850996cdf80346a, %rdx # imm = 0x87AF6693207FCB96
callq 0xc01a0
movq %rax, -0x90(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x32069
movq -0x18(%rbp), %rdi
leaq 0x105a13(%rip), %rsi    # 0x1379ca
movb $0x0, %al
callq 0x4a20
movq %rax, -0x98(%rbp)
cmpq $0x0, -0x98(%rbp)
je 0x31ff6
movq -0x98(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x78(%rbp), %rdi
callq 0xc0720
movq -0xa0(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x326fd
movq -0x30(%rbp), %rdi
callq 0x2f780
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x90(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x27f50
movq %rax, -0xa8(%rbp)
cmpq $0x0, -0xa8(%rbp)
je 0x3204f
movq -0xa8(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x78(%rbp), %rdi
callq 0xc0720
movq -0xb0(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x326fd
movq -0x18(%rbp), %rdi
leaq 0x103613(%rip), %rsi    # 0x13566d
callq 0x6700
andb $0x1, %al
movb %al, -0x79(%rbp)
jmp 0x32233
movq -0x18(%rbp), %rdi
leaq 0x105951(%rip), %rsi    # 0x1379c5
movb $0x0, %al
callq 0x4a20
movq %rax, -0xb8(%rbp)
cmpq $0x0, -0xb8(%rbp)
je 0x320b3
movq -0xb8(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x78(%rbp), %rdi
callq 0xc0720
movq -0xc0(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x326fd
movq -0x40(%rbp), %rax
movq %rax, -0x1c8(%rbp)
callq 0x35ee0
movq -0x1c8(%rbp), %rdi
movq %rax, %rcx
xorl %eax, %eax
movl %eax, %esi
movabsq $-0x7850996cdf80346a, %rdx # imm = 0x87AF6693207FCB96
callq 0xc01a0
movq %rax, -0xc8(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x1c0(%rbp)
callq 0x5d20
movq -0x1c0(%rbp), %rdi
movq %rax, %rcx
xorl %eax, %eax
movl %eax, %esi
movabsq $-0x641110359430e9c5, %rdx # imm = 0x9BEEEFCA6BCF163B
callq 0xc01a0
movq %rax, -0xd0(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0xc8(%rbp), %rdx
movq -0xd0(%rbp), %rcx
callq 0x27f50
movq %rax, -0xd8(%rbp)
cmpq $0x0, -0xd8(%rbp)
je 0x3216e
movq -0xd8(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0x78(%rbp), %rdi
callq 0xc0720
movq -0xe0(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x326fd
movq -0xd0(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x101526(%rip), %rsi    # 0x1336b5
movb $0x0, %al
callq 0x4a20
movq %rax, -0xe8(%rbp)
cmpq $0x0, -0xe8(%rbp)
je 0x321ce
movq -0xe8(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0x78(%rbp), %rdi
callq 0xc0720
movq -0xf0(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x326fd
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x90(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x27f50
movq %rax, -0xf8(%rbp)
cmpq $0x0, -0xf8(%rbp)
je 0x3221e
movq -0xf8(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x78(%rbp), %rdi
callq 0xc0720
movq -0x100(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x326fd
movq -0x18(%rbp), %rdi
leaq 0x103444(%rip), %rsi    # 0x13566d
callq 0x6700
andb $0x1, %al
movb %al, -0x79(%rbp)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x32270
movq -0x18(%rbp), %rdi
leaq 0x105785(%rip), %rsi    # 0x1379ce
movb $0x0, %al
callq 0x4c80
movq %rax, -0x108(%rbp)
movq -0x78(%rbp), %rdi
callq 0xc0720
movq -0x108(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x326fd
movq -0x28(%rbp), %rax
movabsq $-0x12e90733f18038df, %rcx # imm = 0xED16F8CC0E7FC721
cmpq %rcx, 0x10(%rax)
je 0x322b6
movq -0x18(%rbp), %rdi
leaq 0x105760(%rip), %rsi    # 0x1379ef
movb $0x0, %al
callq 0x4c80
movq %rax, -0x110(%rbp)
movq -0x78(%rbp), %rdi
callq 0xc0720
movq -0x110(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x326fd
movq -0x40(%rbp), %rax
movq %rax, -0x1d0(%rbp)
movq -0x28(%rbp), %rdi
callq 0x5d70
movq -0x1d0(%rbp), %rdi
movq %rax, %rcx
xorl %eax, %eax
movl %eax, %esi
movabsq $-0x641110359430e9c5, %rdx # imm = 0x9BEEEFCA6BCF163B
callq 0xc01a0
movq %rax, -0x118(%rbp)
movq -0x118(%rbp), %rax
movabsq $-0x2c53c3baa9910217, %rcx # imm = 0xD3AC3C45566EFDE9
movq %rcx, 0x10(%rax)
movq -0x30(%rbp), %rdi
leaq 0x1055be(%rip), %rsi    # 0x1378cc
callq 0x23300
movq %rax, -0x120(%rbp)
cmpq $0x0, -0x120(%rbp)
je 0x3234b
movq -0x120(%rbp), %rax
movq %rax, -0x128(%rbp)
movq -0x78(%rbp), %rdi
callq 0xc0720
movq -0x128(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x326fd
testb $0x1, -0x79(%rbp)
je 0x3248b
movq -0x18(%rbp), %rdi
leaq 0x11b821(%rip), %rsi    # 0x14db81
movb $0x0, %al
callq 0x4a20
movq %rax, -0x130(%rbp)
cmpq $0x0, -0x130(%rbp)
je 0x3239f
movq -0x130(%rbp), %rax
movq %rax, -0x138(%rbp)
movq -0x78(%rbp), %rdi
callq 0xc0720
movq -0x138(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x326fd
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0x1, %edx
callq 0x23380
movq %rax, -0x140(%rbp)
movq -0x10(%rbp), %rdi
movq -0x140(%rbp), %rsi
callq 0x29aa0
testb $0x1, %al
jne 0x323ce
jmp 0x323ee
movq -0x10(%rbp), %rdi
addq $0x38, %rdi
movq -0x140(%rbp), %rsi
callq 0x33220
movq %rax, -0x88(%rbp)
jmp 0x32489
movabsq $-0x38096408726e4e99, %rax # imm = 0xC7F69BF78D91B167
cmpq %rax, -0x140(%rbp)
jne 0x32412
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x88(%rbp)
jmp 0x32487
movabsq $0x5e9151f1091c19ba, %rax # imm = 0x5E9151F1091C19BA
cmpq %rax, -0x140(%rbp)
jne 0x32432
movq $0x0, -0x88(%rbp)
jmp 0x32485
movq -0x18(%rbp), %rax
movq %rax, -0x1d8(%rbp)
movq -0x10(%rbp), %rdi
movq -0x140(%rbp), %rsi
callq 0x22840
movq -0x1d8(%rbp), %rdi
movq %rax, %rdx
leaq 0x1055b7(%rip), %rsi    # 0x137a15
movb $0x0, %al
callq 0x4c80
movq %rax, -0x148(%rbp)
movq -0x78(%rbp), %rdi
callq 0xc0720
movq -0x148(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x326fd
jmp 0x32487
jmp 0x32489
jmp 0x3248b
testb $0x1, -0x7a(%rbp)
je 0x324dd
movq -0x18(%rbp), %rdi
leaq 0x122eae(%rip), %rsi    # 0x15534a
movb $0x0, %al
callq 0x4a20
movq %rax, -0x150(%rbp)
cmpq $0x0, -0x150(%rbp)
je 0x324db
movq -0x150(%rbp), %rax
movq %rax, -0x158(%rbp)
movq -0x78(%rbp), %rdi
callq 0xc0720
movq -0x158(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x326fd
jmp 0x324dd
movq -0x118(%rbp), %rax
cmpq $0x1, 0x20(%rax)
je 0x3251d
movq -0x18(%rbp), %rdi
leaq 0x10555a(%rip), %rsi    # 0x137a50
movb $0x0, %al
callq 0x4c80
movq %rax, -0x160(%rbp)
movq -0x78(%rbp), %rdi
callq 0xc0720
movq -0x160(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x326fd
movq -0x118(%rbp), %rax
testb $0x1, 0x2d(%rax)
je 0x3255c
movq -0x18(%rbp), %rdi
leaq 0x105541(%rip), %rsi    # 0x137a76
movb $0x0, %al
callq 0x4c80
movq %rax, -0x168(%rbp)
movq -0x78(%rbp), %rdi
callq 0xc0720
movq -0x168(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x326fd
movq -0x10(%rbp), %rdi
movq -0x118(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x22e00
movq %rax, -0x170(%rbp)
cmpq $0x0, -0x170(%rbp)
je 0x325a8
movq -0x170(%rbp), %rax
movq %rax, -0x178(%rbp)
movq -0x78(%rbp), %rdi
callq 0xc0720
movq -0x178(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x326fd
movq -0x30(%rbp), %rdi
movq -0x88(%rbp), %rdx
leaq 0x105585(%rip), %rsi    # 0x137b3f
movb $0x0, %al
callq 0x261b0
movq %rax, -0x180(%rbp)
cmpq $0x0, -0x180(%rbp)
je 0x325f9
movq -0x180(%rbp), %rax
movq %rax, -0x188(%rbp)
movq -0x78(%rbp), %rdi
callq 0xc0720
movq -0x188(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x326fd
movq -0x30(%rbp), %rdi
movq -0x90(%rbp), %rsi
callq 0x24e80
movq -0x30(%rbp), %rdi
leaq 0x101e85(%rip), %rsi    # 0x134499
movb $0x0, %al
callq 0x261b0
movq %rax, -0x190(%rbp)
cmpq $0x0, -0x190(%rbp)
je 0x32653
movq -0x190(%rbp), %rax
movq %rax, -0x198(%rbp)
movq -0x78(%rbp), %rdi
callq 0xc0720
movq -0x198(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x326fd
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x24e80
movq -0x30(%rbp), %rdi
leaq 0x10407b(%rip), %rsi    # 0x1366e6
callq 0x23300
movq %rax, -0x1a0(%rbp)
cmpq $0x0, -0x1a0(%rbp)
je 0x326a5
movq -0x1a0(%rbp), %rax
movq %rax, -0x1a8(%rbp)
movq -0x78(%rbp), %rdi
callq 0xc0720
movq -0x1a8(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x326fd
movq -0x10(%rbp), %rax
movq 0x98(%rax), %rax
movq -0x88(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movb $0x1, 0x10(%rax)
cmpq $0x0, -0x38(%rbp)
je 0x326de
movq -0x38(%rbp), %rdi
movq -0x118(%rbp), %rsi
callq 0x5ce0
movq -0x38(%rbp), %rax
movb $0x1, 0x2d(%rax)
movq $0x0, -0x1b0(%rbp)
movq -0x78(%rbp), %rdi
callq 0xc0720
movq -0x1b0(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x1e0, %rsp            # imm = 0x1E0
popq %rbp
retq
nopw (%rax,%rax)