#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*/ print_int_arr(int *, int);
int /*<<< orphan*/ printf(char *);
int *remove_dup(int *, int);
int main() {
  int a[10] = {1, 2, 3, 4, 4, 3, 2, 5, 6, 5};
  int b[5] = {9, 9, 1, 1, 2};
  int c[3] = {1, 1, 1};
  int d[1] = {3};
  int *o;
  printf("a: ");
  print_int_arr(a, 10);
  o = remove_dup(a, 10);
  print_int_arr(o, 4);
  printf("\nb: ");
  print_int_arr(b, 5);
  o = remove_dup(b, 5);
  print_int_arr(o, 2);
  printf("\nc: ");
  print_int_arr(c, 3);
  o = remove_dup(c, 3);
  print_int_arr(o, 1);
  printf("\nd: ");
  print_int_arr(d, 1);
  o = remove_dup(d, 1);
  print_int_arr(o, 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xea6(%rip),%rsi
mov    $0x28,%edx
call   1060 <memcpy@plt>
mov    0xec5(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xec2(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xec0(%rip),%eax
mov    %eax,-0x40(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x5c(%rbp)
mov    0xeb8(%rip),%eax
mov    %eax,-0x54(%rbp)
mov    0xeb3(%rip),%eax
mov    %eax,-0x60(%rbp)
lea    0xead(%rip),%rdi
call   1050 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1040 <print_int_arr@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1030 <remove_dup@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rdi
mov    $0x4,%esi
call   1040 <print_int_arr@plt>
lea    0xe77(%rip),%rdi
call   1050 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    $0x5,%esi
call   1040 <print_int_arr@plt>
lea    -0x50(%rbp),%rdi
mov    $0x5,%esi
call   1030 <remove_dup@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rdi
mov    $0x2,%esi
call   1040 <print_int_arr@plt>
lea    0xe42(%rip),%rdi
call   1050 <printf@plt>
lea    -0x5c(%rbp),%rdi
mov    $0x3,%esi
call   1040 <print_int_arr@plt>
lea    -0x5c(%rbp),%rdi
mov    $0x3,%esi
call   1030 <remove_dup@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rdi
mov    $0x1,%esi
call   1040 <print_int_arr@plt>
lea    0xe0d(%rip),%rdi
call   1050 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    $0x1,%esi
call   1040 <print_int_arr@plt>
lea    -0x60(%rbp),%rdi
mov    $0x1,%esi
call   1030 <remove_dup@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rdi
xor    %esi,%esi
call   1040 <print_int_arr@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
mov    0xee4(%rip),%rax
mov    %rax,0x60(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xeac(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
mov    0xee1(%rip),%eax
mov    %eax,0x30(%rsp)
movaps 0xec6(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    0xed7(%rip),%eax
mov    %eax,0x18(%rsp)
mov    0xec4(%rip),%rax
mov    %rax,0x10(%rsp)
movl   $0x3,0xc(%rsp)
lea    0xebc(%rip),%rdi
call   1050 <printf@plt>
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <print_int_arr@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <remove_dup@plt>
mov    %rax,%rdi
mov    $0x4,%esi
call   1040 <print_int_arr@plt>
lea    0xe88(%rip),%rdi
call   1050 <printf@plt>
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <print_int_arr@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <remove_dup@plt>
mov    %rax,%rdi
mov    $0x2,%esi
call   1040 <print_int_arr@plt>
lea    0xe55(%rip),%rdi
call   1050 <printf@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <print_int_arr@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <remove_dup@plt>
mov    %rax,%rdi
mov    $0x1,%esi
call   1040 <print_int_arr@plt>
lea    0xe22(%rip),%rdi
call   1050 <printf@plt>
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1040 <print_int_arr@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <remove_dup@plt>
mov    %rax,%rdi
xor    %esi,%esi
call   1040 <print_int_arr@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.a = [10 x i32] [i32 1, i32 2, i32 3, i32 4, i32 4, i32 3, i32 2, i32 5, i32 6, i32 5]
@__const.main.b = [5 x i32] [i32 9, i32 9, i32 1, i32 1, i32 2]
@__const.main.c = [3 x i32] [i32 1, i32 1, i32 1]
@__const.main.d = [1 x i32] [i32 3]
@.str = [4 x i8] c"a: \00"
@.str.1 = [5 x i8] c"\0Ab: \00"
@.str.2 = [5 x i8] c"\0Ac: \00"
@.str.3 = [5 x i8] c"\0Ad: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca [5 x i32]
%4 = alloca [3 x i32]
%5 = alloca [1 x i32]
%6 = alloca i32*
store i32 0, i32* %1
%7 = bitcast [10 x i32]* %2 to i8*
%8 = bitcast [5 x i32]* %3 to i8*
%9 = bitcast [3 x i32]* %4 to i8*
%10 = bitcast [1 x i32]* %5 to i8*
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%13 = call i32 @print_int_arr(i32* %12, i32 10)
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%15 = call i32* @remove_dup(i32* %14, i32 10)
store i32* %15, i32** %6
%16 = load i32*, i32** %6
%17 = call i32 @print_int_arr(i32* %16, i32 4)
%18 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%19 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%20 = call i32 @print_int_arr(i32* %19, i32 5)
%21 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%22 = call i32* @remove_dup(i32* %21, i32 5)
store i32* %22, i32** %6
%23 = load i32*, i32** %6
%24 = call i32 @print_int_arr(i32* %23, i32 2)
%25 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%26 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 0
%27 = call i32 @print_int_arr(i32* %26, i32 3)
%28 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 0
%29 = call i32* @remove_dup(i32* %28, i32 3)
store i32* %29, i32** %6
%30 = load i32*, i32** %6
%31 = call i32 @print_int_arr(i32* %30, i32 1)
%32 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%33 = getelementptr inbounds [1 x i32], [1 x i32]* %5, i64 0, i64 0
%34 = call i32 @print_int_arr(i32* %33, i32 1)
%35 = getelementptr inbounds [1 x i32], [1 x i32]* %5, i64 0, i64 0
%36 = call i32* @remove_dup(i32* %35, i32 1)
store i32* %36, i32** %6
%37 = load i32*, i32** %6
%38 = call i32 @print_int_arr(i32* %37, i32 0)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [10 x i32] [i32 1, i32 2, i32 3, i32 4, i32 4, i32 3, i32 2, i32 5, i32 6, i32 5]
@__const.main.b = [5 x i32] [i32 9, i32 9, i32 1, i32 1, i32 2]
@__const.main.c = [3 x i32] [i32 1, i32 1, i32 1]
@.str = [4 x i8] c"a: \00"
@.str.1 = [5 x i8] c"\0Ab: \00"
@.str.2 = [5 x i8] c"\0Ac: \00"
@.str.3 = [5 x i8] c"\0Ad: \00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = alloca [5 x i32]
%3 = alloca [3 x i32]
%4 = alloca [1 x i32]
%5 = bitcast [10 x i32]* %1 to i8*
%6 = bitcast [5 x i32]* %2 to i8*
%7 = bitcast [3 x i32]* %3 to i8*
%8 = bitcast [1 x i32]* %4 to i8*
%9 = getelementptr inbounds [1 x i32], [1 x i32]* %4, i64 0, i64 0
store i32 3, i32* %9
%10 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%12 = call i32 @print_int_arr(i32* %11, i32 10)
%13 = call i32* @remove_dup(i32* %11, i32 10)
%14 = call i32 @print_int_arr(i32* %13, i32 4)
%15 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%16 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%17 = call i32 @print_int_arr(i32* %16, i32 5)
%18 = call i32* @remove_dup(i32* %16, i32 5)
%19 = call i32 @print_int_arr(i32* %18, i32 2)
%20 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%21 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%22 = call i32 @print_int_arr(i32* %21, i32 3)
%23 = call i32* @remove_dup(i32* %21, i32 3)
%24 = call i32 @print_int_arr(i32* %23, i32 1)
%25 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%26 = call i32 @print_int_arr(i32* %9, i32 1)
%27 = call i32* @remove_dup(i32* %9, i32 1)
%28 = call i32 @print_int_arr(i32* %27, i32 0)
ret i32 0
}