// File: /workspace/github_c_makefile_star2_O3/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, %r12
movq %r8, %r14
movq %rcx, 0x10(%rsp)
movq %rdx, %r13
movq %rsi, %r15
movq %rdi, %rbp
leaq 0x1586b5(%rip), %rax    # 0x19bdd0
movq (%rax), %rsi
leaq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0xd6675
movq $0x0, 0x10(%rbx)
testq %r13, %r13
je 0x43921
leaq 0xedf7c(%rip), %rsi     # 0x1316bf
movq %r15, %rdi
xorl %eax, %eax
callq 0xda80
testq %rax, %rax
jne 0x43a7b
movq %r12, 0x8(%rsp)
movq (%r14), %rbx
leaq 0x151d4b(%rip), %rax    # 0x1954b0
movl 0x151d45(%rip), %ecx    # 0x1954b0
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 0x437bf
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %rbx, %rdx
je 0x437bf
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %rbx, %rdx
je 0x437bf
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %rbx, %rdx
jne 0x437c8
movq (%rax,%rcx), %r12
testq %r12, %r12
jne 0x437ef
movabsq $-0x3dfc7e0a250a30dc, %rdi # imm = 0xC20381F5DAF5CF24
movq %rbx, %rsi
callq 0xe9bc5
movq %rax, %r12
leaq 0x151ccc(%rip), %rdi    # 0x1954b0
movq %rbx, %rsi
movq %rax, %rdx
callq 0x115fac
movq %r14, %rdi
callq *0x10(%r12)
movq (%r14), %rbx
leaq 0x151caf(%rip), %rax    # 0x1954b0
movl 0x151ca9(%rip), %ecx    # 0x1954b0
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 0x4385b
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %rbx, %rdx
je 0x4385b
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %rbx, %rdx
je 0x4385b
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %rbx, %rdx
jne 0x43864
movq (%rax,%rcx), %r12
testq %r12, %r12
jne 0x4388b
movabsq $-0x3dfc7e0a250a30dc, %rdi # imm = 0xC20381F5DAF5CF24
movq %rbx, %rsi
callq 0xe9bc5
movq %rax, %r12
leaq 0x151c30(%rip), %rdi    # 0x1954b0
movq %rbx, %rsi
movq %rax, %rdx
callq 0x115fac
leaq 0xedd2f(%rip), %rsi     # 0x1315c1
movq %r14, %rdi
callq *0x20(%r12)
testq %rax, %rax
jne 0x43a7b
callq 0xffc0
leaq 0x18(%rsp), %rdi
movabsq $-0x641110359430e9c5, %rdx # imm = 0x9BEEEFCA6BCF163B
xorl %esi, %esi
movq %rax, %rcx
callq 0xd68a8
movq %rax, %r12
movq 0x10(%rbp), %rsi
movq %rax, %rdi
movq %r15, %rdx
callq 0x10262
testq %rax, %rax
jne 0x43a7b
movq %r12, (%rsp)
movq 0x8(%r12), %rsi
movabsq $-0x59040ffc58933ff2, %rax # imm = 0xA6FBF003A76CC00E
cmpq %rax, %rsi
je 0x439cf
movabsq $0x213393bef2495d15, %rax # imm = 0x213393BEF2495D15
cmpq %rax, %rsi
movq 0x8(%rsp), %r12
jne 0x439ee
movq 0x10(%rbp), %rdi
callq 0x11a18
movq %rax, %rsi
jmp 0x439e6
leaq 0xedc91(%rip), %rsi     # 0x1315b9
movq %r15, %rdi
xorl %eax, %eax
callq 0xda80
testq %rax, %rax
jne 0x43a7b
movq %r14, (%rsp)
callq 0x46f7e
leaq 0x18(%rsp), %rbx
movabsq $-0x7850996cdf80346a, %rdx # imm = 0x87AF6693207FCB96
movq %rbx, %rdi
xorl %esi, %esi
movq %rax, %rcx
callq 0xd68a8
movq %rax, %r13
callq 0xffc0
movabsq $-0x641110359430e9c5, %rdx # imm = 0x9BEEEFCA6BCF163B
movq %rbx, %rdi
xorl %esi, %esi
movq %rax, %rcx
callq 0xd68a8
movq %rbp, %r14
movq %rax, %rbp
movq %r14, %rdi
movq %r15, %rsi
movq %r13, %rdx
movq %rax, %rcx
callq 0x3a94e
testq %rax, %rax
jne 0x43a7b
movq %rbp, 0x10(%rsp)
leaq 0xe99b2(%rip), %rsi     # 0x12d35d
movq %r15, %rdi
xorl %eax, %eax
callq 0xda80
testq %rax, %rax
jne 0x43a7b
movq %r12, 0x8(%rsp)
movq %r14, %rbp
movq (%rsp), %r14
jmp 0x437f7
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rsi
testq %rsi, %rsi
movq 0x8(%rsp), %r12
je 0x43a6a
movq (%rsp), %rax
movq %rsi, 0x8(%rax)
cmpb $0x0, 0xd(%rbp)
jne 0x43a01
movq 0x18(%rbp), %rdi
callq 0x30b69
testb %al, %al
je 0x43a61
movq %rbp, %rdi
movq (%rsp), %rsi
movq %r14, %rdx
callq 0x32522
testq %rax, %rax
jne 0x43a7b
leaq 0xea31e(%rip), %rsi     # 0x12dd3a
movq %r14, %rdi
callq 0x328fe
testq %rax, %rax
jne 0x43a7b
movq 0x10(%rsp), %rbp
movq 0x8(%rbp), %rax
movabsq $0x3173c900e37ae1de, %rcx # imm = 0x3173C900E37AE1DE
cmpq %rcx, %rax
jg 0x43a9a
movabsq $-0x84b14e74a9e1ff0, %rcx # imm = 0xF7B4EB18B561E010
cmpq %rcx, %rax
je 0x43ac7
testq %rax, %rax
je 0x43ac7
movabsq $0x230abe18cdeefc99, %rcx # imm = 0x230ABE18CDEEFC99
jmp 0x43ac2
leaq 0xedb99(%rip), %rsi     # 0x131601
jmp 0x43a71
leaq 0xedb53(%rip), %rsi     # 0x1315c4
movq %r15, %rdi
xorl %eax, %eax
callq 0xde10
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0xd6d2c
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movabsq $0x3173c900e37ae1df, %rcx # imm = 0x3173C900E37AE1DF
cmpq %rcx, %rax
je 0x43ac7
movabsq $0x54de8100f7c1cbe5, %rcx # imm = 0x54DE8100F7C1CBE5
cmpq %rcx, %rax
je 0x43ac7
movabsq $0x6f0b060106a30da4, %rcx # imm = 0x6F0B060106A30DA4
cmpq %rcx, %rax
jne 0x43b2c
movq %r14, %rdi
movq %r13, %rsi
callq 0x37b5f
leaq 0x10748b(%rip), %rsi    # 0x14af64
movq %r15, %rdi
xorl %eax, %eax
callq 0xda80
testq %rax, %rax
jne 0x43a7b
leaq 0xec8ec(%rip), %rsi     # 0x1303db
movq %r14, %rdi
callq 0x328fe
testq %rax, %rax
jne 0x43a7b
testq %r12, %r12
je 0x43b11
movq %r12, %rdi
movq (%rsp), %rsi
callq 0xfef3
movq (%rsp), %rax
movq 0x20(%rax), %rax
cmpq 0x20(%rbp), %rax
jle 0x43b25
movb $0x0, 0x2e(%r12)
xorl %ebx, %ebx
jmp 0x43a7e
movq (%rsp), %rax
movq 0x20(%rax), %rcx
movq %r15, %rsi
movq %rbp, %rdx
movq %r13, %r8
movq %r14, %r9
callq 0x37633
testq %rax, %rax
jne 0x43a7b
jmp 0x43ad2