// File: /workspace/github_c_makefile_star2_O2/johsteffens[P]beth/xoico/src/xoico.xo.c
// Function: xoico_che_s_trans_control_return
er_t xoico_che_s_trans_control_return( xoico_che_s* o, tp_t tp_control, x_source* source, xoico_che_result* result )
{
    // xoico_che_control.x:397:1
    BLM_INIT_LEVEL(0);
    o->has_completion = true;
    
    if( tp_control == TYPEOF_return ) BLM_TRY(x_source_parse_fa(source,"return" ))
    if( tp_control == TYPEOF_completion ) BLM_TRY(x_source_parse_fa(source,"=" ))
    
    xoico_che_result_arr_s* result_expr = ((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_expr = ((xoico_typespec_s*)BLM_LEVEL_T_PUSH(0,xoico_typespec_s,xoico_typespec_s_create() ));
    const xoico_typespec_s* typespec_ret =&( o->signature->typespec_ret);
    
    BLM_TRY(xoico_che_s_trans_expression(o,source,((xoico_che_result*)( result_expr)), typespec_expr ))
    
    if( typespec_expr->type )
    {
        if( !xoico_che_s_returns_a_value(o) )
        {
            BLM_RETURNV(er_t, x_source_parse_error_fa(source,"Function does not return a value." ))
        }
    }
    
    BLM_TRY(xoico_che_s_trans_whitespace(o,source,((xoico_che_result*)( result_expr ))))
    
    if( !x_source_parse_bl(source,"#?';'" ) ) BLM_RETURNV(er_t, x_source_parse_error_fa(source,"Missing ';' after completion statement." ))
    
    xoico_che_result_arr_s* result_expr_adapted = ((xoico_che_result_arr_s*)BLM_LEVEL_T_PUSH(0,xoico_che_result_arr_s,xoico_che_result_arr_s_create()));
    if( xoico_che_s_returns_a_value(o) && typespec_expr->type )
    {
        if( typespec_expr->access_class != typespec_ret->access_class )
        {
            if( typespec_expr->access_class == TYPEOF_discardable )
            {
                BLM_RETURNV(er_t, x_source_parse_error_fa(source,"return: Conversion discards typespec 'discardable'." ))
            }
    
            if( typespec_ret->access_class == TYPEOF_discardable )
            {
                BLM_RETURNV(er_t, x_source_parse_error_fa(source,"return: Conversion requires typespec 'discardable'." ))
            }
        }
    
        BLM_TRY(xoico_che_s_adapt_expression(o,source, typespec_expr, typespec_ret,((const xoico_che_result*)( result_expr)),((xoico_che_result*)( result_expr_adapted ))))
    }
    else
    {
        xoico_che_result_arr_s_push_result_d(result_expr_adapted,((xoico_che_result*)(((xoico_che_result_arr_s*)bcore_fork(result_expr)) )));
    }
    
    xoico_che_result_a_push_result_d(result,((xoico_che_result*)(xoico_che_result_return_s__(xoico_che_result_return_s_create(),o,((xoico_che_result*)( ((xoico_che_result_arr_s*)bcore_fork(result_expr_adapted)) ))) )));
    
    BLM_RETURNV(er_t, 0)
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %r13
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xf1e70(%rip), %rax     # 0x117dd0
movq (%rax), %rsi
leaq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0x717f5
andq $0x0, 0x10(%r12)
movb $0x1, 0xe0(%r14)
movabsq $0x682e7c28bb773227, %rax # imm = 0x682E7C28BB773227
cmpq %rax, %rbx
je 0x25fa5
movabsq $-0x3a38467cc88352a1, %rax # imm = 0xC5C7B983377CAD5F
cmpq %rax, %rbx
jne 0x25fbf
leaq 0x88ad8(%rip), %rsi     # 0xaea7b
jmp 0x25fac
leaq 0x86090(%rip), %rsi     # 0xac03c
movq %r15, %rdi
xorl %eax, %eax
callq 0xd600
testq %rax, %rax
jne 0x260e0
movq %r13, (%rsp)
movabsq $-0x7850996cdf80346a, %rbx # imm = 0x87AF6693207FCB96
callq 0x2637f
leaq 0x8(%rsp), %r13
movq %r13, %rdi
xorl %esi, %esi
movq %rbx, %rdx
movq %rax, %rcx
callq 0x71967
movq %rax, %r12
callq 0xe090
movabsq $-0x641110359430e9c5, %rdx # imm = 0x9BEEEFCA6BCF163B
movq %r13, %rdi
xorl %esi, %esi
movq %rax, %rcx
callq 0x71967
movq %rax, %r13
movq 0x20(%r14), %rbx
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %rax, %rcx
callq 0x1fc8a
testq %rax, %rax
jne 0x260e0
movq %rbx, %rbp
cmpq $0x0, 0x8(%r13)
je 0x26041
movq %r14, %rdi
callq 0x21d6e
testb %al, %al
je 0x260cf
movq %r15, %rsi
movq %r12, %rdx
callq 0x1dc6b
leaq 0x850ea(%rip), %rsi     # 0xab13d
movq %r15, %rdi
callq 0xe5ff
testb %al, %al
je 0x260c6
callq 0x2637f
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
movabsq $-0x7850996cdf80346a, %rdx # imm = 0x87AF6693207FCB96
movq %rax, %rcx
callq 0x71967
movq %rax, %rbx
movq %r14, %rdi
callq 0x21d6e
testb %al, %al
je 0x260ff
cmpq $0x0, 0x8(%r13)
je 0x260ff
movq 0x10(%r13), %rsi
movq %rbp, %rcx
movq 0x30(%rbp), %rax
cmpq %rax, %rsi
jne 0x26146
addq $0x20, %rcx
movq %r14, %rdi
movq %r15, %rsi
movq %r13, %rdx
movq %r12, %r8
movq %rbx, %r9
callq 0x1e44c
testq %rax, %rax
jne 0x260e0
jmp 0x26116
leaq 0x889d7(%rip), %rsi     # 0xaeaa4
jmp 0x260d6
leaq 0x889ac(%rip), %rsi     # 0xaea82
movq %r15, %rdi
xorl %eax, %eax
callq 0xd7c4
movq %rax, %rbp
leaq 0x8(%rsp), %rdi
callq 0x71b64
movq %rbp, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %rdi
callq 0x6026d
movq %rbx, %rdi
addq $0x8, %rdi
movq %rax, %rsi
callq 0xf6dd
callq 0x26a7d
movq %rax, %r15
movq %rbx, %rdi
callq 0x6026d
movq %r14, 0x8(%r15)
leaq 0x10(%r15), %rdi
movq %rax, %rsi
callq 0x268a0
movq (%rsp), %rdi
movq %r15, %rsi
callq 0x1de41
xorl %ebp, %ebp
jmp 0x260e3
movabsq $-0x12e90733f18038df, %rdx # imm = 0xED16F8CC0E7FC721
cmpq %rdx, %rsi
jne 0x26161
leaq 0x88970(%rip), %rsi     # 0xaeacc
jmp 0x260d6
cmpq %rdx, %rax
jne 0x260a7
leaq 0x8898f(%rip), %rsi     # 0xaeb00
jmp 0x260d6