#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 median(double *, int, double *);
int /*<<< orphan*/ printf(char *, double);
int main(int argc, char const *argv[]) {
  double data[14] = {1.0, 2.1, 3.2,  4.5,  5.5,  6.2,  7.4,
                     8.5, 9.1, 10.4, 11.3, 12.5, 13.2, 14.7};
  double m;
  int proc = median(data, 14, &m);
  printf("Median %f \n", m);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
lea    0xeac(%rip),%rsi
mov    $0x70,%edx
call   1050 <memcpy@plt>
lea    -0x80(%rbp),%rdi
mov    $0xe,%esi
lea    -0x88(%rbp),%rdx
call   1030 <median@plt>
mov    %eax,-0x8c(%rbp)
movsd  -0x88(%rbp),%xmm0
ff
lea    0xee8(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x88,%rsp
movaps 0xf32(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xf16(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xefa(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xede(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xec2(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xea6(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe8a(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rdx
mov    $0xe,%esi
call   1030 <median@plt>
movsd  0x8(%rsp),%xmm0
lea    0xed4(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x88,%rsp
ret

LLVM IR (-O0):
@__const.main.data = [14 x double] [double 1.000000e+00, double 2.100000e+00, double 3.200000e+00, double 4.500000e+00, double 5.500000e+00, double 6.200000e+00, double 7.400000e+00, double 8.500000e+00, double 9.100000e+00, double 1.040000e+01, double 1.130000e+01, double 1.250000e+01, double 1.320000e+01, double 1.470000e+01]
@.str = [12 x i8] c"Median %f \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [14 x double]
%7 = alloca double
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = bitcast [14 x double]* %6 to i8*
%10 = getelementptr inbounds [14 x double], [14 x double]* %6, i64 0, i64 0
%11 = call i32 @median(double* %10, i32 14, double* %7)
store i32 %11, i32* %8
%12 = load double, double* %7
%13 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double %12)
ret i32 0
}

LLVM IR (-O2):
@__const.main.data = [14 x double] [double 1.000000e+00, double 2.100000e+00, double 3.200000e+00, double 4.500000e+00, double 5.500000e+00, double 6.200000e+00, double 7.400000e+00, double 8.500000e+00, double 9.100000e+00, double 1.040000e+01, double 1.130000e+01, double 1.250000e+01, double 1.320000e+01, double 1.470000e+01]
@.str = [12 x i8] c"Median %f \0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [14 x double]
%4 = alloca double
%5 = bitcast [14 x double]* %3 to i8*
%6 = bitcast double* %4 to i8*
%7 = getelementptr inbounds [14 x double], [14 x double]* %3, i64 0, i64 0
%8 = call i32 @median(double* %7, i32 14, double* %4)
%9 = load double, double* %4
%10 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double %9)
ret i32 0
}