#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*/ CloseInput();
int /*<<< orphan*/ InitCheckDir();
int /*<<< orphan*/ LaTeXShutdown();
scalar_t__ OpenInput(char *);
int /*<<< orphan*/ StartTimer();
int /*<<< orphan*/ checkGlobalAssumptions();
int /*<<< orphan*/ dimensionHashtable();
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ init_moves_children_visitors();
int /*<<< orphan*/ init_structure_children_visitors();
int /*<<< orphan*/ initialise_slice_properties();
int /*<<< orphan*/ iterate_problems();
int /*<<< orphan*/ output_plaintext_print_version_info(int /*<<< orphan*/);
int parseCommandlineOptions(int, char **);
int /*<<< orphan*/ platform_init();
int /*<<< orphan*/ set_nice_priority();
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  int idx_end_of_options;
  checkGlobalAssumptions();
  set_nice_priority();
  initialise_slice_properties();
  init_structure_children_visitors();
  init_moves_children_visitors();
  idx_end_of_options = parseCommandlineOptions(argc, argv);
  if (OpenInput(idx_end_of_options < argc ? argv[idx_end_of_options] : "")) {
    platform_init();
    if (!dimensionHashtable())
      fputs("Couldn't allocate the requested amount of memory\n", stdout);
    StartTimer();
    InitCheckDir();
    output_plaintext_print_version_info(stdout);
    iterate_problems();
    CloseInput();
  }
  LaTeXShutdown();
  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    $0x0,%al
call   10b0 <checkGlobalAssumptions@plt>
mov    $0x0,%al
call   1060 <set_nice_priority@plt>
mov    $0x0,%al
call   1110 <initialise_slice_properties@plt>
mov    $0x0,%al
call   1090 <init_structure_children_visitors@plt>
mov    $0x0,%al
call   10c0 <init_moves_children_visitors@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <parseCommandlineOptions@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1269 <main+0x69>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
jmp    1279 <main+0x79>
lea    0xdc1(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    1279 <main+0x79>
mov    -0x20(%rbp),%rdi
call   10d0 <OpenInput@plt>
cmp    $0x0,%rax
je     12e2 <main+0xe2>
mov    $0x0,%al
call   1050 <platform_init@plt>
mov    $0x0,%al
call   1080 <dimensionHashtable@plt>
cmp    $0x0,%eax
jne    12b8 <main+0xb8>
mov    0x2d36(%rip),%rax
mov    (%rax),%esi
lea    0xd4d(%rip),%rdi
call   1070 <fputs@plt>
mov    $0x0,%al
call   10e0 <StartTimer@plt>
mov    $0x0,%al
call   10a0 <InitCheckDir@plt>
mov    0x2d13(%rip),%rax
mov    (%rax),%edi
call   10f0 <output_plaintext_print_version_info@plt>
mov    $0x0,%al
call   1120 <iterate_problems@plt>
mov    $0x0,%al
call   1100 <CloseInput@plt>
mov    $0x0,%al
call   1040 <LaTeXShutdown@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   10b0 <checkGlobalAssumptions@plt>
xor    %eax,%eax
call   1060 <set_nice_priority@plt>
xor    %eax,%eax
call   1110 <initialise_slice_properties@plt>
xor    %eax,%eax
call   1090 <init_structure_children_visitors@plt>
xor    %eax,%eax
call   10c0 <init_moves_children_visitors@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <parseCommandlineOptions@plt>
cmp    %ebp,%eax
jge    1241 <main+0x41>
cltq
mov    (%rbx,%rax,8),%rdi
jmp    1248 <main+0x48>
lea    0xde9(%rip),%rdi
call   10d0 <OpenInput@plt>
test   %rax,%rax
je     12a3 <main+0xa3>
xor    %eax,%eax
call   1050 <platform_init@plt>
xor    %eax,%eax
call   1080 <dimensionHashtable@plt>
test   %eax,%eax
jne    1279 <main+0x79>
mov    0x2d75(%rip),%rax
mov    (%rax),%esi
lea    0xd8c(%rip),%rdi
call   1070 <fputs@plt>
xor    %eax,%eax
call   10e0 <StartTimer@plt>
xor    %eax,%eax
call   10a0 <InitCheckDir@plt>
mov    0x2d52(%rip),%rax
mov    (%rax),%edi
call   10f0 <output_plaintext_print_version_info@plt>
xor    %eax,%eax
call   1120 <iterate_problems@plt>
xor    %eax,%eax
call   1100 <CloseInput@plt>
xor    %eax,%eax
call   1040 <LaTeXShutdown@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [50 x i8] c"Couldn't allocate the requested amount of memory\0A\00"
@stdout = global i32 0
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 = call i32 (...) @checkGlobalAssumptions()
%8 = call i32 (...) @set_nice_priority()
%9 = call i32 (...) @initialise_slice_properties()
%10 = call i32 (...) @init_structure_children_visitors()
%11 = call i32 (...) @init_moves_children_visitors()
%12 = load i32, i32* %4
%13 = load i8**, i8*** %5
%14 = call i32 @parseCommandlineOptions(i32 %12, i8** %13)
store i32 %14, i32* %6
%15 = load i32, i32* %6
%16 = load i32, i32* %4
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %24
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8*, i8** %19, i64 %21
%23 = load i8*, i8** %22
br label %25
24: ; preds = %2
br label %25
25: ; preds = %24, %18
%26 = phi i8* [ %23, %18 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %24 ]
%27 = call i64 @OpenInput(i8* %26)
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %43
29: ; preds = %25
%30 = call i32 (...) @platform_init()
%31 = call i32 (...) @dimensionHashtable()
%32 = icmp ne i32 %31, 0
br i1 %32, label %36, label %33
33: ; preds = %29
%34 = load i32, i32* @stdout
%35 = call i32 @fputs(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %33, %29
%37 = call i32 (...) @StartTimer()
%38 = call i32 (...) @InitCheckDir()
%39 = load i32, i32* @stdout
%40 = call i32 @output_plaintext_print_version_info(i32 %39)
%41 = call i32 (...) @iterate_problems()
%42 = call i32 (...) @CloseInput()
br label %43
43: ; preds = %36, %25
%44 = call i32 (...) @LaTeXShutdown()
ret i32 0
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [50 x i8] c"Couldn't allocate the requested amount of memory\0A\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 (...) @checkGlobalAssumptions()
%4 = tail call i32 (...) @set_nice_priority()
%5 = tail call i32 (...) @initialise_slice_properties()
%6 = tail call i32 (...) @init_structure_children_visitors()
%7 = tail call i32 (...) @init_moves_children_visitors()
%8 = tail call i32 @parseCommandlineOptions(i32 %0, i8** %1)
%9 = icmp slt i32 %8, %0
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = sext i32 %8 to i64
%12 = getelementptr inbounds i8*, i8** %1, i64 %11
%13 = load i8*, i8** %12
br label %14
14: ; preds = %2, %10
%15 = phi i8* [ %13, %10 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %2 ]
%16 = tail call i64 @OpenInput(i8* %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %32, label %18
18: ; preds = %14
%19 = tail call i32 (...) @platform_init()
%20 = tail call i32 (...) @dimensionHashtable()
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = load i32, i32* @stdout
%24 = tail call i32 @fputs(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %22, %18
%26 = tail call i32 (...) @StartTimer()
%27 = tail call i32 (...) @InitCheckDir()
%28 = load i32, i32* @stdout
%29 = tail call i32 @output_plaintext_print_version_info(i32 %28)
%30 = tail call i32 (...) @iterate_problems()
%31 = tail call i32 (...) @CloseInput()
br label %32
32: ; preds = %25, %14
%33 = tail call i32 (...) @LaTeXShutdown()
ret i32 0
}