#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*/ combine(int *, int *, int, int, int, int);
void merge(int a[], int temp[], int start, int end) {
  if (start < end) {
    int mid = start + (end - start) / 2;
    merge(a, temp, start, mid);
    merge(a, temp, mid + 1, end);
    combine(a, temp, start, mid, mid + 1, end);
  }
}


x86 assembly (clang, -O0):
<merge>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11a8 <merge+0x88>
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
sub    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x1c(%rbp),%ecx
call   1040 <merge@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
add    $0x1,%edx
mov    -0x18(%rbp),%ecx
call   1040 <merge@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
add    $0x1,%r8d
mov    -0x18(%rbp),%r9d
call   1030 <combine@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<merge>:
mov    %ecx,%eax
sub    %edx,%eax
jle    118f <merge+0x6f>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r12d
mov    %edx,%ebx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %eax,%ebp
shr    $0x1f,%ebp
add    %eax,%ebp
sar    %ebp
lea    (%rbx,%rbp,1),%ecx
mov    %ecx,0x4(%rsp)
call   1040 <merge@plt>
lea    (%rbx,%rbp,1),%r13d
add    $0x1,%r13d
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r13d,%edx
mov    %r12d,%ecx
call   1040 <merge@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
mov    0x4(%rsp),%ecx
mov    %r13d,%r8d
mov    %r12d,%r9d
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <combine@plt>
ret

LLVM IR (-O0):
define void @merge(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* %8
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %37
13: ; preds = %4
%14 = load i32, i32* %7
%15 = load i32, i32* %8
%16 = load i32, i32* %7
%17 = sub nsw i32 %15, %16
%18 = sdiv i32 %17, 2
%19 = add nsw i32 %14, %18
store i32 %19, i32* %9
%20 = load i32*, i32** %5
%21 = load i32*, i32** %6
%22 = load i32, i32* %7
%23 = load i32, i32* %9
%24 = load i32*, i32** %5
%25 = load i32*, i32** %6
%26 = load i32, i32* %9
%27 = add nsw i32 %26, 1
%28 = load i32, i32* %8
%29 = load i32*, i32** %5
%30 = load i32*, i32** %6
%31 = load i32, i32* %7
%32 = load i32, i32* %9
%33 = load i32, i32* %9
%34 = add nsw i32 %33, 1
%35 = load i32, i32* %8
%36 = call i32 @combine(i32* %29, i32* %30, i32 %31, i32 %32, i32 %34, i32 %35)
br label %37
37: ; preds = %13, %4
ret void
}

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