#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*/ Ave(int *);
int Judge(char *);
int /*<<< orphan*/ Search(char *, char *, int *);
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *);
int Input(char BUF_NAME[40], int BUF_SCORE[16]) {
  char IN_NAME[11];
  int FLAG[2], n = 0;
  printf("Please enter the student's name:\n");
  gets(IN_NAME);
  while (Judge(IN_NAME) != 0) {
    if (Judge(IN_NAME) == 2) {
      Search(BUF_NAME, IN_NAME, FLAG);
      if (FLAG[0] == 1) {
        Ave(BUF_SCORE);
        n = FLAG[1];
        if (BUF_SCORE[3 + n * 4] >= 90)
          printf("A\n");
        else if (BUF_SCORE[3 + n * 4] >= 80)
          printf("B\n");
        else if (BUF_SCORE[3 + n * 4] >= 70)
          printf("C\n");
        else if (BUF_SCORE[3 + n * 4] >= 60)
          printf("D\n");
        else
          printf("F\n");
      } else
        printf("This name not exit!\n");
    }
    printf("Please enter the student's name:\n");
    gets(IN_NAME);
  }
  return 0;
}


x86 assembly (clang, -O0):
<Input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x28(%rbp)
lea    0xe92(%rip),%rdi
call   1040 <printf@plt>
lea    -0x1b(%rbp),%rdi
call   1050 <gets@plt>
lea    -0x1b(%rbp),%rdi
call   1030 <Judge@plt>
cmp    $0x0,%eax
je     12c1 <Input+0x171>
lea    -0x1b(%rbp),%rdi
call   1030 <Judge@plt>
cmp    $0x2,%eax
jne    12a7 <Input+0x157>
mov    -0x8(%rbp),%rdi
lea    -0x1b(%rbp),%rsi
lea    -0x24(%rbp),%rdx
call   1070 <Search@plt>
cmpl   $0x1,-0x24(%rbp)
jne    1296 <Input+0x146>
mov    -0x10(%rbp),%rdi
call   1060 <Ave@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
cmpl   $0x5a,(%rax,%rcx,4)
jl     11f5 <Input+0xa5>
lea    0xe37(%rip),%rdi
call   1040 <printf@plt>
jmp    1291 <Input+0x141>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
cmpl   $0x50,(%rax,%rcx,4)
jl     1220 <Input+0xd0>
lea    0xe0f(%rip),%rdi
call   1040 <printf@plt>
jmp    128c <Input+0x13c>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
cmpl   $0x46,(%rax,%rcx,4)
jl     124b <Input+0xfb>
lea    0xde7(%rip),%rdi
call   1040 <printf@plt>
jmp    1287 <Input+0x137>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
cmpl   $0x3c,(%rax,%rcx,4)
jl     1276 <Input+0x126>
lea    0xdbf(%rip),%rdi
call   1040 <printf@plt>
jmp    1282 <Input+0x132>
lea    0xdb1(%rip),%rdi
call   1040 <printf@plt>
jmp    1287 <Input+0x137>
jmp    128c <Input+0x13c>
jmp    1291 <Input+0x141>
jmp    12a2 <Input+0x152>
lea    0xd94(%rip),%rdi
call   1040 <printf@plt>
jmp    12a7 <Input+0x157>
lea    0xd52(%rip),%rdi
call   1040 <printf@plt>
lea    -0x1b(%rbp),%rdi
call   1050 <gets@plt>
jmp    117c <Input+0x2c>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Input>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xe95(%rip),%rdi
call   1030 <puts@plt>
lea    0xd(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
mov    %rbx,%rdi
call   1040 <Judge@plt>
test   %eax,%eax
je     124a <Input+0xfa>
lea    0xd(%rsp),%rbx
lea    0x4(%rsp),%r12
lea    0xe83(%rip),%rbp
lea    0xe5b(%rip),%r13
jmp    11d1 <Input+0x81>
nopw   0x0(%rax,%rax,1)
call   1030 <puts@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1050 <gets@plt>
mov    %rbx,%rdi
call   1040 <Judge@plt>
test   %eax,%eax
je     124a <Input+0xfa>
mov    %rbx,%rdi
call   1040 <Judge@plt>
cmp    $0x2,%eax
jne    11b5 <Input+0x65>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1070 <Search@plt>
cmpl   $0x1,0x4(%rsp)
mov    %rbp,%rdi
jne    11b0 <Input+0x60>
mov    %r14,%rdi
call   1060 <Ave@plt>
movslq 0x8(%rsp),%rax
shl    $0x4,%rax
mov    0xc(%r14,%rax,1),%eax
lea    0xe2a(%rip),%rdi
cmp    $0x59,%eax
jg     11b0 <Input+0x60>
lea    0xe1c(%rip),%rdi
cmp    $0x4f,%eax
jg     11b0 <Input+0x60>
lea    0xe0e(%rip),%rdi
cmp    $0x45,%eax
jg     11b0 <Input+0x60>
cmp    $0x3c,%eax
lea    0xdfb(%rip),%rdi
lea    0xdf6(%rip),%rax
cmovge %rax,%rdi
jmp    11b0 <Input+0x60>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Please enter the student's name:\0A\00"
@.str.1 = [3 x i8] c"A\0A\00"
@.str.2 = [3 x i8] c"B\0A\00"
@.str.3 = [3 x i8] c"C\0A\00"
@.str.4 = [3 x i8] c"D\0A\00"
@.str.5 = [3 x i8] c"F\0A\00"
@.str.6 = [21 x i8] c"This name not exit!\0A\00"
define i32 @Input(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca [11 x i8]
%6 = alloca [2 x i32]
%7 = alloca i32
store i8* %0, i8** %3
store i32* %1, i32** %4
store i32 0, i32* %7
%8 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 0
%10 = call i32 @gets(i8* %9)
br label %11
11: ; preds = %84, %2
%12 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 0
%13 = call i32 @Judge(i8* %12)
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %88
15: ; preds = %11
%16 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 0
%17 = call i32 @Judge(i8* %16)
%18 = icmp eq i32 %17, 2
br i1 %18, label %19, label %84
19: ; preds = %15
%20 = load i8*, i8** %3
%21 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 0
%22 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%23 = call i32 @Search(i8* %20, i8* %21, i32* %22)
%24 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%25 = load i32, i32* %24
%26 = icmp eq i32 %25, 1
br i1 %26, label %27, label %81
27: ; preds = %19
%28 = load i32*, i32** %4
%29 = call i32 @Ave(i32* %28)
%30 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%31 = load i32, i32* %30
store i32 %31, i32* %7
%32 = load i32*, i32** %4
%33 = load i32, i32* %7
%34 = mul nsw i32 %33, 4
%35 = add nsw i32 3, %34
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i32, i32* %32, i64 %36
%38 = load i32, i32* %37
%39 = icmp sge i32 %38, 90
br i1 %39, label %40, label %42
40: ; preds = %27
%41 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %80
42: ; preds = %27
%43 = load i32*, i32** %4
%44 = load i32, i32* %7
%45 = mul nsw i32 %44, 4
%46 = add nsw i32 3, %45
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i32, i32* %43, i64 %47
%49 = load i32, i32* %48
%50 = icmp sge i32 %49, 80
br i1 %50, label %51, label %53
51: ; preds = %42
%52 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %79
53: ; preds = %42
%54 = load i32*, i32** %4
%55 = load i32, i32* %7
%56 = mul nsw i32 %55, 4
%57 = add nsw i32 3, %56
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i32, i32* %54, i64 %58
%60 = load i32, i32* %59
%61 = icmp sge i32 %60, 70
br i1 %61, label %62, label %64
62: ; preds = %53
%63 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %78
64: ; preds = %53
%65 = load i32*, i32** %4
%66 = load i32, i32* %7
%67 = mul nsw i32 %66, 4
%68 = add nsw i32 3, %67
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i32, i32* %65, i64 %69
%71 = load i32, i32* %70
%72 = icmp sge i32 %71, 60
br i1 %72, label %73, label %75
73: ; preds = %64
%74 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %77
75: ; preds = %64
%76 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %77
77: ; preds = %75, %73
br label %78
78: ; preds = %77, %62
br label %79
79: ; preds = %78, %51
br label %80
80: ; preds = %79, %40
br label %83
81: ; preds = %19
%82 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
br label %83
83: ; preds = %81, %80
br label %84
84: ; preds = %83, %15
%85 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%86 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 0
%87 = call i32 @gets(i8* %86)
br label %11
88: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
@str.7 = [33 x i8] c"Please enter the student's name:\00"
@str.8 = [20 x i8] c"This name not exit!\00"
@str.9 = [2 x i8] c"F\00"
@str.10 = [2 x i8] c"D\00"
@str.11 = [2 x i8] c"C\00"
@str.12 = [2 x i8] c"B\00"
@str.13 = [2 x i8] c"A\00"
define i32 @Input(i8* %0, i32* %1) {
%3 = alloca [11 x i8]
%4 = alloca [2 x i32]
%5 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 0
%6 = bitcast [2 x i32]* %4 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.7, i64 0, i64 0))
%8 = call i32 @gets(i8* %5)
%9 = call i32 @Judge(i8* %5)
%10 = icmp eq i32 %9, 0
br i1 %10, label %45, label %11
11: ; preds = %2
%12 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
br label %14
14: ; preds = %11, %40
%15 = call i32 @Judge(i8* %5)
%16 = icmp eq i32 %15, 2
br i1 %16, label %17, label %40
17: ; preds = %14
%18 = call i32 @Search(i8* %0, i8* %5, i32* %12)
%19 = load i32, i32* %12
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %37
21: ; preds = %17
%22 = call i32 @Ave(i32* %1)
%23 = load i32, i32* %13
%24 = shl nsw i32 %23, 2
%25 = or i32 %24, 3
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %1, i64 %26
%28 = load i32, i32* %27
%29 = icmp sgt i32 %28, 89
br i1 %29, label %37, label %30
30: ; preds = %21
%31 = icmp sgt i32 %28, 79
br i1 %31, label %37, label %32
32: ; preds = %30
%33 = icmp sgt i32 %28, 69
br i1 %33, label %37, label %34
34: ; preds = %32
%35 = icmp sgt i32 %28, 59
%36 = select i1 %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str.10, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str.9, i64 0, i64 0)
br label %37
37: ; preds = %17, %34, %32, %30, %21
%38 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.13, i64 0, i64 0), %21 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.12, i64 0, i64 0), %30 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.11, i64 0, i64 0), %32 ], [ %36, %34 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @str.8, i64 0, i64 0), %17 ]
%39 = call i32 @puts(i8* dereferenceable(1) %38)
br label %40
40: ; preds = %37, %14
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.7, i64 0, i64 0))
%42 = call i32 @gets(i8* %5)
%43 = call i32 @Judge(i8* %5)
%44 = icmp eq i32 %43, 0
br i1 %44, label %45, label %14
45: ; preds = %40, %2
ret i32 0
}