#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*/ test_heap_sort(int);
int main() {
  int i = 0;
  for (i = 16; i <= 1024 * 1024; i *= 2) {
    test_heap_sort(i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x10,-0x8(%rbp)
cmpl   $0x100000,-0x8(%rbp)
jg     1150 <main+0x40>
mov    -0x8(%rbp),%edi
call   1030 <test_heap_sort@plt>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x10,%edi
call   1030 <test_heap_sort@plt>
mov    $0x20,%edi
call   1030 <test_heap_sort@plt>
mov    $0x40,%edi
call   1030 <test_heap_sort@plt>
mov    $0x80,%edi
call   1030 <test_heap_sort@plt>
mov    $0x100,%edi
call   1030 <test_heap_sort@plt>
mov    $0x200,%edi
call   1030 <test_heap_sort@plt>
mov    $0x400,%edi
call   1030 <test_heap_sort@plt>
mov    $0x800,%edi
call   1030 <test_heap_sort@plt>
mov    $0x1000,%edi
call   1030 <test_heap_sort@plt>
mov    $0x2000,%edi
call   1030 <test_heap_sort@plt>
mov    $0x4000,%edi
call   1030 <test_heap_sort@plt>
mov    $0x8000,%edi
call   1030 <test_heap_sort@plt>
mov    $0x10000,%edi
call   1030 <test_heap_sort@plt>
mov    $0x20000,%edi
call   1030 <test_heap_sort@plt>
mov    $0x40000,%edi
call   1030 <test_heap_sort@plt>
mov    $0x80000,%edi
call   1030 <test_heap_sort@plt>
mov    $0x100000,%edi
call   1030 <test_heap_sort@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 16, i32* %2
br label %3
3: ; preds = %9, %0
%4 = load i32, i32* %2
%5 = icmp sle i32 %4, 1048576
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = load i32, i32* %2
%8 = call i32 @test_heap_sort(i32 %7)
br label %9
9: ; preds = %6
%10 = load i32, i32* %2
%11 = mul nsw i32 %10, 2
store i32 %11, i32* %2
br label %3
12: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @test_heap_sort(i32 16)
%2 = tail call i32 @test_heap_sort(i32 32)
%3 = tail call i32 @test_heap_sort(i32 64)
%4 = tail call i32 @test_heap_sort(i32 128)
%5 = tail call i32 @test_heap_sort(i32 256)
%6 = tail call i32 @test_heap_sort(i32 512)
%7 = tail call i32 @test_heap_sort(i32 1024)
%8 = tail call i32 @test_heap_sort(i32 2048)
%9 = tail call i32 @test_heap_sort(i32 4096)
%10 = tail call i32 @test_heap_sort(i32 8192)
%11 = tail call i32 @test_heap_sort(i32 16384)
%12 = tail call i32 @test_heap_sort(i32 32768)
%13 = tail call i32 @test_heap_sort(i32 65536)
%14 = tail call i32 @test_heap_sort(i32 131072)
%15 = tail call i32 @test_heap_sort(i32 262144)
%16 = tail call i32 @test_heap_sort(i32 524288)
%17 = tail call i32 @test_heap_sort(i32 1048576)
ret i32 0
}