#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 */
typedef int /*<<< orphan*/ array;

/* Variables and functions */
double median(double *, double *);
int /*<<< orphan*/ printf(char *, double);
int main(int argc, const char *argv[]) {
  double array[6] = {5, 6, 7, 8, 9, 10};
  printf("size of array == %ld\n", sizeof(array));
  printf("size of *array == %ld\n", sizeof(*array));
  printf("median is %g\n", median(array, array + 6));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1050 <memset@plt>
movsd  0xed2(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xebd(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xea8(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe7b(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe86(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe71(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    0xe8d(%rip),%rdi
movsd  0xe55(%rip),%xmm0
call   1040 <printf@plt>
lea    0xe8f(%rip),%rdi
movsd  0xe39(%rip),%xmm0
call   1040 <printf@plt>
lea    -0x40(%rbp),%rdi
lea    -0x40(%rbp),%rsi
add    $0x30,%rsi
call   1030 <median@plt>
lea    0xe81(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
movaps 0xed5(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xeda(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xede(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0xef2(%rip),%rdi
movsd  0xeda(%rip),%xmm0
call   1040 <printf@plt>
lea    0xef4(%rip),%rdi
movsd  0xece(%rip),%xmm0
call   1040 <printf@plt>
lea    0x30(%rsp),%rsi
mov    %rsp,%rdi
call   1030 <median@plt>
lea    0xeea(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"size of array == %ld\0A\00"
@.str.1 = [23 x i8] c"size of *array == %ld\0A\00"
@.str.2 = [14 x i8] c"median is %g\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [6 x double]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = bitcast [6 x double]* %6 to i8*
%8 = bitcast i8* %7 to [6 x double]*
%9 = getelementptr inbounds [6 x double], [6 x double]* %8, i32 0, i32 0
store double 5.000000e+00, double* %9
%10 = getelementptr inbounds [6 x double], [6 x double]* %8, i32 0, i32 1
store double 6.000000e+00, double* %10
%11 = getelementptr inbounds [6 x double], [6 x double]* %8, i32 0, i32 2
store double 7.000000e+00, double* %11
%12 = getelementptr inbounds [6 x double], [6 x double]* %8, i32 0, i32 3
store double 8.000000e+00, double* %12
%13 = getelementptr inbounds [6 x double], [6 x double]* %8, i32 0, i32 4
store double 9.000000e+00, double* %13
%14 = getelementptr inbounds [6 x double], [6 x double]* %8, i32 0, i32 5
store double 1.000000e+01, double* %14
%15 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), double 4.800000e+01)
%16 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), double 8.000000e+00)
%17 = getelementptr inbounds [6 x double], [6 x double]* %6, i64 0, i64 0
%18 = getelementptr inbounds [6 x double], [6 x double]* %6, i64 0, i64 0
%19 = getelementptr inbounds double, double* %18, i64 6
%20 = call double @median(double* %17, double* %19)
%21 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), double %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"size of array == %ld\0A\00"
@.str.1 = [23 x i8] c"size of *array == %ld\0A\00"
@.str.2 = [14 x i8] c"median is %g\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [6 x double]
%4 = bitcast [6 x double]* %3 to i8*
%5 = getelementptr inbounds [6 x double], [6 x double]* %3, i64 0, i64 0
%6 = bitcast [6 x double]* %3 to <2 x double>*
store <2 x double> <double 5.000000e+00, double 6.000000e+00>, <2 x double>* %6
%7 = getelementptr inbounds [6 x double], [6 x double]* %3, i64 0, i64 2
%8 = bitcast double* %7 to <2 x double>*
store <2 x double> <double 7.000000e+00, double 8.000000e+00>, <2 x double>* %8
%9 = getelementptr inbounds [6 x double], [6 x double]* %3, i64 0, i64 4
%10 = bitcast double* %9 to <2 x double>*
store <2 x double> <double 9.000000e+00, double 1.000000e+01>, <2 x double>* %10
%11 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), double 4.800000e+01)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), double 8.000000e+00)
%13 = getelementptr inbounds [6 x double], [6 x double]* %3, i64 0, i64 6
%14 = call double @median(double* %5, double* %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), double %14)
ret i32 0
}