#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*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ makeTrie(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int main(int argc, char *args[]) {
  char *file = args[1];
  FILE *f;
  f = fopen(file, "r");
  if (f == NULL) {
    fprintf(stderr, "Error: file not found\n");
    return 1;
  }
  makeTrie(f);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xea3(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1192 <main+0x62>
mov    0x2e68(%rip),%rax
mov    (%rax),%edi
lea    0xe81(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11a2 <main+0x72>
mov    -0x20(%rbp),%rdi
call   1030 <makeTrie@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rdi
lea    0xec4(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     1152 <main+0x22>
mov    %rax,%rdi
call   1030 <makeTrie@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
lea    0xea0(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [23 x i8] c"Error: file not found\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
store i8* %10, i8** %6
%11 = load i8*, i8** %6
%12 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %12, i32** %7
%13 = load i32*, i32** %7
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %18
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %21
18: ; preds = %2
%19 = load i32*, i32** %7
%20 = call i32 @makeTrie(i32* %19)
store i32 0, i32* %3
br label %21
21: ; preds = %18, %15
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [23 x i8] c"Error: file not found\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %12
10: ; preds = %2
%11 = tail call i32 @makeTrie(i32* %5)
br label %12
12: ; preds = %10, %7
%13 = phi i32 [ 1, %7 ], [ 0, %10 ]
ret i32 %13
}