#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 RemoveDuplicates(int a[], int n) {
  int i = 0, j = 0;
  for (i = 0; i < n; i++) {
    for (j = i + 1; j < n; j++) {
      if ((a[i] == a[j]) && (i != j)) {
        printf("\n Duplicates at %d and %d", i, j);
        return 1;
      }
    }
  }
  printf("\n No Duplicates Found.");
  return 0;
}


x86 assembly (clang, -O0):
<RemoveDuplicates>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11c3 <RemoveDuplicates+0xb3>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11b0 <RemoveDuplicates+0xa0>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x10(%rbp),%rcx
movslq -0x1c(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jne    119d <RemoveDuplicates+0x8d>
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
je     119d <RemoveDuplicates+0x8d>
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11d8 <RemoveDuplicates+0xc8>
jmp    11a2 <RemoveDuplicates+0x92>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1149 <RemoveDuplicates+0x39>
jmp    11b5 <RemoveDuplicates+0xa5>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1134 <RemoveDuplicates+0x24>
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RemoveDuplicates>:
push   %rbx
test   %esi,%esi
jle    1175 <RemoveDuplicates+0x65>
mov    %esi,%eax
mov    $0x1,%ecx
xor    %r8d,%r8d
jmp    1139 <RemoveDuplicates+0x29>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rcx
cmp    %rax,%r8
je     1175 <RemoveDuplicates+0x65>
mov    %r8,%rsi
add    $0x1,%r8
cmp    %rax,%r8
jae    1130 <RemoveDuplicates+0x20>
mov    (%rdi,%rsi,4),%ebx
mov    %rcx,%rdx
nopl   0x0(%rax,%rax,1)
cmp    (%rdi,%rdx,4),%ebx
je     1160 <RemoveDuplicates+0x50>
add    $0x1,%rdx
cmp    %rdx,%rax
jne    1150 <RemoveDuplicates+0x40>
jmp    1130 <RemoveDuplicates+0x20>
lea    0xe99(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%ebx
jmp    1185 <RemoveDuplicates+0x75>
lea    0xe9e(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [26 x i8] c"\0A Duplicates at %d and %d\00"
@.str.1 = [23 x i8] c"\0A No Duplicates Found.\00"
define i32 @RemoveDuplicates(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %30
4: ; preds = %2
%5 = zext i32 %1 to i64
%6 = zext i32 %1 to i64
br label %10
7: ; preds = %27, %10
%8 = add nuw nsw i64 %12, 1
%9 = icmp eq i64 %13, %6
br i1 %9, label %30, label %10
10: ; preds = %4, %7
%11 = phi i64 [ 0, %4 ], [ %13, %7 ]
%12 = phi i64 [ 1, %4 ], [ %8, %7 ]
%13 = add nuw nsw i64 %11, 1
%14 = icmp ult i64 %13, %5
br i1 %14, label %15, label %7
15: ; preds = %10
%16 = getelementptr inbounds i32, i32* %0, i64 %11
%17 = load i32, i32* %16
br label %18
18: ; preds = %15, %27
%19 = phi i64 [ %12, %15 ], [ %28, %27 ]
%20 = getelementptr inbounds i32, i32* %0, i64 %19
%21 = load i32, i32* %20
%22 = icmp eq i32 %17, %21
br i1 %22, label %23, label %27
23: ; preds = %18
%24 = trunc i64 %11 to i32
%25 = trunc i64 %19 to i32
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %24, i32 %25)
br label %32
27: ; preds = %18
%28 = add nuw nsw i64 %19, 1
%29 = icmp eq i64 %28, %6
br i1 %29, label %7, label %18
30: ; preds = %7, %2
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %32
32: ; preds = %30, %23
%33 = phi i32 [ 1, %23 ], [ 0, %30 ]
ret i32 %33
}