#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*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ latex_print_footer();
int /*<<< orphan*/ latex_print_header();
scalar_t__ open_conllx(char const *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  const char *filename = NULL;
  if (argc == 1) {
    filename = "-";
  } else if (argc == 2) {
    filename = argv[1];
  } else {
    fprintf(stderr, "Usage: %s filename\n", argv[0]);
    return -1;
  }
  latex_print_header();
  if (open_conllx(filename) != 0) {
    fprintf(stderr, "ERROR: failed to open %s\n", argv[1]);
    return -1;
  }
  latex_print_footer();
  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)
movq   $0x0,-0x18(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1178 <main+0x38>
lea    0xe91(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    11c0 <main+0x80>
cmpl   $0x2,-0x8(%rbp)
jne    1193 <main+0x53>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    11bb <main+0x7b>
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe58(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1211 <main+0xd1>
jmp    11c0 <main+0x80>
mov    $0x0,%al
call   1030 <latex_print_header@plt>
mov    -0x18(%rbp),%rdi
call   1040 <open_conllx@plt>
cmp    $0x0,%rax
je     1203 <main+0xc3>
mov    0x2dff(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe24(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1211 <main+0xd1>
mov    $0x0,%al
call   1060 <latex_print_footer@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
cmp    $0x1,%edi
je     1157 <main+0x17>
cmp    $0x2,%edi
jne    118a <main+0x4a>
mov    0x8(%r14),%rbx
jmp    115e <main+0x1e>
lea    0xea2(%rip),%rbx
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <latex_print_header@plt>
mov    %rbx,%rdi
call   1040 <open_conllx@plt>
test   %rax,%rax
je     11a9 <main+0x69>
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
mov    0x8(%r14),%rdx
lea    0xe8e(%rip),%rsi
jmp    119d <main+0x5d>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xe65(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%ebp
jmp    11b0 <main+0x70>
xor    %eax,%eax
call   1060 <latex_print_footer@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"-\00"
@stderr = global i32 0
@.str.1 = [20 x i8] c"Usage: %s filename\0A\00"
@.str.2 = [26 x i8] c"ERROR: failed to open %s\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
store i8* null, i8** %6
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %10
9: ; preds = %2
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %6
br label %24
10: ; preds = %2
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 2
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
store i8* %16, i8** %6
br label %23
17: ; preds = %10
%18 = load i32, i32* @stderr
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %21)
store i32 -1, i32* %3
br label %37
23: ; preds = %13
br label %24
24: ; preds = %23, %9
%25 = call i32 (...) @latex_print_header()
%26 = load i8*, i8** %6
%27 = call i64 @open_conllx(i8* %26)
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %35
29: ; preds = %24
%30 = load i32, i32* @stderr
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %33)
store i32 -1, i32* %3
br label %37
35: ; preds = %24
%36 = call i32 (...) @latex_print_footer()
store i32 0, i32* %3
br label %37
37: ; preds = %35, %29, %17
%38 = load i32, i32* %3
ret i32 %38
}

LLVM IR (-O2):
@.str = [2 x i8] c"-\00"
@stderr = global i32 0
@.str.1 = [20 x i8] c"Usage: %s filename\0A\00"
@.str.2 = [26 x i8] c"ERROR: failed to open %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %6 [
i32 1, label %10
i32 2, label %3
]
3: ; preds = %2
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
br label %10
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %8)
br label %22
10: ; preds = %2, %3
%11 = phi i8* [ %5, %3 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %2 ]
%12 = tail call i32 (...) @latex_print_header()
%13 = tail call i64 @open_conllx(i8* %11)
%14 = icmp eq i64 %13, 0
br i1 %14, label %20, label %15
15: ; preds = %10
%16 = load i32, i32* @stderr
%17 = getelementptr inbounds i8*, i8** %1, i64 1
%18 = load i8*, i8** %17
%19 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %18)
br label %22
20: ; preds = %10
%21 = tail call i32 (...) @latex_print_footer()
br label %22
22: ; preds = %20, %15, %6
%23 = phi i32 [ -1, %15 ], [ 0, %20 ], [ -1, %6 ]
ret i32 %23
}