#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, ...);
void divide(int arr[], int left, int right) {
  int mid;
  if (left < right) {
    mid = (left + right);
    merge(arr, left, mid);
    merge(arr, mid + 1, right);
    merge(arr, left, mid, right);
  }
}


x86 assembly (clang, -O0):
<divide>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1170 <divide+0x60>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    $0x0,%al
call   1030 <merge@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
mov    $0x0,%al
call   1030 <merge@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    $0x0,%al
call   1030 <merge@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<divide>:
cmp    %edx,%esi
jge    115f <divide+0x4f>
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%ebx
mov    %rdi,%r15
lea    (%r14,%rbx,1),%ebp
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <merge@plt>
lea    (%r14,%rbx,1),%esi
add    $0x1,%esi
mov    %r15,%rdi
mov    %r14d,%edx
xor    %eax,%eax
call   1030 <merge@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <merge@plt>
ret

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

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