#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 /*<<< orphan*/ scanf(char *, int *);
void main() {
  int t[10];
  int i, x = 0;
  printf("请输入10个整数到数组中：");
  for (i = 0; i < 10; i++) {
    scanf("%d", &t[i]);
  }
  printf("请输入需要查找的数x=");
  scanf("%d", &x);
  for (i = 0; i < 10; i++) {
    if (x == t[i])
      break;
  }
  if (i < 10)
    printf("找到了，其下标=%d\n", i);
  else
    printf("没有找到，-1\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x38(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    1177 <main+0x57>
movslq -0x34(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xec0(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1144 <main+0x24>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe98(%rip),%rdi
lea    -0x38(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    11cf <main+0xaf>
mov    -0x38(%rbp),%eax
movslq -0x34(%rbp),%rcx
cmp    -0x30(%rbp,%rcx,4),%eax
jne    11bc <main+0x9c>
jmp    11cf <main+0xaf>
jmp    11c1 <main+0xa1>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    119c <main+0x7c>
cmpl   $0xa,-0x34(%rbp)
jge    11ef <main+0xcf>
mov    -0x34(%rbp),%esi
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11fd <main+0xdd>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x38,%rsp
movl   $0x0,0xc(%rsp)
lea    0xebb(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecf(%rip),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x24(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x28(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x2c(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x30(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x34(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xe49(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    0x10(%rsp),%eax
je     125f <main+0x12f>
mov    $0x1,%ebp
cmp    0x14(%rsp),%eax
je     125f <main+0x12f>
mov    $0x2,%ebp
cmp    0x18(%rsp),%eax
je     125f <main+0x12f>
mov    $0x3,%ebp
cmp    0x1c(%rsp),%eax
je     125f <main+0x12f>
mov    $0x4,%ebp
cmp    0x20(%rsp),%eax
je     125f <main+0x12f>
mov    $0x5,%ebp
cmp    0x24(%rsp),%eax
je     125f <main+0x12f>
mov    $0x6,%ebp
cmp    0x28(%rsp),%eax
je     125f <main+0x12f>
mov    $0x7,%ebp
cmp    0x2c(%rsp),%eax
je     125f <main+0x12f>
mov    $0x8,%ebp
cmp    0x30(%rsp),%eax
je     125f <main+0x12f>
mov    $0x9,%ebp
cmp    0x34(%rsp),%eax
jne    1276 <main+0x146>
lea    0xddf(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x38,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xde2(%rip),%rdi
call   1030 <puts@plt>
jmp    126f <main+0x13f>

LLVM IR (-O0):
@.str = [36 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A510\E4\B8\AA\E6\95\B4\E6\95\B0\E5\88\B0\E6\95\B0\E7\BB\84\E4\B8\AD\EF\BC\9A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [30 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E9\9C\80\E8\A6\81\E6\9F\A5\E6\89\BE\E7\9A\84\E6\95\B0x=\00"
@.str.3 = [26 x i8] c"\E6\89\BE\E5\88\B0\E4\BA\86\EF\BC\8C\E5\85\B6\E4\B8\8B\E6\A0\87=%d\0A\00"
@.str.4 = [19 x i8] c"\E6\B2\A1\E6\9C\89\E6\89\BE\E5\88\B0\EF\BC\8C-1\0A\00"
define void @main() {
%1 = alloca [10 x i32]
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %5
5: ; preds = %13, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %16
8: ; preds = %5
%9 = load i32, i32* %2
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %10
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %11)
br label %13
13: ; preds = %8
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
br label %5
16: ; preds = %5
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
store i32 0, i32* %2
br label %19
19: ; preds = %31, %16
%20 = load i32, i32* %2
%21 = icmp slt i32 %20, 10
br i1 %21, label %22, label %34
22: ; preds = %19
%23 = load i32, i32* %3
%24 = load i32, i32* %2
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %25
%27 = load i32, i32* %26
%28 = icmp eq i32 %23, %27
br i1 %28, label %29, label %30
29: ; preds = %22
br label %34
30: ; preds = %22
br label %31
31: ; preds = %30
%32 = load i32, i32* %2
%33 = add nsw i32 %32, 1
store i32 %33, i32* %2
br label %19
34: ; preds = %29, %19
%35 = load i32, i32* %2
%36 = icmp slt i32 %35, 10
br i1 %36, label %37, label %40
37: ; preds = %34
%38 = load i32, i32* %2
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %38)
br label %42
40: ; preds = %34
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
br label %42
42: ; preds = %40, %37
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A510\E4\B8\AA\E6\95\B4\E6\95\B0\E5\88\B0\E6\95\B0\E7\BB\84\E4\B8\AD\EF\BC\9A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [30 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E9\9C\80\E8\A6\81\E6\9F\A5\E6\89\BE\E7\9A\84\E6\95\B0x=\00"
@.str.3 = [26 x i8] c"\E6\89\BE\E5\88\B0\E4\BA\86\EF\BC\8C\E5\85\B6\E4\B8\8B\E6\A0\87=%d\0A\00"
@str = [18 x i8] c"\E6\B2\A1\E6\9C\89\E6\89\BE\E5\88\B0\EF\BC\8C-1\00"
define void @main() {
%1 = alloca [10 x i32]
%2 = alloca i32
%3 = bitcast [10 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %12)
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %14)
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%18 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %18)
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %20)
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %22)
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %24)
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%28 = load i32, i32* %2
%29 = load i32, i32* %6
%30 = icmp eq i32 %28, %29
br i1 %30, label %60, label %31
31: ; preds = %0
%32 = load i32, i32* %8
%33 = icmp eq i32 %28, %32
br i1 %33, label %60, label %34
34: ; preds = %31
%35 = load i32, i32* %10
%36 = icmp eq i32 %28, %35
br i1 %36, label %60, label %37
37: ; preds = %34
%38 = load i32, i32* %12
%39 = icmp eq i32 %28, %38
br i1 %39, label %60, label %40
40: ; preds = %37
%41 = load i32, i32* %14
%42 = icmp eq i32 %28, %41
br i1 %42, label %60, label %43
43: ; preds = %40
%44 = load i32, i32* %16
%45 = icmp eq i32 %28, %44
br i1 %45, label %60, label %46
46: ; preds = %43
%47 = load i32, i32* %18
%48 = icmp eq i32 %28, %47
br i1 %48, label %60, label %49
49: ; preds = %46
%50 = load i32, i32* %20
%51 = icmp eq i32 %28, %50
br i1 %51, label %60, label %52
52: ; preds = %49
%53 = load i32, i32* %22
%54 = icmp eq i32 %28, %53
br i1 %54, label %60, label %55
55: ; preds = %52
%56 = load i32, i32* %24
%57 = icmp eq i32 %28, %56
br i1 %57, label %60, label %58
58: ; preds = %55
%59 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
br label %63
60: ; preds = %55, %52, %49, %46, %43, %40, %37, %34, %31, %0
%61 = phi i32 [ 0, %0 ], [ 1, %31 ], [ 2, %34 ], [ 3, %37 ], [ 4, %40 ], [ 5, %43 ], [ 6, %46 ], [ 7, %49 ], [ 8, %52 ], [ 9, %55 ]
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %61)
br label %63
63: ; preds = %58, %60
ret void
}