#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 CreateBootAtr(char *, char *);
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  int stat = 0;
  printf("MakeAtr Version 0.9-1  (c)1997 Ken Siders\n");
  printf("This program may be freely distributed\n\n");
  if (argc != 3) {
    printf("usage: makeatr atrname.atr file\n\n");
  } else {
    stat = CreateBootAtr(argv[1], argv[2]);
    if (stat) {
      printf("Error #%d encountered in conversion\n\n", stat);
      return EXIT_FAILURE;
    }
    printf("No errors, %s created successfully\n\n", argv[1]);
  }
  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   $0x0,-0x14(%rbp)
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x3,-0x8(%rbp)
je     1176 <main+0x56>
lea    0xeea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d0 <main+0xb0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1040 <CreateBootAtr@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11ba <main+0x9a>
mov    -0x14(%rbp),%esi
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e30(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11dc <main+0xbc>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e01(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xf0c(%rip),%rdi
call   1030 <puts@plt>
lea    0xf2a(%rip),%rdi
call   1030 <puts@plt>
cmp    $0x3,%ebp
jne    117f <main+0x4f>
mov    0x8(%rbx),%rdi
mov    0x10(%rbx),%rsi
call   1050 <CreateBootAtr@plt>
test   %eax,%eax
je     118d <main+0x5d>
lea    0xe93(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e63(%rip),%rax
jmp    11a6 <main+0x76>
lea    0xf17(%rip),%rdi
call   1030 <puts@plt>
jmp    119f <main+0x6f>
mov    0x8(%rbx),%rsi
lea    0xe8e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e32(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [43 x i8] c"MakeAtr Version 0.9-1 (c)1997 Ken Siders\0A\00"
@.str.1 = [41 x i8] c"This program may be freely distributed\0A\0A\00"
@.str.2 = [34 x i8] c"usage: makeatr atrname.atr file\0A\0A\00"
@.str.3 = [38 x i8] c"Error #%d encountered in conversion\0A\0A\00"
@EXIT_FAILURE = global i32 0
@.str.4 = [37 x i8] c"No errors, %s created successfully\0A\0A\00"
@EXIT_SUCCESS = 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 0, i32* %6
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 3
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
br label %32
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = call i32 @CreateBootAtr(i8* %16, i8* %19)
store i32 %20, i32* %6
%21 = load i32, i32* %6
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %27
23: ; preds = %13
%24 = load i32, i32* %6
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i32 %24)
%26 = load i32, i32* @EXIT_FAILURE
store i32 %26, i32* %3
br label %34
27: ; preds = %13
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i8* %30)
br label %32
32: ; preds = %27, %11
%33 = load i32, i32* @EXIT_SUCCESS
store i32 %33, i32* %3
br label %34
34: ; preds = %32, %23
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
@.str.3 = [38 x i8] c"Error #%d encountered in conversion\0A\0A\00"
@EXIT_FAILURE = global i32 0
@.str.4 = [37 x i8] c"No errors, %s created successfully\0A\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [42 x i8] c"MakeAtr Version 0.9-1 (c)1997 Ken Siders\00"
@str.5 = [40 x i8] c"This program may be freely distributed\0A\00"
@str.6 = [33 x i8] c"usage: makeatr atrname.atr file\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.5, i64 0, i64 0))
%5 = icmp eq i32 %0, 3
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.6, i64 0, i64 0))
br label %20
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32 @CreateBootAtr(i8* %10, i8* %12)
%14 = icmp eq i32 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %8
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i32 %13)
br label %20
17: ; preds = %8
%18 = load i8*, i8** %9
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i8* %18)
br label %20
20: ; preds = %6, %17, %15
%21 = phi i32* [ @EXIT_FAILURE, %15 ], [ @EXIT_SUCCESS, %17 ], [ @EXIT_SUCCESS, %6 ]
%22 = load i32, i32* %21
ret i32 %22
}