// File: /workspace/github_c_makefile_star2_O2/johsteffens[P]beth/xoico/src/xoico.xo.c
// Function: xoico_che_s_trans_ternary_branch
er_t xoico_che_s_trans_ternary_branch( xoico_che_s* o, x_source* source, xoico_che_result* result, xoico_typespec_s* out_typespec )
{
    // xoico_che.x:1258:1
    BLM_INIT_LEVEL(0);
    BLM_TRY(x_source_parse_fa(source,"?" ))
    BLM_TRY(xoico_che_result_a_push_sc(result,"?" ))
    xoico_typespec_s* typespec_true  = ((xoico_typespec_s*)BLM_LEVEL_T_PUSH(0,xoico_typespec_s,xoico_typespec_s_create()));
    xoico_typespec_s* typespec_false = ((xoico_typespec_s*)BLM_LEVEL_T_PUSH(0,xoico_typespec_s,xoico_typespec_s_create()));
    
    BLM_TRY(xoico_che_s_trans_expression(o,source, result, typespec_true ))
    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, typespec_false ))
    
    if( typespec_true->type && typespec_false->type )
    {
        if( typespec_true->type != typespec_false->type )
        {
            BLM_TRY(x_source_parse_error_fa(source,"Ternary operator: Branches differ in type: ('#<sc_t>' : '#<sc_t>')",
                xoico_che_s_nameof(o,typespec_true->type ),
                xoico_che_s_nameof(o,typespec_false->type )
            ))
        }
    
        if( typespec_true->indirection != typespec_false->indirection )
        {
            BLM_TRY(x_source_parse_error_fa(source,"Ternary operator: Branches differ in levels of indirection: ('#<sz_t>' : '#<sz_t>')",
                typespec_true->indirection,
                typespec_false->indirection
            ))
        }
    }
    
    if( out_typespec && typespec_true->type )
    {
        xoico_typespec_s_copy(out_typespec,typespec_true );
        out_typespec->flag_addressable = false;
    }
    BLM_RETURNV(er_t, 0)
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %rbx
movq %rdx, %r13
movq %rsi, %r14
movq %rdi, %r12
leaq 0xf82e9(%rip), %rax     # 0x117dd0
movq (%rax), %rsi
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x717f5
andq $0x0, 0x10(%r15)
leaq 0x8e2f3(%rip), %rsi     # 0xaddf6
movq %r14, %rdi
xorl %eax, %eax
callq 0xd600
testq %rax, %rax
jne 0x1fbc7
leaq 0x8e2d9(%rip), %rsi     # 0xaddf6
movq %r13, %rdi
callq 0x1d59d
testq %rax, %rax
jne 0x1fbc7
movq %rbx, (%rsp)
callq 0xe090
leaq 0x8(%rsp), %rbp
movabsq $-0x641110359430e9c5, %rbx # imm = 0x9BEEEFCA6BCF163B
movq %rbp, %rdi
xorl %esi, %esi
movq %rbx, %rdx
movq %rax, %rcx
callq 0x71967
movq %rax, %r15
callq 0xe090
movq %rbp, %rdi
xorl %esi, %esi
movq %rbx, %rdx
movq %rax, %rcx
callq 0x71967
movq %rax, %rbx
movq %r12, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0x1fc8a
testq %rax, %rax
jne 0x1fbc7
leaq 0x8e32e(%rip), %rsi     # 0xadebc
movq %r14, %rdi
xorl %eax, %eax
callq 0xd600
testq %rax, %rax
jne 0x1fbc7
leaq 0x8e318(%rip), %rsi     # 0xadebc
movq %r13, %rdi
callq 0x1d59d
testq %rax, %rax
jne 0x1fbc7
movq %r12, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x1fc8a
testq %rax, %rax
je 0x1fbe6
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 %rbx, %r13
movq 0x8(%r15), %rsi
testq %rsi, %rsi
movq (%rsp), %rbx
je 0x1fc68
movq 0x8(%r13), %rax
testq %rax, %rax
je 0x1fc68
cmpq %rax, %rsi
je 0x1fc41
movq %r12, %rdi
callq 0x1cf9d
movq %r15, %rbx
movq %rax, %r15
movq 0x8(%r13), %rsi
movq %r12, %rdi
callq 0x1cf9d
leaq 0x8de03(%rip), %rsi     # 0xada28
movq %r14, %rdi
movq %r15, %rdx
movq %rbx, %r15
movq (%rsp), %rbx
movq %rax, %rcx
xorl %eax, %eax
callq 0xd7c4
testq %rax, %rax
jne 0x1fbc7
movq 0x20(%r15), %rdx
movq 0x20(%r13), %rcx
cmpq %rcx, %rdx
je 0x1fc68
leaq 0x8de16(%rip), %rsi     # 0xada6b
movq %r14, %rdi
xorl %eax, %eax
callq 0xd7c4
testq %rax, %rax
jne 0x1fbc7
testq %rbx, %rbx
je 0x1fc83
cmpq $0x0, 0x8(%r15)
je 0x1fc83
movq %rbx, %rdi
movq %r15, %rsi
callq 0xe075
movb $0x0, 0x2e(%rbx)
xorl %ebp, %ebp
jmp 0x1fbca