#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 digit_seen[10] = {0};
  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] = 1;
    n /= 10;
    ;
  }
  if (n > 0) {
    printf("Repeated digit.\n");
  } else {
    printf("No repeated digits.\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)
jge    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    0xe43(%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
test   %rcx,%rcx
js     1176 <main+0x46>
mov    %rcx,%rdx
jmp    11c9 <main+0x99>
movabs $0xcccccccccccccccd,%rsi
cc cc cc
neg    %rcx
mov    %rcx,%rax
mul    %rsi
shr    $0x3,%rdx
lea    (%rdx,%rdx,1),%rax
lea    (%rax,%rax,4),%rdi
mov    %rcx,%rax
sub    %rdi,%rax
lea    0x0(,%rax,4),%rdi
neg    %rdi
cmpl   $0x0,0x10(%rsp,%rdi,1)
jne    11d7 <main+0xa7>
neg    %rax
movl   $0x1,0x10(%rsp,%rax,4)
neg    %rdx
mov    %rdx,0x8(%rsp)
cmp    $0x9,%rcx
mov    %rdx,%rcx
ja     1180 <main+0x50>
test   %rdx,%rdx
je     11d7 <main+0xa7>
lea    0xe54(%rip),%rdi
jmp    11de <main+0xae>
lea    0xe37(%rip),%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 = [17 x i8] c"Repeated digit.\0A\00"
@.str.3 = [21 x i8] c"No repeated digits.\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 slt 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 ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %34
32: ; preds = %27
%33 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 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 = [20 x i8] c"No repeated digits.\00"
@str.4 = [16 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 slt i64 %7, 0
br i1 %8, label %9, label %21
9: ; preds = %0, %18
%10 = phi i64 [ %19, %18 ], [ %7, %0 ]
%11 = sub i64 0, %10
%12 = urem i64 %11, 10
%13 = udiv i64 %11, 10
%14 = sub nsw i64 0, %12
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %9
store i32 1, i32* %15
%19 = sub nsw i64 0, %13
store i64 %19, i64* %2
%20 = icmp ult i64 %11, 10
br i1 %20, label %21, label %9
21: ; preds = %18, %0
%22 = phi i64 [ %7, %0 ], [ %19, %18 ]
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %9, %21
br label %25
25: ; preds = %21, %24
%26 = phi i8* [ getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0), %24 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @str.4, i64 0, i64 0), %21 ]
%27 = call i32 @puts(i8* dereferenceable(1) %26)
ret i32 0
}