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

/* Variables and functions */
int /*<<< orphan*/ heapSort(int *, int);
int /*<<< orphan*/ printf(char *, int);
int heapSort_test() {
  int i = 0;
  int arry[20] = {0};
  arry[i++] = 26;
  arry[i++] = 5;
  arry[i++] = 77;
  arry[i++] = 1;
  arry[i++] = 61;
  arry[i++] = 11;
  arry[i++] = 59;
  arry[i++] = 15;
  arry[i++] = 48;
  arry[i++] = 19;
  heapSort(arry, 10);
  for (i = 0; i < sizeof(arry) / sizeof(int); i++) {
    printf("%d\n", arry[i]);
  }
}


x86 assembly (clang, -O0):
<heapSort_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x8(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x50,%edx
call   1050 <memset@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cltq
movl   $0x1a,-0x60(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cltq
movl   $0x5,-0x60(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cltq
movl   $0x4d,-0x60(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cltq
movl   $0x1,-0x60(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cltq
movl   $0x3d,-0x60(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cltq
movl   $0xb,-0x60(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cltq
movl   $0x3b,-0x60(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cltq
movl   $0xf,-0x60(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cltq
movl   $0x30,-0x60(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cltq
movl   $0x13,-0x60(%rbp,%rax,4)
lea    -0x60(%rbp),%rdi
mov    $0xa,%esi
call   1030 <heapSort@plt>
movl   $0x0,-0x8(%rbp)
movslq -0x8(%rbp),%rax
cmp    $0x14,%rax
jae    1266 <heapSort_test+0x136>
movslq -0x8(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%esi
lea    0xdad(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1236 <heapSort_test+0x106>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<heapSort_test>:
push   %rbx
sub    $0x50,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps 0xec2(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xec7(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movabs $0x1300000030,%rax
mov    %rax,0x20(%rsp)
mov    %rsp,%rdi
mov    $0xa,%esi
call   1030 <heapSort@plt>
mov    (%rsp),%esi
lea    0xeac(%rip),%rbx
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x28(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x2c(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x30(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x34(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x38(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x3c(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x40(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x44(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x48(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    0x4c(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @heapSort_test() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [20 x i32]
store i32 0, i32* %2
%4 = bitcast [20 x i32]* %3 to i8*
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 1
store i32 %6, i32* %2
%7 = sext i32 %5 to i64
%8 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %7
store i32 26, i32* %8
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 1
store i32 %10, i32* %2
%11 = sext i32 %9 to i64
%12 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %11
store i32 5, i32* %12
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 1
store i32 %14, i32* %2
%15 = sext i32 %13 to i64
%16 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %15
store i32 77, i32* %16
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
%19 = sext i32 %17 to i64
%20 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %19
store i32 1, i32* %20
%21 = load i32, i32* %2
%22 = add nsw i32 %21, 1
store i32 %22, i32* %2
%23 = sext i32 %21 to i64
%24 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %23
store i32 61, i32* %24
%25 = load i32, i32* %2
%26 = add nsw i32 %25, 1
store i32 %26, i32* %2
%27 = sext i32 %25 to i64
%28 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %27
store i32 11, i32* %28
%29 = load i32, i32* %2
%30 = add nsw i32 %29, 1
store i32 %30, i32* %2
%31 = sext i32 %29 to i64
%32 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %31
store i32 59, i32* %32
%33 = load i32, i32* %2
%34 = add nsw i32 %33, 1
store i32 %34, i32* %2
%35 = sext i32 %33 to i64
%36 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %35
store i32 15, i32* %36
%37 = load i32, i32* %2
%38 = add nsw i32 %37, 1
store i32 %38, i32* %2
%39 = sext i32 %37 to i64
%40 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %39
store i32 48, i32* %40
%41 = load i32, i32* %2
%42 = add nsw i32 %41, 1
store i32 %42, i32* %2
%43 = sext i32 %41 to i64
%44 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %43
store i32 19, i32* %44
%45 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 0
%46 = call i32 @heapSort(i32* %45, i32 10)
store i32 0, i32* %2
br label %47
47: ; preds = %57, %0
%48 = load i32, i32* %2
%49 = sext i32 %48 to i64
%50 = icmp ult i64 %49, 20
br i1 %50, label %51, label %60
51: ; preds = %47
%52 = load i32, i32* %2
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %53
%55 = load i32, i32* %54
%56 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %55)
br label %57
57: ; preds = %51
%58 = load i32, i32* %2
%59 = add nsw i32 %58, 1
store i32 %59, i32* %2
br label %47
60: ; preds = %47
%61 = load i32, i32* %1
ret i32 %61
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @heapSort_test() {
%1 = alloca [20 x i32]
%2 = bitcast [20 x i32]* %1 to i8*
%3 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 8
%4 = bitcast i32* %3 to i8*
%5 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 0
%6 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 1
%7 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 2
%8 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 3
%9 = bitcast [20 x i32]* %1 to <4 x i32>*
store <4 x i32> <i32 26, i32 5, i32 77, i32 1>, <4 x i32>* %9
%10 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 4
%11 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 5
%12 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 6
%13 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 7
%14 = bitcast i32* %10 to <4 x i32>*
store <4 x i32> <i32 61, i32 11, i32 59, i32 15>, <4 x i32>* %14
%15 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 8
store i32 48, i32* %15
%16 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 9
store i32 19, i32* %16
%17 = call i32 @heapSort(i32* %5, i32 10)
%18 = load i32, i32* %5
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %6
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %7
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = load i32, i32* %8
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %24)
%26 = load i32, i32* %10
%27 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %11
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %12
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %13
%33 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %32)
%34 = load i32, i32* %15
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %34)
%36 = load i32, i32* %16
%37 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %36)
%38 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 10
%39 = load i32, i32* %38
%40 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %39)
%41 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 11
%42 = load i32, i32* %41
%43 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %42)
%44 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 12
%45 = load i32, i32* %44
%46 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %45)
%47 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 13
%48 = load i32, i32* %47
%49 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %48)
%50 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 14
%51 = load i32, i32* %50
%52 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %51)
%53 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 15
%54 = load i32, i32* %53
%55 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %54)
%56 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 16
%57 = load i32, i32* %56
%58 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %57)
%59 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 17
%60 = load i32, i32* %59
%61 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %60)
%62 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 18
%63 = load i32, i32* %62
%64 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %63)
%65 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 19
%66 = load i32, i32* %65
%67 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %66)
ret i32 undef
}