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


x86 assembly (clang, -O0):
<merge>:
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    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    119f <merge+0x7f>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x1c(%rbp),%edx
sub    $0x1,%edx
mov    -0x18(%rbp),%rcx
call   1040 <merge@plt>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%rcx
call   1040 <merge@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x1c(%rbp),%edx
sub    $0x1,%edx
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
mov    -0x10(%rbp),%r8d
mov    -0x18(%rbp),%r9
call   1030 <combine@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<merge>:
cmp    %edx,%esi
jge    1188 <merge+0x68>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %edx,%r15d
mov    %esi,%r13d
mov    %rdi,%r12
lea    (%r15,%r13,1),%eax
mov    %eax,%ebx
shr    $0x1f,%ebx
add    %eax,%ebx
sar    %ebx
lea    -0x1(%rbx),%ebp
mov    %ebp,%edx
call   1040 <merge@plt>
add    $0x1,%ebx
mov    %r12,%rdi
mov    %ebx,%esi
mov    %r15d,%edx
mov    %r14,%rcx
call   1040 <merge@plt>
mov    %r12,%rdi
mov    %r13d,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
mov    %r15d,%r8d
mov    %r14,%r9
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* %6
%11 = load i32, i32* %7
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %37
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
%18 = load i32*, i32** %5
%19 = load i32, i32* %6
%20 = load i32, i32* %9
%21 = sub nsw i32 %20, 1
%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 = load i32*, i32** %5
%29 = load i32, i32* %6
%30 = load i32, i32* %9
%31 = sub nsw i32 %30, 1
%32 = load i32, i32* %9
%33 = add nsw i32 %32, 1
%34 = load i32, i32* %7
%35 = load i32*, i32** %8
%36 = call i32 @combine(i32* %28, i32 %29, i32 %31, i32 %33, 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 slt i32 %1, %2
br i1 %5, label %7, label %6
6: ; preds = %4, %7
ret void
7: ; preds = %4
%8 = add nsw i32 %2, %1
%9 = sdiv i32 %8, 2
%10 = add nsw i32 %9, -1
tail call void @merge(i32* %0, i32 %1, i32 %10, i32* %3)
%11 = add nsw i32 %9, 1
tail call void @merge(i32* %0, i32 %11, i32 %2, i32* %3)
%12 = tail call i32 @combine(i32* %0, i32 %1, i32 %10, i32 %11, i32 %2, i32* %3)
br label %6
}