#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(void) {
  int num;
  printf("Enter your mark ");
  scanf("%d", &num);
  printf(" You entered %d", num);
  if (num >= 18) {
    printf(" You got A grade");
  } else if (num >= 14) {
    printf(" You got B grade");
  } else if (num >= 10) {
    printf(" You got C grade");
  } else if (num <= 7) {
    printf(" You Failed in this exam");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x12,-0x8(%rbp)
jl     117b <main+0x5b>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11dc <main+0xbc>
cmpl   $0xe,-0x8(%rbp)
jl     1198 <main+0x78>
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d7 <main+0xb7>
cmpl   $0xa,-0x8(%rbp)
jl     11b5 <main+0x95>
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d2 <main+0xb2>
cmpl   $0x7,-0x8(%rbp)
jg     11cd <main+0xad>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d2 <main+0xb2>
jmp    11d7 <main+0xb7>
jmp    11dc <main+0xbc>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
lea    0xec6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%eax
cmp    $0x11,%eax
jle    1164 <main+0x44>
lea    0xebf(%rip),%rdi
jmp    118c <main+0x6c>
cmp    $0xd,%eax
jle    1172 <main+0x52>
lea    0xec2(%rip),%rdi
jmp    118c <main+0x6c>
cmp    $0x9,%eax
jle    1180 <main+0x60>
lea    0xec5(%rip),%rdi
jmp    118c <main+0x6c>
cmp    $0x7,%eax
jg     1193 <main+0x73>
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Enter your mark \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [16 x i8] c" You entered %d\00"
@.str.3 = [17 x i8] c" You got A grade\00"
@.str.4 = [17 x i8] c" You got B grade\00"
@.str.5 = [17 x i8] c" You got C grade\00"
@.str.6 = [25 x i8] c" You Failed in this exam\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 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* %2)
%5 = load i32, i32* %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %2
%8 = icmp sge i32 %7, 18
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %29
11: ; preds = %0
%12 = load i32, i32* %2
%13 = icmp sge i32 %12, 14
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
br label %28
16: ; preds = %11
%17 = load i32, i32* %2
%18 = icmp sge i32 %17, 10
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
br label %27
21: ; preds = %16
%22 = load i32, i32* %2
%23 = icmp sle i32 %22, 7
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0))
br label %26
26: ; preds = %24, %21
br label %27
27: ; preds = %26, %19
br label %28
28: ; preds = %27, %14
br label %29
29: ; preds = %28, %9
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Enter your mark \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [16 x i8] c" You entered %d\00"
@.str.3 = [17 x i8] c" You got A grade\00"
@.str.4 = [17 x i8] c" You got B grade\00"
@.str.5 = [17 x i8] c" You got C grade\00"
@.str.6 = [25 x i8] c" You Failed in this exam\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 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 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %1
%8 = icmp sgt i32 %7, 17
br i1 %8, label %15, label %9
9: ; preds = %0
%10 = icmp sgt i32 %7, 13
br i1 %10, label %15, label %11
11: ; preds = %9
%12 = icmp sgt i32 %7, 9
br i1 %12, label %15, label %13
13: ; preds = %11
%14 = icmp slt i32 %7, 8
br i1 %14, label %15, label %18
15: ; preds = %13, %11, %9, %0
%16 = phi i8* [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), %0 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), %9 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), %11 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), %13 ]
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %16)
br label %18
18: ; preds = %15, %13
ret i32 0
}