#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() {
  const int number = 9;
  int x;
  int count[number];
  int i;
  for (i = 0; i <= number; i++) {
    count[i] = 0;
  }
  printf("请输入：");
  scanf("%d", &x);
  while (x != -1) {
    if (x >= 0 && x <= 9) {
      count[x]++;
    }
    scanf("%d", &x);
  }
  for (i = 0; i <= number; i++) {
    printf("%d:%d\n", i, count[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x9,-0x8(%rbp)
mov    %rsp,%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x9,-0x1c(%rbp)
jg     1168 <main+0x48>
movslq -0x1c(%rbp),%rax
movl   $0x0,-0x40(%rbp,%rax,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1144 <main+0x24>
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe90(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0xffffffff,-0xc(%rbp)
je     11c8 <main+0xa8>
cmpl   $0x0,-0xc(%rbp)
jl     11b3 <main+0x93>
cmpl   $0x9,-0xc(%rbp)
jg     11b3 <main+0x93>
movslq -0xc(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x40(%rbp,%rax,4)
lea    0xe53(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
jmp    1186 <main+0x66>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x9,-0x1c(%rbp)
jg     1200 <main+0xe0>
mov    -0x1c(%rbp),%esi
movslq -0x1c(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%edx
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11cf <main+0xaf>
movl   $0x0,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%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    $0x48,%rsp
mov    %rsp,0x40(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x30(%rsp)
lea    0xeb0(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xead(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%eax
mov    $0x0,%ecx
mov    $0x0,%edi
mov    $0x0,%r13d
mov    $0x0,%ebx
mov    $0x0,%r14d
mov    $0x0,%r15d
mov    $0x0,%r12d
mov    $0x0,%edx
cmp    $0xffffffff,%eax
je     11f9 <main+0xd9>
lea    0xe6a(%rip),%rbx
mov    %rsp,%rbp
jmp    11c3 <main+0xa3>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%eax
cmp    $0xffffffff,%eax
je     11d1 <main+0xb1>
cmp    $0x9,%eax
ja     11b0 <main+0x90>
mov    %eax,%eax
addl   $0x1,0x10(%rsp,%rax,4)
jmp    11b0 <main+0x90>
mov    0x10(%rsp),%edx
mov    0x14(%rsp),%r12d
mov    0x18(%rsp),%r15d
mov    0x1c(%rsp),%r14d
mov    0x20(%rsp),%ebx
mov    0x24(%rsp),%r13d
mov    0x28(%rsp),%edi
mov    0x2c(%rsp),%ecx
mov    0x30(%rsp),%ebp
mov    %edi,0x4(%rsp)
mov    %ecx,0x8(%rsp)
mov    %ebp,0xc(%rsp)
lea    0xe04(%rip),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x1,%esi
mov    %r12d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x2,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x3,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x4,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x5,%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x6,%esi
mov    0x4(%rsp),%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x7,%esi
mov    0x8(%rsp),%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x8,%esi
mov    0xc(%rsp),%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x34(%rsp),%edx
mov    %rbp,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x40(%rsp),%rsp
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\EF\BC\9A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [7 x i8] c"%d:%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i32 0, i32* %1
store i32 9, i32* %2
%6 = call i8* @llvm.stacksave()
store i8* %6, i8** %4
%7 = alloca i32, i64 9
store i32 0, i32* %5
br label %8
8: ; preds = %15, %0
%9 = load i32, i32* %5
%10 = icmp sle i32 %9, 9
br i1 %10, label %11, label %18
11: ; preds = %8
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %7, i64 %13
store i32 0, i32* %14
br label %15
15: ; preds = %11
%16 = load i32, i32* %5
%17 = add nsw i32 %16, 1
store i32 %17, i32* %5
br label %8
18: ; preds = %8
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
br label %21
21: ; preds = %36, %18
%22 = load i32, i32* %3
%23 = icmp ne i32 %22, -1
br i1 %23, label %24, label %38
24: ; preds = %21
%25 = load i32, i32* %3
%26 = icmp sge i32 %25, 0
br i1 %26, label %27, label %36
27: ; preds = %24
%28 = load i32, i32* %3
%29 = icmp sle i32 %28, 9
br i1 %29, label %30, label %36
30: ; preds = %27
%31 = load i32, i32* %3
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %7, i64 %32
%34 = load i32, i32* %33
%35 = add nsw i32 %34, 1
store i32 %35, i32* %33
br label %36
36: ; preds = %30, %27, %24
%37 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
br label %21
38: ; preds = %21
store i32 0, i32* %5
br label %39
39: ; preds = %49, %38
%40 = load i32, i32* %5
%41 = icmp sle i32 %40, 9
br i1 %41, label %42, label %52
42: ; preds = %39
%43 = load i32, i32* %5
%44 = load i32, i32* %5
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i32, i32* %7, i64 %45
%47 = load i32, i32* %46
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %43, i32 %47)
br label %49
49: ; preds = %42
%50 = load i32, i32* %5
%51 = add nsw i32 %50, 1
store i32 %51, i32* %5
br label %39
52: ; preds = %39
store i32 0, i32* %1
%53 = load i8*, i8** %4
%54 = load i32, i32* %1
ret i32 %54
}

LLVM IR (-O2):
@.str = [13 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\EF\BC\9A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [7 x i8] c"%d:%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i8* @llvm.stacksave()
%4 = alloca [9 x i32]
%5 = bitcast [9 x i32]* %4 to i8*
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = icmp eq i32 %8, -1
br i1 %9, label %29, label %51
10: ; preds = %59
%11 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i64 0, i64 0
%12 = load i32, i32* %11
%13 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i64 0, i64 1
%14 = load i32, i32* %13
%15 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i64 0, i64 2
%16 = load i32, i32* %15
%17 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i64 0, i64 3
%18 = load i32, i32* %17
%19 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i64 0, i64 4
%20 = load i32, i32* %19
%21 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i64 0, i64 5
%22 = load i32, i32* %21
%23 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i64 0, i64 6
%24 = load i32, i32* %23
%25 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i64 0, i64 7
%26 = load i32, i32* %25
%27 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i64 0, i64 8
%28 = load i32, i32* %27
br label %29
29: ; preds = %10, %0
%30 = phi i32 [ %28, %10 ], [ 0, %0 ]
%31 = phi i32 [ %26, %10 ], [ 0, %0 ]
%32 = phi i32 [ %24, %10 ], [ 0, %0 ]
%33 = phi i32 [ %22, %10 ], [ 0, %0 ]
%34 = phi i32 [ %20, %10 ], [ 0, %0 ]
%35 = phi i32 [ %18, %10 ], [ 0, %0 ]
%36 = phi i32 [ %16, %10 ], [ 0, %0 ]
%37 = phi i32 [ %14, %10 ], [ 0, %0 ]
%38 = phi i32 [ %12, %10 ], [ 0, %0 ]
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 %38)
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 %37)
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 2, i32 %36)
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 3, i32 %35)
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 4, i32 %34)
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 5, i32 %33)
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 6, i32 %32)
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 7, i32 %31)
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 8, i32 %30)
%48 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i64 0, i64 9
%49 = load i32, i32* %48
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 9, i32 %49)
ret i32 0
51: ; preds = %0, %59
%52 = phi i32 [ %61, %59 ], [ %8, %0 ]
%53 = icmp ult i32 %52, 10
br i1 %53, label %54, label %59
54: ; preds = %51
%55 = zext i32 %52 to i64
%56 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i64 0, i64 %55
%57 = load i32, i32* %56
%58 = add nsw i32 %57, 1
store i32 %58, i32* %56
br label %59
59: ; preds = %54, %51
%60 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%61 = load i32, i32* %1
%62 = icmp eq i32 %61, -1
br i1 %62, label %10, label %51
}