#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*/ getchar();
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a[10] = {0}, c;
  for (scanf("%d", &c); c != -1; scanf("%d", &c))
    if (c > 0 && c <= 10)
      a[c - 1]++;
  for (c = 0; c < 10; printf("%3d :%3d\n", c++ + 1, a[c]))
    ;
  getchar();
  getchar();
  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    $0x28,%edx
call   1040 <memset@plt>
lea    0xe9a(%rip),%rdi
lea    -0x34(%rbp),%rsi
call   1060 <scanf@plt>
cmpl   $0xffffffff,-0x34(%rbp)
je     11ba <main+0x7a>
cmpl   $0x0,-0x34(%rbp)
jle    11a0 <main+0x60>
cmpl   $0xa,-0x34(%rbp)
jg     11a0 <main+0x60>
mov    -0x34(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x30(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x30(%rbp,%rax,4)
jmp    11a5 <main+0x65>
lea    0xe54(%rip),%rdi
lea    -0x34(%rbp),%rsi
call   1060 <scanf@plt>
jmp    116f <main+0x2f>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    11f7 <main+0xb7>
jmp    11d0 <main+0x90>
mov    -0x34(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
add    $0x1,%esi
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
lea    0xe16(%rip),%rdi
call   1030 <printf@plt>
jmp    11c1 <main+0x81>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x30(%rsp)
lea    0xeac(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0xffffffff,%eax
je     11a5 <main+0x75>
lea    0xe92(%rip),%r14
lea    0xc(%rsp),%rbx
jmp    1194 <main+0x64>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0xffffffff,%eax
je     11a5 <main+0x75>
add    $0xffffffff,%eax
cmp    $0x9,%eax
ja     1180 <main+0x50>
mov    %eax,%eax
addl   $0x1,0x10(%rsp,%rax,4)
jmp    1180 <main+0x50>
xor    %eax,%eax
lea    0xe55(%rip),%rbx
xchg   %ax,%ax
lea    0x1(%rax),%esi
mov    %esi,0xc(%rsp)
cltq
mov    0x14(%rsp,%rax,4),%edx
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0xc(%rsp),%eax
cmp    $0xa,%eax
jl     11b0 <main+0x80>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

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

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