#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*/ qsort_my(int *, int /*<<< orphan*/, int);
int containsDuplicate(int *nums, int numsSize) {
  int i, j;
  qsort_my(nums, 0, numsSize - 1);
  for (i = 0; i < numsSize - 1; i++) {
    if (nums[i] == nums[i + 1])
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<containsDuplicate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1030 <qsort_my@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1188 <containsDuplicate+0x78>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
cmp    (%rcx,%rdx,4),%eax
jne    1175 <containsDuplicate+0x65>
movl   $0x1,-0x4(%rbp)
jmp    118f <containsDuplicate+0x7f>
jmp    117a <containsDuplicate+0x6a>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1137 <containsDuplicate+0x27>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<containsDuplicate>:
push   %r15
push   %r14
push   %rbx
mov    %esi,%r15d
mov    %rdi,%rbx
add    $0xffffffff,%r15d
xor    %r14d,%r14d
xor    %esi,%esi
mov    %r15d,%edx
call   1030 <qsort_my@plt>
test   %r15d,%r15d
cmovle %r14d,%r15d
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nop
cmp    %rax,%r15
je     115b <containsDuplicate+0x4b>
mov    (%rbx,%rax,4),%ecx
lea    0x1(%rax),%rdx
cmp    0x4(%rbx,%rax,4),%ecx
mov    %rdx,%rax
jne    1140 <containsDuplicate+0x30>
mov    $0x1,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @containsDuplicate(i32* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
%8 = load i32*, i32** %4
%9 = load i32, i32* %5
%10 = sub nsw i32 %9, 1
%11 = call i32 @qsort_my(i32* %8, i32 0, i32 %10)
store i32 0, i32* %6
br label %12
12: ; preds = %32, %2
%13 = load i32, i32* %6
%14 = load i32, i32* %5
%15 = sub nsw i32 %14, 1
%16 = icmp slt i32 %13, %15
br i1 %16, label %17, label %35
17: ; preds = %12
%18 = load i32*, i32** %4
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
%22 = load i32, i32* %21
%23 = load i32*, i32** %4
%24 = load i32, i32* %6
%25 = add nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %23, i64 %26
%28 = load i32, i32* %27
%29 = icmp eq i32 %22, %28
br i1 %29, label %30, label %31
30: ; preds = %17
store i32 1, i32* %3
br label %36
31: ; preds = %17
br label %32
32: ; preds = %31
%33 = load i32, i32* %6
%34 = add nsw i32 %33, 1
store i32 %34, i32* %6
br label %12
35: ; preds = %12
store i32 0, i32* %3
br label %36
36: ; preds = %35, %30
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
define i32 @containsDuplicate(i32* %0, i32 %1) {
%3 = add nsw i32 %1, -1
%4 = tail call i32 @qsort_my(i32* %0, i32 0, i32 %3)
%5 = call i32 @llvm.smax.i32(i32 %3, i32 0)
%6 = zext i32 %5 to i64
br label %7
7: ; preds = %10, %2
%8 = phi i64 [ %13, %10 ], [ 0, %2 ]
%9 = icmp eq i64 %8, %6
br i1 %9, label %17, label %10
10: ; preds = %7
%11 = getelementptr inbounds i32, i32* %0, i64 %8
%12 = load i32, i32* %11
%13 = add nuw nsw i64 %8, 1
%14 = getelementptr inbounds i32, i32* %0, i64 %13
%15 = load i32, i32* %14
%16 = icmp eq i32 %12, %15
br i1 %16, label %17, label %7
17: ; preds = %7, %10
%18 = phi i32 [ 1, %10 ], [ 0, %7 ]
ret i32 %18
}