#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, chislo, broi[10];
  for (i = 0; i < 10; i++) {
    broi[i] = 0;
  }
  printf("Vuvedete chislo: ");
  scanf("%d", &chislo);
  while (chislo != 0) {
    broi[chislo % 10]++;
    chislo /= 10;
  }
  printf("Povtoreni:\n ");
  for (i = 0; i < 10; i++) {
    if (broi[i] > 1) {
      printf("cifrata %d se povtarq\n", i);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    115a <main+0x3a>
movslq -0x8(%rbp),%rax
movl   $0x0,-0x40(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea3(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
je     11ae <main+0x8e>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
movslq %edx,%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    1178 <main+0x58>
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1200 <main+0xe0>
movslq -0x8(%rbp),%rax
cmpl   $0x1,-0x40(%rbp,%rax,4)
jle    11ed <main+0xcd>
mov    -0x8(%rbp),%esi
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f2 <main+0xd2>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11c3 <main+0xa3>
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    %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     123a <main+0x11a>
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    $0x12,%ecx
ja     1170 <main+0x50>
mov    %eax,0xc(%rsp)
mov    0x10(%rsp),%ebx
lea    0xe65(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    $0x2,%ebx
jge    1255 <main+0x135>
cmpl   $0x2,0x14(%rsp)
jge    1270 <main+0x150>
cmpl   $0x2,0x18(%rsp)
jge    128e <main+0x16e>
cmpl   $0x2,0x1c(%rsp)
jge    12ac <main+0x18c>
cmpl   $0x2,0x20(%rsp)
jge    12ca <main+0x1aa>
cmpl   $0x2,0x24(%rsp)
jge    12e8 <main+0x1c8>
cmpl   $0x2,0x28(%rsp)
jge    1306 <main+0x1e6>
cmpl   $0x2,0x2c(%rsp)
jge    1324 <main+0x204>
cmpl   $0x2,0x30(%rsp)
jge    1342 <main+0x222>
cmpl   $0x2,0x34(%rsp)
jl     1232 <main+0x112>
lea    0xdfc(%rip),%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret
lea    0xdd4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x14(%rsp)
jl     11cb <main+0xab>
jmp    1270 <main+0x150>
lea    0xdc6(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x14(%rsp)
jl     11cb <main+0xab>
lea    0xdab(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x18(%rsp)
jl     11d6 <main+0xb6>
lea    0xd8d(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x1c(%rsp)
jl     11e1 <main+0xc1>
lea    0xd6f(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x20(%rsp)
jl     11ec <main+0xcc>
lea    0xd51(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x24(%rsp)
jl     11f7 <main+0xd7>
lea    0xd33(%rip),%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x28(%rsp)
jl     1202 <main+0xe2>
lea    0xd15(%rip),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x2c(%rsp)
jl     120d <main+0xed>
lea    0xcf7(%rip),%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x30(%rsp)
jl     1218 <main+0xf8>
lea    0xcd9(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x34(%rsp)
jge    121f <main+0xff>
jmp    1232 <main+0x112>

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

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