#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 /*<<< orphan*/ test_large_array();
int /*<<< orphan*/ test_one_element();
int /*<<< orphan*/ test_small_array();
int /*<<< orphan*/ test_three_elements();
int /*<<< orphan*/ test_two_elements();
int main() {
  int counter = 0;
  if (!test_one_element()) {
    counter++;
    printf("One element array search test failed!\n");
  }
  if (!test_two_elements()) {
    counter++;
    printf("Two elements array search test failed!\n");
  }
  if (!test_three_elements()) {
    counter++;
    printf("Three elements array search test failed!\n");
  }
  if (!test_small_array()) {
    counter++;
    printf("Small array search test failed!\n");
  }
  if (!test_large_array()) {
    counter++;
    printf("Large array search test failed!\n");
  }
  printf("%d tests failed.\n", counter);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1070 <test_one_element@plt>
cmp    $0x0,%eax
jne    119d <main+0x3d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <test_two_elements@plt>
cmp    $0x0,%eax
jne    11c4 <main+0x64>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <test_three_elements@plt>
cmp    $0x0,%eax
jne    11eb <main+0x8b>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <test_small_array@plt>
cmp    $0x0,%eax
jne    1212 <main+0xb2>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1080 <test_large_array@plt>
cmp    $0x0,%eax
jne    1239 <main+0xd9>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1080 <test_one_element@plt>
test   %eax,%eax
jne    118f <main+0x1f>
lea    0xe8d(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
xor    %eax,%eax
call   1070 <test_two_elements@plt>
test   %eax,%eax
jne    11a9 <main+0x39>
add    $0x1,%ebx
lea    0xe94(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <test_three_elements@plt>
test   %eax,%eax
jne    11c3 <main+0x53>
add    $0x1,%ebx
lea    0xea1(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <test_small_array@plt>
test   %eax,%eax
jne    11dd <main+0x6d>
add    $0x1,%ebx
lea    0xeb0(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1090 <test_large_array@plt>
test   %eax,%eax
jne    11f7 <main+0x87>
add    $0x1,%ebx
lea    0xeb6(%rip),%rdi
call   1030 <puts@plt>
lea    0xe02(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [39 x i8] c"One element array search test failed!\0A\00"
@.str.1 = [40 x i8] c"Two elements array search test failed!\0A\00"
@.str.2 = [42 x i8] c"Three elements array search test failed!\0A\00"
@.str.3 = [33 x i8] c"Small array search test failed!\0A\00"
@.str.4 = [33 x i8] c"Large array search test failed!\0A\00"
@.str.5 = [18 x i8] c"%d tests failed.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 (...) @test_one_element()
%4 = icmp ne i32 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %0
%6 = load i32, i32* %2
%7 = add nsw i32 %6, 1
store i32 %7, i32* %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %5, %0
%10 = call i32 (...) @test_two_elements()
%11 = icmp ne i32 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %9
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 1
store i32 %14, i32* %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %12, %9
%17 = call i32 (...) @test_three_elements()
%18 = icmp ne i32 %17, 0
br i1 %18, label %23, label %19
19: ; preds = %16
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
br label %23
23: ; preds = %19, %16
%24 = call i32 (...) @test_small_array()
%25 = icmp ne i32 %24, 0
br i1 %25, label %30, label %26
26: ; preds = %23
%27 = load i32, i32* %2
%28 = add nsw i32 %27, 1
store i32 %28, i32* %2
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
br label %30
30: ; preds = %26, %23
%31 = call i32 (...) @test_large_array()
%32 = icmp ne i32 %31, 0
br i1 %32, label %37, label %33
33: ; preds = %30
%34 = load i32, i32* %2
%35 = add nsw i32 %34, 1
store i32 %35, i32* %2
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0))
br label %37
37: ; preds = %33, %30
%38 = load i32, i32* %2
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i32 %38)
%40 = load i32, i32* %1
ret i32 %40
}

LLVM IR (-O2):
@.str.5 = [18 x i8] c"%d tests failed.\0A\00"
@str = [38 x i8] c"One element array search test failed!\00"
@str.6 = [39 x i8] c"Two elements array search test failed!\00"
@str.7 = [41 x i8] c"Three elements array search test failed!\00"
@str.8 = [32 x i8] c"Small array search test failed!\00"
@str.9 = [32 x i8] c"Large array search test failed!\00"
define i32 @main() {
%1 = tail call i32 (...) @test_one_element()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
%6 = phi i32 [ 0, %0 ], [ 1, %3 ]
%7 = tail call i32 (...) @test_two_elements()
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = add nuw nsw i32 %6, 1
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.6, i64 0, i64 0))
br label %12
12: ; preds = %9, %5
%13 = phi i32 [ %6, %5 ], [ %10, %9 ]
%14 = tail call i32 (...) @test_three_elements()
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = add nuw nsw i32 %13, 1
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.7, i64 0, i64 0))
br label %19
19: ; preds = %16, %12
%20 = phi i32 [ %13, %12 ], [ %17, %16 ]
%21 = tail call i32 (...) @test_small_array()
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = add nuw nsw i32 %20, 1
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.8, i64 0, i64 0))
br label %26
26: ; preds = %23, %19
%27 = phi i32 [ %20, %19 ], [ %24, %23 ]
%28 = tail call i32 (...) @test_large_array()
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %26
%31 = add nuw nsw i32 %27, 1
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.9, i64 0, i64 0))
br label %33
33: ; preds = %30, %26
%34 = phi i32 [ %27, %26 ], [ %31, %30 ]
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i32 %34)
ret i32 0
}