#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*/ heaps;

/* Variables and functions */
int /*<<< orphan*/ heapsort(double *, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  double heaps[] = {1.4,   50.2, 5.11,  -1.55, 301.521, 0.3301, 40.17,
                    -18.0, 88.1, 30.44, -37.2, 3012.0,  49.2};
  heapsort(heaps, (sizeof(heaps) / sizeof(heaps[0])));
  printf("{ ");
  for (int i = 0; i < (sizeof(heaps) / sizeof(heaps[0])); i++)
    printf(" %.3f ", heaps[i]);
  printf(" }\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xeb3(%rip),%rsi
mov    $0x68,%edx
call   1050 <memcpy@plt>
lea    -0x70(%rbp),%rdi
mov    $0xd,%esi
call   1040 <heapsort@plt>
lea    0xefc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x74(%rbp)
movslq -0x74(%rbp),%rax
cmp    $0xd,%rax
jae    11ae <main+0x7e>
movslq -0x74(%rbp),%rax
movsd  -0x70(%rbp,%rax,8),%xmm0
lea    0xed2(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    117a <main+0x4a>
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
mov    0xf24(%rip),%rax
mov    %rax,0x60(%rsp)
movaps 0xf08(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xeec(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xed0(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xeb4(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe98(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe7c(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0xd,%esi
call   1050 <heapsort@plt>
lea    0xecc(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
lea    0xebc(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x10(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x18(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x20(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x28(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x30(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x38(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x40(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x48(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x50(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x58(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x60(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xdf2(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.heaps = [13 x double] [double 1.400000e+00, double 5.020000e+01, double 5.110000e+00, double -1.550000e+00, double 3.015210e+02, double 3.301000e-01, double 4.017000e+01, double -1.800000e+01, double 8.810000e+01, double 3.044000e+01, double -3.720000e+01, double 3.012000e+03, double 4.920000e+01]
@.str = [3 x i8] c"{ \00"
@.str.1 = [7 x i8] c" %.3f \00"
@.str.2 = [4 x i8] c" }\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [13 x double]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [13 x double]* %2 to i8*
%5 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 0
%6 = call i32 @heapsort(double* %5, i32 13)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %8
8: ; preds = %18, %0
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = icmp ult i64 %10, 13
br i1 %11, label %12, label %21
12: ; preds = %8
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [13 x double], [13 x double]* %2, i64 0, i64 %14
%16 = load double, double* %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %16)
br label %18
18: ; preds = %12
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %8
21: ; preds = %8
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@__const.main.heaps = [13 x double] [double 1.400000e+00, double 5.020000e+01, double 5.110000e+00, double -1.550000e+00, double 3.015210e+02, double 3.301000e-01, double 4.017000e+01, double -1.800000e+01, double 8.810000e+01, double 3.044000e+01, double -3.720000e+01, double 3.012000e+03, double 4.920000e+01]
@.str = [3 x i8] c"{ \00"
@.str.1 = [7 x i8] c" %.3f \00"
@str = [3 x i8] c" }\00"
define i32 @main() {
%1 = alloca [13 x double]
%2 = bitcast [13 x double]* %1 to i8*
%3 = getelementptr inbounds [13 x double], [13 x double]* %1, i64 0, i64 0
%4 = call i32 @heapsort(double* %3, i32 13)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = load double, double* %3
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %6)
%8 = getelementptr inbounds [13 x double], [13 x double]* %1, i64 0, i64 1
%9 = load double, double* %8
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %9)
%11 = getelementptr inbounds [13 x double], [13 x double]* %1, i64 0, i64 2
%12 = load double, double* %11
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %12)
%14 = getelementptr inbounds [13 x double], [13 x double]* %1, i64 0, i64 3
%15 = load double, double* %14
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %15)
%17 = getelementptr inbounds [13 x double], [13 x double]* %1, i64 0, i64 4
%18 = load double, double* %17
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %18)
%20 = getelementptr inbounds [13 x double], [13 x double]* %1, i64 0, i64 5
%21 = load double, double* %20
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %21)
%23 = getelementptr inbounds [13 x double], [13 x double]* %1, i64 0, i64 6
%24 = load double, double* %23
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %24)
%26 = getelementptr inbounds [13 x double], [13 x double]* %1, i64 0, i64 7
%27 = load double, double* %26
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %27)
%29 = getelementptr inbounds [13 x double], [13 x double]* %1, i64 0, i64 8
%30 = load double, double* %29
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %30)
%32 = getelementptr inbounds [13 x double], [13 x double]* %1, i64 0, i64 9
%33 = load double, double* %32
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %33)
%35 = getelementptr inbounds [13 x double], [13 x double]* %1, i64 0, i64 10
%36 = load double, double* %35
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %36)
%38 = getelementptr inbounds [13 x double], [13 x double]* %1, i64 0, i64 11
%39 = load double, double* %38
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %39)
%41 = getelementptr inbounds [13 x double], [13 x double]* %1, i64 0, i64 12
%42 = load double, double* %41
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %42)
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret i32 0
}