#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 main(int argc, char **argv) {
  int arr[15] = {60, 54, 51, 46, 43, 40, 39, 37, 36, 32, 27, 20, 19, 16, 8};
  int find = 32, start = 0, end = 14, index = (end + start) / 2;
  do {
    if (arr[index] == find) {
      printf("the special val index of arr is:%d\n", index);
      break;
    } else if (arr[index] < find) {
      end = index - 1;
    } else if (arr[index] > find) {
      start = index + 1;
    }
    index = (end + start) / 2;
  } while (start < end);
  if (start >= end)
    printf("the special val index of arr is not found.");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xebf(%rip),%rsi
mov    $0x3c,%edx
call   1040 <memcpy@plt>
movl   $0x20,-0x54(%rbp)
movl   $0x0,-0x58(%rbp)
movl   $0xe,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
add    -0x58(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x60(%rbp)
movslq -0x60(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%eax
cmp    -0x54(%rbp),%eax
jne    1198 <main+0x78>
mov    -0x60(%rbp),%esi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f8 <main+0xd8>
movslq -0x60(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%eax
cmp    -0x54(%rbp),%eax
jge    11b7 <main+0x97>
mov    -0x60(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    11d6 <main+0xb6>
movslq -0x60(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%eax
cmp    -0x54(%rbp),%eax
jle    11d1 <main+0xb1>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    11d6 <main+0xb6>
jmp    11db <main+0xbb>
mov    -0x5c(%rbp),%eax
add    -0x58(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x60(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x5c(%rbp),%eax
jl     1171 <main+0x51>
mov    -0x58(%rbp),%eax
cmp    -0x5c(%rbp),%eax
jl     1212 <main+0xf2>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.arr = [15 x i32] [i32 60, i32 54, i32 51, i32 46, i32 43, i32 40, i32 39, i32 37, i32 36, i32 32, i32 27, i32 20, i32 19, i32 16, i32 8]
@.str = [36 x i8] c"the special val index of arr is:%d\0A\00"
@.str.1 = [43 x i8] c"the special val index of arr is not found.\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [15 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = bitcast [15 x i32]* %6 to i8*
store i32 32, i32* %7
store i32 0, i32* %8
store i32 14, i32* %9
%12 = load i32, i32* %9
%13 = load i32, i32* %8
%14 = add nsw i32 %12, %13
%15 = sdiv i32 %14, 2
store i32 %15, i32* %10
br label %16
16: ; preds = %53, %2
%17 = load i32, i32* %10
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [15 x i32], [15 x i32]* %6, i64 0, i64 %18
%20 = load i32, i32* %19
%21 = load i32, i32* %7
%22 = icmp eq i32 %20, %21
br i1 %22, label %23, label %26
23: ; preds = %16
%24 = load i32, i32* %10
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %24)
br label %57
26: ; preds = %16
%27 = load i32, i32* %10
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [15 x i32], [15 x i32]* %6, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = load i32, i32* %7
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %36
33: ; preds = %26
%34 = load i32, i32* %10
%35 = sub nsw i32 %34, 1
store i32 %35, i32* %9
br label %47
36: ; preds = %26
%37 = load i32, i32* %10
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [15 x i32], [15 x i32]* %6, i64 0, i64 %38
%40 = load i32, i32* %39
%41 = load i32, i32* %7
%42 = icmp sgt i32 %40, %41
br i1 %42, label %43, label %46
43: ; preds = %36
%44 = load i32, i32* %10
%45 = add nsw i32 %44, 1
store i32 %45, i32* %8
br label %46
46: ; preds = %43, %36
br label %47
47: ; preds = %46, %33
br label %48
48: ; preds = %47
%49 = load i32, i32* %9
%50 = load i32, i32* %8
%51 = add nsw i32 %49, %50
%52 = sdiv i32 %51, 2
store i32 %52, i32* %10
br label %53
53: ; preds = %48
%54 = load i32, i32* %8
%55 = load i32, i32* %9
%56 = icmp slt i32 %54, %55
br i1 %56, label %16, label %57
57: ; preds = %53, %23
%58 = load i32, i32* %8
%59 = load i32, i32* %9
%60 = icmp sge i32 %58, %59
br i1 %60, label %61, label %63
61: ; preds = %57
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
br label %63
63: ; preds = %61, %57
%64 = load i32, i32* %3
ret i32 %64
}

LLVM IR (-O2):
@.str = [36 x i8] c"the special val index of arr is:%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 9)
ret i32 0
}