#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 */

/* Variables and functions */
int /*<<< orphan*/ *getenv(char *);
int /*<<< orphan*/ printf(char *, char *);
int run_file(char *, int);
int main(int argc, char **argv) {
  int dump_registers = 0;
  if (argc < 2) {
    printf("Usage: %s input-file\n", argv[0]);
    return 0;
  }
  if (getenv("DEBUG") != NULL)
    dump_registers = 1;
  return (run_file(argv[1], dump_registers));
}


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)
movl   $0x0,-0x14(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1176 <main+0x46>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe9b(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11a6 <main+0x76>
lea    0xe99(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     1193 <main+0x63>
movl   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x14(%rbp),%esi
call   1040 <run_file@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x1,%edi
jg     114c <main+0x1c>
mov    (%rbx),%rsi
lea    0xebd(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret
lea    0xec3(%rip),%rdi
call   1030 <getenv@plt>
xor    %esi,%esi
test   %rax,%rax
setne  %sil
mov    0x8(%rbx),%rdi
pop    %rbx
jmp    1040 <run_file@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"Usage: %s input-file\0A\00"
@.str.1 = [6 x i8] c"DEBUG\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %12)
store i32 0, i32* %3
br label %24
14: ; preds = %2
%15 = call i32* @getenv(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp ne i32* %15, null
br i1 %16, label %17, label %18
17: ; preds = %14
store i32 1, i32* %6
br label %18
18: ; preds = %17, %14
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = load i32, i32* %6
%23 = call i32 @run_file(i8* %21, i32 %22)
store i32 %23, i32* %3
br label %24
24: ; preds = %18, %9
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
@.str = [22 x i8] c"Usage: %s input-file\0A\00"
@.str.1 = [6 x i8] c"DEBUG\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %14
7: ; preds = %2
%8 = tail call i32* @getenv(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp ne i32* %8, null
%10 = zext i1 %9 to i32
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @run_file(i8* %12, i32 %10)
br label %14
14: ; preds = %7, %4
%15 = phi i32 [ 0, %4 ], [ %13, %7 ]
ret i32 %15
}