#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 n, a[10], b[10], count = 0, c, d;
  printf("Enter number of elements in array\n");
  scanf("%d", &n);
  printf("Enter %d integers\n", n);
  for (c = 0; c < n; c++)
    scanf("%d", &a[c]);
  for (c = 0; c < n; c++) {
    for (d = 0; d < count; d++) {
      if (a[c] == b[d])
        break;
    }
    if (d == count) {
      b[count] = a[c];
      count++;
    }
  }
  printf("Array obtained after removing duplicate elements\n");
  for (c = 0; c < count; c++)
    printf("%d\n", b[c]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x64(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11a1 <main+0x81>
movslq -0x68(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe95(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    116c <main+0x4c>
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    122d <main+0x10d>
movl   $0x0,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0x64(%rbp),%eax
jge    11f5 <main+0xd5>
movslq -0x68(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
movslq -0x6c(%rbp),%rcx
cmp    -0x60(%rbp,%rcx,4),%eax
jne    11e2 <main+0xc2>
jmp    11f5 <main+0xd5>
jmp    11e7 <main+0xc7>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    11bb <main+0x9b>
mov    -0x6c(%rbp),%eax
cmp    -0x64(%rbp),%eax
jne    121a <main+0xfa>
movslq -0x68(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%ecx
movslq -0x64(%rbp),%rax
mov    %ecx,-0x60(%rbp,%rax,4)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    121f <main+0xff>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    11a8 <main+0x88>
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x64(%rbp),%eax
jge    1272 <main+0x152>
movslq -0x68(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%esi
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1242 <main+0x122>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x70,%rsp
lea    0xeda(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb4(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
lea    0xea2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1216 <main+0xe6>
lea    0x40(%rsp),%r15
xor    %ebx,%ebx
lea    0xe7f(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
add    $0x4,%r15
cmp    %rax,%rbx
jl     1190 <main+0x60>
mov    %eax,%eax
test   %eax,%eax
jle    1216 <main+0xe6>
xor    %ecx,%ecx
xor    %ebx,%ebx
jmp    11d7 <main+0xa7>
nopl   0x0(%rax)
mov    0x40(%rsp,%rcx,4),%edx
movslq %ebx,%rsi
mov    %edx,0x10(%rsp,%rsi,4)
add    $0x1,%ebx
add    $0x1,%rcx
cmp    %rax,%rcx
je     1224 <main+0xf4>
mov    $0x0,%edx
test   %ebx,%ebx
jle    1210 <main+0xe0>
mov    0x40(%rsp,%rcx,4),%esi
mov    %ebx,%edi
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
cmp    0x10(%rsp,%rdx,4),%esi
je     1210 <main+0xe0>
add    $0x1,%rdx
cmp    %rdx,%rdi
jne    11f0 <main+0xc0>
jmp    11c0 <main+0x90>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    %ebx,%edx
je     11c0 <main+0x90>
jmp    11ce <main+0x9e>
lea    0xe1f(%rip),%rdi
call   1030 <puts@plt>
jmp    1257 <main+0x127>
lea    0xe11(%rip),%rdi
call   1030 <puts@plt>
test   %ebx,%ebx
jle    1257 <main+0x127>
mov    %ebx,%r15d
lea    0xdd8(%rip),%r14
xor    %ebx,%ebx
mov    0x10(%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1240 <main+0x110>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Enter number of elements in array\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [19 x i8] c"Enter %d integers\0A\00"
@.str.3 = [50 x i8] c"Array obtained after removing duplicate elements\0A\00"
@.str.4 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x i32]
%4 = alloca [10 x i32]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %10)
store i32 0, i32* %6
br label %12
12: ; preds = %21, %0
%13 = load i32, i32* %6
%14 = load i32, i32* %2
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %24
16: ; preds = %12
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %18
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %19)
br label %21
21: ; preds = %16
%22 = load i32, i32* %6
%23 = add nsw i32 %22, 1
store i32 %23, i32* %6
br label %12
24: ; preds = %12
store i32 0, i32* %6
br label %25
25: ; preds = %64, %24
%26 = load i32, i32* %6
%27 = load i32, i32* %2
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %67
29: ; preds = %25
store i32 0, i32* %7
br label %30
30: ; preds = %46, %29
%31 = load i32, i32* %7
%32 = load i32, i32* %5
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %49
34: ; preds = %30
%35 = load i32, i32* %6
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %36
%38 = load i32, i32* %37
%39 = load i32, i32* %7
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %40
%42 = load i32, i32* %41
%43 = icmp eq i32 %38, %42
br i1 %43, label %44, label %45
44: ; preds = %34
br label %49
45: ; preds = %34
br label %46
46: ; preds = %45
%47 = load i32, i32* %7
%48 = add nsw i32 %47, 1
store i32 %48, i32* %7
br label %30
49: ; preds = %44, %30
%50 = load i32, i32* %7
%51 = load i32, i32* %5
%52 = icmp eq i32 %50, %51
br i1 %52, label %53, label %63
53: ; preds = %49
%54 = load i32, i32* %6
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %55
%57 = load i32, i32* %56
%58 = load i32, i32* %5
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %59
store i32 %57, i32* %60
%61 = load i32, i32* %5
%62 = add nsw i32 %61, 1
store i32 %62, i32* %5
br label %63
63: ; preds = %53, %49
br label %64
64: ; preds = %63
%65 = load i32, i32* %6
%66 = add nsw i32 %65, 1
store i32 %66, i32* %6
br label %25
67: ; preds = %25
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %6
br label %69
69: ; preds = %79, %67
%70 = load i32, i32* %6
%71 = load i32, i32* %5
%72 = icmp slt i32 %70, %71
br i1 %72, label %73, label %82
73: ; preds = %69
%74 = load i32, i32* %6
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %75
%77 = load i32, i32* %76
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %77)
br label %79
79: ; preds = %73
%80 = load i32, i32* %6
%81 = add nsw i32 %80, 1
store i32 %81, i32* %6
br label %69
82: ; preds = %69
ret i32 0
}

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