#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*/ copy_array(int, int);
int /*<<< orphan*/ merge(int, int, int);
void merge_split(int begin, int len) {
  int middle;
  if (len - begin < 2)
    return;
  middle = ((len - begin) / 2) + begin;
  merge_split(begin, middle);
  merge_split(middle, len);
  merge(begin, middle, len);
  copy_array(begin, len);
}


x86 assembly (clang, -O0):
<merge_split>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
cmp    $0x2,%eax
jge    1152 <merge_split+0x22>
jmp    1195 <merge_split+0x65>
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
add    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <merge_split@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <merge_split@plt>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1040 <merge@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <copy_array@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<merge_split>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
sub    %edi,%ebx
cmp    $0x1,%ebx
jg     1142 <merge_split+0x12>
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %esi,%r14d
mov    %edi,%ebp
shr    %ebx
add    %edi,%ebx
mov    %ebx,%esi
call   1030 <merge_split@plt>
mov    %ebx,%edi
mov    %r14d,%esi
call   1030 <merge_split@plt>
mov    %ebp,%edi
mov    %ebx,%esi
mov    %r14d,%edx
call   1040 <merge@plt>
mov    %ebp,%edi
mov    %r14d,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <copy_array@plt>

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

LLVM IR (-O2):
define void @merge_split(i32 %0, i32 %1) {
%3 = sub nsw i32 %1, %0
%4 = icmp slt i32 %3, 2
br i1 %4, label %5, label %6
5: ; preds = %2, %6
ret void
6: ; preds = %2
%7 = lshr i32 %3, 1
%8 = add nsw i32 %7, %0
tail call void @merge_split(i32 %0, i32 %8)
tail call void @merge_split(i32 %8, i32 %1)
%9 = tail call i32 @merge(i32 %0, i32 %8, i32 %1)
%10 = tail call i32 @copy_array(i32 %0, i32 %1)
br label %5
}