#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 number, digit;
  int a_digit[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  printf(":\n");
  scanf("%d", &number);
  printf(":\n");
  while (number) {
    digit = number % 10;
    if (a_digit[digit])
      printf("%d ", digit);
    a_digit[digit] = 1;
    number /= 10;
  }
  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    0xe9f(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
je     11d2 <main+0xa2>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
movslq -0xc(%rbp),%rax
cmpl   $0x0,-0x40(%rbp,%rax,4)
je     11b3 <main+0x83>
mov    -0xc(%rbp),%esi
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0xc(%rbp),%rax
movl   $0x1,-0x40(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    117b <main+0x4b>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x30(%rsp)
lea    0xeb3(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe9d(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
je     11f3 <main+0xc3>
lea    0xe7f(%rip),%r14
jmp    11bb <main+0x8b>
cs nopw 0x0(%rax,%rax,1)
movl   $0x1,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)
add    $0x9,%ecx
cmp    $0x12,%ecx
jbe    11f3 <main+0xc3>
movslq %eax,%rsi
imul   $0x66666667,%rsi,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%esi
movslq %esi,%rbx
cmpl   $0x0,0x10(%rsp,%rbx,4)
je     1190 <main+0x60>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%eax
jmp    1190 <main+0x60>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c":\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [10 x i32]
store i32 0, i32* %1
%5 = bitcast [10 x i32]* %4 to i8*
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 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* %2)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %23, %0
%10 = load i32, i32* %2
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %29
12: ; preds = %9
%13 = load i32, i32* %2
%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]* %4, i64 0, i64 %16
%18 = load i32, i32* %17
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %12
%21 = load i32, i32* %3
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %20, %12
%24 = load i32, i32* %3
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %25
store i32 1, i32* %26
%27 = load i32, i32* %2
%28 = sdiv i32 %27, 10
store i32 %28, i32* %2
br label %9
29: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d \00"
@str.3 = [2 x i8] c":\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 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.3, 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 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.3, i64 0, i64 0))
%8 = load i32, i32* %1
%9 = icmp eq i32 %8, 0
br i1 %9, label %25, label %10
10: ; preds = %0, %20
%11 = phi i32 [ %22, %20 ], [ %8, %0 ]
%12 = srem i32 %11, 10
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = icmp eq i32 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %10
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%19 = load i32, i32* %1
br label %20
20: ; preds = %17, %10
%21 = phi i32 [ %19, %17 ], [ %11, %10 ]
store i32 1, i32* %14
%22 = sdiv i32 %21, 10
store i32 %22, i32* %1
%23 = add i32 %21, 9
%24 = icmp ult i32 %23, 19
br i1 %24, label %25, label %10
25: ; preds = %20, %0
ret i32 0
}