#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 */

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int O_CREAT;
int O_EXCL;
int O_WRONLY;
int close(int);
int errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int open(char const *, int, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
char *strerror(int);
void CreateFile(const char *path) {
  int handle;
  if ((handle = open(path, O_CREAT | O_WRONLY | O_EXCL, 0666)) == -1) {
    int e = errno;
    fprintf(stderr,
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/BobBuildTool/bob/refs/heads/master/src/"
            "namespace-sandbox/namespace-sandbox.c"
            ":"
            "405"
            ": "
            "cannot create %s",
            path);
    fprintf(stderr, ": %s\n", strerror(e));
    exit(EXIT_FAILURE);
  };
  if ((close(handle)) == -1) {
    fprintf(stderr, "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                    "outputs/2022-01-22/02-19-57/repos/BobBuildTool/bob/refs/"
                    "heads/master/src/namespace-sandbox/namespace-sandbox.c"
                    ":"
                    "407"
                    ": ");
    perror("close(handle)");
    exit(EXIT_FAILURE);
  };
}


x86 assembly (clang, -O0):
<CreateFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e81(%rip),%rax
mov    (%rax),%esi
mov    0x2e30(%rip),%rax
or     (%rax),%esi
mov    0x2e47(%rip),%rax
or     (%rax),%esi
mov    $0x1b6,%edx
call   1050 <open@plt>
mov    %eax,-0xc(%rbp)
cmp    $0xffffffff,%eax
jne    11fe <CreateFile+0x9e>
mov    0x2e20(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    0x2e24(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe3f(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e09(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%edi
call   1080 <strerror@plt>
mov    -0x14(%rbp),%edi
mov    %rax,%rdx
lea    0xed4(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2dc9(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0xc(%rbp),%edi
call   1030 <close@plt>
cmp    $0xffffffff,%eax
jne    1240 <CreateFile+0xe0>
mov    0x2dc2(%rip),%rax
mov    (%rax),%edi
lea    0xea4(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
lea    0xf43(%rip),%rdi
call   1060 <perror@plt>
mov    0x2d87(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CreateFile>:
push   %rbp
push   %r14
push   %rbx
mov    0x2e8d(%rip),%rax
mov    0x2e3e(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    %rdi,%rbx
mov    0x2e50(%rip),%rax
or     (%rax),%esi
mov    $0x1b6,%edx
call   1050 <open@plt>
cmp    $0xffffffff,%eax
je     11a2 <CreateFile+0x42>
mov    %eax,%edi
call   1030 <close@plt>
cmp    $0xffffffff,%eax
je     11e5 <CreateFile+0x85>
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x2e1f(%rip),%rax
mov    (%rax),%ebp
mov    0x2e26(%rip),%r14
mov    (%r14),%edi
lea    0xe44(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%ebx
mov    %ebp,%edi
call   1080 <strerror@plt>
lea    0xee6(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    1208 <CreateFile+0xa8>
mov    0x2dec(%rip),%rax
mov    (%rax),%edi
lea    0xece(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xf6d(%rip),%rdi
call   1060 <perror@plt>
mov    0x2db1(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@O_CREAT = global i32 0
@O_WRONLY = global i32 0
@O_EXCL = global i32 0
@errno = global i32 0
@stderr = global i32 0
@.str = [189 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/BobBuildTool/bob/refs/heads/master/src/namespace-sandbox/namespace-sandbox.c:405: cannot create %s\00"
@.str.1 = [6 x i8] c": %s\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [173 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/BobBuildTool/bob/refs/heads/master/src/namespace-sandbox/namespace-sandbox.c:407: \00"
@.str.3 = [14 x i8] c"close(handle)\00"
define void @CreateFile(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = load i32, i32* @O_CREAT
%7 = load i32, i32* @O_WRONLY
%8 = or i32 %6, %7
%9 = load i32, i32* @O_EXCL
%10 = or i32 %8, %9
%11 = call i32 @open(i8* %5, i32 %10, i32 438)
store i32 %11, i32* %3
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %24
13: ; preds = %1
%14 = load i32, i32* @errno
store i32 %14, i32* %4
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %2
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([189 x i8], [189 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = load i32, i32* @stderr
%19 = load i32, i32* %4
%20 = call i8* @strerror(i32 %19)
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %20)
%22 = load i32, i32* @EXIT_FAILURE
%23 = call i32 @exit(i32 %22)
unreachable
24: ; preds = %1
%25 = load i32, i32* %3
%26 = call i32 @close(i32 %25)
%27 = icmp eq i32 %26, -1
br i1 %27, label %28, label %34
28: ; preds = %24
%29 = load i32, i32* @stderr
%30 = call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([173 x i8], [173 x i8]* @.str.2, i64 0, i64 0))
%31 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%32 = load i32, i32* @EXIT_FAILURE
%33 = call i32 @exit(i32 %32)
unreachable
34: ; preds = %24
ret void
}

LLVM IR (-O2):
@O_CREAT = global i32 0
@O_WRONLY = global i32 0
@O_EXCL = global i32 0
@errno = global i32 0
@stderr = global i32 0
@.str = [189 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/BobBuildTool/bob/refs/heads/master/src/namespace-sandbox/namespace-sandbox.c:405: cannot create %s\00"
@.str.1 = [6 x i8] c": %s\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [173 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/BobBuildTool/bob/refs/heads/master/src/namespace-sandbox/namespace-sandbox.c:407: \00"
@.str.3 = [14 x i8] c"close(handle)\00"
define void @CreateFile(i8* %0) {
%2 = load i32, i32* @O_CREAT
%3 = load i32, i32* @O_WRONLY
%4 = or i32 %3, %2
%5 = load i32, i32* @O_EXCL
%6 = or i32 %4, %5
%7 = tail call i32 @open(i8* %0, i32 %6, i32 438)
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %18
9: ; preds = %1
%10 = load i32, i32* @errno
%11 = load i32, i32* @stderr
%12 = tail call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([189 x i8], [189 x i8]* @.str, i64 0, i64 0), i8* %0)
%13 = load i32, i32* @stderr
%14 = tail call i8* @strerror(i32 %10)
%15 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = load i32, i32* @EXIT_FAILURE
%17 = tail call i32 @exit(i32 %16)
unreachable
18: ; preds = %1
%19 = tail call i32 @close(i32 %7)
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %27
21: ; preds = %18
%22 = load i32, i32* @stderr
%23 = tail call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([173 x i8], [173 x i8]* @.str.2, i64 0, i64 0))
%24 = tail call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%25 = load i32, i32* @EXIT_FAILURE
%26 = tail call i32 @exit(i32 %25)
unreachable
27: ; preds = %18
ret void
}