#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 generic_mcpy_partition(void *, size_t, size_t, size_t,
                           int (*)(void const *, void const *));
void generic_mcpy_qsort_recurse(void *a, size_t p, size_t r, size_t size,
                                int (*compare)(const void *, const void *)) {
  if (p < r && ~r) {
    int q = generic_mcpy_partition(a, p, r, size, compare);
    generic_mcpy_qsort_recurse(a, p, q - 1, size, compare);
    generic_mcpy_qsort_recurse(a, q + 1, r, size, compare);
  }
}


x86 assembly (clang, -O0):
<generic_mcpy_qsort_recurse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    11b4 <generic_mcpy_qsort_recurse+0x94>
mov    -0x18(%rbp),%rax
xor    $0xffffffffffffffff,%rax
cmp    $0x0,%rax
je     11b4 <generic_mcpy_qsort_recurse+0x94>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1030 <generic_mcpy_partition@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1040 <generic_mcpy_qsort_recurse@plt>
mov    -0x8(%rbp),%rdi
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1040 <generic_mcpy_qsort_recurse@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generic_mcpy_qsort_recurse>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0xffffffffffffffff,%rdx
je     1188 <generic_mcpy_qsort_recurse+0x68>
mov    %rdx,%r13
mov    %rsi,%rbx
cmp    %rdx,%rsi
jae    1188 <generic_mcpy_qsort_recurse+0x68>
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdi,%r12
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
mov    %r15,%rcx
mov    %r14,%r8
call   1030 <generic_mcpy_partition@plt>
mov    %eax,%ebp
lea    -0x1(%rbp),%eax
movslq %eax,%rdx
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r15,%rcx
mov    %r14,%r8
call   1040 <generic_mcpy_qsort_recurse@plt>
add    $0x1,%ebp
movslq %ebp,%rbx
cmp    %r13,%rbx
jb     1150 <generic_mcpy_qsort_recurse+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @generic_mcpy_qsort_recurse(i8* %0, i64 %1, i64 %2, i64 %3, i32 (i8*, i8*)* %4) {
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i32 (i8*, i8*)*
%11 = alloca i32
store i8* %0, i8** %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i64 %3, i64* %9
store i32 (i8*, i8*)* %4, i32 (i8*, i8*)** %10
%12 = load i64, i64* %7
%13 = load i64, i64* %8
%14 = icmp ult i64 %12, %13
br i1 %14, label %15, label %40
15: ; preds = %5
%16 = load i64, i64* %8
%17 = xor i64 %16, -1
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %40
19: ; preds = %15
%20 = load i8*, i8** %6
%21 = load i64, i64* %7
%22 = load i64, i64* %8
%23 = load i64, i64* %9
%24 = load i32 (i8*, i8*)*, i32 (i8*, i8*)** %10
%25 = call i32 @generic_mcpy_partition(i8* %20, i64 %21, i64 %22, i64 %23, i32 (i8*, i8*)* %24)
store i32 %25, i32* %11
%26 = load i8*, i8** %6
%27 = load i64, i64* %7
%28 = load i32, i32* %11
%29 = sub nsw i32 %28, 1
%30 = sext i32 %29 to i64
%31 = load i64, i64* %9
%32 = load i32 (i8*, i8*)*, i32 (i8*, i8*)** %10
%33 = load i8*, i8** %6
%34 = load i32, i32* %11
%35 = add nsw i32 %34, 1
%36 = sext i32 %35 to i64
%37 = load i64, i64* %8
%38 = load i64, i64* %9
%39 = load i32 (i8*, i8*)*, i32 (i8*, i8*)** %10
br label %40
40: ; preds = %19, %15, %5
ret void
}

LLVM IR (-O2):
define void @generic_mcpy_qsort_recurse(i8* %0, i64 %1, i64 %2, i64 %3, i32 (i8*, i8*)* %4) {
%6 = icmp eq i64 %2, -1
%7 = icmp uge i64 %1, %2
%8 = or i1 %6, %7
br i1 %8, label %17, label %9
9: ; preds = %5, %9
%10 = phi i64 [ %15, %9 ], [ %1, %5 ]
%11 = tail call i32 @generic_mcpy_partition(i8* %0, i64 %10, i64 %2, i64 %3, i32 (i8*, i8*)* %4)
%12 = add nsw i32 %11, -1
%13 = sext i32 %12 to i64
tail call void @generic_mcpy_qsort_recurse(i8* %0, i64 %10, i64 %13, i64 %3, i32 (i8*, i8*)* %4)
%14 = add nsw i32 %11, 1
%15 = sext i32 %14 to i64
%16 = icmp ult i64 %15, %2
br i1 %16, label %9, label %17
17: ; preds = %9, %5
ret void
}