#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 main(void) {
  int answer;
  int rating;
  int frequency[11] = {0};
  int responses[40] = {1, 2,  6, 4, 8, 5, 9, 7, 8, 10, 1, 6, 3, 8,
                       6, 10, 3, 8, 2, 7, 6, 5, 7, 6,  8, 6, 7, 5,
                       6, 6,  5, 6, 7, 5, 6, 4, 8, 6,  8, 10};
  for (answer = 0; answer < 40; answer++) {
    ++frequency[responses[answer]];
  }
  printf("%s%17s\n", "Rating", "Frequency");
  for (rating = 1; rating < 11; rating++) {
    printf("%6d%17d\n", rating, frequency[rating]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x2c,%edx
call   1040 <memset@plt>
lea    -0xe0(%rbp),%rdi
lea    0xea0(%rip),%rsi
mov    $0xa0,%edx
call   1050 <memcpy@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x28,-0x8(%rbp)
jge    11a0 <main+0x70>
movslq -0x8(%rbp),%rax
movslq -0xe0(%rbp,%rax,4),%rax
ff
mov    -0x40(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x40(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1171 <main+0x41>
lea    0xef9(%rip),%rdi
lea    0xefa(%rip),%rsi
lea    0xefa(%rip),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0xc(%rbp)
cmpl   $0xb,-0xc(%rbp)
jge    11f4 <main+0xc4>
mov    -0xc(%rbp),%esi
movslq -0xc(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%edx
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c3 <main+0x93>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
xorps  %xmm0,%xmm0
movups %xmm0,0x1c(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
mov    $0x1,%eax
lea    0xece(%rip),%rcx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movslq -0x4(%rcx,%rax,4),%rdx
addl   $0x1,(%rsp,%rdx,4)
movslq (%rcx,%rax,4),%rdx
addl   $0x1,(%rsp,%rdx,4)
add    $0x2,%rax
cmp    $0x29,%rax
jne    1140 <main+0x30>
lea    0xf3e(%rip),%rdi
lea    0xf3f(%rip),%rsi
lea    0xf3f(%rip),%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%edx
lea    0xf37(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x10(%rsp),%edx
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x14(%rsp),%edx
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x18(%rsp),%edx
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x1c(%rsp),%edx
mov    %rbx,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x20(%rsp),%edx
mov    %rbx,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x24(%rsp),%edx
mov    %rbx,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x28(%rsp),%edx
mov    %rbx,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.responses = [40 x i32] [i32 1, i32 2, i32 6, i32 4, i32 8, i32 5, i32 9, i32 7, i32 8, i32 10, i32 1, i32 6, i32 3, i32 8, i32 6, i32 10, i32 3, i32 8, i32 2, i32 7, i32 6, i32 5, i32 7, i32 6, i32 8, i32 6, i32 7, i32 5, i32 6, i32 6, i32 5, i32 6, i32 7, i32 5, i32 6, i32 4, i32 8, i32 6, i32 8, i32 10]
@.str = [8 x i8] c"%s%17s\0A\00"
@.str.1 = [7 x i8] c"Rating\00"
@.str.2 = [10 x i8] c"Frequency\00"
@.str.3 = [9 x i8] c"%6d%17d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [11 x i32]
%5 = alloca [40 x i32]
store i32 0, i32* %1
%6 = bitcast [11 x i32]* %4 to i8*
%7 = bitcast [40 x i32]* %5 to i8*
store i32 0, i32* %2
br label %8
8: ; preds = %20, %0
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 40
br i1 %10, label %11, label %23
11: ; preds = %8
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [40 x i32], [40 x i32]* %5, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [11 x i32], [11 x i32]* %4, i64 0, i64 %16
%18 = load i32, i32* %17
%19 = add nsw i32 %18, 1
store i32 %19, i32* %17
br label %20
20: ; preds = %11
%21 = load i32, i32* %2
%22 = add nsw i32 %21, 1
store i32 %22, i32* %2
br label %8
23: ; preds = %8
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %25
25: ; preds = %35, %23
%26 = load i32, i32* %3
%27 = icmp slt i32 %26, 11
br i1 %27, label %28, label %38
28: ; preds = %25
%29 = load i32, i32* %3
%30 = load i32, i32* %3
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [11 x i32], [11 x i32]* %4, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %29, i32 %33)
br label %35
35: ; preds = %28
%36 = load i32, i32* %3
%37 = add nsw i32 %36, 1
store i32 %37, i32* %3
br label %25
38: ; preds = %25
ret i32 0
}

LLVM IR (-O2):
@__const.main.responses = [40 x i32] [i32 1, i32 2, i32 6, i32 4, i32 8, i32 5, i32 9, i32 7, i32 8, i32 10, i32 1, i32 6, i32 3, i32 8, i32 6, i32 10, i32 3, i32 8, i32 2, i32 7, i32 6, i32 5, i32 7, i32 6, i32 8, i32 6, i32 7, i32 5, i32 6, i32 6, i32 5, i32 6, i32 7, i32 5, i32 6, i32 4, i32 8, i32 6, i32 8, i32 10]
@.str = [8 x i8] c"%s%17s\0A\00"
@.str.1 = [7 x i8] c"Rating\00"
@.str.2 = [10 x i8] c"Frequency\00"
@.str.3 = [9 x i8] c"%6d%17d\0A\00"
define i32 @main() {
%1 = alloca [11 x i32]
%2 = bitcast [11 x i32]* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = phi i64 [ 0, %0 ], [ %18, %3 ]
%5 = getelementptr inbounds [40 x i32], [40 x i32]* @__const.main.responses, i64 0, i64 %4
%6 = load i32, i32* %5
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 %7
%9 = load i32, i32* %8
%10 = add nsw i32 %9, 1
store i32 %10, i32* %8
%11 = or i64 %4, 1
%12 = getelementptr inbounds [40 x i32], [40 x i32]* @__const.main.responses, i64 0, i64 %11
%13 = load i32, i32* %12
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = add nsw i32 %16, 1
store i32 %17, i32* %15
%18 = add nuw nsw i64 %4, 2
%19 = icmp eq i64 %18, 40
br i1 %19, label %20, label %3
20: ; preds = %3
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%22 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 1
%23 = load i32, i32* %22
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 %23)
%25 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 2
%26 = load i32, i32* %25
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 2, i32 %26)
%28 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 3
%29 = load i32, i32* %28
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 3, i32 %29)
%31 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 4
%32 = load i32, i32* %31
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 4, i32 %32)
%34 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 5
%35 = load i32, i32* %34
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 5, i32 %35)
%37 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 6
%38 = load i32, i32* %37
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 6, i32 %38)
%40 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 7
%41 = load i32, i32* %40
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 7, i32 %41)
%43 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 8
%44 = load i32, i32* %43
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 8, i32 %44)
%46 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 9
%47 = load i32, i32* %46
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 9, i32 %47)
%49 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 10
%50 = load i32, i32* %49
%51 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 10, i32 %50)
ret i32 0
}