int main() {
  int array[16];
  int w1 = 20;
  int r;
  long term;
  unsigned int i;
  int j = -(16 / 2);
  for (i = 0; i < 16; i++, j++)
    array[i] = j;
  term = -8;
  r = binsearch(term, array, 16);
  printf("%*s %i %s %li\n", w1, "binsearch returned:", r, "for term", term);
  r = binsearch1(term, array, 16);
  printf("%*s %i %s %li\n", w1, "binsearch1 returned:", r, "for term", term);
  term = 7;
  r = binsearch(term, array, 16);
  printf("%*s %i %s %li\n", w1, "binsearch returned:", r, "for term", term);
  r = binsearch1(term, array, 16);
  printf("%*s %i %s %li\n", w1, "binsearch1 returned:", r, "for term", term);
  term = -1;
  r = binsearch(term, array, 16);
  printf("%*s %i %s %li\n", w1, "binsearch returned:", r, "for term", term);
  r = binsearch1(term, array, 16);
  printf("%*s %i %s %li\n", w1, "binsearch1 returned:", r, "for term", term);
  term = 0;
  r = binsearch(term, array, 16);
  printf("%*s %i %s %li\n", w1, "binsearch returned:", r, "for term", term);
  r = binsearch1(term, array, 16);
  printf("%*s %i %s %li\n", w1, "binsearch1 returned:", r, "for term", term);
  term = 2;
  r = binsearch(term, array, 16);
  printf("%*s %i %s %li\n", w1, "binsearch returned:", r, "for term", term);
  r = binsearch1(term, array, 16);
  printf("%*s %i %s %li\n", w1, "binsearch1 returned:", r, "for term", term);
  term = 8;
  r = binsearch(term, array, 16);
  printf("%*s %i %s %li\n", w1, "binsearch returned:", r, "for term", term);
  r = binsearch1(term, array, 16);
  printf("%*s %i %s %li\n", w1, "binsearch1 returned:", r, "for term", term);
  term = -9;
  r = binsearch(term, array, 16);
  printf("%*s %i %s %li\n", w1, "binsearch returned:", r, "for term", term);
  r = binsearch1(term, array, 16);
  printf("%*s %i %s %li\n", w1, "binsearch1 returned:", r, "for term", term);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x14,-0x54(%rbp)
movl   $0xfffffff8,-0x68(%rbp)
movl   $0x0,-0x64(%rbp)
cmpl   $0x10,-0x64(%rbp)
jae    117f <main+0x4f>
mov    -0x68(%rbp),%ecx
mov    -0x64(%rbp),%eax
mov    %ecx,-0x50(%rbp,%rax,4)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1154 <main+0x24>
movq   $0xfffffffffffffff8,-0x60(%rbp)
ff
mov    -0x60(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x10,%edx
mov    $0x0,%al
call   1030 <binsearch@plt>
mov    %eax,-0x58(%rbp)
mov    -0x54(%rbp),%esi
mov    -0x58(%rbp),%ecx
mov    -0x60(%rbp),%r9
lea    0xe51(%rip),%rdi
lea    0xe59(%rip),%rdx
lea    0xe66(%rip),%r8
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x60(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x10,%edx
mov    $0x0,%al
call   1050 <binsearch1@plt>
mov    %eax,-0x58(%rbp)
mov    -0x54(%rbp),%esi
mov    -0x58(%rbp),%ecx
mov    -0x60(%rbp),%r9
lea    0xe14(%rip),%rdi
lea    0xe39(%rip),%rdx
lea    0xe29(%rip),%r8
mov    $0x0,%al
call   1040 <printf@plt>
movq   $0x7,-0x60(%rbp)
mov    -0x60(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x10,%edx
mov    $0x0,%al
call   1030 <binsearch@plt>
mov    %eax,-0x58(%rbp)
mov    -0x54(%rbp),%esi
mov    -0x58(%rbp),%ecx
mov    -0x60(%rbp),%r9
lea    0xdcf(%rip),%rdi
lea    0xdd7(%rip),%rdx
lea    0xde4(%rip),%r8
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x60(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x10,%edx
mov    $0x0,%al
call   1050 <binsearch1@plt>
mov    %eax,-0x58(%rbp)
mov    -0x54(%rbp),%esi
mov    -0x58(%rbp),%ecx
mov    -0x60(%rbp),%r9
lea    0xd92(%rip),%rdi
lea    0xdb7(%rip),%rdx
lea    0xda7(%rip),%r8
mov    $0x0,%al
call   1040 <printf@plt>
movq   $0xffffffffffffffff,-0x60(%rbp)
ff
mov    -0x60(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x10,%edx
mov    $0x0,%al
call   1030 <binsearch@plt>
mov    %eax,-0x58(%rbp)
mov    -0x54(%rbp),%esi
mov    -0x58(%rbp),%ecx
mov    -0x60(%rbp),%r9
lea    0xd4d(%rip),%rdi
lea    0xd55(%rip),%rdx
lea    0xd62(%rip),%r8
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x60(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x10,%edx
mov    $0x0,%al
call   1050 <binsearch1@plt>
mov    %eax,-0x58(%rbp)
mov    -0x54(%rbp),%esi
mov    -0x58(%rbp),%ecx
mov    -0x60(%rbp),%r9
lea    0xd10(%rip),%rdi
lea    0xd35(%rip),%rdx
lea    0xd25(%rip),%r8
mov    $0x0,%al
call   1040 <printf@plt>
movq   $0x0,-0x60(%rbp)
mov    -0x60(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x10,%edx
mov    $0x0,%al
call   1030 <binsearch@plt>
mov    %eax,-0x58(%rbp)
mov    -0x54(%rbp),%esi
mov    -0x58(%rbp),%ecx
mov    -0x60(%rbp),%r9
lea    0xccb(%rip),%rdi
lea    0xcd3(%rip),%rdx
lea    0xce0(%rip),%r8
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x60(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x10,%edx
mov    $0x0,%al
call   1050 <binsearch1@plt>
mov    %eax,-0x58(%rbp)
mov    -0x54(%rbp),%esi
mov    -0x58(%rbp),%ecx
mov    -0x60(%rbp),%r9
lea    0xc8e(%rip),%rdi
lea    0xcb3(%rip),%rdx
lea    0xca3(%rip),%r8
mov    $0x0,%al
call   1040 <printf@plt>
movq   $0x2,-0x60(%rbp)
mov    -0x60(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x10,%edx
mov    $0x0,%al
call   1030 <binsearch@plt>
mov    %eax,-0x58(%rbp)
mov    -0x54(%rbp),%esi
mov    -0x58(%rbp),%ecx
mov    -0x60(%rbp),%r9
lea    0xc49(%rip),%rdi
lea    0xc51(%rip),%rdx
lea    0xc5e(%rip),%r8
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x60(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x10,%edx
mov    $0x0,%al
call   1050 <binsearch1@plt>
mov    %eax,-0x58(%rbp)
mov    -0x54(%rbp),%esi
mov    -0x58(%rbp),%ecx
mov    -0x60(%rbp),%r9
lea    0xc0c(%rip),%rdi
lea    0xc31(%rip),%rdx
lea    0xc21(%rip),%r8
mov    $0x0,%al
call   1040 <printf@plt>
movq   $0x8,-0x60(%rbp)
mov    -0x60(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x10,%edx
mov    $0x0,%al
call   1030 <binsearch@plt>
mov    %eax,-0x58(%rbp)
mov    -0x54(%rbp),%esi
mov    -0x58(%rbp),%ecx
mov    -0x60(%rbp),%r9
lea    0xbc7(%rip),%rdi
lea    0xbcf(%rip),%rdx
lea    0xbdc(%rip),%r8
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x60(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x10,%edx
mov    $0x0,%al
call   1050 <binsearch1@plt>
mov    %eax,-0x58(%rbp)
mov    -0x54(%rbp),%esi
mov    -0x58(%rbp),%ecx
mov    -0x60(%rbp),%r9
lea    0xb8a(%rip),%rdi
lea    0xbaf(%rip),%rdx
lea    0xb9f(%rip),%r8
mov    $0x0,%al
call   1040 <printf@plt>
movq   $0xfffffffffffffff7,-0x60(%rbp)
ff
mov    -0x60(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x10,%edx
mov    $0x0,%al
call   1030 <binsearch@plt>
mov    %eax,-0x58(%rbp)
mov    -0x54(%rbp),%esi
mov    -0x58(%rbp),%ecx
mov    -0x60(%rbp),%r9
lea    0xb45(%rip),%rdi
lea    0xb4d(%rip),%rdx
lea    0xb5a(%rip),%r8
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x60(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x10,%edx
mov    $0x0,%al
call   1050 <binsearch1@plt>
mov    %eax,-0x58(%rbp)
mov    -0x54(%rbp),%esi
mov    -0x58(%rbp),%ecx
mov    -0x60(%rbp),%r9
lea    0xb08(%rip),%rdi
lea    0xb2d(%rip),%rdx
lea    0xb1d(%rip),%r8
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x40,%rsp
movaps 0xebc(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xec1(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec5(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
mov    %rsp,%r14
mov    $0xfffffffffffffff8,%rdi
mov    %r14,%rsi
mov    $0x10,%edx
xor    %eax,%eax
call   1030 <binsearch@plt>
lea    0xeb4(%rip),%rbx
lea    0xebc(%rip),%r12
lea    0xec9(%rip),%r15
mov    %rbx,%rdi
mov    $0x14,%esi
mov    %r12,%rdx
mov    %eax,%ecx
mov    %r15,%r8
mov    $0xfffffffffffffff8,%r9
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xfffffffffffffff8,%rdi
mov    %r14,%rsi
mov    $0x10,%edx
xor    %eax,%eax
call   1050 <binsearch1@plt>
lea    0xe97(%rip),%r13
mov    %rbx,%rdi
mov    $0x14,%esi
mov    %r13,%rdx
mov    %eax,%ecx
mov    %r15,%r8
mov    $0xfffffffffffffff8,%r9
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7,%edi
mov    %r14,%rsi
mov    $0x10,%edx
xor    %eax,%eax
call   1030 <binsearch@plt>
mov    $0x7,%r9d
mov    %rbx,%rdi
mov    $0x14,%esi
mov    %r12,%rdx
mov    %eax,%ecx
mov    %r15,%r8
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7,%edi
mov    %r14,%rsi
mov    $0x10,%edx
xor    %eax,%eax
call   1050 <binsearch1@plt>
mov    $0x7,%r9d
mov    %rbx,%rdi
mov    $0x14,%esi
mov    %r13,%rdx
mov    %eax,%ecx
mov    %r15,%r8
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffffffffffff,%rdi
mov    %r14,%rsi
mov    $0x10,%edx
xor    %eax,%eax
call   1030 <binsearch@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
mov    %r12,%rdx
mov    %eax,%ecx
mov    %r15,%r8
mov    $0xffffffffffffffff,%r9
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffffffffffff,%rdi
mov    %r14,%rsi
mov    $0x10,%edx
xor    %eax,%eax
call   1050 <binsearch1@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
mov    %r13,%rdx
mov    %eax,%ecx
mov    %r15,%r8
mov    $0xffffffffffffffff,%r9
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
mov    %r14,%rsi
mov    $0x10,%edx
xor    %eax,%eax
call   1030 <binsearch@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
mov    %r12,%rdx
mov    %eax,%ecx
mov    %r15,%r8
xor    %r9d,%r9d
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
mov    %r14,%rsi
mov    $0x10,%edx
xor    %eax,%eax
call   1050 <binsearch1@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
mov    %r13,%rdx
mov    %eax,%ecx
mov    %r15,%r8
xor    %r9d,%r9d
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x2,%edi
mov    %r14,%rsi
mov    $0x10,%edx
xor    %eax,%eax
call   1030 <binsearch@plt>
mov    $0x2,%r9d
mov    %rbx,%rdi
mov    $0x14,%esi
mov    %r12,%rdx
mov    %eax,%ecx
mov    %r15,%r8
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x2,%edi
mov    %r14,%rsi
mov    $0x10,%edx
xor    %eax,%eax
call   1050 <binsearch1@plt>
mov    $0x2,%r9d
mov    %rbx,%rdi
mov    $0x14,%esi
mov    %r13,%rdx
mov    %eax,%ecx
mov    %r15,%r8
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x8,%edi
mov    %r14,%rsi
mov    $0x10,%edx
xor    %eax,%eax
call   1030 <binsearch@plt>
mov    $0x8,%r9d
mov    %rbx,%rdi
mov    $0x14,%esi
mov    %r12,%rdx
mov    %eax,%ecx
mov    %r15,%r8
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x8,%edi
mov    %r14,%rsi
mov    $0x10,%edx
xor    %eax,%eax
call   1050 <binsearch1@plt>
mov    $0x8,%r9d
mov    %rbx,%rdi
mov    $0x14,%esi
mov    %r13,%rdx
mov    %eax,%ecx
mov    %r15,%r8
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xfffffffffffffff7,%rdi
mov    %r14,%rsi
mov    $0x10,%edx
xor    %eax,%eax
call   1030 <binsearch@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
mov    %r12,%rdx
mov    %eax,%ecx
mov    %r15,%r8
mov    $0xfffffffffffffff7,%r9
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xfffffffffffffff7,%rdi
mov    %r14,%rsi
mov    $0x10,%edx
xor    %eax,%eax
call   1050 <binsearch1@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
mov    %r13,%rdx
mov    %eax,%ecx
mov    %r15,%r8
mov    $0xfffffffffffffff7,%r9
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [15 x i8] c"%*s %i %s %li\0A\00"
@.str.1 = [20 x i8] c"binsearch returned:\00"
@.str.2 = [9 x i8] c"for term\00"
@.str.3 = [21 x i8] c"binsearch1 returned:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [16 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 20, i32* %3
store i32 -8, i32* %7
store i32 0, i32* %6
br label %8
8: ; preds = %16, %0
%9 = load i32, i32* %6
%10 = icmp ult i32 %9, 16
br i1 %10, label %11, label %21
11: ; preds = %8
%12 = load i32, i32* %7
%13 = load i32, i32* %6
%14 = zext i32 %13 to i64
%15 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 %14
store i32 %12, i32* %15
br label %16
16: ; preds = %11
%17 = load i32, i32* %6
%18 = add i32 %17, 1
store i32 %18, i32* %6
%19 = load i32, i32* %7
%20 = add nsw i32 %19, 1
store i32 %20, i32* %7
br label %8
21: ; preds = %8
store i64 -8, i64* %5
%22 = load i64, i64* %5
%23 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 0
%24 = call i32 (i64, i32*, i32, ...) bitcast (i32 (...)* @binsearch to i32 (i64, i32*, i32, ...)*)(i64 %22, i32* %23, i32 16)
store i32 %24, i32* %4
%25 = load i32, i32* %3
%26 = load i32, i32* %4
%27 = load i64, i64* %5
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %25, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %26, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 %27)
%29 = load i64, i64* %5
%30 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 0
%31 = call i32 (i64, i32*, i32, ...) bitcast (i32 (...)* @binsearch1 to i32 (i64, i32*, i32, ...)*)(i64 %29, i32* %30, i32 16)
store i32 %31, i32* %4
%32 = load i32, i32* %3
%33 = load i32, i32* %4
%34 = load i64, i64* %5
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %32, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %33, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 %34)
store i64 7, i64* %5
%36 = load i64, i64* %5
%37 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 0
%38 = call i32 (i64, i32*, i32, ...) bitcast (i32 (...)* @binsearch to i32 (i64, i32*, i32, ...)*)(i64 %36, i32* %37, i32 16)
store i32 %38, i32* %4
%39 = load i32, i32* %3
%40 = load i32, i32* %4
%41 = load i64, i64* %5
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %39, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %40, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 %41)
%43 = load i64, i64* %5
%44 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 0
%45 = call i32 (i64, i32*, i32, ...) bitcast (i32 (...)* @binsearch1 to i32 (i64, i32*, i32, ...)*)(i64 %43, i32* %44, i32 16)
store i32 %45, i32* %4
%46 = load i32, i32* %3
%47 = load i32, i32* %4
%48 = load i64, i64* %5
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %46, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %47, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 %48)
store i64 -1, i64* %5
%50 = load i64, i64* %5
%51 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 0
%52 = call i32 (i64, i32*, i32, ...) bitcast (i32 (...)* @binsearch to i32 (i64, i32*, i32, ...)*)(i64 %50, i32* %51, i32 16)
store i32 %52, i32* %4
%53 = load i32, i32* %3
%54 = load i32, i32* %4
%55 = load i64, i64* %5
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %53, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %54, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 %55)
%57 = load i64, i64* %5
%58 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 0
%59 = call i32 (i64, i32*, i32, ...) bitcast (i32 (...)* @binsearch1 to i32 (i64, i32*, i32, ...)*)(i64 %57, i32* %58, i32 16)
store i32 %59, i32* %4
%60 = load i32, i32* %3
%61 = load i32, i32* %4
%62 = load i64, i64* %5
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %60, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %61, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 %62)
store i64 0, i64* %5
%64 = load i64, i64* %5
%65 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 0
%66 = call i32 (i64, i32*, i32, ...) bitcast (i32 (...)* @binsearch to i32 (i64, i32*, i32, ...)*)(i64 %64, i32* %65, i32 16)
store i32 %66, i32* %4
%67 = load i32, i32* %3
%68 = load i32, i32* %4
%69 = load i64, i64* %5
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %67, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %68, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 %69)
%71 = load i64, i64* %5
%72 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 0
%73 = call i32 (i64, i32*, i32, ...) bitcast (i32 (...)* @binsearch1 to i32 (i64, i32*, i32, ...)*)(i64 %71, i32* %72, i32 16)
store i32 %73, i32* %4
%74 = load i32, i32* %3
%75 = load i32, i32* %4
%76 = load i64, i64* %5
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %74, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %75, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 %76)
store i64 2, i64* %5
%78 = load i64, i64* %5
%79 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 0
%80 = call i32 (i64, i32*, i32, ...) bitcast (i32 (...)* @binsearch to i32 (i64, i32*, i32, ...)*)(i64 %78, i32* %79, i32 16)
store i32 %80, i32* %4
%81 = load i32, i32* %3
%82 = load i32, i32* %4
%83 = load i64, i64* %5
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %81, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %82, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 %83)
%85 = load i64, i64* %5
%86 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 0
%87 = call i32 (i64, i32*, i32, ...) bitcast (i32 (...)* @binsearch1 to i32 (i64, i32*, i32, ...)*)(i64 %85, i32* %86, i32 16)
store i32 %87, i32* %4
%88 = load i32, i32* %3
%89 = load i32, i32* %4
%90 = load i64, i64* %5
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %88, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %89, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 %90)
store i64 8, i64* %5
%92 = load i64, i64* %5
%93 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 0
%94 = call i32 (i64, i32*, i32, ...) bitcast (i32 (...)* @binsearch to i32 (i64, i32*, i32, ...)*)(i64 %92, i32* %93, i32 16)
store i32 %94, i32* %4
%95 = load i32, i32* %3
%96 = load i32, i32* %4
%97 = load i64, i64* %5
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %95, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %96, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 %97)
%99 = load i64, i64* %5
%100 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 0
%101 = call i32 (i64, i32*, i32, ...) bitcast (i32 (...)* @binsearch1 to i32 (i64, i32*, i32, ...)*)(i64 %99, i32* %100, i32 16)
store i32 %101, i32* %4
%102 = load i32, i32* %3
%103 = load i32, i32* %4
%104 = load i64, i64* %5
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %102, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %103, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 %104)
store i64 -9, i64* %5
%106 = load i64, i64* %5
%107 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 0
%108 = call i32 (i64, i32*, i32, ...) bitcast (i32 (...)* @binsearch to i32 (i64, i32*, i32, ...)*)(i64 %106, i32* %107, i32 16)
store i32 %108, i32* %4
%109 = load i32, i32* %3
%110 = load i32, i32* %4
%111 = load i64, i64* %5
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %109, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %110, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 %111)
%113 = load i64, i64* %5
%114 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 0
%115 = call i32 (i64, i32*, i32, ...) bitcast (i32 (...)* @binsearch1 to i32 (i64, i32*, i32, ...)*)(i64 %113, i32* %114, i32 16)
store i32 %115, i32* %4
%116 = load i32, i32* %3
%117 = load i32, i32* %4
%118 = load i64, i64* %5
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %116, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %117, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 %118)
%120 = load i32, i32* %1
ret i32 %120
}

LLVM IR (-O2):
@.str = [15 x i8] c"%*s %i %s %li\0A\00"
@.str.1 = [20 x i8] c"binsearch returned:\00"
@.str.2 = [9 x i8] c"for term\00"
@.str.3 = [21 x i8] c"binsearch1 returned:\00"
define i32 @main() {
%1 = alloca [16 x i32]
%2 = bitcast [16 x i32]* %1 to i8*
%3 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 0
%4 = bitcast [16 x i32]* %1 to <4 x i32>*
store <4 x i32> <i32 -8, i32 -7, i32 -6, i32 -5>, <4 x i32>* %4
%5 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 4
%6 = bitcast i32* %5 to <4 x i32>*
store <4 x i32> <i32 -4, i32 -3, i32 -2, i32 -1>, <4 x i32>* %6
%7 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 8
%8 = bitcast i32* %7 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %8
%9 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 12
%10 = bitcast i32* %9 to <4 x i32>*
store <4 x i32> <i32 4, i32 5, i32 6, i32 7>, <4 x i32>* %10
%11 = call i32 (i64, i32*, i32, ...) bitcast (i32 (...)* @binsearch to i32 (i64, i32*, i32, ...)*)(i64 -8, i32* %3, i32 16)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 20, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %11, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 -8)
%13 = call i32 (i64, i32*, i32, ...) bitcast (i32 (...)* @binsearch1 to i32 (i64, i32*, i32, ...)*)(i64 -8, i32* %3, i32 16)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 20, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 -8)
%15 = call i32 (i64, i32*, i32, ...) bitcast (i32 (...)* @binsearch to i32 (i64, i32*, i32, ...)*)(i64 7, i32* %3, i32 16)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 20, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %15, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 7)
%17 = call i32 (i64, i32*, i32, ...) bitcast (i32 (...)* @binsearch1 to i32 (i64, i32*, i32, ...)*)(i64 7, i32* %3, i32 16)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 20, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %17, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 7)
%19 = call i32 (i64, i32*, i32, ...) bitcast (i32 (...)* @binsearch to i32 (i64, i32*, i32, ...)*)(i64 -1, i32* %3, i32 16)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 20, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %19, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 -1)
%21 = call i32 (i64, i32*, i32, ...) bitcast (i32 (...)* @binsearch1 to i32 (i64, i32*, i32, ...)*)(i64 -1, i32* %3, i32 16)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 20, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %21, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 -1)
%23 = call i32 (i64, i32*, i32, ...) bitcast (i32 (...)* @binsearch to i32 (i64, i32*, i32, ...)*)(i64 0, i32* %3, i32 16)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 20, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %23, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 0)
%25 = call i32 (i64, i32*, i32, ...) bitcast (i32 (...)* @binsearch1 to i32 (i64, i32*, i32, ...)*)(i64 0, i32* %3, i32 16)
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 20, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %25, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 0)
%27 = call i32 (i64, i32*, i32, ...) bitcast (i32 (...)* @binsearch to i32 (i64, i32*, i32, ...)*)(i64 2, i32* %3, i32 16)
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 20, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %27, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 2)
%29 = call i32 (i64, i32*, i32, ...) bitcast (i32 (...)* @binsearch1 to i32 (i64, i32*, i32, ...)*)(i64 2, i32* %3, i32 16)
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 20, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %29, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 2)
%31 = call i32 (i64, i32*, i32, ...) bitcast (i32 (...)* @binsearch to i32 (i64, i32*, i32, ...)*)(i64 8, i32* %3, i32 16)
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 20, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %31, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 8)
%33 = call i32 (i64, i32*, i32, ...) bitcast (i32 (...)* @binsearch1 to i32 (i64, i32*, i32, ...)*)(i64 8, i32* %3, i32 16)
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 20, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %33, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 8)
%35 = call i32 (i64, i32*, i32, ...) bitcast (i32 (...)* @binsearch to i32 (i64, i32*, i32, ...)*)(i64 -9, i32* %3, i32 16)
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 20, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %35, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 -9)
%37 = call i32 (i64, i32*, i32, ...) bitcast (i32 (...)* @binsearch1 to i32 (i64, i32*, i32, ...)*)(i64 -9, i32* %3, i32 16)
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 20, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %37, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 -9)
ret i32 0
}