; LLVM IR from edualgo/dsa-code-store :: Generic-Tree/Generic-Tree-master/TreeSource (main)

; 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.TreeNode = type { i32, %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<TreeNode<int> *, std::allocator<TreeNode<int> *>>::_Vector_impl" }
%"struct.std::_Vector_base<TreeNode<int> *, std::allocator<TreeNode<int> *>>::_Vector_impl" = type { %"struct.std::_Vector_base<TreeNode<int> *, std::allocator<TreeNode<int> *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<TreeNode<int> *, std::allocator<TreeNode<int> *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.Secondlargest_return = type { ptr, ptr }

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIP8TreeNodeIiESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP8TreeNodeIiESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #3 align 2

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

12:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %13 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 16) #6
  invoke void @_ZN20Secondlargest_returnIiEC2EP8TreeNodeIiES3_(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef null, ptr noundef null)
          to label %14 unwind label %16

14:                                               ; preds = %12
  store ptr %13, ptr %4, align 8, !tbaa !5
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %15, ptr %2, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  br label %149

16:                                               ; preds = %12
  %17 = landingpad { ptr, i32 }
          cleanup
  %18 = extractvalue { ptr, i32 } %17, 0
  store ptr %18, ptr %5, align 8
  %19 = extractvalue { ptr, i32 } %17, 1
  store i32 %19, ptr %6, align 4
  call void @_ZdlPvm(ptr noundef %13, i64 noundef 16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  br label %151

20:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %21 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 16) #6
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  invoke void @_ZN20Secondlargest_returnIiEC2EP8TreeNodeIiES3_(ptr noundef nonnull align 8 dereferenceable(16) %21, ptr noundef %22, ptr noundef null)
          to label %23 unwind label %32

23:                                               ; preds = %20
  store ptr %21, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %24

24:                                               ; preds = %144, %23
  %25 = load i32, ptr %8, align 4, !tbaa !9
  %26 = sext i32 %25 to i64
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = getelementptr inbounds %class.TreeNode, ptr %27, i32 0, i32 1
  %29 = call noundef i64 @_ZNKSt6vectorIP8TreeNodeIiESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %28) #5
  %30 = icmp ult i64 %26, %29
  br i1 %30, label %36, label %31

31:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %147

32:                                               ; preds = %20
  %33 = landingpad { ptr, i32 }
          cleanup
  %34 = extractvalue { ptr, i32 } %33, 0
  store ptr %34, ptr %5, align 8
  %35 = extractvalue { ptr, i32 } %33, 1
  store i32 %35, ptr %6, align 4
  call void @_ZdlPvm(ptr noundef %21, i64 noundef 16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %151

36:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = getelementptr inbounds %class.TreeNode, ptr %37, i32 0, i32 1
  %39 = load i32, ptr %8, align 4, !tbaa !9
  %40 = sext i32 %39 to i64
  %41 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP8TreeNodeIiESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %38, i64 noundef %40) #5
  %42 = load ptr, ptr %41, align 8, !tbaa !5
  %43 = call noundef ptr @_Z21second_largest_helperP8TreeNodeIiE(ptr noundef %42)
  store ptr %43, ptr %9, align 8, !tbaa !5
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  %45 = getelementptr inbounds %class.Secondlargest_return, ptr %44, i32 0, i32 0
  %46 = load ptr, ptr %45, align 8, !tbaa !11
  %47 = getelementptr inbounds %class.TreeNode, ptr %46, i32 0, i32 0
  %48 = load i32, ptr %47, align 8, !tbaa !13
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  %50 = getelementptr inbounds %class.Secondlargest_return, ptr %49, i32 0, i32 0
  %51 = load ptr, ptr %50, align 8, !tbaa !11
  %52 = getelementptr inbounds %class.TreeNode, ptr %51, i32 0, i32 0
  %53 = load i32, ptr %52, align 8, !tbaa !13
  %54 = icmp sgt i32 %48, %53
  br i1 %54, label %55, label %107

55:                                               ; preds = %36
  %56 = load ptr, ptr %9, align 8, !tbaa !5
  %57 = getelementptr inbounds %class.Secondlargest_return, ptr %56, i32 0, i32 1
  %58 = load ptr, ptr %57, align 8, !tbaa !19
  %59 = icmp eq ptr %58, null
  br i1 %59, label %60, label %71

60:                                               ; preds = %55
  %61 = load ptr, ptr %7, align 8, !tbaa !5
  %62 = getelementptr inbounds %class.Secondlargest_return, ptr %61, i32 0, i32 0
  %63 = load ptr, ptr %62, align 8, !tbaa !11
  %64 = load ptr, ptr %7, align 8, !tbaa !5
  %65 = getelementptr inbounds %class.Secondlargest_return, ptr %64, i32 0, i32 1
  store ptr %63, ptr %65, align 8, !tbaa !19
  %66 = load ptr, ptr %9, align 8, !tbaa !5
  %67 = getelementptr inbounds %class.Secondlargest_return, ptr %66, i32 0, i32 0
  %68 = load ptr, ptr %67, align 8, !tbaa !11
  %69 = load ptr, ptr %7, align 8, !tbaa !5
  %70 = getelementptr inbounds %class.Secondlargest_return, ptr %69, i32 0, i32 0
  store ptr %68, ptr %70, align 8, !tbaa !11
  br label %106

71:                                               ; preds = %55
  %72 = load ptr, ptr %9, align 8, !tbaa !5
  %73 = getelementptr inbounds %class.Secondlargest_return, ptr %72, i32 0, i32 1
  %74 = load ptr, ptr %73, align 8, !tbaa !19
  %75 = getelementptr inbounds %class.TreeNode, ptr %74, i32 0, i32 0
  %76 = load i32, ptr %75, align 8, !tbaa !13
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  %78 = getelementptr inbounds %class.Secondlargest_return, ptr %77, i32 0, i32 0
  %79 = load ptr, ptr %78, align 8, !tbaa !11
  %80 = getelementptr inbounds %class.TreeNode, ptr %79, i32 0, i32 0
  %81 = load i32, ptr %80, align 8, !tbaa !13
  %82 = icmp sgt i32 %76, %81
  br i1 %82, label %83, label %94

83:                                               ; preds = %71
  %84 = load ptr, ptr %9, align 8, !tbaa !5
  %85 = getelementptr inbounds %class.Secondlargest_return, ptr %84, i32 0, i32 1
  %86 = load ptr, ptr %85, align 8, !tbaa !19
  %87 = load ptr, ptr %7, align 8, !tbaa !5
  %88 = getelementptr inbounds %class.Secondlargest_return, ptr %87, i32 0, i32 1
  store ptr %86, ptr %88, align 8, !tbaa !19
  %89 = load ptr, ptr %9, align 8, !tbaa !5
  %90 = getelementptr inbounds %class.Secondlargest_return, ptr %89, i32 0, i32 0
  %91 = load ptr, ptr %90, align 8, !tbaa !11
  %92 = load ptr, ptr %7, align 8, !tbaa !5
  %93 = getelementptr inbounds %class.Secondlargest_return, ptr %92, i32 0, i32 0
  store ptr %91, ptr %93, align 8, !tbaa !11
  br label %105

94:                                               ; preds = %71
  %95 = load ptr, ptr %7, align 8, !tbaa !5
  %96 = getelementptr inbounds %class.Secondlargest_return, ptr %95, i32 0, i32 0
  %97 = load ptr, ptr %96, align 8, !tbaa !11
  %98 = load ptr, ptr %7, align 8, !tbaa !5
  %99 = getelementptr inbounds %class.Secondlargest_return, ptr %98, i32 0, i32 1
  store ptr %97, ptr %99, align 8, !tbaa !19
  %100 = load ptr, ptr %9, align 8, !tbaa !5
  %101 = getelementptr inbounds %class.Secondlargest_return, ptr %100, i32 0, i32 0
  %102 = load ptr, ptr %101, align 8, !tbaa !11
  %103 = load ptr, ptr %7, align 8, !tbaa !5
  %104 = getelementptr inbounds %class.Secondlargest_return, ptr %103, i32 0, i32 0
  store ptr %102, ptr %104, align 8, !tbaa !11
  br label %105

105:                                              ; preds = %94, %83
  br label %106

106:                                              ; preds = %105, %60
  br label %143

107:                                              ; preds = %36
  %108 = load ptr, ptr %7, align 8, !tbaa !5
  %109 = getelementptr inbounds %class.Secondlargest_return, ptr %108, i32 0, i32 0
  %110 = load ptr, ptr %109, align 8, !tbaa !11
  %111 = getelementptr inbounds %class.TreeNode, ptr %110, i32 0, i32 0
  %112 = load i32, ptr %111, align 8, !tbaa !13
  %113 = load ptr, ptr %9, align 8, !tbaa !5
  %114 = getelementptr inbounds %class.Secondlargest_return, ptr %113, i32 0, i32 0
  %115 = load ptr, ptr %114, align 8, !tbaa !11
  %116 = getelementptr inbounds %class.TreeNode, ptr %115, i32 0, i32 0
  %117 = load i32, ptr %116, align 8, !tbaa !13
  %118 = icmp ne i32 %112, %117
  br i1 %118, label %119, label %142

119:                                              ; preds = %107
  %120 = load ptr, ptr %7, align 8, !tbaa !5
  %121 = getelementptr inbounds %class.Secondlargest_return, ptr %120, i32 0, i32 1
  %122 = load ptr, ptr %121, align 8, !tbaa !19
  %123 = icmp eq ptr %122, null
  br i1 %123, label %136, label %124

124:                                              ; preds = %119
  %125 = load ptr, ptr %9, align 8, !tbaa !5
  %126 = getelementptr inbounds %class.Secondlargest_return, ptr %125, i32 0, i32 0
  %127 = load ptr, ptr %126, align 8, !tbaa !11
  %128 = getelementptr inbounds %class.TreeNode, ptr %127, i32 0, i32 0
  %129 = load i32, ptr %128, align 8, !tbaa !13
  %130 = load ptr, ptr %7, align 8, !tbaa !5
  %131 = getelementptr inbounds %class.Secondlargest_return, ptr %130, i32 0, i32 1
  %132 = load ptr, ptr %131, align 8, !tbaa !19
  %133 = getelementptr inbounds %class.TreeNode, ptr %132, i32 0, i32 0
  %134 = load i32, ptr %133, align 8, !tbaa !13
  %135 = icmp sgt i32 %129, %134
  br i1 %135, label %136, label %142

136:                                              ; preds = %124, %119
  %137 = load ptr, ptr %9, align 8, !tbaa !5
  %138 = getelementptr inbounds %class.Secondlargest_return, ptr %137, i32 0, i32 0
  %139 = load ptr, ptr %138, align 8, !tbaa !11
  %140 = load ptr, ptr %7, align 8, !tbaa !5
  %141 = getelementptr inbounds %class.Secondlargest_return, ptr %140, i32 0, i32 1
  store ptr %139, ptr %141, align 8, !tbaa !19
  br label %142

142:                                              ; preds = %136, %124, %107
  br label %143

143:                                              ; preds = %142, %106
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %144

144:                                              ; preds = %143
  %145 = load i32, ptr %8, align 4, !tbaa !9
  %146 = add nsw i32 %145, 1
  store i32 %146, ptr %8, align 4, !tbaa !9
  br label %24, !llvm.loop !20

147:                                              ; preds = %31
  %148 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %148, ptr %2, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %149

149:                                              ; preds = %147, %14
  %150 = load ptr, ptr %2, align 8
  ret ptr %150

151:                                              ; preds = %32, %16
  %152 = load ptr, ptr %5, align 8
  %153 = load i32, ptr %6, align 4
  %154 = insertvalue { ptr, i32 } poison, ptr %152, 0
  %155 = insertvalue { ptr, i32 } %154, i32 %153, 1
  resume { ptr, i32 } %155
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN20Secondlargest_returnIiEC2EP8TreeNodeIiES3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, ptr noundef) unnamed_addr #3 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nobuiltin allocsize(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 = { nobuiltin 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 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 = { 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 #5 = { nounwind }
attributes #6 = { builtin allocsize(0) }
attributes #7 = { builtin 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 0}
!12 = !{!"_ZTS20Secondlargest_returnIiE", !6, i64 0, !6, i64 8}
!13 = !{!14, !10, i64 0}
!14 = !{!"_ZTS8TreeNodeIiE", !10, i64 0, !15, i64 8}
!15 = !{!"_ZTSSt6vectorIP8TreeNodeIiESaIS2_EE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIP8TreeNodeIiESaIS2_EE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIP8TreeNodeIiESaIS2_EE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIP8TreeNodeIiESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!19 = !{!12, !6, i64 8}
!20 = distinct !{!20, !21}
!21 = !{!"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"

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #0

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIP8TreeNodeIiESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP8TreeNodeIiESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef nonnull ptr @_Z21second_largest_helperP8TreeNodeIiE(ptr noundef %0) local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %2 = icmp eq ptr %0, null
  %3 = tail call noalias noundef nonnull dereferenceable(16) ptr @_Znwm(i64 noundef 16) #3
  br i1 %2, label %4, label %5

4:                                                ; preds = %1
  tail call void @_ZN20Secondlargest_returnIiEC2EP8TreeNodeIiES3_(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef null, ptr noundef null)
  br label %.loopexit

5:                                                ; preds = %1
  tail call void @_ZN20Secondlargest_returnIiEC2EP8TreeNodeIiES3_(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull %0, ptr noundef null)
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = tail call noundef i64 @_ZNKSt6vectorIP8TreeNodeIiESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #4
  %.not41 = icmp eq i64 %7, 0
  br i1 %.not41, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %5
  %8 = getelementptr inbounds i8, ptr %3, i64 8
  br label %9

9:                                                ; preds = %.lr.ph, %32
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %32 ]
  %10 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP8TreeNodeIiESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %indvars.iv) #4
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %12 = tail call noundef ptr @_Z21second_largest_helperP8TreeNodeIiE(ptr noundef %11)
  %13 = load ptr, ptr %12, align 8, !tbaa !9
  %14 = load i32, ptr %13, align 8, !tbaa !11
  %15 = load ptr, ptr %3, align 8, !tbaa !9
  %16 = load i32, ptr %15, align 8, !tbaa !11
  %17 = icmp sgt i32 %14, %16
  br i1 %17, label %18, label %25

18:                                               ; preds = %9
  %19 = getelementptr inbounds i8, ptr %12, i64 8
  %20 = load ptr, ptr %19, align 8, !tbaa !18
  %21 = icmp eq ptr %20, null
  br i1 %21, label %.sink.split.sink.split, label %22

22:                                               ; preds = %18
  %23 = load i32, ptr %20, align 8, !tbaa !11
  %24 = icmp sgt i32 %23, %16
  %. = select i1 %24, ptr %20, ptr %15
  br label %.sink.split.sink.split

25:                                               ; preds = %9
  %.not = icmp eq i32 %16, %14
  br i1 %.not, label %32, label %26

26:                                               ; preds = %25
  %27 = load ptr, ptr %8, align 8, !tbaa !18
  %28 = icmp eq ptr %27, null
  br i1 %28, label %.sink.split, label %29

29:                                               ; preds = %26
  %30 = load i32, ptr %27, align 8, !tbaa !11
  %31 = icmp sgt i32 %14, %30
  br i1 %31, label %.sink.split, label %32

.sink.split.sink.split:                           ; preds = %22, %18
  %.sink43 = phi ptr [ %15, %18 ], [ %., %22 ]
  store ptr %.sink43, ptr %8, align 8, !tbaa !18
  br label %.sink.split

.sink.split:                                      ; preds = %.sink.split.sink.split, %26, %29
  %.sink = phi ptr [ %8, %29 ], [ %8, %26 ], [ %3, %.sink.split.sink.split ]
  store ptr %13, ptr %.sink, align 8, !tbaa !5
  br label %32

32:                                               ; preds = %.sink.split, %25, %29
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %33 = tail call noundef i64 @_ZNKSt6vectorIP8TreeNodeIiESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #4
  %34 = icmp ugt i64 %33, %indvars.iv.next
  br i1 %34, label %9, label %.loopexit, !llvm.loop !19

.loopexit:                                        ; preds = %32, %5, %4
  ret ptr %3
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN20Secondlargest_returnIiEC2EP8TreeNodeIiES3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, ptr noundef) unnamed_addr #1 align 2

attributes #0 = { nobuiltin allocsize(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 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 = { 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 = { builtin allocsize(0) }
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, !6, i64 0}
!10 = !{!"_ZTS20Secondlargest_returnIiE", !6, i64 0, !6, i64 8}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTS8TreeNodeIiE", !13, i64 0, !14, i64 8}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTSSt6vectorIP8TreeNodeIiESaIS2_EE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseIP8TreeNodeIiESaIS2_EE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIP8TreeNodeIiESaIS2_EE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIP8TreeNodeIiESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!18 = !{!10, !6, i64 8}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass