#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*/ printf(char *, ...);
void outputHeader(long *ar, int left, int pivotIndex, int right) {
  int i;
  int median = (right - left) / 2;
  printf(" ");
  for (i = left; i <= right; i++) {
    if (i == left) {
      printf("left");
    } else if (i == right) {
      printf("rt. ");
    } else if (i == median) {
      printf("med ");
    } else if (i == pivotIndex) {
      printf("pivt");
    } else {
      printf("    ");
    }
    printf(" ");
  }
  printf("\n");
  for (i = left; i <= right; i++) {
    printf("| %02ld ", ar[i]);
  }
  printf("|\n");
}


x86 assembly (clang, -O0):
<outputHeader>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     120b <outputHeader+0xfb>
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1175 <outputHeader+0x65>
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ef <outputHeader+0xdf>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    1194 <outputHeader+0x84>
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ea <outputHeader+0xda>
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    11b3 <outputHeader+0xa3>
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e5 <outputHeader+0xd5>
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    11d2 <outputHeader+0xc2>
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e0 <outputHeader+0xd0>
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e5 <outputHeader+0xd5>
jmp    11ea <outputHeader+0xda>
jmp    11ef <outputHeader+0xdf>
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114a <outputHeader+0x3a>
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     1253 <outputHeader+0x143>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xddb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    121f <outputHeader+0x10f>
lea    0xdc8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outputHeader>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,%ebx
mov    %edx,%r12d
mov    %esi,%ebp
mov    %rdi,%r13
mov    %ecx,%r15d
sub    %esi,%r15d
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    %ebx,%r14d
sub    %ebp,%r14d
jge    116f <outputHeader+0x3f>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1288 <outputHeader+0x158>
mov    %r13,0x8(%rsp)
mov    %r12d,(%rsp)
lea    0xe81(%rip),%r13
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    %ebx,0x4(%rsp)
mov    %ebx,%r12d
sub    %ebp,%r12d
jne    11b3 <outputHeader+0x83>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x8(%rsp),%rcx
jmp    1253 <outputHeader+0x123>
mov    %r15d,%eax
shr    $0x1f,%eax
add    %r15d,%eax
sar    %eax
mov    %rbp,0x10(%rsp)
lea    0x1(%rbp),%ebx
mov    %ebx,%ebp
sub    (%rsp),%ebp
sub    %eax,%ebx
xor    %r15d,%r15d
jmp    11fd <outputHeader+0xcd>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%r15d
mov    %r14d,%eax
add    %r15d,%eax
je     1239 <outputHeader+0x109>
mov    %r13,%rdi
cmp    $0x1,%r15d
je     11e0 <outputHeader+0xb0>
lea    (%r14,%r15,1),%eax
lea    0xdf4(%rip),%rdi
cmp    $0x1,%eax
je     11e0 <outputHeader+0xb0>
lea    0xded(%rip),%rdi
cmp    %r15d,%ebx
je     11e0 <outputHeader+0xb0>
cmp    %r15d,%ebp
lea    0xde8(%rip),%rdi
lea    0xddc(%rip),%rax
cmove  %rax,%rdi
jmp    11e0 <outputHeader+0xb0>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x10(%rsp),%rbp
cmp    %ebp,0x4(%rsp)
mov    0x8(%rsp),%rcx
jl     1288 <outputHeader+0x158>
movslq %ebp,%rax
lea    (%rcx,%rax,8),%rbp
add    $0x1,%r12d
lea    0xdb4(%rip),%r14
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    0x0(%rbp,%rbx,8),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %ebx,%r12d
jne    1270 <outputHeader+0x140>
lea    0xd93(%rip),%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [5 x i8] c"left\00"
@.str.2 = [5 x i8] c"rt. \00"
@.str.3 = [5 x i8] c"med \00"
@.str.4 = [5 x i8] c"pivt\00"
@.str.5 = [5 x i8] c" \00"
@.str.6 = [2 x i8] c"\0A\00"
@.str.7 = [9 x i8] c"| %02ld \00"
@.str.8 = [3 x i8] c"|\0A\00"
define void @outputHeader(i64* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i64*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i64* %0, i64** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* %8
%12 = load i32, i32* %6
%13 = sub nsw i32 %11, %12
%14 = sdiv i32 %13, 2
store i32 %14, i32* %10
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%16 = load i32, i32* %6
store i32 %16, i32* %9
br label %17
17: ; preds = %52, %4
%18 = load i32, i32* %9
%19 = load i32, i32* %8
%20 = icmp sle i32 %18, %19
br i1 %20, label %21, label %55
21: ; preds = %17
%22 = load i32, i32* %9
%23 = load i32, i32* %6
%24 = icmp eq i32 %22, %23
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %50
27: ; preds = %21
%28 = load i32, i32* %9
%29 = load i32, i32* %8
%30 = icmp eq i32 %28, %29
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %49
33: ; preds = %27
%34 = load i32, i32* %9
%35 = load i32, i32* %10
%36 = icmp eq i32 %34, %35
br i1 %36, label %37, label %39
37: ; preds = %33
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %48
39: ; preds = %33
%40 = load i32, i32* %9
%41 = load i32, i32* %7
%42 = icmp eq i32 %40, %41
br i1 %42, label %43, label %45
43: ; preds = %39
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %47
45: ; preds = %39
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
br label %47
47: ; preds = %45, %43
br label %48
48: ; preds = %47, %37
br label %49
49: ; preds = %48, %31
br label %50
50: ; preds = %49, %25
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %52
52: ; preds = %50
%53 = load i32, i32* %9
%54 = add nsw i32 %53, 1
store i32 %54, i32* %9
br label %17
55: ; preds = %17
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%57 = load i32, i32* %6
store i32 %57, i32* %9
br label %58
58: ; preds = %69, %55
%59 = load i32, i32* %9
%60 = load i32, i32* %8
%61 = icmp sle i32 %59, %60
br i1 %61, label %62, label %72
62: ; preds = %58
%63 = load i64*, i64** %5
%64 = load i32, i32* %9
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i64, i64* %63, i64 %65
%67 = load i64, i64* %66
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i64 %67)
br label %69
69: ; preds = %62
%70 = load i32, i32* %9
%71 = add nsw i32 %70, 1
store i32 %71, i32* %9
br label %58
72: ; preds = %58
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"left\00"
@.str.2 = [5 x i8] c"rt. \00"
@.str.3 = [5 x i8] c"med \00"
@.str.4 = [5 x i8] c"pivt\00"
@.str.5 = [5 x i8] c" \00"
@.str.7 = [9 x i8] c"| %02ld \00"
@str = [2 x i8] c"|\00"
define void @outputHeader(i64* nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = sub nsw i32 %3, %1
%6 = sdiv i32 %5, 2
%7 = tail call i32 @putchar(i32 32)
%8 = icmp slt i32 %3, %1
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = tail call i32 @putchar(i32 10)
br label %46
11: ; preds = %4
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%13 = tail call i32 @putchar(i32 32)
%14 = icmp eq i32 %3, %1
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = tail call i32 @putchar(i32 10)
br label %35
17: ; preds = %11, %28
%18 = phi i32 [ %19, %28 ], [ %1, %11 ]
%19 = add i32 %18, 1
%20 = icmp eq i32 %19, %1
br i1 %20, label %28, label %21
21: ; preds = %17
%22 = icmp eq i32 %19, %3
br i1 %22, label %28, label %23
23: ; preds = %21
%24 = icmp eq i32 %19, %6
br i1 %24, label %28, label %25
25: ; preds = %23
%26 = icmp eq i32 %19, %2
%27 = select i1 %26, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0)
br label %28
28: ; preds = %25, %23, %21, %17
%29 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %17 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), %21 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), %23 ], [ %27, %25 ]
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %29)
%31 = tail call i32 @putchar(i32 32)
%32 = icmp eq i32 %19, %3
br i1 %32, label %33, label %17
33: ; preds = %28
%34 = tail call i32 @putchar(i32 10)
br i1 %8, label %46, label %35
35: ; preds = %15, %33
%36 = sext i32 %1 to i64
%37 = add i32 %3, 1
br label %38
38: ; preds = %35, %38
%39 = phi i64 [ %36, %35 ], [ %43, %38 ]
%40 = getelementptr inbounds i64, i64* %0, i64 %39
%41 = load i64, i64* %40
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i64 %41)
%43 = add nsw i64 %39, 1
%44 = trunc i64 %43 to i32
%45 = icmp eq i32 %37, %44
br i1 %45, label %46, label %38
46: ; preds = %38, %9, %33
%47 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret void
}