#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 i, n, j;
  int a[10] = {
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  };
  printf("Vavedi chislo: ");
  scanf("\n%d", &n);
  for (i = 0; i < 10; i++) {
    while (n != 0) {
      j = n % 10;
      a[j]++;
      n = n / 10;
    }
  }
  for (i = 0; i < 10; i++) {
    if (a[i] >= 2) {
      printf("\nPovtarq se! \n>> %d\n", 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    0xeac(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    11d0 <main+0xa0>
jmp    1183 <main+0x53>
cmpl   $0x0,-0xc(%rbp)
je     11bd <main+0x8d>
mov    -0xc(%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
mov    %ecx,-0x40(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
jmp    1183 <main+0x53>
jmp    11c2 <main+0x92>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1174 <main+0x44>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1214 <main+0xe4>
movslq -0x8(%rbp),%rax
cmpl   $0x2,-0x40(%rbp,%rax,4)
jl     1201 <main+0xd1>
mov    -0x8(%rbp),%esi
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1206 <main+0xd6>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11d7 <main+0xa7>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x30(%rsp)
lea    0xebe(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xebe(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
jmp    117a <main+0x5a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebx
mov    %ecx,%eax
cmp    $0xa,%ebx
je     11c9 <main+0xa9>
mov    $0x0,%ecx
test   %eax,%eax
je     1170 <main+0x50>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
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    $0x12,%ecx
ja     1190 <main+0x70>
mov    %eax,0xc(%rsp)
mov    %eax,%ecx
jmp    1170 <main+0x50>
cmpl   $0x2,0x10(%rsp)
jge    124a <main+0x12a>
cmpl   $0x2,0x14(%rsp)
jge    1265 <main+0x145>
cmpl   $0x2,0x18(%rsp)
jge    1283 <main+0x163>
cmpl   $0x2,0x1c(%rsp)
jge    12a1 <main+0x181>
cmpl   $0x2,0x20(%rsp)
jge    12bf <main+0x19f>
cmpl   $0x2,0x24(%rsp)
jge    12dd <main+0x1bd>
cmpl   $0x2,0x28(%rsp)
jge    12fb <main+0x1db>
cmpl   $0x2,0x2c(%rsp)
jge    1319 <main+0x1f9>
cmpl   $0x2,0x30(%rsp)
jge    1337 <main+0x217>
cmpl   $0x2,0x34(%rsp)
jl     1242 <main+0x122>
lea    0xdde(%rip),%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret
lea    0xdc3(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x14(%rsp)
jl     11db <main+0xbb>
lea    0xda8(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x18(%rsp)
jl     11e6 <main+0xc6>
lea    0xd8a(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x1c(%rsp)
jl     11f1 <main+0xd1>
lea    0xd6c(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x20(%rsp)
jl     11fc <main+0xdc>
lea    0xd4e(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x24(%rsp)
jl     1207 <main+0xe7>
lea    0xd30(%rip),%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x28(%rsp)
jl     1212 <main+0xf2>
lea    0xd12(%rip),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x2c(%rsp)
jl     121d <main+0xfd>
lea    0xcf4(%rip),%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x30(%rsp)
jl     1228 <main+0x108>
lea    0xcd6(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x34(%rsp)
jge    122f <main+0x10f>
jmp    1242 <main+0x122>

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

LLVM IR (-O2):
@.str = [16 x i8] c"Vavedi chislo: \00"
@.str.1 = [4 x i8] c"\0A%d\00"
@.str.2 = [21 x i8] c"\0APovtarq se! \0A>> %d\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 ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
br label %8
8: ; preds = %0, %23
%9 = phi i32 [ 0, %0 ], [ %25, %23 ]
%10 = phi i32 [ %7, %0 ], [ %24, %23 ]
%11 = icmp eq i32 %10, 0
br i1 %11, label %23, label %12
12: ; preds = %8, %12
%13 = phi i32 [ %19, %12 ], [ %10, %8 ]
%14 = srem i32 %13, 10
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %15
%17 = load i32, i32* %16
%18 = add nsw i32 %17, 1
store i32 %18, i32* %16
%19 = sdiv i32 %13, 10
%20 = add i32 %13, 9
%21 = icmp ult i32 %20, 19
br i1 %21, label %22, label %12
22: ; preds = %12
store i32 %19, i32* %1
br label %23
23: ; preds = %22, %8
%24 = phi i32 [ %19, %22 ], [ 0, %8 ]
%25 = add nuw nsw i32 %9, 1
%26 = icmp eq i32 %25, 10
br i1 %26, label %27, label %8
27: ; preds = %23
%28 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%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 ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 0)
br label %33
33: ; preds = %27, %31
%34 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 1
%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 ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 1)
br label %39
39: ; preds = %37, %33
%40 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 2
%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 ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 2)
br label %45
45: ; preds = %43, %39
%46 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 3
%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 ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 3)
br label %51
51: ; preds = %49, %45
%52 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 4
%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 ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 4)
br label %57
57: ; preds = %55, %51
%58 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 5
%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 ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 5)
br label %63
63: ; preds = %61, %57
%64 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 6
%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 ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 6)
br label %69
69: ; preds = %67, %63
%70 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 7
%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 ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 7)
br label %75
75: ; preds = %73, %69
%76 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 8
%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 ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 8)
br label %81
81: ; preds = %79, %75
%82 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 9
%83 = load i32, i32* %82
%84 = icmp sgt i32 %83, 1
br i1 %84, label %85, label %87
85: ; preds = %81
%86 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 9)
br label %87
87: ; preds = %85, %81
ret i32 0
}