#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, chislo[10] = {0}, a[20];
  printf("Vyvedete chislo:");
  scanf("%d", &n);
  while (n != 0) {
    chislo[n % 10] = chislo[n % 10] + 1;
    n = n / 10;
  }
  for (i = 0; i <= 9; i++) {
    if (chislo[i] > 1) {
      printf("%d \n", i);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeaa(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
je     11b4 <main+0x84>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
movslq %edx,%rax
mov    -0x40(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    -0xc(%rbp),%eax
mov    $0xa,%esi
cltd
idiv   %esi
movslq %edx,%rax
mov    %ecx,-0x40(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
jmp    1170 <main+0x40>
movl   $0x0,-0x8(%rbp)
cmpl   $0x9,-0x8(%rbp)
jg     11f8 <main+0xc8>
movslq -0x8(%rbp),%rax
cmpl   $0x1,-0x40(%rbp,%rax,4)
jle    11e5 <main+0xb5>
mov    -0x8(%rbp),%esi
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ea <main+0xba>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11bb <main+0x8b>
mov    -0x4(%rbp),%eax
add    $0x90,%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    0xec2(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
je     11bc <main+0x9c>
cs nopw 0x0(%rax,%rax,1)
nopl   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    1170 <main+0x50>
mov    %eax,0xc(%rsp)
cmpl   $0x1,0x10(%rsp)
jle    11bc <main+0x9c>
lea    0xe61(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x14(%rsp)
jge    122d <main+0x10d>
cmpl   $0x2,0x18(%rsp)
jge    1247 <main+0x127>
cmpl   $0x2,0x1c(%rsp)
jge    1265 <main+0x145>
cmpl   $0x2,0x20(%rsp)
jge    1283 <main+0x163>
cmpl   $0x2,0x24(%rsp)
jge    12a1 <main+0x181>
cmpl   $0x2,0x28(%rsp)
jge    12bf <main+0x19f>
cmpl   $0x2,0x2c(%rsp)
jge    12dd <main+0x1bd>
cmpl   $0x2,0x30(%rsp)
jge    12fb <main+0x1db>
cmpl   $0x2,0x34(%rsp)
jl     1226 <main+0x106>
lea    0xdfa(%rip),%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret
lea    0xde0(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x18(%rsp)
jl     11ca <main+0xaa>
lea    0xdc6(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x1c(%rsp)
jl     11d5 <main+0xb5>
lea    0xda8(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x20(%rsp)
jl     11e0 <main+0xc0>
lea    0xd8a(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x24(%rsp)
jl     11eb <main+0xcb>
lea    0xd6c(%rip),%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x28(%rsp)
jl     11f6 <main+0xd6>
lea    0xd4e(%rip),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x2c(%rsp)
jl     1201 <main+0xe1>
lea    0xd30(%rip),%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x30(%rsp)
jl     120c <main+0xec>
lea    0xd12(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x34(%rsp)
jge    1213 <main+0xf3>
jmp    1226 <main+0x106>

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

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