#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 size = 0;
  int frequency[10] = {0};
  int i;
  printf("Enter the number of people: ");
  scanf("%d", &size);
  int response[size];
  for (i = 0; i < size; i++) {
    printf("Enter the rate (1-10): ");
    scanf("%d", &response[i]);
    if (response[i] > 10) {
      printf("Out of range, try again\n");
      printf("Enter the rate between 1 to 10: ");
      scanf("%d", &response[i]);
    }
    ++frequency[response[i] - 1];
  }
  printf("%s\t   %s\n", "RATING", "FREQUENCY");
  for (i = 0; i < 10; i++) {
    printf("%d\t   %d\n", i + 1, frequency[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movaps %xmm0,-0x20(%rbp)
movaps %xmm0,-0x30(%rbp)
movq   $0x0,-0x10(%rbp)
lea    0xeb0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x40(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    123c <main+0x11c>
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x50(%rbp),%rsi
movslq -0x34(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe58(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x50(%rbp),%rax
movslq -0x34(%rbp),%rcx
cmpl   $0xa,(%rax,%rcx,4)
jle    1213 <main+0xf3>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x50(%rbp),%rsi
movslq -0x34(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe0f(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x50(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
sub    $0x1,%eax
cltq
mov    -0x30(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1195 <main+0x75>
lea    0xe2f(%rip),%rdi
lea    0xe32(%rip),%rsi
lea    0xe32(%rip),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    1293 <main+0x173>
mov    -0x34(%rbp),%esi
add    $0x1,%esi
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    125f <main+0x13f>
movl   $0x0,-0x4(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
movl   $0x0,-0x2c(%rbp)
xorps  %xmm0,%xmm0
movaps %xmm0,-0x60(%rbp)
movaps %xmm0,-0x70(%rbp)
movq   $0x0,-0x50(%rbp)
lea    0xe9e(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeab(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1050 <scanf@plt>
mov    %rsp,-0x78(%rbp)
mov    -0x2c(%rbp),%eax
mov    %rsp,%r14
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
cmpl   $0x0,-0x2c(%rbp)
mov    $0x0,%eax
mov    $0x0,%ecx
mov    $0x0,%edx
mov    $0x0,%esi
mov    $0x0,%edi
mov    $0x0,%r13d
mov    $0x0,%r15d
mov    $0x0,%r12d
jle    1269 <main+0x139>
lea    0xe4d(%rip),%r15
lea    0xe43(%rip),%rbx
lea    0xe57(%rip),%r13
xor    %r12d,%r12d
jmp    1208 <main+0xd8>
cs nopw 0x0(%rax,%rax,1)
cltq
addl   $0x1,-0x74(%rbp,%rax,4)
add    $0x1,%r12
movslq -0x2c(%rbp),%rax
add    $0x4,%r14
cmp    %rax,%r12
jge    124b <main+0x11b>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
mov    (%r14),%eax
cmp    $0xb,%eax
jl     11f0 <main+0xc0>
lea    0xe52(%rip),%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
mov    (%r14),%eax
jmp    11f0 <main+0xc0>
mov    -0x70(%rbp),%r12d
mov    -0x6c(%rbp),%r15d
mov    -0x68(%rbp),%r13d
mov    -0x64(%rbp),%edi
mov    -0x60(%rbp),%esi
mov    -0x5c(%rbp),%edx
mov    -0x58(%rbp),%ecx
mov    -0x54(%rbp),%eax
mov    -0x50(%rbp),%ebx
mov    %esi,-0x30(%rbp)
mov    %edx,-0x34(%rbp)
mov    %ecx,-0x38(%rbp)
mov    %ebx,-0x3c(%rbp)
mov    %eax,-0x40(%rbp)
mov    %edi,%r14d
lea    0xdd7(%rip),%rdi
lea    0xdda(%rip),%rsi
lea    0xdda(%rip),%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdd6(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r12d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    -0x30(%rbp),%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
mov    -0x34(%rbp),%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
mov    -0x38(%rbp),%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
mov    -0x40(%rbp),%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
mov    -0x3c(%rbp),%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    -0x4c(%rbp),%edx
mov    %rbx,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    -0x78(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Enter the number of people: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [24 x i8] c"Enter the rate (1-10): \00"
@.str.3 = [25 x i8] c"Out of range, try again\0A\00"
@.str.4 = [33 x i8] c"Enter the rate between 1 to 10: \00"
@.str.5 = [10 x i8] c"%s\09 %s\0A\00"
@.str.6 = [7 x i8] c"RATING\00"
@.str.7 = [10 x i8] c"FREQUENCY\00"
@.str.8 = [10 x i8] c"%d\09 %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x i32]
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i32 0, i32* %1
store i32 0, i32* %2
%7 = bitcast [10 x i32]* %3 to i8*
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %5
%13 = alloca i32, i64 %11
store i64 %11, i64* %6
store i32 0, i32* %4
br label %14
14: ; preds = %46, %0
%15 = load i32, i32* %4
%16 = load i32, i32* %2
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %49
18: ; preds = %14
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%20 = load i32, i32* %4
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %13, i64 %21
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %22)
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %13, i64 %25
%27 = load i32, i32* %26
%28 = icmp sgt i32 %27, 10
br i1 %28, label %29, label %36
29: ; preds = %18
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0))
%32 = load i32, i32* %4
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32, i32* %13, i64 %33
%35 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %34)
br label %36
36: ; preds = %29, %18
%37 = load i32, i32* %4
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i32, i32* %13, i64 %38
%40 = load i32, i32* %39
%41 = sub nsw i32 %40, 1
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %42
%44 = load i32, i32* %43
%45 = add nsw i32 %44, 1
store i32 %45, i32* %43
br label %46
46: ; preds = %36
%47 = load i32, i32* %4
%48 = add nsw i32 %47, 1
store i32 %48, i32* %4
br label %14
49: ; preds = %14
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %4
br label %51
51: ; preds = %62, %49
%52 = load i32, i32* %4
%53 = icmp slt i32 %52, 10
br i1 %53, label %54, label %65
54: ; preds = %51
%55 = load i32, i32* %4
%56 = add nsw i32 %55, 1
%57 = load i32, i32* %4
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %58
%60 = load i32, i32* %59
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32 %56, i32 %60)
br label %62
62: ; preds = %54
%63 = load i32, i32* %4
%64 = add nsw i32 %63, 1
store i32 %64, i32* %4
br label %51
65: ; preds = %51
store i32 0, i32* %1
%66 = load i8*, i8** %5
%67 = load i32, i32* %1
ret i32 %67
}

LLVM IR (-O2):
@.str = [29 x i8] c"Enter the number of people: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [24 x i8] c"Enter the rate (1-10): \00"
@.str.4 = [33 x i8] c"Enter the rate between 1 to 10: \00"
@.str.5 = [10 x i8] c"%s\09 %s\0A\00"
@.str.6 = [7 x i8] c"RATING\00"
@.str.7 = [10 x i8] c"FREQUENCY\00"
@.str.8 = [10 x i8] c"%d\09 %d\0A\00"
@str = [24 x i8] c"Out of range, try again\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = bitcast [10 x i32]* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = zext i32 %7 to i64
%9 = call i8* @llvm.stacksave()
%10 = alloca i32, i64 %8
%11 = load i32, i32* %1
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %55
13: ; preds = %0, %25
%14 = phi i64 [ %32, %25 ], [ 0, %0 ]
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%16 = getelementptr inbounds i32, i32* %10, i64 %14
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%18 = load i32, i32* %16
%19 = icmp sgt i32 %18, 10
br i1 %19, label %20, label %25
20: ; preds = %13
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%24 = load i32, i32* %16
br label %25
25: ; preds = %20, %13
%26 = phi i32 [ %24, %20 ], [ %18, %13 ]
%27 = add nsw i32 %26, -1
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = add nsw i32 %30, 1
store i32 %31, i32* %29
%32 = add nuw nsw i64 %14, 1
%33 = load i32, i32* %1
%34 = sext i32 %33 to i64
%35 = icmp slt i64 %32, %34
br i1 %35, label %13, label %36
36: ; preds = %25
%37 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%38 = load i32, i32* %37
%39 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 1
%40 = load i32, i32* %39
%41 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 2
%42 = load i32, i32* %41
%43 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 3
%44 = load i32, i32* %43
%45 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 4
%46 = load i32, i32* %45
%47 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 5
%48 = load i32, i32* %47
%49 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 6
%50 = load i32, i32* %49
%51 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 7
%52 = load i32, i32* %51
%53 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 8
%54 = load i32, i32* %53
br label %55
55: ; preds = %36, %0
%56 = phi i32 [ %54, %36 ], [ 0, %0 ]
%57 = phi i32 [ %52, %36 ], [ 0, %0 ]
%58 = phi i32 [ %50, %36 ], [ 0, %0 ]
%59 = phi i32 [ %48, %36 ], [ 0, %0 ]
%60 = phi i32 [ %46, %36 ], [ 0, %0 ]
%61 = phi i32 [ %44, %36 ], [ 0, %0 ]
%62 = phi i32 [ %42, %36 ], [ 0, %0 ]
%63 = phi i32 [ %40, %36 ], [ 0, %0 ]
%64 = phi i32 [ %38, %36 ], [ 0, %0 ]
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32 1, i32 %64)
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32 2, i32 %63)
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32 3, i32 %62)
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32 4, i32 %61)
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32 5, i32 %60)
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32 6, i32 %59)
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32 7, i32 %58)
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32 8, i32 %57)
%74 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32 9, i32 %56)
%75 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 9
%76 = load i32, i32* %75
%77 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32 10, i32 %76)
ret i32 0
}