#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_s(char *, int *);
int /*<<< orphan*/ system(char *);
int main() {
  int n;
  char grad;
  printf("Enter numerical grade:");
  scanf_s("%d", &n);
  if ((n >= 0) && (n <= 100)) {
    n /= 10;
    switch (n) {
    case 0:
    case 1:
    case 2:
    case 3:
    case 4:
    case 5:
      grad = 'F';
      break;
    case 6:
      grad = 'D';
      break;
    case 7:
      grad = 'C';
      break;
    case 8:
      grad = 'B';
      break;
    case 9:
    case 10:
      grad = 'A';
      break;
    default:
      break;
    }
  } else {
    printf("Error!\n");
    system("PAUSE");
    return 1;
  }
  printf("Letter grade: %c\n", grad);
  system("PAUSE");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xee6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeef(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf_s@plt>
cmpl   $0x0,-0x8(%rbp)
jl     11e8 <main+0xb8>
cmpl   $0x64,-0x8(%rbp)
jg     11e8 <main+0xb8>
movslq -0x8(%rbp),%rax
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0xa,%rax
ja     11de <main+0xae>
mov    -0x18(%rbp),%rax
lea    0xe58(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x46,-0x9(%rbp)
jmp    11e3 <main+0xb3>
movb   $0x44,-0x9(%rbp)
jmp    11e3 <main+0xb3>
movb   $0x43,-0x9(%rbp)
jmp    11e3 <main+0xb3>
movb   $0x42,-0x9(%rbp)
jmp    11e3 <main+0xb3>
movb   $0x41,-0x9(%rbp)
jmp    11e3 <main+0xb3>
jmp    11e3 <main+0xb3>
jmp    120e <main+0xde>
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe51(%rip),%rdi
call   1030 <system@plt>
movl   $0x1,-0x4(%rbp)
jmp    1233 <main+0x103>
movsbl -0x9(%rbp),%esi
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe27(%rip),%rdi
call   1030 <system@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xeb6(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xebd(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf_s@plt>
mov    0x4(%rsp),%eax
cmp    $0x64,%eax
ja     11a3 <main+0x63>
movzbl %al,%ecx
imul   $0xcd,%ecx,%eax
shr    $0xb,%eax
mov    %eax,0x4(%rsp)
cmp    $0x6e,%cl
jae    118f <main+0x4f>
movzbl %al,%eax
lea    0xeb0(%rip),%rcx
mov    (%rcx,%rax,4),%ebx
lea    0xe8a(%rip),%rdi
xor    %ebp,%ebp
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11b4 <main+0x74>
lea    0xe88(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebp
lea    0xe5f(%rip),%rdi
call   1040 <system@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Enter numerical grade:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [8 x i8] c"Error!\0A\00"
@.str.3 = [6 x i8] c"PAUSE\00"
@.str.4 = [18 x i8] c"Letter grade: %c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = icmp sge i32 %6, 0
br i1 %7, label %8, label %22
8: ; preds = %0
%9 = load i32, i32* %2
%10 = icmp sle i32 %9, 100
br i1 %10, label %11, label %22
11: ; preds = %8
%12 = load i32, i32* %2
%13 = sdiv i32 %12, 10
store i32 %13, i32* %2
%14 = load i32, i32* %2
switch i32 %14, label %20 [
i32 0, label %15
i32 1, label %15
i32 2, label %15
i32 3, label %15
i32 4, label %15
i32 5, label %15
i32 6, label %16
i32 7, label %17
i32 8, label %18
i32 9, label %19
i32 10, label %19
]
15: ; preds = %11, %11, %11, %11, %11, %11
store i8 70, i8* %3
br label %21
16: ; preds = %11
store i8 68, i8* %3
br label %21
17: ; preds = %11
store i8 67, i8* %3
br label %21
18: ; preds = %11
store i8 66, i8* %3
br label %21
19: ; preds = %11, %11
store i8 65, i8* %3
br label %21
20: ; preds = %11
br label %21
21: ; preds = %20, %19, %18, %17, %16, %15
br label %25
22: ; preds = %8, %0
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%24 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %1
br label %30
25: ; preds = %21
%26 = load i8, i8* %3
%27 = sext i8 %26 to i32
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %27)
%29 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %1
br label %30
30: ; preds = %25, %22
%31 = load i32, i32* %1
ret i32 %31
}

LLVM IR (-O2):
@.str = [23 x i8] c"Enter numerical grade:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [6 x i8] c"PAUSE\00"
@.str.4 = [18 x i8] c"Letter grade: %c\0A\00"
@str = [7 x i8] c"Error!\00"
@switch.table.main = [11 x i32] [i32 70, i32 70, i32 70, i32 70, i32 70, i32 70, i32 68, i32 67, i32 66, i32 65, i32 65]
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp ult i32 %5, 101
br i1 %6, label %7, label %12
7: ; preds = %0
%8 = trunc i32 %5 to i8
%9 = udiv i8 %8, 10
%10 = zext i8 %9 to i32
store i32 %10, i32* %1
%11 = icmp ult i8 %8, 110
br i1 %11, label %14, label %18
12: ; preds = %0
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
br label %21
14: ; preds = %7
%15 = zext i8 %9 to i64
%16 = getelementptr inbounds [11 x i32], [11 x i32]* @switch.table.main, i64 0, i64 %15
%17 = load i32, i32* %16
br label %18
18: ; preds = %14, %7
%19 = phi i32 [ 0, %7 ], [ %17, %14 ]
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %18, %12
%22 = phi i32 [ 0, %18 ], [ 1, %12 ]
%23 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
ret i32 %22
}