// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
leaq 0x18a7ce(%rip), %rax    # 0x1b2330
movq (%rax), %rax
movq %rax, -0x30(%rbp)
leaq -0x60(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0xbfe80
movq -0x68(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x18(%rbp), %rdi
leaq 0x10f564(%rip), %rsi    # 0x137101
movb $0x0, %al
callq 0x4a20
movq %rax, -0x70(%rbp)
cmpq $0x0, -0x70(%rbp)
je 0x27bcd
movq -0x70(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x68(%rbp), %rdi
callq 0xc0720
movq -0x78(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x27f3e
movq -0x20(%rbp), %rdi
leaq 0x10f529(%rip), %rsi    # 0x137101
callq 0x23300
movq %rax, -0x80(%rbp)
cmpq $0x0, -0x80(%rbp)
je 0x27c0c
movq -0x80(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x68(%rbp), %rdi
callq 0xc0720
movq -0x88(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x27f3e
movq -0x30(%rbp), %rax
movq %rax, -0x110(%rbp)
callq 0x5d20
movq -0x110(%rbp), %rdi
movq %rax, %rcx
xorl %eax, %eax
movl %eax, %esi
movabsq $-0x641110359430e9c5, %rdx # imm = 0x9BEEEFCA6BCF163B
callq 0xc01a0
movq %rax, -0x90(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x108(%rbp)
callq 0x5d20
movq -0x108(%rbp), %rdi
movq %rax, %rcx
xorl %eax, %eax
movl %eax, %esi
movabsq $-0x641110359430e9c5, %rdx # imm = 0x9BEEEFCA6BCF163B
callq 0xc01a0
movq %rax, -0x98(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x90(%rbp), %rcx
callq 0x27f50
movq %rax, -0xa0(%rbp)
cmpq $0x0, -0xa0(%rbp)
je 0x27cc4
movq -0xa0(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x68(%rbp), %rdi
callq 0xc0720
movq -0xa8(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x27f3e
movq -0x18(%rbp), %rdi
leaq 0x10f4f8(%rip), %rsi    # 0x1371c7
movb $0x0, %al
callq 0x4a20
movq %rax, -0xb0(%rbp)
cmpq $0x0, -0xb0(%rbp)
je 0x27d0e
movq -0xb0(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x68(%rbp), %rdi
callq 0xc0720
movq -0xb8(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x27f3e
movq -0x20(%rbp), %rdi
leaq 0x10f4ae(%rip), %rsi    # 0x1371c7
callq 0x23300
movq %rax, -0xc0(%rbp)
cmpq $0x0, -0xc0(%rbp)
je 0x27d56
movq -0xc0(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x68(%rbp), %rdi
callq 0xc0720
movq -0xc8(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x27f3e
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x98(%rbp), %rcx
callq 0x27f50
movq %rax, -0xd0(%rbp)
cmpq $0x0, -0xd0(%rbp)
je 0x27da6
movq -0xd0(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x68(%rbp), %rdi
callq 0xc0720
movq -0xd8(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x27f3e
movq -0x90(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x27ef2
movq -0x98(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x27ef2
movq -0x90(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x98(%rbp), %rcx
cmpq 0x8(%rcx), %rax
je 0x27e79
movq -0x18(%rbp), %rax
movq %rax, -0x120(%rbp)
movq -0x10(%rbp), %rdi
movq -0x90(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x22840
movq %rax, -0x118(%rbp)
movq -0x10(%rbp), %rdi
movq -0x98(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x22840
movq -0x120(%rbp), %rdi
movq -0x118(%rbp), %rdx
movq %rax, %rcx
leaq 0x10eefb(%rip), %rsi    # 0x136d33
movb $0x0, %al
callq 0x4c80
movq %rax, -0xe0(%rbp)
cmpq $0x0, -0xe0(%rbp)
je 0x27e77
movq -0xe0(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0x68(%rbp), %rdi
callq 0xc0720
movq -0xe8(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x27f3e
jmp 0x27e79
movq -0x90(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x98(%rbp), %rcx
cmpq 0x20(%rcx), %rax
je 0x27ef0
movq -0x18(%rbp), %rdi
movq -0x90(%rbp), %rax
movq 0x20(%rax), %rdx
movq -0x98(%rbp), %rax
movq 0x20(%rax), %rcx
leaq 0x10eec4(%rip), %rsi    # 0x136d76
movb $0x0, %al
callq 0x4c80
movq %rax, -0xf0(%rbp)
cmpq $0x0, -0xf0(%rbp)
je 0x27eee
movq -0xf0(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0x68(%rbp), %rdi
callq 0xc0720
movq -0xf8(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x27f3e
jmp 0x27ef0
jmp 0x27ef2
cmpq $0x0, -0x28(%rbp)
je 0x27f1f
movq -0x90(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x27f1f
movq -0x28(%rbp), %rdi
movq -0x90(%rbp), %rsi
callq 0x5ce0
movq -0x28(%rbp), %rax
movb $0x0, 0x2e(%rax)
movq $0x0, -0x100(%rbp)
movq -0x68(%rbp), %rdi
callq 0xc0720
movq -0x100(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nopl (%rax,%rax)