#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*/ prevhad(int, int *, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, const char *argv[]) {
  int i, n, a[1000000];
  scanf("%d", &n);
  for (i = 0; i < n; i++)
    scanf("%d", &a[i]);
  printf("%d", a[0]);
  for (i = 1; i < n; i++) {
    if (!prevhad(a[i], a, i))
      printf(" %d", a[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3d0920,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb1(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1198 <main+0x68>
movslq -0x14(%rbp),%rax
lea    -0x3d0920(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe7c(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1160 <main+0x30>
mov    -0x3d0920(%rbp),%esi
lea    0xe5c(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    120a <main+0xda>
movslq -0x14(%rbp),%rax
mov    -0x3d0920(%rbp,%rax,4),%edi
lea    -0x3d0920(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <prevhad@plt>
cmp    $0x0,%eax
jne    11f7 <main+0xc7>
movslq -0x14(%rbp),%rax
mov    -0x3d0920(%rbp,%rax,4),%esi
lea    0xe0e(%rip),%rdi
call   1030 <printf@plt>
jmp    11fc <main+0xcc>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11b1 <main+0x81>
xor    %eax,%eax
add    $0x3d0920,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x3d0910,%rsp
lea    0xebe(%rip),%r14
lea    0xc(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
lea    0x10(%rsp),%r15
xor    %ebx,%ebx
nopw   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     1160 <main+0x30>
mov    0x10(%rsp),%esi
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x2,0xc(%rsp)
jl     11de <main+0xae>
mov    $0x1,%ebx
lea    0x10(%rsp),%r14
lea    0xe5b(%rip),%r15
jmp    11be <main+0x8e>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jge    11de <main+0xae>
mov    0x10(%rsp,%rbx,4),%edi
mov    %r14,%rsi
mov    %ebx,%edx
call   1040 <prevhad@plt>
test   %eax,%eax
jne    11b0 <main+0x80>
mov    0x10(%rsp,%rbx,4),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
jmp    11b0 <main+0x80>
xor    %eax,%eax
add    $0x3d0910,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c" %d\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca [1000000 x i32]
%5 = bitcast i32* %3 to i8*
%6 = bitcast [1000000 x i32]* %4 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%8 = load i32, i32* %3
%9 = icmp sgt i32 %8, 0
br label %10
10: ; preds = %2, %10
%11 = phi i64 [ %14, %10 ], [ 0, %2 ]
%12 = getelementptr inbounds [1000000 x i32], [1000000 x i32]* %4, i64 0, i64 %11
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %12)
%14 = add nuw nsw i64 %11, 1
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = icmp slt i64 %14, %16
br i1 %17, label %10, label %18
18: ; preds = %10
%19 = getelementptr inbounds [1000000 x i32], [1000000 x i32]* %4, i64 0, i64 0
%20 = load i32, i32* %19
%21 = getelementptr inbounds [1000000 x i32], [1000000 x i32]* %4, i64 0, i64 0
%22 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %20)
%23 = load i32, i32* %3
%24 = icmp sgt i32 %23, 1
br i1 %24, label %25, label %40
25: ; preds = %18, %35
%26 = phi i64 [ %36, %35 ], [ 1, %18 ]
%27 = getelementptr inbounds [1000000 x i32], [1000000 x i32]* %4, i64 0, i64 %26
%28 = load i32, i32* %27
%29 = trunc i64 %26 to i32
%30 = call i32 @prevhad(i32 %28, i32* %21, i32 %29)
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %25
%33 = load i32, i32* %27
%34 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %33)
br label %35
35: ; preds = %25, %32
%36 = add nuw nsw i64 %26, 1
%37 = load i32, i32* %3
%38 = sext i32 %37 to i64
%39 = icmp slt i64 %36, %38
br i1 %39, label %25, label %40
40: ; preds = %35, %18
ret i32 0
}