// File: /workspace/github_c_makefile_star2_O2/johsteffens[P]beth/xoico/src/xoico.xo.c
// Function: xoico_che_s_trans_builtin_cast
er_t xoico_che_s_trans_builtin_cast( 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:72:1
    BLM_INIT_LEVEL(0);
    if( result_expr ) // member call
    {
        BLM_TRY(x_source_parse_fa(source," ( " ))
        xoico_che_result_a_clear(result_out);
    }
    else // direct call
    {
        BLM_TRY(x_source_parse_fa(source,"cast ( " ))
        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 ))
        BLM_TRY(x_source_parse_fa(source," , " ))
        typespec_expr = typespec;
        result_expr =((const xoico_che_result*)( result));
    }
    
    BLM_TRY(xoico_che_result_a_push_sc(result_out,"((" ))
    xoico_typespec_s* typespec_cast = ((xoico_typespec_s*)BLM_LEVEL_T_PUSH(0,xoico_typespec_s,xoico_typespec_s_create()));
    
    BLM_TRY(xoico_typespec_s_parse(typespec_cast,o->host, source ))
    
    if( typespec_cast->type == ((tp_t)(TYPEOF_type_object)) )
    {
        typespec_cast->type = xoico_host_a_obj_type(o->host);
    }
    else if( typespec_cast->type == ((tp_t)(TYPEOF_type_deduce)) )
    {
        if( !typespec_expr->type )
        {
            BLM_RETURNV(er_t, x_source_parse_error_fa(source,"Cast-syntax: Deduce requested but expression is intractable." ))
        }
        typespec_cast->type = typespec_expr->type;
    }
    
    if( !o->waive_unknown_type && !xoico_che_s_is_type(o,typespec_cast->type ) )
    {
        BLM_RETURNV(er_t, x_source_parse_error_fa(source,"Cast: Unknown type name was used." ))
    }
    
    BLM_TRY(xoico_che_s_push_typespec(o,typespec_cast, result_out ))
    BLM_TRY(xoico_che_result_a_push_sc(result_out,")(" ))
    
    if
    (
        typespec_expr->type &&
        ( typespec_expr->type != ((tp_t)(TYPEOF_vc_t)) ) &&
        ( typespec_expr->type != ((tp_t)(TYPEOF_vd_t)) ) &&
        ( typespec_expr->type != ((tp_t)(TYPEOF_sc_t)) ) &&
        ( typespec_expr->type != ((tp_t)(TYPEOF_sd_t)) ) &&
        ( typespec_expr->type != TYPEOF_void )
    )
    {
        BLM_TRY(xoico_che_s_adapt_expression_indirection(o,source, typespec_expr, typespec_cast->indirection, result_expr, result_out ))
    }
    else
    {
        xoico_che_result_a_push_result_c(result_out,result_expr );
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r9, 0x10(%rsp)
movq %r8, %r14
movq %rcx, %r12
movq %rdx, %r13
movq %rsi, %r15
movq %rdi, %rbp
leaq 0xf37e3(%rip), %rax     # 0x117dd0
movq (%rax), %rsi
leaq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0x717f5
andq $0x0, 0x10(%rbx)
testq %r13, %r13
je 0x246c7
leaq 0x8a0ad(%rip), %rsi     # 0xae6bf
movq %r15, %rdi
xorl %eax, %eax
callq 0xd600
testq %rax, %rax
jne 0x2488c
movq %r14, %rdi
callq 0x235f4
leaq 0x89f8d(%rip), %rsi     # 0xae5c1
movq %r14, %rdi
callq 0x1d59d
testq %rax, %rax
jne 0x2488c
movq %r12, 0x8(%rsp)
callq 0xe090
leaq 0x18(%rsp), %rdi
movabsq $-0x641110359430e9c5, %rdx # imm = 0x9BEEEFCA6BCF163B
xorl %esi, %esi
movq %rax, %rcx
callq 0x71967
movq %rax, %r12
movq 0x10(%rbp), %rsi
movq %rax, %rdi
movq %r15, %rdx
callq 0xe149
testq %rax, %rax
jne 0x2488c
movq 0x8(%r12), %rsi
movabsq $-0x59040ffc58933ff2, %rax # imm = 0xA6FBF003A76CC00E
cmpq %rax, %rsi
movq %r12, %rbx
je 0x2475d
movabsq $0x213393bef2495d15, %rax # imm = 0x213393BEF2495D15
cmpq %rax, %rsi
movq 0x8(%rsp), %r12
jne 0x24774
movq 0x10(%rbp), %rdi
callq 0xe8a0
movq %rax, %rsi
jmp 0x24770
leaq 0x89eeb(%rip), %rsi     # 0xae5b9
movq %r15, %rdi
xorl %eax, %eax
callq 0xd600
testq %rax, %rax
jne 0x2488c
callq 0x2637f
leaq 0x18(%rsp), %rbx
movabsq $-0x7850996cdf80346a, %rdx # imm = 0x87AF6693207FCB96
movq %rbx, %rdi
xorl %esi, %esi
movq %rax, %rcx
callq 0x71967
movq %rax, %r13
callq 0xe090
movabsq $-0x641110359430e9c5, %rdx # imm = 0x9BEEEFCA6BCF163B
movq %rbx, %rdi
xorl %esi, %esi
movq %rax, %rcx
callq 0x71967
movq %rax, %r12
movq %rbp, %rdi
movq %r15, %rsi
movq %r13, %rdx
movq %rax, %rcx
callq 0x1fc8a
testq %rax, %rax
jne 0x2488c
leaq 0x85c18(%rip), %rsi     # 0xaa35d
movq %r15, %rdi
xorl %eax, %eax
callq 0xd600
testq %rax, %rax
jne 0x2488c
jmp 0x2462d
movq 0x8(%rsp), %r12
movq 0x8(%r12), %rsi
testq %rsi, %rsi
je 0x2487b
movq %rsi, 0x8(%rbx)
cmpb $0x0, 0xd(%rbp)
jne 0x2478a
movq %rbp, %rdi
callq 0x1e88a
testb %al, %al
je 0x24872
movq %rbp, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1d30a
testq %rax, %rax
jne 0x2488c
movq %rbx, %rbp
leaq 0x8658f(%rip), %rsi     # 0xaad3a
movq %r14, %rdi
callq 0x1d59d
testq %rax, %rax
jne 0x2488c
movq 0x8(%r12), %rax
movabsq $-0x84b14e74a9e1ff0, %rcx # imm = 0xF7B4EB18B561E010
cmpq %rcx, %rax
je 0x24815
testq %rax, %rax
je 0x24815
movabsq $0x230abe18cdeefc99, %rcx # imm = 0x230ABE18CDEEFC99
cmpq %rcx, %rax
je 0x24815
movabsq $0x3173c900e37ae1df, %rcx # imm = 0x3173C900E37AE1DF
cmpq %rcx, %rax
je 0x24815
movabsq $0x54de8100f7c1cbe5, %rcx # imm = 0x54DE8100F7C1CBE5
cmpq %rcx, %rax
je 0x24815
movabsq $0x6f0b060106a30da4, %rcx # imm = 0x6F0B060106A30DA4
cmpq %rcx, %rax
jne 0x248ab
movq %r14, %rdi
movq %r13, %rsi
callq 0x1e42a
leaq 0xa46bf(%rip), %rsi     # 0xc8ee6
movq %r15, %rdi
xorl %eax, %eax
callq 0xd600
testq %rax, %rax
jne 0x2488c
leaq 0x88b9e(%rip), %rsi     # 0xad3db
movq %r14, %rdi
callq 0x1d59d
testq %rax, %rax
jne 0x2488c
movq 0x10(%rsp), %rbx
testq %rbx, %rbx
je 0x2485f
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xe075
movq 0x20(%rbp), %rax
cmpq 0x20(%r12), %rax
jle 0x2486e
movb $0x0, 0x2e(%rbx)
xorl %ebx, %ebx
jmp 0x2488f
leaq 0x89d88(%rip), %rsi     # 0xae601
jmp 0x24882
leaq 0x89d42(%rip), %rsi     # 0xae5c4
movq %r15, %rdi
xorl %eax, %eax
callq 0xd7c4
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x71b64
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x20(%rbp), %rcx
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %r8
movq %r14, %r9
callq 0x1e317
testq %rax, %rax
jne 0x2488c
jmp 0x24820