#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 mark;
  int gradePoint;
  printf("Enter student's mark: ");
  scanf("%f", &mark);
  gradePoint = mark / 10;
  switch (gradePoint) {
  case 10:
    if (mark > 100) {
      printf("Invalid mark entered\n");
      break;
    }
  case 9:
    printf("Grade: O\n");
    break;
  case 8:
    printf("Grade: E\n");
    break;
  case 7:
    printf("Grade: A\n");
    break;
  case 6:
    printf("Grade: B\n");
    break;
  case 5:
    printf("Grade: C\n");
    break;
  case 4:
  case 3:
  case 2:
  case 1:
  case 0:
    if (mark < 0) {
      printf("Invalid mark entered\n");
      break;
    }
    printf("Grade: F\n");
    break;
  default:
    printf("Invalid mark entered\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xefe(%rip),%rdi
call   1030 <printf@plt>
lea    0xf09(%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)
mov    -0xc(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0xa,%rax
ja     1238 <main+0x118>
mov    -0x18(%rbp),%rax
lea    0xe89(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  -0x8(%rbp),%xmm0
movss  0xe6f(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    11af <main+0x8f>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
jmp    1244 <main+0x124>
jmp    11b4 <main+0x94>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
jmp    1244 <main+0x124>
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
jmp    1244 <main+0x124>
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
jmp    1244 <main+0x124>
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
jmp    1244 <main+0x124>
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
jmp    1244 <main+0x124>
xorps  %xmm0,%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1227 <main+0x107>
lea    0xe31(%rip),%rdi
call   1030 <printf@plt>
jmp    1244 <main+0x124>
lea    0xe68(%rip),%rdi
call   1030 <printf@plt>
jmp    1244 <main+0x124>
lea    0xe0f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xefc(%rip),%rdi
call   1040 <printf@plt>
lea    0xf07(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
movss  0x4(%rsp),%xmm0
movaps %xmm0,%xmm1
divss  0xea1(%rip),%xmm1
cvttss2si %xmm1,%eax
cmp    $0xa,%eax
ja     11bd <main+0x8d>
lea    0xf03(%rip),%rdi
lea    0xe92(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
lea    0xef8(%rip),%rax
lea    0xebb(%rip),%rdi
cmova  %rax,%rdi
jmp    11cd <main+0x9d>
lea    0xeb7(%rip),%rdi
jmp    11cd <main+0x9d>
lea    0xeb7(%rip),%rdi
jmp    11cd <main+0x9d>
lea    0xeb7(%rip),%rdi
jmp    11cd <main+0x9d>
ucomiss 0xe49(%rip),%xmm0
jbe    11c6 <main+0x96>
lea    0xec0(%rip),%rdi
jmp    11cd <main+0x9d>
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Enter student's mark: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [22 x i8] c"Invalid mark entered\0A\00"
@.str.3 = [10 x i8] c"Grade: O\0A\00"
@.str.4 = [10 x i8] c"Grade: E\0A\00"
@.str.5 = [10 x i8] c"Grade: A\0A\00"
@.str.6 = [10 x i8] c"Grade: B\0A\00"
@.str.7 = [10 x i8] c"Grade: C\0A\00"
@.str.8 = [10 x i8] c"Grade: F\0A\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 ([23 x i8], [23 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 = load i32, i32* %3
switch i32 %9, label %33 [
i32 10, label %10
i32 9, label %16
i32 8, label %18
i32 7, label %20
i32 6, label %22
i32 5, label %24
i32 4, label %26
i32 3, label %26
i32 2, label %26
i32 1, label %26
i32 0, label %26
]
10: ; preds = %0
%11 = load float, float* %2
%12 = fcmp ogt float %11, 1.000000e+02
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %35
15: ; preds = %10
br label %16
16: ; preds = %0, %15
%17 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %35
18: ; preds = %0
%19 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
br label %35
20: ; preds = %0
%21 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
br label %35
22: ; preds = %0
%23 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
br label %35
24: ; preds = %0
%25 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
br label %35
26: ; preds = %0, %0, %0, %0, %0
%27 = load float, float* %2
%28 = fcmp olt float %27, 0.000000e+00
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %35
31: ; preds = %26
%32 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
br label %35
33: ; preds = %0
%34 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %35
35: ; preds = %33, %31, %29, %24, %22, %20, %18, %16, %13
%36 = load i32, i32* %1
ret i32 %36
}

LLVM IR (-O2):
@.str = [23 x i8] c"Enter student's mark: \00"
@.str.1 = [3 x i8] c"%f\00"
@str = [9 x i8] c"Grade: F\00"
@str.10 = [9 x i8] c"Grade: C\00"
@str.11 = [9 x i8] c"Grade: B\00"
@str.12 = [9 x i8] c"Grade: A\00"
@str.13 = [9 x i8] c"Grade: E\00"
@str.14 = [9 x i8] c"Grade: O\00"
@str.16 = [21 x i8] c"Invalid mark entered\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 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
switch i32 %7, label %17 [
i32 10, label %8
i32 9, label %10
i32 8, label %18
i32 7, label %11
i32 6, label %12
i32 5, label %13
i32 4, label %14
i32 3, label %14
i32 2, label %14
i32 1, label %14
i32 0, label %14
]
8: ; preds = %0
%9 = fcmp ogt float %5, 1.000000e+02
br i1 %9, label %18, label %10
10: ; preds = %8, %0
br label %18
11: ; preds = %0
br label %18
12: ; preds = %0
br label %18
13: ; preds = %0
br label %18
14: ; preds = %0, %0, %0, %0, %0
%15 = fcmp olt float %5, 0.000000e+00
%16 = select i1 %15, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @str.16, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0)
br label %18
17: ; preds = %0
br label %18
18: ; preds = %14, %0, %8, %17, %13, %12, %11, %10
%19 = phi i8* [ getelementptr inbounds ([21 x i8], [21 x i8]* @str.16, i64 0, i64 0), %17 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @str.10, i64 0, i64 0), %13 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @str.11, i64 0, i64 0), %12 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @str.12, i64 0, i64 0), %11 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @str.14, i64 0, i64 0), %10 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @str.16, i64 0, i64 0), %8 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @str.13, i64 0, i64 0), %0 ], [ %16, %14 ]
%20 = call i32 @puts(i8* dereferenceable(1) %19)
ret i32 0
}