#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*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int score[10] = {76, 85, 90, 67, 59, 79, 82, 95, 91, 65};
  int pointer[101];
  int index;
  int grade;
  int i;
  for (i = 0; i <= 101; i++)
    pointer[i] = -1;
  for (i = 0; i < 10; i++) {
    index = score[i];
    pointer[index] = i;
  }
  while (1) {
    printf("请输入学生成绩（0到100）.==>");
    scanf("%d", &grade);
    if (grade != -1) {
      index = pointer[grade];
      if (index != -1)
        printf("学生学号是：%d\n", index);
      else
        printf("没有此成绩的学生\n");
    } else
      exit(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1e0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xea3(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x1dc(%rbp)
cmpl   $0x65,-0x1dc(%rbp)
jg     11a4 <main+0x64>
movslq -0x1dc(%rbp),%rax
movl   $0xffffffff,-0x1d0(%rbp,%rax,4)
ff ff ff ff
mov    -0x1dc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1dc(%rbp)
jmp    1171 <main+0x31>
movl   $0x0,-0x1dc(%rbp)
cmpl   $0xa,-0x1dc(%rbp)
jge    11f4 <main+0xb4>
movslq -0x1dc(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x1d4(%rbp)
mov    -0x1dc(%rbp),%ecx
movslq -0x1d4(%rbp),%rax
mov    %ecx,-0x1d0(%rbp,%rax,4)
mov    -0x1dc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1dc(%rbp)
jmp    11ae <main+0x6e>
jmp    11f9 <main+0xb9>
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe41(%rip),%rdi
lea    -0x1d8(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0xffffffff,-0x1d8(%rbp)
je     1274 <main+0x134>
movslq -0x1d8(%rbp),%rax
mov    -0x1d0(%rbp,%rax,4),%eax
mov    %eax,-0x1d4(%rbp)
cmpl   $0xffffffff,-0x1d4(%rbp)
je     1261 <main+0x121>
mov    -0x1d4(%rbp),%esi
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    126f <main+0x12f>
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    127e <main+0x13e>
mov    $0x1,%edi
call   1060 <exit@plt>
jmp    11f9 <main+0xb9>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1b0,%rsp
lea    0x10(%rsp),%rdi
mov    $0x198,%edx
mov    $0xff,%esi
call   1050 <memset@plt>
movl   $0x0,0x140(%rsp)
movl   $0x1,0x164(%rsp)
movabs $0x800000002,%rax
mov    %rax,0x178(%rsp)
movl   $0x3,0x11c(%rsp)
movl   $0x4,0xfc(%rsp)
movl   $0x5,0x14c(%rsp)
movl   $0x6,0x158(%rsp)
movl   $0x7,0x18c(%rsp)
movl   $0x9,0x114(%rsp)
lea    0xe1b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe34(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0xffffffff,%eax
jne    1210 <main+0xc0>
mov    $0x1,%edi
call   1070 <exit@plt>
lea    0xe29(%rip),%r14
lea    0xde2(%rip),%r15
lea    0xe02(%rip),%r12
lea    0xc(%rsp),%rbx
lea    0xdf9(%rip),%r13
jmp    1266 <main+0x116>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0xffffffff,%eax
je     1206 <main+0xb6>
cltq
mov    0x10(%rsp,%rax,4),%esi
cmp    $0xffffffff,%esi
je     1240 <main+0xf0>
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1248 <main+0xf8>

LLVM IR (-O0):
@__const.main.score = [10 x i32] [i32 76, i32 85, i32 90, i32 67, i32 59, i32 79, i32 82, i32 95, i32 91, i32 65]
@.str = [39 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E5\AD\A6\E7\94\9F\E6\88\90\E7\BB\A9\EF\BC\880\E5\88\B0100\EF\BC\89.==>\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [22 x i8] c"\E5\AD\A6\E7\94\9F\E5\AD\A6\E5\8F\B7\E6\98\AF\EF\BC\9A%d\0A\00"
@.str.3 = [26 x i8] c"\E6\B2\A1\E6\9C\89\E6\AD\A4\E6\88\90\E7\BB\A9\E7\9A\84\E5\AD\A6\E7\94\9F\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca [101 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [10 x i32]* %2 to i8*
store i32 0, i32* %6
br label %8
8: ; preds = %15, %0
%9 = load i32, i32* %6
%10 = icmp sle i32 %9, 101
br i1 %10, label %11, label %18
11: ; preds = %8
%12 = load i32, i32* %6
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [101 x i32], [101 x i32]* %3, i64 0, i64 %13
store i32 -1, i32* %14
br label %15
15: ; preds = %11
%16 = load i32, i32* %6
%17 = add nsw i32 %16, 1
store i32 %17, i32* %6
br label %8
18: ; preds = %8
store i32 0, i32* %6
br label %19
19: ; preds = %31, %18
%20 = load i32, i32* %6
%21 = icmp slt i32 %20, 10
br i1 %21, label %22, label %34
22: ; preds = %19
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %24
%26 = load i32, i32* %25
store i32 %26, i32* %4
%27 = load i32, i32* %6
%28 = load i32, i32* %4
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [101 x i32], [101 x i32]* %3, i64 0, i64 %29
store i32 %27, i32* %30
br label %31
31: ; preds = %22
%32 = load i32, i32* %6
%33 = add nsw i32 %32, 1
store i32 %33, i32* %6
br label %19
34: ; preds = %19
br label %35
35: ; preds = %34, %55
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%37 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%38 = load i32, i32* %5
%39 = icmp ne i32 %38, -1
br i1 %39, label %40, label %53
40: ; preds = %35
%41 = load i32, i32* %5
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [101 x i32], [101 x i32]* %3, i64 0, i64 %42
%44 = load i32, i32* %43
store i32 %44, i32* %4
%45 = load i32, i32* %4
%46 = icmp ne i32 %45, -1
br i1 %46, label %47, label %50
47: ; preds = %40
%48 = load i32, i32* %4
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %48)
br label %52
50: ; preds = %40
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
br label %52
52: ; preds = %50, %47
br label %55
53: ; preds = %35
%54 = call i32 @exit(i32 1)
unreachable
55: ; preds = %52
br label %35
}

LLVM IR (-O2):
@.str = [39 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E5\AD\A6\E7\94\9F\E6\88\90\E7\BB\A9\EF\BC\880\E5\88\B0100\EF\BC\89.==>\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [22 x i8] c"\E5\AD\A6\E7\94\9F\E5\AD\A6\E5\8F\B7\E6\98\AF\EF\BC\9A%d\0A\00"
@str = [25 x i8] c"\E6\B2\A1\E6\9C\89\E6\AD\A4\E6\88\90\E7\BB\A9\E7\9A\84\E5\AD\A6\E7\94\9F\00"
define i32 @main() {
%1 = alloca [101 x i32]
%2 = bitcast [101 x i32]* %1 to i8*
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = getelementptr inbounds [101 x i32], [101 x i32]* %1, i64 0, i64 76
store i32 0, i32* %5
%6 = getelementptr inbounds [101 x i32], [101 x i32]* %1, i64 0, i64 85
store i32 1, i32* %6
%7 = getelementptr inbounds [101 x i32], [101 x i32]* %1, i64 0, i64 90
store i32 2, i32* %7
%8 = getelementptr inbounds [101 x i32], [101 x i32]* %1, i64 0, i64 67
store i32 3, i32* %8
%9 = getelementptr inbounds [101 x i32], [101 x i32]* %1, i64 0, i64 59
store i32 4, i32* %9
%10 = getelementptr inbounds [101 x i32], [101 x i32]* %1, i64 0, i64 79
store i32 5, i32* %10
%11 = getelementptr inbounds [101 x i32], [101 x i32]* %1, i64 0, i64 82
store i32 6, i32* %11
%12 = getelementptr inbounds [101 x i32], [101 x i32]* %1, i64 0, i64 95
store i32 7, i32* %12
%13 = getelementptr inbounds [101 x i32], [101 x i32]* %1, i64 0, i64 91
store i32 8, i32* %13
%14 = getelementptr inbounds [101 x i32], [101 x i32]* %1, i64 0, i64 65
store i32 9, i32* %14
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%17 = load i32, i32* %3
%18 = icmp eq i32 %17, -1
br i1 %18, label %29, label %19
19: ; preds = %0, %31
%20 = phi i32 [ %34, %31 ], [ %17, %0 ]
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [101 x i32], [101 x i32]* %1, i64 0, i64 %21
%23 = load i32, i32* %22
%24 = icmp eq i32 %23, -1
br i1 %24, label %27, label %25
25: ; preds = %19
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %23)
br label %31
27: ; preds = %19
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
br label %31
29: ; preds = %31, %0
%30 = call i32 @exit(i32 1)
unreachable
31: ; preds = %25, %27
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%33 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%34 = load i32, i32* %3
%35 = icmp eq i32 %34, -1
br i1 %35, label %29, label %19
}