// File: /workspace/github_c_makefile_star2_O1/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 0x1773f9(%rip), %rax    # 0x1a8dd0
movq (%rax), %rsi
leaq 0x28(%rsp), %rbx
movq %rbx, %rdi
callq 0xe0431
movq $0x0, 0x10(%rbx)
testq %r14, %r14
je 0x319f8
movb $0x1, (%r14)
movq %r13, %rdi
callq 0xc90fb
testb %al, %al
je 0x31d40
movq %r12, 0x18(%rsp)
movq %r15, 0x10(%rsp)
movq %r14, 0x20(%rsp)
movabsq $-0x503db0e6e1c2e704, %r15 # imm = 0xAFC24F191E3D18FC
movq %r13, 0x8(%rsp)
movq %r13, %rdi
callq 0xc92d1
leaq 0x28(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
movq %rax, %rdx
callq 0xe0900
movq %rax, %r14
xorl %eax, %eax
callq 0x114bbb
movq %rbx, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %rax, %rcx
callq 0xe0676
movq %rax, %r12
leaq 0x178264(%rip), %rbx    # 0x1a9cc8
leaq 0x58(%rsp), %r15
movq (%r14), %r13
movl (%rbx), %eax
cltq
leaq (%rax,%rax,2), %rax
movq 0x20(%rbx,%rax,8), %rcx
movq 0x18(%rbx,%rax,8), %rdx
andq %r13, %rdx
shlq $0x4, %rdx
leaq (%rcx,%rdx), %rax
movq (%rcx,%rdx), %rdx
movl $0x8, %ecx
cmpq %r13, %rdx
je 0x31ac5
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %r13, %rdx
je 0x31ac5
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %r13, %rdx
je 0x31ac5
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %r13, %rdx
jne 0x31bbe
movq (%rax,%rcx), %rbp
testq %rbp, %rbp
jne 0x31af1
movabsq $-0x7e8ee9b9b4bbaa8, %rdi # imm = 0xF817116464B44558
movq %r13, %rsi
callq 0xf3f85
movq %rax, %rbp
movq %rbx, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x12128c
cmpq $0x0, 0x40(%rbp)
jne 0x31b07
movq %rbp, %rdi
leaq 0x11340f(%rip), %rsi    # 0x144f11
callq 0xf592c
movq %r14, %rdi
callq *0x40(%rbp)
testb %al, %al
jne 0x31bc9
movq (%r14), %r13
movl (%rbx), %eax
cltq
leaq (%rax,%rax,2), %rax
movq 0x20(%rbx,%rax,8), %rcx
movq 0x18(%rbx,%rax,8), %rdx
andq %r13, %rdx
shlq $0x4, %rdx
leaq (%rcx,%rdx), %rax
movq (%rcx,%rdx), %rdx
movl $0x8, %ecx
cmpq %r13, %rdx
je 0x31b6d
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %r13, %rdx
je 0x31b6d
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %r13, %rdx
je 0x31b6d
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %r13, %rdx
jne 0x31bc5
movq (%rax,%rcx), %rbp
testq %rbp, %rbp
jne 0x31b99
movabsq $-0x7e8ee9b9b4bbaa8, %rdi # imm = 0xF817116464B44558
movq %r13, %rsi
callq 0xf3f85
movq %rax, %rbp
movq %rbx, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x12128c
movb $0x0, 0x58(%rsp)
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq *0x10(%rbp)
movsbl 0x58(%rsp), %esi
movq %r12, %rdi
callq 0x115381
jmp 0x31a69
xorl %ebp, %ebp
jmp 0x31ac9
xorl %ebp, %ebp
jmp 0x31b71
movq %r12, %rdi
callq 0x32ea9
testb %al, %al
movq 0x20(%rsp), %r14
movq 0x18(%rsp), %r13
jne 0x31d12
movq %r15, (%rsp)
leaq 0x28(%rsp), %rsi
movq %r15, %rdi
callq 0xe0431
movq (%rsp), %rbx
movq $0x1, 0x10(%rbx)
xorl %eax, %eax
callq 0x114bbb
movl $0x1, %esi
movq %rbx, %rdi
movabsq $-0x503db0e6e1c2e704, %rdx # imm = 0xAFC24F191E3D18FC
movq %rax, %rcx
callq 0xe0676
movq %rax, %rbx
leaq 0x109277(%rip), %rsi    # 0x13aea2
movq %rax, %rdi
movq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0x1157cb
leaq 0x109290(%rip), %rsi    # 0x13aed1
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1157cb
movb 0x182(%r13), %bpl
cmpb $0x1, %bpl
jne 0x31c98
testq %r14, %r14
je 0x31c61
movb $0x1, (%r14)
leaq 0x1092b3(%rip), %rsi    # 0x13af1b
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1157cb
leaq 0x177177(%rip), %rax    # 0x1a8df0
movq (%rax), %rdi
movq 0x8(%rbx), %rdx
leaq 0x1092e5(%rip), %rsi    # 0x13af6c
xorl %eax, %eax
callq 0xee2a
movq %rsp, %rdi
callq 0xe0b11
jmp 0x31d0d
testq %r14, %r14
je 0x31ca1
movb $0x0, (%r14)
leaq 0x1092d7(%rip), %rsi    # 0x13af7f
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1157cb
leaq 0x10930d(%rip), %rsi    # 0x13afc6
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1157cb
leaq 0x109326(%rip), %rsi    # 0x13aff0
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1157cb
leaq 0x109335(%rip), %rsi    # 0x13b010
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1157cb
movq 0x8(%rbx), %rdx
leaq 0x10933f(%rip), %rsi    # 0x13b02f
movabsq $0x4d9e984c5b21faea, %rdi # imm = 0x4D9E984C5B21FAEA
xorl %eax, %eax
callq 0xc87b0
movq %rax, %rbx
movq (%rsp), %rdi
callq 0xe0b30
testb %bpl, %bpl
je 0x31d4c
testq %r14, %r14
sete %al
movq 0x10(%rsp), %rbx
testq %rbx, %rbx
sete %cl
orb %al, %cl
jne 0x31d40
cmpb $0x0, 0x183(%r13)
jne 0x31d40
movq %r12, %rdi
callq 0x32fd9
cmpq %rbx, %rax
setne (%r14)
leaq 0x28(%rsp), %rdi
callq 0xe0b30
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq