#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 EXIT_SUCCESS;
int /*<<< orphan*/ binarySearch(int, int *, int);
int /*<<< orphan*/ bubblesort(int, int *);
int /*<<< orphan*/ linearSearch(int, int *, int);
int /*<<< orphan*/ quicksort(int *, int);
int main(int argc, char *argv[]) {
  int sortedArray[10] = {13, 21, 32, 47, 50, 61, 66, 85, 90, 99};
  linearSearch(10, sortedArray, 61);
  binarySearch(10, sortedArray, 61);
  int unsortedArray[10] = {50, 32, 99, 66, 85, 13, 21, 47, 90, 61};
  linearSearch(10, unsortedArray, 61);
  binarySearch(10, unsortedArray, 61);
  bubblesort(10, unsortedArray);
  binarySearch(10, unsortedArray, 61);
  int array[10] = {50, 32, 99, 66, 85, 13, 21, 47, 90, 61};
  quicksort(array, 10);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xe8c(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
lea    -0x40(%rbp),%rsi
mov    $0xa,%edi
mov    $0x3d,%edx
call   1030 <linearSearch@plt>
lea    -0x40(%rbp),%rsi
mov    $0xa,%edi
mov    $0x3d,%edx
call   1060 <binarySearch@plt>
lea    -0x70(%rbp),%rdi
lea    0xe81(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
lea    -0x70(%rbp),%rsi
mov    $0xa,%edi
mov    $0x3d,%edx
call   1030 <linearSearch@plt>
lea    -0x70(%rbp),%rsi
mov    $0xa,%edi
mov    $0x3d,%edx
call   1060 <binarySearch@plt>
lea    -0x70(%rbp),%rsi
mov    $0xa,%edi
call   1070 <bubblesort@plt>
lea    -0x70(%rbp),%rsi
mov    $0xa,%edi
mov    $0x3d,%edx
call   1060 <binarySearch@plt>
lea    -0xa0(%rbp),%rdi
lea    0xe52(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
lea    -0xa0(%rbp),%rdi
mov    $0xa,%esi
call   1040 <quicksort@plt>
mov    0x2db0(%rip),%rax
mov    (%rax),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    0xecf(%rip),%rax
mov    %rax,0x80(%rsp)
movaps 0xeb0(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xe94(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
lea    0x60(%rsp),%rbx
mov    $0xa,%edi
mov    %rbx,%rsi
mov    $0x3d,%edx
call   1030 <linearSearch@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
mov    $0x3d,%edx
call   1050 <binarySearch@plt>
mov    0xeaf(%rip),%r14
mov    %r14,0x50(%rsp)
movaps 0xe93(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xe77(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
lea    0x30(%rsp),%rbx
mov    $0xa,%edi
mov    %rbx,%rsi
mov    $0x3d,%edx
call   1030 <linearSearch@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
mov    $0x3d,%edx
call   1050 <binarySearch@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1060 <bubblesort@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
mov    $0x3d,%edx
call   1050 <binarySearch@plt>
mov    %r14,0x20(%rsp)
movaps 0xe2e(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe12(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0xa,%esi
call   1040 <quicksort@plt>
mov    0x2daa(%rip),%rax
mov    (%rax),%eax
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.sortedArray = [10 x i32] [i32 13, i32 21, i32 32, i32 47, i32 50, i32 61, i32 66, i32 85, i32 90, i32 99]
@__const.main.unsortedArray = [10 x i32] [i32 50, i32 32, i32 99, i32 66, i32 85, i32 13, i32 21, i32 47, i32 90, i32 61]
@__const.main.array = [10 x i32] [i32 50, i32 32, i32 99, i32 66, i32 85, i32 13, i32 21, i32 47, i32 90, i32 61]
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [10 x i32]
%7 = alloca [10 x i32]
%8 = alloca [10 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = bitcast [10 x i32]* %6 to i8*
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 0
%11 = call i32 @linearSearch(i32 10, i32* %10, i32 61)
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 0
%13 = call i32 @binarySearch(i32 10, i32* %12, i32 61)
%14 = bitcast [10 x i32]* %7 to i8*
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %7, i64 0, i64 0
%16 = call i32 @linearSearch(i32 10, i32* %15, i32 61)
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %7, i64 0, i64 0
%18 = call i32 @binarySearch(i32 10, i32* %17, i32 61)
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %7, i64 0, i64 0
%20 = call i32 @bubblesort(i32 10, i32* %19)
%21 = getelementptr inbounds [10 x i32], [10 x i32]* %7, i64 0, i64 0
%22 = call i32 @binarySearch(i32 10, i32* %21, i32 61)
%23 = bitcast [10 x i32]* %8 to i8*
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %8, i64 0, i64 0
%25 = call i32 @quicksort(i32* %24, i32 10)
%26 = load i32, i32* @EXIT_SUCCESS
ret i32 %26
}

LLVM IR (-O2):
@__const.main.sortedArray = [10 x i32] [i32 13, i32 21, i32 32, i32 47, i32 50, i32 61, i32 66, i32 85, i32 90, i32 99]
@__const.main.array = [10 x i32] [i32 50, i32 32, i32 99, i32 66, i32 85, i32 13, i32 21, i32 47, i32 90, i32 61]
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10 x i32]
%4 = alloca [10 x i32]
%5 = alloca [10 x i32]
%6 = bitcast [10 x i32]* %3 to i8*
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%8 = call i32 @linearSearch(i32 10, i32* %7, i32 61)
%9 = call i32 @binarySearch(i32 10, i32* %7, i32 61)
%10 = bitcast [10 x i32]* %4 to i8*
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 0
%12 = call i32 @linearSearch(i32 10, i32* %11, i32 61)
%13 = call i32 @binarySearch(i32 10, i32* %11, i32 61)
%14 = call i32 @bubblesort(i32 10, i32* %11)
%15 = call i32 @binarySearch(i32 10, i32* %11, i32 61)
%16 = bitcast [10 x i32]* %5 to i8*
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 0
%18 = call i32 @quicksort(i32* %17, i32 10)
%19 = load i32, i32* @EXIT_SUCCESS
ret i32 %19
}