#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 exam_grade(int);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  printf("Testing exam grade\n");
  if (exam_grade(-1) != -1) {
    printf("-1 failed\n");
  }
  if (exam_grade(0) != 0) {
    printf("0 failed\n");
  }
  if (exam_grade(24) != 0) {
    printf("24 failed\n");
  }
  if (exam_grade(25) != 1) {
    printf("25 failed\n");
  }
  if (exam_grade(37) != 1) {
    printf("37 failed\n");
  }
  if (exam_grade(38) != 2) {
    printf("38 failed\n");
  }
  if (exam_grade(51) != -1) {
    printf("51 failed\n");
  }
  printf("All tests passed if no fail messages abve\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1030 <exam_grade@plt>
cmp    $0xffffffff,%eax
je     1161 <main+0x41>
lea    0xeb8(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1030 <exam_grade@plt>
cmp    $0x0,%eax
je     117d <main+0x5d>
lea    0xea7(%rip),%rdi
call   1040 <printf@plt>
mov    $0x18,%edi
call   1030 <exam_grade@plt>
cmp    $0x0,%eax
je     119c <main+0x7c>
lea    0xe92(%rip),%rdi
call   1040 <printf@plt>
mov    $0x19,%edi
call   1030 <exam_grade@plt>
cmp    $0x1,%eax
je     11bb <main+0x9b>
lea    0xe7e(%rip),%rdi
call   1040 <printf@plt>
mov    $0x25,%edi
call   1030 <exam_grade@plt>
cmp    $0x1,%eax
je     11da <main+0xba>
lea    0xe6a(%rip),%rdi
call   1040 <printf@plt>
mov    $0x26,%edi
call   1030 <exam_grade@plt>
cmp    $0x2,%eax
je     11f9 <main+0xd9>
lea    0xe56(%rip),%rdi
call   1040 <printf@plt>
mov    $0x33,%edi
call   1030 <exam_grade@plt>
cmp    $0xffffffff,%eax
je     1218 <main+0xf8>
lea    0xe42(%rip),%rdi
call   1040 <printf@plt>
lea    0xe41(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1040 <exam_grade@plt>
cmp    $0xffffffff,%eax
je     1148 <main+0x28>
lea    0xf35(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exam_grade@plt>
test   %eax,%eax
je     115f <main+0x3f>
lea    0xf15(%rip),%rdi
call   1030 <puts@plt>
mov    $0x18,%edi
call   1040 <exam_grade@plt>
test   %eax,%eax
je     1179 <main+0x59>
lea    0xef1(%rip),%rdi
call   1030 <puts@plt>
mov    $0x19,%edi
call   1040 <exam_grade@plt>
cmp    $0x1,%eax
je     1194 <main+0x74>
lea    0xecc(%rip),%rdi
call   1030 <puts@plt>
mov    $0x25,%edi
call   1040 <exam_grade@plt>
cmp    $0x1,%eax
je     11af <main+0x8f>
lea    0xea7(%rip),%rdi
call   1030 <puts@plt>
mov    $0x26,%edi
call   1040 <exam_grade@plt>
cmp    $0x2,%eax
je     11ca <main+0xaa>
lea    0xe82(%rip),%rdi
call   1030 <puts@plt>
mov    $0x33,%edi
call   1040 <exam_grade@plt>
cmp    $0xffffffff,%eax
je     11e5 <main+0xc5>
lea    0xe5d(%rip),%rdi
call   1030 <puts@plt>
lea    0xe27(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Testing exam grade\0A\00"
@.str.1 = [11 x i8] c"-1 failed\0A\00"
@.str.2 = [10 x i8] c"0 failed\0A\00"
@.str.3 = [11 x i8] c"24 failed\0A\00"
@.str.4 = [11 x i8] c"25 failed\0A\00"
@.str.5 = [11 x i8] c"37 failed\0A\00"
@.str.6 = [11 x i8] c"38 failed\0A\00"
@.str.7 = [11 x i8] c"51 failed\0A\00"
@.str.8 = [43 x i8] c"All tests passed if no fail messages abve\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @exam_grade(i32 -1)
%8 = icmp ne i32 %7, -1
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %2
%12 = call i32 @exam_grade(i32 0)
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %14, %11
%17 = call i32 @exam_grade(i32 24)
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %21
21: ; preds = %19, %16
%22 = call i32 @exam_grade(i32 25)
%23 = icmp ne i32 %22, 1
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %26
26: ; preds = %24, %21
%27 = call i32 @exam_grade(i32 37)
%28 = icmp ne i32 %27, 1
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
br label %31
31: ; preds = %29, %26
%32 = call i32 @exam_grade(i32 38)
%33 = icmp ne i32 %32, 2
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
br label %36
36: ; preds = %34, %31
%37 = call i32 @exam_grade(i32 51)
%38 = icmp ne i32 %37, -1
br i1 %38, label %39, label %41
39: ; preds = %36
%40 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
br label %41
41: ; preds = %39, %36
%42 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.8, i64 0, i64 0))
%43 = load i32, i32* %3
ret i32 %43
}

LLVM IR (-O2):
@str = [19 x i8] c"Testing exam grade\00"
@str.9 = [42 x i8] c"All tests passed if no fail messages abve\00"
@str.10 = [10 x i8] c"51 failed\00"
@str.11 = [10 x i8] c"38 failed\00"
@str.12 = [10 x i8] c"37 failed\00"
@str.13 = [10 x i8] c"25 failed\00"
@str.14 = [10 x i8] c"24 failed\00"
@str.15 = [9 x i8] c"0 failed\00"
@str.16 = [10 x i8] c"-1 failed\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @exam_grade(i32 -1)
%5 = icmp eq i32 %4, -1
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.16, i64 0, i64 0))
br label %8
8: ; preds = %6, %2
%9 = tail call i32 @exam_grade(i32 0)
%10 = icmp eq i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %8
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.15, i64 0, i64 0))
br label %13
13: ; preds = %11, %8
%14 = tail call i32 @exam_grade(i32 24)
%15 = icmp eq i32 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %13
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.14, i64 0, i64 0))
br label %18
18: ; preds = %16, %13
%19 = tail call i32 @exam_grade(i32 25)
%20 = icmp eq i32 %19, 1
br i1 %20, label %23, label %21
21: ; preds = %18
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.13, i64 0, i64 0))
br label %23
23: ; preds = %21, %18
%24 = tail call i32 @exam_grade(i32 37)
%25 = icmp eq i32 %24, 1
br i1 %25, label %28, label %26
26: ; preds = %23
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.12, i64 0, i64 0))
br label %28
28: ; preds = %26, %23
%29 = tail call i32 @exam_grade(i32 38)
%30 = icmp eq i32 %29, 2
br i1 %30, label %33, label %31
31: ; preds = %28
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.11, i64 0, i64 0))
br label %33
33: ; preds = %31, %28
%34 = tail call i32 @exam_grade(i32 51)
%35 = icmp eq i32 %34, -1
br i1 %35, label %38, label %36
36: ; preds = %33
%37 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.10, i64 0, i64 0))
br label %38
38: ; preds = %36, %33
%39 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.9, i64 0, i64 0))
ret i32 0
}