#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ process_file(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ usage();
int main(int argc, char **argv) {
  char *data_filename;
  if (argc == 2) {
    data_filename = argv[1];
  } else if (argc == 1) {
    data_filename = NULL;
  } else {
    fprintf(stderr, "Can't read from multiple input files.\n");
    usage();
    exit(1);
  }
  process_file(data_filename);
  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   $0x2,-0x8(%rbp)
jne    1171 <main+0x31>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    11b3 <main+0x73>
cmpl   $0x1,-0x8(%rbp)
jne    1188 <main+0x48>
movq   $0x0,-0x18(%rbp)
jmp    11ae <main+0x6e>
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
lea    0xe68(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1050 <usage@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
jmp    11b3 <main+0x73>
mov    -0x18(%rbp),%rdi
call   1030 <process_file@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x1,%edi
je     1151 <main+0x11>
cmp    $0x2,%edi
jne    115c <main+0x1c>
mov    0x8(%rsi),%rdi
jmp    1153 <main+0x13>
xor    %edi,%edi
call   1030 <process_file@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
lea    0xe94(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1050 <usage@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [39 x i8] c"Can't read from multiple input files.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 2
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
store i8* %12, i8** %6
br label %23
13: ; preds = %2
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %17
16: ; preds = %13
store i8* null, i8** %6
br label %22
17: ; preds = %13
%18 = load i32, i32* @stderr
%19 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%20 = call i32 (...) @usage()
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %16
br label %23
23: ; preds = %22, %9
%24 = load i8*, i8** %6
%25 = call i32 @process_file(i8* %24)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [39 x i8] c"Can't read from multiple input files.\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %6 [
i32 2, label %3
i32 1, label %11
]
3: ; preds = %2
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
br label %11
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 (...) @usage()
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2, %3
%12 = phi i8* [ %5, %3 ], [ null, %2 ]
%13 = tail call i32 @process_file(i8* %12)
ret i32 0
}