// File: /workspace/github_c_makefile_star2_O2/johsteffens[P]beth/xoico/src/xoico.xo.c
// Function: xoico_compiler_s_check_overwrite
er_t xoico_compiler_s_check_overwrite( const xoico_compiler_s* o, sc_t file, tp_t body_signature, bl_t* clear_to_overwrite )
{
    // xoico_compiler.x:423:1
    BLM_INIT_LEVEL(0);
    if( clear_to_overwrite ) (*(clear_to_overwrite)) = true;
    if( !bcore_file_exists(file ) ) BLM_RETURNV(er_t, 0)
    
    x_source* source =((x_source*)( ((bcore_source*)BLM_LEVEL_A_PUSH(0,bcore_file_open_source(file )))));
    st_s* data = ((st_s*)BLM_LEVEL_T_PUSH(0,st_s,st_s_create()));
    while( !x_source_eos(source) ) st_s_push_char(data,x_source_get_u0(source) );
    
    if( !xoico_compiler_is_correctly_signed(data ) )
    {BLM_INIT_LEVEL(1);
        st_s* s = ((st_s*)BLM_LEVEL_T_PUSH(1,st_s,st_s_create()));
        st_s_push_fa(s,"Planted file #<sc_t>: Signature check failed.\n", file );
        st_s_push_fa(s,"This file might have been created or edited outside the xoico framework.\n" );
        if( o->overwrite_unsigned_target_files )
        {
            if( clear_to_overwrite ) (*(clear_to_overwrite)) = true;
            st_s_push_fa(s,"Flag 'overwrite_unsigned_target_files' is 'true'. The file will be overwritten.\n" );
            x_sink_push_fa(x_sink_stderr(),"\nWARNING: #<sc_t>\n", s->sc );
        }
        else
        {
            if( clear_to_overwrite ) (*(clear_to_overwrite)) = false;
            st_s_push_fa(s,"Xoico has currently no permission to overwrite unsigned target files.\n" );
            st_s_push_fa(s,"You can fix it in one of following ways:\n" );
            st_s_push_fa(s,"* Rename or (re)move the file.\n" );
            st_s_push_fa(s,"* Use command line flag '-f'.\n" );
            BLM_RETURNV(er_t, bcore_error_push_fa(((tp_t)(TYPEOF_general_error)), "\nERROR: #<sc_t>\n", s->sc ))
        }
    BLM_DOWN();}
    
    if( clear_to_overwrite && body_signature && !o->always_expand )
    {
        (*(clear_to_overwrite)) = xoico_compiler_body_signature(data ) != body_signature;
    }
    
    BLM_RETURNV(er_t, 0)
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r13
movq %rdi, %r15
leaq 0xfc05c(%rip), %rax     # 0x117dd0
movq (%rax), %rsi
leaq 0x18(%rsp), %r12
movq %r12, %rdi
callq 0x717f5
andq $0x0, 0x10(%r12)
testq %rbx, %rbx
je 0x1bd92
movb $0x1, (%rbx)
movq %r13, %rdi
callq 0x60eaa
testb %al, %al
je 0x1bef9
movq %r14, 0x8(%rsp)
movabsq $-0x503db0e6e1c2e704, %r14 # imm = 0xAFC24F191E3D18FC
movq %r13, %rdi
callq 0x61037
leaq 0x18(%rsp), %r12
movq %r12, %rdi
xorl %esi, %esi
movq %rax, %rdx
callq 0x71a90
movq %rax, %rbp
xorl %eax, %eax
callq 0x8eb65
movq %r12, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %rax, %rcx
callq 0x71967
movq %rax, %r12
movq %rbp, %rdi
callq 0xe626
testb %al, %al
jne 0x1be09
movq %rbp, %rdi
callq 0x104d1
movsbl %al, %esi
movq %r12, %rdi
callq 0x8f0ee
jmp 0x1bde8
movq %r12, %rdi
callq 0x1c355
testb %al, %al
jne 0x1becc
leaq 0x48(%rsp), %rbp
movq %rbp, 0x10(%rsp)
leaq 0x18(%rsp), %rsi
movq %rbp, %rdi
callq 0x717f5
movq $0x1, 0x10(%rbp)
xorl %eax, %eax
callq 0x8eb65
pushq $0x1
popq %rsi
movq %rbp, %rdi
movabsq $-0x503db0e6e1c2e704, %rdx # imm = 0xAFC24F191E3D18FC
movq %rax, %rcx
callq 0x71967
movq %rax, %rbp
leaq 0x91041(%rip), %rsi     # 0xacea2
movq %rax, %rdi
movq %r13, %rdx
xorl %eax, %eax
callq 0x8f4ef
leaq 0x9105c(%rip), %rsi     # 0xaced1
movq %rbp, %rdi
xorl %eax, %eax
callq 0x8f4ef
cmpb $0x1, 0x182(%r15)
jne 0x1bf17
testq %rbx, %rbx
je 0x1be95
movb $0x1, (%rbx)
leaq 0x9107f(%rip), %rsi     # 0xacf1b
movq %rbp, %rdi
xorl %eax, %eax
callq 0x8f4ef
leaq 0xfbf43(%rip), %rax     # 0x117df0
movq (%rax), %rdi
movq 0x8(%rbp), %rdx
leaq 0x910b1(%rip), %rsi     # 0xacf6c
xorl %eax, %eax
callq 0xdd43
leaq 0x10(%rsp), %rdi
callq 0x71b48
testq %rbx, %rbx
sete %al
movq 0x8(%rsp), %r14
testq %r14, %r14
sete %cl
orb %al, %cl
jne 0x1bef9
cmpb $0x0, 0x183(%r15)
jne 0x1bef9
movq %r12, %rdi
callq 0x1c41a
cmpq %r14, %rax
setne (%rbx)
leaq 0x18(%rsp), %rdi
callq 0x71b64
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %rbx, %rbx
je 0x1bf1f
movb $0x0, (%rbx)
leaq 0x91059(%rip), %rsi     # 0xacf7f
movq %rbp, %rdi
xorl %eax, %eax
callq 0x8f4ef
leaq 0x9108f(%rip), %rsi     # 0xacfc6
movq %rbp, %rdi
xorl %eax, %eax
callq 0x8f4ef
leaq 0x910a8(%rip), %rsi     # 0xacff0
movq %rbp, %rdi
xorl %eax, %eax
callq 0x8f4ef
leaq 0x910b7(%rip), %rsi     # 0xad010
movq %rbp, %rdi
xorl %eax, %eax
callq 0x8f4ef
movq 0x8(%rbp), %rdx
leaq 0x910c1(%rip), %rsi     # 0xad02f
movabsq $0x4d9e984c5b21faea, %rdi # imm = 0x4D9E984C5B21FAEA
xorl %eax, %eax
callq 0x605f4
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x71b64
jmp 0x1bf05