int main() {
  long l[27] = {2, 4, 1, 5,   6,  7, 9,  20,  2133, 54, 345, 43, 2, 5,
                6, 3, 7, 345, 56, 7, 34, 654, 324,  6,  42,  4,  5};
  printList(l, 27);
  asm("									"
      "				\nmovq %%rdx, %%r8;			"
      "							\nsubq $2, "
      "%%r8;								"
      "			\nsarq $1, %%r8; 				"
      "		\nmovq %%rdx, %%r9;					"
      "						\ndecq %%r9;		"
      "									"
      "		\nheapsort_while1:					"
      "						\ncall seep;		"
      "									"
      "		\ndecq %%r8;						"
      "						\ncmpq $0, %%r8;	"
      "									"
      "	\njne heapsort_while1;						"
      "				\nheapsort_while2:			"
      "								\ncmpq $0, "
      "%%r9;								"
      "				\nje end_heapsort;			\nmovq "
      "%%r9, %%r10;							"
      "				\nmovq $0, %%r11;			"
      "								\ncall "
      "swap;								"
      "					\ndecq %%r9;			"
      "									"
      "	\nmovq $0, %%r8;						"
      "					\ncall seep;			"
      "									"
      "	\njmp heapsort_while2;						"
      "				\nseep:					"
      "									\nmovq "
      "%%r8, %%r12;							"
      "			\nmovq %%r12, %%r13;				"
      "						\nsalq $1, %%r13;	"
      "									"
      "	\nincq %%r13;							"
      "					\nseep_while:			"
      "									"
      "	\ncmpq %%r13, %%r9;						"
      "					\nret;				\nmovq "
      "(%%rcx, %%r12, 8), %%r14;			\ncmpq %%r14, (%%rcx, "
      "%%r13, 8);			\njge if1else;			"
      "									\nmovq "
      "%%r13, %%r15;							"
      "			\njmp if1end;					"
      "								"
      "\nif1else:							"
      "						\nmovq %%r12, %%r15;	"
      "									"
      "\nif1end:							"
      "							\nincq %%r13;	"
      "									"
      "		\ncmpq %%r13, %%r9;					"
      "						\njg if2end;		"
      "									"
      "		\nmovq (%%rcx, %%r15, 8), %%r14;			\ncmpq "
      "%%r14, (%%rcx, %%r13, 8);			\njge if2end;	"
      "									"
      "			\nmovq %%r13,	%%r15;				"
      "							\nif2end:	"
      "									"
      "				\ndecq %%r13;				"
      "								\ncmpq %%r15, "
      "%%r12;								"
      "		\njne if3false;						"
      "						\nret;			"
      "	\nif3false:							"
      "						\nmovq %%r12, %%r10;	"
      "									\nmovq "
      "%%r15, %%r11;							"
      "				\ncall swap;				"
      "									\nmovq "
      "%%r15, %%r12;							"
      "			\nmovq %%r12, %%r13;				"
      "						\nsalq %%r13;		"
      "									"
      "	\nincq %%r13;							"
      "					\njmp seep_while;		"
      "									"
      "	\nswap:								"
      "						\nmovq (%%rcx, %%r10, 8), "
      "%%r14;			\nxchg %%r14, (%%rcx, %%r11, 8);	"
      "		\nmovq %%r14, (%%rcx, %%r10, 8);			"
      "\nret;								"
      "						\nend_heapsort:"
      :
      : "c"(l), "d"(27)
      : "memory", "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15");
  printList(l, 27);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
sub    $0xe0,%rsp
lea    -0x100(%rbp),%rdi
lea    0xebf(%rip),%rsi
mov    $0xd8,%edx
call   1030 <memcpy@plt>
lea    -0x100(%rbp),%rdi
mov    $0x1b,%esi
mov    $0x0,%al
call   1040 <printList@plt>
lea    -0x100(%rbp),%rcx
mov    $0x1b,%edx
mov    %rdx,%r8
sub    $0x2,%r8
sar    %r8
mov    %rdx,%r9
dec    %r9

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe0,%rsp
lea    0xec9(%rip),%rsi
mov    %rsp,%rbx
mov    $0xd8,%edx
mov    %rbx,%rdi
call   1030 <memcpy@plt>
mov    %rbx,%rdi
mov    $0x1b,%esi
xor    %eax,%eax
call   1040 <printList@plt>
mov    %rbx,%rcx
mov    $0x1b,%edx
mov    %rdx,%r8
sub    $0x2,%r8
sar    %r8
mov    %rdx,%r9
dec    %r9

LLVM IR (-O0):
@__const.main.l = [27 x i64] [i64 2, i64 4, i64 1, i64 5, i64 6, i64 7, i64 9, i64 20, i64 2133, i64 54, i64 345, i64 43, i64 2, i64 5, i64 6, i64 3, i64 7, i64 345, i64 56, i64 7, i64 34, i64 654, i64 324, i64 6, i64 42, i64 4, i64 5]
define i32 @main() {
%1 = alloca [27 x i64]
%2 = bitcast [27 x i64]* %1 to i8*
%3 = getelementptr inbounds [27 x i64], [27 x i64]* %1, i64 0, i64 0
%4 = call i32 (i64*, i32, ...) bitcast (i32 (...)* @printList to i32 (i64*, i32, ...)*)(i64* %3, i32 27)
%5 = getelementptr inbounds [27 x i64], [27 x i64]* %1, i64 0, i64 0
%6 = getelementptr inbounds [27 x i64], [27 x i64]* %1, i64 0, i64 0
%7 = call i32 (i64*, i32, ...) bitcast (i32 (...)* @printList to i32 (i64*, i32, ...)*)(i64* %6, i32 27)
ret i32 0
}

LLVM IR (-O2):
@__const.main.l = [27 x i64] [i64 2, i64 4, i64 1, i64 5, i64 6, i64 7, i64 9, i64 20, i64 2133, i64 54, i64 345, i64 43, i64 2, i64 5, i64 6, i64 3, i64 7, i64 345, i64 56, i64 7, i64 34, i64 654, i64 324, i64 6, i64 42, i64 4, i64 5]
define i32 @main() {
%1 = alloca [27 x i64]
%2 = bitcast [27 x i64]* %1 to i8*
%3 = getelementptr inbounds [27 x i64], [27 x i64]* %1, i64 0, i64 0
%4 = call i32 (i64*, i32, ...) bitcast (i32 (...)* @printList to i32 (i64*, i32, ...)*)(i64* %3, i32 27)
%5 = call i32 (i64*, i32, ...) bitcast (i32 (...)* @printList to i32 (i64*, i32, ...)*)(i64* %3, i32 27)
ret i32 0
}