; LLVM IR from ahampriyanshu/algo-ds-101 :: Data-Structures/Tree/23-Tree/23Tree.ll (Z11fixOverflowP8TreeNode)

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

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%struct.TreeNode = type { [3 x i32], ptr, ptr, ptr, ptr, ptr, i32 }

@root = external dso_local global ptr, align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.1 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [18 x i8], align 1

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_Z7newNodei(i32 noundef) #1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z10isOverflowP8TreeNode(ptr noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_Z11fixOverflowP8TreeNode(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %7 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.1)
  br label %8

8:                                                ; preds = %177, %1
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = call noundef zeroext i1 @_Z10isOverflowP8TreeNode(ptr noundef %9)
  br i1 %10, label %11, label %178

11:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.TreeNode, ptr %12, i32 0, i32 0
  %14 = getelementptr inbounds [3 x i32], ptr %13, i64 0, i64 1
  %15 = load i32, ptr %14, align 4, !tbaa !9
  store i32 %15, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %16 = load ptr, ptr %2, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.TreeNode, ptr %16, i32 0, i32 0
  %18 = getelementptr inbounds [3 x i32], ptr %17, i64 0, i64 2
  %19 = load i32, ptr %18, align 8, !tbaa !9
  %20 = call noundef ptr @_Z7newNodei(i32 noundef %19)
  store ptr %20, ptr %4, align 8, !tbaa !5
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.TreeNode, ptr %21, i32 0, i32 4
  %23 = load ptr, ptr %22, align 8, !tbaa !11
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.TreeNode, ptr %24, i32 0, i32 2
  store ptr %23, ptr %25, align 8, !tbaa !13
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.TreeNode, ptr %26, i32 0, i32 3
  %28 = load ptr, ptr %27, align 8, !tbaa !14
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.TreeNode, ptr %29, i32 0, i32 1
  store ptr %28, ptr %30, align 8, !tbaa !15
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.TreeNode, ptr %31, i32 0, i32 2
  %33 = load ptr, ptr %32, align 8, !tbaa !13
  %34 = icmp ne ptr %33, null
  br i1 %34, label %35, label %41

35:                                               ; preds = %11
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.TreeNode, ptr %37, i32 0, i32 2
  %39 = load ptr, ptr %38, align 8, !tbaa !13
  %40 = getelementptr inbounds %struct.TreeNode, ptr %39, i32 0, i32 5
  store ptr %36, ptr %40, align 8, !tbaa !16
  br label %41

41:                                               ; preds = %35, %11
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.TreeNode, ptr %42, i32 0, i32 1
  %44 = load ptr, ptr %43, align 8, !tbaa !15
  %45 = icmp ne ptr %44, null
  br i1 %45, label %46, label %52

46:                                               ; preds = %41
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.TreeNode, ptr %48, i32 0, i32 1
  %50 = load ptr, ptr %49, align 8, !tbaa !15
  %51 = getelementptr inbounds %struct.TreeNode, ptr %50, i32 0, i32 5
  store ptr %47, ptr %51, align 8, !tbaa !16
  br label %52

52:                                               ; preds = %46, %41
  %53 = load ptr, ptr %2, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.TreeNode, ptr %53, i32 0, i32 0
  %55 = getelementptr inbounds [3 x i32], ptr %54, i64 0, i64 2
  store i32 2147483647, ptr %55, align 8, !tbaa !9
  %56 = load ptr, ptr %2, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.TreeNode, ptr %56, i32 0, i32 0
  %58 = getelementptr inbounds [3 x i32], ptr %57, i64 0, i64 1
  store i32 2147483647, ptr %58, align 4, !tbaa !9
  %59 = load ptr, ptr %2, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.TreeNode, ptr %59, i32 0, i32 4
  store ptr null, ptr %60, align 8, !tbaa !11
  %61 = load ptr, ptr %2, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.TreeNode, ptr %61, i32 0, i32 3
  store ptr null, ptr %62, align 8, !tbaa !14
  %63 = load ptr, ptr %2, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.TreeNode, ptr %63, i32 0, i32 6
  store i32 1, ptr %64, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %65 = load ptr, ptr %2, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.TreeNode, ptr %65, i32 0, i32 5
  %67 = load ptr, ptr %66, align 8, !tbaa !16
  store ptr %67, ptr %5, align 8, !tbaa !5
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = icmp ne ptr %68, null
  br i1 %69, label %84, label %70

70:                                               ; preds = %52
  %71 = load i32, ptr %3, align 4, !tbaa !9
  %72 = call noundef ptr @_Z7newNodei(i32 noundef %71)
  store ptr %72, ptr @root, align 8, !tbaa !5
  %73 = load ptr, ptr @root, align 8, !tbaa !5
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.TreeNode, ptr %74, i32 0, i32 5
  store ptr %73, ptr %75, align 8, !tbaa !16
  %76 = load ptr, ptr %2, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.TreeNode, ptr %76, i32 0, i32 5
  store ptr %73, ptr %77, align 8, !tbaa !16
  %78 = load ptr, ptr %4, align 8, !tbaa !5
  %79 = load ptr, ptr @root, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.TreeNode, ptr %79, i32 0, i32 2
  store ptr %78, ptr %80, align 8, !tbaa !13
  %81 = load ptr, ptr %2, align 8, !tbaa !5
  %82 = load ptr, ptr @root, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.TreeNode, ptr %82, i32 0, i32 1
  store ptr %81, ptr %83, align 8, !tbaa !15
  store i32 3, ptr %6, align 4
  br label %175

84:                                               ; preds = %52
  %85 = load ptr, ptr %5, align 8, !tbaa !5
  %86 = load ptr, ptr %4, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.TreeNode, ptr %86, i32 0, i32 5
  store ptr %85, ptr %87, align 8, !tbaa !16
  %88 = load ptr, ptr %2, align 8, !tbaa !5
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.TreeNode, ptr %89, i32 0, i32 1
  %91 = load ptr, ptr %90, align 8, !tbaa !15
  %92 = icmp eq ptr %88, %91
  br i1 %92, label %93, label %129

93:                                               ; preds = %84
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.TreeNode, ptr %94, i32 0, i32 0
  %96 = getelementptr inbounds [3 x i32], ptr %95, i64 0, i64 1
  %97 = load i32, ptr %96, align 4, !tbaa !9
  %98 = load ptr, ptr %5, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.TreeNode, ptr %98, i32 0, i32 0
  %100 = getelementptr inbounds [3 x i32], ptr %99, i64 0, i64 2
  store i32 %97, ptr %100, align 8, !tbaa !9
  %101 = load ptr, ptr %5, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.TreeNode, ptr %101, i32 0, i32 0
  %103 = getelementptr inbounds [3 x i32], ptr %102, i64 0, i64 0
  %104 = load i32, ptr %103, align 8, !tbaa !9
  %105 = load ptr, ptr %5, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.TreeNode, ptr %105, i32 0, i32 0
  %107 = getelementptr inbounds [3 x i32], ptr %106, i64 0, i64 1
  store i32 %104, ptr %107, align 4, !tbaa !9
  %108 = load i32, ptr %3, align 4, !tbaa !9
  %109 = load ptr, ptr %5, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.TreeNode, ptr %109, i32 0, i32 0
  %111 = getelementptr inbounds [3 x i32], ptr %110, i64 0, i64 0
  store i32 %108, ptr %111, align 8, !tbaa !9
  %112 = load ptr, ptr %5, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.TreeNode, ptr %112, i32 0, i32 6
  %114 = load i32, ptr %113, align 8, !tbaa !17
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %113, align 8, !tbaa !17
  %116 = load ptr, ptr %5, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.TreeNode, ptr %116, i32 0, i32 3
  %118 = load ptr, ptr %117, align 8, !tbaa !14
  %119 = load ptr, ptr %5, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.TreeNode, ptr %119, i32 0, i32 4
  store ptr %118, ptr %120, align 8, !tbaa !11
  %121 = load ptr, ptr %5, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.TreeNode, ptr %121, i32 0, i32 2
  %123 = load ptr, ptr %122, align 8, !tbaa !13
  %124 = load ptr, ptr %5, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.TreeNode, ptr %124, i32 0, i32 3
  store ptr %123, ptr %125, align 8, !tbaa !14
  %126 = load ptr, ptr %4, align 8, !tbaa !5
  %127 = load ptr, ptr %5, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.TreeNode, ptr %127, i32 0, i32 2
  store ptr %126, ptr %128, align 8, !tbaa !13
  br label %172

129:                                              ; preds = %84
  %130 = load ptr, ptr %2, align 8, !tbaa !5
  %131 = load ptr, ptr %5, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.TreeNode, ptr %131, i32 0, i32 2
  %133 = load ptr, ptr %132, align 8, !tbaa !13
  %134 = icmp eq ptr %130, %133
  br i1 %134, label %135, label %159

135:                                              ; preds = %129
  %136 = load ptr, ptr %5, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.TreeNode, ptr %136, i32 0, i32 0
  %138 = getelementptr inbounds [3 x i32], ptr %137, i64 0, i64 1
  %139 = load i32, ptr %138, align 4, !tbaa !9
  %140 = load ptr, ptr %5, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.TreeNode, ptr %140, i32 0, i32 0
  %142 = getelementptr inbounds [3 x i32], ptr %141, i64 0, i64 2
  store i32 %139, ptr %142, align 8, !tbaa !9
  %143 = load i32, ptr %3, align 4, !tbaa !9
  %144 = load ptr, ptr %5, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.TreeNode, ptr %144, i32 0, i32 0
  %146 = getelementptr inbounds [3 x i32], ptr %145, i64 0, i64 1
  store i32 %143, ptr %146, align 4, !tbaa !9
  %147 = load ptr, ptr %5, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.TreeNode, ptr %147, i32 0, i32 6
  %149 = load i32, ptr %148, align 8, !tbaa !17
  %150 = add nsw i32 %149, 1
  store i32 %150, ptr %148, align 8, !tbaa !17
  %151 = load ptr, ptr %5, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.TreeNode, ptr %151, i32 0, i32 3
  %153 = load ptr, ptr %152, align 8, !tbaa !14
  %154 = load ptr, ptr %5, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.TreeNode, ptr %154, i32 0, i32 4
  store ptr %153, ptr %155, align 8, !tbaa !11
  %156 = load ptr, ptr %4, align 8, !tbaa !5
  %157 = load ptr, ptr %5, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.TreeNode, ptr %157, i32 0, i32 3
  store ptr %156, ptr %158, align 8, !tbaa !14
  br label %171

159:                                              ; preds = %129
  %160 = load i32, ptr %3, align 4, !tbaa !9
  %161 = load ptr, ptr %5, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.TreeNode, ptr %161, i32 0, i32 0
  %163 = getelementptr inbounds [3 x i32], ptr %162, i64 0, i64 2
  store i32 %160, ptr %163, align 8, !tbaa !9
  %164 = load ptr, ptr %5, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.TreeNode, ptr %164, i32 0, i32 6
  %166 = load i32, ptr %165, align 8, !tbaa !17
  %167 = add nsw i32 %166, 1
  store i32 %167, ptr %165, align 8, !tbaa !17
  %168 = load ptr, ptr %4, align 8, !tbaa !5
  %169 = load ptr, ptr %5, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.TreeNode, ptr %169, i32 0, i32 4
  store ptr %168, ptr %170, align 8, !tbaa !11
  br label %171

171:                                              ; preds = %159, %135
  br label %172

172:                                              ; preds = %171, %93
  %173 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %173, ptr %2, align 8, !tbaa !5
  br label %174

174:                                              ; preds = %172
  store i32 0, ptr %6, align 4
  br label %175

175:                                              ; preds = %174, %70
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  %176 = load i32, ptr %6, align 4
  switch i32 %176, label %180 [
    i32 0, label %177
    i32 3, label %178
  ]

177:                                              ; preds = %175
  br label %8, !llvm.loop !18

178:                                              ; preds = %175, %8
  %179 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.2)
  ret void

180:                                              ; preds = %175
  unreachable
}

attributes #0 = { inlinehint 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 #1 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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, !6, i64 40}
!12 = !{!"_ZTS8TreeNode", !7, i64 0, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !10, i64 56}
!13 = !{!12, !6, i64 24}
!14 = !{!12, !6, i64 32}
!15 = !{!12, !6, i64 16}
!16 = !{!12, !6, i64 48}
!17 = !{!12, !10, i64 56}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}


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

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@root = external dso_local local_unnamed_addr global ptr, align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.1 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [18 x i8], align 1

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_Z7newNodei(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z10isOverflowP8TreeNode(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z11fixOverflowP8TreeNode(ptr noundef %0) local_unnamed_addr #1 {
  %2 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.1)
  %3 = tail call noundef zeroext i1 @_Z10isOverflowP8TreeNode(ptr noundef %0)
  br i1 %3, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %1, %63
  %.05971 = phi ptr [ %23, %63 ], [ %0, %1 ]
  %4 = getelementptr inbounds i8, ptr %.05971, i64 4
  %5 = load i32, ptr %4, align 4, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %.05971, i64 8
  %7 = load i32, ptr %6, align 8, !tbaa !5
  %8 = tail call noundef ptr @_Z7newNodei(i32 noundef %7)
  %9 = getelementptr inbounds i8, ptr %.05971, i64 40
  %10 = load ptr, ptr %9, align 8, !tbaa !9
  %11 = getelementptr inbounds i8, ptr %8, i64 24
  store ptr %10, ptr %11, align 8, !tbaa !12
  %12 = getelementptr inbounds i8, ptr %.05971, i64 32
  %13 = load ptr, ptr %12, align 8, !tbaa !13
  %14 = getelementptr inbounds i8, ptr %8, i64 16
  store ptr %13, ptr %14, align 8, !tbaa !14
  %.not = icmp eq ptr %10, null
  br i1 %.not, label %17, label %15

15:                                               ; preds = %.lr.ph
  %16 = getelementptr inbounds i8, ptr %10, i64 48
  store ptr %8, ptr %16, align 8, !tbaa !15
  br label %17

17:                                               ; preds = %15, %.lr.ph
  %.not63 = icmp eq ptr %13, null
  br i1 %.not63, label %20, label %18

18:                                               ; preds = %17
  %19 = getelementptr inbounds i8, ptr %13, i64 48
  store ptr %8, ptr %19, align 8, !tbaa !15
  br label %20

20:                                               ; preds = %18, %17
  store i32 2147483647, ptr %6, align 8, !tbaa !5
  store i32 2147483647, ptr %4, align 4, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %.05971, i64 56
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %12, i8 0, i64 16, i1 false)
  store i32 1, ptr %21, align 8, !tbaa !16
  %22 = getelementptr inbounds i8, ptr %.05971, i64 48
  %23 = load ptr, ptr %22, align 8, !tbaa !15
  %.not64 = icmp eq ptr %23, null
  br i1 %.not64, label %.thread, label %29

.thread:                                          ; preds = %20
  %24 = getelementptr inbounds i8, ptr %.05971, i64 48
  %25 = tail call noundef ptr @_Z7newNodei(i32 noundef %5)
  store ptr %25, ptr @root, align 8, !tbaa !17
  %26 = getelementptr inbounds i8, ptr %8, i64 48
  store ptr %25, ptr %26, align 8, !tbaa !15
  store ptr %25, ptr %24, align 8, !tbaa !15
  %27 = getelementptr inbounds i8, ptr %25, i64 24
  store ptr %8, ptr %27, align 8, !tbaa !12
  %28 = getelementptr inbounds i8, ptr %25, i64 16
  store ptr %.05971, ptr %28, align 8, !tbaa !14
  br label %.loopexit

29:                                               ; preds = %20
  %30 = getelementptr inbounds i8, ptr %8, i64 48
  store ptr %23, ptr %30, align 8, !tbaa !15
  %31 = getelementptr inbounds i8, ptr %23, i64 16
  %32 = load ptr, ptr %31, align 8, !tbaa !14
  %33 = icmp eq ptr %.05971, %32
  br i1 %33, label %34, label %43

34:                                               ; preds = %29
  %35 = getelementptr inbounds i8, ptr %23, i64 4
  %36 = load <2 x i32>, ptr %23, align 8, !tbaa !5
  store <2 x i32> %36, ptr %35, align 4, !tbaa !5
  store i32 %5, ptr %23, align 8, !tbaa !5
  %37 = getelementptr inbounds i8, ptr %23, i64 56
  %38 = load i32, ptr %37, align 8, !tbaa !16
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr %37, align 8, !tbaa !16
  %40 = getelementptr inbounds i8, ptr %23, i64 32
  %41 = getelementptr inbounds i8, ptr %23, i64 24
  %42 = load <2 x ptr>, ptr %41, align 8, !tbaa !17
  store <2 x ptr> %42, ptr %40, align 8, !tbaa !17
  br label %63

43:                                               ; preds = %29
  %44 = getelementptr inbounds i8, ptr %23, i64 24
  %45 = load ptr, ptr %44, align 8, !tbaa !12
  %46 = icmp eq ptr %.05971, %45
  br i1 %46, label %47, label %57

47:                                               ; preds = %43
  %48 = getelementptr inbounds i8, ptr %23, i64 4
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = getelementptr inbounds i8, ptr %23, i64 8
  store i32 %49, ptr %50, align 8, !tbaa !5
  store i32 %5, ptr %48, align 4, !tbaa !5
  %51 = getelementptr inbounds i8, ptr %23, i64 56
  %52 = load i32, ptr %51, align 8, !tbaa !16
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %51, align 8, !tbaa !16
  %54 = getelementptr inbounds i8, ptr %23, i64 32
  %55 = load ptr, ptr %54, align 8, !tbaa !13
  %56 = getelementptr inbounds i8, ptr %23, i64 40
  store ptr %55, ptr %56, align 8, !tbaa !9
  br label %63

57:                                               ; preds = %43
  %58 = getelementptr inbounds i8, ptr %23, i64 8
  store i32 %5, ptr %58, align 8, !tbaa !5
  %59 = getelementptr inbounds i8, ptr %23, i64 56
  %60 = load i32, ptr %59, align 8, !tbaa !16
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %59, align 8, !tbaa !16
  %62 = getelementptr inbounds i8, ptr %23, i64 40
  br label %63

63:                                               ; preds = %34, %57, %47
  %.sink = phi ptr [ %41, %34 ], [ %62, %57 ], [ %54, %47 ]
  store ptr %8, ptr %.sink, align 8, !tbaa !17
  %64 = tail call noundef zeroext i1 @_Z10isOverflowP8TreeNode(ptr noundef nonnull %23)
  br i1 %64, label %.lr.ph, label %.loopexit

.loopexit:                                        ; preds = %63, %1, %.thread
  %65 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.2)
  ret void
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

attributes #0 = { inlinehint 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 #1 = { 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 #2 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 40}
!10 = !{!"_ZTS8TreeNode", !7, i64 0, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !6, i64 56}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!10, !11, i64 24}
!13 = !{!10, !11, i64 32}
!14 = !{!10, !11, i64 16}
!15 = !{!10, !11, i64 48}
!16 = !{!10, !6, i64 56}
!17 = !{!11, !11, i64 0}


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