#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) {
  bool digit_seen[10] = {false};
  int digit;
  long n;
  printf("Enter a number: ");
  scanf("%ld", &n);
  while (n > 0) {
    digit = n % 10;
    if (digit_seen[digit])
      break;
    digit_seen[digit] = true;
    n /= 10;
  }
  if (n > 0)
    printf("Repeated digit\n");
  else
    printf("No repeated digit\n");
  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
call   1030 <printf@plt>
lea    0xeaf(%rip),%rdi
lea    -0x40(%rbp),%rsi
call   1050 <scanf@plt>
cmpq   $0x0,-0x40(%rbp)
jle    11c0 <main+0x90>
mov    -0x40(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %edx,%eax
mov    %eax,-0x34(%rbp)
movslq -0x34(%rbp),%rax
cmpl   $0x0,-0x30(%rbp,%rax,4)
je     119d <main+0x6d>
jmp    11c0 <main+0x90>
movslq -0x34(%rbp),%rax
movl   $0x1,-0x30(%rbp,%rax,4)
mov    -0x40(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x40(%rbp)
jmp    116b <main+0x3b>
cmpq   $0x0,-0x40(%rbp)
jle    11dc <main+0xac>
lea    0xe43(%rip),%rdi
call   1030 <printf@plt>
jmp    11e8 <main+0xb8>
lea    0xe42(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x30(%rsp)
lea    0xeaf(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb4(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x8(%rsp),%rcx
lea    0xea2(%rip),%rdi
test   %rcx,%rcx
jle    11ca <main+0x9a>
movabs $0xcccccccccccccccd,%r9
cc cc cc
lea    0xe9e(%rip),%r8
nopl   0x0(%rax)
mov    %rcx,%rax
mul    %r9
shr    $0x3,%rdx
lea    (%rdx,%rdx,1),%rax
lea    (%rax,%rax,4),%rsi
mov    %rcx,%rax
sub    %rsi,%rax
cmpl   $0x0,0x10(%rsp,%rax,4)
jne    11c7 <main+0x97>
movl   $0x1,0x10(%rsp,%rax,4)
mov    %rdx,0x8(%rsp)
cmp    $0x9,%rcx
mov    %rdx,%rcx
ja     1190 <main+0x60>
jmp    11ca <main+0x9a>
mov    %r8,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

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

LLVM IR (-O2):
@.str = [17 x i8] c"Enter a number: \00"
@.str.1 = [4 x i8] c"%ld\00"
@str = [18 x i8] c"No repeated digit\00"
@str.4 = [15 x i8] c"Repeated digit\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*
%5 = tail call i32 @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 %9, label %18
9: ; preds = %0, %16
%10 = phi i64 [ %12, %16 ], [ %7, %0 ]
%11 = urem i64 %10, 10
%12 = udiv i64 %10, 10
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %11
%14 = load i32, i32* %13
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %9
store i32 1, i32* %13
store i64 %12, i64* %2
%17 = icmp ult i64 %10, 10
br i1 %17, label %18, label %9
18: ; preds = %16, %9, %0
%19 = phi i8* [ getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0), %0 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @str.4, i64 0, i64 0), %9 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0), %16 ]
%20 = call i32 @puts(i8* dereferenceable(1) %19)
ret i32 0
}