#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 partition(int **, int, int);
void quicksort(int ar[][2], int l, int r) {
  int m = 0;
  if (l >= r) {
    return;
  }
  m = partition(ar, l, r);
  quicksort(ar, l, m - 1);
  quicksort(ar, m + 1, r);
}


x86 assembly (clang, -O0):
<quicksort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     114a <quicksort+0x2a>
jmp    1180 <quicksort+0x60>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <partition@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
call   1040 <quicksort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <quicksort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quicksort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %edx,%esi
jge    1166 <quicksort+0x46>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <partition@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1040 <quicksort@plt>
add    $0x1,%ebx
mov    %ebx,%ebp
cmp    %r14d,%ebx
jl     1140 <quicksort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @quicksort([2 x i32]* %0, i32 %1, i32 %2) {
%4 = alloca [2 x i32]*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store [2 x i32]* %0, [2 x i32]** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = icmp sge i32 %8, %9
br i1 %10, label %11, label %12
11: ; preds = %3
br label %26
12: ; preds = %3
%13 = load [2 x i32]*, [2 x i32]** %4
%14 = bitcast [2 x i32]* %13 to i32**
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = call i32 @partition(i32** %14, i32 %15, i32 %16)
store i32 %17, i32* %7
%18 = load [2 x i32]*, [2 x i32]** %4
%19 = load i32, i32* %5
%20 = load i32, i32* %7
%21 = sub nsw i32 %20, 1
%22 = load [2 x i32]*, [2 x i32]** %4
%23 = load i32, i32* %7
%24 = add nsw i32 %23, 1
%25 = load i32, i32* %6
br label %26
26: ; preds = %12, %11
ret void
}

LLVM IR (-O2):
define void @quicksort([2 x i32]* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %13
5: ; preds = %3
%6 = bitcast [2 x i32]* %0 to i32**
br label %7
7: ; preds = %5, %7
%8 = phi i32 [ %1, %5 ], [ %11, %7 ]
%9 = tail call i32 @partition(i32** %6, i32 %8, i32 %2)
%10 = add nsw i32 %9, -1
tail call void @quicksort([2 x i32]* %0, i32 %8, i32 %10)
%11 = add nsw i32 %9, 1
%12 = icmp slt i32 %11, %2
br i1 %12, label %7, label %13
13: ; preds = %7, %3
ret void
}