#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, char);
int /*<<< orphan*/ puts(char *);
int main() {
  char grades[] = {
      'A', 'A', 'B', 'C', 'A', 'B', 'C', 'C', 'B', 'A', 'D', 'D', 'B', 'B',
      'A', 'A', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'F', 'B', 'B', 'B', 'B',
  };
  int student;
  puts("Class Grades");
  for (student = 0; student < 35; student++)
    printf("Student #%d, %c\n", student + 1, grades[student]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec2(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x23,-0x24(%rbp)
jge    119f <main+0x7f>
mov    -0x24(%rbp),%esi
add    $0x1,%esi
movslq -0x24(%rbp),%rax
lea    0xea2(%rip),%rdi
movsbl -0x20(%rbp,%rax,1),%edx
call   1040 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    116c <main+0x4c>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    0xef0(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
lea    0xec6(%rip),%r15
lea    0xee8(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl (%rbx,%r15,1),%edx
add    $0x1,%rbx
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
cmp    $0x23,%rbx
jne    1150 <main+0x30>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.grades = [28 x i8] c"AABCABCCBADDBBAAABABABAFBBBB"
@.str = [13 x i8] c"Class Grades\00"
@.str.1 = [17 x i8] c"Student #%d, %c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [28 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [28 x i8]* %2 to i8*
%5 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %6
6: ; preds = %17, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 35
br i1 %8, label %9, label %20
9: ; preds = %6
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [28 x i8], [28 x i8]* %2, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %11, i8 signext %15)
br label %17
17: ; preds = %9
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %6
20: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@__const.main.grades = [28 x i8] c"AABCABCCBADDBBAAABABABAFBBBB"
@.str = [13 x i8] c"Class Grades\00"
@.str.1 = [17 x i8] c"Student #%d, %c\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
%3 = phi i64 [ 0, %0 ], [ %4, %2 ]
%4 = add nuw nsw i64 %3, 1
%5 = getelementptr inbounds [28 x i8], [28 x i8]* @__const.main.grades, i64 0, i64 %3
%6 = load i8, i8* %5
%7 = trunc i64 %4 to i32
%8 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %7, i8 signext %6)
%9 = icmp eq i64 %4, 35
br i1 %9, label %10, label %2
10: ; preds = %2
ret i32 0
}