#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int number[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  int i, n, k;
  scanf("%d", &n);
  while (n != 0) {
    k = n % 10;
    number[k] = number[k] + 1;
    n = n / 10;
  }
  for (i = 0; i < 10; i++) {
    if (number[i] != 0) {
      printf("%d - %d\n", i, number[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    $0x28,%edx
call   1040 <memset@plt>
lea    0xeaa(%rip),%rdi
lea    -0x38(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x38(%rbp)
je     119d <main+0x6d>
mov    -0x38(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x3c(%rbp)
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%ecx
add    $0x1,%ecx
movslq -0x3c(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x38(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x38(%rbp)
jmp    115f <main+0x2f>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    11e7 <main+0xb7>
movslq -0x34(%rbp),%rax
cmpl   $0x0,-0x30(%rbp,%rax,4)
je     11d4 <main+0xa4>
mov    -0x34(%rbp),%esi
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
lea    0xe34(%rip),%rdi
call   1030 <printf@plt>
jmp    11d9 <main+0xa9>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11a4 <main+0x74>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x30(%rsp)
lea    0xebf(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
je     11ab <main+0x8b>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movslq %eax,%rcx
imul   $0x66666667,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rax
add    %edx,%eax
lea    (%rax,%rax,1),%edx
lea    (%rdx,%rdx,4),%edx
mov    %ecx,%esi
sub    %edx,%esi
movslq %esi,%rdx
addl   $0x1,0x10(%rsp,%rdx,4)
add    $0x9,%ecx
cmp    $0x13,%ecx
jae    1160 <main+0x40>
mov    %eax,0xc(%rsp)
mov    0x10(%rsp),%edx
test   %edx,%edx
je     11ab <main+0x8b>
lea    0xe5f(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    0x14(%rsp),%edx
test   %edx,%edx
je     11c4 <main+0xa4>
lea    0xe49(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    0x18(%rsp),%edx
test   %edx,%edx
je     11dd <main+0xbd>
lea    0xe30(%rip),%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    0x1c(%rsp),%edx
test   %edx,%edx
je     11f6 <main+0xd6>
lea    0xe17(%rip),%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    0x20(%rsp),%edx
test   %edx,%edx
je     120f <main+0xef>
lea    0xdfe(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
mov    0x24(%rsp),%edx
test   %edx,%edx
je     1228 <main+0x108>
lea    0xde5(%rip),%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
mov    0x28(%rsp),%edx
test   %edx,%edx
je     1241 <main+0x121>
lea    0xdcc(%rip),%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
mov    0x2c(%rsp),%edx
test   %edx,%edx
je     125a <main+0x13a>
lea    0xdb3(%rip),%rdi
mov    $0x7,%esi
call   1030 <printf@plt>
mov    0x30(%rsp),%edx
test   %edx,%edx
je     1273 <main+0x153>
lea    0xd9a(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
mov    0x34(%rsp),%edx
test   %edx,%edx
je     128c <main+0x16c>
lea    0xd81(%rip),%rdi
mov    $0x9,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [9 x i8] c"%d - %d\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, 0
br i1 %7, label %24, label %12
8: ; preds = %12
store i32 %19, i32* %2
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, 0
br i1 %11, label %24, label %22
12: ; preds = %0, %12
%13 = phi i32 [ %19, %12 ], [ %6, %0 ]
%14 = srem i32 %13, 10
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %15
%17 = load i32, i32* %16
%18 = add nsw i32 %17, 1
store i32 %18, i32* %16
%19 = sdiv i32 %13, 10
%20 = add i32 %13, 9
%21 = icmp ult i32 %20, 19
br i1 %21, label %8, label %12
22: ; preds = %8
%23 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 %10)
br label %24
24: ; preds = %0, %8, %22
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%26 = load i32, i32* %25
%27 = icmp eq i32 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %24
%29 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 %26)
br label %30
30: ; preds = %28, %24
%31 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%32 = load i32, i32* %31
%33 = icmp eq i32 %32, 0
br i1 %33, label %36, label %34
34: ; preds = %30
%35 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 %32)
br label %36
36: ; preds = %34, %30
%37 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%38 = load i32, i32* %37
%39 = icmp eq i32 %38, 0
br i1 %39, label %42, label %40
40: ; preds = %36
%41 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 %38)
br label %42
42: ; preds = %40, %36
%43 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%44 = load i32, i32* %43
%45 = icmp eq i32 %44, 0
br i1 %45, label %48, label %46
46: ; preds = %42
%47 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 4, i32 %44)
br label %48
48: ; preds = %46, %42
%49 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%50 = load i32, i32* %49
%51 = icmp eq i32 %50, 0
br i1 %51, label %54, label %52
52: ; preds = %48
%53 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 5, i32 %50)
br label %54
54: ; preds = %52, %48
%55 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%56 = load i32, i32* %55
%57 = icmp eq i32 %56, 0
br i1 %57, label %60, label %58
58: ; preds = %54
%59 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 6, i32 %56)
br label %60
60: ; preds = %58, %54
%61 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%62 = load i32, i32* %61
%63 = icmp eq i32 %62, 0
br i1 %63, label %66, label %64
64: ; preds = %60
%65 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 7, i32 %62)
br label %66
66: ; preds = %64, %60
%67 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%68 = load i32, i32* %67
%69 = icmp eq i32 %68, 0
br i1 %69, label %72, label %70
70: ; preds = %66
%71 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 8, i32 %68)
br label %72
72: ; preds = %70, %66
%73 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%74 = load i32, i32* %73
%75 = icmp eq i32 %74, 0
br i1 %75, label %78, label %76
76: ; preds = %72
%77 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 9, i32 %74)
br label %78
78: ; preds = %76, %72
ret i32 0
}