#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 getNum(long, int);
int getSize(long);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, long *);
int main() {
  long int num;
  scanf("%ld", &num);
  num = ((num < 0) ? (-num) : (num));
  int i = 0;
  while (i < getSize(num)) {
    int tmp = getNum(num, getSize(num) - (i++) - 1);
    printf("%d : ", tmp);
    int j = 0;
    int cnt = 0;
    while (j < getSize(num)) {
      if (getNum(num, getSize(num) - j - 1) == tmp) {
        cnt++;
      }
      j++;
    }
    printf("%d\n", cnt);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
cmpq   $0x0,-0x10(%rbp)
jge    1179 <main+0x39>
xor    %eax,%eax
sub    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    1181 <main+0x41>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <getSize@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
cmp    %ecx,%eax
jge    126a <main+0x12a>
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <getSize@plt>
mov    -0x38(%rbp),%rdi
mov    %eax,%esi
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
sub    %eax,%esi
sub    $0x1,%esi
call   1050 <getNum@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe1f(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <getSize@plt>
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
cmp    %ecx,%eax
jge    1256 <main+0x116>
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <getSize@plt>
mov    -0x48(%rbp),%rdi
mov    %eax,%esi
sub    -0x1c(%rbp),%esi
sub    $0x1,%esi
call   1050 <getNum@plt>
cmp    -0x18(%rbp),%eax
jne    1248 <main+0x108>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11f8 <main+0xb8>
mov    -0x20(%rbp),%esi
lea    0xdaa(%rip),%rdi
call   1030 <printf@plt>
jmp    1190 <main+0x50>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeae(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%rax
mov    %rax,%rdi
neg    %rdi
cmovs  %rax,%rdi
mov    %rdi,(%rsp)
call   1060 <getSize@plt>
test   %eax,%eax
jle    122d <main+0xed>
xor    %r13d,%r13d
jmp    11a0 <main+0x60>
xchg   %ax,%ax
lea    0xe83(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    (%rsp),%rdi
call   1060 <getSize@plt>
cmp    %eax,%r13d
jge    122d <main+0xed>
mov    %r13d,%ebx
mov    (%rsp),%rbp
mov    %rbp,%rdi
call   1060 <getSize@plt>
lea    0x1(%rbx),%r13d
not    %ebx
add    %eax,%ebx
mov    %rbp,%rdi
mov    %ebx,%esi
call   1050 <getNum@plt>
mov    %eax,%r12d
lea    0xe39(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    (%rsp),%rdi
call   1060 <getSize@plt>
mov    $0x0,%ebx
test   %eax,%eax
jle    1180 <main+0x40>
xor    %ebx,%ebx
mov    $0xffffffff,%r14d
xor    %r15d,%r15d
nop
mov    (%rsp),%rbp
mov    %rbp,%rdi
call   1060 <getSize@plt>
lea    (%rax,%r14,1),%esi
mov    %rbp,%rdi
call   1050 <getNum@plt>
xor    %ecx,%ecx
cmp    %r12d,%eax
sete   %cl
add    %ecx,%ebx
add    $0x1,%r15d
mov    (%rsp),%rdi
call   1060 <getSize@plt>
add    $0xffffffff,%r14d
cmp    %eax,%r15d
jl     11f0 <main+0xb0>
jmp    1180 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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