#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 play(int, int, int);
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  printf("#include <stdio.h>\n#include <stdlib.h>\n#include "
         "<assert.h>\n\n#define ALEX 0\n#define BARB 1\n\n");
  printf("int play(int k, int a, int b) {\n    // TODO\n    return 0;\n}\n\n");
  printf("int main() {\n");
  srand(time(NULL));
  int n = 1000, inner = 5;
  while (n--) {
    for (int i = 0; i < inner; i++) {
      int k = 1 + rand() % (n + 6);
      int a = 1 + rand() % (n + 6);
      int b = a + rand() % (n + 6);
      printf("    assert(play(%d,%d,%d) == %s);\n", k, a, b,
             play(k, a, b) == 1 ? "BARB" : "ALEX");
    }
  }
  printf("    return 0;\n}\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf18(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x3e8,-0x8(%rbp)
movl   $0x5,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1279 <main+0x129>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1274 <main+0x124>
mov    $0x0,%al
call   1070 <rand@plt>
mov    -0x8(%rbp),%ecx
add    $0x6,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
mov    $0x0,%al
call   1070 <rand@plt>
mov    -0x8(%rbp),%ecx
add    $0x6,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    $0x0,%al
call   1070 <rand@plt>
mov    -0x8(%rbp),%ecx
add    $0x6,%ecx
cltd
idiv   %ecx
mov    -0x2c(%rbp),%eax
add    %edx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1050 <play@plt>
mov    -0x28(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    %eax,%edi
lea    0xe86(%rip),%r8
lea    0xe7a(%rip),%rax
cmp    $0x1,%edi
cmove  %rax,%r8
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11c2 <main+0x72>
jmp    11a7 <main+0x57>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0a(%rip),%rdi
call   1030 <puts@plt>
lea    0xf3b(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    $0x3ed,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1080 <rand@plt>
cltd
idiv   %ebp
lea    0x1(%rdx),%r15d
xor    %eax,%eax
call   1080 <rand@plt>
cltd
idiv   %ebp
mov    %edx,%ebx
lea    0x1(%rbx),%r12d
xor    %eax,%eax
call   1080 <rand@plt>
cltd
idiv   %ebp
add    %edx,%ebx
add    $0x1,%ebx
mov    %r15d,%edi
mov    %r12d,%esi
mov    %ebx,%edx
call   1060 <play@plt>
cmp    $0x1,%eax
lea    0xe34(%rip),%r14
mov    %r14,%r8
lea    0xe25(%rip),%r13
cmove  %r13,%r8
lea    0xdf7(%rip),%rdi
mov    %r15d,%esi
mov    %r12d,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1080 <rand@plt>
cltd
idiv   %ebp
lea    0x1(%rdx),%r15d
xor    %eax,%eax
call   1080 <rand@plt>
cltd
idiv   %ebp
mov    %edx,%ebx
lea    0x1(%rbx),%r12d
xor    %eax,%eax
call   1080 <rand@plt>
cltd
idiv   %ebp
add    %edx,%ebx
add    $0x1,%ebx
mov    %r15d,%edi
mov    %r12d,%esi
mov    %ebx,%edx
call   1060 <play@plt>
cmp    $0x1,%eax
mov    %r14,%r8
cmove  %r13,%r8
lea    0xd9d(%rip),%rdi
mov    %rdi,%r13
mov    %r15d,%esi
mov    %r12d,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1080 <rand@plt>
cltd
idiv   %ebp
lea    0x1(%rdx),%r15d
xor    %eax,%eax
call   1080 <rand@plt>
cltd
idiv   %ebp
mov    %edx,%ebx
lea    0x1(%rbx),%r12d
xor    %eax,%eax
call   1080 <rand@plt>
cltd
idiv   %ebp
add    %edx,%ebx
add    $0x1,%ebx
mov    %r15d,%edi
mov    %r12d,%esi
mov    %ebx,%edx
call   1060 <play@plt>
cmp    $0x1,%eax
mov    %r14,%r8
lea    0xd67(%rip),%r14
cmove  %r14,%r8
mov    %r13,%rdi
mov    %r15d,%esi
mov    %r12d,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1080 <rand@plt>
cltd
idiv   %ebp
lea    0x1(%rdx),%r15d
xor    %eax,%eax
call   1080 <rand@plt>
cltd
idiv   %ebp
mov    %edx,%ebx
lea    0x1(%rbx),%r12d
xor    %eax,%eax
call   1080 <rand@plt>
cltd
idiv   %ebp
add    %edx,%ebx
add    $0x1,%ebx
mov    %r15d,%edi
mov    %r12d,%esi
mov    %ebx,%edx
call   1060 <play@plt>
cmp    $0x1,%eax
lea    0xd12(%rip),%r8
cmove  %r14,%r8
mov    %r13,%rdi
mov    %r15d,%esi
mov    %r12d,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1080 <rand@plt>
cltd
idiv   %ebp
lea    0x1(%rdx),%r15d
xor    %eax,%eax
call   1080 <rand@plt>
cltd
idiv   %ebp
mov    %edx,%ebx
lea    0x1(%rbx),%r12d
xor    %eax,%eax
call   1080 <rand@plt>
cltd
idiv   %ebp
add    %edx,%ebx
add    $0x1,%ebx
mov    %r15d,%edi
mov    %r12d,%esi
mov    %ebx,%edx
call   1060 <play@plt>
cmp    $0x1,%eax
lea    0xcb8(%rip),%r8
cmove  %r14,%r8
mov    %r13,%rdi
mov    %r15d,%esi
mov    %r12d,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebp
cmp    $0x5,%ebp
jne    11b0 <main+0x50>
lea    0xd39(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [92 x i8] c"#include <stdio.h>\0A#include <stdlib.h>\0A#include <assert.h>\0A\0A#define ALEX 0\0A#define BARB 1\0A\0A\00"
@.str.1 = [62 x i8] c"int play(int k, int a, int b) {\0A // TODO\0A return 0;\0A}\0A\0A\00"
@.str.2 = [14 x i8] c"int main() {\0A\00"
@.str.3 = [35 x i8] c" assert(play(%d,%d,%d) == %s);\0A\00"
@.str.4 = [5 x i8] c"BARB\00"
@.str.5 = [5 x i8] c"ALEX\00"
@.str.6 = [17 x i8] c" return 0;\0A}\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([92 x i8], [92 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @time(i32* null)
%12 = call i32 @srand(i32 %11)
store i32 1000, i32* %2
store i32 5, i32* %3
br label %13
13: ; preds = %53, %0
%14 = load i32, i32* %2
%15 = add nsw i32 %14, -1
store i32 %15, i32* %2
%16 = icmp ne i32 %14, 0
br i1 %16, label %17, label %54
17: ; preds = %13
store i32 0, i32* %4
br label %18
18: ; preds = %50, %17
%19 = load i32, i32* %4
%20 = load i32, i32* %3
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %53
22: ; preds = %18
%23 = call i32 (...) @rand()
%24 = load i32, i32* %2
%25 = add nsw i32 %24, 6
%26 = srem i32 %23, %25
%27 = add nsw i32 1, %26
store i32 %27, i32* %5
%28 = call i32 (...) @rand()
%29 = load i32, i32* %2
%30 = add nsw i32 %29, 6
%31 = srem i32 %28, %30
%32 = add nsw i32 1, %31
store i32 %32, i32* %6
%33 = load i32, i32* %6
%34 = call i32 (...) @rand()
%35 = load i32, i32* %2
%36 = add nsw i32 %35, 6
%37 = srem i32 %34, %36
%38 = add nsw i32 %33, %37
store i32 %38, i32* %7
%39 = load i32, i32* %5
%40 = load i32, i32* %6
%41 = load i32, i32* %7
%42 = load i32, i32* %5
%43 = load i32, i32* %6
%44 = load i32, i32* %7
%45 = call i32 @play(i32 %42, i32 %43, i32 %44)
%46 = icmp eq i32 %45, 1
%47 = zext i1 %46 to i64
%48 = select i1 %46, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0)
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i32 %39, i32 %40, i32 %41, i8* %48)
br label %50
50: ; preds = %22
%51 = load i32, i32* %4
%52 = add nsw i32 %51, 1
store i32 %52, i32* %4
br label %18
53: ; preds = %18
br label %13
54: ; preds = %13
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.3 = [35 x i8] c" assert(play(%d,%d,%d) == %s);\0A\00"
@.str.4 = [5 x i8] c"BARB\00"
@.str.5 = [5 x i8] c"ALEX\00"
@str = [91 x i8] c"#include <stdio.h>\0A#include <stdlib.h>\0A#include <assert.h>\0A\0A#define ALEX 0\0A#define BARB 1\0A\00"
@str.7 = [61 x i8] c"int play(int k, int a, int b) {\0A // TODO\0A return 0;\0A}\0A\00"
@str.8 = [13 x i8] c"int main() {\00"
@str.9 = [16 x i8] c" return 0;\0A}\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([91 x i8], [91 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.7, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.8, i64 0, i64 0))
%4 = tail call i32 @time(i32* null)
%5 = tail call i32 @srand(i32 %4)
br label %6
6: ; preds = %0, %6
%7 = phi i32 [ 999, %0 ], [ %75, %6 ]
%8 = phi i32 [ 1000, %0 ], [ %7, %6 ]
%9 = add nuw nsw i32 %8, 5
%10 = tail call i32 (...) @rand()
%11 = srem i32 %10, %9
%12 = add nsw i32 %11, 1
%13 = tail call i32 (...) @rand()
%14 = srem i32 %13, %9
%15 = add nsw i32 %14, 1
%16 = tail call i32 (...) @rand()
%17 = srem i32 %16, %9
%18 = add nsw i32 %17, %15
%19 = tail call i32 @play(i32 %12, i32 %15, i32 %18)
%20 = icmp eq i32 %19, 1
%21 = select i1 %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i32 %12, i32 %15, i32 %18, i8* %21)
%23 = tail call i32 (...) @rand()
%24 = srem i32 %23, %9
%25 = add nsw i32 %24, 1
%26 = tail call i32 (...) @rand()
%27 = srem i32 %26, %9
%28 = add nsw i32 %27, 1
%29 = tail call i32 (...) @rand()
%30 = srem i32 %29, %9
%31 = add nsw i32 %30, %28
%32 = tail call i32 @play(i32 %25, i32 %28, i32 %31)
%33 = icmp eq i32 %32, 1
%34 = select i1 %33, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0)
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i32 %25, i32 %28, i32 %31, i8* %34)
%36 = tail call i32 (...) @rand()
%37 = srem i32 %36, %9
%38 = add nsw i32 %37, 1
%39 = tail call i32 (...) @rand()
%40 = srem i32 %39, %9
%41 = add nsw i32 %40, 1
%42 = tail call i32 (...) @rand()
%43 = srem i32 %42, %9
%44 = add nsw i32 %43, %41
%45 = tail call i32 @play(i32 %38, i32 %41, i32 %44)
%46 = icmp eq i32 %45, 1
%47 = select i1 %46, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0)
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i32 %38, i32 %41, i32 %44, i8* %47)
%49 = tail call i32 (...) @rand()
%50 = srem i32 %49, %9
%51 = add nsw i32 %50, 1
%52 = tail call i32 (...) @rand()
%53 = srem i32 %52, %9
%54 = add nsw i32 %53, 1
%55 = tail call i32 (...) @rand()
%56 = srem i32 %55, %9
%57 = add nsw i32 %56, %54
%58 = tail call i32 @play(i32 %51, i32 %54, i32 %57)
%59 = icmp eq i32 %58, 1
%60 = select i1 %59, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0)
%61 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i32 %51, i32 %54, i32 %57, i8* %60)
%62 = tail call i32 (...) @rand()
%63 = srem i32 %62, %9
%64 = add nsw i32 %63, 1
%65 = tail call i32 (...) @rand()
%66 = srem i32 %65, %9
%67 = add nsw i32 %66, 1
%68 = tail call i32 (...) @rand()
%69 = srem i32 %68, %9
%70 = add nsw i32 %69, %67
%71 = tail call i32 @play(i32 %64, i32 %67, i32 %70)
%72 = icmp eq i32 %71, 1
%73 = select i1 %72, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0)
%74 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i32 %64, i32 %67, i32 %70, i8* %73)
%75 = add nsw i32 %7, -1
%76 = icmp eq i32 %7, 0
br i1 %76, label %77, label %6
77: ; preds = %6
%78 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.9, i64 0, i64 0))
ret i32 0
}