// File: /workspace/github_c_makefile_star2_O0/johsteffens[P]beth/xoico/src/xoico.xo.c
// Function: xoico_che_s_adapt_expression_indirection
er_t xoico_che_s_adapt_expression_indirection( xoico_che_s* o, x_source* source, const xoico_typespec_s* typespec_expr, sz_t target_indirection, const xoico_che_result* result_expr, xoico_che_result* result )
{
    // xoico_che.x:764:1
    
    if( target_indirection == typespec_expr->indirection )
    {
        xoico_che_result_a_push_result_c(result,result_expr );
    }
    else if( target_indirection == typespec_expr->indirection + 1 )
    {
        if( typespec_expr->flag_addressable )
        {
            BLM_TRY(xoico_che_result_a_push_sc(result,"&(" ))
            xoico_che_result_a_push_result_c(result,result_expr );
            BLM_TRY(xoico_che_result_a_push_sc(result,")" ))
        }
        else
        {
            return  x_source_parse_error_fa(source,"Increasing indirection: Expression has no address." );
        }
    }
    else if( target_indirection < typespec_expr->indirection )
    {
        for(sz_t ind = typespec_expr->indirection; ind > target_indirection; ind-- ) BLM_TRY(xoico_che_result_a_push_sc(result,"*" ))
        BLM_TRY(xoico_che_result_a_push_sc(result,"(" ))
        xoico_che_result_a_push_result_c(result,result_expr );
        BLM_TRY(xoico_che_result_a_push_sc(result,")" ))
    }
    else
    {
        return  x_source_parse_error_fa(source,"Cannot adapt from expression's indirection '#<sz_t>' to target indirection '#<sz_t>'.",
            typespec_expr->indirection,
            target_indirection
        );
    }
    return  0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jne 0x24c53
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x24e80
jmp 0x24e5f
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
movq 0x20(%rcx), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
jne 0x24d27
movq -0x20(%rbp), %rax
testb $0x1, 0x2e(%rax)
je 0x24d07
movq -0x38(%rbp), %rdi
leaq 0x112ac5(%rip), %rsi    # 0x13774a
callq 0x23300
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x24cb9
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq 0x18d68c(%rip), %rax    # 0x1b2330
movq (%rax), %rdi
callq 0xc0720
movq -0x48(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x24e67
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x24e80
movq -0x38(%rbp), %rdi
leaq 0x13067a(%rip), %rsi    # 0x15534b
callq 0x23300
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
je 0x24d05
movq -0x50(%rbp), %rax
movq %rax, -0x58(%rbp)
leaq 0x18d640(%rip), %rax    # 0x1b2330
movq (%rax), %rdi
callq 0xc0720
movq -0x58(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x24e67
jmp 0x24d22
movq -0x18(%rbp), %rdi
leaq 0x111ae2(%rip), %rsi    # 0x1367f4
movb $0x0, %al
callq 0x4c80
movq %rax, -0x8(%rbp)
jmp 0x24e67
jmp 0x24e5d
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jge 0x24e37
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x28(%rbp), %rax
jle 0x24d9e
movq -0x38(%rbp), %rdi
leaq 0x11bc68(%rip), %rsi    # 0x1409c2
callq 0x23300
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x68(%rbp)
je 0x24d8e
movq -0x68(%rbp), %rax
movq %rax, -0x70(%rbp)
leaq 0x18d5b7(%rip), %rax    # 0x1b2330
movq (%rax), %rdi
callq 0xc0720
movq -0x70(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x24e67
jmp 0x24d90
movq -0x60(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x24d45
movq -0x38(%rbp), %rdi
leaq 0x10ea9d(%rip), %rsi    # 0x133846
callq 0x23300
movq %rax, -0x78(%rbp)
cmpq $0x0, -0x78(%rbp)
je 0x24ddd
movq -0x78(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq 0x18d568(%rip), %rax    # 0x1b2330
movq (%rax), %rdi
callq 0xc0720
movq -0x80(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x24e67
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x24e80
movq -0x38(%rbp), %rdi
leaq 0x130556(%rip), %rsi    # 0x15534b
callq 0x23300
movq %rax, -0x88(%rbp)
cmpq $0x0, -0x88(%rbp)
je 0x24e35
movq -0x88(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq 0x18d510(%rip), %rax    # 0x1b2330
movq (%rax), %rdi
callq 0xc0720
movq -0x90(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x24e67
jmp 0x24e5b
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rdx
movq -0x28(%rbp), %rcx
leaq 0x1119d9(%rip), %rsi    # 0x136827
movb $0x0, %al
callq 0x4c80
movq %rax, -0x8(%rbp)
jmp 0x24e67
jmp 0x24e5d
jmp 0x24e5f
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)