#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 EOF;
int getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int main(void) {
  int grades;
  unsigned int aCount = 0;
  unsigned int bCount = 0;
  unsigned int cCount = 0;
  unsigned int dCount = 0;
  unsigned int fCount = 0;
  puts("Enter the letter grades.");
  puts("Enter the EOF character to end input.");
  while ((grades = getchar()) != EOF) {
    if (grades == 'A' || grades == 'a') {
      aCount++;
    }
    if (grades == 'B' || grades == 'b') {
      bCount++;
    }
    if (grades == 'C' || grades == 'c') {
      cCount++;
    }
    if (grades == 'D' || grades == 'd') {
      dCount++;
    }
    if (grades == 'F' || grades == 'f') {
      fCount++;
    }
    if (grades == '\n' || grades == '\t' || grades == ' ') {
    }
    if (!((grades == 'A' || grades == 'a') ||
          (grades == 'B' || grades == 'b') ||
          (grades == 'C' || grades == 'c') ||
          (grades == 'D' || grades == 'd') ||
          (grades == 'F' || grades == 'f') ||
          (grades == '\n' || grades == '\t' || grades == ' '))) {
      printf("%s", "Incorrect letter grade entered.");
      puts("Enter a new grade.");
    }
  }
  puts("\nTotals for each letter grade are:");
  printf("A: %u\n", aCount);
  printf("B: %u\n", bCount);
  printf("C: %u\n", cCount);
  printf("D: %u\n", dCount);
  printf("F: %u\n", fCount);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xe97(%rip),%rdi
call   1030 <puts@plt>
lea    0xea4(%rip),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e5d(%rip),%rcx
cmp    (%rcx),%eax
je     12ef <main+0x1bf>
cmpl   $0x41,-0x8(%rbp)
je     11a7 <main+0x77>
cmpl   $0x61,-0x8(%rbp)
jne    11b0 <main+0x80>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x42,-0x8(%rbp)
je     11c4 <main+0x94>
cmpl   $0x62,-0x8(%rbp)
jne    11cd <main+0x9d>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x43,-0x8(%rbp)
je     11e1 <main+0xb1>
cmpl   $0x63,-0x8(%rbp)
jne    11ea <main+0xba>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x44,-0x8(%rbp)
je     11fe <main+0xce>
cmpl   $0x64,-0x8(%rbp)
jne    1207 <main+0xd7>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x46,-0x8(%rbp)
je     121b <main+0xeb>
cmpl   $0x66,-0x8(%rbp)
jne    1224 <main+0xf4>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0xa,-0x8(%rbp)
je     1242 <main+0x112>
cmpl   $0x9,-0x8(%rbp)
je     1242 <main+0x112>
cmpl   $0x20,-0x8(%rbp)
jne    1247 <main+0x117>
jmp    1247 <main+0x117>
cmpl   $0x41,-0x8(%rbp)
je     12ea <main+0x1ba>
cmpl   $0x61,-0x8(%rbp)
je     12ea <main+0x1ba>
cmpl   $0x42,-0x8(%rbp)
je     12ea <main+0x1ba>
cmpl   $0x62,-0x8(%rbp)
je     12ea <main+0x1ba>
cmpl   $0x43,-0x8(%rbp)
je     12ea <main+0x1ba>
cmpl   $0x63,-0x8(%rbp)
je     12ea <main+0x1ba>
cmpl   $0x44,-0x8(%rbp)
je     12ea <main+0x1ba>
cmpl   $0x64,-0x8(%rbp)
je     12ea <main+0x1ba>
cmpl   $0x46,-0x8(%rbp)
je     12ea <main+0x1ba>
cmpl   $0x66,-0x8(%rbp)
je     12ea <main+0x1ba>
cmpl   $0xa,-0x8(%rbp)
je     12ea <main+0x1ba>
cmpl   $0x9,-0x8(%rbp)
je     12ea <main+0x1ba>
cmpl   $0x20,-0x8(%rbp)
je     12ea <main+0x1ba>
lea    0xd6f(%rip),%rdi
lea    0xd6b(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd7d(%rip),%rdi
call   1030 <puts@plt>
jmp    117a <main+0x4a>
lea    0xd7f(%rip),%rdi
call   1030 <puts@plt>
mov    -0xc(%rbp),%esi
lea    0xd93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xd89(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xd7f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xd75(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xd6b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0x1043(%rip),%rdi
call   1030 <puts@plt>
lea    0x1050(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e82(%rip),%r13
pxor   %xmm0,%xmm0
movdqa %xmm0,(%rsp)
cmp    0x0(%r13),%eax
jne    1205 <main+0xd5>
lea    0x107d(%rip),%rdi
call   1030 <puts@plt>
movdqa (%rsp),%xmm0
movd   %xmm0,%esi
lea    0x108b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
pshufd $0x55,(%rsp),%xmm0
movd   %xmm0,%esi
lea    0x107a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
pshufd $0xee,(%rsp),%xmm0
movd   %xmm0,%esi
lea    0x1069(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
pshufd $0xff,(%rsp),%xmm0
movd   %xmm0,%esi
lea    0x1058(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x1051(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
pxor   %xmm0,%xmm0
movdqa %xmm0,(%rsp)
lea    0xdfb(%rip),%rbp
xor    %ebx,%ebx
jmp    1277 <main+0x147>
lea    0xfa7(%rip),%rdi
lea    0xfa3(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xfb5(%rip),%rdi
call   1030 <puts@plt>
nopw   0x0(%rax,%rax,1)
movd   %r12d,%xmm0
pshufd $0x0,%xmm0,%xmm0
pcmpeqd 0xdae(%rip),%xmm0
movdqa (%rsp),%xmm1
psubd  %xmm0,%xmm1
movdqa %xmm1,(%rsp)
mov    %r15b,%r14b
add    %r14d,%ebx
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    0x0(%r13),%eax
je     1179 <main+0x49>
mov    %eax,%r12d
and    $0xffffffdf,%r12d
xor    %r14d,%r14d
cmp    $0x46,%r12d
sete   %r15b
add    $0xfffffff7,%eax
cmp    $0x5d,%eax
ja     1219 <main+0xe9>
movslq 0x0(%rbp,%rax,4),%rax
add    %rbp,%rax
jmp    *%rax

LLVM IR (-O0):
@.str = [25 x i8] c"Enter the letter grades.\00"
@.str.1 = [38 x i8] c"Enter the EOF character to end input.\00"
@EOF = global i32 0
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [32 x i8] c"Incorrect letter grade entered.\00"
@.str.4 = [19 x i8] c"Enter a new grade.\00"
@.str.5 = [35 x i8] c"\0ATotals for each letter grade are:\00"
@.str.6 = [7 x i8] c"A: %u\0A\00"
@.str.7 = [7 x i8] c"B: %u\0A\00"
@.str.8 = [7 x i8] c"C: %u\0A\00"
@.str.9 = [7 x i8] c"D: %u\0A\00"
@.str.10 = [7 x i8] c"F: %u\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
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
%8 = call i32 @puts(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @puts(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %111, %0
%11 = call i32 (...) @getchar()
store i32 %11, i32* %2
%12 = load i32, i32* @EOF
%13 = icmp ne i32 %11, %12
br i1 %13, label %14, label %112
14: ; preds = %10
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 65
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = load i32, i32* %2
%19 = icmp eq i32 %18, 97
br i1 %19, label %20, label %23
20: ; preds = %17, %14
%21 = load i32, i32* %3
%22 = add i32 %21, 1
store i32 %22, i32* %3
br label %23
23: ; preds = %20, %17
%24 = load i32, i32* %2
%25 = icmp eq i32 %24, 66
br i1 %25, label %29, label %26
26: ; preds = %23
%27 = load i32, i32* %2
%28 = icmp eq i32 %27, 98
br i1 %28, label %29, label %32
29: ; preds = %26, %23
%30 = load i32, i32* %4
%31 = add i32 %30, 1
store i32 %31, i32* %4
br label %32
32: ; preds = %29, %26
%33 = load i32, i32* %2
%34 = icmp eq i32 %33, 67
br i1 %34, label %38, label %35
35: ; preds = %32
%36 = load i32, i32* %2
%37 = icmp eq i32 %36, 99
br i1 %37, label %38, label %41
38: ; preds = %35, %32
%39 = load i32, i32* %5
%40 = add i32 %39, 1
store i32 %40, i32* %5
br label %41
41: ; preds = %38, %35
%42 = load i32, i32* %2
%43 = icmp eq i32 %42, 68
br i1 %43, label %47, label %44
44: ; preds = %41
%45 = load i32, i32* %2
%46 = icmp eq i32 %45, 100
br i1 %46, label %47, label %50
47: ; preds = %44, %41
%48 = load i32, i32* %6
%49 = add i32 %48, 1
store i32 %49, i32* %6
br label %50
50: ; preds = %47, %44
%51 = load i32, i32* %2
%52 = icmp eq i32 %51, 70
br i1 %52, label %56, label %53
53: ; preds = %50
%54 = load i32, i32* %2
%55 = icmp eq i32 %54, 102
br i1 %55, label %56, label %59
56: ; preds = %53, %50
%57 = load i32, i32* %7
%58 = add i32 %57, 1
store i32 %58, i32* %7
br label %59
59: ; preds = %56, %53
%60 = load i32, i32* %2
%61 = icmp eq i32 %60, 10
br i1 %61, label %68, label %62
62: ; preds = %59
%63 = load i32, i32* %2
%64 = icmp eq i32 %63, 9
br i1 %64, label %68, label %65
65: ; preds = %62
%66 = load i32, i32* %2
%67 = icmp eq i32 %66, 32
br i1 %67, label %68, label %69
68: ; preds = %65, %62, %59
br label %69
69: ; preds = %68, %65
%70 = load i32, i32* %2
%71 = icmp eq i32 %70, 65
br i1 %71, label %111, label %72
72: ; preds = %69
%73 = load i32, i32* %2
%74 = icmp eq i32 %73, 97
br i1 %74, label %111, label %75
75: ; preds = %72
%76 = load i32, i32* %2
%77 = icmp eq i32 %76, 66
br i1 %77, label %111, label %78
78: ; preds = %75
%79 = load i32, i32* %2
%80 = icmp eq i32 %79, 98
br i1 %80, label %111, label %81
81: ; preds = %78
%82 = load i32, i32* %2
%83 = icmp eq i32 %82, 67
br i1 %83, label %111, label %84
84: ; preds = %81
%85 = load i32, i32* %2
%86 = icmp eq i32 %85, 99
br i1 %86, label %111, label %87
87: ; preds = %84
%88 = load i32, i32* %2
%89 = icmp eq i32 %88, 68
br i1 %89, label %111, label %90
90: ; preds = %87
%91 = load i32, i32* %2
%92 = icmp eq i32 %91, 100
br i1 %92, label %111, label %93
93: ; preds = %90
%94 = load i32, i32* %2
%95 = icmp eq i32 %94, 70
br i1 %95, label %111, label %96
96: ; preds = %93
%97 = load i32, i32* %2
%98 = icmp eq i32 %97, 102
br i1 %98, label %111, label %99
99: ; preds = %96
%100 = load i32, i32* %2
%101 = icmp eq i32 %100, 10
br i1 %101, label %111, label %102
102: ; preds = %99
%103 = load i32, i32* %2
%104 = icmp eq i32 %103, 9
br i1 %104, label %111, label %105
105: ; preds = %102
%106 = load i32, i32* %2
%107 = icmp eq i32 %106, 32
br i1 %107, label %111, label %108
108: ; preds = %105
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%110 = call i32 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
br label %111
111: ; preds = %108, %105, %102, %99, %96, %93, %90, %87, %84, %81, %78, %75, %72, %69
br label %10
112: ; preds = %10
%113 = call i32 @puts(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
%114 = load i32, i32* %3
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i32 %114)
%116 = load i32, i32* %4
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i32 %116)
%118 = load i32, i32* %5
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i32 %118)
%120 = load i32, i32* %6
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i32 %120)
%122 = load i32, i32* %7
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), i32 %122)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"Enter the letter grades.\00"
@.str.1 = [38 x i8] c"Enter the EOF character to end input.\00"
@EOF = global i32 0
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [32 x i8] c"Incorrect letter grade entered.\00"
@.str.4 = [19 x i8] c"Enter a new grade.\00"
@.str.5 = [35 x i8] c"\0ATotals for each letter grade are:\00"
@.str.6 = [7 x i8] c"A: %u\0A\00"
@.str.7 = [7 x i8] c"B: %u\0A\00"
@.str.8 = [7 x i8] c"C: %u\0A\00"
@.str.9 = [7 x i8] c"D: %u\0A\00"
@.str.10 = [7 x i8] c"F: %u\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 (...) @getchar()
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %26, label %6
6: ; preds = %0, %22
%7 = phi i32 [ %23, %22 ], [ %3, %0 ]
%8 = phi i32 [ %18, %22 ], [ 0, %0 ]
%9 = phi <4 x i32> [ %15, %22 ], [ zeroinitializer, %0 ]
%10 = and i32 %7, -33
%11 = insertelement <4 x i32> poison, i32 %10, i64 0
%12 = shufflevector <4 x i32> %11, <4 x i32> poison, <4 x i32> zeroinitializer
%13 = icmp eq <4 x i32> %12, <i32 65, i32 66, i32 67, i32 68>
%14 = zext <4 x i1> %13 to <4 x i32>
%15 = add <4 x i32> %9, %14
%16 = icmp eq i32 %10, 70
%17 = zext i1 %16 to i32
%18 = add i32 %8, %17
switch i32 %7, label %19 [
i32 102, label %22
i32 100, label %22
i32 99, label %22
i32 98, label %22
i32 97, label %22
i32 70, label %22
i32 68, label %22
i32 67, label %22
i32 66, label %22
i32 65, label %22
i32 32, label %22
i32 10, label %22
i32 9, label %22
]
19: ; preds = %6
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
br label %22
22: ; preds = %6, %6, %6, %6, %6, %6, %6, %6, %6, %6, %6, %6, %6, %19
%23 = tail call i32 (...) @getchar()
%24 = load i32, i32* @EOF
%25 = icmp eq i32 %23, %24
br i1 %25, label %26, label %6
26: ; preds = %22, %0
%27 = phi i32 [ 0, %0 ], [ %18, %22 ]
%28 = phi <4 x i32> [ zeroinitializer, %0 ], [ %15, %22 ]
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
%30 = extractelement <4 x i32> %28, i64 0
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i32 %30)
%32 = extractelement <4 x i32> %28, i64 1
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i32 %32)
%34 = extractelement <4 x i32> %28, i64 2
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i32 %34)
%36 = extractelement <4 x i32> %28, i64 3
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i32 %36)
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), i32 %27)
ret i32 0
}