#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 a[10];
  int i, n, k;
  printf("4islo:");
  scanf("%d", &n);
  for (i = 0; i < 10; i++) {
    a[i] = 0;
  }
  for (i = 0; i <= 9; i++) {
    while (n != 0) {
      k = n % 10;
      a[k] = a[k] + 1;
      n = n / 10;
    }
  }
  for (i = 0; i < 10; i++) {
    if (a[i] >= 2) {
      printf("Ima povtorka %d\n", i);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec3(%rip),%rdi
lea    -0x38(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    1178 <main+0x58>
movslq -0x34(%rbp),%rax
movl   $0x0,-0x30(%rbp,%rax,4)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1154 <main+0x34>
movl   $0x0,-0x34(%rbp)
cmpl   $0x9,-0x34(%rbp)
jg     11df <main+0xbf>
jmp    118e <main+0x6e>
cmpl   $0x0,-0x38(%rbp)
je     11cc <main+0xac>
mov    -0x38(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x3c(%rbp)
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%ecx
add    $0x1,%ecx
movslq -0x3c(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x38(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x38(%rbp)
jmp    118e <main+0x6e>
jmp    11d1 <main+0xb1>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    117f <main+0x5f>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    1223 <main+0x103>
movslq -0x34(%rbp),%rax
cmpl   $0x2,-0x30(%rbp,%rax,4)
jl     1210 <main+0xf0>
mov    -0x34(%rbp),%esi
lea    0xe01(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1215 <main+0xf5>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11e6 <main+0xc6>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
lea    0xed4(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movq   $0x0,0x30(%rsp)
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    0xdd4(%rip),%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret
lea    0xdb9(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x14(%rsp)
jl     11db <main+0xbb>
lea    0xd9e(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x18(%rsp)
jl     11e6 <main+0xc6>
lea    0xd80(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x1c(%rsp)
jl     11f1 <main+0xd1>
lea    0xd62(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x20(%rsp)
jl     11fc <main+0xdc>
lea    0xd44(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x24(%rsp)
jl     1207 <main+0xe7>
lea    0xd26(%rip),%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x28(%rsp)
jl     1212 <main+0xf2>
lea    0xd08(%rip),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x2c(%rsp)
jl     121d <main+0xfd>
lea    0xcea(%rip),%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x30(%rsp)
jl     1228 <main+0x108>
lea    0xccc(%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 = [7 x i8] c"4islo:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [17 x i8] c"Ima povtorka %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
store i32 0, i32* %3
br label %8
8: ; preds = %15, %0
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 10
br i1 %10, label %11, label %18
11: ; preds = %8
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %13
store i32 0, i32* %14
br label %15
15: ; preds = %11
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %8
18: ; preds = %8
store i32 0, i32* %3
br label %19
19: ; preds = %40, %18
%20 = load i32, i32* %3
%21 = icmp sle i32 %20, 9
br i1 %21, label %22, label %43
22: ; preds = %19
br label %23
23: ; preds = %26, %22
%24 = load i32, i32* %4
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %39
26: ; preds = %23
%27 = load i32, i32* %4
%28 = srem i32 %27, 10
store i32 %28, i32* %5
%29 = load i32, i32* %5
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %30
%32 = load i32, i32* %31
%33 = add nsw i32 %32, 1
%34 = load i32, i32* %5
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %35
store i32 %33, i32* %36
%37 = load i32, i32* %4
%38 = sdiv i32 %37, 10
store i32 %38, i32* %4
br label %23
39: ; preds = %23
br label %40
40: ; preds = %39
%41 = load i32, i32* %3
%42 = add nsw i32 %41, 1
store i32 %42, i32* %3
br label %19
43: ; preds = %19
store i32 0, i32* %3
br label %44
44: ; preds = %57, %43
%45 = load i32, i32* %3
%46 = icmp slt i32 %45, 10
br i1 %46, label %47, label %60
47: ; preds = %44
%48 = load i32, i32* %3
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %49
%51 = load i32, i32* %50
%52 = icmp sge i32 %51, 2
br i1 %52, label %53, label %56
53: ; preds = %47
%54 = load i32, i32* %3
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %54)
br label %56
56: ; preds = %53, %47
br label %57
57: ; preds = %56
%58 = load i32, i32* %3
%59 = add nsw i32 %58, 1
store i32 %59, i32* %3
br label %44
60: ; preds = %44
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"4islo:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [17 x i8] c"Ima povtorka %d\0A\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 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* %3)
%7 = load i32, i32* %3
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]* %1, 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* %3
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]* %1, 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 ([17 x i8], [17 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]* %1, 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 ([17 x i8], [17 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]* %1, 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 ([17 x i8], [17 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]* %1, 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 ([17 x i8], [17 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]* %1, 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 ([17 x i8], [17 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]* %1, 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 ([17 x i8], [17 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]* %1, 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 ([17 x i8], [17 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]* %1, 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 ([17 x i8], [17 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]* %1, 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 ([17 x i8], [17 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]* %1, 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 ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 9)
br label %87
87: ; preds = %85, %81
ret i32 0
}