#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*/ adjust(int *, int);
int /*<<< orphan*/ extract_min(int *, int *);
int /*<<< orphan*/ head_sort(int *, int);
int /*<<< orphan*/ insert(int *, int *, int);
int /*<<< orphan*/ print_head(int *, int);
int main(void) {
  int head[1000] = {-1, 10, 20, 5, 44, 32, 150, 50, 222, 342, 1, 9, 28, 20};
  int head_len = 13;
  adjust(head, head_len);
  print_head(head, head_len);
  insert(head, &head_len, 33);
  print_head(head, head_len);
  extract_min(head, &head_len);
  print_head(head, head_len);
  head_sort(head, head_len);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xfc0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xfb0(%rbp),%rdi
lea    0xe80(%rip),%rsi
mov    $0xfa0,%edx
call   1060 <memcpy@plt>
movl   $0xd,-0xfb4(%rbp)
lea    -0xfb0(%rbp),%rdi
mov    -0xfb4(%rbp),%esi
call   1030 <adjust@plt>
lea    -0xfb0(%rbp),%rdi
mov    -0xfb4(%rbp),%esi
call   1080 <print_head@plt>
lea    -0xfb0(%rbp),%rdi
lea    -0xfb4(%rbp),%rsi
mov    $0x21,%edx
call   1070 <insert@plt>
lea    -0xfb0(%rbp),%rdi
mov    -0xfb4(%rbp),%esi
call   1080 <print_head@plt>
lea    -0xfb0(%rbp),%rdi
lea    -0xfb4(%rbp),%rsi
call   1040 <extract_min@plt>
lea    -0xfb0(%rbp),%rdi
mov    -0xfb4(%rbp),%esi
call   1080 <print_head@plt>
lea    -0xfb0(%rbp),%rdi
mov    -0xfb4(%rbp),%esi
call   1050 <head_sort@plt>
xor    %eax,%eax
add    $0xfc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xfb8,%rsp
lea    0xe8f(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    $0xfa0,%edx
mov    %rbx,%rdi
call   1060 <memcpy@plt>
movl   $0xd,0xc(%rsp)
mov    %rbx,%rdi
mov    $0xd,%esi
call   1030 <adjust@plt>
mov    %rbx,%rdi
mov    $0xd,%esi
call   1080 <print_head@plt>
lea    0xc(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x21,%edx
call   1070 <insert@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1080 <print_head@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <extract_min@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1080 <print_head@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1050 <head_sort@plt>
xor    %eax,%eax
add    $0xfb8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.head = <{ [14 x i32], [986 x i32] }> <{ [14 x i32] [i32 -1, i32 10, i32 20, i32 5, i32 44, i32 32, i32 150, i32 50, i32 222, i32 342, i32 1, i32 9, i32 28, i32 20], [986 x i32] zeroinitializer }>
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [1000 x i32]* %2 to i8*
store i32 13, i32* %3
%5 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 0
%6 = load i32, i32* %3
%7 = call i32 @adjust(i32* %5, i32 %6)
%8 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 0
%9 = load i32, i32* %3
%10 = call i32 @print_head(i32* %8, i32 %9)
%11 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 0
%12 = call i32 @insert(i32* %11, i32* %3, i32 33)
%13 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 0
%14 = load i32, i32* %3
%15 = call i32 @print_head(i32* %13, i32 %14)
%16 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 0
%17 = call i32 @extract_min(i32* %16, i32* %3)
%18 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 0
%19 = load i32, i32* %3
%20 = call i32 @print_head(i32* %18, i32 %19)
%21 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 0
%22 = load i32, i32* %3
%23 = call i32 @head_sort(i32* %21, i32 %22)
ret i32 0
}

LLVM IR (-O2):
@__const.main.head = <{ [14 x i32], [986 x i32] }> <{ [14 x i32] [i32 -1, i32 10, i32 20, i32 5, i32 44, i32 32, i32 150, i32 50, i32 222, i32 342, i32 1, i32 9, i32 28, i32 20], [986 x i32] zeroinitializer }>
define i32 @main() {
%1 = alloca [1000 x i32]
%2 = alloca i32
%3 = bitcast [1000 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
store i32 13, i32* %2
%5 = getelementptr inbounds [1000 x i32], [1000 x i32]* %1, i64 0, i64 0
%6 = call i32 @adjust(i32* %5, i32 13)
%7 = call i32 @print_head(i32* %5, i32 13)
%8 = call i32 @insert(i32* %5, i32* %2, i32 33)
%9 = load i32, i32* %2
%10 = call i32 @print_head(i32* %5, i32 %9)
%11 = call i32 @extract_min(i32* %5, i32* %2)
%12 = load i32, i32* %2
%13 = call i32 @print_head(i32* %5, i32 %12)
%14 = load i32, i32* %2
%15 = call i32 @head_sort(i32* %5, i32 %14)
ret i32 0
}