#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 basic_xor_test_16_32();
int basic_xor_test_16_64();
int basic_xor_test_8_32();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  int ret;
  int num_failed = 0;
  srand(time(NULL));
  ret = basic_xor_test_16_32();
  if (ret) {
    fprintf(stderr, "basic_xor_test_16_32 has failed!\n");
    num_failed++;
  }
  ret = basic_xor_test_16_64();
  if (ret) {
    fprintf(stderr, "basic_xor_test_16_64 has failed!\n");
    num_failed++;
  }
  ret = basic_xor_test_8_32();
  if (ret) {
    fprintf(stderr, "basic_xor_test_8_32 has failed!\n");
    num_failed++;
  }
  if (num_failed == 0) {
    fprintf(stderr, "Tests pass!!!\n");
  }
  return num_failed;
}


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,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1030 <basic_xor_test_16_32@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11bf <main+0x5f>
mov    0x2e38(%rip),%rax
mov    (%rax),%edi
lea    0xe4f(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1080 <basic_xor_test_16_64@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11f1 <main+0x91>
mov    0x2e06(%rip),%rax
mov    (%rax),%edi
lea    0xe3f(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1070 <basic_xor_test_8_32@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1223 <main+0xc3>
mov    0x2dd4(%rip),%rax
mov    (%rax),%edi
lea    0xe2f(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    1242 <main+0xe2>
mov    0x2dac(%rip),%rax
mov    (%rax),%edi
lea    0xe28(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %ebx,%ebx
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1030 <basic_xor_test_16_32@plt>
test   %eax,%eax
je     1196 <main+0x36>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
lea    0xe74(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%ebx
xor    %eax,%eax
call   1080 <basic_xor_test_16_64@plt>
test   %eax,%eax
je     11b9 <main+0x59>
mov    0x2e38(%rip),%rax
mov    (%rax),%edi
lea    0xe71(%rip),%rsi
call   1050 <fprintf@plt>
add    $0x1,%ebx
xor    %eax,%eax
call   1070 <basic_xor_test_8_32@plt>
test   %eax,%eax
je     11de <main+0x7e>
mov    0x2e15(%rip),%rax
mov    (%rax),%edi
lea    0xe70(%rip),%rsi
call   1050 <fprintf@plt>
add    $0x1,%ebx
jmp    11f9 <main+0x99>
test   %ebx,%ebx
jne    11f9 <main+0x99>
mov    0x2df7(%rip),%rax
mov    (%rax),%edi
lea    0xe73(%rip),%rsi
call   1050 <fprintf@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"basic_xor_test_16_32 has failed!\0A\00"
@.str.1 = [34 x i8] c"basic_xor_test_16_64 has failed!\0A\00"
@.str.2 = [33 x i8] c"basic_xor_test_8_32 has failed!\0A\00"
@.str.3 = [15 x i8] c"Tests pass!!!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
%8 = call i32 @time(i32* null)
%9 = call i32 @srand(i32 %8)
%10 = call i32 (...) @basic_xor_test_16_32()
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%16 = load i32, i32* %7
%17 = add nsw i32 %16, 1
store i32 %17, i32* %7
br label %18
18: ; preds = %13, %2
%19 = call i32 (...) @basic_xor_test_16_64()
store i32 %19, i32* %6
%20 = load i32, i32* %6
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %27
22: ; preds = %18
%23 = load i32, i32* @stderr
%24 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%25 = load i32, i32* %7
%26 = add nsw i32 %25, 1
store i32 %26, i32* %7
br label %27
27: ; preds = %22, %18
%28 = call i32 (...) @basic_xor_test_8_32()
store i32 %28, i32* %6
%29 = load i32, i32* %6
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %36
31: ; preds = %27
%32 = load i32, i32* @stderr
%33 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%34 = load i32, i32* %7
%35 = add nsw i32 %34, 1
store i32 %35, i32* %7
br label %36
36: ; preds = %31, %27
%37 = load i32, i32* %7
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %42
39: ; preds = %36
%40 = load i32, i32* @stderr
%41 = call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %42
42: ; preds = %39, %36
%43 = load i32, i32* %7
ret i32 %43
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"basic_xor_test_16_32 has failed!\0A\00"
@.str.1 = [34 x i8] c"basic_xor_test_16_64 has failed!\0A\00"
@.str.2 = [33 x i8] c"basic_xor_test_8_32 has failed!\0A\00"
@.str.3 = [15 x i8] c"Tests pass!!!\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%5 = tail call i32 (...) @basic_xor_test_16_32()
%6 = icmp eq i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %7, %2
%11 = phi i32 [ 1, %7 ], [ 0, %2 ]
%12 = tail call i32 (...) @basic_xor_test_16_64()
%13 = icmp eq i32 %12, 0
br i1 %13, label %18, label %14
14: ; preds = %10
%15 = load i32, i32* @stderr
%16 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%17 = add nuw nsw i32 %11, 1
br label %18
18: ; preds = %14, %10
%19 = phi i32 [ %17, %14 ], [ %11, %10 ]
%20 = tail call i32 (...) @basic_xor_test_8_32()
%21 = icmp eq i32 %20, 0
br i1 %21, label %26, label %22
22: ; preds = %18
%23 = load i32, i32* @stderr
%24 = tail call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%25 = add nuw nsw i32 %19, 1
br label %31
26: ; preds = %18
%27 = icmp eq i32 %19, 0
br i1 %27, label %28, label %31
28: ; preds = %26
%29 = load i32, i32* @stderr
%30 = tail call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %31
31: ; preds = %22, %28, %26
%32 = phi i32 [ %25, %22 ], [ 0, %28 ], [ %19, %26 ]
ret i32 %32
}