#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 num, i, numbers[10] = {0}, k = 0;
  scanf("%d", &num);
  while (num > 0) {
    k = num % 10;
    numbers[k]++;
    num = num / 10;
  }
  for (i = 0; i < 10; i++) {
    if (num = 0) {
      numbers[0]++;
    }
    if (numbers[i] != 0) {
      printf("Number %d - %d times\n", i, numbers[i]);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
movl   $0x0,-0x44(%rbp)
lea    0xea3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jle    11a0 <main+0x70>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x44(%rbp)
movslq -0x44(%rbp),%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    1166 <main+0x36>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1209 <main+0xd9>
movl   $0x0,-0x8(%rbp)
xor    %eax,%eax
test   $0x1,%al
jne    11c7 <main+0x97>
jmp    11d0 <main+0xa0>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
movslq -0xc(%rbp),%rax
cmpl   $0x0,-0x40(%rbp,%rax,4)
je     11f6 <main+0xc6>
mov    -0xc(%rbp),%esi
movslq -0xc(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%edx
lea    0xe12(%rip),%rdi
call   1030 <printf@plt>
jmp    11fb <main+0xcb>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11a7 <main+0x77>
xor    %eax,%eax
add    $0x50,%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
jle    119e <main+0x7e>
mov    $0xcccccccd,%ecx
nopl   0x0(%rax,%rax,1)
mov    %eax,%edx
imul   %rcx,%rdx
shr    $0x23,%rdx
lea    (%rdx,%rdx,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %eax,%edi
sub    %esi,%edi
addl   $0x1,0x10(%rsp,%rdi,4)
cmp    $0xa,%eax
mov    %edx,%eax
jae    1160 <main+0x40>
mov    0x10(%rsp),%edx
movl   $0x0,0xc(%rsp)
test   %edx,%edx
je     119e <main+0x7e>
lea    0xe6c(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
movl   $0x0,0xc(%rsp)
mov    0x14(%rsp),%edx
test   %edx,%edx
je     11bf <main+0x9f>
lea    0xe4e(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
movl   $0x0,0xc(%rsp)
mov    0x18(%rsp),%edx
test   %edx,%edx
je     11e0 <main+0xc0>
lea    0xe2d(%rip),%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
movl   $0x0,0xc(%rsp)
mov    0x1c(%rsp),%edx
test   %edx,%edx
je     1201 <main+0xe1>
lea    0xe0c(%rip),%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
movl   $0x0,0xc(%rsp)
mov    0x20(%rsp),%edx
test   %edx,%edx
je     1222 <main+0x102>
lea    0xdeb(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
movl   $0x0,0xc(%rsp)
mov    0x24(%rsp),%edx
test   %edx,%edx
je     1243 <main+0x123>
lea    0xdca(%rip),%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
movl   $0x0,0xc(%rsp)
mov    0x28(%rsp),%edx
test   %edx,%edx
je     1264 <main+0x144>
lea    0xda9(%rip),%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
movl   $0x0,0xc(%rsp)
mov    0x2c(%rsp),%edx
test   %edx,%edx
je     1285 <main+0x165>
lea    0xd88(%rip),%rdi
mov    $0x7,%esi
call   1030 <printf@plt>
movl   $0x0,0xc(%rsp)
mov    0x30(%rsp),%edx
test   %edx,%edx
je     12a6 <main+0x186>
lea    0xd67(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
movl   $0x0,0xc(%rsp)
mov    0x34(%rsp),%edx
test   %edx,%edx
je     12c7 <main+0x1a7>
lea    0xd46(%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 = [22 x i8] c"Number %d - %d times\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [10 x i32]
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [10 x i32]* %4 to i8*
store i32 0, i32* %5
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %8
8: ; preds = %11, %0
%9 = load i32, i32* %2
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %21
11: ; preds = %8
%12 = load i32, i32* %2
%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]* %4, i64 0, i64 %15
%17 = load i32, i32* %16
%18 = add nsw i32 %17, 1
store i32 %18, i32* %16
%19 = load i32, i32* %2
%20 = sdiv i32 %19, 10
store i32 %20, i32* %2
br label %8
21: ; preds = %8
store i32 0, i32* %3
br label %22
22: ; preds = %44, %21
%23 = load i32, i32* %3
%24 = icmp slt i32 %23, 10
br i1 %24, label %25, label %47
25: ; preds = %22
store i32 0, i32* %2
br i1 false, label %26, label %30
26: ; preds = %25
%27 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 0
%28 = load i32, i32* %27
%29 = add nsw i32 %28, 1
store i32 %29, i32* %27
br label %30
30: ; preds = %26, %25
%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 %43
36: ; preds = %30
%37 = load i32, i32* %3
%38 = load i32, i32* %3
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %39
%41 = load i32, i32* %40
%42 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %37, i32 %41)
br label %43
43: ; preds = %36, %30
br label %44
44: ; preds = %43
%45 = load i32, i32* %3
%46 = add nsw i32 %45, 1
store i32 %46, i32* %3
br label %22
47: ; preds = %22
ret i32 0
}

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