#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 points, grade = 0;
  printf("Enter points: \n");
  scanf("%d", &points);
  if (points < 0 || points > 100)
    printf("Invalid value for points!\n");
  else {
    if (points > 90)
      grade = 10;
    else if (points > 80)
      grade = 9;
    else if (points > 70)
      grade = 8;
    else if (points > 60)
      grade = 7;
    else if (points > 50)
      grade = 6;
    else
      grade = 5;
    char sign = ' ';
    int pc = points % 10;
    if (grade != 5) {
      if (pc >= 1 && pc <= 3)
        sign = '-';
      else if (grade != 10 && (pc >= 8 || pc == 0))
        sign = '+';
    }
    printf("Grade %d%c\n", grade, sign);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jl     1168 <main+0x48>
cmpl   $0x64,-0x8(%rbp)
jle    117b <main+0x5b>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    127e <main+0x15e>
cmpl   $0x5a,-0x8(%rbp)
jle    1191 <main+0x71>
movl   $0xa,-0xc(%rbp)
jmp    1204 <main+0xe4>
cmpl   $0x50,-0x8(%rbp)
jle    11a7 <main+0x87>
movl   $0x9,-0xc(%rbp)
jmp    11ff <main+0xdf>
cmpl   $0x46,-0x8(%rbp)
jle    11bd <main+0x9d>
movl   $0x8,-0xc(%rbp)
jmp    11fa <main+0xda>
cmpl   $0x3c,-0x8(%rbp)
jle    11d3 <main+0xb3>
movl   $0x7,-0xc(%rbp)
jmp    11f5 <main+0xd5>
cmpl   $0x32,-0x8(%rbp)
jle    11e9 <main+0xc9>
movl   $0x6,-0xc(%rbp)
jmp    11f0 <main+0xd0>
movl   $0x5,-0xc(%rbp)
jmp    11f5 <main+0xd5>
jmp    11fa <main+0xda>
jmp    11ff <main+0xdf>
jmp    1204 <main+0xe4>
movb   $0x20,-0xd(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
cmpl   $0x5,-0xc(%rbp)
je     1269 <main+0x149>
cmpl   $0x1,-0x14(%rbp)
jl     123d <main+0x11d>
cmpl   $0x3,-0x14(%rbp)
jg     123d <main+0x11d>
movb   $0x2d,-0xd(%rbp)
jmp    1264 <main+0x144>
cmpl   $0xa,-0xc(%rbp)
je     125f <main+0x13f>
cmpl   $0x8,-0x14(%rbp)
jge    125b <main+0x13b>
cmpl   $0x0,-0x14(%rbp)
jne    125f <main+0x13f>
movb   $0x2b,-0xd(%rbp)
jmp    1264 <main+0x144>
jmp    1269 <main+0x149>
mov    -0xc(%rbp),%esi
movsbl -0xd(%rbp),%edx
lea    0xdb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed7(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x65,%eax
jb     1168 <main+0x38>
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
jmp    120e <main+0xde>
cmp    $0x5b,%eax
jb     119e <main+0x6e>
movzbl %al,%eax
imul   $0xcd,%eax,%ecx
shr    $0xa,%ecx
and    $0xfffffffe,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %cl,%al
movzbl %al,%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
mov    $0x2d,%eax
mov    $0x20,%edx
cmovb  %eax,%edx
mov    $0xa,%esi
jmp    1200 <main+0xd0>
mov    $0x9,%esi
cmp    $0x50,%eax
ja     11c6 <main+0x96>
mov    $0x8,%esi
cmp    $0x46,%eax
ja     11c6 <main+0x96>
mov    $0x7,%esi
cmp    $0x3c,%eax
ja     11c6 <main+0x96>
mov    $0x6,%esi
cmp    $0x33,%eax
jb     1212 <main+0xe2>
movzbl %al,%eax
imul   $0xcd,%eax,%ecx
shr    $0xa,%ecx
and    $0xfffffffe,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %cl,%al
movzbl %al,%edi
add    $0xffffffff,%edi
mov    $0x2d,%edx
mov    $0x20,%ecx
cmp    $0x3,%edi
cmovae %ecx,%edx
jb     1200 <main+0xd0>
add    $0xf8,%al
cmp    $0xf9,%al
mov    $0x2b,%eax
cmovb  %eax,%ecx
mov    %ecx,%edx
lea    0xdfc(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    $0x20,%edx
mov    $0x5,%esi
jmp    1200 <main+0xd0>

LLVM IR (-O0):
@.str = [16 x i8] c"Enter points: \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [27 x i8] c"Invalid value for points!\0A\00"
@.str.3 = [12 x i8] c"Grade %d%c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %0
%11 = load i32, i32* %2
%12 = icmp sgt i32 %11, 100
br i1 %12, label %13, label %15
13: ; preds = %10, %0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
br label %69
15: ; preds = %10
%16 = load i32, i32* %2
%17 = icmp sgt i32 %16, 90
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 10, i32* %3
br label %40
19: ; preds = %15
%20 = load i32, i32* %2
%21 = icmp sgt i32 %20, 80
br i1 %21, label %22, label %23
22: ; preds = %19
store i32 9, i32* %3
br label %39
23: ; preds = %19
%24 = load i32, i32* %2
%25 = icmp sgt i32 %24, 70
br i1 %25, label %26, label %27
26: ; preds = %23
store i32 8, i32* %3
br label %38
27: ; preds = %23
%28 = load i32, i32* %2
%29 = icmp sgt i32 %28, 60
br i1 %29, label %30, label %31
30: ; preds = %27
store i32 7, i32* %3
br label %37
31: ; preds = %27
%32 = load i32, i32* %2
%33 = icmp sgt i32 %32, 50
br i1 %33, label %34, label %35
34: ; preds = %31
store i32 6, i32* %3
br label %36
35: ; preds = %31
store i32 5, i32* %3
br label %36
36: ; preds = %35, %34
br label %37
37: ; preds = %36, %30
br label %38
38: ; preds = %37, %26
br label %39
39: ; preds = %38, %22
br label %40
40: ; preds = %39, %18
store i8 32, i8* %4
%41 = load i32, i32* %2
%42 = srem i32 %41, 10
store i32 %42, i32* %5
%43 = load i32, i32* %3
%44 = icmp ne i32 %43, 5
br i1 %44, label %45, label %64
45: ; preds = %40
%46 = load i32, i32* %5
%47 = icmp sge i32 %46, 1
br i1 %47, label %48, label %52
48: ; preds = %45
%49 = load i32, i32* %5
%50 = icmp sle i32 %49, 3
br i1 %50, label %51, label %52
51: ; preds = %48
store i8 45, i8* %4
br label %63
52: ; preds = %48, %45
%53 = load i32, i32* %3
%54 = icmp ne i32 %53, 10
br i1 %54, label %55, label %62
55: ; preds = %52
%56 = load i32, i32* %5
%57 = icmp sge i32 %56, 8
br i1 %57, label %61, label %58
58: ; preds = %55
%59 = load i32, i32* %5
%60 = icmp eq i32 %59, 0
br i1 %60, label %61, label %62
61: ; preds = %58, %55
store i8 43, i8* %4
br label %62
62: ; preds = %61, %58, %52
br label %63
63: ; preds = %62, %51
br label %64
64: ; preds = %63, %40
%65 = load i32, i32* %3
%66 = load i8, i8* %4
%67 = sext i8 %66 to i32
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %65, i32 %67)
br label %69
69: ; preds = %64, %13
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [12 x i8] c"Grade %d%c\0A\00"
@str = [15 x i8] c"Enter points: \00"
@str.4 = [26 x i8] c"Invalid value for points!\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 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
%6 = icmp ugt i32 %5, 100
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.4, i64 0, i64 0))
br label %42
9: ; preds = %0
%10 = icmp ugt i32 %5, 90
br i1 %10, label %11, label %18
11: ; preds = %9
%12 = trunc i32 %5 to i8
%13 = urem i8 %12, 10
%14 = zext i8 %13 to i32
%15 = add nsw i32 %14, -1
%16 = icmp ult i32 %15, 3
%17 = select i1 %16, i32 45, i32 32
br label %38
18: ; preds = %9
%19 = icmp ugt i32 %5, 80
br i1 %19, label %26, label %20
20: ; preds = %18
%21 = icmp ugt i32 %5, 70
br i1 %21, label %26, label %22
22: ; preds = %20
%23 = icmp ugt i32 %5, 60
br i1 %23, label %26, label %24
24: ; preds = %22
%25 = icmp ugt i32 %5, 50
br i1 %25, label %26, label %38
26: ; preds = %22, %20, %18, %24
%27 = phi i32 [ 6, %24 ], [ 7, %22 ], [ 8, %20 ], [ 9, %18 ]
%28 = trunc i32 %5 to i8
%29 = urem i8 %28, 10
%30 = zext i8 %29 to i32
%31 = add nsw i32 %30, -1
%32 = icmp ult i32 %31, 3
%33 = select i1 %32, i32 45, i32 32
br i1 %32, label %38, label %34
34: ; preds = %26
%35 = add nsw i8 %29, -8
%36 = icmp ult i8 %35, -7
%37 = select i1 %36, i32 43, i32 32
br label %38
38: ; preds = %11, %34, %26, %24
%39 = phi i32 [ 5, %24 ], [ %27, %26 ], [ %27, %34 ], [ 10, %11 ]
%40 = phi i32 [ 32, %24 ], [ %33, %26 ], [ %37, %34 ], [ %17, %11 ]
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %39, i32 %40)
br label %42
42: ; preds = %38, %7
ret i32 0
}