; LLVM IR from UtkarshPathrabe/Competitive-Coding :: Model Algorithms/Advanced Data Structure/AVL Tree.ll (Z10deleteNodeP4nodei)

; 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.node = type { i32, i32, i32, ptr, ptr }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3maxii(i32 noundef, i32 noundef) #0

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_Z11rightRotateP4node(ptr noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_Z10leftRotateP4node(ptr noundef) #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_Z12minValueNodeP4node(ptr noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_Z10deleteNodeP4nodei(ptr noundef %0, i32 noundef %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = icmp eq ptr %10, null
  br i1 %11, label %12, label %13

12:                                               ; preds = %2
  store ptr null, ptr %3, align 8
  br label %188

13:                                               ; preds = %2
  %14 = load i32, ptr %5, align 4, !tbaa !9
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.node, ptr %15, i32 0, i32 0
  %17 = load i32, ptr %16, align 8, !tbaa !11
  %18 = icmp slt i32 %14, %17
  br i1 %18, label %19, label %27

19:                                               ; preds = %13
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.node, ptr %20, i32 0, i32 3
  %22 = load ptr, ptr %21, align 8, !tbaa !13
  %23 = load i32, ptr %5, align 4, !tbaa !9
  %24 = call noundef ptr @_Z10deleteNodeP4nodei(ptr noundef %22, i32 noundef %23)
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.node, ptr %25, i32 0, i32 3
  store ptr %24, ptr %26, align 8, !tbaa !13
  br label %107

27:                                               ; preds = %13
  %28 = load i32, ptr %5, align 4, !tbaa !9
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.node, ptr %29, i32 0, i32 0
  %31 = load i32, ptr %30, align 8, !tbaa !11
  %32 = icmp sgt i32 %28, %31
  br i1 %32, label %33, label %41

33:                                               ; preds = %27
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.node, ptr %34, i32 0, i32 4
  %36 = load ptr, ptr %35, align 8, !tbaa !14
  %37 = load i32, ptr %5, align 4, !tbaa !9
  %38 = call noundef ptr @_Z10deleteNodeP4nodei(ptr noundef %36, i32 noundef %37)
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.node, ptr %39, i32 0, i32 4
  store ptr %38, ptr %40, align 8, !tbaa !14
  br label %106

41:                                               ; preds = %27
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.node, ptr %42, i32 0, i32 2
  %44 = load i32, ptr %43, align 8, !tbaa !15
  %45 = icmp sgt i32 %44, 1
  br i1 %45, label %46, label %52

46:                                               ; preds = %41
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.node, ptr %47, i32 0, i32 2
  %49 = load i32, ptr %48, align 8, !tbaa !15
  %50 = add nsw i32 %49, -1
  store i32 %50, ptr %48, align 8, !tbaa !15
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %51, ptr %3, align 8
  br label %188

52:                                               ; preds = %41
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.node, ptr %53, i32 0, i32 3
  %55 = load ptr, ptr %54, align 8, !tbaa !13
  %56 = icmp eq ptr %55, null
  br i1 %56, label %62, label %57

57:                                               ; preds = %52
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.node, ptr %58, i32 0, i32 4
  %60 = load ptr, ptr %59, align 8, !tbaa !14
  %61 = icmp eq ptr %60, null
  br i1 %61, label %62, label %86

62:                                               ; preds = %57, %52
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.node, ptr %63, i32 0, i32 3
  %65 = load ptr, ptr %64, align 8, !tbaa !13
  %66 = icmp ne ptr %65, null
  br i1 %66, label %67, label %71

67:                                               ; preds = %62
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.node, ptr %68, i32 0, i32 3
  %70 = load ptr, ptr %69, align 8, !tbaa !13
  br label %75

71:                                               ; preds = %62
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.node, ptr %72, i32 0, i32 4
  %74 = load ptr, ptr %73, align 8, !tbaa !14
  br label %75

75:                                               ; preds = %71, %67
  %76 = phi ptr [ %70, %67 ], [ %74, %71 ]
  store ptr %76, ptr %6, align 8, !tbaa !5
  %77 = load ptr, ptr %6, align 8, !tbaa !5
  %78 = icmp eq ptr %77, null
  br i1 %78, label %79, label %81

79:                                               ; preds = %75
  %80 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %80, ptr %6, align 8, !tbaa !5
  store ptr null, ptr %4, align 8, !tbaa !5
  br label %84

81:                                               ; preds = %75
  %82 = load ptr, ptr %6, align 8, !tbaa !5
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %83, ptr align 8 %82, i64 32, i1 false), !tbaa.struct !16
  br label %84

84:                                               ; preds = %81, %79
  %85 = load ptr, ptr %6, align 8, !tbaa !5
  call void @free(ptr noundef %85) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %105

86:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.node, ptr %87, i32 0, i32 4
  %89 = load ptr, ptr %88, align 8, !tbaa !14
  %90 = call noundef ptr @_Z12minValueNodeP4node(ptr noundef %89)
  store ptr %90, ptr %7, align 8, !tbaa !5
  %91 = load ptr, ptr %7, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.node, ptr %91, i32 0, i32 0
  %93 = load i32, ptr %92, align 8, !tbaa !11
  %94 = load ptr, ptr %4, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.node, ptr %94, i32 0, i32 0
  store i32 %93, ptr %95, align 8, !tbaa !11
  %96 = load ptr, ptr %4, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.node, ptr %96, i32 0, i32 4
  %98 = load ptr, ptr %97, align 8, !tbaa !14
  %99 = load ptr, ptr %7, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.node, ptr %99, i32 0, i32 0
  %101 = load i32, ptr %100, align 8, !tbaa !11
  %102 = call noundef ptr @_Z10deleteNodeP4nodei(ptr noundef %98, i32 noundef %101)
  %103 = load ptr, ptr %4, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.node, ptr %103, i32 0, i32 4
  store ptr %102, ptr %104, align 8, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %105

105:                                              ; preds = %86, %84
  br label %106

106:                                              ; preds = %105, %33
  br label %107

107:                                              ; preds = %106, %19
  %108 = load ptr, ptr %4, align 8, !tbaa !5
  %109 = icmp eq ptr %108, null
  br i1 %109, label %110, label %111

110:                                              ; preds = %107
  store ptr null, ptr %3, align 8
  br label %188

111:                                              ; preds = %107
  %112 = load ptr, ptr %4, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.node, ptr %112, i32 0, i32 3
  %114 = load ptr, ptr %113, align 8, !tbaa !13
  %115 = call noundef i32 @_Z6heightP4node(ptr noundef %114)
  %116 = load ptr, ptr %4, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.node, ptr %116, i32 0, i32 4
  %118 = load ptr, ptr %117, align 8, !tbaa !14
  %119 = call noundef i32 @_Z6heightP4node(ptr noundef %118)
  %120 = call noundef i32 @_Z3maxii(i32 noundef %115, i32 noundef %119)
  %121 = add nsw i32 %120, 1
  %122 = load ptr, ptr %4, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.node, ptr %122, i32 0, i32 1
  store i32 %121, ptr %123, align 4, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %124 = load ptr, ptr %4, align 8, !tbaa !5
  %125 = call noundef i32 @_Z10getBalanceP4node(ptr noundef %124)
  store i32 %125, ptr %8, align 4, !tbaa !9
  %126 = load i32, ptr %8, align 4, !tbaa !9
  %127 = icmp sgt i32 %126, 1
  br i1 %127, label %128, label %137

128:                                              ; preds = %111
  %129 = load ptr, ptr %4, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.node, ptr %129, i32 0, i32 3
  %131 = load ptr, ptr %130, align 8, !tbaa !13
  %132 = call noundef i32 @_Z10getBalanceP4node(ptr noundef %131)
  %133 = icmp sge i32 %132, 0
  br i1 %133, label %134, label %137

134:                                              ; preds = %128
  %135 = load ptr, ptr %4, align 8, !tbaa !5
  %136 = call noundef ptr @_Z11rightRotateP4node(ptr noundef %135)
  store ptr %136, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %187

137:                                              ; preds = %128, %111
  %138 = load i32, ptr %8, align 4, !tbaa !9
  %139 = icmp sgt i32 %138, 1
  br i1 %139, label %140, label %155

140:                                              ; preds = %137
  %141 = load ptr, ptr %4, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.node, ptr %141, i32 0, i32 3
  %143 = load ptr, ptr %142, align 8, !tbaa !13
  %144 = call noundef i32 @_Z10getBalanceP4node(ptr noundef %143)
  %145 = icmp slt i32 %144, 0
  br i1 %145, label %146, label %155

146:                                              ; preds = %140
  %147 = load ptr, ptr %4, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.node, ptr %147, i32 0, i32 3
  %149 = load ptr, ptr %148, align 8, !tbaa !13
  %150 = call noundef ptr @_Z10leftRotateP4node(ptr noundef %149)
  %151 = load ptr, ptr %4, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.node, ptr %151, i32 0, i32 3
  store ptr %150, ptr %152, align 8, !tbaa !13
  %153 = load ptr, ptr %4, align 8, !tbaa !5
  %154 = call noundef ptr @_Z11rightRotateP4node(ptr noundef %153)
  store ptr %154, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %187

155:                                              ; preds = %140, %137
  %156 = load i32, ptr %8, align 4, !tbaa !9
  %157 = icmp slt i32 %156, -1
  br i1 %157, label %158, label %167

158:                                              ; preds = %155
  %159 = load ptr, ptr %4, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.node, ptr %159, i32 0, i32 4
  %161 = load ptr, ptr %160, align 8, !tbaa !14
  %162 = call noundef i32 @_Z10getBalanceP4node(ptr noundef %161)
  %163 = icmp sle i32 %162, 0
  br i1 %163, label %164, label %167

164:                                              ; preds = %158
  %165 = load ptr, ptr %4, align 8, !tbaa !5
  %166 = call noundef ptr @_Z10leftRotateP4node(ptr noundef %165)
  store ptr %166, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %187

167:                                              ; preds = %158, %155
  %168 = load i32, ptr %8, align 4, !tbaa !9
  %169 = icmp slt i32 %168, -1
  br i1 %169, label %170, label %185

170:                                              ; preds = %167
  %171 = load ptr, ptr %4, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.node, ptr %171, i32 0, i32 4
  %173 = load ptr, ptr %172, align 8, !tbaa !14
  %174 = call noundef i32 @_Z10getBalanceP4node(ptr noundef %173)
  %175 = icmp sgt i32 %174, 0
  br i1 %175, label %176, label %185

176:                                              ; preds = %170
  %177 = load ptr, ptr %4, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.node, ptr %177, i32 0, i32 4
  %179 = load ptr, ptr %178, align 8, !tbaa !14
  %180 = call noundef ptr @_Z11rightRotateP4node(ptr noundef %179)
  %181 = load ptr, ptr %4, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.node, ptr %181, i32 0, i32 4
  store ptr %180, ptr %182, align 8, !tbaa !14
  %183 = load ptr, ptr %4, align 8, !tbaa !5
  %184 = call noundef ptr @_Z10leftRotateP4node(ptr noundef %183)
  store ptr %184, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %187

185:                                              ; preds = %170, %167
  %186 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %186, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %187

187:                                              ; preds = %185, %176, %164, %146, %134
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %188

188:                                              ; preds = %187, %110, %46, %12
  %189 = load ptr, ptr %3, align 8
  ret ptr %189
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

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

attributes #0 = { mustprogress 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_ZTS4node", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16, !6, i64 24}
!13 = !{!12, !6, i64 16}
!14 = !{!12, !6, i64 24}
!15 = !{!12, !10, i64 8}
!16 = !{i64 0, i64 4, !9, i64 4, i64 4, !9, i64 8, i64 4, !9, i64 16, i64 8, !5, i64 24, i64 8, !5}
!17 = !{!12, !10, i64 4}


; 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"

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3maxii(i32 noundef, i32 noundef) local_unnamed_addr #0

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef ptr @_Z10deleteNodeP4nodei(ptr noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = icmp eq ptr %0, null
  br i1 %3, label %.critedge64, label %4

4:                                                ; preds = %2
  %5 = load i32, ptr %0, align 8, !tbaa !5
  %6 = icmp sgt i32 %5, %1
  br i1 %6, label %7, label %11

7:                                                ; preds = %4
  %8 = getelementptr inbounds i8, ptr %0, i64 16
  %9 = load ptr, ptr %8, align 8, !tbaa !11
  %10 = tail call noundef ptr @_Z10deleteNodeP4nodei(ptr noundef %9, i32 noundef %1)
  store ptr %10, ptr %8, align 8, !tbaa !11
  br label %.thread66

11:                                               ; preds = %4
  %12 = icmp slt i32 %5, %1
  br i1 %12, label %13, label %17

13:                                               ; preds = %11
  %14 = getelementptr inbounds i8, ptr %0, i64 24
  %15 = load ptr, ptr %14, align 8, !tbaa !12
  %16 = tail call noundef ptr @_Z10deleteNodeP4nodei(ptr noundef %15, i32 noundef %1)
  store ptr %16, ptr %14, align 8, !tbaa !12
  br label %.thread66

17:                                               ; preds = %11
  %18 = getelementptr inbounds i8, ptr %0, i64 8
  %19 = load i32, ptr %18, align 8, !tbaa !13
  %20 = icmp sgt i32 %19, 1
  br i1 %20, label %21, label %23

21:                                               ; preds = %17
  %22 = add nsw i32 %19, -1
  store i32 %22, ptr %18, align 8, !tbaa !13
  br label %.critedge64

23:                                               ; preds = %17
  %24 = getelementptr inbounds i8, ptr %0, i64 16
  %25 = load ptr, ptr %24, align 8, !tbaa !11
  %26 = icmp eq ptr %25, null
  %27 = getelementptr inbounds i8, ptr %0, i64 24
  %28 = load ptr, ptr %27, align 8, !tbaa !12
  %29 = icmp eq ptr %28, null
  br i1 %26, label %31, label %30

30:                                               ; preds = %23
  br i1 %29, label %.thread65, label %32

31:                                               ; preds = %23
  br i1 %29, label %.thread69, label %.thread65

.thread69:                                        ; preds = %31
  tail call void @free(ptr noundef nonnull %0) #3
  br label %.critedge64

32:                                               ; preds = %30
  %33 = tail call noundef ptr @_Z12minValueNodeP4node(ptr noundef nonnull %28)
  %34 = load i32, ptr %33, align 8, !tbaa !5
  store i32 %34, ptr %0, align 8, !tbaa !5
  %35 = load ptr, ptr %27, align 8, !tbaa !12
  %36 = tail call noundef ptr @_Z10deleteNodeP4nodei(ptr noundef %35, i32 noundef %34)
  store ptr %36, ptr %27, align 8, !tbaa !12
  br label %.thread66

.thread65:                                        ; preds = %30, %31
  %37 = phi ptr [ %28, %31 ], [ %25, %30 ]
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %37, i64 32, i1 false), !tbaa.struct !14
  tail call void @free(ptr noundef nonnull %37) #3
  br label %.thread66

.thread66:                                        ; preds = %32, %13, %7, %.thread65
  %38 = getelementptr inbounds i8, ptr %0, i64 16
  %39 = load ptr, ptr %38, align 8, !tbaa !11
  %40 = tail call noundef i32 @_Z6heightP4node(ptr noundef %39)
  %41 = getelementptr inbounds i8, ptr %0, i64 24
  %42 = load ptr, ptr %41, align 8, !tbaa !12
  %43 = tail call noundef i32 @_Z6heightP4node(ptr noundef %42)
  %44 = tail call noundef i32 @_Z3maxii(i32 noundef %40, i32 noundef %43)
  %45 = add nsw i32 %44, 1
  %46 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 %45, ptr %46, align 4, !tbaa !17
  %47 = tail call noundef i32 @_Z10getBalanceP4node(ptr noundef nonnull %0)
  %48 = icmp sgt i32 %47, 1
  br i1 %48, label %49, label %.critedge

49:                                               ; preds = %.thread66
  %50 = load ptr, ptr %38, align 8, !tbaa !11
  %51 = tail call noundef i32 @_Z10getBalanceP4node(ptr noundef %50)
  %52 = icmp sgt i32 %51, -1
  br i1 %52, label %53, label %55

53:                                               ; preds = %49
  %54 = tail call noundef ptr @_Z11rightRotateP4node(ptr noundef nonnull %0)
  br label %.critedge64

55:                                               ; preds = %49
  %56 = load ptr, ptr %38, align 8, !tbaa !11
  %57 = tail call noundef i32 @_Z10getBalanceP4node(ptr noundef %56)
  %58 = icmp slt i32 %57, 0
  br i1 %58, label %59, label %.critedge64

59:                                               ; preds = %55
  %60 = load ptr, ptr %38, align 8, !tbaa !11
  %61 = tail call noundef ptr @_Z10leftRotateP4node(ptr noundef %60)
  store ptr %61, ptr %38, align 8, !tbaa !11
  %62 = tail call noundef ptr @_Z11rightRotateP4node(ptr noundef nonnull %0)
  br label %.critedge64

.critedge:                                        ; preds = %.thread66
  %63 = icmp slt i32 %47, -1
  br i1 %63, label %64, label %.critedge64

64:                                               ; preds = %.critedge
  %65 = load ptr, ptr %41, align 8, !tbaa !12
  %66 = tail call noundef i32 @_Z10getBalanceP4node(ptr noundef %65)
  %67 = icmp slt i32 %66, 1
  br i1 %67, label %68, label %70

68:                                               ; preds = %64
  %69 = tail call noundef ptr @_Z10leftRotateP4node(ptr noundef nonnull %0)
  br label %.critedge64

70:                                               ; preds = %64
  %71 = load ptr, ptr %41, align 8, !tbaa !12
  %72 = tail call noundef i32 @_Z10getBalanceP4node(ptr noundef %71)
  %73 = icmp sgt i32 %72, 0
  br i1 %73, label %74, label %.critedge64

74:                                               ; preds = %70
  %75 = load ptr, ptr %41, align 8, !tbaa !12
  %76 = tail call noundef ptr @_Z11rightRotateP4node(ptr noundef %75)
  store ptr %76, ptr %41, align 8, !tbaa !12
  %77 = tail call noundef ptr @_Z10leftRotateP4node(ptr noundef nonnull %0)
  br label %.critedge64

.critedge64:                                      ; preds = %55, %.thread69, %53, %59, %68, %74, %.critedge, %70, %2, %21
  %.1 = phi ptr [ %0, %21 ], [ null, %2 ], [ %54, %53 ], [ %62, %59 ], [ %69, %68 ], [ %77, %74 ], [ %0, %.critedge ], [ %0, %70 ], [ null, %.thread69 ], [ %0, %55 ]
  ret ptr %.1
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

attributes #0 = { mustprogress 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 0}
!6 = !{!"_ZTS4node", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !10, i64 24}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !10, i64 16}
!12 = !{!6, !10, i64 24}
!13 = !{!6, !7, i64 8}
!14 = !{i64 0, i64 4, !15, i64 4, i64 4, !15, i64 8, i64 4, !15, i64 16, i64 8, !16, i64 24, i64 8, !16}
!15 = !{!7, !7, i64 0}
!16 = !{!10, !10, i64 0}
!17 = !{!6, !7, i64 4}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass