#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(double **, int, int, int, int);
void MergeSort(double **data, int first, int last, int col) {
  if (first >= last)
    return;
  int mid = (last - first) / 2;
  MergeSort(data, first, first + mid, col);
  MergeSort(data, first + mid + 1, last, col);
  Merge(data, first, first + mid, last, col);
  return;
}


x86 assembly (clang, -O0):
<MergeSort>:
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
jl     1146 <MergeSort+0x26>
jmp    119d <MergeSort+0x7d>
mov    -0x10(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%edx
add    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1040 <MergeSort@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    -0x18(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1040 <MergeSort@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%edx
add    -0x18(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
call   1030 <Merge@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MergeSort>:
mov    %edx,%eax
sub    %esi,%eax
jle    1186 <MergeSort+0x66>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%r13d
mov    %esi,%ebx
mov    %rdi,%r15
mov    %eax,%ebp
shr    $0x1f,%ebp
add    %eax,%ebp
sar    %ebp
lea    (%rbx,%rbp,1),%r12d
mov    %r12d,%edx
call   1040 <MergeSort@plt>
lea    (%rbx,%rbp,1),%esi
add    $0x1,%esi
mov    %r15,%rdi
mov    %r13d,%edx
mov    %r14d,%ecx
call   1040 <MergeSort@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r12d,%edx
mov    %r13d,%ecx
mov    %r14d,%r8d
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <Merge@plt>
ret

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

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