#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 atoi(char *);
int *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int removeDuplicates(int *, int);
int main(int argc, char **argv) {
  int i, size = argc - 1;
  int *nums = malloc(size * sizeof(int));
  for (i = 0; i < argc - 1; i++) {
    nums[i] = atoi(argv[i + 1]);
  }
  int count = removeDuplicates(nums, size);
  for (i = 0; i < count; i++) {
    printf("%d ", nums[i]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
movslq -0x18(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11bb <main+0x7b>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <atoi@plt>
mov    %eax,%edx
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1179 <main+0x39>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1040 <removeDuplicates@plt>
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1204 <main+0xc4>
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11d1 <main+0x91>
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
mov    %edi,%r15d
lea    -0x1(%r15),%r14d
lea    -0x4(,%r15,4),%edi
ff
call   1060 <malloc@plt>
mov    %rax,%r13
cmp    $0x2,%r15d
jl     119b <main+0x4b>
mov    %r14d,%r15d
xor    %ebp,%ebp
lea    0x1(%rbp),%rbx
mov    0x8(%r12,%rbp,8),%rdi
call   1070 <atoi@plt>
mov    %eax,0x0(%r13,%rbp,4)
mov    %rbx,%rbp
cmp    %rbx,%r15
jne    1180 <main+0x30>
mov    %r13,%rdi
mov    %r14d,%esi
call   1050 <removeDuplicates@plt>
test   %eax,%eax
jle    11d8 <main+0x88>
mov    %eax,%r15d
lea    0xe4c(%rip),%r14
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    0x0(%r13,%rbp,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r15
jne    11c0 <main+0x70>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
@.str.1 = [2 x i8] c"\0A\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 i32*
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = sub nsw i32 %10, 1
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = sext i32 %12 to i64
%14 = mul i64 %13, 4
%15 = trunc i64 %14 to i32
%16 = call i32* @malloc(i32 %15)
store i32* %16, i32** %8
store i32 0, i32* %6
br label %17
17: ; preds = %34, %2
%18 = load i32, i32* %6
%19 = load i32, i32* %4
%20 = sub nsw i32 %19, 1
%21 = icmp slt i32 %18, %20
br i1 %21, label %22, label %37
22: ; preds = %17
%23 = load i8**, i8*** %5
%24 = load i32, i32* %6
%25 = add nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %23, i64 %26
%28 = load i8*, i8** %27
%29 = call i32 @atoi(i8* %28)
%30 = load i32*, i32** %8
%31 = load i32, i32* %6
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %30, i64 %32
store i32 %29, i32* %33
br label %34
34: ; preds = %22
%35 = load i32, i32* %6
%36 = add nsw i32 %35, 1
store i32 %36, i32* %6
br label %17
37: ; preds = %17
%38 = load i32*, i32** %8
%39 = load i32, i32* %7
%40 = call i32 @removeDuplicates(i32* %38, i32 %39)
store i32 %40, i32* %9
store i32 0, i32* %6
br label %41
41: ; preds = %52, %37
%42 = load i32, i32* %6
%43 = load i32, i32* %9
%44 = icmp slt i32 %42, %43
br i1 %44, label %45, label %55
45: ; preds = %41
%46 = load i32*, i32** %8
%47 = load i32, i32* %6
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i32, i32* %46, i64 %48
%50 = load i32, i32* %49
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %50)
br label %52
52: ; preds = %45
%53 = load i32, i32* %6
%54 = add nsw i32 %53, 1
store i32 %54, i32* %6
br label %41
55: ; preds = %41
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

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