#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 */
unsigned int _quicksort_partition(void *, unsigned int, unsigned int,
                                  unsigned int,
                                  int (*)(void const *, void const *));
void _quicksort(void *array, unsigned int lo, unsigned int hi,
                unsigned int el_size, int (*comp)(const void *, const void *)) {
  if (lo >= hi)
    return;
  unsigned int p = _quicksort_partition(array, lo, hi, el_size, comp);
  _quicksort(array, lo, p, el_size, comp);
  _quicksort(array, p + 1, hi, el_size, comp);
}


x86 assembly (clang, -O0):
<_quicksort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jb     114a <_quicksort+0x2a>
jmp    1192 <_quicksort+0x72>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x20(%rbp),%r8
call   1030 <_quicksort_partition@plt>
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x20(%rbp),%r8
call   1040 <_quicksort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x20(%rbp),%r8
call   1040 <_quicksort@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_quicksort>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    %edx,%esi
jae    1171 <_quicksort+0x51>
mov    %r8,%r14
mov    %ecx,%r15d
mov    %edx,%r12d
mov    %esi,%ebp
mov    %rdi,%r13
nopl   (%rax)
mov    %r13,%rdi
mov    %ebp,%esi
mov    %r12d,%edx
mov    %r15d,%ecx
mov    %r14,%r8
call   1030 <_quicksort_partition@plt>
mov    %eax,%ebx
mov    %r13,%rdi
mov    %ebp,%esi
mov    %eax,%edx
mov    %r15d,%ecx
mov    %r14,%r8
call   1040 <_quicksort@plt>
add    $0x1,%ebx
mov    %ebx,%ebp
cmp    %r12d,%ebx
jb     1140 <_quicksort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @_quicksort(i8* %0, i32 %1, i32 %2, i32 %3, i32 (i8*, i8*)* %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32 (i8*, i8*)*
%11 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 (i8*, i8*)* %4, i32 (i8*, i8*)** %10
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = icmp uge i32 %12, %13
br i1 %14, label %15, label %16
15: ; preds = %5
br label %34
16: ; preds = %5
%17 = load i8*, i8** %6
%18 = load i32, i32* %7
%19 = load i32, i32* %8
%20 = load i32, i32* %9
%21 = load i32 (i8*, i8*)*, i32 (i8*, i8*)** %10
%22 = call i32 @_quicksort_partition(i8* %17, i32 %18, i32 %19, i32 %20, i32 (i8*, i8*)* %21)
store i32 %22, i32* %11
%23 = load i8*, i8** %6
%24 = load i32, i32* %7
%25 = load i32, i32* %11
%26 = load i32, i32* %9
%27 = load i32 (i8*, i8*)*, i32 (i8*, i8*)** %10
%28 = load i8*, i8** %6
%29 = load i32, i32* %11
%30 = add i32 %29, 1
%31 = load i32, i32* %8
%32 = load i32, i32* %9
%33 = load i32 (i8*, i8*)*, i32 (i8*, i8*)** %10
br label %34
34: ; preds = %16, %15
ret void
}

LLVM IR (-O2):
define void @_quicksort(i8* %0, i32 %1, i32 %2, i32 %3, i32 (i8*, i8*)* %4) {
%6 = icmp ult i32 %1, %2
br i1 %6, label %7, label %12
7: ; preds = %5, %7
%8 = phi i32 [ %10, %7 ], [ %1, %5 ]
%9 = tail call i32 @_quicksort_partition(i8* %0, i32 %8, i32 %2, i32 %3, i32 (i8*, i8*)* %4)
tail call void @_quicksort(i8* %0, i32 %8, i32 %9, i32 %3, i32 (i8*, i8*)* %4)
%10 = add i32 %9, 1
%11 = icmp ult i32 %10, %2
br i1 %11, label %7, label %12
12: ; preds = %7, %5
ret void
}