#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_s(char *, int *);
int main() {
  int n, i, pom;
  int cifri[10] = {0};
  printf("vuvedi chislo");
  scanf_s("%d", &n);
  while (n > 0) {
    pom = n % 10;
    cifri[pom] = cifri[pom] + 1;
    n = n / 10;
  }
  for (i = 0; i < 10; i++)
    if (cifri[i] != 0)
      printf("cifrata %d se sreshta %d puti\n", i, cifri[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeaa(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf_s@plt>
cmpl   $0x0,-0x8(%rbp)
jle    11ab <main+0x7b>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
movslq -0x10(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%ecx
add    $0x1,%ecx
movslq -0x10(%rbp),%rax
mov    %ecx,-0x40(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    116d <main+0x3d>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    11f7 <main+0xc7>
movslq -0xc(%rbp),%rax
cmpl   $0x0,-0x40(%rbp,%rax,4)
je     11e4 <main+0xb4>
mov    -0xc(%rbp),%esi
movslq -0xc(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%edx
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e9 <main+0xb9>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11b2 <main+0x82>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x30(%rsp)
lea    0xebf(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf_s@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    11ac <main+0x8c>
mov    $0xcccccccd,%ecx
cs nopw 0x0(%rax,%rax,1)
mov    %eax,%edx
mov    %eax,%eax
imul   %rcx,%rax
shr    $0x23,%rax
lea    (%rax,%rax,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %edx,%edi
sub    %esi,%edi
addl   $0x1,0x10(%rsp,%rdi,4)
cmp    $0xa,%edx
jae    1170 <main+0x50>
mov    %eax,0xc(%rsp)
mov    0x10(%rsp),%edx
test   %edx,%edx
je     11ac <main+0x8c>
lea    0xe6e(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x14(%rsp),%edx
test   %edx,%edx
je     11c7 <main+0xa7>
lea    0xe56(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x18(%rsp),%edx
test   %edx,%edx
je     11e2 <main+0xc2>
lea    0xe3b(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x1c(%rsp),%edx
test   %edx,%edx
je     11fd <main+0xdd>
lea    0xe20(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x20(%rsp),%edx
test   %edx,%edx
je     1218 <main+0xf8>
lea    0xe05(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x24(%rsp),%edx
test   %edx,%edx
je     1233 <main+0x113>
lea    0xdea(%rip),%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x28(%rsp),%edx
test   %edx,%edx
je     124e <main+0x12e>
lea    0xdcf(%rip),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2c(%rsp),%edx
test   %edx,%edx
je     1269 <main+0x149>
lea    0xdb4(%rip),%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x30(%rsp),%edx
test   %edx,%edx
je     1284 <main+0x164>
lea    0xd99(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x34(%rsp),%edx
test   %edx,%edx
je     129f <main+0x17f>
lea    0xd7e(%rip),%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"vuvedi chislo\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [31 x i8] c"cifrata %d se sreshta %d puti\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = bitcast i32* %1 to i8*
%4 = bitcast [10 x i32]* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = icmp sgt i32 %7, 0
br i1 %8, label %13, label %24
9: ; preds = %13
store i32 %20, i32* %1
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, 0
br i1 %12, label %24, label %22
13: ; preds = %0, %13
%14 = phi i32 [ %20, %13 ], [ %7, %0 ]
%15 = urem i32 %14, 10
%16 = zext i32 %15 to i64
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %16
%18 = load i32, i32* %17
%19 = add nsw i32 %18, 1
store i32 %19, i32* %17
%20 = udiv i32 %14, 10
%21 = icmp ult i32 %14, 10
br i1 %21, label %9, label %13
22: ; preds = %9
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 %11)
br label %24
24: ; preds = %0, %9, %22
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 1
%26 = load i32, i32* %25
%27 = icmp eq i32 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %24
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 %26)
br label %30
30: ; preds = %28, %24
%31 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 2
%32 = load i32, i32* %31
%33 = icmp eq i32 %32, 0
br i1 %33, label %36, label %34
34: ; preds = %30
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 2, i32 %32)
br label %36
36: ; preds = %34, %30
%37 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 3
%38 = load i32, i32* %37
%39 = icmp eq i32 %38, 0
br i1 %39, label %42, label %40
40: ; preds = %36
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 3, i32 %38)
br label %42
42: ; preds = %40, %36
%43 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 4
%44 = load i32, i32* %43
%45 = icmp eq i32 %44, 0
br i1 %45, label %48, label %46
46: ; preds = %42
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 4, i32 %44)
br label %48
48: ; preds = %46, %42
%49 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 5
%50 = load i32, i32* %49
%51 = icmp eq i32 %50, 0
br i1 %51, label %54, label %52
52: ; preds = %48
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 5, i32 %50)
br label %54
54: ; preds = %52, %48
%55 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 6
%56 = load i32, i32* %55
%57 = icmp eq i32 %56, 0
br i1 %57, label %60, label %58
58: ; preds = %54
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 6, i32 %56)
br label %60
60: ; preds = %58, %54
%61 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 7
%62 = load i32, i32* %61
%63 = icmp eq i32 %62, 0
br i1 %63, label %66, label %64
64: ; preds = %60
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 7, i32 %62)
br label %66
66: ; preds = %64, %60
%67 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 8
%68 = load i32, i32* %67
%69 = icmp eq i32 %68, 0
br i1 %69, label %72, label %70
70: ; preds = %66
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 8, i32 %68)
br label %72
72: ; preds = %70, %66
%73 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 9
%74 = load i32, i32* %73
%75 = icmp eq i32 %74, 0
br i1 %75, label %78, label %76
76: ; preds = %72
%77 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 9, i32 %74)
br label %78
78: ; preds = %76, %72
ret i32 0
}