#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);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int arr[10] = {3, 8, 11, 44, 55, 66, 77, 99, 100, 120};
  int i, num, sta, end, mid;
  scanf("%d", &num);
  if (num < arr[0] || num > arr[10 - 1])
    printf("%d 不在数组当中.\n", num);
  else {
    if (num == arr[0] || num == arr[10 - 1]) {
      printf("%d 在数组当中.\n", num);
      return 0;
    }
    sta = 0;
    end = 10 - 1;
    for (i = 0; sta != end; i++) {
      mid = (sta + end) / 2;
      if (arr[mid] > num) {
        sta = sta;
        end = mid;
      } else if (arr[mid] < num) {
        sta = mid + 1;
        end = end;
      } else {
        printf("%d 在数组当中.\n", num);
        break;
      }
    }
    if (sta == end)
      printf("%d 不在数组当中.\n", num);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
lea    0xecd(%rip),%rdi
lea    -0x38(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x38(%rbp),%eax
cmp    -0x30(%rbp),%eax
jl     117c <main+0x4c>
mov    -0x38(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1190 <main+0x60>
mov    -0x38(%rbp),%esi
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
jmp    1288 <main+0x158>
mov    -0x38(%rbp),%eax
cmp    -0x30(%rbp),%eax
je     11a8 <main+0x78>
mov    -0x38(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    11c3 <main+0x93>
mov    -0x38(%rbp),%esi
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    128f <main+0x15f>
movl   $0x0,-0x3c(%rbp)
movl   $0x9,-0x40(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x40(%rbp),%eax
je     1268 <main+0x138>
mov    -0x3c(%rbp),%eax
add    -0x40(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x44(%rbp)
movslq -0x44(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
cmp    -0x38(%rbp),%eax
jle    1217 <main+0xe7>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x40(%rbp)
jmp    1255 <main+0x125>
movslq -0x44(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
cmp    -0x38(%rbp),%eax
jge    123c <main+0x10c>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x40(%rbp)
jmp    1250 <main+0x120>
mov    -0x38(%rbp),%esi
lea    0xdfd(%rip),%rdi
call   1030 <printf@plt>
jmp    1268 <main+0x138>
jmp    1255 <main+0x125>
jmp    125a <main+0x12a>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11d8 <main+0xa8>
mov    -0x3c(%rbp),%eax
cmp    -0x40(%rbp),%eax
jne    1283 <main+0x153>
mov    -0x38(%rbp),%esi
lea    0xdad(%rip),%rdi
call   1030 <printf@plt>
jmp    1288 <main+0x158>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf00(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
lea    -0x79(%rsi),%eax
lea    0xeeb(%rip),%rdi
cmp    $0xffffff8a,%eax
jb     1159 <main+0x39>
lea    0xef7(%rip),%r8
cmp    $0x3,%esi
je     1156 <main+0x36>
cmp    $0x78,%esi
jne    1162 <main+0x42>
mov    %r8,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
mov    $0x9,%r10d
lea    0xe8f(%rip),%r9
jmp    1188 <main+0x68>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ecx,%r10d
cmp    %r10d,%eax
je     1159 <main+0x39>
lea    (%r10,%rax,1),%edx
mov    %edx,%ecx
shr    $0x1f,%ecx
add    %edx,%ecx
sar    %ecx
movslq %ecx,%rdx
cmp    %esi,(%r9,%rdx,4)
jg     1180 <main+0x60>
jge    1156 <main+0x36>
add    $0x1,%ecx
mov    %ecx,%eax
cmp    %r10d,%eax
jne    1188 <main+0x68>
jmp    1159 <main+0x39>

LLVM IR (-O0):
@__const.main.arr = [10 x i32] [i32 3, i32 8, i32 11, i32 44, i32 55, i32 66, i32 77, i32 99, i32 100, i32 120]
@.str = [3 x i8] c"%d\00"
@.str.1 = [24 x i8] c"%d \E4\B8\8D\E5\9C\A8\E6\95\B0\E7\BB\84\E5\BD\93\E4\B8\AD.\0A\00"
@.str.2 = [21 x i8] c"%d \E5\9C\A8\E6\95\B0\E7\BB\84\E5\BD\93\E4\B8\AD.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = bitcast [10 x i32]* %2 to i8*
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%10 = load i32, i32* %4
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%12 = load i32, i32* %11
%13 = icmp slt i32 %10, %12
br i1 %13, label %19, label %14
14: ; preds = %0
%15 = load i32, i32* %4
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 9
%17 = load i32, i32* %16
%18 = icmp sgt i32 %15, %17
br i1 %18, label %19, label %22
19: ; preds = %14, %0
%20 = load i32, i32* %4
%21 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %20)
br label %81
22: ; preds = %14
%23 = load i32, i32* %4
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%25 = load i32, i32* %24
%26 = icmp eq i32 %23, %25
br i1 %26, label %32, label %27
27: ; preds = %22
%28 = load i32, i32* %4
%29 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 9
%30 = load i32, i32* %29
%31 = icmp eq i32 %28, %30
br i1 %31, label %32, label %35
32: ; preds = %27, %22
%33 = load i32, i32* %4
%34 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %33)
store i32 0, i32* %1
br label %82
35: ; preds = %27
store i32 0, i32* %5
store i32 9, i32* %6
store i32 0, i32* %3
br label %36
36: ; preds = %70, %35
%37 = load i32, i32* %5
%38 = load i32, i32* %6
%39 = icmp ne i32 %37, %38
br i1 %39, label %40, label %73
40: ; preds = %36
%41 = load i32, i32* %5
%42 = load i32, i32* %6
%43 = add nsw i32 %41, %42
%44 = sdiv i32 %43, 2
store i32 %44, i32* %7
%45 = load i32, i32* %7
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %46
%48 = load i32, i32* %47
%49 = load i32, i32* %4
%50 = icmp sgt i32 %48, %49
br i1 %50, label %51, label %54
51: ; preds = %40
%52 = load i32, i32* %5
store i32 %52, i32* %5
%53 = load i32, i32* %7
store i32 %53, i32* %6
br label %69
54: ; preds = %40
%55 = load i32, i32* %7
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %56
%58 = load i32, i32* %57
%59 = load i32, i32* %4
%60 = icmp slt i32 %58, %59
br i1 %60, label %61, label %65
61: ; preds = %54
%62 = load i32, i32* %7
%63 = add nsw i32 %62, 1
store i32 %63, i32* %5
%64 = load i32, i32* %6
store i32 %64, i32* %6
br label %68
65: ; preds = %54
%66 = load i32, i32* %4
%67 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %66)
br label %73
68: ; preds = %61
br label %69
69: ; preds = %68, %51
br label %70
70: ; preds = %69
%71 = load i32, i32* %3
%72 = add nsw i32 %71, 1
store i32 %72, i32* %3
br label %36
73: ; preds = %65, %36
%74 = load i32, i32* %5
%75 = load i32, i32* %6
%76 = icmp eq i32 %74, %75
br i1 %76, label %77, label %80
77: ; preds = %73
%78 = load i32, i32* %4
%79 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %78)
br label %80
80: ; preds = %77, %73
br label %81
81: ; preds = %80, %19
store i32 0, i32* %1
br label %82
82: ; preds = %81, %32
%83 = load i32, i32* %1
ret i32 %83
}

LLVM IR (-O2):
@__const.main.arr = [10 x i32] [i32 3, i32 8, i32 11, i32 44, i32 55, i32 66, i32 77, i32 99, i32 100, i32 120]
@.str = [3 x i8] c"%d\00"
@.str.1 = [24 x i8] c"%d \E4\B8\8D\E5\9C\A8\E6\95\B0\E7\BB\84\E5\BD\93\E4\B8\AD.\0A\00"
@.str.2 = [21 x i8] c"%d \E5\9C\A8\E6\95\B0\E7\BB\84\E5\BD\93\E4\B8\AD.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = add i32 %4, -121
%6 = icmp ult i32 %5, -118
br i1 %6, label %25, label %7
7: ; preds = %0
switch i32 %4, label %8 [
i32 3, label %25
i32 120, label %25
]
8: ; preds = %7, %21
%9 = phi i32 [ %23, %21 ], [ 9, %7 ]
%10 = phi i32 [ %22, %21 ], [ 0, %7 ]
%11 = add nsw i32 %9, %10
%12 = sdiv i32 %11, 2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [10 x i32], [10 x i32]* @__const.main.arr, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = icmp sgt i32 %15, %4
br i1 %16, label %21, label %17
17: ; preds = %8
%18 = icmp slt i32 %15, %4
br i1 %18, label %19, label %25
19: ; preds = %17
%20 = add nsw i32 %12, 1
br label %21
21: ; preds = %8, %19
%22 = phi i32 [ %20, %19 ], [ %10, %8 ]
%23 = phi i32 [ %9, %19 ], [ %12, %8 ]
%24 = icmp eq i32 %22, %23
br i1 %24, label %25, label %8
25: ; preds = %21, %17, %7, %7, %0
%26 = phi i8* [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), %0 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), %7 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), %7 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), %17 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), %21 ]
%27 = call i32 @printf(i8* %26, i32 %4)
ret i32 0
}