#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 EXIT_FAILURE;
int EXIT_SUCCESS;
int XML_MAJOR_VERSION;
int XML_MICRO_VERSION;
int XML_MINOR_VERSION;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ process(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  int i;
  for (i = 1; i < argc; ++i) {
    if (strcmp(argv[i], "-version") == 0) {
      printf("xml2info 1.0\n");
      printf("libexpat %d.%d.%d\n", XML_MAJOR_VERSION, XML_MINOR_VERSION,
             XML_MICRO_VERSION);
      exit(EXIT_SUCCESS);
    } else {
      fprintf(stderr, "MAME XML to INFO converter\n");
      fprintf(stderr, "Syntax: xml2info [-version] < input.xml > output.lst\n");
      exit(EXIT_SUCCESS);
    }
  }
  if (process(stdin, stdout) != 0) {
    exit(EXIT_FAILURE);
  }
  return EXIT_SUCCESS;
}


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   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1218 <main+0xc8>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe74(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11e0 <main+0x90>
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2df0(%rip),%rax
mov    (%rax),%esi
mov    0x2e27(%rip),%rax
mov    (%rax),%edx
mov    0x2e26(%rip),%rax
mov    (%rax),%ecx
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2dd7(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
lea    0xe3a(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2dcc(%rip),%rax
mov    (%rax),%edi
lea    0xe41(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2d9f(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    0x2db9(%rip),%rax
mov    (%rax),%edi
mov    0x2d90(%rip),%rax
mov    (%rax),%esi
call   1040 <process@plt>
cmp    $0x0,%rax
je     1247 <main+0xf7>
mov    0x2d80(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    0x2d62(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jge    118d <main+0x2d>
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
mov    0x2e42(%rip),%rax
mov    (%rax),%esi
call   1050 <process@plt>
test   %rax,%rax
jne    11d9 <main+0x79>
mov    0x2e27(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret
mov    0x8(%rsi),%rdi
lea    0xe68(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    11e7 <main+0x87>
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
mov    0x2deb(%rip),%rax
mov    (%rax),%esi
mov    0x2e22(%rip),%rax
mov    (%rax),%edx
mov    0x2e21(%rip),%rax
mov    (%rax),%ecx
lea    0xe39(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    120a <main+0xaa>
mov    0x2de0(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    0x2dda(%rip),%rbx
mov    (%rbx),%edi
lea    0xe25(%rip),%rsi
call   1070 <fprintf@plt>
mov    (%rbx),%edi
lea    0xe33(%rip),%rsi
call   1070 <fprintf@plt>
mov    0x2d9f(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"-version\00"
@.str.1 = [14 x i8] c"xml2info 1.0\0A\00"
@.str.2 = [19 x i8] c"libexpat %d.%d.%d\0A\00"
@XML_MAJOR_VERSION = global i32 0
@XML_MINOR_VERSION = global i32 0
@XML_MICRO_VERSION = global i32 0
@EXIT_SUCCESS = global i32 0
@stderr = global i32 0
@.str.3 = [28 x i8] c"MAME XML to INFO converter\0A\00"
@.str.4 = [54 x i8] c"Syntax: xml2info [-version] < input.xml > output.lst\0A\00"
@stdin = global i32 0
@stdout = global i32 0
@EXIT_FAILURE = 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
store i32 1, i32* %6
br label %7
7: ; preds = %34, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %37
11: ; preds = %7
%12 = load i8**, i8*** %5
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8*, i8** %12, i64 %14
%16 = load i8*, i8** %15
%17 = call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %27
19: ; preds = %11
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%21 = load i32, i32* @XML_MAJOR_VERSION
%22 = load i32, i32* @XML_MINOR_VERSION
%23 = load i32, i32* @XML_MICRO_VERSION
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %21, i32 %22, i32 %23)
%25 = load i32, i32* @EXIT_SUCCESS
%26 = call i32 @exit(i32 %25)
unreachable
27: ; preds = %11
%28 = load i32, i32* @stderr
%29 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%30 = load i32, i32* @stderr
%31 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0))
%32 = load i32, i32* @EXIT_SUCCESS
%33 = call i32 @exit(i32 %32)
unreachable
34: ; No predecessors!
%35 = load i32, i32* %6
%36 = add nsw i32 %35, 1
store i32 %36, i32* %6
br label %7
37: ; preds = %7
%38 = load i32, i32* @stdin
%39 = load i32, i32* @stdout
%40 = call i64 @process(i32 %38, i32 %39)
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %45
42: ; preds = %37
%43 = load i32, i32* @EXIT_FAILURE
%44 = call i32 @exit(i32 %43)
unreachable
45: ; preds = %37
%46 = load i32, i32* @EXIT_SUCCESS
ret i32 %46
}

LLVM IR (-O2):
@.str = [9 x i8] c"-version\00"
@.str.2 = [19 x i8] c"libexpat %d.%d.%d\0A\00"
@XML_MAJOR_VERSION = global i32 0
@XML_MINOR_VERSION = global i32 0
@XML_MICRO_VERSION = global i32 0
@EXIT_SUCCESS = global i32 0
@stderr = global i32 0
@.str.3 = [28 x i8] c"MAME XML to INFO converter\0A\00"
@.str.4 = [54 x i8] c"Syntax: xml2info [-version] < input.xml > output.lst\0A\00"
@stdin = global i32 0
@stdout = global i32 0
@EXIT_FAILURE = global i32 0
@str = [13 x i8] c"xml2info 1.0\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %24
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %4
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%11 = load i32, i32* @XML_MAJOR_VERSION
%12 = load i32, i32* @XML_MINOR_VERSION
%13 = load i32, i32* @XML_MICRO_VERSION
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %11, i32 %12, i32 %13)
%15 = load i32, i32* @EXIT_SUCCESS
%16 = tail call i32 @exit(i32 %15)
unreachable
17: ; preds = %4
%18 = load i32, i32* @stderr
%19 = tail call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%20 = load i32, i32* @stderr
%21 = tail call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0))
%22 = load i32, i32* @EXIT_SUCCESS
%23 = tail call i32 @exit(i32 %22)
unreachable
24: ; preds = %2
%25 = load i32, i32* @stdin
%26 = load i32, i32* @stdout
%27 = tail call i64 @process(i32 %25, i32 %26)
%28 = icmp eq i64 %27, 0
br i1 %28, label %32, label %29
29: ; preds = %24
%30 = load i32, i32* @EXIT_FAILURE
%31 = tail call i32 @exit(i32 %30)
unreachable
32: ; preds = %24
%33 = load i32, i32* @EXIT_SUCCESS
ret i32 %33
}