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


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    -0x34(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x34(%rbp)
je     1199 <main+0x69>
mov    -0x34(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x38(%rbp)
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x34(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x34(%rbp)
jmp    115f <main+0x2f>
movl   $0x0,-0x3c(%rbp)
cmpl   $0xa,-0x3c(%rbp)
jge    11e3 <main+0xb3>
movslq -0x3c(%rbp),%rax
cmpl   $0x0,-0x30(%rbp,%rax,4)
je     11d0 <main+0xa0>
mov    -0x3c(%rbp),%esi
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
lea    0xe38(%rip),%rdi
call   1030 <printf@plt>
jmp    11d5 <main+0xa5>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11a0 <main+0x70>
mov    -0x4(%rbp),%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 = [21 x i8] c"%d repeat %d times \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* %3)
br label %8
8: ; preds = %11, %0
%9 = load i32, i32* %3
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %21
11: ; preds = %8
%12 = load i32, i32* %3
%13 = srem i32 %12, 10
store i32 %13, i32* %4
%14 = load i32, i32* %4
%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
store i32 %18, i32* %16
%19 = load i32, i32* %3
%20 = sdiv i32 %19, 10
store i32 %20, i32* %3
br label %8
21: ; preds = %8
store i32 0, i32* %5
br label %22
22: ; preds = %39, %21
%23 = load i32, i32* %5
%24 = icmp slt i32 %23, 10
br i1 %24, label %25, label %42
25: ; preds = %22
%26 = load i32, i32* %5
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %27
%29 = load i32, i32* %28
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %38
31: ; preds = %25
%32 = load i32, i32* %5
%33 = load i32, i32* %5
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %32, i32 %36)
br label %38
38: ; preds = %31, %25
br label %39
39: ; preds = %38
%40 = load i32, i32* %5
%41 = add nsw i32 %40, 1
store i32 %41, i32* %5
br label %22
42: ; preds = %22
%43 = load i32, i32* %1
ret i32 %43
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [21 x i8] c"%d repeat %d times \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 ([21 x i8], [21 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 ([21 x i8], [21 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 ([21 x i8], [21 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 ([21 x i8], [21 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 ([21 x i8], [21 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 ([21 x i8], [21 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 ([21 x i8], [21 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 ([21 x i8], [21 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 ([21 x i8], [21 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 ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 9, i32 %74)
br label %78
78: ; preds = %76, %72
ret i32 0
}