#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int puts(char *);
int main(int argc, char **argv) {
  char *newfile = "/testfile.txt";
  FILE *fp = fopen(newfile, "r");
  if (fp == NULL) {
    return 0;
  }
  fprintf(fp, "%s\n", "error reporting");
  int o = puts("sfasdfsfdfff");
  printf("%d\n", o);
  fclose(fp);
  char *longstring = "i hope i can find a likely girl";
  printf("%s\n", longstring + 8);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe93(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe92(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    119c <main+0x4c>
movl   $0x0,-0x4(%rbp)
jmp    11fd <main+0xad>
mov    -0x20(%rbp),%rdi
lea    0xe69(%rip),%rsi
lea    0xe66(%rip),%rdx
call   1060 <fprintf@plt>
lea    0xe6a(%rip),%rdi
call   1030 <puts@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
lea    0xe52(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rsi
add    $0x8,%rsi
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xea8(%rip),%rdi
lea    0xeaf(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     11b2 <main+0x62>
mov    %rax,%rbx
lea    0xe9d(%rip),%rsi
lea    0xe9a(%rip),%rdx
mov    %rax,%rdi
call   1060 <fprintf@plt>
lea    0xe9b(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9c(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xe90(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"/testfile.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [16 x i8] c"error reporting\00"
@.str.4 = [13 x i8] c"sfasdfsfdfff\00"
@.str.5 = [4 x i8] c"%d\0A\00"
@.str.6 = [32 x i8] c"i hope i can find a likely girl\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %6
%10 = load i8*, i8** %6
%11 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %11, i32** %7
%12 = load i32*, i32** %7
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %15
14: ; preds = %2
store i32 0, i32* %3
br label %26
15: ; preds = %2
%16 = load i32*, i32** %7
%17 = call i32 @fprintf(i32* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
store i32 %18, i32* %8
%19 = load i32, i32* %8
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %19)
%21 = load i32*, i32** %7
%22 = call i32 @fclose(i32* %21)
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i8** %9
%23 = load i8*, i8** %9
%24 = getelementptr inbounds i8, i8* %23, i64 8
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %24)
br label %26
26: ; preds = %15, %14
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@.str = [14 x i8] c"/testfile.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [16 x i8] c"error reporting\00"
@.str.4 = [13 x i8] c"sfasdfsfdfff\00"
@.str.5 = [4 x i8] c"%d\0A\00"
@.str.6 = [32 x i8] c"i hope i can find a likely girl\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %11, label %5
5: ; preds = %2
%6 = tail call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %7)
%9 = tail call i32 @fclose(i32* %3)
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 8))
br label %11
11: ; preds = %2, %5
ret i32 0
}