// File: /workspace/github_c_makefile_star2_O2/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 0xfc2f7(%rip), %rax     # 0x117dd0
movq (%rax), %rsi
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x717f5
andq $0x0, 0x10(%r15)
cmpb $0x0, 0xf9(%r14)
je 0x1bbf0
cmpq $0x0, 0x100(%r14)
jne 0x1bb2f
leaq 0x8eb3a(%rip), %rdi     # 0xaa647
leaq 0x91224(%rip), %rsi     # 0xacd38
leaq 0x91229(%rip), %rdx     # 0xacd44
leaq 0x8e76e(%rip), %rcx     # 0xaa290
movl $0x1641, %r8d           # imm = 0x1641
xorl %eax, %eax
callq 0x5ffac
cmpq $0x0, 0x108(%r14)
jne 0x1bb62
leaq 0x8eb07(%rip), %rdi     # 0xaa647
leaq 0x9121a(%rip), %rsi     # 0xacd61
leaq 0x911f6(%rip), %rdx     # 0xacd44
leaq 0x8e73b(%rip), %rcx     # 0xaa290
movl $0x1642, %r8d           # imm = 0x1642
xorl %eax, %eax
callq 0x5ffac
movq 0x80(%r14), %rsi
leaq 0x911fd(%rip), %rdi     # 0xacd6d
xorl %eax, %eax
callq 0x8ec7d
leaq 0x8(%rsp), %rbp
movabsq $-0x503db0e6e1c2e704, %r15 # imm = 0xAFC24F191E3D18FC
movq %rbp, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %rax, %rcx
callq 0x71967
movq %rax, %r13
movq 0x80(%r14), %rsi
leaq 0x911d0(%rip), %rdi     # 0xacd77
xorl %eax, %eax
callq 0x8ec7d
movq %rbp, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %rax, %rcx
callq 0x71967
movq %rax, %r12
movq 0x80(%r14), %rsi
leaq 0x91146(%rip), %rdi     # 0xacd15
xorl %eax, %eax
callq 0x8ec7d
movq %rbp, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %rax, %rcx
callq 0x71967
cmpb $0x1, 0xfa(%r14)
jne 0x1bc09
testq %rbx, %rbx
je 0x1bbf8
movb $0x0, (%rbx)
leaq 0x8(%rsp), %rdi
callq 0x71b64
xorl %ebp, %ebp
jmp 0x1bd03
movq %rax, %r15
movb $0x0, 0x7(%rsp)
cmpb $0x1, 0x50(%r14)
jne 0x1bc21
movq 0x118(%r14), %rdx
jmp 0x1bc23
xorl %edx, %edx
movq 0x138(%r14), %rdi
movq 0x8(%r13), %rsi
leaq 0x7(%rsp), %rcx
callq 0x1bd53
testq %rax, %rax
jne 0x1bcf6
cmpb $0x1, 0x7(%rsp)
jne 0x1bc72
movq 0x8(%r13), %rsi
leaq 0x9112e(%rip), %rdi     # 0xacd81
xorl %eax, %eax
callq 0x5fc08
movq 0x8(%r13), %rdi
movq 0x100(%r14), %rsi
callq 0x1bf91
testq %rbx, %rbx
je 0x1bc72
movb $0x1, (%rbx)
movb $0x0, 0x7(%rsp)
cmpb $0x1, 0x50(%r14)
jne 0x1bc87
movq 0x120(%r14), %rdx
jmp 0x1bc89
xorl %edx, %edx
movq 0x138(%r14), %rdi
movq 0x8(%r12), %rsi
leaq 0x7(%rsp), %rcx
callq 0x1bd53
testq %rax, %rax
jne 0x1bcf6
cmpb $0x1, 0x7(%rsp)
jne 0x1bcd7
movq 0x8(%r12), %rsi
leaq 0x910ca(%rip), %rdi     # 0xacd81
xorl %eax, %eax
callq 0x5fc08
movq 0x8(%r12), %rdi
movq 0x108(%r14), %rsi
callq 0x1bf91
testq %rbx, %rbx
je 0x1bcd7
movb $0x1, (%rbx)
leaq 0x7(%rsp), %rcx
movb $0x0, (%rcx)
movq 0x138(%r14), %rdi
movq 0x8(%r15), %rsi
xorl %edx, %edx
callq 0x1bd53
testq %rax, %rax
je 0x1bd15
movq %rax, %rbp
leaq 0x8(%rsp), %rdi
callq 0x71b64
movq %rbp, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpb $0x1, 0x7(%rsp)
jne 0x1bbf8
movq 0x8(%r15), %rsi
leaq 0x91056(%rip), %rdi     # 0xacd81
xorl %eax, %eax
callq 0x5fc08
movq 0x8(%r15), %rdi
movq 0x110(%r14), %rsi
callq 0x1bf91
testq %rbx, %rbx
je 0x1bbf8
movb $0x1, (%rbx)
jmp 0x1bbf8