#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*/ findDuplicates(int *, int);
int /*<<< orphan*/ printf(char *);
int main(void) {
  int arraySize = 32000;
  int array[arraySize];
  for (int i = 0; i < arraySize; i++) {
    array[i] = i + 1;
  }
  array[1] = 1;
  array[4] = 4;
  array[118] = 118;
  array[31900] = 31900;
  array[31999] = 31999;
  printf("Print duplicates from the array: ");
  findDuplicates(array, arraySize);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x7d00,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    118f <main+0x6f>
mov    -0x28(%rbp),%rax
mov    -0x1c(%rbp),%edx
add    $0x1,%edx
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1164 <main+0x44>
mov    -0x28(%rbp),%rax
movl   $0x1,0x4(%rax)
movl   $0x4,0x10(%rax)
movl   $0x76,0x1d8(%rax)
movl   $0x7c9c,0x1f270(%rax)
movl   $0x7cff,0x1f3fc(%rax)
lea    0xe3a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1030 <findDuplicates@plt>
lea    0xe44(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x1f408,%rsp
movaps 0xec2(%rip),%xmm0
movaps 0xecb(%rip),%xmm1
mov    $0xc,%eax
pcmpeqd %xmm8,%xmm8
movdqa 0xec8(%rip),%xmm9
movdqa 0xed0(%rip),%xmm4
movdqa 0xed8(%rip),%xmm5
movdqa 0xee0(%rip),%xmm6
movaps %xmm1,%xmm7
shufps $0x88,%xmm0,%xmm7
movaps %xmm7,%xmm2
psubd  %xmm8,%xmm2
movaps %xmm7,%xmm3
paddd  %xmm9,%xmm3
movdqa %xmm2,-0x30(%rsp,%rax,4)
movdqa %xmm3,-0x20(%rsp,%rax,4)
movaps %xmm7,%xmm2
paddd  %xmm4,%xmm2
paddd  %xmm5,%xmm7
movdqa %xmm2,-0x10(%rsp,%rax,4)
movdqa %xmm7,(%rsp,%rax,4)
paddq  %xmm6,%xmm1
paddq  %xmm6,%xmm0
add    $0x10,%rax
cmp    $0x7d0c,%rax
jne    1170 <main+0x40>
movl   $0x1,0x4(%rsp)
movl   $0x4,0x10(%rsp)
movl   $0x76,0x1d8(%rsp)
movl   $0x7c9c,0x1f270(%rsp)
movl   $0x7cff,0x1f3fc(%rsp)
lea    0xe6b(%rip),%rdi
call   1050 <printf@plt>
mov    %rsp,%rdi
mov    $0x7d00,%esi
call   1040 <findDuplicates@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x1f408,%rsp
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Print duplicates from the array: \00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
store i32 0, i32* %1
store i32 32000, i32* %2
%6 = load i32, i32* %2
%7 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
store i8* %8, i8** %3
%9 = alloca i32, i64 %7
store i64 %7, i64* %4
store i32 0, i32* %5
br label %10
10: ; preds = %20, %0
%11 = load i32, i32* %5
%12 = load i32, i32* %2
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %23
14: ; preds = %10
%15 = load i32, i32* %5
%16 = add nsw i32 %15, 1
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %9, i64 %18
store i32 %16, i32* %19
br label %20
20: ; preds = %14
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 1
store i32 %22, i32* %5
br label %10
23: ; preds = %10
%24 = getelementptr inbounds i32, i32* %9, i64 1
store i32 1, i32* %24
%25 = getelementptr inbounds i32, i32* %9, i64 4
store i32 4, i32* %25
%26 = getelementptr inbounds i32, i32* %9, i64 118
store i32 118, i32* %26
%27 = getelementptr inbounds i32, i32* %9, i64 31900
store i32 31900, i32* %27
%28 = getelementptr inbounds i32, i32* %9, i64 31999
store i32 31999, i32* %28
%29 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%30 = load i32, i32* %2
%31 = call i32 @findDuplicates(i32* %9, i32 %30)
%32 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
%33 = load i8*, i8** %3
%34 = load i32, i32* %1
ret i32 %34
}

LLVM IR (-O2):
@.str = [34 x i8] c"Print duplicates from the array: \00"
define i32 @main() {
%1 = alloca [32000 x i32]
br label %2
2: ; preds = %2, %0
%3 = phi i64 [ 0, %0 ], [ %23, %2 ]
%4 = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, %0 ], [ %24, %2 ]
%5 = getelementptr inbounds [32000 x i32], [32000 x i32]* %1, i64 0, i64 %3
%6 = trunc <4 x i64> %4 to <4 x i32>
%7 = add <4 x i32> %6, <i32 1, i32 1, i32 1, i32 1>
%8 = trunc <4 x i64> %4 to <4 x i32>
%9 = add <4 x i32> %8, <i32 5, i32 5, i32 5, i32 5>
%10 = bitcast i32* %5 to <4 x i32>*
store <4 x i32> %7, <4 x i32>* %10
%11 = getelementptr inbounds i32, i32* %5, i64 4
%12 = bitcast i32* %11 to <4 x i32>*
store <4 x i32> %9, <4 x i32>* %12
%13 = or i64 %3, 8
%14 = add <4 x i64> %4, <i64 8, i64 8, i64 8, i64 8>
%15 = getelementptr inbounds [32000 x i32], [32000 x i32]* %1, i64 0, i64 %13
%16 = trunc <4 x i64> %14 to <4 x i32>
%17 = add <4 x i32> %16, <i32 1, i32 1, i32 1, i32 1>
%18 = trunc <4 x i64> %14 to <4 x i32>
%19 = add <4 x i32> %18, <i32 5, i32 5, i32 5, i32 5>
%20 = bitcast i32* %15 to <4 x i32>*
store <4 x i32> %17, <4 x i32>* %20
%21 = getelementptr inbounds i32, i32* %15, i64 4
%22 = bitcast i32* %21 to <4 x i32>*
store <4 x i32> %19, <4 x i32>* %22
%23 = add nuw nsw i64 %3, 16
%24 = add <4 x i64> %4, <i64 16, i64 16, i64 16, i64 16>
%25 = icmp eq i64 %23, 32000
br i1 %25, label %26, label %2
26: ; preds = %2
%27 = getelementptr inbounds [32000 x i32], [32000 x i32]* %1, i64 0, i64 0
%28 = getelementptr inbounds [32000 x i32], [32000 x i32]* %1, i64 0, i64 1
store i32 1, i32* %28
%29 = getelementptr inbounds [32000 x i32], [32000 x i32]* %1, i64 0, i64 4
store i32 4, i32* %29
%30 = getelementptr inbounds [32000 x i32], [32000 x i32]* %1, i64 0, i64 118
store i32 118, i32* %30
%31 = getelementptr inbounds [32000 x i32], [32000 x i32]* %1, i64 0, i64 31900
store i32 31900, i32* %31
%32 = getelementptr inbounds [32000 x i32], [32000 x i32]* %1, i64 0, i64 31999
store i32 31999, i32* %32
%33 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%34 = call i32 @findDuplicates(i32* %27, i32 32000)
%35 = call i32 @putchar(i32 10)
ret i32 0
}