#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*/ countSplitInv(long long *, long long, long long, long long);
void countInv(long long int A[], long long int start, long long int end) {
  if (start < end) {
    long long int mid = (start + end) / 2;
    countInv(A, start, mid);
    countInv(A, mid + 1, end);
    countSplitInv(A, start, mid, end);
  }
}


x86 assembly (clang, -O0):
<countInv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    1193 <countInv+0x73>
mov    -0x10(%rbp),%rax
add    -0x18(%rbp),%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <countInv@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
add    $0x1,%rsi
mov    -0x18(%rbp),%rdx
call   1040 <countInv@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rcx
call   1030 <countSplitInv@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<countInv>:
cmp    %rdx,%rsi
jge    117a <countInv+0x5a>
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r12
mov    %rdi,%r15
lea    (%rdx,%rsi,1),%rax
mov    %rax,%rbx
shr    $0x3f,%rbx
add    %rax,%rbx
sar    %rbx
mov    %rbx,%rdx
call   1040 <countInv@plt>
lea    0x1(%rbx),%rsi
mov    %r15,%rdi
mov    %r14,%rdx
call   1040 <countInv@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <countSplitInv@plt>
ret

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

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