#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 *, ...);
void print_heap(double *data, int N) {
  int i;
  printf("\n");
  for (i = 0; i < (N - 1) / 2; i++)
    printf("%.10f %.10f %.10f\n", data[i], data[2 * i + 1], data[2 * i + 2]);
}


x86 assembly (clang, -O0):
<print_heap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeeb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
jge    11a8 <print_heap+0x98>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
shl    $0x1,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
lea    0xe6d(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1134 <print_heap+0x24>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_heap>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %rdi,%r12
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    $0x3,%r14d
jl     1187 <print_heap+0x67>
add    $0xffffffff,%r14d
shr    %r14d
shl    $0x3,%r14
xor    %ebx,%ebx
lea    0xeae(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%r12,%rbx,1),%xmm0
movsd  0x8(%r12,%rbx,2),%xmm1
movsd  0x10(%r12,%rbx,2),%xmm2
mov    %r15,%rdi
mov    $0x3,%al
call   1040 <printf@plt>
add    $0x8,%rbx
cmp    %rbx,%r14
jne    1160 <print_heap+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [19 x i8] c"%.10f %.10f %.10f\0A\00"
define void @print_heap(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
%5 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %7
7: ; preds = %34, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = sub nsw i32 %9, 1
%11 = sdiv i32 %10, 2
%12 = icmp slt i32 %8, %11
br i1 %12, label %13, label %37
13: ; preds = %7
%14 = load double*, double** %3
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds double, double* %14, i64 %16
%18 = load double, double* %17
%19 = load double*, double** %3
%20 = load i32, i32* %5
%21 = mul nsw i32 2, %20
%22 = add nsw i32 %21, 1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %19, i64 %23
%25 = load double, double* %24
%26 = load double*, double** %3
%27 = load i32, i32* %5
%28 = mul nsw i32 2, %27
%29 = add nsw i32 %28, 2
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double, double* %26, i64 %30
%32 = load double, double* %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), double %18, double %25, double %32)
br label %34
34: ; preds = %13
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 1
store i32 %36, i32* %5
br label %7
37: ; preds = %7
ret void
}

LLVM IR (-O2):
@.str.1 = [19 x i8] c"%.10f %.10f %.10f\0A\00"
define void @print_heap(double* nocapture %0, i32 %1) {
%3 = tail call i32 @putchar(i32 10)
%4 = icmp sgt i32 %1, 2
br i1 %4, label %5, label %23
5: ; preds = %2
%6 = add nsw i32 %1, -1
%7 = lshr i32 %6, 1
%8 = zext i32 %7 to i64
br label %9
9: ; preds = %5, %9
%10 = phi i64 [ 0, %5 ], [ %21, %9 ]
%11 = getelementptr inbounds double, double* %0, i64 %10
%12 = load double, double* %11
%13 = shl nuw nsw i64 %10, 1
%14 = or i64 %13, 1
%15 = getelementptr inbounds double, double* %0, i64 %14
%16 = load double, double* %15
%17 = add nuw nsw i64 %13, 2
%18 = getelementptr inbounds double, double* %0, i64 %17
%19 = load double, double* %18
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), double %12, double %16, double %19)
%21 = add nuw nsw i64 %10, 1
%22 = icmp eq i64 %21, %8
br i1 %22, label %23, label %9
23: ; preds = %9, %2
ret void
}