#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 *, float *);
int main() {
  float m;
  int key;
  printf("Enter marks\n");
  scanf("%f", &m);
  key = m / 10;
  printf("GRADE : ");
  switch (key) {
  case 10:
    printf("O");
    break;
  case 9:
    printf("O");
    break;
  case 8:
    printf("E");
    break;
  case 7:
    printf("A");
    break;
  case 6:
    printf("B");
    break;
  case 5:
    printf("C");
    break;
  case 4:
    printf("D");
    break;
  case 3:
    printf("F");
    break;
  case 2:
    printf("F");
    break;
  case 1:
    printf("F");
    break;
  case 0:
    printf("F");
    break;
  default:
    printf("WRONG INPUT");
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xefa(%rip),%rdi
call   1030 <printf@plt>
lea    0xefb(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
movss  0xea8(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0xc(%rbp)
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0xa,%rax
ja     124f <main+0x12f>
mov    -0x18(%rbp),%rax
lea    0xe79(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
jmp    125b <main+0x13b>
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
jmp    125b <main+0x13b>
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
jmp    125b <main+0x13b>
lea    0xe7f(%rip),%rdi
call   1030 <printf@plt>
jmp    125b <main+0x13b>
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
jmp    125b <main+0x13b>
lea    0xe61(%rip),%rdi
call   1030 <printf@plt>
jmp    125b <main+0x13b>
lea    0xe52(%rip),%rdi
call   1030 <printf@plt>
jmp    125b <main+0x13b>
lea    0xe43(%rip),%rdi
call   1030 <printf@plt>
jmp    125b <main+0x13b>
lea    0xe32(%rip),%rdi
call   1030 <printf@plt>
jmp    125b <main+0x13b>
lea    0xe21(%rip),%rdi
call   1030 <printf@plt>
jmp    125b <main+0x13b>
lea    0xe10(%rip),%rdi
call   1030 <printf@plt>
jmp    125b <main+0x13b>
lea    0xe01(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xefc(%rip),%rdi
call   1040 <puts@plt>
lea    0xed8(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
movss  0xc(%rsp),%xmm0
divss  0xe90(%rip),%xmm0
cvttss2si %xmm0,%ebx
lea    0xeb8(%rip),%rdi
call   1050 <printf@plt>
cmp    $0xa,%ebx
ja     11a3 <main+0x63>
lea    0xe78(%rip),%rax
movslq (%rax,%rbx,4),%rcx
add    %rax,%rcx
jmp    *%rcx
mov    $0x46,%edi
jmp    11d2 <main+0x92>
mov    $0x4f,%edi
jmp    11d2 <main+0x92>
lea    0xe92(%rip),%rdi
call   1050 <printf@plt>
jmp    11d7 <main+0x97>
mov    $0x44,%edi
jmp    11d2 <main+0x92>
mov    $0x43,%edi
jmp    11d2 <main+0x92>
mov    $0x42,%edi
jmp    11d2 <main+0x92>
mov    $0x41,%edi
jmp    11d2 <main+0x92>
mov    $0x45,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Enter marks\0A\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [9 x i8] c"GRADE : \00"
@.str.3 = [2 x i8] c"O\00"
@.str.4 = [2 x i8] c"E\00"
@.str.5 = [2 x i8] c"A\00"
@.str.6 = [2 x i8] c"B\00"
@.str.7 = [2 x i8] c"C\00"
@.str.8 = [2 x i8] c"D\00"
@.str.9 = [2 x i8] c"F\00"
@.str.10 = [12 x i8] c"WRONG INPUT\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%6 = load float, float* %2
%7 = fdiv float %6, 1.000000e+01
%8 = fptosi float %7 to i32
store i32 %8, i32* %3
%9 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%10 = load i32, i32* %3
switch i32 %10, label %33 [
i32 10, label %11
i32 9, label %13
i32 8, label %15
i32 7, label %17
i32 6, label %19
i32 5, label %21
i32 4, label %23
i32 3, label %25
i32 2, label %27
i32 1, label %29
i32 0, label %31
]
11: ; preds = %0
%12 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %35
13: ; preds = %0
%14 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %35
15: ; preds = %0
%16 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %35
17: ; preds = %0
%18 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %35
19: ; preds = %0
%20 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %35
21: ; preds = %0
%22 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %35
23: ; preds = %0
%24 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %35
25: ; preds = %0
%26 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %35
27: ; preds = %0
%28 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %35
29: ; preds = %0
%30 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %35
31: ; preds = %0
%32 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %35
33: ; preds = %0
%34 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
br label %35
35: ; preds = %33, %31, %29, %27, %25, %23, %21, %19, %17, %15, %13, %11
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [9 x i8] c"GRADE : \00"
@.str.10 = [12 x i8] c"WRONG INPUT\00"
@str = [12 x i8] c"Enter marks\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 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), float* %1)
%5 = load float, float* %1
%6 = fdiv float %5, 1.000000e+01
%7 = fptosi float %6 to i32
%8 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
switch i32 %7, label %31 [
i32 10, label %9
i32 9, label %11
i32 8, label %13
i32 7, label %15
i32 6, label %17
i32 5, label %19
i32 4, label %21
i32 3, label %23
i32 2, label %25
i32 1, label %27
i32 0, label %29
]
9: ; preds = %0
%10 = call i32 @putchar(i32 79)
br label %33
11: ; preds = %0
%12 = call i32 @putchar(i32 79)
br label %33
13: ; preds = %0
%14 = call i32 @putchar(i32 69)
br label %33
15: ; preds = %0
%16 = call i32 @putchar(i32 65)
br label %33
17: ; preds = %0
%18 = call i32 @putchar(i32 66)
br label %33
19: ; preds = %0
%20 = call i32 @putchar(i32 67)
br label %33
21: ; preds = %0
%22 = call i32 @putchar(i32 68)
br label %33
23: ; preds = %0
%24 = call i32 @putchar(i32 70)
br label %33
25: ; preds = %0
%26 = call i32 @putchar(i32 70)
br label %33
27: ; preds = %0
%28 = call i32 @putchar(i32 70)
br label %33
29: ; preds = %0
%30 = call i32 @putchar(i32 70)
br label %33
31: ; preds = %0
%32 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
br label %33
33: ; preds = %31, %29, %27, %25, %23, %21, %19, %17, %15, %13, %11, %9
ret i32 0
}