#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 *, long *);
int main(void) {
  int duplicates[10] = {0};
  int digit = 0;
  int empty = 0;
  long n = 0;
  printf("Enter a number: ");
  scanf("%ld", &n);
  while (n > 0) {
    digit = n % 10;
    duplicates[digit] += 1;
    n /= 10;
  }
  for (int i = 0; i < 10; i += 1) {
    empty += duplicates[i];
  }
  if (empty == 0) {
    printf("No repeated digits\n");
  } else {
    printf("Digit:\t\t");
    for (int i = 0; i < 10; i += 1) {
      printf("%d ", i);
    }
    printf("\nOccurances:\t");
    for (int i = 0; i < 10; i += 1) {
      printf("%d ", duplicates[i]);
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe97(%rip),%rdi
lea    -0x40(%rbp),%rsi
call   1050 <scanf@plt>
cmpq   $0x0,-0x40(%rbp)
jle    11c7 <main+0x97>
mov    -0x40(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %edx,%eax
mov    %eax,-0x34(%rbp)
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x40(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x40(%rbp)
jmp    1183 <main+0x53>
movl   $0x0,-0x44(%rbp)
cmpl   $0xa,-0x44(%rbp)
jge    11f4 <main+0xc4>
movslq -0x44(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
add    -0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11ce <main+0x9e>
cmpl   $0x0,-0x38(%rbp)
jne    1211 <main+0xe1>
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12a0 <main+0x170>
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x48(%rbp)
cmpl   $0xa,-0x48(%rbp)
jge    124f <main+0x11f>
mov    -0x48(%rbp),%esi
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1226 <main+0xf6>
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4c(%rbp)
cmpl   $0xa,-0x4c(%rbp)
jge    1292 <main+0x162>
movslq -0x4c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xdb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1264 <main+0x134>
lea    0xd8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movq   $0x0,0x40(%rsp)
movq   $0x0,0x8(%rsp)
lea    0xe8c(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe8d(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x8(%rsp),%rdx
mov    $0x0,%ecx
mov    $0x0,%esi
mov    $0x0,%edi
mov    $0x0,%r13d
mov    $0x0,%ebp
mov    $0x0,%r14d
mov    $0x0,%r15d
mov    $0x0,%eax
test   %rdx,%rdx
jle    1222 <main+0xe2>
movabs $0xcccccccccccccccd,%rsi
cc cc cc
nopl   (%rax)
mov    %rdx,%rcx
mov    %rdx,%rax
mul    %rsi
shr    $0x3,%rdx
lea    (%rdx,%rdx,1),%rax
lea    (%rax,%rax,4),%rax
mov    %rcx,%rdi
sub    %rax,%rdi
addl   $0x1,0x20(%rsp,%rdi,4)
cmp    $0xa,%rcx
jae    11d0 <main+0x90>
mov    %rdx,0x8(%rsp)
mov    0x20(%rsp),%eax
mov    0x24(%rsp),%r15d
mov    0x28(%rsp),%r14d
mov    0x2c(%rsp),%ebp
mov    0x30(%rsp),%r13d
mov    0x34(%rsp),%edi
mov    0x38(%rsp),%esi
mov    0x3c(%rsp),%ecx
mov    0x40(%rsp),%ebx
add    %r15d,%eax
add    %r14d,%eax
add    %ebp,%eax
add    %r13d,%eax
add    %edi,%eax
add    %esi,%eax
add    %ecx,%eax
add    %ebx,%eax
mov    0x44(%rsp),%edx
add    %edx,%eax
jne    124e <main+0x10e>
lea    0xdec(%rip),%rdi
call   1040 <puts@plt>
jmp    13a3 <main+0x263>
mov    %edi,0x10(%rsp)
lea    0xdbc(%rip),%rdi
xor    %eax,%eax
mov    %ecx,0x18(%rsp)
mov    %esi,0x14(%rsp)
mov    %edx,0x1c(%rsp)
call   1050 <printf@plt>
lea    0xdab(%rip),%r12
mov    %r12,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd15(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x20(%rsp),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    0x10(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    0x14(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    0x18(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    0x1c(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Enter a number: \00"
@.str.1 = [4 x i8] c"%ld\00"
@.str.2 = [20 x i8] c"No repeated digits\0A\00"
@.str.3 = [9 x i8] c"Digit:\09\09\00"
@.str.4 = [4 x i8] c"%d \00"
@.str.5 = [14 x i8] c"\0AOccurances:\09\00"
@.str.6 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = bitcast [10 x i32]* %2 to i8*
store i32 0, i32* %3
store i32 0, i32* %4
store i64 0, i64* %5
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %5)
br label %12
12: ; preds = %15, %0
%13 = load i64, i64* %5
%14 = icmp sgt i64 %13, 0
br i1 %14, label %15, label %26
15: ; preds = %12
%16 = load i64, i64* %5
%17 = srem i64 %16, 10
%18 = trunc i64 %17 to i32
store i32 %18, i32* %3
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %20
%22 = load i32, i32* %21
%23 = add nsw i32 %22, 1
store i32 %23, i32* %21
%24 = load i64, i64* %5
%25 = sdiv i64 %24, 10
store i64 %25, i64* %5
br label %12
26: ; preds = %12
store i32 0, i32* %6
br label %27
27: ; preds = %37, %26
%28 = load i32, i32* %6
%29 = icmp slt i32 %28, 10
br i1 %29, label %30, label %40
30: ; preds = %27
%31 = load i32, i32* %6
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %32
%34 = load i32, i32* %33
%35 = load i32, i32* %4
%36 = add nsw i32 %35, %34
store i32 %36, i32* %4
br label %37
37: ; preds = %30
%38 = load i32, i32* %6
%39 = add nsw i32 %38, 1
store i32 %39, i32* %6
br label %27
40: ; preds = %27
%41 = load i32, i32* %4
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
br label %72
45: ; preds = %40
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %7
br label %47
47: ; preds = %53, %45
%48 = load i32, i32* %7
%49 = icmp slt i32 %48, 10
br i1 %49, label %50, label %56
50: ; preds = %47
%51 = load i32, i32* %7
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %51)
br label %53
53: ; preds = %50
%54 = load i32, i32* %7
%55 = add nsw i32 %54, 1
store i32 %55, i32* %7
br label %47
56: ; preds = %47
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %8
br label %58
58: ; preds = %67, %56
%59 = load i32, i32* %8
%60 = icmp slt i32 %59, 10
br i1 %60, label %61, label %70
61: ; preds = %58
%62 = load i32, i32* %8
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %63
%65 = load i32, i32* %64
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %65)
br label %67
67: ; preds = %61
%68 = load i32, i32* %8
%69 = add nsw i32 %68, 1
store i32 %69, i32* %8
br label %58
70: ; preds = %58
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %72
72: ; preds = %70, %43
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Enter a number: \00"
@.str.1 = [4 x i8] c"%ld\00"
@.str.3 = [9 x i8] c"Digit:\09\09\00"
@.str.4 = [4 x i8] c"%d \00"
@.str.5 = [14 x i8] c"\0AOccurances:\09\00"
@str = [19 x i8] c"No repeated digits\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = alloca i64
%3 = bitcast [10 x i32]* %1 to i8*
%4 = bitcast i64* %2 to i8*
store i64 0, i64* %2
%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 ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %2)
%7 = load i64, i64* %2
%8 = icmp sgt i64 %7, 0
br i1 %8, label %50, label %28
9: ; preds = %50
store i64 %56, i64* %2
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%11 = load i32, i32* %10
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%13 = load i32, i32* %12
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%15 = load i32, i32* %14
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%17 = load i32, i32* %16
%18 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%19 = load i32, i32* %18
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%21 = load i32, i32* %20
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%23 = load i32, i32* %22
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%25 = load i32, i32* %24
%26 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%27 = load i32, i32* %26
br label %28
28: ; preds = %9, %0
%29 = phi i32 [ %27, %9 ], [ 0, %0 ]
%30 = phi i32 [ %25, %9 ], [ 0, %0 ]
%31 = phi i32 [ %23, %9 ], [ 0, %0 ]
%32 = phi i32 [ %21, %9 ], [ 0, %0 ]
%33 = phi i32 [ %19, %9 ], [ 0, %0 ]
%34 = phi i32 [ %17, %9 ], [ 0, %0 ]
%35 = phi i32 [ %15, %9 ], [ 0, %0 ]
%36 = phi i32 [ %13, %9 ], [ 0, %0 ]
%37 = phi i32 [ %11, %9 ], [ 0, %0 ]
%38 = add nsw i32 %36, %37
%39 = add nsw i32 %35, %38
%40 = add nsw i32 %34, %39
%41 = add nsw i32 %33, %40
%42 = add nsw i32 %32, %41
%43 = add nsw i32 %31, %42
%44 = add nsw i32 %30, %43
%45 = add nsw i32 %29, %44
%46 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%47 = load i32, i32* %46
%48 = sub i32 0, %45
%49 = icmp eq i32 %47, %48
br i1 %49, label %58, label %60
50: ; preds = %0, %50
%51 = phi i64 [ %56, %50 ], [ %7, %0 ]
%52 = urem i64 %51, 10
%53 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %52
%54 = load i32, i32* %53
%55 = add nsw i32 %54, 1
store i32 %55, i32* %53
%56 = udiv i64 %51, 10
%57 = icmp ult i64 %51, 10
br i1 %57, label %9, label %50
58: ; preds = %28
%59 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
br label %86
60: ; preds = %28
%61 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 0)
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 1)
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 2)
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 3)
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 4)
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 5)
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 6)
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 7)
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 8)
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 9)
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%74 = load i32, i32* %61
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %74)
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %36)
%77 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %35)
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %34)
%79 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %33)
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %32)
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %31)
%82 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %30)
%83 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %29)
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %47)
%85 = call i32 @putchar(i32 10)
br label %86
86: ; preds = %60, %58
ret i32 0
}