#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 num[10] = {0};
  int cifra, n;
  printf("Vuvedi chislo :");
  scanf("%d", &n);
  printf("Povtarqshti se chisla : ");
  while (n > 0) {
    cifra = n % 10;
    if (num[cifra] == 1) {
      printf("%d ", cifra);
      num[cifra] = 2;
    } else if (num[cifra] == 2)
      break;
    else
      num[cifra] = 1;
    n /= 10;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%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    -0x38(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x38(%rbp)
jle    11fc <main+0xcc>
mov    -0x38(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x34(%rbp)
movslq -0x34(%rbp),%rax
cmpl   $0x1,-0x30(%rbp,%rax,4)
jne    11c4 <main+0x94>
mov    -0x34(%rbp),%esi
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x34(%rbp),%rax
movl   $0x2,-0x30(%rbp,%rax,4)
jmp    11e9 <main+0xb9>
movslq -0x34(%rbp),%rax
cmpl   $0x2,-0x30(%rbp,%rax,4)
jne    11d8 <main+0xa8>
jmp    11fc <main+0xcc>
movslq -0x34(%rbp),%rax
movl   $0x1,-0x30(%rbp,%rax,4)
jmp    11e9 <main+0xb9>
mov    -0x38(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x38(%rbp)
jmp    117b <main+0x4b>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x30(%rsp)
lea    0xeba(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
lea    0xeae(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    11ef <main+0xcf>
mov    $0xcccccccd,%r15d
lea    0xeab(%rip),%r14
jmp    11c9 <main+0xa9>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x2,%ecx
mov    0xc(%rsp),%eax
mov    %ecx,0x10(%rsp,%rbx,4)
movslq %eax,%rcx
imul   $0x66666667,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rax
add    %edx,%eax
mov    %eax,0xc(%rsp)
cmp    $0x9,%ecx
jle    11ef <main+0xcf>
mov    %eax,%ecx
imul   %r15,%rcx
shr    $0x23,%rcx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
mov    %eax,%ebx
sub    %ecx,%ebx
mov    0x10(%rsp,%rbx,4),%edx
cmp    $0x1,%edx
je     1190 <main+0x70>
mov    $0x1,%ecx
cmp    $0x2,%edx
jne    11a5 <main+0x85>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [16 x i8] c"Vuvedi chislo :\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [25 x i8] c"Povtarqshti se chisla : \00"
@.str.3 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = alloca i32
%3 = bitcast [10 x i32]* %1 to i8*
%4 = bitcast 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 ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%8 = load i32, i32* %2
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %24
10: ; preds = %0, %19
%11 = phi i32 [ %22, %19 ], [ %8, %0 ]
%12 = urem i32 %11, 10
%13 = zext i32 %12 to i64
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %13
%15 = load i32, i32* %14
switch i32 %15, label %19 [
i32 1, label %16
i32 2, label %24
]
16: ; preds = %10
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %12)
%18 = load i32, i32* %2
br label %19
19: ; preds = %10, %16
%20 = phi i32 [ %18, %16 ], [ %11, %10 ]
%21 = phi i32 [ 2, %16 ], [ 1, %10 ]
store i32 %21, i32* %14
%22 = sdiv i32 %20, 10
store i32 %22, i32* %2
%23 = icmp sgt i32 %20, 9
br i1 %23, label %10, label %24
24: ; preds = %19, %10, %0
ret i32 0
}