#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*/ abspath(char *, char *);
int /*<<< orphan*/ chdir(char *);
int /*<<< orphan*/ getcwd(char *, int);
int /*<<< orphan*/ mktempdir(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ rmtempdir(char *, int);
int runtests(char *, char *);
int main(int argc, char **argv) {
  int result;
  char testdir[1024];
  char ironout[1024];
  char origin[1024];
  if (argc < 2) {
    printf("Usage: %s testdir\n", argv[0]);
    return 1;
  }
  mktempdir("ironproj");
  getcwd(origin, 1024);
  abspath(testdir, argv[1]);
  abspath(ironout, "ironout");
  chdir("ironproj");
  result = runtests(testdir, ironout);
  chdir(origin);
  rmtempdir("ironproj", 1);
  return result;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11b2 <main+0x42>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe5f(%rip),%rdi
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    123b <main+0xcb>
lea    0xe5a(%rip),%rdi
call   1030 <mktempdir@plt>
lea    -0xc20(%rbp),%rdi
mov    $0x400,%esi
call   1060 <getcwd@plt>
lea    -0x420(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1090 <abspath@plt>
lea    -0x820(%rbp),%rdi
lea    0xe2b(%rip),%rsi
call   1090 <abspath@plt>
lea    0xe16(%rip),%rdi
call   1040 <chdir@plt>
lea    -0x420(%rbp),%rdi
lea    -0x820(%rbp),%rsi
call   1080 <runtests@plt>
mov    %eax,-0x14(%rbp)
lea    -0xc20(%rbp),%rdi
call   1040 <chdir@plt>
lea    0xde8(%rip),%rdi
mov    $0x1,%esi
call   1070 <rmtempdir@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xc08,%rsp
mov    %rsi,%rbx
cmp    $0x1,%edi
jg     119c <main+0x2c>
mov    (%rbx),%rsi
lea    0xe70(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%ebx
jmp    1210 <main+0xa0>
lea    0xe70(%rip),%r15
mov    %r15,%rdi
call   1030 <mktempdir@plt>
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x400,%esi
call   1060 <getcwd@plt>
mov    0x8(%rbx),%rsi
lea    0x800(%rsp),%r12
mov    %r12,%rdi
call   1090 <abspath@plt>
lea    0xe46(%rip),%rsi
lea    0x400(%rsp),%rbx
mov    %rbx,%rdi
call   1090 <abspath@plt>
mov    %r15,%rdi
call   1040 <chdir@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1080 <runtests@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1040 <chdir@plt>
mov    %r15,%rdi
mov    $0x1,%esi
call   1070 <rmtempdir@plt>
mov    %ebx,%eax
add    $0xc08,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Usage: %s testdir\0A\00"
@.str.1 = [9 x i8] c"ironproj\00"
@.str.2 = [8 x i8] c"ironout\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [1024 x i8]
%8 = alloca [1024 x i8]
%9 = alloca [1024 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 2
br i1 %11, label %12, label %17
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %15)
store i32 1, i32* %3
br label %36
17: ; preds = %2
%18 = call i32 @mktempdir(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%20 = call i32 @getcwd(i8* %19, i32 1024)
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i32 @abspath(i8* %21, i8* %24)
%26 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%27 = call i32 @abspath(i8* %26, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%28 = call i32 @chdir(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%29 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%30 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%31 = call i32 @runtests(i8* %29, i8* %30)
store i32 %31, i32* %6
%32 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%33 = call i32 @chdir(i8* %32)
%34 = call i32 @rmtempdir(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 1)
%35 = load i32, i32* %6
store i32 %35, i32* %3
br label %36
36: ; preds = %17, %12
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
@.str = [19 x i8] c"Usage: %s testdir\0A\00"
@.str.1 = [9 x i8] c"ironproj\00"
@.str.2 = [8 x i8] c"ironout\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = alloca [1024 x i8]
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%9 = icmp slt i32 %0, 2
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i8*, i8** %1
%12 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %24
13: ; preds = %2
%14 = tail call i32 @mktempdir(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @getcwd(i8* %8, i32 1024)
%16 = getelementptr inbounds i8*, i8** %1, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @abspath(i8* %6, i8* %17)
%19 = call i32 @abspath(i8* %7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%20 = call i32 @chdir(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%21 = call i32 @runtests(i8* %6, i8* %7)
%22 = call i32 @chdir(i8* %8)
%23 = call i32 @rmtempdir(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 1)
br label %24
24: ; preds = %13, %10
%25 = phi i32 [ 1, %10 ], [ %21, %13 ]
ret i32 %25
}