#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 /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, ...);
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ test(int, int);
scalar_t__ time(int /*<<< orphan*/ *);
void bulktester1() {
  int testcount;
  int correctcount = 0;
  time_t t;
  srand((unsigned)time(&t));
  for (testcount = 1; testcount <= 100; testcount++) {
    if (test(testcount, 11)) {
      correctcount++;
      printf("Test %d on length %d correct\n", testcount, 11);
    }
  }
  if (correctcount + 1 < testcount) {
    printf("Ran %d tests but only %d were correctly sorted.\n", testcount - 1,
           correctcount);
  } else {
    printf("All %d tests were correctly sorted.\n", testcount - 1);
  }
}


x86 assembly (clang, -O0):
<bulktester1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
lea    -0xc(%rbp),%rdi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x1,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jg     11b9 <bulktester1+0x79>
mov    -0x4(%rbp),%edi
mov    $0xb,%esi
call   1060 <test@plt>
cmp    $0x0,%rax
je     11a6 <bulktester1+0x66>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%esi
lea    0xe66(%rip),%rdi
mov    $0xb,%edx
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ab <bulktester1+0x6b>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1166 <bulktester1+0x26>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
cmp    -0x4(%rbp),%eax
jge    11e4 <bulktester1+0xa4>
mov    -0x4(%rbp),%esi
sub    $0x1,%esi
mov    -0x8(%rbp),%edx
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f8 <bulktester1+0xb8>
mov    -0x4(%rbp),%esi
sub    $0x1,%esi
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bulktester1>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rdi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x1,%ebp
lea    0xe9b(%rip),%r14
xor    %ebx,%ebx
jmp    1178 <bulktester1+0x38>
nopl   0x0(%rax)
add    $0x1,%ebp
cmp    $0x65,%ebp
je     119f <bulktester1+0x5f>
mov    %ebp,%edi
mov    $0xb,%esi
call   1060 <test@plt>
test   %rax,%rax
je     1170 <bulktester1+0x30>
add    $0x1,%ebx
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0xb,%edx
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1170 <bulktester1+0x30>
cmp    $0x63,%ebx
jg     11bb <bulktester1+0x7b>
lea    0xe73(%rip),%rdi
mov    $0x64,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11ce <bulktester1+0x8e>
lea    0xe8d(%rip),%rdi
mov    $0x64,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Test %d on length %d correct\0A\00"
@.str.1 = [49 x i8] c"Ran %d tests but only %d were correctly sorted.\0A\00"
@.str.2 = [37 x i8] c"All %d tests were correctly sorted.\0A\00"
define void @bulktester1() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %2
%4 = call i64 @time(i32* %3)
%5 = trunc i64 %4 to i32
%6 = call i32 @srand(i32 %5)
store i32 1, i32* %1
br label %7
7: ; preds = %20, %0
%8 = load i32, i32* %1
%9 = icmp sle i32 %8, 100
br i1 %9, label %10, label %23
10: ; preds = %7
%11 = load i32, i32* %1
%12 = call i64 @test(i32 %11, i32 11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %10
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
%17 = load i32, i32* %1
%18 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %17, i32 11)
br label %19
19: ; preds = %14, %10
br label %20
20: ; preds = %19
%21 = load i32, i32* %1
%22 = add nsw i32 %21, 1
store i32 %22, i32* %1
br label %7
23: ; preds = %7
%24 = load i32, i32* %2
%25 = add nsw i32 %24, 1
%26 = load i32, i32* %1
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %33
28: ; preds = %23
%29 = load i32, i32* %1
%30 = sub nsw i32 %29, 1
%31 = load i32, i32* %2
%32 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i32 %30, i32 %31)
br label %37
33: ; preds = %23
%34 = load i32, i32* %1
%35 = sub nsw i32 %34, 1
%36 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %35)
br label %37
37: ; preds = %33, %28
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"Test %d on length %d correct\0A\00"
@.str.1 = [49 x i8] c"Ran %d tests but only %d were correctly sorted.\0A\00"
@.str.2 = [37 x i8] c"All %d tests were correctly sorted.\0A\00"
define void @bulktester1() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i64 @time(i32* %1)
%4 = trunc i64 %3 to i32
%5 = call i32 @srand(i32 %4)
br label %6
6: ; preds = %0, %14
%7 = phi i32 [ 0, %0 ], [ %15, %14 ]
%8 = phi i32 [ 1, %0 ], [ %16, %14 ]
%9 = call i64 @test(i32 %8, i32 11)
%10 = icmp eq i64 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %6
%12 = add nsw i32 %7, 1
%13 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %8, i32 11)
br label %14
14: ; preds = %6, %11
%15 = phi i32 [ %12, %11 ], [ %7, %6 ]
%16 = add nuw nsw i32 %8, 1
%17 = icmp eq i32 %16, 101
br i1 %17, label %18, label %6
18: ; preds = %14
%19 = icmp slt i32 %15, 100
br i1 %19, label %20, label %22
20: ; preds = %18
%21 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i32 100, i32 %15)
br label %24
22: ; preds = %18
%23 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 100)
br label %24
24: ; preds = %22, %20
ret void
}