#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*/ test2;
typedef int /*<<< orphan*/ test1;

/* Variables and functions */
int /*<<< orphan*/ binarySearchInt(int *, int, int);
int /*<<< orphan*/ testResult(int /*<<< orphan*/);
int main(int argc, char const *argv[]) {
  int test1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
  testResult(binarySearchInt(test1, sizeof(test1) / sizeof(int), 2));
  testResult(binarySearchInt(test1, sizeof(test1) / sizeof(int), 55));
  testResult(binarySearchInt(test1, 0, 6));
  int test2[] = {23, 44, 51, 65, 66, 67, 88, 89, 91, 92, 94, 100};
  testResult(binarySearchInt(test2, sizeof(test2) / sizeof(int), 87));
  testResult(binarySearchInt(test2, sizeof(test2) / sizeof(int), 100));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xeaf(%rip),%rsi
mov    $0x28,%edx
call   1030 <memcpy@plt>
lea    -0x40(%rbp),%rdi
mov    $0xa,%esi
mov    $0x2,%edx
call   1040 <binarySearchInt@plt>
mov    %eax,%edi
call   1050 <testResult@plt>
lea    -0x40(%rbp),%rdi
mov    $0xa,%esi
mov    $0x37,%edx
call   1040 <binarySearchInt@plt>
mov    %eax,%edi
call   1050 <testResult@plt>
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x6,%edx
call   1040 <binarySearchInt@plt>
mov    %eax,%edi
call   1050 <testResult@plt>
lea    -0x70(%rbp),%rdi
lea    0xe7f(%rip),%rsi
mov    $0x30,%edx
call   1030 <memcpy@plt>
lea    -0x70(%rbp),%rdi
mov    $0xc,%esi
mov    $0x57,%edx
call   1040 <binarySearchInt@plt>
mov    %eax,%edi
call   1050 <testResult@plt>
lea    -0x70(%rbp),%rdi
mov    $0xc,%esi
mov    $0x64,%edx
call   1040 <binarySearchInt@plt>
mov    %eax,%edi
call   1050 <testResult@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x60,%rsp
mov    0xef4(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xed8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebc(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0x2,%edx
call   1030 <binarySearchInt@plt>
mov    %eax,%edi
call   1040 <testResult@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0x37,%edx
call   1030 <binarySearchInt@plt>
mov    %eax,%edi
call   1040 <testResult@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x6,%edx
call   1030 <binarySearchInt@plt>
mov    %eax,%edi
call   1040 <testResult@plt>
movaps 0xeb6(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xe9a(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xe7e(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xc,%esi
mov    $0x57,%edx
call   1030 <binarySearchInt@plt>
mov    %eax,%edi
call   1040 <testResult@plt>
mov    %rbx,%rdi
mov    $0xc,%esi
mov    $0x64,%edx
call   1030 <binarySearchInt@plt>
mov    %eax,%edi
call   1040 <testResult@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.test1 = [10 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9]
@__const.main.test2 = [12 x i32] [i32 23, i32 44, i32 51, i32 65, i32 66, i32 67, i32 88, i32 89, i32 91, i32 92, i32 94, i32 100]
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [10 x i32]
%7 = alloca [12 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [10 x i32]* %6 to i8*
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 0
%10 = call i32 @binarySearchInt(i32* %9, i32 10, i32 2)
%11 = call i32 @testResult(i32 %10)
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 0
%13 = call i32 @binarySearchInt(i32* %12, i32 10, i32 55)
%14 = call i32 @testResult(i32 %13)
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 0
%16 = call i32 @binarySearchInt(i32* %15, i32 0, i32 6)
%17 = call i32 @testResult(i32 %16)
%18 = bitcast [12 x i32]* %7 to i8*
%19 = getelementptr inbounds [12 x i32], [12 x i32]* %7, i64 0, i64 0
%20 = call i32 @binarySearchInt(i32* %19, i32 12, i32 87)
%21 = call i32 @testResult(i32 %20)
%22 = getelementptr inbounds [12 x i32], [12 x i32]* %7, i64 0, i64 0
%23 = call i32 @binarySearchInt(i32* %22, i32 12, i32 100)
%24 = call i32 @testResult(i32 %23)
ret i32 0
}

LLVM IR (-O2):
@__const.main.test1 = [10 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9]
@__const.main.test2 = [12 x i32] [i32 23, i32 44, i32 51, i32 65, i32 66, i32 67, i32 88, i32 89, i32 91, i32 92, i32 94, i32 100]
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10 x i32]
%4 = alloca [12 x i32]
%5 = bitcast [10 x i32]* %3 to i8*
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%7 = call i32 @binarySearchInt(i32* %6, i32 10, i32 2)
%8 = call i32 @testResult(i32 %7)
%9 = call i32 @binarySearchInt(i32* %6, i32 10, i32 55)
%10 = call i32 @testResult(i32 %9)
%11 = call i32 @binarySearchInt(i32* %6, i32 0, i32 6)
%12 = call i32 @testResult(i32 %11)
%13 = bitcast [12 x i32]* %4 to i8*
%14 = getelementptr inbounds [12 x i32], [12 x i32]* %4, i64 0, i64 0
%15 = call i32 @binarySearchInt(i32* %14, i32 12, i32 87)
%16 = call i32 @testResult(i32 %15)
%17 = call i32 @binarySearchInt(i32* %14, i32 12, i32 100)
%18 = call i32 @testResult(i32 %17)
ret i32 0
}