; LLVM IR from ksw2000/Data-Structure-in-C :: Tree (AVL-Tree)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.avlTree = type { ptr, ptr, ptr, ptr, ptr }
%struct.treeNode = type { ptr, ptr, ptr, i32 }

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [31 x i8], align 1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
declare dso_local void @stack_push(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @stack_pop(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @stack_empty(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @stack_init(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @treeNode_updateHeight(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @treeNode_reBalance(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @avlTree_delete(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  store ptr null, ptr %5, align 8, !tbaa !5
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.avlTree, ptr %9, i32 0, i32 4
  %11 = load ptr, ptr %10, align 8, !tbaa !9
  call void @stack_init(ptr noundef %11)
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.avlTree, ptr %12, i32 0, i32 4
  %14 = load ptr, ptr %13, align 8, !tbaa !9
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.avlTree, ptr %15, i32 0, i32 0
  call void @stack_push(ptr noundef %14, ptr noundef %16)
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.avlTree, ptr %17, i32 0, i32 0
  %19 = load ptr, ptr %18, align 8, !tbaa !11
  store ptr %19, ptr %5, align 8, !tbaa !5
  br label %20

20:                                               ; preds = %63, %2
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = icmp ne ptr %21, null
  br i1 %22, label %23, label %64

23:                                               ; preds = %20
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.avlTree, ptr %24, i32 0, i32 1
  %26 = load ptr, ptr %25, align 8, !tbaa !12
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.treeNode, ptr %28, i32 0, i32 0
  %30 = load ptr, ptr %29, align 8, !tbaa !13
  %31 = call i32 %26(ptr noundef %27, ptr noundef %30)
  %32 = icmp slt i32 %31, 0
  br i1 %32, label %33, label %42

33:                                               ; preds = %23
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.avlTree, ptr %34, i32 0, i32 4
  %36 = load ptr, ptr %35, align 8, !tbaa !9
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.treeNode, ptr %37, i32 0, i32 1
  call void @stack_push(ptr noundef %36, ptr noundef %38)
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.treeNode, ptr %39, i32 0, i32 1
  %41 = load ptr, ptr %40, align 8, !tbaa !16
  store ptr %41, ptr %5, align 8, !tbaa !5
  br label %63

42:                                               ; preds = %23
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.avlTree, ptr %43, i32 0, i32 1
  %45 = load ptr, ptr %44, align 8, !tbaa !12
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.treeNode, ptr %47, i32 0, i32 0
  %49 = load ptr, ptr %48, align 8, !tbaa !13
  %50 = call i32 %45(ptr noundef %46, ptr noundef %49)
  %51 = icmp sgt i32 %50, 0
  br i1 %51, label %52, label %61

52:                                               ; preds = %42
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.avlTree, ptr %53, i32 0, i32 4
  %55 = load ptr, ptr %54, align 8, !tbaa !9
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.treeNode, ptr %56, i32 0, i32 2
  call void @stack_push(ptr noundef %55, ptr noundef %57)
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.treeNode, ptr %58, i32 0, i32 2
  %60 = load ptr, ptr %59, align 8, !tbaa !17
  store ptr %60, ptr %5, align 8, !tbaa !5
  br label %62

61:                                               ; preds = %42
  br label %64

62:                                               ; preds = %52
  br label %63

63:                                               ; preds = %62, %33
  br label %20, !llvm.loop !18

64:                                               ; preds = %61, %20
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = icmp ne ptr %65, null
  br i1 %66, label %70, label %67

67:                                               ; preds = %64
  %68 = load ptr, ptr @stderr, align 8, !tbaa !5
  %69 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %68, ptr noundef @.str) #4
  call void @exit(i32 noundef 1) #5
  unreachable

70:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %71 = load ptr, ptr %3, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.avlTree, ptr %71, i32 0, i32 4
  %73 = load ptr, ptr %72, align 8, !tbaa !9
  %74 = call ptr @stack_pop(ptr noundef %73)
  store ptr %74, ptr %6, align 8, !tbaa !5
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.treeNode, ptr %75, i32 0, i32 2
  %77 = load ptr, ptr %76, align 8, !tbaa !17
  %78 = icmp ne ptr %77, null
  br i1 %78, label %79, label %84

79:                                               ; preds = %70
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.treeNode, ptr %80, i32 0, i32 1
  %82 = load ptr, ptr %81, align 8, !tbaa !16
  %83 = icmp ne ptr %82, null
  br i1 %83, label %101, label %84

84:                                               ; preds = %79, %70
  %85 = load ptr, ptr %5, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.treeNode, ptr %85, i32 0, i32 2
  %87 = load ptr, ptr %86, align 8, !tbaa !17
  %88 = icmp ne ptr %87, null
  br i1 %88, label %89, label %93

89:                                               ; preds = %84
  %90 = load ptr, ptr %5, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.treeNode, ptr %90, i32 0, i32 2
  %92 = load ptr, ptr %91, align 8, !tbaa !17
  br label %97

93:                                               ; preds = %84
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.treeNode, ptr %94, i32 0, i32 1
  %96 = load ptr, ptr %95, align 8, !tbaa !16
  br label %97

97:                                               ; preds = %93, %89
  %98 = phi ptr [ %92, %89 ], [ %96, %93 ]
  %99 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %98, ptr %99, align 8, !tbaa !5
  %100 = load ptr, ptr %5, align 8, !tbaa !5
  call void @free(ptr noundef %100) #4
  br label %143

101:                                              ; preds = %79
  %102 = load ptr, ptr %3, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.avlTree, ptr %102, i32 0, i32 4
  %104 = load ptr, ptr %103, align 8, !tbaa !9
  %105 = load ptr, ptr %6, align 8, !tbaa !5
  call void @stack_push(ptr noundef %104, ptr noundef %105)
  %106 = load ptr, ptr %3, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.avlTree, ptr %106, i32 0, i32 4
  %108 = load ptr, ptr %107, align 8, !tbaa !9
  %109 = load ptr, ptr %5, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.treeNode, ptr %109, i32 0, i32 2
  call void @stack_push(ptr noundef %108, ptr noundef %110)
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %111 = load ptr, ptr %5, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.treeNode, ptr %111, i32 0, i32 2
  %113 = load ptr, ptr %112, align 8, !tbaa !17
  store ptr %113, ptr %7, align 8, !tbaa !5
  br label %114

114:                                              ; preds = %119, %101
  %115 = load ptr, ptr %7, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.treeNode, ptr %115, i32 0, i32 1
  %117 = load ptr, ptr %116, align 8, !tbaa !16
  %118 = icmp ne ptr %117, null
  br i1 %118, label %119, label %128

119:                                              ; preds = %114
  %120 = load ptr, ptr %3, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.avlTree, ptr %120, i32 0, i32 4
  %122 = load ptr, ptr %121, align 8, !tbaa !9
  %123 = load ptr, ptr %7, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.treeNode, ptr %123, i32 0, i32 1
  call void @stack_push(ptr noundef %122, ptr noundef %124)
  %125 = load ptr, ptr %7, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.treeNode, ptr %125, i32 0, i32 1
  %127 = load ptr, ptr %126, align 8, !tbaa !16
  store ptr %127, ptr %7, align 8, !tbaa !5
  br label %114, !llvm.loop !20

128:                                              ; preds = %114
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %129 = load ptr, ptr %3, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.avlTree, ptr %129, i32 0, i32 4
  %131 = load ptr, ptr %130, align 8, !tbaa !9
  %132 = call ptr @stack_pop(ptr noundef %131)
  store ptr %132, ptr %8, align 8, !tbaa !5
  %133 = load ptr, ptr %7, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.treeNode, ptr %133, i32 0, i32 0
  %135 = load ptr, ptr %134, align 8, !tbaa !13
  %136 = load ptr, ptr %5, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.treeNode, ptr %136, i32 0, i32 0
  store ptr %135, ptr %137, align 8, !tbaa !13
  %138 = load ptr, ptr %7, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.treeNode, ptr %138, i32 0, i32 2
  %140 = load ptr, ptr %139, align 8, !tbaa !17
  %141 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %140, ptr %141, align 8, !tbaa !5
  %142 = load ptr, ptr %7, align 8, !tbaa !5
  call void @free(ptr noundef %142) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %143

143:                                              ; preds = %128, %97
  br label %144

144:                                              ; preds = %151, %143
  %145 = load ptr, ptr %3, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.avlTree, ptr %145, i32 0, i32 4
  %147 = load ptr, ptr %146, align 8, !tbaa !9
  %148 = call i32 @stack_empty(ptr noundef %147)
  %149 = icmp ne i32 %148, 0
  %150 = xor i1 %149, true
  br i1 %150, label %151, label %159

151:                                              ; preds = %144
  %152 = load ptr, ptr %3, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.avlTree, ptr %152, i32 0, i32 4
  %154 = load ptr, ptr %153, align 8, !tbaa !9
  %155 = call ptr @stack_pop(ptr noundef %154)
  store ptr %155, ptr %6, align 8, !tbaa !5
  %156 = load ptr, ptr %6, align 8, !tbaa !5
  %157 = load ptr, ptr %156, align 8, !tbaa !5
  call void @treeNode_updateHeight(ptr noundef %157)
  %158 = load ptr, ptr %6, align 8, !tbaa !5
  call void @treeNode_reBalance(ptr noundef %158)
  br label %144, !llvm.loop !21

159:                                              ; preds = %144
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  ret void
}

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #2

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #3

; Function Attrs: nounwind
declare void @free(ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { noreturn nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 32}
!10 = !{!"avlTree", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!11 = !{!10, !6, i64 0}
!12 = !{!10, !6, i64 8}
!13 = !{!14, !6, i64 0}
!14 = !{!"treeNode", !6, i64 0, !6, i64 8, !6, i64 16, !15, i64 24}
!15 = !{!"int", !7, i64 0}
!16 = !{!14, !6, i64 8}
!17 = !{!14, !6, i64 16}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19}
!21 = distinct !{!21, !19}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [31 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @stack_push(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @stack_pop(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @stack_empty(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @stack_init(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @treeNode_updateHeight(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @treeNode_reBalance(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @avlTree_delete(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 32
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  tail call void @stack_init(ptr noundef %4)
  %5 = load ptr, ptr %3, align 8, !tbaa !5
  tail call void @stack_push(ptr noundef %5, ptr noundef %0)
  %.053 = load ptr, ptr %0, align 8, !tbaa !10
  %.not54 = icmp eq ptr %.053, null
  br i1 %.not54, label %.critedge, label %.lr.ph

.lr.ph:                                           ; preds = %2
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  br label %7

7:                                                ; preds = %.lr.ph, %17
  %.055 = phi ptr [ %.053, %.lr.ph ], [ %.0, %17 ]
  %8 = load ptr, ptr %6, align 8, !tbaa !11
  %9 = load ptr, ptr %.055, align 8, !tbaa !12
  %10 = tail call i32 %8(ptr noundef %1, ptr noundef %9) #4
  %11 = icmp slt i32 %10, 0
  br i1 %11, label %17, label %12

12:                                               ; preds = %7
  %13 = load ptr, ptr %6, align 8, !tbaa !11
  %14 = load ptr, ptr %.055, align 8, !tbaa !12
  %15 = tail call i32 %13(ptr noundef %1, ptr noundef %14) #4
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %17, label %22

17:                                               ; preds = %12, %7
  %.sink68 = phi i64 [ 8, %7 ], [ 16, %12 ]
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %.055, i64 %.sink68
  tail call void @stack_push(ptr noundef %18, ptr noundef nonnull %19)
  %.0 = load ptr, ptr %19, align 8, !tbaa !10
  %.not = icmp eq ptr %.0, null
  br i1 %.not, label %.critedge, label %7, !llvm.loop !15

.critedge:                                        ; preds = %17, %2
  %20 = load ptr, ptr @stderr, align 8, !tbaa !10
  %21 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %20, ptr noundef nonnull @.str) #5
  tail call void @exit(i32 noundef 1) #6
  unreachable

22:                                               ; preds = %12
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = tail call ptr @stack_pop(ptr noundef %23)
  %25 = getelementptr inbounds i8, ptr %.055, i64 16
  %26 = load ptr, ptr %25, align 8, !tbaa !17
  %.not47 = icmp eq ptr %26, null
  %27 = getelementptr inbounds i8, ptr %.055, i64 8
  %28 = load ptr, ptr %27, align 8, !tbaa !18
  br i1 %.not47, label %30, label %29

29:                                               ; preds = %22
  %.not48 = icmp eq ptr %28, null
  br i1 %.not48, label %30, label %32

30:                                               ; preds = %22, %29
  %31 = phi ptr [ %26, %29 ], [ %28, %22 ]
  store ptr %31, ptr %24, align 8, !tbaa !10
  br label %46

32:                                               ; preds = %29
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  tail call void @stack_push(ptr noundef %33, ptr noundef %24)
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  tail call void @stack_push(ptr noundef %34, ptr noundef nonnull %25)
  %.04556 = load ptr, ptr %25, align 8, !tbaa !10
  %35 = getelementptr inbounds i8, ptr %.04556, i64 8
  %36 = load ptr, ptr %35, align 8, !tbaa !18
  %.not5057 = icmp eq ptr %36, null
  br i1 %.not5057, label %._crit_edge, label %.lr.ph58

.lr.ph58:                                         ; preds = %32, %.lr.ph58
  %37 = phi ptr [ %39, %.lr.ph58 ], [ %35, %32 ]
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  tail call void @stack_push(ptr noundef %38, ptr noundef nonnull %37)
  %.045 = load ptr, ptr %37, align 8, !tbaa !10
  %39 = getelementptr inbounds i8, ptr %.045, i64 8
  %40 = load ptr, ptr %39, align 8, !tbaa !18
  %.not50 = icmp eq ptr %40, null
  br i1 %.not50, label %._crit_edge, label %.lr.ph58, !llvm.loop !19

._crit_edge:                                      ; preds = %.lr.ph58, %32
  %.045.lcssa = phi ptr [ %.04556, %32 ], [ %.045, %.lr.ph58 ]
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = tail call ptr @stack_pop(ptr noundef %41)
  %43 = load ptr, ptr %.045.lcssa, align 8, !tbaa !12
  store ptr %43, ptr %.055, align 8, !tbaa !12
  %44 = getelementptr inbounds i8, ptr %.045.lcssa, i64 16
  %45 = load ptr, ptr %44, align 8, !tbaa !17
  store ptr %45, ptr %42, align 8, !tbaa !10
  br label %46

46:                                               ; preds = %._crit_edge, %30
  %.045.lcssa.sink = phi ptr [ %.045.lcssa, %._crit_edge ], [ %.055, %30 ]
  tail call void @free(ptr noundef nonnull %.045.lcssa.sink) #4
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = tail call i32 @stack_empty(ptr noundef %47)
  %.not5159 = icmp eq i32 %48, 0
  br i1 %.not5159, label %.lr.ph61, label %._crit_edge62

.lr.ph61:                                         ; preds = %46, %.lr.ph61
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = tail call ptr @stack_pop(ptr noundef %49)
  %51 = load ptr, ptr %50, align 8, !tbaa !10
  tail call void @treeNode_updateHeight(ptr noundef %51)
  tail call void @treeNode_reBalance(ptr noundef nonnull %50)
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = tail call i32 @stack_empty(ptr noundef %52)
  %.not51 = icmp eq i32 %53, 0
  br i1 %.not51, label %.lr.ph61, label %._crit_edge62, !llvm.loop !20

._crit_edge62:                                    ; preds = %.lr.ph61, %46
  ret void
}

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #3

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { cold nounwind }
attributes #6 = { noreturn nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 32}
!6 = !{!"avlTree", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!7, !7, i64 0}
!11 = !{!6, !7, i64 8}
!12 = !{!13, !7, i64 0}
!13 = !{!"treeNode", !7, i64 0, !7, i64 8, !7, i64 16, !14, i64 24}
!14 = !{!"int", !8, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!13, !7, i64 16}
!18 = !{!13, !7, i64 8}
!19 = distinct !{!19, !16}
!20 = distinct !{!20, !16}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass