#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_down(int, void *, int, size_t,
                             int (*)(void const *, void const *));
void heap_initialize(void *heap, int count, size_t size,
                     int (*compar)(const void *elt1, const void *elt2)) {
  int position;
  for (position = count / 2; position >= 1; --position)
    heap_down(position, heap, count, size, compar);
}


x86 assembly (clang, -O0):
<heap_initialize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x24(%rbp)
cmpl   $0x1,-0x24(%rbp)
jl     1164 <heap_initialize+0x54>
mov    -0x24(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
call   1030 <heap_down@plt>
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    1135 <heap_initialize+0x25>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<heap_initialize>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
cmp    $0x2,%esi
jl     114c <heap_initialize+0x3c>
mov    %rcx,%r14
mov    %rdx,%r15
mov    %esi,%ebp
mov    %rdi,%r12
mov    %esi,%ebx
shr    %ebx
nopl   0x0(%rax)
mov    %ebx,%edi
mov    %r12,%rsi
mov    %ebp,%edx
mov    %r15,%rcx
mov    %r14,%r8
call   1030 <heap_down@plt>
lea    -0x1(%rbx),%eax
cmp    $0x1,%ebx
mov    %eax,%ebx
ja     1130 <heap_initialize+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @heap_initialize(i8* %0, i32 %1, i64 %2, i32 (i8*, i8*)* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i64
%8 = alloca i32 (i8*, i8*)*
%9 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i64 %2, i64* %7
store i32 (i8*, i8*)* %3, i32 (i8*, i8*)** %8
%10 = load i32, i32* %6
%11 = sdiv i32 %10, 2
store i32 %11, i32* %9
br label %12
12: ; preds = %22, %4
%13 = load i32, i32* %9
%14 = icmp sge i32 %13, 1
br i1 %14, label %15, label %25
15: ; preds = %12
%16 = load i32, i32* %9
%17 = load i8*, i8** %5
%18 = load i32, i32* %6
%19 = load i64, i64* %7
%20 = load i32 (i8*, i8*)*, i32 (i8*, i8*)** %8
%21 = call i32 @heap_down(i32 %16, i8* %17, i32 %18, i64 %19, i32 (i8*, i8*)* %20)
br label %22
22: ; preds = %15
%23 = load i32, i32* %9
%24 = add nsw i32 %23, -1
store i32 %24, i32* %9
br label %12
25: ; preds = %12
ret void
}

LLVM IR (-O2):
define void @heap_initialize(i8* %0, i32 %1, i64 %2, i32 (i8*, i8*)* %3) {
%5 = icmp sgt i32 %1, 1
br i1 %5, label %6, label %13
6: ; preds = %4
%7 = lshr i32 %1, 1
br label %8
8: ; preds = %6, %8
%9 = phi i32 [ %11, %8 ], [ %7, %6 ]
%10 = tail call i32 @heap_down(i32 %9, i8* %0, i32 %1, i64 %2, i32 (i8*, i8*)* %3)
%11 = add nsw i32 %9, -1
%12 = icmp ugt i32 %9, 1
br i1 %12, label %8, label %13
13: ; preds = %8, %4
ret void
}