#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(int);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *);
void test7() {
  char file[200] = "/home/liquid/eclipseprojects/botzilladata/signatures/test/"
                   "1c1bc117650566267c6ef0a4138a57a5.sig";
  FILE *fp;
  if ((fp = fopen(file, "r")) == NULL) {
    printf("Cannot open file.\n");
    exit(1);
  } else
    printf("Opening file ok.\n");
}


x86 assembly (clang, -O0):
<test7>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
lea    -0xd0(%rbp),%rdi
lea    0xea7(%rip),%rsi
mov    $0xc8,%edx
call   1040 <memcpy@plt>
lea    -0xd0(%rbp),%rdi
lea    0xf57(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0xd8(%rbp)
cmp    $0x0,%rax
jne    119d <test7+0x5d>
lea    0xf3c(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
lea    0xf39(%rip),%rdi
call   1030 <printf@plt>
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test7>:
push   %rbx
sub    $0xd0,%rsp
lea    0xeb1(%rip),%rsi
mov    %rsp,%rbx
mov    $0xc8,%edx
mov    %rbx,%rdi
call   1040 <memcpy@plt>
lea    0xf62(%rip),%rsi
mov    %rbx,%rdi
call   1050 <fopen@plt>
test   %rax,%rax
je     1187 <test7+0x47>
lea    0xf50(%rip),%rdi
add    $0xd0,%rsp
pop    %rbx
jmp    1030 <puts@plt>
lea    0xf4d(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@__const.test7.file = [200 x i8] c"/home/liquid/eclipseprojects/botzilladata/signatures/test/1c1bc117650566267c6ef0a4138a57a5.sig\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [2 x i8] c"r\00"
@.str.1 = [19 x i8] c"Cannot open file.\0A\00"
@.str.2 = [18 x i8] c"Opening file ok.\0A\00"
define void @test7() {
%1 = alloca [200 x i8]
%2 = alloca i32*
%3 = bitcast [200 x i8]* %1 to i8*
%4 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 0
%5 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %5, i32** %2
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @exit(i32 1)
unreachable
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %12
12: ; preds = %10
ret void
}

LLVM IR (-O2):
@__const.test7.file = [200 x i8] c"/home/liquid/eclipseprojects/botzilladata/signatures/test/1c1bc117650566267c6ef0a4138a57a5.sig\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [2 x i8] c"r\00"
@str = [17 x i8] c"Opening file ok.\00"
@str.3 = [18 x i8] c"Cannot open file.\00"
define void @test7() {
%1 = alloca [200 x i8]
%2 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 0
%3 = call i32* @fopen(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.3, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %0
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
ret void
}