#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(unsigned long long *, unsigned long long,
                           unsigned long long);
void mergesrt(unsigned long long int *a, unsigned long long int lower,
              unsigned long long int upper) {
  if (lower == upper - 1)
    return;
  unsigned long long int mid = (lower + upper) / 2;
  mergesrt(a, lower, mid);
  mergesrt(a, mid, upper);
  combine(a, lower, upper);
}


x86 assembly (clang, -O0):
<mergesrt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
jne    114e <mergesrt+0x2e>
jmp    1191 <mergesrt+0x71>
mov    -0x10(%rbp),%rax
add    -0x18(%rbp),%rax
shr    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <mergesrt@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <mergesrt@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <combine@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mergesrt>:
lea    -0x1(%rdx),%rax
cmp    %rsi,%rax
jne    112a <mergesrt+0xa>
ret
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
lea    (%rdx,%rsi,1),%r12
shr    %r12
mov    %r12,%rdx
call   1040 <mergesrt@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
call   1040 <mergesrt@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <combine@plt>

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

LLVM IR (-O2):
define void @mergesrt(i64* %0, i64 %1, i64 %2) {
%4 = add i64 %2, -1
%5 = icmp eq i64 %4, %1
br i1 %5, label %6, label %7
6: ; preds = %3, %7
ret void
7: ; preds = %3
%8 = add i64 %2, %1
%9 = lshr i64 %8, 1
tail call void @mergesrt(i64* %0, i64 %1, i64 %9)
tail call void @mergesrt(i64* %0, i64 %9, i64 %2)
%10 = tail call i32 @combine(i64* %0, i64 %1, i64 %2)
br label %6
}