#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*/ fflush(int /*<<< orphan*/);
char getchar();
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stdin;
int main() {
  char inp;
  printf("%s\n", "Enter Grade Code: ");
  inp = getchar();
  fflush(stdin);
  if (inp == 'A') {
    printf("%s\n", "HRA percentage is 45");
  } else if (inp == 'B') {
    printf("%s\n", "HRA percentage is 40");
  } else if (inp == 'C') {
    printf("%s\n", "HRA percentage is 30");
  } else if (inp == 'D') {
    printf("%s\n", "HRA percentage is 25");
  } else
    printf("%s\n", "Invalid Grade Code");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    0xeb7(%rip),%rsi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jne    118f <main+0x5f>
lea    0xe82(%rip),%rdi
lea    0xe92(%rip),%rsi
call   1030 <printf@plt>
jmp    1220 <main+0xf0>
movsbl -0x5(%rbp),%eax
cmp    $0x42,%eax
jne    11b4 <main+0x84>
lea    0xe5d(%rip),%rdi
lea    0xe82(%rip),%rsi
call   1030 <printf@plt>
jmp    121b <main+0xeb>
movsbl -0x5(%rbp),%eax
cmp    $0x43,%eax
jne    11d9 <main+0xa9>
lea    0xe38(%rip),%rdi
lea    0xe72(%rip),%rsi
call   1030 <printf@plt>
jmp    1216 <main+0xe6>
movsbl -0x5(%rbp),%eax
cmp    $0x44,%eax
jne    11fe <main+0xce>
lea    0xe13(%rip),%rdi
lea    0xe62(%rip),%rsi
call   1030 <printf@plt>
jmp    1211 <main+0xe1>
lea    0xdfb(%rip),%rdi
lea    0xe5f(%rip),%rsi
call   1030 <printf@plt>
jmp    1216 <main+0xe6>
jmp    121b <main+0xeb>
jmp    1220 <main+0xf0>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
lea    0xec5(%rip),%rsi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
add    $0xbf,%bl
cmp    $0x3,%bl
ja     1177 <main+0x47>
movsbq %bl,%rax
lea    0xf12(%rip),%rcx
movslq (%rcx,%rax,4),%rsi
add    %rcx,%rsi
jmp    117e <main+0x4e>
lea    0xeed(%rip),%rsi
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [19 x i8] c"Enter Grade Code: \00"
@stdin = global i32 0
@.str.2 = [21 x i8] c"HRA percentage is 45\00"
@.str.3 = [21 x i8] c"HRA percentage is 40\00"
@.str.4 = [21 x i8] c"HRA percentage is 30\00"
@.str.5 = [21 x i8] c"HRA percentage is 25\00"
@.str.6 = [19 x i8] c"Invalid Grade Code\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%4 = call signext i8 (...) @getchar()
store i8 %4, i8* %2
%5 = load i32, i32* @stdin
%6 = call i32 @fflush(i32 %5)
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 65
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %35
12: ; preds = %0
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 66
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
br label %34
18: ; preds = %12
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 67
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %33
24: ; preds = %18
%25 = load i8, i8* %2
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 68
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
br label %32
30: ; preds = %24
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
br label %32
32: ; preds = %30, %28
br label %33
33: ; preds = %32, %22
br label %34
34: ; preds = %33, %16
br label %35
35: ; preds = %34, %10
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [19 x i8] c"Enter Grade Code: \00"
@stdin = global i32 0
@.str.2 = [21 x i8] c"HRA percentage is 45\00"
@.str.3 = [21 x i8] c"HRA percentage is 40\00"
@.str.4 = [21 x i8] c"HRA percentage is 30\00"
@.str.5 = [21 x i8] c"HRA percentage is 25\00"
@.str.6 = [19 x i8] c"Invalid Grade Code\00"
@reltable.main = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([21 x i8]* @.str.2 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([21 x i8]* @.str.3 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([21 x i8]* @.str.4 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([21 x i8]* @.str.5 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32)]
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call signext i8 (...) @getchar()
%3 = load i32, i32* @stdin
%4 = tail call i32 @fflush(i32 %3)
%5 = add i8 %2, -65
%6 = icmp ult i8 %5, 4
br i1 %6, label %7, label %11
7: ; preds = %0
%8 = sext i8 %5 to i64
%9 = shl i64 %8, 2
%10 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.main to i8*), i64 %9)
br label %11
11: ; preds = %0, %7
%12 = phi i8* [ %10, %7 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), %0 ]
%13 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %12)
ret i32 0
}