#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*/ eipa_free(void **, int, char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ printf(char *);
void filename(char *text, char *fname) {
  FILE *f = fopen(fname, "w");
  if (f == NULL) {
    printf("Error opening file!\n");
    exit(EXIT_FAILURE);
  }
  fprintf(f, "%s", text);
  fclose(f);
  eipa_free((void **)(&(text)), 221,
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/WikiDreams/CUDA-SAK/refs/heads/master/"
            "Cuda-SAK/functions.c");
}


x86 assembly (clang, -O0):
<filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe85(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11a9 <filename+0x49>
lea    0xe6c(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe5f(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
lea    -0x8(%rbp),%rdi
mov    $0xdd,%esi
lea    0xe44(%rip),%rdx
call   1060 <eipa_free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filename>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rax
mov    %rdi,%r14
mov    %rdi,(%rsp)
lea    0xe8b(%rip),%rsi
mov    %rax,%rdi
call   1070 <fopen@plt>
test   %rax,%rax
je     11b4 <filename+0x54>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1050 <fputs@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xe63(%rip),%rdx
mov    %rsp,%rdi
mov    $0xdd,%esi
call   1060 <eipa_free@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xedc(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e19(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"w\00"
@.str.1 = [21 x i8] c"Error opening file!\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [149 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/WikiDreams/CUDA-SAK/refs/heads/master/Cuda-SAK/functions.c\00"
define void @filename(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %7, i32** %5
%8 = load i32*, i32** %5
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%12 = load i32, i32* @EXIT_FAILURE
%13 = call i32 @exit(i32 %12)
unreachable
14: ; preds = %2
%15 = load i32*, i32** %5
%16 = load i8*, i8** %3
%17 = call i32 @fprintf(i32* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %16)
%18 = load i32*, i32** %5
%19 = call i32 @fclose(i32* %18)
%20 = call i32 @eipa_free(i8** %3, i32 221, i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"w\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [149 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/WikiDreams/CUDA-SAK/refs/heads/master/Cuda-SAK/functions.c\00"
@str = [20 x i8] c"Error opening file!\00"
define void @filename(i8* %0, i8* nocapture %1) {
%3 = alloca i8*
store i8* %0, i8** %3
%4 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %2
%11 = tail call i32 @fputs(i8* %0, i32* %4)
%12 = tail call i32 @fclose(i32* %4)
%13 = call i32 @eipa_free(i8** %3, i32 221, i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.3, i64 0, i64 0))
ret void
}