#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_Merge(int *, int, int, int, int);
int /*<<< orphan*/ printf(char *);
void MergeSort_Split(int arr[], int left, int right, int round) {
  int mid;
  if (left < right)
    mid = (left + right) / 2;
  MergeSort_Split(arr, left, mid, round);
  MergeSort_Split(arr, mid + 1, right, round);
  printf("Calling MergeSort_Merge(); ...\n");
  MergeSort_Merge(arr, left, mid, right, round);
}


x86 assembly (clang, -O0):
<MergeSort_Split>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1162 <MergeSort_Split+0x32>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1050 <MergeSort_Split@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1050 <MergeSort_Split@plt>
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
call   1040 <MergeSort_Merge@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MergeSort_Split>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%r14d
mov    %edx,%r12d
mov    %esi,%ebp
mov    %rdi,%r15
cmp    %edx,%esi
jge    1154 <MergeSort_Split+0x24>
lea    (%r12,%rbp,1),%eax
mov    %eax,%ebx
shr    $0x1f,%ebx
add    %eax,%ebx
sar    %ebx
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %r14d,%ecx
call   1050 <MergeSort_Split@plt>
lea    0x1(%rbx),%esi
mov    %r15,%rdi
mov    %r12d,%edx
mov    %r14d,%ecx
call   1050 <MergeSort_Split@plt>
lea    0xe85(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %r12d,%ecx
mov    %r14d,%r8d
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <MergeSort_Merge@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"Calling MergeSort_Merge(); ...\0A\00"
define void @MergeSort_Split(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* %6
%11 = load i32, i32* %7
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %18
13: ; preds = %4
%14 = load i32, i32* %6
%15 = load i32, i32* %7
%16 = add nsw i32 %14, %15
%17 = sdiv i32 %16, 2
store i32 %17, i32* %9
br label %18
18: ; preds = %13, %4
%19 = load i32*, i32** %5
%20 = load i32, i32* %6
%21 = load i32, i32* %9
%22 = load i32, i32* %8
%23 = load i32*, i32** %5
%24 = load i32, i32* %9
%25 = add nsw i32 %24, 1
%26 = load i32, i32* %7
%27 = load i32, i32* %8
%28 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%29 = load i32*, i32** %5
%30 = load i32, i32* %6
%31 = load i32, i32* %9
%32 = load i32, i32* %7
%33 = load i32, i32* %8
%34 = call i32 @MergeSort_Merge(i32* %29, i32 %30, i32 %31, i32 %32, i32 %33)
ret void
}

LLVM IR (-O2):
@str = [31 x i8] c"Calling MergeSort_Merge(); ...\00"
define void @MergeSort_Split(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp slt i32 %1, %2
br i1 %5, label %6, label %9
6: ; preds = %4
%7 = add nsw i32 %2, %1
%8 = sdiv i32 %7, 2
br label %9
9: ; preds = %6, %4
%10 = phi i32 [ %8, %6 ], [ undef, %4 ]
tail call void @MergeSort_Split(i32* %0, i32 %1, i32 %10, i32 %3)
%11 = add nsw i32 %10, 1
tail call void @MergeSort_Split(i32* %0, i32 %11, i32 %2, i32 %3)
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%13 = tail call i32 @MergeSort_Merge(i32* %0, i32 %1, i32 %10, i32 %2, i32 %3)
ret void
}