#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 */
float median(float *, int);
int /*<<< orphan*/ printFloatArray(float *, int);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  float a1[5] = {3.1415, 2.1, 16.33, 14, 0.4};
  float a2[6] = {3.4, 7, 22.33, 31.6, 1.1, 16};
  float medianA1, medianA2;
  medianA1 = median(a1, 5);
  medianA2 = median(a2, 6);
  printf("Median value for a1: %f\nMedian value for a2: %f\n", medianA1,
         medianA2);
  printFloatArray(a1, 5);
  printFloatArray(a2, 6);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeb5(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xebb(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xeb8(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xeb5(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1030 <median@plt>
movss  %xmm0,-0x44(%rbp)
lea    -0x40(%rbp),%rdi
mov    $0x6,%esi
call   1030 <median@plt>
movss  %xmm0,-0x48(%rbp)
movss  -0x44(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x48(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe7a(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1050 <printFloatArray@plt>
lea    -0x40(%rbp),%rdi
mov    $0x6,%esi
call   1050 <printFloatArray@plt>
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    0xec3(%rip),%eax
mov    %eax,0x20(%rsp)
movaps 0xea8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    0xecc(%rip),%rax
mov    %rax,0x40(%rsp)
movaps 0xeb0(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0x5,%esi
call   1030 <median@plt>
movss  %xmm0,0xc(%rsp)
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x6,%esi
call   1030 <median@plt>
movss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm2
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
lea    0xe81(%rip),%rdi
movaps %xmm2,%xmm0
mov    $0x2,%al
call   1050 <printf@plt>
mov    %r14,%rdi
mov    $0x5,%esi
call   1060 <printFloatArray@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1060 <printFloatArray@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.a1 = [5 x float] [float 0x400921CAC0000000, float 0x4000CCCCC0000000, float 0x4030547AE0000000, float 1.400000e+01, float 0x3FD99999A0000000]
@__const.main.a2 = [6 x float] [float 0x400B333340000000, float 7.000000e+00, float 0x4036547AE0000000, float 0x403F9999A0000000, float 0x3FF19999A0000000, float 1.600000e+01]
@.str = [49 x i8] c"Median value for a1: %f\0AMedian value for a2: %f\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x float]
%3 = alloca [6 x float]
%4 = alloca float
%5 = alloca float
store i32 0, i32* %1
%6 = bitcast [5 x float]* %2 to i8*
%7 = bitcast [6 x float]* %3 to i8*
%8 = getelementptr inbounds [5 x float], [5 x float]* %2, i64 0, i64 0
%9 = call float @median(float* %8, i32 5)
store float %9, float* %4
%10 = getelementptr inbounds [6 x float], [6 x float]* %3, i64 0, i64 0
%11 = call float @median(float* %10, i32 6)
store float %11, float* %5
%12 = load float, float* %4
%13 = fpext float %12 to double
%14 = load float, float* %5
%15 = fpext float %14 to double
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), double %13, double %15)
%17 = getelementptr inbounds [5 x float], [5 x float]* %2, i64 0, i64 0
%18 = call i32 @printFloatArray(float* %17, i32 5)
%19 = getelementptr inbounds [6 x float], [6 x float]* %3, i64 0, i64 0
%20 = call i32 @printFloatArray(float* %19, i32 6)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@__const.main.a1 = [5 x float] [float 0x400921CAC0000000, float 0x4000CCCCC0000000, float 0x4030547AE0000000, float 1.400000e+01, float 0x3FD99999A0000000]
@__const.main.a2 = [6 x float] [float 0x400B333340000000, float 7.000000e+00, float 0x4036547AE0000000, float 0x403F9999A0000000, float 0x3FF19999A0000000, float 1.600000e+01]
@.str = [49 x i8] c"Median value for a1: %f\0AMedian value for a2: %f\0A\00"
define i32 @main() {
%1 = alloca [5 x float]
%2 = alloca [6 x float]
%3 = bitcast [5 x float]* %1 to i8*
%4 = bitcast [6 x float]* %2 to i8*
%5 = getelementptr inbounds [5 x float], [5 x float]* %1, i64 0, i64 0
%6 = call float @median(float* %5, i32 5)
%7 = getelementptr inbounds [6 x float], [6 x float]* %2, i64 0, i64 0
%8 = call float @median(float* %7, i32 6)
%9 = fpext float %6 to double
%10 = fpext float %8 to double
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), double %9, double %10)
%12 = call i32 @printFloatArray(float* %5, i32 5)
%13 = call i32 @printFloatArray(float* %7, i32 6)
%14 = call i32 @putchar(i32 10)
ret i32 0
}