#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, i, digits[10] = {0};
  scanf("%d", &number);
  if (number == 0)
    digits[0]++;
  while (number > 0) {
    digits[number % 10]++;
    number /= 10;
  }
  for (i = 0; i < 10; i++) {
    if (digits[i] != 0) {
      digits[i] > 1 ? printf("Digit %d --> %d times\n", i, digits[i])
                    : printf("Digit %d --> %d time\n", i, 1);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
lea    0xeaa(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    1172 <main+0x42>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1177 <main+0x47>
cmpl   $0x0,-0x8(%rbp)
jle    11ad <main+0x7d>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
movslq %edx,%rax
mov    -0x40(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x40(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    1177 <main+0x47>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    121f <main+0xef>
movslq -0xc(%rbp),%rax
cmpl   $0x0,-0x40(%rbp,%rax,4)
je     120c <main+0xdc>
movslq -0xc(%rbp),%rax
cmpl   $0x1,-0x40(%rbp,%rax,4)
jle    11f8 <main+0xc8>
mov    -0xc(%rbp),%esi
movslq -0xc(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%edx
lea    0xe15(%rip),%rdi
call   1030 <printf@plt>
jmp    120c <main+0xdc>
mov    -0xc(%rbp),%esi
lea    0xe18(%rip),%rdi
mov    $0x1,%edx
call   1030 <printf@plt>
jmp    1211 <main+0xe1>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11b4 <main+0x84>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x30(%rsp)
lea    0xeba(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
je     1186 <main+0x66>
jle    118e <main+0x6e>
mov    $0xcccccccd,%ecx
nop
mov    %eax,%edx
mov    %eax,%eax
imul   %rcx,%rax
shr    $0x23,%rax
lea    (%rax,%rax,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %edx,%edi
sub    %esi,%edi
addl   $0x1,0x10(%rsp,%rdi,4)
cmp    $0xa,%edx
jae    1160 <main+0x40>
mov    %eax,0xc(%rsp)
jmp    118e <main+0x6e>
movl   $0x1,0x10(%rsp)
xor    %ebx,%ebx
lea    0xe6c(%rip),%r14
lea    0xe7c(%rip),%r15
jmp    11b9 <main+0x99>
mov    %r15,%rdi
mov    %ebx,%esi
mov    $0x1,%edx
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0xa,%rbx
je     11cd <main+0xad>
mov    0x10(%rsp,%rbx,4),%edx
test   %edx,%edx
je     11af <main+0x8f>
cmp    $0x2,%edx
jl     11a0 <main+0x80>
mov    %r14,%rdi
mov    %ebx,%esi
jmp    11aa <main+0x8a>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [23 x i8] c"Digit %d --> %d times\0A\00"
@.str.2 = [22 x i8] c"Digit %d --> %d time\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = bitcast i32* %1 to i8*
%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* %1)
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
store i32 1, i32* %9
br label %12
10: ; preds = %0
%11 = icmp sgt i32 %6, 0
br i1 %11, label %14, label %12
12: ; preds = %8, %13, %10
br label %23
13: ; preds = %14
store i32 %21, i32* %1
br label %12
14: ; preds = %10, %14
%15 = phi i32 [ %21, %14 ], [ %6, %10 ]
%16 = urem i32 %15, 10
%17 = zext i32 %16 to i64
%18 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %17
%19 = load i32, i32* %18
%20 = add nsw i32 %19, 1
store i32 %20, i32* %18
%21 = udiv i32 %15, 10
%22 = icmp ult i32 %15, 10
br i1 %22, label %13, label %14
23: ; preds = %12, %35
%24 = phi i64 [ %36, %35 ], [ 0, %12 ]
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = icmp eq i32 %26, 0
br i1 %27, label %35, label %28
28: ; preds = %23
%29 = icmp sgt i32 %26, 1
%30 = trunc i64 %24 to i32
br i1 %29, label %31, label %33
31: ; preds = %28
%32 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %30, i32 %26)
br label %35
33: ; preds = %28
%34 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %30, i32 1)
br label %35
35: ; preds = %23, %33, %31
%36 = add nuw nsw i64 %24, 1
%37 = icmp eq i64 %36, 10
br i1 %37, label %38, label %23
38: ; preds = %35
ret i32 0
}