#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 *, short);
int main() {
  short input[20] = {10, 20, 51, 66, 10, 88, 66, 45, 46, 99,
                     33, 55, 45, 68, 12, 11, 45, 65, 77, 44};
  short alreadyRead[20] = {0};
  int nextIndex = 0;
  int i, j, printNum;
  for (i = 0; i <= 20 - 1; i++) {
    printNum = 1;
    for (j = 0; j < nextIndex; j++) {
      if (alreadyRead[j] == input[i]) {
        printNum = 0;
        break;
      }
    }
    if (printNum) {
      printf("%d ", input[i]);
      alreadyRead[nextIndex++] = input[i];
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
movl   $0x0,-0x64(%rbp)
movl   $0x0,-0x68(%rbp)
cmpl   $0x13,-0x68(%rbp)
jg     121c <main+0xec>
movl   $0x1,-0x70(%rbp)
movl   $0x0,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0x64(%rbp),%eax
jge    11cf <main+0x9f>
movslq -0x6c(%rbp),%rax
movswl -0x60(%rbp,%rax,2),%eax
movslq -0x68(%rbp),%rcx
movswl -0x30(%rbp,%rcx,2),%ecx
cmp    %ecx,%eax
jne    11bc <main+0x8c>
movl   $0x0,-0x70(%rbp)
jmp    11cf <main+0x9f>
jmp    11c1 <main+0x91>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    118a <main+0x5a>
cmpl   $0x0,-0x70(%rbp)
je     1209 <main+0xd9>
movslq -0x68(%rbp),%rax
lea    0xe44(%rip),%rdi
movswl -0x30(%rbp,%rax,2),%esi
call   1030 <printf@plt>
movslq -0x68(%rbp),%rax
mov    -0x30(%rbp,%rax,2),%cx
mov    -0x64(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x64(%rbp)
cltq
mov    %cx,-0x60(%rbp,%rax,2)
jmp    120e <main+0xde>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1172 <main+0x42>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x30,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movq   $0x0,0x20(%rsp)
xor    %ebx,%ebx
lea    0xec6(%rip),%r15
lea    0xee7(%rip),%r14
xor    %r12d,%r12d
jmp    1172 <main+0x62>
cs nopw 0x0(%rax,%rax,1)
movswl %ax,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
movslq %r12d,%rax
add    $0x1,%r12d
mov    %bp,(%rsp,%rax,2)
add    $0x1,%rbx
cmp    $0x14,%rbx
je     11a1 <main+0x91>
movzwl (%r15,%rbx,2),%eax
test   %r12d,%r12d
jle    1150 <main+0x40>
mov    %r12d,%ecx
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    %ax,(%rsp,%rdx,2)
je     1168 <main+0x58>
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    1190 <main+0x80>
jmp    1150 <main+0x40>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@__const.main.input = [20 x i16] [i16 10, i16 20, i16 51, i16 66, i16 10, i16 88, i16 66, i16 45, i16 46, i16 99, i16 33, i16 55, i16 45, i16 68, i16 12, i16 11, i16 45, i16 65, i16 77, i16 44]
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca [20 x i16]
%2 = bitcast [20 x i16]* %1 to i8*
br label %3
3: ; preds = %0, %24
%4 = phi i64 [ 0, %0 ], [ %26, %24 ]
%5 = phi i32 [ 0, %0 ], [ %25, %24 ]
%6 = icmp sgt i32 %5, 0
%7 = getelementptr inbounds [20 x i16], [20 x i16]* @__const.main.input, i64 0, i64 %4
%8 = load i16, i16* %7
br i1 %6, label %9, label %19
9: ; preds = %3
%10 = zext i32 %5 to i64
br label %13
11: ; preds = %13
%12 = icmp eq i64 %18, %10
br i1 %12, label %19, label %13
13: ; preds = %9, %11
%14 = phi i64 [ 0, %9 ], [ %18, %11 ]
%15 = getelementptr inbounds [20 x i16], [20 x i16]* %1, i64 0, i64 %14
%16 = load i16, i16* %15
%17 = icmp eq i16 %16, %8
%18 = add nuw nsw i64 %14, 1
br i1 %17, label %24, label %11
19: ; preds = %11, %3
%20 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i16 signext %8)
%21 = add nsw i32 %5, 1
%22 = sext i32 %5 to i64
%23 = getelementptr inbounds [20 x i16], [20 x i16]* %1, i64 0, i64 %22
store i16 %8, i16* %23
br label %24
24: ; preds = %13, %19
%25 = phi i32 [ %21, %19 ], [ %5, %13 ]
%26 = add nuw nsw i64 %4, 1
%27 = icmp eq i64 %26, 20
br i1 %27, label %28, label %3
28: ; preds = %24
ret i32 0
}