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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
movl   $0xffffffff,-0x34(%rbp)
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
lea    -0x38(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x0,-0x3c(%rbp)
cmpl   $0xa,-0x3c(%rbp)
jge    11b9 <main+0x89>
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
cmp    -0x38(%rbp),%eax
jne    11a6 <main+0x76>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x34(%rbp)
jmp    11b9 <main+0x89>
jmp    11ab <main+0x7b>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1180 <main+0x50>
cmpl   $0xffffffff,-0x34(%rbp)
je     11d9 <main+0xa9>
mov    -0x34(%rbp),%esi
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e7 <main+0xb7>
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xf58(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf6f(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
add    $0xffffffc5,%eax
cmp    $0x24,%eax
ja     1179 <main+0x49>
lea    0xe97(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x4,%ebx
jmp    11bd <main+0x8d>
lea    0xf54(%rip),%rdi
call   1030 <puts@plt>
jmp    11cd <main+0x9d>
mov    $0x9,%ebx
jmp    11bd <main+0x8d>
mov    $0x3,%ebx
jmp    11bd <main+0x8d>
mov    $0x5,%ebx
jmp    11bd <main+0x8d>
mov    $0x6,%ebx
jmp    11bd <main+0x8d>
mov    $0x1,%ebx
jmp    11bd <main+0x8d>
mov    $0x2,%ebx
jmp    11bd <main+0x8d>
mov    $0x8,%ebx
jmp    11bd <main+0x8d>
mov    $0x7,%ebx
lea    0xefa(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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 i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [10 x i32]* %2 to i8*
store i32 -1, i32* %3
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
store i32 0, i32* %5
br label %9
9: ; preds = %22, %0
%10 = load i32, i32* %5
%11 = icmp slt i32 %10, 10
br i1 %11, label %12, label %25
12: ; preds = %9
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = load i32, i32* %4
%18 = icmp eq i32 %16, %17
br i1 %18, label %19, label %21
19: ; preds = %12
%20 = load i32, i32* %5
store i32 %20, i32* %3
br label %25
21: ; preds = %12
br label %22
22: ; preds = %21
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
br label %9
25: ; preds = %19, %9
%26 = load i32, i32* %3
%27 = icmp ne i32 %26, -1
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = load i32, i32* %3
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %29)
br label %33
31: ; preds = %25
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
br label %33
33: ; preds = %31, %28
ret i32 0
}

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 i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
switch i32 %5, label %6 [
i32 76, label %17
i32 85, label %8
i32 90, label %9
i32 67, label %10
i32 59, label %11
i32 79, label %12
i32 82, label %13
i32 95, label %14
i32 91, label %15
i32 65, label %16
]
6: ; preds = %0
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
br label %20
8: ; preds = %0
br label %17
9: ; preds = %0
br label %17
10: ; preds = %0
br label %17
11: ; preds = %0
br label %17
12: ; preds = %0
br label %17
13: ; preds = %0
br label %17
14: ; preds = %0
br label %17
15: ; preds = %0
br label %17
16: ; preds = %0
br label %17
17: ; preds = %0, %16, %15, %14, %13, %12, %11, %10, %9, %8
%18 = phi i32 [ 0, %0 ], [ 1, %8 ], [ 2, %9 ], [ 3, %10 ], [ 4, %11 ], [ 5, %12 ], [ 6, %13 ], [ 7, %14 ], [ 8, %15 ], [ 9, %16 ]
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %18)
br label %20
20: ; preds = %6, %17
ret i32 0
}