#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*/ heapSort();
int /*<<< orphan*/ heapify();
int /*<<< orphan*/ insert(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ showElements();
int main() {
  printf("\n:: Inserting Elements in array ::\n");
  insert(10);
  insert(12);
  insert(1);
  insert(9);
  insert(7);
  insert(6);
  insert(8);
  printf("\n:: Elements in array ::\n");
  showElements();
  printf("\n:: Heapify ::\n");
  heapify();
  printf("\n:: Heap Sort ::\n");
  heapSort();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1050 <insert@plt>
mov    $0xc,%edi
call   1050 <insert@plt>
mov    $0x1,%edi
call   1050 <insert@plt>
mov    $0x9,%edi
call   1050 <insert@plt>
mov    $0x7,%edi
call   1050 <insert@plt>
mov    $0x6,%edi
call   1050 <insert@plt>
mov    $0x8,%edi
call   1050 <insert@plt>
lea    0xe77(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <showElements@plt>
lea    0xe7e(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1070 <heapify@plt>
lea    0xe7b(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <heapSort@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xea8(%rip),%rdi
call   1030 <puts@plt>
mov    $0xa,%edi
call   1050 <insert@plt>
mov    $0xc,%edi
call   1050 <insert@plt>
mov    $0x1,%edi
call   1050 <insert@plt>
mov    $0x9,%edi
call   1050 <insert@plt>
mov    $0x7,%edi
call   1050 <insert@plt>
mov    $0x6,%edi
call   1050 <insert@plt>
mov    $0x8,%edi
call   1050 <insert@plt>
lea    0xe79(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <showElements@plt>
lea    0xe7f(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1070 <heapify@plt>
lea    0xe7b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <heapSort@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"\0A:: Inserting Elements in array ::\0A\00"
@.str.1 = [26 x i8] c"\0A:: Elements in array ::\0A\00"
@.str.2 = [16 x i8] c"\0A:: Heapify ::\0A\00"
@.str.3 = [18 x i8] c"\0A:: Heap Sort ::\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @insert(i32 10)
%3 = call i32 @insert(i32 12)
%4 = call i32 @insert(i32 1)
%5 = call i32 @insert(i32 9)
%6 = call i32 @insert(i32 7)
%7 = call i32 @insert(i32 6)
%8 = call i32 @insert(i32 8)
%9 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 (...) @showElements()
%11 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 (...) @heapify()
%13 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 (...) @heapSort()
ret i32 0
}

LLVM IR (-O2):
@str = [35 x i8] c"\0A:: Inserting Elements in array ::\00"
@str.4 = [25 x i8] c"\0A:: Elements in array ::\00"
@str.5 = [15 x i8] c"\0A:: Heapify ::\00"
@str.6 = [17 x i8] c"\0A:: Heap Sort ::\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @insert(i32 10)
%3 = tail call i32 @insert(i32 12)
%4 = tail call i32 @insert(i32 1)
%5 = tail call i32 @insert(i32 9)
%6 = tail call i32 @insert(i32 7)
%7 = tail call i32 @insert(i32 6)
%8 = tail call i32 @insert(i32 8)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.4, i64 0, i64 0))
%10 = tail call i32 (...) @showElements()
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.5, i64 0, i64 0))
%12 = tail call i32 (...) @heapify()
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.6, i64 0, i64 0))
%14 = tail call i32 (...) @heapSort()
ret i32 0
}