#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 binsearch(int, int *, int);
int /*<<< orphan*/ printf(char *, int, int);
main() {
  int t[8];
  t[0] = 1;
  t[1] = 3;
  t[2] = 4;
  t[3] = 6;
  t[4] = 9;
  t[5] = 11;
  t[6] = 15;
  t[7] = 17;
  printf("number = %d, is at position = %d\n", 1, binsearch(1, t, 8));
  printf("number = %d, is at position = %d\n", 2, binsearch(2, t, 8));
  printf("number = %d, is at position = %d\n", 3, binsearch(3, t, 8));
  printf("number = %d, is at position = %d\n", 4, binsearch(4, t, 8));
  printf("number = %d, is at position = %d\n", 5, binsearch(5, t, 8));
  printf("number = %d, is at position = %d\n", 6, binsearch(6, t, 8));
  printf("number = %d, is at position = %d\n", 7, binsearch(7, t, 8));
  printf("number = %d, is at position = %d\n", 8, binsearch(8, t, 8));
  printf("number = %d, is at position = %d\n", 9, binsearch(9, t, 8));
  printf("number = %d, is at position = %d\n", 10, binsearch(10, t, 8));
  printf("number = %d, is at position = %d\n", 11, binsearch(11, t, 8));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x1,-0x20(%rbp)
movl   $0x3,-0x1c(%rbp)
movl   $0x4,-0x18(%rbp)
movl   $0x6,-0x14(%rbp)
movl   $0x9,-0x10(%rbp)
movl   $0xb,-0xc(%rbp)
movl   $0xf,-0x8(%rbp)
movl   $0x11,-0x4(%rbp)
lea    -0x20(%rbp),%rsi
mov    $0x1,%edi
mov    $0x8,%edx
call   1030 <binsearch@plt>
mov    %eax,%edx
lea    0xe84(%rip),%rdi
mov    $0x1,%esi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rsi
mov    $0x2,%edi
mov    $0x8,%edx
call   1030 <binsearch@plt>
mov    %eax,%edx
lea    0xe5e(%rip),%rdi
mov    $0x2,%esi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rsi
mov    $0x3,%edi
mov    $0x8,%edx
call   1030 <binsearch@plt>
mov    %eax,%edx
lea    0xe38(%rip),%rdi
mov    $0x3,%esi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rsi
mov    $0x4,%edi
mov    $0x8,%edx
call   1030 <binsearch@plt>
mov    %eax,%edx
lea    0xe12(%rip),%rdi
mov    $0x4,%esi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rsi
mov    $0x5,%edi
mov    $0x8,%edx
call   1030 <binsearch@plt>
mov    %eax,%edx
lea    0xdec(%rip),%rdi
mov    $0x5,%esi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rsi
mov    $0x6,%edi
mov    $0x8,%edx
call   1030 <binsearch@plt>
mov    %eax,%edx
lea    0xdc6(%rip),%rdi
mov    $0x6,%esi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rsi
mov    $0x7,%edi
mov    $0x8,%edx
call   1030 <binsearch@plt>
mov    %eax,%edx
lea    0xda0(%rip),%rdi
mov    $0x7,%esi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rsi
mov    $0x8,%edx
mov    %edx,%edi
call   1030 <binsearch@plt>
mov    %eax,%edx
lea    0xd7d(%rip),%rdi
mov    $0x8,%esi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rsi
mov    $0x9,%edi
mov    $0x8,%edx
call   1030 <binsearch@plt>
mov    %eax,%edx
lea    0xd57(%rip),%rdi
mov    $0x9,%esi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rsi
mov    $0xa,%edi
mov    $0x8,%edx
call   1030 <binsearch@plt>
mov    %eax,%edx
lea    0xd31(%rip),%rdi
mov    $0xa,%esi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rsi
mov    $0xb,%edi
mov    $0x8,%edx
call   1030 <binsearch@plt>
mov    %eax,%edx
lea    0xd0b(%rip),%rdi
mov    $0xb,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movaps 0xed2(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xed7(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    %rsp,%r14
mov    $0x1,%edi
mov    %r14,%rsi
mov    $0x8,%edx
call   1030 <binsearch@plt>
lea    0xec6(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x2,%edi
mov    %r14,%rsi
mov    $0x8,%edx
call   1030 <binsearch@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x3,%edi
mov    %r14,%rsi
mov    $0x8,%edx
call   1030 <binsearch@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x4,%edi
mov    %r14,%rsi
mov    $0x8,%edx
call   1030 <binsearch@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x5,%edi
mov    %r14,%rsi
mov    $0x8,%edx
call   1030 <binsearch@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x6,%edi
mov    %r14,%rsi
mov    $0x8,%edx
call   1030 <binsearch@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x7,%edi
mov    %r14,%rsi
mov    $0x8,%edx
call   1030 <binsearch@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x8,%edi
mov    %r14,%rsi
mov    $0x8,%edx
call   1030 <binsearch@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x9,%edi
mov    %r14,%rsi
mov    $0x8,%edx
call   1030 <binsearch@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0xa,%edi
mov    %r14,%rsi
mov    $0x8,%edx
call   1030 <binsearch@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0xb,%edi
mov    %r14,%rsi
mov    $0x8,%edx
call   1030 <binsearch@plt>
mov    %rbx,%rdi
mov    $0xb,%esi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [34 x i8] c"number = %d, is at position = %d\0A\00"
define i32 @main() {
%1 = alloca [8 x i32]
%2 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
store i32 1, i32* %2
%3 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 1
store i32 3, i32* %3
%4 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 2
store i32 4, i32* %4
%5 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 3
store i32 6, i32* %5
%6 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 4
store i32 9, i32* %6
%7 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 5
store i32 11, i32* %7
%8 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 6
store i32 15, i32* %8
%9 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 7
store i32 17, i32* %9
%10 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%11 = call i32 @binsearch(i32 1, i32* %10, i32 8)
%12 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 1, i32 %11)
%13 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%14 = call i32 @binsearch(i32 2, i32* %13, i32 8)
%15 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 2, i32 %14)
%16 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%17 = call i32 @binsearch(i32 3, i32* %16, i32 8)
%18 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 3, i32 %17)
%19 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%20 = call i32 @binsearch(i32 4, i32* %19, i32 8)
%21 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 4, i32 %20)
%22 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%23 = call i32 @binsearch(i32 5, i32* %22, i32 8)
%24 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 5, i32 %23)
%25 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%26 = call i32 @binsearch(i32 6, i32* %25, i32 8)
%27 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 6, i32 %26)
%28 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%29 = call i32 @binsearch(i32 7, i32* %28, i32 8)
%30 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 7, i32 %29)
%31 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%32 = call i32 @binsearch(i32 8, i32* %31, i32 8)
%33 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 8, i32 %32)
%34 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%35 = call i32 @binsearch(i32 9, i32* %34, i32 8)
%36 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 9, i32 %35)
%37 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%38 = call i32 @binsearch(i32 10, i32* %37, i32 8)
%39 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 10, i32 %38)
%40 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%41 = call i32 @binsearch(i32 11, i32* %40, i32 8)
%42 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 11, i32 %41)
ret i32 0
}

LLVM IR (-O2):
@.str = [34 x i8] c"number = %d, is at position = %d\0A\00"
define i32 @main() {
%1 = alloca [8 x i32]
%2 = bitcast [8 x i32]* %1 to i8*
%3 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%4 = bitcast [8 x i32]* %1 to <4 x i32>*
store <4 x i32> <i32 1, i32 3, i32 4, i32 6>, <4 x i32>* %4
%5 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 4
%6 = bitcast i32* %5 to <4 x i32>*
store <4 x i32> <i32 9, i32 11, i32 15, i32 17>, <4 x i32>* %6
%7 = call i32 @binsearch(i32 1, i32* %3, i32 8)
%8 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 1, i32 %7)
%9 = call i32 @binsearch(i32 2, i32* %3, i32 8)
%10 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 2, i32 %9)
%11 = call i32 @binsearch(i32 3, i32* %3, i32 8)
%12 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 3, i32 %11)
%13 = call i32 @binsearch(i32 4, i32* %3, i32 8)
%14 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 4, i32 %13)
%15 = call i32 @binsearch(i32 5, i32* %3, i32 8)
%16 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 5, i32 %15)
%17 = call i32 @binsearch(i32 6, i32* %3, i32 8)
%18 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 6, i32 %17)
%19 = call i32 @binsearch(i32 7, i32* %3, i32 8)
%20 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 7, i32 %19)
%21 = call i32 @binsearch(i32 8, i32* %3, i32 8)
%22 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 8, i32 %21)
%23 = call i32 @binsearch(i32 9, i32* %3, i32 8)
%24 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 9, i32 %23)
%25 = call i32 @binsearch(i32 10, i32* %3, i32 8)
%26 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 10, i32 %25)
%27 = call i32 @binsearch(i32 11, i32* %3, i32 8)
%28 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 11, i32 %27)
ret i32 0
}