#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 /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ run_tokenizer(int /*<<< orphan*/ *);
int /*<<< orphan*/ *stdin;
int main(int argc, char **argv) {
  if (argc > 1) {
    printf("Batch mode! File name is %s\n", argv[1]);
    FILE *f = fopen(argv[1], "r");
    run_tokenizer(f);
    fclose(f);
    exit(0);
  } else {
    run_tokenizer(stdin);
  }
  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)
cmpl   $0x1,-0x8(%rbp)
jle    11b5 <main+0x65>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe81(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe8a(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <run_tokenizer@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
xor    %edi,%edi
call   1070 <exit@plt>
mov    0x2e2c(%rip),%rax
mov    (%rax),%rdi
call   1030 <run_tokenizer@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jge    1169 <main+0x19>
mov    0x2e8b(%rip),%rax
mov    (%rax),%rdi
call   1030 <run_tokenizer@plt>
xor    %eax,%eax
pop    %rbx
ret
mov    %rsi,%rbx
mov    0x8(%rsi),%rsi
lea    0xe89(%rip),%rdi
call   1050 <printf@plt>
mov    0x8(%rbx),%rdi
lea    0xe96(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <run_tokenizer@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"Batch mode! File name is %s\0A\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32* null
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
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %23
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32* @fopen(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %17, i32** %6
%18 = load i32*, i32** %6
%19 = call i32 @run_tokenizer(i32* %18)
%20 = load i32*, i32** %6
%21 = call i32 @fclose(i32* %20)
%22 = call i32 @exit(i32 0)
unreachable
23: ; preds = %2
%24 = load i32*, i32** @stdin
%25 = call i32 @run_tokenizer(i32* %24)
br label %26
26: ; preds = %23
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"Batch mode! File name is %s\0A\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32* null
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i8*, i8** %5
%9 = tail call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 @run_tokenizer(i32* %9)
%11 = tail call i32 @fclose(i32* %9)
%12 = tail call i32 @exit(i32 0)
unreachable
13: ; preds = %2
%14 = load i32*, i32** @stdin
%15 = tail call i32 @run_tokenizer(i32* %14)
ret i32 0
}