#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 chislo, i = 0, broi, j;
  printf("\n Vyvedi chislo");
  scanf("%d", &chislo);
  while (i < 10) {
    broi = 0;
    j = chislo;
    while (j != 0) {
      if (chislo % 10 == i)
        broi++;
      j = j / 10;
    }
    if (broi != 0)
      printf("\n Chisloto %d se sreshta %d puti", i, broi);
    i++;
  }
  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
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0xa,-0xc(%rbp)
jge    11d1 <main+0xb1>
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11a5 <main+0x85>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    -0xc(%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   $0x0,-0x10(%rbp)
je     11c3 <main+0xa3>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1154 <main+0x34>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xed6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
lea    0xeca(%rip),%rbx
xor    %ebp,%ebp
jmp    1158 <main+0x38>
nopl   (%rax)
add    $0x1,%ebp
cmp    $0xa,%ebp
je     11c3 <main+0xa3>
mov    0x4(%rsp),%eax
test   %eax,%eax
je     1150 <main+0x30>
movslq %eax,%rcx
imul   $0x66666667,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
mov    %eax,%edx
sub    %ecx,%edx
xor    %ecx,%ecx
cmp    %ebp,%edx
sete   %cl
xor    %edx,%edx
nopl   0x0(%rax)
add    %ecx,%edx
movslq %eax,%rsi
imul   $0x66666667,%rsi,%rax
mov    %rax,%rdi
shr    $0x3f,%rdi
sar    $0x22,%rax
add    %edi,%eax
add    $0x9,%esi
cmp    $0x12,%esi
ja     1190 <main+0x70>
test   %edx,%edx
je     1150 <main+0x30>
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1150 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"\0A Vyvedi chislo\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [33 x i8] c"\0A Chisloto %d se sreshta %d puti\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 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 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* %2)
br label %8
8: ; preds = %34, %0
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 10
br i1 %10, label %11, label %37
11: ; preds = %8
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 ne i32 %14, 0
br i1 %15, label %16, label %27
16: ; preds = %13
%17 = load i32, i32* %2
%18 = srem i32 %17, 10
%19 = load i32, i32* %3
%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 ne i32 %28, 0
br i1 %29, label %30, label %34
30: ; preds = %27
%31 = load i32, i32* %3
%32 = load i32, i32* %4
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %31, i32 %32)
br label %34
34: ; preds = %30, %27
%35 = load i32, i32* %3
%36 = add nsw i32 %35, 1
store i32 %36, i32* %3
br label %8
37: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"\0A Vyvedi chislo\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [33 x i8] c"\0A Chisloto %d se sreshta %d puti\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 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, %24
%6 = phi i32 [ 0, %0 ], [ %25, %24 ]
%7 = load i32, i32* %1
%8 = icmp eq i32 %7, 0
br i1 %8, label %24, label %9
9: ; preds = %5
%10 = srem i32 %7, 10
%11 = icmp eq i32 %10, %6
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %9, %13
%14 = phi i32 [ %7, %9 ], [ %17, %13 ]
%15 = phi i32 [ 0, %9 ], [ %16, %13 ]
%16 = add nuw nsw i32 %15, %12
%17 = sdiv i32 %14, 10
%18 = add i32 %14, 9
%19 = icmp ult i32 %18, 19
br i1 %19, label %20, label %13
20: ; preds = %13
%21 = icmp eq i32 %16, 0
br i1 %21, label %24, label %22
22: ; preds = %20
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %6, i32 %16)
br label %24
24: ; preds = %5, %22, %20
%25 = add nuw nsw i32 %6, 1
%26 = icmp eq i32 %25, 10
br i1 %26, label %27, label %5
27: ; preds = %24
ret i32 0
}