#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 = 0;
  scanf("%d", &num);
  while (i++ != 10) {
    int count = 0;
    int tmp = num;
    while (tmp > 0) {
      if (i == tmp % 10) {
        count++;
      }
      tmp /= 10;
    }
    if (count > 1)
      printf("%d is met %d times\n", i, count);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0xa,%eax
je     11ca <main+0xaa>
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    11a9 <main+0x89>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x18(%rbp),%eax
cmp    %edx,%eax
jne    1196 <main+0x76>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
jmp    1167 <main+0x47>
cmpl   $0x1,-0x10(%rbp)
jle    11c5 <main+0xa5>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe43(%rip),%rdi
call   1030 <printf@plt>
jmp    1146 <main+0x26>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed0(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%ebx
mov    $0xcccccccd,%r15d
lea    0xeb7(%rip),%r14
jmp    115a <main+0x3a>
xchg   %ax,%ax
lea    0x1(%rbx),%eax
cmp    $0xa,%ebx
mov    %eax,%ebx
je     11a6 <main+0x86>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    1150 <main+0x30>
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %eax,%ecx
imul   %r15,%rcx
shr    $0x23,%rcx
lea    (%rcx,%rcx,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %eax,%edi
sub    %esi,%edi
xor    %esi,%esi
cmp    %edi,%ebx
sete   %sil
add    %esi,%edx
cmp    $0x9,%eax
mov    %ecx,%eax
ja     1170 <main+0x50>
cmp    $0x2,%edx
jb     1150 <main+0x30>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
jmp    1150 <main+0x30>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [20 x i8] c"%d is met %d times\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
br label %4
4: ; preds = %0, %21
%5 = phi i32 [ 1, %0 ], [ %22, %21 ]
%6 = load i32, i32* %1
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %21
8: ; preds = %4, %8
%9 = phi i32 [ %15, %8 ], [ %6, %4 ]
%10 = phi i32 [ %14, %8 ], [ 0, %4 ]
%11 = urem i32 %9, 10
%12 = icmp eq i32 %5, %11
%13 = zext i1 %12 to i32
%14 = add nuw nsw i32 %10, %13
%15 = udiv i32 %9, 10
%16 = icmp ult i32 %9, 10
br i1 %16, label %17, label %8
17: ; preds = %8
%18 = icmp ugt i32 %14, 1
br i1 %18, label %19, label %21
19: ; preds = %17
%20 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %5, i32 %14)
br label %21
21: ; preds = %4, %19, %17
%22 = add nuw nsw i32 %5, 1
%23 = icmp eq i32 %5, 10
br i1 %23, label %24, label %4
24: ; preds = %21
ret i32 0
}