#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] = {0}, i, n, p;
  printf("Enter n:");
  scanf("%d", &n);
  if (n < 0) {
    n = n * (-1);
  }
  while (n > 0) {
    int p = n % 10;
    a[p]++;
    n = n / 10;
  }
  int r = 0;
  for (i = 0; i < 10; i++) {
    if (a[i] > 1) {
      printf("Digit %d repeats\n", i);
      r = 1;
    }
  }
  if (!r) {
    printf("No repeating digits");
  }
}


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>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea5(%rip),%rdi
lea    -0x38(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x38(%rbp)
jge    117e <main+0x4e>
imul   $0xffffffff,-0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
jmp    1183 <main+0x53>
cmpl   $0x0,-0x38(%rbp)
jle    11bd <main+0x8d>
mov    -0x38(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x40(%rbp)
movslq -0x40(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x38(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x38(%rbp)
jmp    1183 <main+0x53>
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    120f <main+0xdf>
movslq -0x34(%rbp),%rax
cmpl   $0x1,-0x30(%rbp,%rax,4)
jle    11fc <main+0xcc>
mov    -0x34(%rbp),%esi
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x44(%rbp)
jmp    1201 <main+0xd1>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11cb <main+0x9b>
cmpl   $0x0,-0x44(%rbp)
jne    1227 <main+0xf7>
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%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    %ebx,%ebx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb7(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
js     1168 <main+0x48>
jne    116a <main+0x4a>
jmp    11b0 <main+0x90>
neg    %eax
mov    $0xcccccccd,%ecx
nop
mov    %eax,%edx
mov    %eax,%eax
imul   %rcx,%rax
shr    $0x23,%rax
lea    (%rax,%rax,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %edx,%edi
sub    %esi,%edi
addl   $0x1,0x10(%rsp,%rdi,4)
cmp    $0xa,%edx
jae    1170 <main+0x50>
mov    %eax,0xc(%rsp)
cmpl   $0x1,0x10(%rsp)
jle    11b0 <main+0x90>
lea    0xe6a(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%ebx
cmpl   $0x2,0x14(%rsp)
jge    1227 <main+0x107>
cmpl   $0x2,0x18(%rsp)
jge    124a <main+0x12a>
cmpl   $0x2,0x1c(%rsp)
jge    126d <main+0x14d>
cmpl   $0x2,0x20(%rsp)
jge    1290 <main+0x170>
cmpl   $0x2,0x24(%rsp)
jge    12b3 <main+0x193>
cmpl   $0x2,0x28(%rsp)
jge    12d6 <main+0x1b6>
cmpl   $0x2,0x2c(%rsp)
jge    12f9 <main+0x1d9>
cmpl   $0x2,0x30(%rsp)
jge    131c <main+0x1fc>
cmpl   $0x2,0x34(%rsp)
jl     133f <main+0x21f>
lea    0xdf6(%rip),%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1351 <main+0x231>
lea    0xdde(%rip),%rdi
mov    $0x1,%ebx
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,0x18(%rsp)
jl     11c2 <main+0xa2>
lea    0xdbb(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%ebx
cmpl   $0x2,0x1c(%rsp)
jl     11cd <main+0xad>
lea    0xd98(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%ebx
cmpl   $0x2,0x20(%rsp)
jl     11d8 <main+0xb8>
lea    0xd75(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%ebx
cmpl   $0x2,0x24(%rsp)
jl     11e3 <main+0xc3>
lea    0xd52(%rip),%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%ebx
cmpl   $0x2,0x28(%rsp)
jl     11ee <main+0xce>
lea    0xd2f(%rip),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%ebx
cmpl   $0x2,0x2c(%rsp)
jl     11f9 <main+0xd9>
lea    0xd0c(%rip),%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%ebx
cmpl   $0x2,0x30(%rsp)
jl     1204 <main+0xe4>
lea    0xce9(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%ebx
cmpl   $0x2,0x34(%rsp)
jge    120f <main+0xef>
test   %ebx,%ebx
jne    1351 <main+0x231>
lea    0xcd4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"Enter n:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [18 x i8] c"Digit %d repeats\0A\00"
@.str.3 = [20 x i8] c"No repeating digits\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = bitcast [10 x i32]* %2 to i8*
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %0
%14 = load i32, i32* %4
%15 = mul nsw i32 %14, -1
store i32 %15, i32* %4
br label %16
16: ; preds = %13, %0
br label %17
17: ; preds = %20, %16
%18 = load i32, i32* %4
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %30
20: ; preds = %17
%21 = load i32, i32* %4
%22 = srem i32 %21, 10
store i32 %22, i32* %6
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = add nsw i32 %26, 1
store i32 %27, i32* %25
%28 = load i32, i32* %4
%29 = sdiv i32 %28, 10
store i32 %29, i32* %4
br label %17
30: ; preds = %17
store i32 0, i32* %7
store i32 0, i32* %3
br label %31
31: ; preds = %44, %30
%32 = load i32, i32* %3
%33 = icmp slt i32 %32, 10
br i1 %33, label %34, label %47
34: ; preds = %31
%35 = load i32, i32* %3
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %36
%38 = load i32, i32* %37
%39 = icmp sgt i32 %38, 1
br i1 %39, label %40, label %43
40: ; preds = %34
%41 = load i32, i32* %3
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %41)
store i32 1, i32* %7
br label %43
43: ; preds = %40, %34
br label %44
44: ; preds = %43
%45 = load i32, i32* %3
%46 = add nsw i32 %45, 1
store i32 %46, i32* %3
br label %31
47: ; preds = %31
%48 = load i32, i32* %7
%49 = icmp ne i32 %48, 0
br i1 %49, label %52, label %50
50: ; preds = %47
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %52
52: ; preds = %50, %47
%53 = load i32, i32* %1
ret i32 %53
}

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