#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int d = 0;
  int number;
  int t;
  int temp;
  printf("Enter number:\n");
  scanf("%d", &number);
  while (d <= 9) {
    t = 0;
    temp = number;
    while (temp > 0) {
      if (temp % 10 == d)
        t++;
      temp /= 10;
    }
    if (t > 1)
      printf("The number %d is met %d times\n", d, t);
    d++;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec4(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x9,-0x8(%rbp)
jg     11d1 <main+0xb1>
movl   $0x0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    11a5 <main+0x85>
mov    -0x14(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    -0x8(%rbp),%edx
jne    1192 <main+0x72>
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    116b <main+0x4b>
cmpl   $0x1,-0x10(%rbp)
jle    11c3 <main+0xa3>
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1154 <main+0x34>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xee3(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb5(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    $0xcccccccd,%ebx
lea    0xea2(%rip),%r14
xor    %ebp,%ebp
jmp    1178 <main+0x48>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebp
cmp    $0xa,%ebp
je     11c8 <main+0x98>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    1170 <main+0x40>
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %eax,%ecx
imul   %rbx,%rcx
shr    $0x23,%rcx
lea    (%rcx,%rcx,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %eax,%edi
sub    %esi,%edi
xor    %esi,%esi
cmp    %ebp,%edi
sete   %sil
add    %esi,%edx
cmp    $0x9,%eax
mov    %ecx,%eax
ja     1190 <main+0x60>
cmp    $0x2,%edx
jb     1170 <main+0x40>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1170 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Enter number:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [31 x i8] c"The number %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* %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
br label %8
8: ; preds = %34, %0
%9 = load i32, i32* %2
%10 = icmp sle i32 %9, 9
br i1 %10, label %11, label %37
11: ; preds = %8
store i32 0, i32* %4
%12 = load i32, i32* %3
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* %5
%18 = srem i32 %17, 10
%19 = load i32, i32* %2
%20 = icmp eq i32 %18, %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* %2
%32 = load i32, i32* %4
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %31, i32 %32)
br label %34
34: ; preds = %30, %27
%35 = load i32, i32* %2
%36 = add nsw i32 %35, 1
store i32 %36, i32* %2
br label %8
37: ; preds = %8
%38 = load i32, i32* %1
ret i32 %38
}

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