#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 *, long long *);
int main() {
  int a[10];
  long long int x;
  for (x = 0; x < 10; x++)
    a[x] = 0;
  printf("\nVavedi chislo:");
  scanf("%lli", &x);
  while (x != 0) {
    a[x % 10]++;
    x /= 10;
  }
  for (x = 0; x < 10; x++)
    printf("\nTsifrata %lli se povtaria %d pat(i).", x, a[x]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x38(%rbp)
cmpq   $0xa,-0x38(%rbp)
jge    115f <main+0x3f>
mov    -0x38(%rbp),%rax
movl   $0x0,-0x30(%rbp,%rax,4)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1137 <main+0x17>
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9c(%rip),%rdi
lea    -0x38(%rbp),%rsi
call   1040 <scanf@plt>
cmpq   $0x0,-0x38(%rbp)
je     11b8 <main+0x98>
mov    -0x38(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    -0x30(%rbp,%rdx,4),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp,%rdx,4)
mov    -0x38(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x38(%rbp)
jmp    117d <main+0x5d>
movq   $0x0,-0x38(%rbp)
cmpq   $0xa,-0x38(%rbp)
jge    11f6 <main+0xd6>
mov    -0x38(%rbp),%rsi
mov    -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    11c0 <main+0xa0>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movq   $0x0,0x30(%rsp)
movq   $0xa,0x8(%rsp)
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb7(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x8(%rsp),%rcx
test   %rcx,%rcx
je     11b4 <main+0x94>
movabs $0x6666666666666667,%rsi
66 66 66
nopw   0x0(%rax,%rax,1)
mov    %rcx,%rax
imul   %rsi
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x2,%rdx
add    %rax,%rdx
lea    (%rdx,%rdx,1),%rax
lea    (%rax,%rax,4),%rax
mov    %rcx,%rdi
sub    %rax,%rdi
addl   $0x1,0x10(%rsp,%rdi,4)
add    $0x9,%rcx
cmp    $0x13,%rcx
mov    %rdx,%rcx
jae    1180 <main+0x60>
movq   $0x0,0x8(%rsp)
lea    0xe51(%rip),%rbx
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
mov    0x10(%rsp,%rsi,4),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%rax
lea    0x1(%rax),%rsi
mov    %rsi,0x8(%rsp)
cmp    $0x9,%rax
jl     11d0 <main+0xb0>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [16 x i8] c"\0AVavedi chislo:\00"
@.str.1 = [5 x i8] c"%lli\00"
@.str.2 = [38 x i8] c"\0ATsifrata %lli se povtaria %d pat(i).\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = alloca i64
%4 = bitcast i64* %3 to i8*
store i64 10, i64* %3
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %3)
%7 = load i64, i64* %3
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %10, %0
store i64 0, i64* %3
br label %19
10: ; preds = %0, %10
%11 = phi i64 [ %16, %10 ], [ %7, %0 ]
%12 = srem i64 %11, 10
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %12
%14 = load i32, i32* %13
%15 = add nsw i32 %14, 1
store i32 %15, i32* %13
%16 = sdiv i64 %11, 10
%17 = add i64 %11, 9
%18 = icmp ult i64 %17, 19
br i1 %18, label %9, label %10
19: ; preds = %9, %19
%20 = phi i64 [ 0, %9 ], [ %25, %19 ]
%21 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %20
%22 = load i32, i32* %21
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i64 %20, i32 %22)
%24 = load i64, i64* %3
%25 = add nsw i64 %24, 1
store i64 %25, i64* %3
%26 = icmp slt i64 %24, 9
br i1 %26, label %19, label %27
27: ; preds = %19
ret i32 0
}