#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 *);
void main() {
  int i, a[10];
  long long int n;
  for (i = 0; i < 10; i++)
    a[i] = 0;
  printf("\nVavedi chislo:");
  scanf("%lli", &n);
  while (n != 0) {
    a[n % 10]++;
    n /= 10;
  }
  printf("\nTsifrite, koito se povtariat sa: ");
  for (i = 0; i < 10; i++)
    if (a[i] > 1)
      printf("%d, ", i);
  printf("\b\b.");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    1153 <main+0x33>
movslq -0x4(%rbp),%rax
movl   $0x0,-0x30(%rbp,%rax,4)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112f <main+0xf>
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea8(%rip),%rdi
lea    -0x38(%rbp),%rsi
call   1040 <scanf@plt>
cmpq   $0x0,-0x38(%rbp)
je     11ac <main+0x8c>
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    1171 <main+0x51>
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    11fe <main+0xde>
movslq -0x4(%rbp),%rax
cmpl   $0x1,-0x30(%rbp,%rax,4)
jle    11eb <main+0xcb>
mov    -0x4(%rbp),%esi
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f0 <main+0xd0>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11c1 <main+0xa1>
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
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)
lea    0xebe(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x8(%rsp),%rdx
test   %rdx,%rdx
je     125a <main+0x13a>
movabs $0x6666666666666667,%rsi
66 66 66
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rdx,%rcx
mov    %rdx,%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    $0x12,%rcx
ja     1180 <main+0x60>
mov    %rdx,0x8(%rsp)
mov    0x10(%rsp),%ebx
lea    0xe51(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    $0x2,%ebx
jge    1275 <main+0x155>
cmpl   $0x2,0x14(%rsp)
jge    1290 <main+0x170>
cmpl   $0x2,0x18(%rsp)
jge    12ae <main+0x18e>
cmpl   $0x2,0x1c(%rsp)
jge    12cc <main+0x1ac>
cmpl   $0x2,0x20(%rsp)
jge    12ea <main+0x1ca>
cmpl   $0x2,0x24(%rsp)
jge    1308 <main+0x1e8>
cmpl   $0x2,0x28(%rsp)
jge    1326 <main+0x206>
cmpl   $0x2,0x2c(%rsp)
jge    1344 <main+0x224>
cmpl   $0x2,0x30(%rsp)
jge    1362 <main+0x242>
cmpl   $0x2,0x34(%rsp)
jl     1246 <main+0x126>
lea    0xdfe(%rip),%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xdf0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbx
ret
lea    0xdb4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x14(%rsp)
jl     11df <main+0xbf>
jmp    1290 <main+0x170>
lea    0xdbc(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x14(%rsp)
jl     11df <main+0xbf>
lea    0xda1(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x18(%rsp)
jl     11ea <main+0xca>
lea    0xd83(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x1c(%rsp)
jl     11f5 <main+0xd5>
lea    0xd65(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x20(%rsp)
jl     1200 <main+0xe0>
lea    0xd47(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x24(%rsp)
jl     120b <main+0xeb>
lea    0xd29(%rip),%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x28(%rsp)
jl     1216 <main+0xf6>
lea    0xd0b(%rip),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x2c(%rsp)
jl     1221 <main+0x101>
lea    0xced(%rip),%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x30(%rsp)
jl     122c <main+0x10c>
lea    0xccf(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x34(%rsp)
jge    1233 <main+0x113>
jmp    1246 <main+0x126>

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

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