#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int iNum, i, j;
  float faArr1[50], fTemp;
  float *fPtr;
  float fMedian;
  fPtr = faArr1;
  printf("\nEnter the no of elements in the array\n");
  scanf("%d", &iNum);
  printf("\nEnter elements of Array\n");
  for (i = 0; i < iNum; i++)
    scanf("%f", fPtr + i);
  printf("\nThe elements of Array\n");
  for (i = 0; i < iNum; i++)
    printf("%0.2f \t", *(fPtr + i));
  for (i = 0; i < iNum - 1; i++) {
    for (j = i + 1; j < iNum; j++) {
      if (faArr1[i] > faArr1[j]) {
        fTemp = faArr1[i];
        faArr1[i] = faArr1[j];
        faArr1[j] = fTemp;
      }
    }
  }
  if (iNum % 2)
    fMedian = *(fPtr + (iNum / 2));
  else
    fMedian = (*(fPtr + (iNum / 2)) + *(fPtr + (iNum / 2) - 1)) / 2.0f;
  printf("\nMedian = %g\n", fMedian);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xe0(%rbp),%rax
mov    %rax,-0xf0(%rbp)
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11af <main+0x8f>
mov    -0xf0(%rbp),%rsi
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1175 <main+0x55>
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1200 <main+0xe0>
mov    -0xf0(%rbp),%rax
movslq -0xc(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe79(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c4 <main+0xa4>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    12b6 <main+0x196>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12a3 <main+0x183>
movslq -0xc(%rbp),%rax
movss  -0xe0(%rbp,%rax,4),%xmm0
ff ff
movslq -0x10(%rbp),%rax
ucomiss -0xe0(%rbp,%rax,4),%xmm0
ff
jbe    1290 <main+0x170>
movslq -0xc(%rbp),%rax
movss  -0xe0(%rbp,%rax,4),%xmm0
ff ff
movss  %xmm0,-0xe4(%rbp)
ff
movslq -0x10(%rbp),%rax
movss  -0xe0(%rbp,%rax,4),%xmm0
ff ff
movslq -0xc(%rbp),%rax
movss  %xmm0,-0xe0(%rbp,%rax,4)
ff ff
movss  -0xe4(%rbp),%xmm0
ff
movslq -0x10(%rbp),%rax
movss  %xmm0,-0xe0(%rbp,%rax,4)
ff ff
jmp    1295 <main+0x175>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1221 <main+0x101>
jmp    12a8 <main+0x188>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1207 <main+0xe7>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1301 <main+0x1e1>
mov    -0xf0(%rbp),%rax
mov    %rax,-0x100(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x100(%rbp),%rax
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0xf4(%rbp)
ff
jmp    136a <main+0x24a>
mov    -0xf0(%rbp),%rax
mov    %rax,-0x110(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x110(%rbp),%rax
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0xf0(%rbp),%rax
mov    %rax,-0x108(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x108(%rbp),%rax
movslq %ecx,%rcx
addss  -0x4(%rax,%rcx,4),%xmm0
movss  0xca2(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0xf4(%rbp)
ff
movss  -0xf4(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xcef(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xe0,%rsp
lea    0xedd(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb5(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x0,0xc(%rsp)
jle    119f <main+0x6f>
lea    0x10(%rsp),%r15
lea    0xe8d(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
add    $0x4,%r15
cmp    %rax,%rbx
jl     1180 <main+0x50>
lea    0xeba(%rip),%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    1246 <main+0x116>
xor    %ebx,%ebx
lea    0xe4a(%rip),%r14
movss  0x10(%rsp,%rbx,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     11c0 <main+0x90>
cmp    $0x2,%eax
jl     1246 <main+0x116>
mov    %eax,%r8d
lea    -0x1(%rax),%r9d
lea    0x10(%rsp),%rsi
xor    %ecx,%ecx
mov    %r8,%rdi
jmp    120d <main+0xdd>
nopw   0x0(%rax,%rax,1)
add    $0x4,%rsi
add    $0xffffffffffffffff,%rdi
cmp    %r9,%rcx
je     1246 <main+0x116>
mov    %rcx,%rbx
add    $0x1,%rcx
cmp    %r8,%rcx
jae    1200 <main+0xd0>
mov    $0x1,%edx
jmp    1229 <main+0xf9>
add    $0x1,%rdx
cmp    %rdx,%rdi
je     1200 <main+0xd0>
movss  0x10(%rsp,%rbx,4),%xmm0
movss  (%rsi,%rdx,4),%xmm1
ucomiss %xmm1,%xmm0
jbe    1220 <main+0xf0>
movss  %xmm1,0x10(%rsp,%rbx,4)
movss  %xmm0,(%rsi,%rdx,4)
jmp    1220 <main+0xf0>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
movslq %ecx,%rcx
movss  0x10(%rsp,%rcx,4),%xmm0
test   $0x1,%al
jne    126a <main+0x13a>
addss  0xc(%rsp,%rcx,4),%xmm0
mulss  0xd96(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd9d(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [40 x i8] c"\0AEnter the no of elements in the array\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [26 x i8] c"\0AEnter elements of Array\0A\00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [24 x i8] c"\0AThe elements of Array\0A\00"
@.str.5 = [8 x i8] c"%0.2f \09\00"
@.str.6 = [14 x i8] c"\0AMedian = %g\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [50 x float]
%6 = alloca float
%7 = alloca float*
%8 = alloca float
store i32 0, i32* %1
%9 = getelementptr inbounds [50 x float], [50 x float]* %5, i64 0, i64 0
store float* %9, float** %7
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %13
13: ; preds = %23, %0
%14 = load i32, i32* %3
%15 = load i32, i32* %2
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %26
17: ; preds = %13
%18 = load float*, float** %7
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds float, float* %18, i64 %20
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %21)
br label %23
23: ; preds = %17
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %13
26: ; preds = %13
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %3
br label %28
28: ; preds = %40, %26
%29 = load i32, i32* %3
%30 = load i32, i32* %2
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %43
32: ; preds = %28
%33 = load float*, float** %7
%34 = load i32, i32* %3
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds float, float* %33, i64 %35
%37 = load float, float* %36
%38 = fpext float %37 to double
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), double %38)
br label %40
40: ; preds = %32
%41 = load i32, i32* %3
%42 = add nsw i32 %41, 1
store i32 %42, i32* %3
br label %28
43: ; preds = %28
store i32 0, i32* %3
br label %44
44: ; preds = %87, %43
%45 = load i32, i32* %3
%46 = load i32, i32* %2
%47 = sub nsw i32 %46, 1
%48 = icmp slt i32 %45, %47
br i1 %48, label %49, label %90
49: ; preds = %44
%50 = load i32, i32* %3
%51 = add nsw i32 %50, 1
store i32 %51, i32* %4
br label %52
52: ; preds = %83, %49
%53 = load i32, i32* %4
%54 = load i32, i32* %2
%55 = icmp slt i32 %53, %54
br i1 %55, label %56, label %86
56: ; preds = %52
%57 = load i32, i32* %3
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [50 x float], [50 x float]* %5, i64 0, i64 %58
%60 = load float, float* %59
%61 = load i32, i32* %4
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [50 x float], [50 x float]* %5, i64 0, i64 %62
%64 = load float, float* %63
%65 = fcmp ogt float %60, %64
br i1 %65, label %66, label %82
66: ; preds = %56
%67 = load i32, i32* %3
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [50 x float], [50 x float]* %5, i64 0, i64 %68
%70 = load float, float* %69
store float %70, float* %6
%71 = load i32, i32* %4
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [50 x float], [50 x float]* %5, i64 0, i64 %72
%74 = load float, float* %73
%75 = load i32, i32* %3
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds [50 x float], [50 x float]* %5, i64 0, i64 %76
store float %74, float* %77
%78 = load float, float* %6
%79 = load i32, i32* %4
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds [50 x float], [50 x float]* %5, i64 0, i64 %80
store float %78, float* %81
br label %82
82: ; preds = %66, %56
br label %83
83: ; preds = %82
%84 = load i32, i32* %4
%85 = add nsw i32 %84, 1
store i32 %85, i32* %4
br label %52
86: ; preds = %52
br label %87
87: ; preds = %86
%88 = load i32, i32* %3
%89 = add nsw i32 %88, 1
store i32 %89, i32* %3
br label %44
90: ; preds = %44
%91 = load i32, i32* %2
%92 = srem i32 %91, 2
%93 = icmp ne i32 %92, 0
br i1 %93, label %94, label %101
94: ; preds = %90
%95 = load float*, float** %7
%96 = load i32, i32* %2
%97 = sdiv i32 %96, 2
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds float, float* %95, i64 %98
%100 = load float, float* %99
store float %100, float* %8
br label %117
101: ; preds = %90
%102 = load float*, float** %7
%103 = load i32, i32* %2
%104 = sdiv i32 %103, 2
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds float, float* %102, i64 %105
%107 = load float, float* %106
%108 = load float*, float** %7
%109 = load i32, i32* %2
%110 = sdiv i32 %109, 2
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds float, float* %108, i64 %111
%113 = getelementptr inbounds float, float* %112, i64 -1
%114 = load float, float* %113
%115 = fadd float %107, %114
%116 = fdiv float %115, 2.000000e+00
store float %116, float* %8
br label %117
117: ; preds = %101, %94
%118 = load float, float* %8
%119 = fpext float %118 to double
%120 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), double %119)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [3 x i8] c"%f\00"
@.str.5 = [8 x i8] c"%0.2f \09\00"
@.str.6 = [14 x i8] c"\0AMedian = %g\0A\00"
@str = [39 x i8] c"\0AEnter the no of elements in the array\00"
@str.7 = [25 x i8] c"\0AEnter elements of Array\00"
@str.8 = [23 x i8] c"\0AThe elements of Array\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [50 x float]
%3 = bitcast i32* %1 to i8*
%4 = bitcast [50 x float]* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.7, i64 0, i64 0))
%8 = load i32, i32* %1
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %0, %10
%11 = phi i64 [ %14, %10 ], [ 0, %0 ]
%12 = getelementptr inbounds [50 x float], [50 x float]* %2, i64 0, i64 %11
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %12)
%14 = add nuw nsw i64 %11, 1
%15 = load i32, i32* %1
%16 = sext i32 %15 to i64
%17 = icmp slt i64 %14, %16
br i1 %17, label %10, label %18
18: ; preds = %10, %0
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.8, i64 0, i64 0))
%20 = load i32, i32* %1
%21 = icmp sgt i32 %20, 0
br i1 %21, label %29, label %59
22: ; preds = %29
%23 = icmp sgt i32 %36, 1
br i1 %23, label %24, label %59
24: ; preds = %22
%25 = add nsw i32 %36, -1
%26 = zext i32 %36 to i64
%27 = zext i32 %25 to i64
%28 = zext i32 %36 to i64
br label %42
29: ; preds = %18, %29
%30 = phi i64 [ %35, %29 ], [ 0, %18 ]
%31 = getelementptr inbounds [50 x float], [50 x float]* %2, i64 0, i64 %30
%32 = load float, float* %31
%33 = fpext float %32 to double
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), double %33)
%35 = add nuw nsw i64 %30, 1
%36 = load i32, i32* %1
%37 = sext i32 %36 to i64
%38 = icmp slt i64 %35, %37
br i1 %38, label %29, label %22
39: ; preds = %56, %42
%40 = add nuw nsw i64 %44, 1
%41 = icmp eq i64 %45, %27
br i1 %41, label %59, label %42
42: ; preds = %24, %39
%43 = phi i64 [ 0, %24 ], [ %45, %39 ]
%44 = phi i64 [ 1, %24 ], [ %40, %39 ]
%45 = add nuw nsw i64 %43, 1
%46 = icmp ult i64 %45, %26
br i1 %46, label %47, label %39
47: ; preds = %42
%48 = getelementptr inbounds [50 x float], [50 x float]* %2, i64 0, i64 %43
br label %49
49: ; preds = %47, %56
%50 = phi i64 [ %44, %47 ], [ %57, %56 ]
%51 = load float, float* %48
%52 = getelementptr inbounds [50 x float], [50 x float]* %2, i64 0, i64 %50
%53 = load float, float* %52
%54 = fcmp ogt float %51, %53
br i1 %54, label %55, label %56
55: ; preds = %49
store float %53, float* %48
store float %51, float* %52
br label %56
56: ; preds = %49, %55
%57 = add nuw nsw i64 %50, 1
%58 = icmp eq i64 %57, %28
br i1 %58, label %39, label %49
59: ; preds = %39, %18, %22
%60 = phi i32 [ %36, %22 ], [ %20, %18 ], [ %36, %39 ]
%61 = and i32 %60, 1
%62 = icmp eq i32 %61, 0
%63 = sdiv i32 %60, 2
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [50 x float], [50 x float]* %2, i64 0, i64 %64
%66 = load float, float* %65
br i1 %62, label %67, label %72
67: ; preds = %59
%68 = getelementptr inbounds float, float* %65, i64 -1
%69 = load float, float* %68
%70 = fadd float %66, %69
%71 = fmul float %70, 5.000000e-01
br label %72
72: ; preds = %59, %67
%73 = phi float [ %71, %67 ], [ %66, %59 ]
%74 = fpext float %73 to double
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), double %74)
ret i32 0
}