#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 parttionSelect(int *, int /*<<< orphan*/, int, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int A[6] = {3, 6, 0, 10, 38, 4};
  printf("%d\n", parttionSelect(A, 0, 5, 4));
  int A2[6] = {3, 6, 0, 10, 38, 4};
  printf("%d\n", parttionSelect(A2, 0, 5, 1));
  int A3[6] = {3, 6, 0, 10, 38, 4};
  printf("%d\n", parttionSelect(A3, 0, 5, 6));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x5,%edx
mov    $0x4,%ecx
call   1040 <parttionSelect@plt>
mov    %eax,%esi
lea    0xeea(%rip),%rdi
call   1030 <printf@plt>
mov    0xea6(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xea3(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xea0(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x5,%edx
mov    $0x1,%ecx
call   1040 <parttionSelect@plt>
mov    %eax,%esi
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
mov    0xe82(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xe7f(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xe7c(%rip),%rax
mov    %rax,-0x50(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x5,%edx
mov    $0x6,%ecx
call   1040 <parttionSelect@plt>
mov    %eax,%esi
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x58,%rsp
mov    0xef2(%rip),%r14
mov    %r14,0x50(%rsp)
movaps 0xed6(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
lea    0x40(%rsp),%rdi
xor    %esi,%esi
mov    $0x5,%edx
mov    $0x4,%ecx
call   1040 <parttionSelect@plt>
lea    0xea4(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r14,0x30(%rsp)
movaps 0xe9e(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0x20(%rsp),%rdi
xor    %esi,%esi
mov    $0x5,%edx
mov    $0x1,%ecx
call   1040 <parttionSelect@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r14,0x10(%rsp)
movaps 0xe6d(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x5,%edx
mov    $0x6,%ecx
call   1040 <parttionSelect@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.A = [6 x i32] [i32 3, i32 6, i32 0, i32 10, i32 38, i32 4]
@.str = [4 x i8] c"%d\0A\00"
@__const.main.A2 = [6 x i32] [i32 3, i32 6, i32 0, i32 10, i32 38, i32 4]
@__const.main.A3 = [6 x i32] [i32 3, i32 6, i32 0, i32 10, i32 38, i32 4]
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i32]
%3 = alloca [6 x i32]
%4 = alloca [6 x i32]
store i32 0, i32* %1
%5 = bitcast [6 x i32]* %2 to i8*
%6 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%7 = call i32 @parttionSelect(i32* %6, i32 0, i32 5, i32 4)
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = bitcast [6 x i32]* %3 to i8*
%10 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%11 = call i32 @parttionSelect(i32* %10, i32 0, i32 5, i32 1)
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = bitcast [6 x i32]* %4 to i8*
%14 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 0
%15 = call i32 @parttionSelect(i32* %14, i32 0, i32 5, i32 6)
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@__const.main.A3 = [6 x i32] [i32 3, i32 6, i32 0, i32 10, i32 38, i32 4]
define i32 @main() {
%1 = alloca [6 x i32]
%2 = alloca [6 x i32]
%3 = alloca [6 x i32]
%4 = bitcast [6 x i32]* %1 to i8*
%5 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%6 = call i32 @parttionSelect(i32* %5, i32 0, i32 5, i32 4)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = bitcast [6 x i32]* %2 to i8*
%9 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%10 = call i32 @parttionSelect(i32* %9, i32 0, i32 5, i32 1)
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = bitcast [6 x i32]* %3 to i8*
%13 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%14 = call i32 @parttionSelect(i32* %13, i32 0, i32 5, i32 6)
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
ret i32 0
}