// File: /workspace/github_c_makefile_star2_O3/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 $0x88, %rsp
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r13
movq %rdi, %r12
leaq 0x16c483(%rip), %rax    # 0x19bdd0
movq (%rax), %rsi
leaq 0x58(%rsp), %rbx
movq %rbx, %rdi
callq 0xd6675
movq $0x0, 0x10(%rbx)
testq %r14, %r14
je 0x2f96e
movb $0x1, (%r14)
movq %r13, %rdi
callq 0xbf581
testb %al, %al
je 0x2fc34
movq %r12, 0x8(%rsp)
movq %r15, 0x10(%rsp)
movq %r14, 0x18(%rsp)
movabsq $-0x503db0e6e1c2e704, %r14 # imm = 0xAFC24F191E3D18FC
movq %r13, (%rsp)
movq %r13, %rdi
callq 0xbf75a
leaq 0x58(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
movq %rax, %rdx
callq 0xd6b17
movq %rax, %r15
xorl %eax, %eax
callq 0x109c82
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %rax, %rcx
callq 0xd68a8
movq %rax, %r12
leaq 0x16d2ef(%rip), %r13    # 0x19ccc8
leaq 0x28(%rsp), %r14
movq (%r15), %rbx
movl (%r13), %eax
cltq
leaq (%rax,%rax,2), %rax
movq 0x20(%r13,%rax,8), %rcx
movq 0x18(%r13,%rax,8), %rdx
andq %rbx, %rdx
shlq $0x4, %rdx
leaq (%rcx,%rdx), %rax
movq (%rcx,%rdx), %rdx
movl $0x8, %ecx
cmpq %rbx, %rdx
je 0x2fa38
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %rbx, %rdx
je 0x2fa38
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %rbx, %rdx
je 0x2fa38
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %rbx, %rdx
jne 0x2fa41
movq (%rax,%rcx), %rbp
testq %rbp, %rbp
jne 0x2fa64
movabsq $-0x7e8ee9b9b4bbaa8, %rdi # imm = 0xF817116464B44558
movq %rbx, %rsi
callq 0xe9bc5
movq %rax, %rbp
movq %r13, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x115fac
movq 0x40(%rbp), %rax
testq %rax, %rax
jne 0x2fa80
movq %rbp, %rdi
leaq 0x10a312(%rip), %rsi    # 0x139d89
callq 0xeb49c
movq 0x40(%rbp), %rax
movq %r15, %rdi
callq *%rax
testb %al, %al
jne 0x2fb3b
movq (%r15), %rbx
movl (%r13), %eax
cltq
leaq (%rax,%rax,2), %rax
movq 0x20(%r13,%rax,8), %rcx
movq 0x18(%r13,%rax,8), %rdx
andq %rbx, %rdx
shlq $0x4, %rdx
leaq (%rcx,%rdx), %rax
movq (%rcx,%rdx), %rdx
movl $0x8, %ecx
cmpq %rbx, %rdx
je 0x2fae7
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %rbx, %rdx
je 0x2fae7
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %rbx, %rdx
je 0x2fae7
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %rbx, %rdx
jne 0x2faf0
movq (%rax,%rcx), %rbp
testq %rbp, %rbp
jne 0x2fb13
movabsq $-0x7e8ee9b9b4bbaa8, %rdi # imm = 0xF817116464B44558
movq %rbx, %rsi
callq 0xe9bc5
movq %rax, %rbp
movq %r13, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x115fac
movq 0x10(%rbp), %rax
movb $0x0, 0x28(%rsp)
movl $0x1, %edx
movq %r15, %rdi
movq %r14, %rsi
callq *%rax
movsbl 0x28(%rsp), %esi
movq %r12, %rdi
callq 0x10a448
jmp 0x2f9de
movq %r12, %rdi
callq 0x30da8
testb %al, %al
movq 0x18(%rsp), %r15
movq 0x10(%rsp), %r13
movq 0x8(%rsp), %rbp
jne 0x2fc0c
movq %r14, 0x20(%rsp)
leaq 0x58(%rsp), %rsi
movq %r14, %rdi
callq 0xd6675
movq $0x1, 0x38(%rsp)
xorl %eax, %eax
callq 0x109c82
movl $0x1, %esi
movq %r14, %rdi
movabsq $-0x503db0e6e1c2e704, %rdx # imm = 0xAFC24F191E3D18FC
movq %rax, %rcx
callq 0xd68a8
movq %rax, %rbx
leaq 0x100302(%rip), %rsi    # 0x12fea2
movq %rax, %rdi
movq (%rsp), %rdx
xorl %eax, %eax
callq 0x10a8a5
leaq 0x10031c(%rip), %rsi    # 0x12fed1
movq %rbx, %rdi
xorl %eax, %eax
callq 0x10a8a5
cmpb $0x1, 0x182(%rbp)
jne 0x2fc55
testq %r15, %r15
je 0x2fbd5
movb $0x1, (%r15)
leaq 0x10033f(%rip), %rsi    # 0x12ff1b
movq %rbx, %rdi
xorl %eax, %eax
callq 0x10a8a5
leaq 0x16c203(%rip), %rax    # 0x19bdf0
movq (%rax), %rdi
movq 0x8(%rbx), %rdx
leaq 0x100371(%rip), %rsi    # 0x12ff6c
xorl %eax, %eax
callq 0xed3f
leaq 0x20(%rsp), %rdi
callq 0xd6d0d
testq %r15, %r15
sete %al
testq %r13, %r13
sete %cl
orb %al, %cl
jne 0x2fc34
cmpb $0x0, 0x183(%rbp)
jne 0x2fc34
movq %r12, %rdi
callq 0x30ed8
cmpq %r13, %rax
setne (%r15)
leaq 0x58(%rsp), %rdi
callq 0xd6d2c
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %r15, %r15
je 0x2fc5e
movb $0x0, (%r15)
leaq 0x10031a(%rip), %rsi    # 0x12ff7f
movq %rbx, %rdi
xorl %eax, %eax
callq 0x10a8a5
leaq 0x100350(%rip), %rsi    # 0x12ffc6
movq %rbx, %rdi
xorl %eax, %eax
callq 0x10a8a5
leaq 0x100369(%rip), %rsi    # 0x12fff0
movq %rbx, %rdi
xorl %eax, %eax
callq 0x10a8a5
leaq 0x100378(%rip), %rsi    # 0x130010
movq %rbx, %rdi
xorl %eax, %eax
callq 0x10a8a5
movq 0x8(%rbx), %rdx
leaq 0x100382(%rip), %rsi    # 0x13002f
movabsq $0x4d9e984c5b21faea, %rdi # imm = 0x4D9E984C5B21FAEA
xorl %eax, %eax
callq 0xbec3c
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0xd6d2c
jmp 0x2fc40