// File: /workspace/github_c_makefile_star2_O1/johsteffens[P]beth/xoico/src/xoico.xo.c
// Function: xoico_target_s_expand_phase2
er_t xoico_target_s_expand_phase2( xoico_target_s* o, bl_t* p_modified )
{
    // xoico_target.x:583:1
    BLM_INIT_LEVEL(0);
    if( !o->modified )
    {
        if( (p_modified) ) (*(p_modified)) = false;
        BLM_RETURNV(er_t, 0)
    }
    
    ASSERT( o->target_h );
    ASSERT( o->target_c );
    
    st_s* file_h = ((st_s*)BLM_LEVEL_T_PUSH(0,st_s,st_s_create_fa("#<sc_t>.h", o->output_path.sc )));
    st_s* file_c = ((st_s*)BLM_LEVEL_T_PUSH(0,st_s,st_s_create_fa("#<sc_t>.c", o->output_path.sc )));
    st_s* file_state = ((st_s*)BLM_LEVEL_T_PUSH(0,st_s,st_s_create_fa("#<sc_t>.state", o->output_path.sc )));
    
    if( o->readonly )
    {
    //        bcore_msg_fa( "Affected: #<sc_t>\n", file_h.sc );
    //        bcore_msg_fa( "Affected: #<sc_t>\n", file_c.sc );
        if( (p_modified) ) (*(p_modified)) = false;
    }
    else
    {
        {
            bl_t clear_to_overwrite = false;
            tp_t body_signature = o->update_target_on_body_signature ? o->body_signature_h : 0;
            BLM_TRY(xoico_compiler_s_check_overwrite(o->compiler,file_h->sc, body_signature, (&(clear_to_overwrite)) ))
            if( clear_to_overwrite )
            {
                bcore_msg_fa( "Writing: #<sc_t>\n", file_h->sc );
                BLM_TRY(xoico_target_write_with_signature(file_h->sc, o->target_h ))
                if( (p_modified) ) (*(p_modified)) = true;
            }
        }
    
        {
            bl_t clear_to_overwrite = false;
            tp_t body_signature = o->update_target_on_body_signature ? o->body_signature_c : 0;
            BLM_TRY(xoico_compiler_s_check_overwrite(o->compiler,file_c->sc, body_signature, (&(clear_to_overwrite)) ))
            if( clear_to_overwrite )
            {
                bcore_msg_fa( "Writing: #<sc_t>\n", file_c->sc );
                BLM_TRY(xoico_target_write_with_signature(file_c->sc, o->target_c ))
                if( (p_modified) ) (*(p_modified)) = true;
            }
        }
    
        {
            bl_t clear_to_overwrite = false;
            BLM_TRY(xoico_compiler_s_check_overwrite(o->compiler,file_state->sc, 0, (&(clear_to_overwrite)) ))
            if( clear_to_overwrite )
            {
                bcore_msg_fa( "Writing: #<sc_t>\n", file_state->sc );
                BLM_TRY(xoico_target_write_with_signature(file_state->sc, o->target_state ))
                if( (p_modified) ) (*(p_modified)) = true;
            }
        }
    
    }
    BLM_RETURNV(er_t, 0)
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x1776c3(%rip), %rax    # 0x1a8dd0
movq (%rax), %rsi
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0xe0431
movq $0x0, 0x10(%r15)
cmpb $0x0, 0xf9(%r14)
je 0x31827
cmpq $0x0, 0x100(%r14)
jne 0x31766
leaq 0x106f03(%rip), %rdi    # 0x138647
leaq 0x1095ed(%rip), %rsi    # 0x13ad38
leaq 0x1095f2(%rip), %rdx    # 0x13ad44
leaq 0x106b37(%rip), %rcx    # 0x138290
movl $0x1641, %r8d           # imm = 0x1641
xorl %eax, %eax
callq 0xc8053
cmpq $0x0, 0x108(%r14)
jne 0x31799
leaq 0x106ed0(%rip), %rdi    # 0x138647
leaq 0x1095e3(%rip), %rsi    # 0x13ad61
leaq 0x1095bf(%rip), %rdx    # 0x13ad44
leaq 0x106b04(%rip), %rcx    # 0x138290
movl $0x1642, %r8d           # imm = 0x1642
xorl %eax, %eax
callq 0xc8053
movq 0x80(%r14), %rsi
leaq 0x1095c6(%rip), %rdi    # 0x13ad6d
xorl %eax, %eax
callq 0x114d03
leaq 0x8(%rsp), %r12
movabsq $-0x503db0e6e1c2e704, %r15 # imm = 0xAFC24F191E3D18FC
movq %r12, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %rax, %rcx
callq 0xe0676
movq %rax, %rbp
movq 0x80(%r14), %rsi
leaq 0x109599(%rip), %rdi    # 0x13ad77
xorl %eax, %eax
callq 0x114d03
movq %r12, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %rax, %rcx
callq 0xe0676
movq %rax, %r13
movq 0x80(%r14), %rsi
leaq 0x10950f(%rip), %rdi    # 0x13ad15
xorl %eax, %eax
callq 0x114d03
movq %r12, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %rax, %rcx
callq 0xe0676
cmpb $0x1, 0xfa(%r14)
jne 0x3184e
testq %rbx, %rbx
je 0x3182f
movb $0x0, (%rbx)
leaq 0x8(%rsp), %rdi
callq 0xe0b30
xorl %r12d, %r12d
movq %r12, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
movb $0x0, 0x7(%rsp)
cmpb $0x1, 0x50(%r14)
jne 0x31866
movq 0x118(%r14), %rdx
jmp 0x31868
xorl %edx, %edx
movq 0x138(%r14), %rdi
movq 0x8(%rbp), %rsi
leaq 0x7(%rsp), %rcx
callq 0x319b3
movq %rax, %r12
testq %rax, %rax
je 0x31891
leaq 0x8(%rsp), %rdi
callq 0xe0b30
jmp 0x3183c
cmpb $0x1, 0x7(%rsp)
jne 0x318c2
movq 0x8(%rbp), %rsi
leaq 0x1094de(%rip), %rdi    # 0x13ad81
xorl %eax, %eax
callq 0xc7ec8
movq 0x8(%rbp), %rdi
movq 0x100(%r14), %rsi
callq 0x31d61
testq %rbx, %rbx
je 0x318c2
movb $0x1, (%rbx)
movb $0x0, 0x7(%rsp)
cmpb $0x1, 0x50(%r14)
jne 0x318d7
movq 0x120(%r14), %rdx
jmp 0x318d9
xorl %edx, %edx
movq 0x138(%r14), %rdi
movq 0x8(%r13), %rsi
leaq 0x7(%rsp), %rcx
callq 0x319b3
movq %rax, %rbp
testq %rax, %rax
je 0x31903
leaq 0x8(%rsp), %rdi
callq 0xe0b30
movq %rbp, %r12
testq %rbp, %rbp
jne 0x3183c
cmpb $0x1, 0x7(%rsp)
jne 0x3193d
movq 0x8(%r13), %rsi
leaq 0x109463(%rip), %rdi    # 0x13ad81
xorl %eax, %eax
callq 0xc7ec8
movq 0x8(%r13), %rdi
movq 0x108(%r14), %rsi
callq 0x31d61
testq %rbx, %rbx
je 0x3193d
movb $0x1, (%rbx)
leaq 0x7(%rsp), %rcx
movb $0x0, (%rcx)
movq 0x138(%r14), %rdi
movq 0x8(%r15), %rsi
xorl %edx, %edx
callq 0x319b3
movq %rax, %r13
testq %rax, %rax
je 0x3196c
leaq 0x8(%rsp), %rdi
callq 0xe0b30
movq %r13, %r12
testq %r13, %r13
jne 0x3183c
cmpb $0x1, 0x7(%rsp)
jne 0x3182f
movq 0x8(%r15), %rsi
leaq 0x1093f6(%rip), %rdi    # 0x13ad81
xorl %eax, %eax
callq 0xc7ec8
movq 0x8(%r15), %rdi
movq 0x110(%r14), %rsi
callq 0x31d61
testq %rbx, %rbx
je 0x3182f
movb $0x1, (%rbx)
jmp 0x3182f