#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 a, n[10], b = 0, i = 0;
  while (b != 10) {
    n[b] = 0;
    b++;
  }
  b = 0;
  printf("Vavedi chislo:");
  scanf("%d", &a);
  while (a != 0) {
    b = a % 10;
    n[b]++;
    a = a / 10;
  }
  b = 0;
  while (b != 10) {
    printf("\nBroy %d - %d", b, n[b]);
    b++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
cmpl   $0xa,-0x34(%rbp)
je     1161 <main+0x41>
movslq -0x34(%rbp),%rax
movl   $0x0,-0x30(%rbp,%rax,4)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    113d <main+0x1d>
movl   $0x0,-0x34(%rbp)
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9d(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
je     11c0 <main+0xa0>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x34(%rbp)
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    1186 <main+0x66>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
je     11f8 <main+0xd8>
mov    -0x34(%rbp),%esi
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11c7 <main+0xa7>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x30(%rsp)
lea    0xeb5(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%eax
mov    $0x0,%ecx
mov    $0x0,%edi
mov    $0x0,%r13d
mov    $0x0,%ebx
mov    $0x0,%r14d
mov    $0x0,%r15d
mov    $0x0,%r12d
mov    $0x0,%edx
test   %eax,%eax
je     11fc <main+0xdc>
cs nopw 0x0(%rax,%rax,1)
movslq %eax,%rcx
imul   $0x66666667,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rax
add    %edx,%eax
lea    (%rax,%rax,1),%edx
lea    (%rdx,%rdx,4),%edx
mov    %ecx,%esi
sub    %edx,%esi
movslq %esi,%rdx
addl   $0x1,0x10(%rsp,%rdx,4)
add    $0x9,%ecx
cmp    $0x13,%ecx
jae    11a0 <main+0x80>
mov    %eax,(%rsp)
mov    0x10(%rsp),%edx
mov    0x14(%rsp),%r12d
mov    0x18(%rsp),%r15d
mov    0x1c(%rsp),%r14d
mov    0x20(%rsp),%ebx
mov    0x24(%rsp),%r13d
mov    0x28(%rsp),%edi
mov    0x2c(%rsp),%ecx
mov    0x30(%rsp),%ebp
mov    %edi,0x4(%rsp)
mov    %ecx,0x8(%rsp)
mov    %ebp,0xc(%rsp)
lea    0xe00(%rip),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x1,%esi
mov    %r12d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x2,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x3,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x4,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x5,%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x6,%esi
mov    0x4(%rsp),%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x7,%esi
mov    0x8(%rsp),%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x8,%esi
mov    0xc(%rsp),%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x34(%rsp),%edx
mov    %rbp,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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