#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, int);
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,
                       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, 9};
  for (answer = 0; answer < 40; answer++) {
    frequency[responses[answer]] = frequency[responses[answer]] + 1;
  }
  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    11ac <main+0x7c>
movslq -0x8(%rbp),%rax
movslq -0xe0(%rbp,%rax,4),%rax
ff
mov    -0x40(%rbp,%rax,4),%ecx
add    $0x1,%ecx
movslq -0x8(%rbp),%rax
movslq -0xe0(%rbp,%rax,4),%rax
ff
mov    %ecx,-0x40(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1171 <main+0x41>
movl   $0x1,-0xc(%rbp)
cmpl   $0xb,-0xc(%rbp)
jge    11e2 <main+0xb2>
mov    -0xc(%rbp),%esi
movslq -0xc(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%edx
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11b3 <main+0x83>
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>
mov    0x4(%rsp),%edx
lea    0xf3a(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    0x10(%rsp),%edx
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
mov    0x14(%rsp),%edx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
mov    0x18(%rsp),%edx
mov    %rbx,%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
mov    0x1c(%rsp),%edx
mov    %rbx,%rdi
mov    $0x7,%esi
call   1030 <printf@plt>
mov    0x20(%rsp),%edx
mov    %rbx,%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
mov    0x24(%rsp),%edx
mov    %rbx,%rdi
mov    $0x9,%esi
call   1030 <printf@plt>
mov    0x28(%rsp),%edx
mov    %rbx,%rdi
mov    $0xa,%esi
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 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, i32 9]
@.str = [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 = %26, %0
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 40
br i1 %10, label %11, label %29
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
%20 = load i32, i32* %2
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [40 x i32], [40 x i32]* %5, i64 0, i64 %21
%23 = load i32, i32* %22
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [11 x i32], [11 x i32]* %4, i64 0, i64 %24
store i32 %19, i32* %25
br label %26
26: ; preds = %11
%27 = load i32, i32* %2
%28 = add nsw i32 %27, 1
store i32 %28, i32* %2
br label %8
29: ; preds = %8
store i32 1, i32* %3
br label %30
30: ; preds = %40, %29
%31 = load i32, i32* %3
%32 = icmp slt i32 %31, 11
br i1 %32, label %33, label %43
33: ; preds = %30
%34 = load i32, i32* %3
%35 = load i32, i32* %3
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [11 x i32], [11 x i32]* %4, i64 0, i64 %36
%38 = load i32, i32* %37
%39 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %34, i32 %38)
br label %40
40: ; preds = %33
%41 = load i32, i32* %3
%42 = add nsw i32 %41, 1
store i32 %42, i32* %3
br label %30
43: ; preds = %30
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 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, i32 9]
@.str = [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 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 1
%22 = load i32, i32* %21
%23 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 1, i32 %22)
%24 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 2
%25 = load i32, i32* %24
%26 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 2, i32 %25)
%27 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 3
%28 = load i32, i32* %27
%29 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 3, i32 %28)
%30 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 4
%31 = load i32, i32* %30
%32 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 4, i32 %31)
%33 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 5
%34 = load i32, i32* %33
%35 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 5, i32 %34)
%36 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 6
%37 = load i32, i32* %36
%38 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 6, i32 %37)
%39 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 7
%40 = load i32, i32* %39
%41 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 7, i32 %40)
%42 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 8
%43 = load i32, i32* %42
%44 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 8, i32 %43)
%45 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 9
%46 = load i32, i32* %45
%47 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 9, i32 %46)
%48 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 10
%49 = load i32, i32* %48
%50 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 10, i32 %49)
ret i32 0
}