#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *, int, char const *);
void create_empty_file(const char *filename) {
  FILE *out;
  out = fopen(filename, "w");
  if (out == NULL) {
    perror("fopen()");
    printf("%s:%d filename = %s\n",
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/niven/connect4/refs/heads/master/utils.c",
           72, filename);
    exit(EXIT_FAILURE);
  };
  fclose(out);
}


x86 assembly (clang, -O0):
<create_empty_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe99(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11b1 <create_empty_file+0x61>
lea    0xe80(%rip),%rdi
call   1060 <perror@plt>
mov    -0x8(%rbp),%rcx
lea    0xe78(%rip),%rdi
lea    0xe86(%rip),%rsi
mov    $0x48,%edx
call   1040 <printf@plt>
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_empty_file>:
push   %rbx
mov    %rdi,%rbx
lea    0xea5(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     116e <create_empty_file+0x1e>
mov    %rax,%rdi
pop    %rbx
jmp    1030 <fclose@plt>
lea    0xe8d(%rip),%rdi
call   1060 <perror@plt>
lea    0xe89(%rip),%rdi
lea    0xe97(%rip),%rsi
mov    $0x48,%edx
mov    %rbx,%rcx
call   1040 <printf@plt>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"w\00"
@.str.1 = [8 x i8] c"fopen()\00"
@.str.2 = [21 x i8] c"%s:%d filename = %s\0A\00"
@.str.3 = [131 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/niven/connect4/refs/heads/master/utils.c\00"
@EXIT_FAILURE = global i32 0
define void @create_empty_file(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %14
8: ; preds = %1
%9 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%10 = load i8*, i8** %2
%11 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([131 x i8], [131 x i8]* @.str.3, i64 0, i64 0), i32 72, i8* %10)
%12 = load i32, i32* @EXIT_FAILURE
%13 = call i32 @exit(i32 %12)
unreachable
14: ; preds = %1
%15 = load i32*, i32** %3
%16 = call i32 @fclose(i32* %15)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"w\00"
@.str.1 = [8 x i8] c"fopen()\00"
@.str.2 = [21 x i8] c"%s:%d filename = %s\0A\00"
@.str.3 = [131 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/niven/connect4/refs/heads/master/utils.c\00"
@EXIT_FAILURE = global i32 0
define void @create_empty_file(i8* %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([131 x i8], [131 x i8]* @.str.3, i64 0, i64 0), i32 72, i8* %0)
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %1
%10 = tail call i32 @fclose(i32* %2)
ret void
}