#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 course_grade(int, int);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  printf("Testing course grade\n");
  if (course_grade(-1, -1) != -1) {
    printf("-1,-1 failed\n");
  }
  if (course_grade(0, 0) != 0) {
    printf("0,0 failed\n");
  }
  if (course_grade(0, 1) != 0) {
    printf("0,1 failed\n");
  }
  if (course_grade(1, 0) != 0) {
    printf("1,0 failed\n");
  }
  if (course_grade(1, 1) != 1) {
    printf("1,1 failed\n");
  }
  if (course_grade(2, 1) != 2) {
    printf("2, 1 failed\n");
  }
  if (course_grade(2, 2) != -1) {
    printf("2, 2 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   1030 <printf@plt>
mov    $0xffffffff,%esi
mov    %esi,%edi
call   1040 <course_grade@plt>
cmp    $0xffffffff,%eax
je     1163 <main+0x43>
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1040 <course_grade@plt>
cmp    $0x0,%eax
je     1181 <main+0x61>
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1040 <course_grade@plt>
cmp    $0x0,%eax
je     11a2 <main+0x82>
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <course_grade@plt>
cmp    $0x0,%eax
je     11c3 <main+0xa3>
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%esi
mov    %esi,%edi
call   1040 <course_grade@plt>
cmp    $0x1,%eax
je     11e4 <main+0xc4>
lea    0xe69(%rip),%rdi
call   1030 <printf@plt>
mov    $0x2,%edi
mov    $0x1,%esi
call   1040 <course_grade@plt>
cmp    $0x2,%eax
je     1208 <main+0xe8>
lea    0xe51(%rip),%rdi
call   1030 <printf@plt>
mov    $0x2,%esi
mov    %esi,%edi
call   1040 <course_grade@plt>
cmp    $0xffffffff,%eax
je     1229 <main+0x109>
lea    0xe3d(%rip),%rdi
call   1030 <printf@plt>
lea    0xe3e(%rip),%rdi
call   1030 <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
mov    $0xffffffff,%esi
call   1040 <course_grade@plt>
cmp    $0xffffffff,%eax
je     114d <main+0x2d>
lea    0xf3b(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1040 <course_grade@plt>
test   %eax,%eax
je     1166 <main+0x46>
lea    0xf17(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1040 <course_grade@plt>
test   %eax,%eax
je     1182 <main+0x62>
lea    0xef0(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <course_grade@plt>
test   %eax,%eax
je     119e <main+0x7e>
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1040 <course_grade@plt>
cmp    $0x1,%eax
je     11be <main+0x9e>
lea    0xe9e(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%edi
mov    $0x1,%esi
call   1040 <course_grade@plt>
cmp    $0x2,%eax
je     11de <main+0xbe>
lea    0xe72(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%edi
mov    $0x2,%esi
call   1040 <course_grade@plt>
cmp    $0xffffffff,%eax
je     11fe <main+0xde>
lea    0xe46(%rip),%rdi
call   1030 <puts@plt>
lea    0xe10(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

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