#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*/ bubbleSort(int *);
int /*<<< orphan*/ printArray(int *);
int /*<<< orphan*/ printf(char *, ...);
void median(int answer[]) {
  printf("\n%s\n%s\n%s\n%s", "********", "Median", "********",
         "The unsorted array of response is");
  printArray(answer);
  bubbleSort(answer);
  printf("\n\nThe sorted array is");
  printArray(answer);
  printf("\n\nThe median is element %d of\n"
         "the sorted %d element array.\n"
         "For this run the median is %d\n\n",
         99 / 2, 99, answer[99 / 2]);
}


x86 assembly (clang, -O0):
<median>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xebd(%rip),%rdi
lea    0xec3(%rip),%rcx
lea    0xec5(%rip),%rdx
lea    0xec5(%rip),%r8
mov    %rcx,%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1050 <printArray@plt>
mov    -0x8(%rbp),%rdi
call   1040 <bubbleSort@plt>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1050 <printArray@plt>
mov    -0x8(%rbp),%rax
mov    0xc4(%rax),%ecx
lea    0xeb9(%rip),%rdi
mov    $0x31,%esi
mov    $0x63,%edx
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<median>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rdi
lea    0xed4(%rip),%rdx
lea    0xec4(%rip),%rcx
lea    0xecd(%rip),%r8
mov    %rcx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1050 <printArray@plt>
mov    %rbx,%rdi
call   1040 <bubbleSort@plt>
lea    0xece(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1050 <printArray@plt>
mov    0xc4(%rbx),%ecx
lea    0xec8(%rip),%rdi
mov    $0x31,%esi
mov    $0x63,%edx
xor    %eax,%eax
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"\0A%s\0A%s\0A%s\0A%s\00"
@.str.1 = [9 x i8] c"********\00"
@.str.2 = [7 x i8] c"Median\00"
@.str.3 = [34 x i8] c"The unsorted array of response is\00"
@.str.4 = [22 x i8] c"\0A\0AThe sorted array is\00"
@.str.5 = [91 x i8] c"\0A\0AThe median is element %d of\0Athe sorted %d element array.\0AFor this run the median is %d\0A\0A\00"
define void @median(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%4 = load i32*, i32** %2
%5 = call i32 @printArray(i32* %4)
%6 = load i32*, i32** %2
%7 = call i32 @bubbleSort(i32* %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%9 = load i32*, i32** %2
%10 = call i32 @printArray(i32* %9)
%11 = load i32*, i32** %2
%12 = getelementptr inbounds i32, i32* %11, i64 49
%13 = load i32, i32* %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str.5, i64 0, i64 0), i32 49, i32 99, i32 %13)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"\0A%s\0A%s\0A%s\0A%s\00"
@.str.1 = [9 x i8] c"********\00"
@.str.2 = [7 x i8] c"Median\00"
@.str.3 = [34 x i8] c"The unsorted array of response is\00"
@.str.4 = [22 x i8] c"\0A\0AThe sorted array is\00"
@.str.5 = [91 x i8] c"\0A\0AThe median is element %d of\0Athe sorted %d element array.\0AFor this run the median is %d\0A\0A\00"
define void @median(i32* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%3 = tail call i32 @printArray(i32* %0)
%4 = tail call i32 @bubbleSort(i32* %0)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%6 = tail call i32 @printArray(i32* %0)
%7 = getelementptr inbounds i32, i32* %0, i64 49
%8 = load i32, i32* %7
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([91 x i8], [91 x i8]* @.str.5, i64 0, i64 0), i32 49, i32 99, i32 %8)
ret void
}