// File: /workspace/github_c_makefile_star2_O2/johsteffens[P]beth/xoico/src/xoico.xo.c
// Function: xoico_che_s_trans_function_args
er_t xoico_che_s_trans_function_args( xoico_che_s* o, x_source* source, bl_t function_without_brackets, const xoico_func_s* func, const xoico_che_result* result_object_expr, const xoico_typespec_s* typespec_object, xoico_che_result* result, xoico_typespec_s* typespec_return )
{
    // xoico_che_function.x:32:1
    BLM_INIT_LEVEL(0);
    tp_t transient_return_type = 0;
    
    tp_t object_type = func->obj_type;
    const xoico_signature_s* signature = func->signature;
    typespec_return->type = 0;
    
    if( function_without_brackets )
    {
        BLM_TRY(xoico_che_result_a_push_sc(result,"(" ))
    }
    else
    {
        BLM_TRY(xoico_che_s_trans(o,source, "(", result ))
    }
    
    tp_t cast_to_var = signature->typespec_ret.transient ? signature->typespec_ret.transient->cast_to_var : 0;
    
    tp_t ret_transient_class = signature->typespec_ret.transient ? signature->typespec_ret.transient->class : 0;
    
    const xoico_transient_map_s* transient_map = NULL;
    
    if( signature->arg_o )
    {
        if( !result_object_expr )
        {
            xoico_che_result_arr_s* result_expr   = ((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_expr = ((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_expr)), typespec_expr ))
            result_object_expr =((const xoico_che_result*)( result_expr));
            typespec_object = typespec_expr;
            if( signature->args.size > 0 ) BLM_TRY(x_source_parse_fa(source," ," ))
        }
    
        transient_map = ( typespec_object ) ? xoico_che_s_get_transient_map(o,typespec_object->type ) : NULL;
    
        xoico_typespec_s* typespec_object_adapted = ((xoico_typespec_s*)BLM_LEVEL_T_PUSH(0,xoico_typespec_s,xoico_typespec_s_clone(&(signature->arg_o->typespec))));
    
        if( object_type ) BLM_TRY(xoico_typespec_s_relent(typespec_object_adapted,o->host, object_type ))
    
        if( typespec_object->type )
        {
            if
            (
                ret_transient_class &&
                signature->arg_o->typespec.transient &&
                signature->arg_o->typespec.transient->class == ret_transient_class
            )
            {
                transient_return_type = typespec_object->type;
            }
            BLM_TRY(xoico_che_s_adapt_expression(o,source, typespec_object, typespec_object_adapted, result_object_expr, result ))
        }
        else
        {
            xoico_che_result_a_push_result_c(result,result_object_expr );
        }
        if( signature->args.size > 0 ) BLM_TRY(xoico_che_result_a_push_sc(result,"," ))
    
        if( cast_to_var == signature->arg_o->name )
        {
            xoico_typespec_s_copy(typespec_return,typespec_object );
            typespec_return->indirection = typespec_object_adapted->indirection;
        }
    }
    
    if( transient_map && ret_transient_class )
    {
        if( !transient_return_type ) transient_return_type = xoico_transient_map_s_get(transient_map,ret_transient_class );
    }
    
    {const xoico_args_s* __a=&(signature->args );if(__a)for(sz_t __i=0;__i<__a->size;__i++){const xoico_arg_s* arg=__a->data[__i];
    {
        if( xoico_arg_s_is_variadic(arg) ) break;
    
        xoico_che_result_arr_s* result_expr = ((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_expr = ((xoico_typespec_s*)BLM_LEVEL_T_PUSH(0,xoico_typespec_s,xoico_typespec_s_create()));
        BLM_TRY(x_source_parse_fa(source," " ))
    
        if( __i > 0 )
        {
            BLM_TRY(x_source_parse_fa(source," ," ))
            BLM_TRY(xoico_che_result_a_push_sc(result,"," ))
        }
    
        BLM_TRY(xoico_che_s_trans_whitespace(o,source,((xoico_che_result*)( result_expr ))))
        if( x_source_parse_bl(source,"#?')'" ) ) BLM_RETURNV(er_t, x_source_parse_error_fa(source,"Function argument '#<sc_t>': No value passed.", xoico_che_s_nameof(o,arg->name ) ))
    
        BLM_TRY(xoico_che_s_trans_expression(o,source,((xoico_che_result*)( result_expr)), typespec_expr ))
    
        if( typespec_expr->type )
        {
            if( arg->typespec.transient )
            {
                if( transient_return_type == 0 && arg->typespec.transient->class == ret_transient_class )
                {
                    transient_return_type = typespec_expr->type;
                }
    
                if( transient_map )
                {
                    tp_t t = xoico_transient_map_s_get(transient_map,ret_transient_class );
                    if( xoico_che_s_is_stamp(o,t ) )
                    {
                        if( typespec_expr->type != t )
                        {
                            BLM_RETURNV(er_t, x_source_parse_error_fa(source,"Function argument '#<sc_t>': Type '#<sc_t>' expected but type '#<sc_t>' passed.", xoico_che_s_nameof(o,arg->name ), xoico_che_s_nameof(o,t ), xoico_che_s_nameof(o,typespec_expr->type ) ))
                        }
                    }
                }
            }
    
            BLM_TRY(xoico_che_s_adapt_expression(o,source, typespec_expr,&( arg->typespec),((const xoico_che_result*)( result_expr)), result ))
        }
        else
        {
            xoico_che_result_a_push_result_d(result,((xoico_che_result*)(((xoico_che_result_arr_s*)bcore_fork(result_expr)) )));
        }
    
        if( cast_to_var == arg->name )
        {
            xoico_typespec_s_copy(typespec_return,typespec_expr );
            typespec_return->indirection = arg->typespec.indirection;
        }
    }
    
    }}if( xoico_args_s_is_variadic(&(signature->args)) )
    {
        while( !x_source_eos(source) && !x_source_parse_bl(source," #=?')'" ) )
        {
            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, NULL ))
        }
    }
    
    if( function_without_brackets )
    {
        BLM_TRY(xoico_che_result_a_push_sc(result,")" ))
    }
    else
    {
        BLM_TRY(x_source_parse_fa(source," " ))
        BLM_TRY(xoico_che_s_trans(o,source, ")", result ))
    }
    
    
    if( typespec_return->type == 0 )
    {
        xoico_typespec_s_copy(typespec_return,&(signature->typespec_ret ));
        if( transient_return_type != 0 ) typespec_return->type = transient_return_type;
    }
    BLM_RETURNV(er_t, 0)
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %r9, (%rsp)
movq %r8, 0x10(%rsp)
movq %rcx, %r15
movl %edx, %r14d
movq %rsi, %rbx
movq %rdi, 0x8(%rsp)
movq 0xb8(%rsp), %r12
movq 0xb0(%rsp), %r13
leaq 0xf3e82(%rip), %rax     # 0x117dd0
movq (%rax), %rsi
leaq 0x48(%rsp), %rbp
movq %rbp, %rdi
callq 0x717f5
andq $0x0, 0x10(%rbp)
movq 0x18(%r15), %rax
movq %rax, 0x20(%rsp)
movq 0x40(%r15), %rax
movq %rax, 0x30(%rsp)
andq $0x0, 0x8(%r12)
movl %r14d, 0x3c(%rsp)
testl %r14d, %r14d
je 0x23f99
movq %rbx, %rbp
leaq 0x8655f(%rip), %rsi     # 0xaa4ee
movq %r13, %rdi
callq 0x1d59d
jmp 0x23fae
leaq 0x8654e(%rip), %rdx     # 0xaa4ee
movq %rbx, %rbp
movq %rbx, %rsi
movq %r13, %rcx
callq 0x1d558
testq %rax, %rax
je 0x23fd2
movq %rax, %r15
leaq 0x48(%rsp), %rdi
callq 0x71b64
movq %r15, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x30(%rsp), %r14
movq 0x38(%r14), %rax
testq %rax, %rax
je 0x23fef
movq 0x8(%rax), %r13
movq 0x10(%rax), %rax
movq %rax, 0x28(%rsp)
jmp 0x23ffb
movq $0x0, 0x28(%rsp)
xorl %r13d, %r13d
movq 0x10(%rsp), %r12
movabsq $-0x641110359430e9c5, %r15 # imm = 0x9BEEEFCA6BCF163B
cmpq $0x0, 0x50(%r14)
movq %rbp, %rbx
je 0x24047
testq %r12, %r12
je 0x24050
movq (%rsp), %rax
testq %rax, %rax
movq %r12, 0x10(%rsp)
je 0x240e2
movq 0x8(%rax), %rsi
movq 0x8(%rsp), %r15
movq 0x18(%r15), %rdi
callq 0x1c2ca
movq %rax, 0x18(%rsp)
jmp 0x240f0
xorl %ecx, %ecx
xorl %eax, %eax
jmp 0x24206
callq 0x2637f
leaq 0x48(%rsp), %r14
movabsq $-0x7850996cdf80346a, %rdx # imm = 0x87AF6693207FCB96
movq %r14, %rdi
xorl %esi, %esi
movq %rax, %rcx
callq 0x71967
movq %rax, %r12
callq 0xe090
movq %r14, %rdi
xorl %esi, %esi
movabsq $-0x641110359430e9c5, %rdx # imm = 0x9BEEEFCA6BCF163B
movq %rax, %rcx
callq 0x71967
movq %rax, %r14
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
movq %r12, %rdx
movq %rax, %rcx
callq 0x1fc8a
testq %rax, %rax
jne 0x23fb3
movq %r14, (%rsp)
movq 0x30(%rsp), %r14
cmpq $0x0, 0x68(%r14)
je 0x24019
leaq 0x87079(%rip), %rsi     # 0xab143
movq %rbx, %rdi
xorl %eax, %eax
callq 0xd600
testq %rax, %rax
jne 0x23fb3
jmp 0x24019
movq $0x0, 0x18(%rsp)
movq 0x8(%rsp), %r15
movq 0x50(%r14), %rdi
addq $0x20, %rdi
callq 0xe0b1
leaq 0x48(%rsp), %rdi
xorl %esi, %esi
movabsq $-0x641110359430e9c5, %rdx # imm = 0x9BEEEFCA6BCF163B
movq %rax, %rcx
callq 0x71967
movq %rax, %r12
movq 0x20(%rsp), %rcx
testq %rcx, %rcx
je 0x24139
movabsq $0x213393bef2495d15, %rax # imm = 0x213393BEF2495D15
cmpq %rax, 0x8(%r12)
jne 0x24139
movq %rcx, 0x8(%r12)
movq (%rsp), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x24190
testq %r13, %r13
je 0x24164
movq 0x50(%r14), %rcx
movq 0x38(%rcx), %rcx
testq %rcx, %rcx
je 0x24164
xorl %ebp, %ebp
cmpq %r13, 0x8(%rcx)
cmoveq %rax, %rbp
jmp 0x24166
xorl %ebp, %ebp
movq %r15, %rdi
movq %rbx, %rsi
movq (%rsp), %rdx
movq %r12, %rcx
movq 0x10(%rsp), %r8
movq 0xb0(%rsp), %r9
callq 0x1e44c
testq %rax, %rax
jne 0x23fb3
jmp 0x241a4
movq 0xb0(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x1e42a
xorl %ebp, %ebp
cmpq $0x0, 0x68(%r14)
je 0x241c8
leaq 0x86f92(%rip), %rsi     # 0xab144
movq 0xb0(%rsp), %rdi
callq 0x1d59d
testq %rax, %rax
jne 0x23fb3
movq 0x50(%r14), %rax
movq 0x28(%rsp), %rcx
cmpq 0x50(%rax), %rcx
jne 0x241f4
movq 0xb8(%rsp), %r15
movq %r15, %rdi
movq (%rsp), %rsi
callq 0xe075
movq 0x20(%r12), %rax
movq %rax, 0x20(%r15)
movabsq $-0x641110359430e9c5, %r15 # imm = 0x9BEEEFCA6BCF163B
movq %rbp, %rax
movq 0x18(%rsp), %rcx
movq %rcx, 0x18(%rsp)
testq %rcx, %rcx
je 0x24227
testq %r13, %r13
je 0x24227
testq %rax, %rax
jne 0x24227
movq 0x18(%rsp), %rdi
movq %r13, %rsi
callq 0xe108
movq %rax, (%rsp)
movq %r13, 0x20(%rsp)
leaq 0x20(%r14), %rax
movq %rax, 0x40(%rsp)
xorl %edx, %edx
movq 0x68(%r14), %rax
cmpq %rax, %rdx
jae 0x24429
movq 0x60(%r14), %rcx
movq (%rcx,%rdx,8), %r12
cmpb $0x0, 0x4f(%r12)
jne 0x24432
movq %rdx, 0x10(%rsp)
callq 0x2637f
leaq 0x48(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
movabsq $-0x7850996cdf80346a, %rdx # imm = 0x87AF6693207FCB96
movq %rax, %rcx
callq 0x71967
movq %rax, %rbp
callq 0xe090
movq %r14, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %rax, %rcx
callq 0x71967
movq %rax, %r14
movq %rbx, %r13
movq %rbx, %rdi
leaq 0x9d4d3(%rip), %rsi     # 0xc177d
xorl %eax, %eax
callq 0xd600
testq %rax, %rax
jne 0x23fb3
cmpq $0x0, 0x10(%rsp)
je 0x242f9
movq %r13, %rdi
leaq 0x86e77(%rip), %rsi     # 0xab143
xorl %eax, %eax
callq 0xd600
testq %rax, %rax
jne 0x23fb3
movq 0xb0(%rsp), %rdi
leaq 0x86e59(%rip), %rsi     # 0xab144
callq 0x1d59d
testq %rax, %rax
jne 0x23fb3
movq %r13, %r15
movq %r13, %rsi
movq %rbp, %rdx
callq 0x1dc6b
movq %r13, %rdi
leaq 0x86d80(%rip), %rsi     # 0xab091
callq 0xe5ff
testb %al, %al
jne 0x244e3
movq 0x8(%rsp), %rdi
movq %r15, %rsi
movq %rbp, %rdx
movq %r14, %rcx
callq 0x1fc8a
testq %rax, %rax
jne 0x23fb3
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x243ca
movq 0x38(%r12), %rcx
testq %rcx, %rcx
je 0x243a0
cmpq $0x0, (%rsp)
jne 0x2436e
movq 0x20(%rsp), %rdx
cmpq %rdx, 0x8(%rcx)
movl $0x0, %ecx
cmovneq %rcx, %rax
movq %rax, (%rsp)
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x243a0
movq 0x20(%rsp), %rsi
callq 0xe108
movq %rax, %r15
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x1e881
testb %al, %al
je 0x243a0
cmpq %r15, 0x8(%r14)
jne 0x24576
leaq 0x20(%r12), %rcx
movq 0x8(%rsp), %rdi
movq %r13, %rsi
movq %r14, %rdx
movq %rbp, %r8
movq 0xb0(%rsp), %r9
callq 0x1e44c
testq %rax, %rax
je 0x243e2
jmp 0x23fb3
movq %rbp, %rdi
callq 0x6026d
movq 0xb0(%rsp), %rdi
movq %rax, %rsi
callq 0x1de41
movq 0x28(%rsp), %rax
cmpq 0x50(%r12), %rax
jne 0x2440a
movq 0xb8(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xe075
movq 0x40(%r12), %rax
movq %rax, 0x20(%r15)
movq 0x10(%rsp), %rdx
incq %rdx
movq 0x30(%rsp), %r14
movabsq $-0x641110359430e9c5, %r15 # imm = 0x9BEEEFCA6BCF163B
movq %r13, %rbx
jmp 0x2423b
testq %rax, %rax
je 0x244c6
movq 0x60(%r14), %rcx
movq -0x8(%rcx,%rax,8), %rax
cmpb $0x1, 0x4f(%rax)
jne 0x244c6
leaq 0x860a4(%rip), %r14     # 0xaa4f0
leaq 0x86cf0(%rip), %r13     # 0xab143
leaq 0x86cea(%rip), %rbp     # 0xab144
movq %rbx, %rdi
callq 0xe626
testb %al, %al
jne 0x244c6
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe5ff
testb %al, %al
jne 0x244c6
movq %rbx, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0xd600
testq %rax, %rax
jne 0x23fb3
movq 0xb0(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
callq 0x1d59d
testq %rax, %rax
jne 0x23fb3
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x1fc8a
movq %rax, %r15
testq %rax, %rax
je 0x2445a
jmp 0x23fb6
cmpb $0x0, 0x3c(%rsp)
je 0x2450b
leaq 0xa4a13(%rip), %rsi     # 0xc8ee7
movq 0xb0(%rsp), %rdi
callq 0x1d59d
jmp 0x2453c
movq 0x50(%r12), %rsi
movq 0x8(%rsp), %rdi
callq 0x1cf9d
leaq 0x8a013(%rip), %rsi     # 0xae50c
movq %r15, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xd7c4
jmp 0x23fb3
leaq 0x9d26b(%rip), %rsi     # 0xc177d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xd600
testq %rax, %rax
movq 0xb0(%rsp), %rcx
jne 0x23fb3
leaq 0xa49b3(%rip), %rdx     # 0xc8ee7
movq %rbx, %rsi
callq 0x1d558
testq %rax, %rax
jne 0x23fb3
movq 0xb8(%rsp), %rbx
cmpq $0x0, 0x8(%rbx)
jne 0x2456e
movq %rbx, %rdi
movq 0x40(%rsp), %rsi
callq 0xe075
movq (%rsp), %rax
testq %rax, %rax
je 0x2456e
movq %rax, 0x8(%rbx)
xorl %r15d, %r15d
jmp 0x23fb6
movq 0x50(%r12), %rsi
movq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0x1cf9d
movq %rax, %rbx
movq %r12, %rdi
movq %r15, %rsi
callq 0x1cf9d
movq %rax, %r15
movq 0x8(%r14), %rsi
movq %r12, %rdi
callq 0x1cf9d
leaq 0x89f8e(%rip), %rsi     # 0xae53a
movq %r13, %rdi
movq %rbx, %rdx
movq %r15, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0xd7c4
jmp 0x23fb3