#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*/ mergeSort_copyArray(int *, int *, int, int);
int /*<<< orphan*/ mergeSort_merge(int *, int, int, int, int *);
void mergeSort_partition(int *array, int low, int high, int *dummyArray) {
  if (high - low < 2)
    return;
  int mid = (high + low) / 2;
  mergeSort_partition(array, low, mid, dummyArray);
  mergeSort_partition(array, mid, high, dummyArray);
  mergeSort_merge(array, low, mid, high, dummyArray);
  mergeSort_copyArray(dummyArray, array, low, high);
}


x86 assembly (clang, -O0):
<mergeSort_partition>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x10(%rbp),%eax
sub    -0xc(%rbp),%eax
cmp    $0x2,%eax
jge    115a <mergeSort_partition+0x2a>
jmp    11ba <mergeSort_partition+0x8a>
mov    -0x10(%rbp),%eax
add    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x18(%rbp),%rcx
call   1030 <mergeSort_partition@plt>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%rcx
call   1030 <mergeSort_partition@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x18(%rbp),%r8
call   1050 <mergeSort_merge@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1040 <mergeSort_copyArray@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mergeSort_partition>:
mov    %edx,%eax
sub    %esi,%eax
cmp    $0x1,%eax
jg     113a <mergeSort_partition+0xa>
ret
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %edx,%r15d
mov    %esi,%ebx
mov    %rdi,%r12
lea    (%r15,%rbx,1),%eax
mov    %eax,%ebp
shr    $0x1f,%ebp
add    %eax,%ebp
sar    %ebp
mov    %ebp,%edx
call   1030 <mergeSort_partition@plt>
mov    %r12,%rdi
mov    %ebp,%esi
mov    %r15d,%edx
mov    %r14,%rcx
call   1030 <mergeSort_partition@plt>
mov    %r12,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r15d,%ecx
mov    %r14,%r8
call   1050 <mergeSort_merge@plt>
mov    %r14,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
mov    %r15d,%ecx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <mergeSort_copyArray@plt>

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

LLVM IR (-O2):
define void @mergeSort_partition(i32* %0, i32 %1, i32 %2, i32* %3) {
%5 = sub nsw i32 %2, %1
%6 = icmp slt i32 %5, 2
br i1 %6, label %7, label %8
7: ; preds = %4, %8
ret void
8: ; preds = %4
%9 = add nsw i32 %2, %1
%10 = sdiv i32 %9, 2
tail call void @mergeSort_partition(i32* %0, i32 %1, i32 %10, i32* %3)
tail call void @mergeSort_partition(i32* %0, i32 %10, i32 %2, i32* %3)
%11 = tail call i32 @mergeSort_merge(i32* %0, i32 %1, i32 %10, i32 %2, i32* %3)
%12 = tail call i32 @mergeSort_copyArray(i32* %3, i32* %0, i32 %1, i32 %2)
br label %7
}