#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ heap_sort(int *, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int i;
  int datas[11] = {-65536, 5, 3, 17, 10, 84, 19, 6, 22, 9, 35};
  heap_sort(datas, 10);
  for (i = 1; i < 11; ++i)
    printf("%d", datas[i]);
  printf("\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xea6(%rip),%rsi
mov    $0x2c,%edx
call   1050 <memcpy@plt>
lea    -0x40(%rbp),%rdi
mov    $0xa,%esi
call   1030 <heap_sort@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0xb,-0x8(%rbp)
jge    11a7 <main+0x67>
movslq -0x8(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%esi
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1179 <main+0x39>
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
movups 0xed0(%rip),%xmm0
movups %xmm0,0x1c(%rsp)
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe9c(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0xa,%esi
call   1040 <heap_sort@plt>
mov    0x4(%rsp),%esi
lea    0xeac(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x28(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   1060 <exit@plt>

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

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