#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_initialize(void *, int, size_t,
                                   int (*)(void const *, void const *));
int /*<<< orphan*/ heap_to_tieheap(void *, int, int *, size_t,
                                   int (*)(void const *, void const *));
void tieheap_initialize(void *tieheap, int count, int *heap_count, size_t size,
                        int (*compar)(const void *elt1, const void *elt2)) {
  if (count == 1)
    *heap_count = 0;
  else {
    heap_initialize(tieheap, count, size, compar);
    *heap_count = count;
    heap_to_tieheap(tieheap, count, heap_count, size, compar);
  }
}


x86 assembly (clang, -O0):
<tieheap_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    %r8,-0x28(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    1154 <tieheap_initialize+0x34>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
jmp    1189 <tieheap_initialize+0x69>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1030 <heap_initialize@plt>
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1040 <heap_to_tieheap@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tieheap_initialize>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%rbx
cmp    $0x1,%esi
jne    113f <tieheap_initialize+0x1f>
movl   $0x0,(%rbx)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r8,%r14
mov    %rcx,%r15
mov    %esi,%ebp
mov    %rdi,%r12
mov    %rcx,%rdx
mov    %r8,%rcx
call   1030 <heap_initialize@plt>
mov    %ebp,(%rbx)
mov    %r12,%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
mov    %r15,%rcx
mov    %r14,%r8
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <heap_to_tieheap@plt>

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

LLVM IR (-O2):
define void @tieheap_initialize(i8* %0, i32 %1, i32* %2, i64 %3, i32 (i8*, i8*)* %4) {
%6 = icmp eq i32 %1, 1
br i1 %6, label %7, label %8
7: ; preds = %5
store i32 0, i32* %2
br label %11
8: ; preds = %5
%9 = tail call i32 @heap_initialize(i8* %0, i32 %1, i64 %3, i32 (i8*, i8*)* %4)
store i32 %1, i32* %2
%10 = tail call i32 @heap_to_tieheap(i8* %0, i32 %1, i32* %2, i64 %3, i32 (i8*, i8*)* %4)
br label %11
11: ; preds = %8, %7
ret void
}