#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
scalar_t__ ENOENT;
int /*<<< orphan*/ abort();
scalar_t__ errno;
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *, int);
int stat(char *, struct stat *);
scalar_t__ unlink(char *);
void delete_file(char *name) {
  if (!(unlink("writev_test.tmp") == 0)) {
    if (errno != ENOENT)
      perror("error unlinking");
  }
  errno = 0;
  {
    struct stat s;
    int statval = stat("writev_test.tmp", &s);
    do {
      if (!(statval == -1)) {
        printf(
            "%s:%d **************** assertion failure\n",
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/benjaminy/Charcoal/refs/heads/linReg/"
            "ThirdParty/cil/Charcoal-1.7.3/test/small2/writev.c",
            36);
        abort();
      }
    } while (0);
    do {
      if (!(errno == ENOENT)) {
        printf(
            "%s:%d **************** assertion failure\n",
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/benjaminy/Charcoal/refs/heads/linReg/"
            "ThirdParty/cil/Charcoal-1.7.3/test/small2/writev.c",
            37);
        abort();
      }
    } while (0);
  }
}


x86 assembly (clang, -O0):
<delete_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xe9d(%rip),%rdi
call   1040 <unlink@plt>
cmp    $0x0,%rax
je     119d <delete_file+0x4d>
mov    0x2e67(%rip),%rax
mov    (%rax),%rax
mov    0x2e4d(%rip),%rcx
cmp    (%rcx),%rax
je     1198 <delete_file+0x48>
lea    0xe7d(%rip),%rdi
call   1070 <perror@plt>
jmp    119d <delete_file+0x4d>
mov    0x2e3c(%rip),%rax
movq   $0x0,(%rax)
lea    0xe4e(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <stat@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
je     11e7 <delete_file+0x97>
lea    0xe51(%rip),%rdi
lea    0xe74(%rip),%rsi
mov    $0x24,%edx
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    11ec <delete_file+0x9c>
jmp    11f1 <delete_file+0xa1>
mov    0x2de8(%rip),%rax
mov    (%rax),%rax
mov    0x2dce(%rip),%rcx
cmp    (%rcx),%rax
je     122a <delete_file+0xda>
lea    0xe0e(%rip),%rdi
lea    0xe31(%rip),%rsi
mov    $0x25,%edx
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    122f <delete_file+0xdf>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delete_file>:
push   %rbx
sub    $0x10,%rsp
lea    0xea4(%rip),%rdi
call   1040 <unlink@plt>
test   %rax,%rax
je     117c <delete_file+0x2c>
mov    0x2e73(%rip),%rax
mov    (%rax),%rax
mov    0x2e59(%rip),%rcx
cmp    (%rcx),%rax
jne    11b5 <delete_file+0x65>
mov    0x2e5d(%rip),%rbx
movq   $0x0,(%rbx)
lea    0xe6f(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1060 <stat@plt>
cmp    $0xffffffff,%eax
jne    11c3 <delete_file+0x73>
mov    (%rbx),%rax
mov    0x2e26(%rip),%rcx
cmp    (%rcx),%rax
jne    11d8 <delete_file+0x88>
add    $0x10,%rsp
pop    %rbx
ret
lea    0xe54(%rip),%rdi
call   1070 <perror@plt>
jmp    117c <delete_file+0x2c>
lea    0xe56(%rip),%rdi
lea    0xe79(%rip),%rsi
mov    $0x24,%edx
jmp    11eb <delete_file+0x9b>
lea    0xe41(%rip),%rdi
lea    0xe64(%rip),%rsi
mov    $0x25,%edx
call   1050 <printf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [16 x i8] c"writev_test.tmp\00"
@errno = global i64 0
@ENOENT = global i64 0
@.str.1 = [16 x i8] c"error unlinking\00"
@.str.2 = [42 x i8] c"%s:%d **************** assertion failure\0A\00"
@.str.3 = [178 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/benjaminy/Charcoal/refs/heads/linReg/ThirdParty/cil/Charcoal-1.7.3/test/small2/writev.c\00"
define void @delete_file(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.stat
%4 = alloca i32
store i8* %0, i8** %2
%5 = call i64 @unlink(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %1
%8 = load i64, i64* @errno
%9 = load i64, i64* @ENOENT
%10 = icmp ne i64 %8, %9
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %11, %7
br label %14
14: ; preds = %13, %1
store i64 0, i64* @errno
%15 = call i32 @stat(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), %struct.stat* %3)
store i32 %15, i32* %4
br label %16
16: ; preds = %14
%17 = load i32, i32* %4
%18 = icmp eq i32 %17, -1
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([178 x i8], [178 x i8]* @.str.3, i64 0, i64 0), i32 36)
%21 = call i32 (...) @abort()
unreachable
22: ; preds = %16
br label %23
23: ; preds = %22
br label %24
24: ; preds = %23
%25 = load i64, i64* @errno
%26 = load i64, i64* @ENOENT
%27 = icmp eq i64 %25, %26
br i1 %27, label %31, label %28
28: ; preds = %24
%29 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([178 x i8], [178 x i8]* @.str.3, i64 0, i64 0), i32 37)
%30 = call i32 (...) @abort()
unreachable
31: ; preds = %24
br label %32
32: ; preds = %31
ret void
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [16 x i8] c"writev_test.tmp\00"
@errno = global i64 0
@ENOENT = global i64 0
@.str.1 = [16 x i8] c"error unlinking\00"
@.str.2 = [42 x i8] c"%s:%d **************** assertion failure\0A\00"
@.str.3 = [178 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/benjaminy/Charcoal/refs/heads/linReg/ThirdParty/cil/Charcoal-1.7.3/test/small2/writev.c\00"
define void @delete_file(i8* nocapture readnone %0) {
%2 = alloca %struct.stat
%3 = tail call i64 @unlink(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
br i1 %4, label %11, label %5
5: ; preds = %1
%6 = load i64, i64* @errno
%7 = load i64, i64* @ENOENT
%8 = icmp eq i64 %6, %7
br i1 %8, label %11, label %9
9: ; preds = %5
%10 = tail call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %5, %9, %1
store i64 0, i64* @errno
%12 = bitcast %struct.stat* %2 to i8*
%13 = call i32 @stat(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), %struct.stat* %2)
%14 = icmp eq i32 %13, -1
br i1 %14, label %18, label %15
15: ; preds = %11
%16 = tail call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([178 x i8], [178 x i8]* @.str.3, i64 0, i64 0), i32 36)
%17 = tail call i32 (...) @abort()
unreachable
18: ; preds = %11
%19 = load i64, i64* @errno
%20 = load i64, i64* @ENOENT
%21 = icmp eq i64 %19, %20
br i1 %21, label %25, label %22
22: ; preds = %18
%23 = tail call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([178 x i8], [178 x i8]* @.str.3, i64 0, i64 0), i32 37)
%24 = tail call i32 (...) @abort()
unreachable
25: ; preds = %18
ret void
}