#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*/ merge(int *, int, int, int *);
void mergeSort(int *numbersA, int size, int *numbersB) {
  if (size < 2) {
    return;
  }
  int mid = size / 2;
  mergeSort(numbersA, mid, numbersB);
  mergeSort(numbersA + mid, size - mid, numbersB);
  merge(numbersA, size, mid, numbersB);
}


x86 assembly (clang, -O0):
<mergeSort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    1142 <mergeSort+0x22>
jmp    1191 <mergeSort+0x71>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <mergeSort@plt>
mov    -0x8(%rbp),%rdi
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0xc(%rbp),%esi
sub    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <mergeSort@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x18(%rbp),%rcx
call   1040 <merge@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mergeSort>:
cmp    $0x1,%esi
jg     1126 <mergeSort+0x6>
ret
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%r15
mov    %esi,%ebx
shr    %ebx
mov    %ebx,%esi
call   1030 <mergeSort@plt>
lea    (%r15,%rbx,4),%rdi
mov    %ebp,%esi
sub    %ebx,%esi
mov    %r14,%rdx
call   1030 <mergeSort@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <merge@plt>

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

LLVM IR (-O2):
define void @mergeSort(i32* %0, i32 %1, i32* %2) {
%4 = icmp slt i32 %1, 2
br i1 %4, label %5, label %6
5: ; preds = %3, %6
ret void
6: ; preds = %3
%7 = lshr i32 %1, 1
tail call void @mergeSort(i32* %0, i32 %7, i32* %2)
%8 = zext i32 %7 to i64
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = sub nsw i32 %1, %7
tail call void @mergeSort(i32* %9, i32 %10, i32* %2)
%11 = tail call i32 @merge(i32* %0, i32 %1, i32 %7, i32* %2)
br label %5
}