#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 assingment = 01, test = 01, quiz = 01, worksheet = 01;
  int assingmentOut = 5, testOut = 10, quizout = 5, worksheetout = 10;
  int n = 0;
  int grade[n];
  for (; n < 4; n++) {
    if (n == 0) {
      printf("Assignment Grade\n");
      scanf("%d", &grade[n]);
    }
    if (n == 1) {
      printf("Test Grade\n");
      scanf("%d", &grade[n]);
    }
    if (n == 2) {
      printf("Quiz Grade\n");
      scanf("%d", &grade[n]);
    }
    if (n == 3) {
      printf("worksheet Grade\n");
      scanf("%d", &grade[n]);
    }
  }
  printf("Grade Report for: Donald A. Huskey\n\n");
  printf("Assignment %d\tTest %d\tQuiz %d\tWorksheet %d\n", assingment, test,
         quiz, worksheet);
  printf("%4d/%d\t\t", grade[0], assingmentOut);
  printf("%2d/%d\t", grade[1], testOut);
  printf("%2d/%d\t", grade[2], quizout);
  printf("%5d/%d\n", grade[3], quizout);
  printf("\nTotal Points:\t%d/%d\n", 29, 30);
  printf("Average:\t%f\n", 96.67);
  printf("Letter Grade:\t%c\n", 'A');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x5,-0x18(%rbp)
movl   $0xa,-0x1c(%rbp)
movl   $0x5,-0x20(%rbp)
movl   $0xa,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x30(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x38(%rbp)
cmpl   $0x4,-0x28(%rbp)
jge    127e <main+0x15e>
cmpl   $0x0,-0x28(%rbp)
jne    11d2 <main+0xb2>
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%rsi
movslq -0x28(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe4d(%rip),%rdi
call   1040 <scanf@plt>
cmpl   $0x1,-0x28(%rbp)
jne    1205 <main+0xe5>
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%rsi
movslq -0x28(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe1a(%rip),%rdi
call   1040 <scanf@plt>
cmpl   $0x2,-0x28(%rbp)
jne    1238 <main+0x118>
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%rsi
movslq -0x28(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xde7(%rip),%rdi
call   1040 <scanf@plt>
cmpl   $0x3,-0x28(%rbp)
jne    126b <main+0x14b>
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%rsi
movslq -0x28(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xdb4(%rip),%rdi
call   1040 <scanf@plt>
jmp    1270 <main+0x150>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1195 <main+0x75>
lea    0xdc1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
lea    0xdcb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%edx
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%rax
mov    0x4(%rax),%esi
mov    -0x1c(%rbp),%edx
lea    0xdd1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%rax
mov    0x8(%rax),%esi
mov    -0x20(%rbp),%edx
lea    0xdb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%rax
mov    0xc(%rax),%esi
mov    -0x20(%rbp),%edx
lea    0xda9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xda3(%rip),%rdi
mov    $0x1d,%esi
mov    $0x1e,%edx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xda1(%rip),%rdi
movsd  0xcd3(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xd98(%rip),%rdi
mov    $0x41,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xc(%rsp),%r14
lea    0x8(%rsp),%r15
lea    0x4(%rsp),%r12
lea    0xf81(%rip),%rdi
call   1030 <puts@plt>
lea    0xeae(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xf58(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
lea    0xf36(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
lea    0xf0f(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
lea    0xed4(%rip),%rdi
call   1030 <puts@plt>
lea    0xe4e(%rip),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
mov    $0x1,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%esi
lea    0xe54(%rip),%rdi
mov    $0x5,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
lea    0xe46(%rip),%rbx
mov    %rbx,%rdi
mov    $0xa,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
mov    $0x5,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
lea    0xe21(%rip),%rdi
mov    $0x5,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe16(%rip),%rdi
mov    $0x1d,%esi
mov    $0x1e,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe14(%rip),%rdi
movsd  0xda6(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe0b(%rip),%rdi
mov    $0x41,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Assignment Grade\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [12 x i8] c"Test Grade\0A\00"
@.str.3 = [12 x i8] c"Quiz Grade\0A\00"
@.str.4 = [17 x i8] c"worksheet Grade\0A\00"
@.str.5 = [37 x i8] c"Grade Report for: Donald A. Huskey\0A\0A\00"
@.str.6 = [44 x i8] c"Assignment %d\09Test %d\09Quiz %d\09Worksheet %d\0A\00"
@.str.7 = [9 x i8] c"%4d/%d\09\09\00"
@.str.8 = [8 x i8] c"%2d/%d\09\00"
@.str.9 = [8 x i8] c"%5d/%d\0A\00"
@.str.10 = [22 x i8] c"\0ATotal Points:\09%d/%d\0A\00"
@.str.11 = [13 x i8] c"Average:\09%f\0A\00"
@.str.12 = [18 x i8] c"Letter Grade:\09%c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i64
store i32 0, i32* %1
store i32 1, i32* %2
store i32 1, i32* %3
store i32 1, i32* %4
store i32 1, i32* %5
store i32 5, i32* %6
store i32 10, i32* %7
store i32 5, i32* %8
store i32 10, i32* %9
store i32 0, i32* %10
%13 = load i32, i32* %10
%14 = zext i32 %13 to i64
%15 = call i8* @llvm.stacksave()
store i8* %15, i8** %11
%16 = alloca i32, i64 %14
store i64 %14, i64* %12
br label %17
17: ; preds = %57, %0
%18 = load i32, i32* %10
%19 = icmp slt i32 %18, 4
br i1 %19, label %20, label %60
20: ; preds = %17
%21 = load i32, i32* %10
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %29
23: ; preds = %20
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%25 = load i32, i32* %10
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %16, i64 %26
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %27)
br label %29
29: ; preds = %23, %20
%30 = load i32, i32* %10
%31 = icmp eq i32 %30, 1
br i1 %31, label %32, label %38
32: ; preds = %29
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%34 = load i32, i32* %10
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i32, i32* %16, i64 %35
%37 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %36)
br label %38
38: ; preds = %32, %29
%39 = load i32, i32* %10
%40 = icmp eq i32 %39, 2
br i1 %40, label %41, label %47
41: ; preds = %38
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%43 = load i32, i32* %10
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i32, i32* %16, i64 %44
%46 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %45)
br label %47
47: ; preds = %41, %38
%48 = load i32, i32* %10
%49 = icmp eq i32 %48, 3
br i1 %49, label %50, label %56
50: ; preds = %47
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%52 = load i32, i32* %10
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i32, i32* %16, i64 %53
%55 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %54)
br label %56
56: ; preds = %50, %47
br label %57
57: ; preds = %56
%58 = load i32, i32* %10
%59 = add nsw i32 %58, 1
store i32 %59, i32* %10
br label %17
60: ; preds = %17
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0))
%62 = load i32, i32* %2
%63 = load i32, i32* %3
%64 = load i32, i32* %4
%65 = load i32, i32* %5
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0), i32 %62, i32 %63, i32 %64, i32 %65)
%67 = getelementptr inbounds i32, i32* %16, i64 0
%68 = load i32, i32* %67
%69 = load i32, i32* %6
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 %68, i32 %69)
%71 = getelementptr inbounds i32, i32* %16, i64 1
%72 = load i32, i32* %71
%73 = load i32, i32* %7
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i32 %72, i32 %73)
%75 = getelementptr inbounds i32, i32* %16, i64 2
%76 = load i32, i32* %75
%77 = load i32, i32* %8
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i32 %76, i32 %77)
%79 = getelementptr inbounds i32, i32* %16, i64 3
%80 = load i32, i32* %79
%81 = load i32, i32* %8
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i32 %80, i32 %81)
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i32 29, i32 30)
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0), double 9.667000e+01)
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.12, i64 0, i64 0), i32 65)
store i32 0, i32* %1
%86 = load i8*, i8** %11
%87 = load i32, i32* %1
ret i32 %87
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.6 = [44 x i8] c"Assignment %d\09Test %d\09Quiz %d\09Worksheet %d\0A\00"
@.str.7 = [9 x i8] c"%4d/%d\09\09\00"
@.str.8 = [8 x i8] c"%2d/%d\09\00"
@.str.9 = [8 x i8] c"%5d/%d\0A\00"
@.str.10 = [22 x i8] c"\0ATotal Points:\09%d/%d\0A\00"
@.str.11 = [13 x i8] c"Average:\09%f\0A\00"
@.str.12 = [18 x i8] c"Letter Grade:\09%c\0A\00"
@str = [36 x i8] c"Grade Report for: Donald A. Huskey\0A\00"
@str.13 = [16 x i8] c"worksheet Grade\00"
@str.14 = [11 x i8] c"Quiz Grade\00"
@str.15 = [11 x i8] c"Test Grade\00"
@str.16 = [17 x i8] c"Assignment Grade\00"
define i32 @main() {
%1 = alloca [0 x i32]
%2 = getelementptr inbounds [0 x i32], [0 x i32]* %1, i64 0, i64 0
%3 = getelementptr inbounds [0 x i32], [0 x i32]* %1, i64 0, i64 3
%4 = getelementptr inbounds [0 x i32], [0 x i32]* %1, i64 0, i64 2
%5 = getelementptr inbounds [0 x i32], [0 x i32]* %1, i64 0, i64 1
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.16, 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 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.15, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.14, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.13, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0), i32 1, i32 1, i32 1, i32 1)
%16 = load i32, i32* %2
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 %16, i32 5)
%18 = load i32, i32* %5
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i32 %18, i32 10)
%20 = load i32, i32* %4
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i32 %20, i32 5)
%22 = load i32, i32* %3
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i32 %22, i32 5)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i32 29, i32 30)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0), double 9.667000e+01)
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.12, i64 0, i64 0), i32 65)
ret i32 0
}