#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*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ testList(int *, int, int);
void runTests(int partTwo) {
  printf("** Testing no item list.\n");
  testList(NULL, 0, partTwo);
  int num;
  int t;
  for (num = 1; num < 10; num++) {
    printf("** Testing %d item lists.\n", num);
    for (t = 0; t < 5; t++) {
      int arr[num];
      int i;
      for (i = 0; i < num; i++) {
        arr[i] = rand() % 1000;
      }
      testList(arr, num, partTwo);
    }
    printf("** Passed all tests for %d item lists.\n", num);
  }
}


x86 assembly (clang, -O0):
<runTests>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%edx
xor    %eax,%eax
mov    %eax,%edi
xor    %esi,%esi
call   1040 <testList@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    122f <runTests+0xff>
mov    -0x8(%rbp),%esi
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    1210 <runTests+0xe0>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11ec <runTests+0xbc>
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    -0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11b8 <runTests+0x88>
mov    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
call   1040 <testList@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1180 <runTests+0x50>
mov    -0x8(%rbp),%esi
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115e <runTests+0x2e>
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<runTests>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0xeec(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
xor    %esi,%esi
mov    %ebx,-0x2c(%rbp)
mov    %ebx,%edx
call   1050 <testList@plt>
mov    $0x1,%r12d
lea    0xe89(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rbx
mov    %rsp,%r13
lea    0xf(,%r12,4),%r15
and    $0xfffffffffffffff0,%r15
sub    %r15,%r13
mov    %r13,%rsp
xor    %r14d,%r14d
nopl   0x0(%rax)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
imul   $0x3e8,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0x0(%r13,%r14,4)
add    $0x1,%r14
cmp    %r14,%r12
jne    11a0 <runTests+0x60>
mov    %r13,%rdi
mov    %r12d,%esi
mov    -0x2c(%rbp),%edx
call   1050 <testList@plt>
mov    %rbx,%rsp
mov    %rsp,%r14
mov    %rsp,%r13
sub    %r15,%r13
mov    %r13,%rsp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
imul   $0x3e8,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0x0(%r13,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1200 <runTests+0xc0>
mov    %r13,%rdi
mov    %r12d,%esi
mov    -0x2c(%rbp),%edx
call   1050 <testList@plt>
mov    %r14,%rsp
mov    %rsp,%r14
mov    %rsp,%r13
sub    %r15,%r13
mov    %r13,%rsp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
imul   $0x3e8,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0x0(%r13,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1260 <runTests+0x120>
mov    %r13,%rdi
mov    %r12d,%esi
mov    -0x2c(%rbp),%edx
call   1050 <testList@plt>
mov    %r14,%rsp
mov    %rsp,%r14
mov    %rsp,%r13
sub    %r15,%r13
mov    %r13,%rsp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
imul   $0x3e8,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0x0(%r13,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    12c0 <runTests+0x180>
mov    %r13,%rdi
mov    %r12d,%esi
mov    -0x2c(%rbp),%edx
call   1050 <testList@plt>
mov    %r14,%rsp
mov    %rsp,%r14
mov    %rsp,%r13
sub    %r15,%r13
mov    %r13,%rsp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
imul   $0x3e8,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0x0(%r13,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1320 <runTests+0x1e0>
mov    %r13,%rdi
mov    %r12d,%esi
mov    -0x2c(%rbp),%edx
call   1050 <testList@plt>
mov    %r14,%rsp
lea    0xcb0(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r12
cmp    $0xa,%r12
jne    1170 <runTests+0x30>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"** Testing no item list.\0A\00"
@.str.1 = [27 x i8] c"** Testing %d item lists.\0A\00"
@.str.2 = [40 x i8] c"** Passed all tests for %d item lists.\0A\00"
define void @runTests(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
store i32 %0, i32* %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* %2
%10 = call i32 @testList(i32* null, i32 0, i32 %9)
store i32 1, i32* %3
br label %11
11: ; preds = %49, %1
%12 = load i32, i32* %3
%13 = icmp slt i32 %12, 10
br i1 %13, label %14, label %52
14: ; preds = %11
%15 = load i32, i32* %3
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %15)
store i32 0, i32* %4
br label %17
17: ; preds = %43, %14
%18 = load i32, i32* %4
%19 = icmp slt i32 %18, 5
br i1 %19, label %20, label %46
20: ; preds = %17
%21 = load i32, i32* %3
%22 = zext i32 %21 to i64
%23 = call i8* @llvm.stacksave()
store i8* %23, i8** %5
%24 = alloca i32, i64 %22
store i64 %22, i64* %6
store i32 0, i32* %7
br label %25
25: ; preds = %35, %20
%26 = load i32, i32* %7
%27 = load i32, i32* %3
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %38
29: ; preds = %25
%30 = call i32 (...) @rand()
%31 = srem i32 %30, 1000
%32 = load i32, i32* %7
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32, i32* %24, i64 %33
store i32 %31, i32* %34
br label %35
35: ; preds = %29
%36 = load i32, i32* %7
%37 = add nsw i32 %36, 1
store i32 %37, i32* %7
br label %25
38: ; preds = %25
%39 = load i32, i32* %3
%40 = load i32, i32* %2
%41 = call i32 @testList(i32* %24, i32 %39, i32 %40)
%42 = load i8*, i8** %5
br label %43
43: ; preds = %38
%44 = load i32, i32* %4
%45 = add nsw i32 %44, 1
store i32 %45, i32* %4
br label %17
46: ; preds = %17
%47 = load i32, i32* %3
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32 %47)
br label %49
49: ; preds = %46
%50 = load i32, i32* %3
%51 = add nsw i32 %50, 1
store i32 %51, i32* %3
br label %11
52: ; preds = %11
ret void
}

LLVM IR (-O2):
@.str.1 = [27 x i8] c"** Testing %d item lists.\0A\00"
@.str.2 = [40 x i8] c"** Passed all tests for %d item lists.\0A\00"
@str = [25 x i8] c"** Testing no item list.\00"
define void @runTests(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @testList(i32* null, i32 0, i32 %0)
br label %4
4: ; preds = %1, %61
%5 = phi i64 [ 1, %1 ], [ %64, %61 ]
%6 = trunc i64 %5 to i32
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = call i8* @llvm.stacksave()
%9 = alloca i32, i64 %5
br label %10
10: ; preds = %4, %10
%11 = phi i64 [ 0, %4 ], [ %15, %10 ]
%12 = call i32 (...) @rand()
%13 = srem i32 %12, 1000
%14 = getelementptr inbounds i32, i32* %9, i64 %11
store i32 %13, i32* %14
%15 = add nuw nsw i64 %11, 1
%16 = icmp eq i64 %15, %5
br i1 %16, label %17, label %10
17: ; preds = %10
%18 = call i32 @testList(i32* %9, i32 %6, i32 %0)
%19 = call i8* @llvm.stacksave()
%20 = alloca i32, i64 %5
br label %21
21: ; preds = %21, %17
%22 = phi i64 [ 0, %17 ], [ %26, %21 ]
%23 = call i32 (...) @rand()
%24 = srem i32 %23, 1000
%25 = getelementptr inbounds i32, i32* %20, i64 %22
store i32 %24, i32* %25
%26 = add nuw nsw i64 %22, 1
%27 = icmp eq i64 %26, %5
br i1 %27, label %28, label %21
28: ; preds = %21
%29 = call i32 @testList(i32* %20, i32 %6, i32 %0)
%30 = call i8* @llvm.stacksave()
%31 = alloca i32, i64 %5
br label %32
32: ; preds = %32, %28
%33 = phi i64 [ 0, %28 ], [ %37, %32 ]
%34 = call i32 (...) @rand()
%35 = srem i32 %34, 1000
%36 = getelementptr inbounds i32, i32* %31, i64 %33
store i32 %35, i32* %36
%37 = add nuw nsw i64 %33, 1
%38 = icmp eq i64 %37, %5
br i1 %38, label %39, label %32
39: ; preds = %32
%40 = call i32 @testList(i32* %31, i32 %6, i32 %0)
%41 = call i8* @llvm.stacksave()
%42 = alloca i32, i64 %5
br label %43
43: ; preds = %43, %39
%44 = phi i64 [ 0, %39 ], [ %48, %43 ]
%45 = call i32 (...) @rand()
%46 = srem i32 %45, 1000
%47 = getelementptr inbounds i32, i32* %42, i64 %44
store i32 %46, i32* %47
%48 = add nuw nsw i64 %44, 1
%49 = icmp eq i64 %48, %5
br i1 %49, label %50, label %43
50: ; preds = %43
%51 = call i32 @testList(i32* %42, i32 %6, i32 %0)
%52 = call i8* @llvm.stacksave()
%53 = alloca i32, i64 %5
br label %54
54: ; preds = %54, %50
%55 = phi i64 [ 0, %50 ], [ %59, %54 ]
%56 = call i32 (...) @rand()
%57 = srem i32 %56, 1000
%58 = getelementptr inbounds i32, i32* %53, i64 %55
store i32 %57, i32* %58
%59 = add nuw nsw i64 %55, 1
%60 = icmp eq i64 %59, %5
br i1 %60, label %61, label %54
61: ; preds = %54
%62 = call i32 @testList(i32* %53, i32 %6, i32 %0)
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%64 = add nuw nsw i64 %5, 1
%65 = icmp eq i64 %64, 10
br i1 %65, label %66, label %4
66: ; preds = %61
ret void
}