#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 */
typedef int pid_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ _exit(int /*<<< orphan*/);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int fork();
int /*<<< orphan*/ kill(int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int sprintf(char *, char *, ...);
int /*<<< orphan*/ stdout;
int system(char *);
int wait(int *);
int main(int argc, char *argv[]) {
  pid_t cpid[argc - 1], w;
  char buffer[250];
  int status, l, j;
  if (argc < 3 || argc > 4) {
    printf("Usage: 2nash A B [outfile]\n");
    return (0);
  }
  for (l = 1; l < 3; l++) {
    cpid[l - 1] = fork();
    if (cpid[l - 1] == -1) {
      perror("fork");
      exit(EXIT_FAILURE);
    }
    if (cpid[l - 1] == 0) {
      if (l == 1) {
        int n = sprintf(buffer, "lrsnash %s %s > out%i", argv[1], argv[2], l);
      } else {
        int n = sprintf(buffer, "lrsnash %s %s > out%i", argv[2], argv[1], l);
      }
      int i = system(buffer);
      _exit(0);
    }
  }
  w = wait(&status);
  for (j = 1; j < 3; j++) {
    if (w == cpid[j - 1]) {
      if (j == 1)
        printf("lrsnash %s %s   finished first\n", argv[1], argv[2]);
      else {
        printf("lrsnash %s %s   finished first\n", argv[2], argv[1]);
        printf("player numbers will be reversed in output\n");
      }
      if (argc == 4) {
        printf("output file: %s\n", argv[3]);
        int n = sprintf(buffer, "/bin/mv -f out%i %s", j, argv[3]);
      } else {
        printf("output file: out\n");
        int n = sprintf(buffer, "/bin/mv -f out%i out", j);
      }
      int i = system(buffer);
    } else {
      int n = sprintf(buffer, "/bin/rm -f out%i", j);
      int i = system(buffer);
    }
  }
  printf("the other process will be ");
  fflush(stdout);
  kill(0, 9);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x158(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
cmpl   $0x3,-0x8(%rbp)
jl     11fa <main+0x5a>
cmpl   $0x4,-0x8(%rbp)
jle    121e <main+0x7e>
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret
movl   $0x1,-0x128(%rbp)
cmpl   $0x3,-0x128(%rbp)
jge    1349 <main+0x1a9>
mov    $0x0,%al
call   10c0 <fork@plt>
mov    %eax,%edx
mov    -0x158(%rbp),%rax
mov    -0x128(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x128(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
jne    1284 <main+0xe4>
lea    0xdab(%rip),%rdi
call   1080 <perror@plt>
mov    0x2d63(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x158(%rbp),%rax
mov    -0x128(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    1330 <main+0x190>
cmpl   $0x1,-0x128(%rbp)
jne    12e5 <main+0x145>
lea    -0x120(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rcx
mov    -0x128(%rbp),%r8d
lea    0xd4e(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
mov    %eax,-0x130(%rbp)
jmp    1317 <main+0x177>
lea    -0x120(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
mov    -0x128(%rbp),%r8d
lea    0xd17(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
mov    %eax,-0x134(%rbp)
lea    -0x120(%rbp),%rdi
call   1040 <system@plt>
mov    %eax,-0x138(%rbp)
xor    %edi,%edi
call   1030 <_exit@plt>
jmp    1335 <main+0x195>
mov    -0x128(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x128(%rbp)
jmp    1228 <main+0x88>
lea    -0x124(%rbp),%rdi
call   10b0 <wait@plt>
mov    %eax,-0x24(%rbp)
movl   $0x1,-0x12c(%rbp)
cmpl   $0x3,-0x12c(%rbp)
jge    14ca <main+0x32a>
mov    -0x158(%rbp),%rcx
mov    -0x24(%rbp),%eax
mov    -0x12c(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
cmp    (%rcx,%rdx,4),%eax
jne    147e <main+0x2de>
cmpl   $0x1,-0x12c(%rbp)
jne    13be <main+0x21e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xc85(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    13ea <main+0x24a>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xc62(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xc74(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x4,-0x8(%rbp)
jne    1438 <main+0x298>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
lea    0xc7f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x120(%rbp),%rdi
mov    -0x12c(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rcx
lea    0xc6d(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
mov    %eax,-0x13c(%rbp)
jmp    1467 <main+0x2c7>
lea    0xc68(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x120(%rbp),%rdi
mov    -0x12c(%rbp),%edx
lea    0xc5f(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
mov    %eax,-0x140(%rbp)
lea    -0x120(%rbp),%rdi
call   1040 <system@plt>
mov    %eax,-0x144(%rbp)
jmp    14b1 <main+0x311>
lea    -0x120(%rbp),%rdi
mov    -0x12c(%rbp),%edx
lea    0xc3c(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
mov    %eax,-0x148(%rbp)
lea    -0x120(%rbp),%rdi
call   1040 <system@plt>
mov    %eax,-0x14c(%rbp)
jmp    14b6 <main+0x316>
mov    -0x12c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x12c(%rbp)
jmp    1362 <main+0x1c2>
lea    0xc0e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2af9(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
xor    %edi,%edi
mov    $0x9,%esi
call   1060 <kill@plt>
mov    0x2ad7(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x110,%rsp
mov    %edi,%ebx
lea    -0x5(%rbx),%eax
cmp    $0xfffffffe,%eax
jae    11e7 <main+0x37>
lea    0xf0c(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rsi,%r14
xor    %eax,%eax
call   10d0 <fork@plt>
cmp    $0xffffffff,%eax
je     125e <main+0xae>
mov    %eax,%ebp
test   %eax,%eax
jne    120e <main+0x5e>
mov    $0x1,%r8d
mov    $0x2,%eax
mov    $0x1,%ecx
jmp    1231 <main+0x81>
xor    %eax,%eax
call   10d0 <fork@plt>
cmp    $0xffffffff,%eax
je     125e <main+0xae>
mov    %eax,%r12d
test   %eax,%eax
jne    1278 <main+0xc8>
mov    $0x2,%r8d
mov    $0x1,%eax
mov    $0x2,%ecx
mov    (%r14,%rcx,8),%rdx
mov    (%r14,%rax,8),%rcx
lea    0xdc5(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   10a0 <sprintf@plt>
mov    %rbx,%rdi
call   1050 <system@plt>
xor    %edi,%edi
call   1030 <_exit@plt>
lea    0xd9b(%rip),%rdi
call   1090 <perror@plt>
mov    0x2d6f(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
lea    0xc(%rsp),%rdi
call   10c0 <wait@plt>
mov    %eax,%r15d
cmp    %ebp,%eax
jne    12d4 <main+0x124>
mov    0x8(%r14),%rsi
mov    0x10(%r14),%rdx
lea    0xd83(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
cmp    $0x4,%ebx
jne    12dd <main+0x12d>
mov    0x18(%r14),%rsi
lea    0xd8c(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x18(%r14),%rcx
lea    0xd8b(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    $0x1,%edx
xor    %eax,%eax
call   10a0 <sprintf@plt>
jmp    1301 <main+0x151>
lea    0xd9a(%rip),%rsi
jmp    12f0 <main+0x140>
lea    0xde7(%rip),%rdi
call   1040 <puts@plt>
lea    0xd70(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    $0x1,%edx
xor    %eax,%eax
call   10a0 <sprintf@plt>
lea    0x10(%rsp),%rdi
call   1050 <system@plt>
cmp    %r12d,%r15d
jne    1367 <main+0x1b7>
mov    0x8(%r14),%rdx
mov    0x10(%r14),%rsi
lea    0xcfc(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xd74(%rip),%rdi
call   1040 <puts@plt>
cmp    $0x4,%ebx
jne    1370 <main+0x1c0>
mov    0x18(%r14),%rsi
lea    0xcf9(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x18(%r14),%rcx
lea    0xcf8(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    $0x2,%edx
xor    %eax,%eax
call   10a0 <sprintf@plt>
jmp    1394 <main+0x1e4>
lea    0xd07(%rip),%rsi
jmp    1383 <main+0x1d3>
lea    0xd54(%rip),%rdi
call   1040 <puts@plt>
lea    0xcdd(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    $0x2,%edx
xor    %eax,%eax
call   10a0 <sprintf@plt>
lea    0x10(%rsp),%rdi
call   1050 <system@plt>
lea    0xce1(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2c25(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
xor    %edi,%edi
mov    $0x9,%esi
call   1070 <kill@plt>
mov    0x2c03(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"Usage: 2nash A B [outfile]\0A\00"
@.str.1 = [5 x i8] c"fork\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [22 x i8] c"lrsnash %s %s > out%i\00"
@.str.3 = [32 x i8] c"lrsnash %s %s finished first\0A\00"
@.str.4 = [43 x i8] c"player numbers will be reversed in output\0A\00"
@.str.5 = [17 x i8] c"output file: %s\0A\00"
@.str.6 = [20 x i8] c"/bin/mv -f out%i %s\00"
@.str.7 = [18 x i8] c"output file: out\0A\00"
@.str.8 = [21 x i8] c"/bin/mv -f out%i out\00"
@.str.9 = [17 x i8] c"/bin/rm -f out%i\00"
@.str.10 = [27 x i8] c"the other process will be \00"
@stdout = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca [250 x i8]
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%21 = load i32, i32* %4
%22 = sub nsw i32 %21, 1
%23 = zext i32 %22 to i64
%24 = call i8* @llvm.stacksave()
store i8* %24, i8** %6
%25 = alloca i32, i64 %23
store i64 %23, i64* %7
%26 = load i32, i32* %4
%27 = icmp slt i32 %26, 3
br i1 %27, label %31, label %28
28: ; preds = %2
%29 = load i32, i32* %4
%30 = icmp sgt i32 %29, 4
br i1 %30, label %31, label %35
31: ; preds = %28, %2
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
%33 = load i8*, i8** %6
%34 = load i32, i32* %3
ret i32 %34
35: ; preds = %28
store i32 1, i32* %11
br label %36
36: ; preds = %90, %35
%37 = load i32, i32* %11
%38 = icmp slt i32 %37, 3
br i1 %38, label %39, label %93
39: ; preds = %36
%40 = call i32 (...) @fork()
%41 = load i32, i32* %11
%42 = sub nsw i32 %41, 1
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i32, i32* %25, i64 %43
store i32 %40, i32* %44
%45 = load i32, i32* %11
%46 = sub nsw i32 %45, 1
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i32, i32* %25, i64 %47
%49 = load i32, i32* %48
%50 = icmp eq i32 %49, -1
br i1 %50, label %51, label %55
51: ; preds = %39
%52 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%53 = load i32, i32* @EXIT_FAILURE
%54 = call i32 @exit(i32 %53)
unreachable
55: ; preds = %39
%56 = load i32, i32* %11
%57 = sub nsw i32 %56, 1
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i32, i32* %25, i64 %58
%60 = load i32, i32* %59
%61 = icmp eq i32 %60, 0
br i1 %61, label %62, label %89
62: ; preds = %55
%63 = load i32, i32* %11
%64 = icmp eq i32 %63, 1
br i1 %64, label %65, label %75
65: ; preds = %62
%66 = getelementptr inbounds [250 x i8], [250 x i8]* %9, i64 0, i64 0
%67 = load i8**, i8*** %5
%68 = getelementptr inbounds i8*, i8** %67, i64 1
%69 = load i8*, i8** %68
%70 = load i8**, i8*** %5
%71 = getelementptr inbounds i8*, i8** %70, i64 2
%72 = load i8*, i8** %71
%73 = load i32, i32* %11
%74 = call i32 (i8*, i8*, ...) @sprintf(i8* %66, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %69, i8* %72, i32 %73)
store i32 %74, i32* %13
br label %85
75: ; preds = %62
%76 = getelementptr inbounds [250 x i8], [250 x i8]* %9, i64 0, i64 0
%77 = load i8**, i8*** %5
%78 = getelementptr inbounds i8*, i8** %77, i64 2
%79 = load i8*, i8** %78
%80 = load i8**, i8*** %5
%81 = getelementptr inbounds i8*, i8** %80, i64 1
%82 = load i8*, i8** %81
%83 = load i32, i32* %11
%84 = call i32 (i8*, i8*, ...) @sprintf(i8* %76, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %79, i8* %82, i32 %83)
store i32 %84, i32* %14
br label %85
85: ; preds = %75, %65
%86 = getelementptr inbounds [250 x i8], [250 x i8]* %9, i64 0, i64 0
%87 = call i32 @system(i8* %86)
store i32 %87, i32* %15
%88 = call i32 @_exit(i32 0)
unreachable
89: ; preds = %55
br label %90
90: ; preds = %89
%91 = load i32, i32* %11
%92 = add nsw i32 %91, 1
store i32 %92, i32* %11
br label %36
93: ; preds = %36
%94 = call i32 @wait(i32* %10)
store i32 %94, i32* %8
store i32 1, i32* %12
br label %95
95: ; preds = %155, %93
%96 = load i32, i32* %12
%97 = icmp slt i32 %96, 3
br i1 %97, label %98, label %158
98: ; preds = %95
%99 = load i32, i32* %8
%100 = load i32, i32* %12
%101 = sub nsw i32 %100, 1
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds i32, i32* %25, i64 %102
%104 = load i32, i32* %103
%105 = icmp eq i32 %99, %104
br i1 %105, label %106, label %148
106: ; preds = %98
%107 = load i32, i32* %12
%108 = icmp eq i32 %107, 1
br i1 %108, label %109, label %117
109: ; preds = %106
%110 = load i8**, i8*** %5
%111 = getelementptr inbounds i8*, i8** %110, i64 1
%112 = load i8*, i8** %111
%113 = load i8**, i8*** %5
%114 = getelementptr inbounds i8*, i8** %113, i64 2
%115 = load i8*, i8** %114
%116 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8* %112, i8* %115)
br label %126
117: ; preds = %106
%118 = load i8**, i8*** %5
%119 = getelementptr inbounds i8*, i8** %118, i64 2
%120 = load i8*, i8** %119
%121 = load i8**, i8*** %5
%122 = getelementptr inbounds i8*, i8** %121, i64 1
%123 = load i8*, i8** %122
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8* %120, i8* %123)
%125 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0))
br label %126
126: ; preds = %117, %109
%127 = load i32, i32* %4
%128 = icmp eq i32 %127, 4
br i1 %128, label %129, label %140
129: ; preds = %126
%130 = load i8**, i8*** %5
%131 = getelementptr inbounds i8*, i8** %130, i64 3
%132 = load i8*, i8** %131
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8* %132)
%134 = getelementptr inbounds [250 x i8], [250 x i8]* %9, i64 0, i64 0
%135 = load i32, i32* %12
%136 = load i8**, i8*** %5
%137 = getelementptr inbounds i8*, i8** %136, i64 3
%138 = load i8*, i8** %137
%139 = call i32 (i8*, i8*, ...) @sprintf(i8* %134, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i32 %135, i8* %138)
store i32 %139, i32* %16
br label %145
140: ; preds = %126
%141 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0))
%142 = getelementptr inbounds [250 x i8], [250 x i8]* %9, i64 0, i64 0
%143 = load i32, i32* %12
%144 = call i32 (i8*, i8*, ...) @sprintf(i8* %142, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), i32 %143)
store i32 %144, i32* %17
br label %145
145: ; preds = %140, %129
%146 = getelementptr inbounds [250 x i8], [250 x i8]* %9, i64 0, i64 0
%147 = call i32 @system(i8* %146)
store i32 %147, i32* %18
br label %154
148: ; preds = %98
%149 = getelementptr inbounds [250 x i8], [250 x i8]* %9, i64 0, i64 0
%150 = load i32, i32* %12
%151 = call i32 (i8*, i8*, ...) @sprintf(i8* %149, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 %150)
store i32 %151, i32* %19
%152 = getelementptr inbounds [250 x i8], [250 x i8]* %9, i64 0, i64 0
%153 = call i32 @system(i8* %152)
store i32 %153, i32* %20
br label %154
154: ; preds = %148, %145
br label %155
155: ; preds = %154
%156 = load i32, i32* %12
%157 = add nsw i32 %156, 1
store i32 %157, i32* %12
br label %95
158: ; preds = %95
%159 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0))
%160 = load i32, i32* @stdout
%161 = call i32 @fflush(i32 %160)
%162 = call i32 @kill(i32 0, i32 9)
%163 = load i32, i32* @EXIT_SUCCESS
%164 = call i32 @exit(i32 %163)
unreachable
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"fork\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [22 x i8] c"lrsnash %s %s > out%i\00"
@.str.3 = [32 x i8] c"lrsnash %s %s finished first\0A\00"
@.str.5 = [17 x i8] c"output file: %s\0A\00"
@.str.6 = [20 x i8] c"/bin/mv -f out%i %s\00"
@.str.8 = [21 x i8] c"/bin/mv -f out%i out\00"
@.str.9 = [17 x i8] c"/bin/rm -f out%i\00"
@.str.10 = [27 x i8] c"the other process will be \00"
@stdout = global i32 0
@EXIT_SUCCESS = global i32 0
@str = [42 x i8] c"player numbers will be reversed in output\00"
@str.11 = [17 x i8] c"output file: out\00"
@str.12 = [27 x i8] c"Usage: 2nash A B [outfile]\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [250 x i8]
%4 = alloca i32
%5 = getelementptr inbounds [250 x i8], [250 x i8]* %3, i64 0, i64 0
%6 = bitcast i32* %4 to i8*
%7 = add i32 %0, -5
%8 = icmp ult i32 %7, -2
br i1 %8, label %11, label %9
9: ; preds = %2
%10 = tail call i32 (...) @fork()
switch i32 %10, label %28 [
i32 -1, label %13
i32 0, label %17
]
11: ; preds = %2
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.12, i64 0, i64 0))
ret i32 0
13: ; preds = %28, %9
%14 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%15 = load i32, i32* @EXIT_FAILURE
%16 = tail call i32 @exit(i32 %15)
unreachable
17: ; preds = %28, %9
%18 = phi i64 [ 1, %9 ], [ 2, %28 ]
%19 = phi i64 [ 2, %9 ], [ 1, %28 ]
%20 = phi i32 [ 1, %9 ], [ 2, %28 ]
%21 = getelementptr inbounds i8*, i8** %1, i64 %18
%22 = load i8*, i8** %21
%23 = getelementptr inbounds i8*, i8** %1, i64 %19
%24 = load i8*, i8** %23
%25 = call i32 (i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %22, i8* %24, i32 %20)
%26 = call i32 @system(i8* %5)
%27 = tail call i32 @_exit(i32 0)
unreachable
28: ; preds = %9
%29 = tail call i32 (...) @fork()
switch i32 %29, label %30 [
i32 -1, label %13
i32 0, label %17
]
30: ; preds = %28
%31 = call i32 @wait(i32* %4)
%32 = getelementptr inbounds i8*, i8** %1, i64 2
%33 = getelementptr inbounds i8*, i8** %1, i64 1
%34 = icmp eq i32 %0, 4
%35 = getelementptr inbounds i8*, i8** %1, i64 3
%36 = icmp eq i32 %31, %10
br i1 %36, label %37, label %49
37: ; preds = %30
%38 = load i8*, i8** %33
%39 = load i8*, i8** %32
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8* %38, i8* %39)
br i1 %34, label %41, label %46
41: ; preds = %37
%42 = load i8*, i8** %35
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8* %42)
%44 = load i8*, i8** %35
%45 = call i32 (i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i32 1, i8* %44)
br label %51
46: ; preds = %37
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.11, i64 0, i64 0))
%48 = call i32 (i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), i32 1)
br label %51
49: ; preds = %30
%50 = call i32 (i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 1)
br label %51
51: ; preds = %41, %46, %49
%52 = call i32 @system(i8* %5)
%53 = icmp eq i32 %31, %29
br i1 %53, label %56, label %54
54: ; preds = %51
%55 = call i32 (i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 2)
br label %69
56: ; preds = %51
%57 = load i8*, i8** %32
%58 = load i8*, i8** %33
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8* %57, i8* %58)
%60 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
br i1 %34, label %64, label %61
61: ; preds = %56
%62 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.11, i64 0, i64 0))
%63 = call i32 (i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), i32 2)
br label %69
64: ; preds = %56
%65 = load i8*, i8** %35
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8* %65)
%67 = load i8*, i8** %35
%68 = call i32 (i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i32 2, i8* %67)
br label %69
69: ; preds = %61, %64, %54
%70 = call i32 @system(i8* %5)
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0))
%72 = load i32, i32* @stdout
%73 = call i32 @fflush(i32 %72)
%74 = call i32 @kill(i32 0, i32 9)
%75 = load i32, i32* @EXIT_SUCCESS
%76 = call i32 @exit(i32 %75)
unreachable
}