// File: /workspace/github_c_makefile_star2_O1/johsteffens[P]beth/xoico/src/xoico.xo.c
// Function: xoico_wrap_s_finalize
er_t xoico_wrap_s_finalize( xoico_wrap_s* o, const xoico_host* host )
{
    // xoico_wrap.x:42:5
    BLM_INIT_LEVEL(0);
    xoico_compiler_s* compiler = xoico_host_a_compiler(host);
    const xoico_group_s* group = xoico_compiler_s_get_group(compiler,o->group_name );
    if( !group ) BLM_TRY(x_source_point_s_parse_error_fa(&(o->source_point),"Wrap: '#<sc_t>' is not a group.", xoico_compiler_s_nameof(compiler,o->group_name ) ))
    const xoico_func_s* func = xoico_group_s_get_func(group,o->func_name );
    if( !func ) BLM_TRY(x_source_point_s_parse_error_fa(&(o->source_point),"Wrap: '#<sc_t>' is not a function in group '#<sc_t>'.", xoico_compiler_s_nameof(compiler,o->func_name ), xoico_compiler_s_nameof(compiler,o->group_name ) ))
    
    xoico_signature_s_attach( &(o->signature ),  xoico_signature_s_clone(xoico_compiler_s_get_signature(compiler,func->signature->global_name )));
    BLM_TRY(xoico_signature_s_set_global_name(o->signature,host ))
    BLM_TRY(xoico_signature_s_convert_transient_types(o->signature,host, xoico_host_a_transient_map(host) ))
    BLM_TRY(xoico_compiler_s_register_item(compiler,((const xoico*)(o->signature ))))
    
    BCORE_PASS_CREATE(xoico_func_s,o->func);
    o->func->name = o->signature->name;
    o->func->signature_global_name = o->signature->global_name;
    
    st_s* st = ((st_s*)BLM_LEVEL_T_PUSH(0,st_s,st_s_create()));
    st_s_push_fa(st,"{" );
    if( xoico_signature_s_returns_a_value(o->signature) ) st_s_push_sc(st,"return " );
    
    st_s_push_fa(st,"#<sc_t>_#<sc_t>(", xoico_host_a_nameof(host,group->tp_name ), xoico_host_a_nameof(host,func->name ) );
    
    if( o->signature->arg_o )
    {
        BLM_TRY(xoico_arg_s_expand_name(o->signature->arg_o,host,((x_sink*)( st ))))
        BLM_TRY(xoico_args_s_expand_name(&(o->signature->args),host, false,((x_sink*)( st ))))
    }
    else
    {
        BLM_TRY(xoico_args_s_expand_name(&(o->signature->args),host, true,((x_sink*)( st ))))
    }
    
    st_s_push_fa(st,");};" );
    
    BCORE_PASS_CREATE(xoico_body_s,o->func->body);
    BLM_TRY(xoico_body_s_parse(o->func->body,host, ((x_source*)BLM_LEVEL_A_PUSH(0,x_source_create_from_sc(st->sc ))) ))
    
    BLM_RETURNV(er_t, 0)
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x17f86f(%rip), %rax    # 0x1a8dd0
movq (%rax), %rsi
leaq 0x18(%rsp), %r15
movq %r15, %rdi
callq 0xe0431
movq $0x0, 0x10(%r15)
movq (%rbx), %r15
leaq 0x17611d(%rip), %rdx    # 0x19f6a0
movl 0x176117(%rip), %eax    # 0x19f6a0
cltq
leaq (%rax,%rax,2), %rax
movq 0x20(%rdx,%rax,8), %rcx
movq 0x18(%rdx,%rax,8), %rdx
andq %r15, %rdx
shlq $0x4, %rdx
leaq (%rcx,%rdx), %rax
movq (%rcx,%rdx), %rdx
movl $0x8, %ecx
cmpq %r15, %rdx
je 0x295e0
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %r15, %rdx
je 0x295e0
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %r15, %rdx
je 0x295e0
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %r15, %rdx
jne 0x29ae0
movq (%rax,%rcx), %r12
testq %r12, %r12
jne 0x29610
movabsq $-0x1e682f89ce03d7c8, %rdi # imm = 0xE197D07631FC2838
movq %r15, %rsi
callq 0xf3f85
movq %rax, %r12
leaq 0x17609b(%rip), %rdi    # 0x19f6a0
movq %r15, %rsi
movq %rax, %rdx
callq 0x12128c
movq %rbx, %rdi
callq *0x20(%r12)
movq %rax, %r12
movq 0x8(%r14), %rsi
leaq 0x50(%rax), %rdi
callq 0xd4806
testq %rax, %rax
je 0x29632
movq (%rax), %r13
jmp 0x29635
xorl %r13d, %r13d
testq %r13, %r13
je 0x29654
movq 0x10(%r14), %rsi
leaq 0x178(%r13), %rdi
callq 0xd4806
testq %rax, %rax
je 0x29686
movq (%rax), %rax
jmp 0x29688
leaq 0x18(%r14), %r15
movq 0x8(%r14), %rsi
movq %r12, %rdi
callq 0xe39f
leaq 0x11025f(%rip), %rsi    # 0x1398ca
movq %r15, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x13591
movq %rax, %rbp
testq %rax, %rax
jne 0x29a69
jmp 0x2963a
xorl %eax, %eax
movq %r13, (%rsp)
testq %rax, %rax
movq %rax, 0x10(%rsp)
je 0x29a75
movq %rbp, 0x8(%rsp)
movq 0x40(%rax), %rax
movq 0x18(%rax), %rsi
movq %r12, %rdi
callq 0x15c23
movq %rax, %rdi
callq 0x149d9
movq %rax, %r15
movq 0x30(%r14), %rdi
callq 0x14917
movq %r15, 0x30(%r14)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x15076
movq 0x30(%r14), %r13
movq (%rbx), %rbp
movl 0x175fc1(%rip), %eax    # 0x19f6a0
cltq
leaq (%rax,%rax,2), %rax
leaq 0x175fb4(%rip), %rdx    # 0x19f6a0
movq 0x20(%rdx,%rax,8), %rcx
movq 0x18(%rdx,%rax,8), %rdx
andq %rbp, %rdx
shlq $0x4, %rdx
leaq (%rcx,%rdx), %rax
movq (%rcx,%rdx), %rdx
movl $0x8, %ecx
cmpq %rbp, %rdx
je 0x2973d
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %rbp, %rdx
je 0x2973d
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %rbp, %rdx
je 0x2973d
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %rbp, %rdx
jne 0x29ae8
movq (%rax,%rcx), %r15
testq %r15, %r15
jne 0x2976d
movabsq $-0x1e682f89ce03d7c8, %rdi # imm = 0xE197D07631FC2838
movq %rbp, %rsi
callq 0xf3f85
movq %rax, %r15
leaq 0x175f3e(%rip), %rdi    # 0x19f6a0
movq %rbp, %rsi
movq %rax, %rdx
callq 0x12128c
movq %rbx, %rdi
callq *0x40(%r15)
movq %r13, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x14a9d
movq 0x30(%r14), %rsi
movq %r12, %rdi
callq 0x1b29a
movq %rax, %r15
testq %rax, %rax
movq 0x8(%rsp), %rbp
je 0x297a8
leaq 0x18(%rsp), %rdi
callq 0xe0b30
movq %r15, %rbp
testq %r15, %r15
movq (%rsp), %r15
jne 0x29ace
cmpq $0x0, 0x38(%r14)
jne 0x297c5
callq 0x19c7d
movq %rax, 0x38(%r14)
movq %rbp, 0x8(%rsp)
movq 0x30(%r14), %rax
movq 0x38(%r14), %rcx
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rcx)
movq 0x18(%rax), %rax
movq %rax, 0x20(%rcx)
xorl %eax, %eax
callq 0x114bbb
leaq 0x18(%rsp), %rdi
movabsq $-0x503db0e6e1c2e704, %rdx # imm = 0xAFC24F191E3D18FC
xorl %esi, %esi
movq %rax, %rcx
callq 0xe0676
movq %rax, %r12
leaq 0x124e2c(%rip), %rsi    # 0x14e638
movq %rax, %rdi
xorl %eax, %eax
callq 0x1157cb
movq 0x30(%r14), %rax
movq 0x28(%rax), %rcx
movabsq $0x3173c900e37ae1df, %rdx # imm = 0x3173C900E37AE1DF
cmpq %rdx, %rcx
je 0x29832
testq %rcx, %rcx
jne 0x29839
cmpq $0x0, 0x40(%rax)
je 0x29848
leaq 0x10f1cf(%rip), %rsi    # 0x138a0f
movq %r12, %rdi
callq 0x115620
movq 0xa8(%r15), %r15
movq (%rbx), %rbp
movl 0x175e48(%rip), %eax    # 0x19f6a0
cltq
leaq (%rax,%rax,2), %rax
leaq 0x175e3b(%rip), %rdx    # 0x19f6a0
movq 0x20(%rdx,%rax,8), %rcx
movq 0x18(%rdx,%rax,8), %rdx
andq %rbp, %rdx
shlq $0x4, %rdx
leaq (%rcx,%rdx), %rax
movq (%rcx,%rdx), %rdx
movl $0x8, %ecx
cmpq %rbp, %rdx
je 0x298b6
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %rbp, %rdx
je 0x298b6
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %rbp, %rdx
je 0x298b6
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %rbp, %rdx
jne 0x29af0
movq (%rax,%rcx), %r13
testq %r13, %r13
jne 0x298e6
movabsq $-0x1e682f89ce03d7c8, %rdi # imm = 0xE197D07631FC2838
movq %rbp, %rsi
callq 0xf3f85
movq %rax, %r13
leaq 0x175dc5(%rip), %rdi    # 0x19f6a0
movq %rbp, %rsi
movq %rax, %rdx
callq 0x12128c
movq %rbx, %rdi
movq %r15, %rsi
callq *0x48(%r13)
movq %rax, %r15
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rsi
movq (%rbx), %r13
movl 0x175d9b(%rip), %eax    # 0x19f6a0
cltq
leaq (%rax,%rax,2), %rax
leaq 0x175d8e(%rip), %rdx    # 0x19f6a0
movq 0x20(%rdx,%rax,8), %rcx
movq 0x18(%rdx,%rax,8), %rdx
andq %r13, %rdx
shlq $0x4, %rdx
leaq (%rcx,%rdx), %rax
movq (%rcx,%rdx), %rdx
movl $0x8, %ecx
cmpq %r13, %rdx
je 0x29963
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %r13, %rdx
je 0x29963
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %r13, %rdx
je 0x29963
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %r13, %rdx
jne 0x29af8
movq (%rax,%rcx), %rbp
testq %rbp, %rbp
jne 0x299a1
movabsq $-0x1e682f89ce03d7c8, %rdi # imm = 0xE197D07631FC2838
movq %r15, (%rsp)
movq %rsi, %r15
movq %r13, %rsi
callq 0xf3f85
movq %rax, %rbp
leaq 0x175d11(%rip), %rdi    # 0x19f6a0
movq %r13, %rsi
movq %rax, %rdx
callq 0x12128c
movq %r15, %rsi
movq (%rsp), %r15
movq %rbx, %rdi
callq *0x48(%rbp)
leaq 0x10ff72(%rip), %rsi    # 0x139920
movq %r12, %rdi
movq %r15, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x1157cb
movq 0x30(%r14), %rdi
movq 0x50(%rdi), %r15
testq %r15, %r15
je 0x299dd
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x13810
movq 0x30(%r14), %rdi
xorl %edx, %edx
testq %r15, %r15
sete %dl
addq $0x58, %rdi
movq %rbx, %rsi
movq %r12, %rcx
callq 0x14417
leaq 0x10ff36(%rip), %rsi    # 0x139931
movq %r12, %rdi
xorl %eax, %eax
callq 0x1157cb
movq 0x38(%r14), %r15
cmpq $0x0, 0x38(%r15)
movq 0x8(%rsp), %rbp
jne 0x29a1e
callq 0x184a5
movq %rax, 0x38(%r15)
movq 0x38(%r14), %rax
movq 0x38(%rax), %r14
movq 0x8(%r12), %rdi
callq 0xee802
leaq 0x18(%rsp), %rdi
xorl %esi, %esi
movq %rax, %rdx
callq 0xe0900
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x18fa3
movq %rax, %rbx
testq %rax, %rax
je 0x29a62
leaq 0x18(%rsp), %rdi
callq 0xe0b30
movq %rbx, %rbp
testq %rbx, %rbx
jne 0x29ace
xorl %ebp, %ebp
leaq 0x18(%rsp), %rdi
callq 0xe0b30
jmp 0x29ace
leaq 0x18(%r14), %r15
movq 0x10(%r14), %rsi
movq %r12, %rdi
callq 0xe39f
movq %rax, %r13
movq 0x8(%r14), %rsi
movq %r12, %rdi
callq 0xe39f
leaq 0x10fe4f(%rip), %rsi    # 0x1398ea
movq %r15, %rdi
movq %r13, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x13591
movq %rax, %r15
testq %rax, %rax
je 0x29ac0
leaq 0x18(%rsp), %rdi
callq 0xe0b30
movq %r15, %rbp
testq %r15, %r15
movq 0x10(%rsp), %rax
je 0x2969a
movq %rbp, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r12d, %r12d
jmp 0x295e4
xorl %r15d, %r15d
jmp 0x29741
xorl %r13d, %r13d
jmp 0x298ba
xorl %ebp, %ebp
jmp 0x29967