#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*/ heap_sort(int *, int);
int /*<<< orphan*/ max_heap_insert(int *, int, int);
int /*<<< orphan*/ printf(char *, int);
void main() {
  int show = 0;
  int line = 0;
  int number[1024] = {4, 1, 3, 2, 16, 9, 10, 14, 8, 7};
  heap_sort(number, 10);
  max_heap_insert(number, 25, 10);
  for (show = 0; show < 11; show++)
    printf("%d ", number[show]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1010,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x1010(%rbp),%rdi
lea    0xe99(%rip),%rsi
mov    $0x1000,%edx
call   1050 <memcpy@plt>
lea    -0x1010(%rbp),%rdi
mov    $0xa,%esi
call   1030 <heap_sort@plt>
lea    -0x1010(%rbp),%rdi
mov    $0x19,%esi
mov    $0xa,%edx
call   1060 <max_heap_insert@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0xb,-0x4(%rbp)
jge    11ce <main+0x8e>
movslq -0x4(%rbp),%rax
mov    -0x1010(%rbp,%rax,4),%esi
lea    0x1e45(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    119f <main+0x5f>
add    $0x1010,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x1000,%rsp
lea    0xeb1(%rip),%rsi
mov    %rsp,%rbx
mov    $0x1000,%edx
mov    %rbx,%rdi
call   1050 <memcpy@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <heap_sort@plt>
mov    %rbx,%rdi
mov    $0x19,%esi
mov    $0xa,%edx
call   1060 <max_heap_insert@plt>
mov    (%rsp),%esi
lea    0x1e78(%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>
add    $0x1000,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.number = <{ [10 x i32], [1014 x i32] }> <{ [10 x i32] [i32 4, i32 1, i32 3, i32 2, i32 16, i32 9, i32 10, i32 14, i32 8, i32 7], [1014 x i32] zeroinitializer }>
@.str = [4 x i8] c"%d \00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [1024 x i32]
store i32 0, i32* %1
store i32 0, i32* %2
%4 = bitcast [1024 x i32]* %3 to i8*
%5 = getelementptr inbounds [1024 x i32], [1024 x i32]* %3, i64 0, i64 0
%6 = call i32 @heap_sort(i32* %5, i32 10)
%7 = getelementptr inbounds [1024 x i32], [1024 x i32]* %3, i64 0, i64 0
%8 = call i32 @max_heap_insert(i32* %7, i32 25, i32 10)
store i32 0, i32* %1
br label %9
9: ; preds = %18, %0
%10 = load i32, i32* %1
%11 = icmp slt i32 %10, 11
br i1 %11, label %12, label %21
12: ; preds = %9
%13 = load i32, i32* %1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [1024 x i32], [1024 x i32]* %3, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %12
%19 = load i32, i32* %1
%20 = add nsw i32 %19, 1
store i32 %20, i32* %1
br label %9
21: ; preds = %9
ret void
}

LLVM IR (-O2):
@__const.main.number = <{ [10 x i32], [1014 x i32] }> <{ [10 x i32] [i32 4, i32 1, i32 3, i32 2, i32 16, i32 9, i32 10, i32 14, i32 8, i32 7], [1014 x i32] zeroinitializer }>
@.str = [4 x i8] c"%d \00"
define void @main() {
%1 = alloca [1024 x i32]
%2 = bitcast [1024 x i32]* %1 to i8*
%3 = getelementptr inbounds [1024 x i32], [1024 x i32]* %1, i64 0, i64 0
%4 = call i32 @heap_sort(i32* %3, i32 10)
%5 = call i32 @max_heap_insert(i32* %3, i32 25, i32 10)
%6 = load i32, i32* %3
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = getelementptr inbounds [1024 x i32], [1024 x i32]* %1, i64 0, i64 1
%9 = load i32, i32* %8
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds [1024 x i32], [1024 x i32]* %1, i64 0, i64 2
%12 = load i32, i32* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds [1024 x i32], [1024 x i32]* %1, i64 0, i64 3
%15 = load i32, i32* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds [1024 x i32], [1024 x i32]* %1, i64 0, i64 4
%18 = load i32, i32* %17
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = getelementptr inbounds [1024 x i32], [1024 x i32]* %1, i64 0, i64 5
%21 = load i32, i32* %20
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = getelementptr inbounds [1024 x i32], [1024 x i32]* %1, i64 0, i64 6
%24 = load i32, i32* %23
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %24)
%26 = getelementptr inbounds [1024 x i32], [1024 x i32]* %1, i64 0, i64 7
%27 = load i32, i32* %26
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %27)
%29 = getelementptr inbounds [1024 x i32], [1024 x i32]* %1, i64 0, i64 8
%30 = load i32, i32* %29
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %30)
%32 = getelementptr inbounds [1024 x i32], [1024 x i32]* %1, i64 0, i64 9
%33 = load i32, i32* %32
%34 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %33)
%35 = getelementptr inbounds [1024 x i32], [1024 x i32]* %1, i64 0, i64 10
%36 = load i32, i32* %35
%37 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %36)
ret void
}