#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 */
struct AVLTree {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ AVLTreeAdd(struct AVLTree *, int);
int AVLTreeContains(struct AVLTree *, int);
int /*<<< orphan*/ AVLTreeDelete(struct AVLTree *);
int AVLTreeGetSmallest(struct AVLTree *);
int AVLTreeHeight(struct AVLTree *);
struct AVLTree *AVLTreeNew();
int /*<<< orphan*/ AVLTreePrint(struct AVLTree *);
int /*<<< orphan*/ AVLTreeRemove(struct AVLTree *, int);
int /*<<< orphan*/ AVLTreeRemoveSmallest(struct AVLTree *);
int AVLTreeSize(struct AVLTree *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  struct AVLTree *tree = AVLTreeNew();
  AVLTreeAdd(tree, 4);
  AVLTreeAdd(tree, 7);
  printf("Contains 4: %d\n", AVLTreeContains(tree, 4));
  printf("Contains 9: %d\n", AVLTreeContains(tree, 9));
  AVLTreePrint(tree);
  AVLTreeAdd(tree, 3);
  AVLTreePrint(tree);
  AVLTreeAdd(tree, 2);
  AVLTreePrint(tree);
  printf("Smallest  : %d\n", AVLTreeGetSmallest(tree));
  AVLTreeRemoveSmallest(tree);
  AVLTreePrint(tree);
  AVLTreeAdd(tree, 23);
  AVLTreePrint(tree);
  printf("Smallest  : %d\n", AVLTreeGetSmallest(tree));
  printf("Size      : %d\n", AVLTreeSize(tree));
  printf("Height    : %d\n", AVLTreeHeight(tree));
  AVLTreeRemove(tree, 3);
  AVLTreePrint(tree);
  printf("Size      : %d\n", AVLTreeSize(tree));
  printf("Height    : %d\n", AVLTreeHeight(tree));
  AVLTreeAdd(tree, 3);
  AVLTreePrint(tree);
  AVLTreeAdd(tree, 1);
  AVLTreePrint(tree);
  AVLTreeAdd(tree, 0);
  AVLTreePrint(tree);
  AVLTreeDelete(tree);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   10d0 <AVLTreeNew@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1050 <AVLTreeAdd@plt>
mov    -0x10(%rbp),%rdi
mov    $0x7,%esi
call   1050 <AVLTreeAdd@plt>
mov    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1040 <AVLTreeContains@plt>
mov    %eax,%esi
lea    0xe03(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    $0x9,%esi
call   1040 <AVLTreeContains@plt>
mov    %eax,%esi
lea    0xdf7(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   10b0 <AVLTreePrint@plt>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1050 <AVLTreeAdd@plt>
mov    -0x10(%rbp),%rdi
call   10b0 <AVLTreePrint@plt>
mov    -0x10(%rbp),%rdi
mov    $0x2,%esi
call   1050 <AVLTreeAdd@plt>
mov    -0x10(%rbp),%rdi
call   10b0 <AVLTreePrint@plt>
mov    -0x10(%rbp),%rdi
call   10c0 <AVLTreeGetSmallest@plt>
mov    %eax,%esi
lea    0xdb9(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1090 <AVLTreeRemoveSmallest@plt>
mov    -0x10(%rbp),%rdi
call   10b0 <AVLTreePrint@plt>
mov    -0x10(%rbp),%rdi
mov    $0x17,%esi
call   1050 <AVLTreeAdd@plt>
mov    -0x10(%rbp),%rdi
call   10b0 <AVLTreePrint@plt>
mov    -0x10(%rbp),%rdi
call   10c0 <AVLTreeGetSmallest@plt>
mov    %eax,%esi
lea    0xd79(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <AVLTreeSize@plt>
mov    %eax,%esi
lea    0xd72(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1070 <AVLTreeHeight@plt>
mov    %eax,%esi
lea    0xd6b(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1080 <AVLTreeRemove@plt>
mov    -0x10(%rbp),%rdi
call   10b0 <AVLTreePrint@plt>
mov    -0x10(%rbp),%rdi
call   1030 <AVLTreeSize@plt>
mov    %eax,%esi
lea    0xd2d(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1070 <AVLTreeHeight@plt>
mov    %eax,%esi
lea    0xd26(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1050 <AVLTreeAdd@plt>
mov    -0x10(%rbp),%rdi
call   10b0 <AVLTreePrint@plt>
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1050 <AVLTreeAdd@plt>
mov    -0x10(%rbp),%rdi
call   10b0 <AVLTreePrint@plt>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1050 <AVLTreeAdd@plt>
mov    -0x10(%rbp),%rdi
call   10b0 <AVLTreePrint@plt>
mov    -0x10(%rbp),%rdi
call   10a0 <AVLTreeDelete@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   10d0 <AVLTreeNew@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x4,%esi
call   1050 <AVLTreeAdd@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1050 <AVLTreeAdd@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1040 <AVLTreeContains@plt>
lea    0xe13(%rip),%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
call   1040 <AVLTreeContains@plt>
lea    0xe08(%rip),%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    %rbx,%rdi
call   10b0 <AVLTreePrint@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1050 <AVLTreeAdd@plt>
mov    %rbx,%rdi
call   10b0 <AVLTreePrint@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1050 <AVLTreeAdd@plt>
mov    %rbx,%rdi
call   10b0 <AVLTreePrint@plt>
mov    %rbx,%rdi
call   10c0 <AVLTreeGetSmallest@plt>
lea    0xdd0(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1090 <AVLTreeRemoveSmallest@plt>
mov    %rbx,%rdi
call   10b0 <AVLTreePrint@plt>
mov    %rbx,%rdi
mov    $0x17,%esi
call   1050 <AVLTreeAdd@plt>
mov    %rbx,%rdi
call   10b0 <AVLTreePrint@plt>
mov    %rbx,%rdi
call   10c0 <AVLTreeGetSmallest@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1030 <AVLTreeSize@plt>
lea    0xd90(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1070 <AVLTreeHeight@plt>
lea    0xd87(%rip),%r15
mov    %r15,%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1080 <AVLTreeRemove@plt>
mov    %rbx,%rdi
call   10b0 <AVLTreePrint@plt>
mov    %rbx,%rdi
call   1030 <AVLTreeSize@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1070 <AVLTreeHeight@plt>
mov    %r15,%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1050 <AVLTreeAdd@plt>
mov    %rbx,%rdi
call   10b0 <AVLTreePrint@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1050 <AVLTreeAdd@plt>
mov    %rbx,%rdi
call   10b0 <AVLTreePrint@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <AVLTreeAdd@plt>
mov    %rbx,%rdi
call   10b0 <AVLTreePrint@plt>
mov    %rbx,%rdi
call   10a0 <AVLTreeDelete@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.AVLTree = type { i32 }
@.str = [16 x i8] c"Contains 4: %d\0A\00"
@.str.1 = [16 x i8] c"Contains 9: %d\0A\00"
@.str.2 = [16 x i8] c"Smallest : %d\0A\00"
@.str.3 = [16 x i8] c"Size : %d\0A\00"
@.str.4 = [16 x i8] c"Height : %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.AVLTree*
store i32 0, i32* %1
%3 = call %struct.AVLTree* (...) @AVLTreeNew()
store %struct.AVLTree* %3, %struct.AVLTree** %2
%4 = load %struct.AVLTree*, %struct.AVLTree** %2
%5 = call i32 @AVLTreeAdd(%struct.AVLTree* %4, i32 4)
%6 = load %struct.AVLTree*, %struct.AVLTree** %2
%7 = call i32 @AVLTreeAdd(%struct.AVLTree* %6, i32 7)
%8 = load %struct.AVLTree*, %struct.AVLTree** %2
%9 = call i32 @AVLTreeContains(%struct.AVLTree* %8, i32 4)
%10 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load %struct.AVLTree*, %struct.AVLTree** %2
%12 = call i32 @AVLTreeContains(%struct.AVLTree* %11, i32 9)
%13 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = load %struct.AVLTree*, %struct.AVLTree** %2
%15 = call i32 @AVLTreePrint(%struct.AVLTree* %14)
%16 = load %struct.AVLTree*, %struct.AVLTree** %2
%17 = call i32 @AVLTreeAdd(%struct.AVLTree* %16, i32 3)
%18 = load %struct.AVLTree*, %struct.AVLTree** %2
%19 = call i32 @AVLTreePrint(%struct.AVLTree* %18)
%20 = load %struct.AVLTree*, %struct.AVLTree** %2
%21 = call i32 @AVLTreeAdd(%struct.AVLTree* %20, i32 2)
%22 = load %struct.AVLTree*, %struct.AVLTree** %2
%23 = call i32 @AVLTreePrint(%struct.AVLTree* %22)
%24 = load %struct.AVLTree*, %struct.AVLTree** %2
%25 = call i32 @AVLTreeGetSmallest(%struct.AVLTree* %24)
%26 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %25)
%27 = load %struct.AVLTree*, %struct.AVLTree** %2
%28 = call i32 @AVLTreeRemoveSmallest(%struct.AVLTree* %27)
%29 = load %struct.AVLTree*, %struct.AVLTree** %2
%30 = call i32 @AVLTreePrint(%struct.AVLTree* %29)
%31 = load %struct.AVLTree*, %struct.AVLTree** %2
%32 = call i32 @AVLTreeAdd(%struct.AVLTree* %31, i32 23)
%33 = load %struct.AVLTree*, %struct.AVLTree** %2
%34 = call i32 @AVLTreePrint(%struct.AVLTree* %33)
%35 = load %struct.AVLTree*, %struct.AVLTree** %2
%36 = call i32 @AVLTreeGetSmallest(%struct.AVLTree* %35)
%37 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %36)
%38 = load %struct.AVLTree*, %struct.AVLTree** %2
%39 = call i32 @AVLTreeSize(%struct.AVLTree* %38)
%40 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %39)
%41 = load %struct.AVLTree*, %struct.AVLTree** %2
%42 = call i32 @AVLTreeHeight(%struct.AVLTree* %41)
%43 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %42)
%44 = load %struct.AVLTree*, %struct.AVLTree** %2
%45 = call i32 @AVLTreeRemove(%struct.AVLTree* %44, i32 3)
%46 = load %struct.AVLTree*, %struct.AVLTree** %2
%47 = call i32 @AVLTreePrint(%struct.AVLTree* %46)
%48 = load %struct.AVLTree*, %struct.AVLTree** %2
%49 = call i32 @AVLTreeSize(%struct.AVLTree* %48)
%50 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %49)
%51 = load %struct.AVLTree*, %struct.AVLTree** %2
%52 = call i32 @AVLTreeHeight(%struct.AVLTree* %51)
%53 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %52)
%54 = load %struct.AVLTree*, %struct.AVLTree** %2
%55 = call i32 @AVLTreeAdd(%struct.AVLTree* %54, i32 3)
%56 = load %struct.AVLTree*, %struct.AVLTree** %2
%57 = call i32 @AVLTreePrint(%struct.AVLTree* %56)
%58 = load %struct.AVLTree*, %struct.AVLTree** %2
%59 = call i32 @AVLTreeAdd(%struct.AVLTree* %58, i32 1)
%60 = load %struct.AVLTree*, %struct.AVLTree** %2
%61 = call i32 @AVLTreePrint(%struct.AVLTree* %60)
%62 = load %struct.AVLTree*, %struct.AVLTree** %2
%63 = call i32 @AVLTreeAdd(%struct.AVLTree* %62, i32 0)
%64 = load %struct.AVLTree*, %struct.AVLTree** %2
%65 = call i32 @AVLTreePrint(%struct.AVLTree* %64)
%66 = load %struct.AVLTree*, %struct.AVLTree** %2
%67 = call i32 @AVLTreeDelete(%struct.AVLTree* %66)
ret i32 0
}

LLVM IR (-O2):
%struct.AVLTree = type { i32 }
@.str = [16 x i8] c"Contains 4: %d\0A\00"
@.str.1 = [16 x i8] c"Contains 9: %d\0A\00"
@.str.2 = [16 x i8] c"Smallest : %d\0A\00"
@.str.3 = [16 x i8] c"Size : %d\0A\00"
@.str.4 = [16 x i8] c"Height : %d\0A\00"
define i32 @main() {
%1 = tail call %struct.AVLTree* (...) @AVLTreeNew()
%2 = tail call i32 @AVLTreeAdd(%struct.AVLTree* %1, i32 4)
%3 = tail call i32 @AVLTreeAdd(%struct.AVLTree* %1, i32 7)
%4 = tail call i32 @AVLTreeContains(%struct.AVLTree* %1, i32 4)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = tail call i32 @AVLTreeContains(%struct.AVLTree* %1, i32 9)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = tail call i32 @AVLTreePrint(%struct.AVLTree* %1)
%9 = tail call i32 @AVLTreeAdd(%struct.AVLTree* %1, i32 3)
%10 = tail call i32 @AVLTreePrint(%struct.AVLTree* %1)
%11 = tail call i32 @AVLTreeAdd(%struct.AVLTree* %1, i32 2)
%12 = tail call i32 @AVLTreePrint(%struct.AVLTree* %1)
%13 = tail call i32 @AVLTreeGetSmallest(%struct.AVLTree* %1)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%15 = tail call i32 @AVLTreeRemoveSmallest(%struct.AVLTree* %1)
%16 = tail call i32 @AVLTreePrint(%struct.AVLTree* %1)
%17 = tail call i32 @AVLTreeAdd(%struct.AVLTree* %1, i32 23)
%18 = tail call i32 @AVLTreePrint(%struct.AVLTree* %1)
%19 = tail call i32 @AVLTreeGetSmallest(%struct.AVLTree* %1)
%20 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %19)
%21 = tail call i32 @AVLTreeSize(%struct.AVLTree* %1)
%22 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %21)
%23 = tail call i32 @AVLTreeHeight(%struct.AVLTree* %1)
%24 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %23)
%25 = tail call i32 @AVLTreeRemove(%struct.AVLTree* %1, i32 3)
%26 = tail call i32 @AVLTreePrint(%struct.AVLTree* %1)
%27 = tail call i32 @AVLTreeSize(%struct.AVLTree* %1)
%28 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %27)
%29 = tail call i32 @AVLTreeHeight(%struct.AVLTree* %1)
%30 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %29)
%31 = tail call i32 @AVLTreeAdd(%struct.AVLTree* %1, i32 3)
%32 = tail call i32 @AVLTreePrint(%struct.AVLTree* %1)
%33 = tail call i32 @AVLTreeAdd(%struct.AVLTree* %1, i32 1)
%34 = tail call i32 @AVLTreePrint(%struct.AVLTree* %1)
%35 = tail call i32 @AVLTreeAdd(%struct.AVLTree* %1, i32 0)
%36 = tail call i32 @AVLTreePrint(%struct.AVLTree* %1)
%37 = tail call i32 @AVLTreeDelete(%struct.AVLTree* %1)
ret i32 0
}