#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(void) {
  int ratingCounters[11] = {}, i, response, entries;
  printf("How many responses to enter? ");
  scanf("%i", &entries);
  printf("Enter your responses, 999 to exit\n");
  for (i = 1; i <= entries; ++i) {
    scanf("%i", &response);
    if (1 <= response && response <= 10)
      ++ratingCounters[response];
    else if (999 == response)
      break;
    else
      printf("Bad response: %i\n", response);
  }
  printf("\n\n");
  printf("Rating Number of Responses\n");
  printf("------ -------------------\n");
  for (i = 1; i <= 10; ++i)
    printf("%4i%14i\n", i, ratingCounters[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x2c,%edx
call   1040 <memset@plt>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
lea    -0x3c(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jg     1206 <main+0xd6>
lea    0xe89(%rip),%rdi
lea    -0x38(%rbp),%rsi
call   1050 <scanf@plt>
mov    $0x1,%eax
cmp    -0x38(%rbp),%eax
jg     11ca <main+0x9a>
cmpl   $0xa,-0x38(%rbp)
jg     11ca <main+0x9a>
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x30(%rbp,%rax,4)
jmp    11f3 <main+0xc3>
mov    $0x3e7,%eax
cmp    -0x38(%rbp),%eax
jne    11dd <main+0xad>
jmp    1206 <main+0xd6>
mov    -0x38(%rbp),%esi
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f3 <main+0xc3>
jmp    11f8 <main+0xc8>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1182 <main+0x52>
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jg     1268 <main+0x138>
mov    -0x34(%rbp),%esi
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1237 <main+0x107>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
xorps  %xmm0,%xmm0
movups %xmm0,0x3c(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
lea    0xea9(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb7(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <scanf@plt>
lea    0xec4(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x0,0x8(%rsp)
mov    $0x0,%eax
mov    $0x0,%ecx
mov    $0x0,%edx
mov    $0x0,%ebx
mov    $0x0,%r14d
mov    $0x0,%r15d
mov    $0x0,%r12d
mov    $0x0,%r13d
jle    1231 <main+0x101>
lea    0xe63(%rip),%r15
lea    0x1c(%rsp),%rbp
lea    0xe5a(%rip),%r14
xor    %ebx,%ebx
jmp    11de <main+0xae>
nopl   0x0(%rax,%rax,1)
addl   $0x1,0x20(%rsp,%rsi,4)
add    $0x1,%ebx
cmp    0x8(%rsp),%ebx
jge    1209 <main+0xd9>
mov    %r15,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
mov    0x1c(%rsp),%esi
lea    -0x1(%rsi),%eax
cmp    $0x9,%eax
jbe    11d0 <main+0xa0>
cmp    $0x3e7,%esi
je     1209 <main+0xd9>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11d5 <main+0xa5>
mov    0x24(%rsp),%r13d
mov    0x28(%rsp),%r12d
mov    0x2c(%rsp),%r15d
mov    0x30(%rsp),%r14d
mov    0x34(%rsp),%ebx
mov    0x38(%rsp),%edx
mov    0x3c(%rsp),%ecx
mov    0x40(%rsp),%eax
mov    0x44(%rsp),%ebp
mov    %edx,0xc(%rsp)
mov    %ecx,0x10(%rsp)
mov    %ebp,0x14(%rsp)
mov    %eax,0x18(%rsp)
lea    0xde9(%rip),%rdi
call   1030 <puts@plt>
lea    0xe0a(%rip),%rdi
call   1030 <puts@plt>
lea    0xe19(%rip),%rdi
call   1030 <puts@plt>
lea    0xdc7(%rip),%rbp
mov    %rbp,%rdi
mov    $0x1,%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    $0x2,%esi
mov    %r12d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    $0x3,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    $0x4,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    $0x5,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    $0x6,%esi
mov    0xc(%rsp),%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    $0x7,%esi
mov    0x10(%rsp),%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    $0x8,%esi
mov    0x18(%rsp),%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    $0x9,%esi
mov    0x14(%rsp),%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x48(%rsp),%edx
mov    %rbp,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"How many responses to enter? \00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [35 x i8] c"Enter your responses, 999 to exit\0A\00"
@.str.3 = [18 x i8] c"Bad response: %i\0A\00"
@.str.4 = [3 x i8] c"\0A\0A\00"
@.str.5 = [28 x i8] c"Rating Number of Responses\0A\00"
@.str.6 = [28 x i8] c"------ -------------------\0A\00"
@.str.7 = [9 x i8] c"%4i%14i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [11 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [11 x i32]* %2 to i8*
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %10
10: ; preds = %36, %0
%11 = load i32, i32* %3
%12 = load i32, i32* %5
%13 = icmp sle i32 %11, %12
br i1 %13, label %14, label %39
14: ; preds = %10
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%16 = load i32, i32* %4
%17 = icmp sle i32 1, %16
br i1 %17, label %18, label %27
18: ; preds = %14
%19 = load i32, i32* %4
%20 = icmp sle i32 %19, 10
br i1 %20, label %21, label %27
21: ; preds = %18
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [11 x i32], [11 x i32]* %2, i64 0, i64 %23
%25 = load i32, i32* %24
%26 = add nsw i32 %25, 1
store i32 %26, i32* %24
br label %35
27: ; preds = %18, %14
%28 = load i32, i32* %4
%29 = icmp eq i32 999, %28
br i1 %29, label %30, label %31
30: ; preds = %27
br label %39
31: ; preds = %27
%32 = load i32, i32* %4
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %31
br label %35
35: ; preds = %34, %21
br label %36
36: ; preds = %35
%37 = load i32, i32* %3
%38 = add nsw i32 %37, 1
store i32 %38, i32* %3
br label %10
39: ; preds = %30, %10
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %3
br label %43
43: ; preds = %53, %39
%44 = load i32, i32* %3
%45 = icmp sle i32 %44, 10
br i1 %45, label %46, label %56
46: ; preds = %43
%47 = load i32, i32* %3
%48 = load i32, i32* %3
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [11 x i32], [11 x i32]* %2, i64 0, i64 %49
%51 = load i32, i32* %50
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 %47, i32 %51)
br label %53
53: ; preds = %46
%54 = load i32, i32* %3
%55 = add nsw i32 %54, 1
store i32 %55, i32* %3
br label %43
56: ; preds = %43
ret i32 0
}

LLVM IR (-O2):
@.str = [30 x i8] c"How many responses to enter? \00"
@.str.1 = [3 x i8] c"%i\00"
@.str.3 = [18 x i8] c"Bad response: %i\0A\00"
@.str.7 = [9 x i8] c"%4i%14i\0A\00"
@str = [34 x i8] c"Enter your responses, 999 to exit\00"
@str.8 = [2 x i8] c"\0A\00"
@str.9 = [27 x i8] c"Rating Number of Responses\00"
@str.10 = [27 x i8] c"------ -------------------\00"
define i32 @main() {
%1 = alloca [11 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = bitcast [11 x i32]* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 1
br i1 %11, label %50, label %12
12: ; preds = %0, %27
%13 = phi i32 [ %28, %27 ], [ 1, %0 ]
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%15 = load i32, i32* %2
%16 = add i32 %15, -1
%17 = icmp ult i32 %16, 10
br i1 %17, label %18, label %23
18: ; preds = %12
%19 = zext i32 %15 to i64
%20 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = add nsw i32 %21, 1
store i32 %22, i32* %20
br label %27
23: ; preds = %12
%24 = icmp eq i32 %15, 999
br i1 %24, label %31, label %25
25: ; preds = %23
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %15)
br label %27
27: ; preds = %18, %25
%28 = add nuw nsw i32 %13, 1
%29 = load i32, i32* %3
%30 = icmp slt i32 %13, %29
br i1 %30, label %12, label %31
31: ; preds = %23, %27
%32 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 1
%33 = load i32, i32* %32
%34 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 2
%35 = load i32, i32* %34
%36 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 3
%37 = load i32, i32* %36
%38 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 4
%39 = load i32, i32* %38
%40 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 5
%41 = load i32, i32* %40
%42 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 6
%43 = load i32, i32* %42
%44 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 7
%45 = load i32, i32* %44
%46 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 8
%47 = load i32, i32* %46
%48 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 9
%49 = load i32, i32* %48
br label %50
50: ; preds = %31, %0
%51 = phi i32 [ %49, %31 ], [ 0, %0 ]
%52 = phi i32 [ %47, %31 ], [ 0, %0 ]
%53 = phi i32 [ %45, %31 ], [ 0, %0 ]
%54 = phi i32 [ %43, %31 ], [ 0, %0 ]
%55 = phi i32 [ %41, %31 ], [ 0, %0 ]
%56 = phi i32 [ %39, %31 ], [ 0, %0 ]
%57 = phi i32 [ %37, %31 ], [ 0, %0 ]
%58 = phi i32 [ %35, %31 ], [ 0, %0 ]
%59 = phi i32 [ %33, %31 ], [ 0, %0 ]
%60 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.8, i64 0, i64 0))
%61 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.9, i64 0, i64 0))
%62 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.10, i64 0, i64 0))
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 1, i32 %59)
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 2, i32 %58)
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 3, i32 %57)
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 4, i32 %56)
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 5, i32 %55)
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 6, i32 %54)
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 7, i32 %53)
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 8, i32 %52)
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 9, i32 %51)
%72 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 10
%73 = load i32, i32* %72
%74 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 10, i32 %73)
ret i32 0
}