; LLVM IR from RichtersFinger/ChainSimulation :: Chain.ll (ZN5ChainC2EPS_)

; 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.Chain = type { double, double, double, double, double, %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<ChainElement *, std::allocator<ChainElement *>>::_Vector_impl" }
%"struct.std::_Vector_base<ChainElement *, std::allocator<ChainElement *>>::_Vector_impl" = type { %"struct.std::_Vector_base<ChainElement *, std::allocator<ChainElement *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<ChainElement *, std::allocator<ChainElement *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.ChainElement = type { double, double, double, double, double, double, double, double, i8, ptr, ptr }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIP12ChainElementSaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0 align 2

; Function Attrs: nounwind
declare double @sqrt(double noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5ChainC2EPS_(ptr noundef nonnull align 8 dereferenceable(64) %0, ptr noundef %1) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %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 %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %10 = load ptr, ptr %3, align 8
  %11 = getelementptr inbounds %class.Chain, ptr %10, i32 0, i32 5
  call void @_ZNSt6vectorIP12ChainElementSaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #7
  %12 = getelementptr inbounds %class.Chain, ptr %10, i32 0, i32 0
  store double 4.000000e+04, ptr %12, align 8, !tbaa !9
  %13 = getelementptr inbounds %class.Chain, ptr %10, i32 0, i32 3
  store double 2.000000e+04, ptr %13, align 8, !tbaa !16
  %14 = getelementptr inbounds %class.Chain, ptr %10, i32 0, i32 0
  %15 = load double, ptr %14, align 8, !tbaa !9
  %16 = call double @sqrt(double noundef %15) #7
  %17 = fmul double 5.000000e-04, %16
  %18 = getelementptr inbounds %class.Chain, ptr %10, i32 0, i32 1
  store double %17, ptr %18, align 8, !tbaa !17
  %19 = getelementptr inbounds %class.Chain, ptr %10, i32 0, i32 3
  %20 = load double, ptr %19, align 8, !tbaa !16
  %21 = call double @sqrt(double noundef %20) #7
  %22 = fmul double 5.000000e-03, %21
  %23 = getelementptr inbounds %class.Chain, ptr %10, i32 0, i32 4
  store double %22, ptr %23, align 8, !tbaa !18
  %24 = getelementptr inbounds %class.Chain, ptr %10, i32 0, i32 2
  store double 1.000000e-03, ptr %24, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  store i32 0, ptr %5, align 4, !tbaa !20
  br label %25

25:                                               ; preds = %69, %2
  %26 = load i32, ptr %5, align 4, !tbaa !20
  %27 = sext i32 %26 to i64
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %class.Chain, ptr %28, i32 0, i32 5
  %30 = call noundef i64 @_ZNKSt6vectorIP12ChainElementSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %29) #7
  %31 = icmp ult i64 %27, %30
  br i1 %31, label %33, label %32

32:                                               ; preds = %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %81

33:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %34 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 88) #8
          to label %35 unwind label %72

35:                                               ; preds = %33
  invoke void @_ZN12ChainElementC1Ev(ptr noundef nonnull align 8 dereferenceable(88) %34)
          to label %36 unwind label %76

36:                                               ; preds = %35
  store ptr %34, ptr %6, align 8, !tbaa !5
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %class.Chain, ptr %37, i32 0, i32 5
  %39 = load i32, ptr %5, align 4, !tbaa !20
  %40 = sext i32 %39 to i64
  %41 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP12ChainElementSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %38, i64 noundef %40) #7
  %42 = load ptr, ptr %41, align 8, !tbaa !5
  %43 = getelementptr inbounds %class.ChainElement, ptr %42, i32 0, i32 0
  %44 = load double, ptr %43, align 8, !tbaa !22
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = getelementptr inbounds %class.ChainElement, ptr %45, i32 0, i32 0
  store double %44, ptr %46, align 8, !tbaa !22
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %class.Chain, ptr %47, i32 0, i32 5
  %49 = load i32, ptr %5, align 4, !tbaa !20
  %50 = sext i32 %49 to i64
  %51 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP12ChainElementSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %48, i64 noundef %50) #7
  %52 = load ptr, ptr %51, align 8, !tbaa !5
  %53 = getelementptr inbounds %class.ChainElement, ptr %52, i32 0, i32 1
  %54 = load double, ptr %53, align 8, !tbaa !25
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = getelementptr inbounds %class.ChainElement, ptr %55, i32 0, i32 1
  store double %54, ptr %56, align 8, !tbaa !25
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = getelementptr inbounds %class.Chain, ptr %57, i32 0, i32 5
  %59 = load i32, ptr %5, align 4, !tbaa !20
  %60 = sext i32 %59 to i64
  %61 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP12ChainElementSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %58, i64 noundef %60) #7
  %62 = load ptr, ptr %61, align 8, !tbaa !5
  %63 = getelementptr inbounds %class.ChainElement, ptr %62, i32 0, i32 6
  %64 = load double, ptr %63, align 8, !tbaa !26
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  %66 = getelementptr inbounds %class.ChainElement, ptr %65, i32 0, i32 6
  store double %64, ptr %66, align 8, !tbaa !26
  %67 = getelementptr inbounds %class.Chain, ptr %10, i32 0, i32 5
  invoke void @_ZNSt6vectorIP12ChainElementSaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %67, ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %68 unwind label %72

68:                                               ; preds = %36
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %69

69:                                               ; preds = %68
  %70 = load i32, ptr %5, align 4, !tbaa !20
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr %5, align 4, !tbaa !20
  br label %25, !llvm.loop !27

72:                                               ; preds = %36, %33
  %73 = landingpad { ptr, i32 }
          cleanup
  %74 = extractvalue { ptr, i32 } %73, 0
  store ptr %74, ptr %7, align 8
  %75 = extractvalue { ptr, i32 } %73, 1
  store i32 %75, ptr %8, align 4
  br label %80

76:                                               ; preds = %35
  %77 = landingpad { ptr, i32 }
          cleanup
  %78 = extractvalue { ptr, i32 } %77, 0
  store ptr %78, ptr %7, align 8
  %79 = extractvalue { ptr, i32 } %77, 1
  store i32 %79, ptr %8, align 4
  call void @_ZdlPvm(ptr noundef %34, i64 noundef 88) #9
  br label %80

80:                                               ; preds = %76, %72
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %150

81:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !20
  br label %82

82:                                               ; preds = %146, %81
  %83 = load i32, ptr %9, align 4, !tbaa !20
  %84 = sext i32 %83 to i64
  %85 = load ptr, ptr %4, align 8, !tbaa !5
  %86 = getelementptr inbounds %class.Chain, ptr %85, i32 0, i32 5
  %87 = call noundef i64 @_ZNKSt6vectorIP12ChainElementSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %86) #7
  %88 = icmp ult i64 %84, %87
  br i1 %88, label %90, label %89

89:                                               ; preds = %82
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %149

90:                                               ; preds = %82
  %91 = load i32, ptr %9, align 4, !tbaa !20
  %92 = icmp eq i32 %91, 0
  br i1 %92, label %93, label %104

93:                                               ; preds = %90
  %94 = getelementptr inbounds %class.Chain, ptr %10, i32 0, i32 5
  %95 = load i32, ptr %9, align 4, !tbaa !20
  %96 = sext i32 %95 to i64
  %97 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP12ChainElementSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %94, i64 noundef %96) #7
  %98 = load ptr, ptr %97, align 8, !tbaa !5
  invoke void @_ZN12ChainElement17linkLeftToElementEPS_(ptr noundef nonnull align 8 dereferenceable(88) %98, ptr noundef null)
          to label %99 unwind label %100

99:                                               ; preds = %93
  br label %117

100:                                              ; preds = %132, %125, %104, %93
  %101 = landingpad { ptr, i32 }
          cleanup
  %102 = extractvalue { ptr, i32 } %101, 0
  store ptr %102, ptr %7, align 8
  %103 = extractvalue { ptr, i32 } %101, 1
  store i32 %103, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %150

104:                                              ; preds = %90
  %105 = getelementptr inbounds %class.Chain, ptr %10, i32 0, i32 5
  %106 = load i32, ptr %9, align 4, !tbaa !20
  %107 = sext i32 %106 to i64
  %108 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP12ChainElementSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %105, i64 noundef %107) #7
  %109 = load ptr, ptr %108, align 8, !tbaa !5
  %110 = getelementptr inbounds %class.Chain, ptr %10, i32 0, i32 5
  %111 = load i32, ptr %9, align 4, !tbaa !20
  %112 = sub nsw i32 %111, 1
  %113 = sext i32 %112 to i64
  %114 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP12ChainElementSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %110, i64 noundef %113) #7
  %115 = load ptr, ptr %114, align 8, !tbaa !5
  invoke void @_ZN12ChainElement17linkLeftToElementEPS_(ptr noundef nonnull align 8 dereferenceable(88) %109, ptr noundef %115)
          to label %116 unwind label %100

116:                                              ; preds = %104
  br label %117

117:                                              ; preds = %116, %99
  %118 = load i32, ptr %9, align 4, !tbaa !20
  %119 = sext i32 %118 to i64
  %120 = load ptr, ptr %4, align 8, !tbaa !5
  %121 = getelementptr inbounds %class.Chain, ptr %120, i32 0, i32 5
  %122 = call noundef i64 @_ZNKSt6vectorIP12ChainElementSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %121) #7
  %123 = sub i64 %122, 1
  %124 = icmp eq i64 %119, %123
  br i1 %124, label %125, label %132

125:                                              ; preds = %117
  %126 = getelementptr inbounds %class.Chain, ptr %10, i32 0, i32 5
  %127 = load i32, ptr %9, align 4, !tbaa !20
  %128 = sext i32 %127 to i64
  %129 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP12ChainElementSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %126, i64 noundef %128) #7
  %130 = load ptr, ptr %129, align 8, !tbaa !5
  invoke void @_ZN12ChainElement18linkRightToElementEPS_(ptr noundef nonnull align 8 dereferenceable(88) %130, ptr noundef null)
          to label %131 unwind label %100

131:                                              ; preds = %125
  br label %145

132:                                              ; preds = %117
  %133 = getelementptr inbounds %class.Chain, ptr %10, i32 0, i32 5
  %134 = load i32, ptr %9, align 4, !tbaa !20
  %135 = sext i32 %134 to i64
  %136 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP12ChainElementSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %133, i64 noundef %135) #7
  %137 = load ptr, ptr %136, align 8, !tbaa !5
  %138 = getelementptr inbounds %class.Chain, ptr %10, i32 0, i32 5
  %139 = load i32, ptr %9, align 4, !tbaa !20
  %140 = add nsw i32 %139, 1
  %141 = sext i32 %140 to i64
  %142 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP12ChainElementSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %138, i64 noundef %141) #7
  %143 = load ptr, ptr %142, align 8, !tbaa !5
  invoke void @_ZN12ChainElement18linkRightToElementEPS_(ptr noundef nonnull align 8 dereferenceable(88) %137, ptr noundef %143)
          to label %144 unwind label %100

144:                                              ; preds = %132
  br label %145

145:                                              ; preds = %144, %131
  br label %146

146:                                              ; preds = %145
  %147 = load i32, ptr %9, align 4, !tbaa !20
  %148 = add nsw i32 %147, 1
  store i32 %148, ptr %9, align 4, !tbaa !20
  br label %82, !llvm.loop !29

149:                                              ; preds = %89
  ret void

150:                                              ; preds = %100, %80
  call void @_ZNSt6vectorIP12ChainElementSaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #7
  br label %151

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

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

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

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

declare i32 @__gxx_personality_v0(...)

declare void @_ZN12ChainElementC1Ev(ptr noundef nonnull align 8 dereferenceable(88)) unnamed_addr #5

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIP12ChainElementSaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

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

declare void @_ZN12ChainElement17linkLeftToElementEPS_(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef) #5

declare void @_ZN12ChainElement18linkRightToElementEPS_(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIP12ChainElementSaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0 align 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 = { 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 = { 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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { "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 #6 = { 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 #7 = { nounwind }
attributes #8 = { builtin allocsize(0) }
attributes #9 = { 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, !11, i64 0}
!10 = !{!"_ZTS5Chain", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !12, i64 40}
!11 = !{!"double", !7, i64 0}
!12 = !{!"_ZTSSt6vectorIP12ChainElementSaIS1_EE", !13, i64 0}
!13 = !{!"_ZTSSt12_Vector_baseIP12ChainElementSaIS1_EE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIP12ChainElementSaIS1_EE12_Vector_implE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIP12ChainElementSaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!16 = !{!10, !11, i64 24}
!17 = !{!10, !11, i64 8}
!18 = !{!10, !11, i64 32}
!19 = !{!10, !11, i64 16}
!20 = !{!21, !21, i64 0}
!21 = !{!"int", !7, i64 0}
!22 = !{!23, !11, i64 0}
!23 = !{!"_ZTS12ChainElement", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !24, i64 64, !6, i64 72, !6, i64 80}
!24 = !{!"bool", !7, i64 0}
!25 = !{!23, !11, i64 8}
!26 = !{!23, !11, i64 48}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = distinct !{!29, !28}


; 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 void @_ZNSt6vectorIP12ChainElementSaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5ChainC2EPS_(ptr noundef nonnull align 8 dereferenceable(64) %0, ptr noundef %1) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = getelementptr inbounds i8, ptr %0, i64 40
  tail call void @_ZNSt6vectorIP12ChainElementSaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  store <2 x double> <double 4.000000e+04, double 1.000000e-01>, ptr %0, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 32
  store double 0x3FE6A09E667F3BCD, ptr %5, align 8, !tbaa !9
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  store <2 x double> <double 1.000000e-03, double 2.000000e+04>, ptr %6, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %1, i64 40
  %8 = tail call noundef i64 @_ZNKSt6vectorIP12ChainElementSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #6
  %.not = icmp eq i64 %8, 0
  br i1 %.not, label %.preheader, label %.lr.ph

.preheader:                                       ; preds = %43, %2
  %9 = call noundef i64 @_ZNKSt6vectorIP12ChainElementSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #6
  %.not37 = icmp eq i64 %9, 0
  br i1 %.not37, label %._crit_edge, label %.lr.ph36.preheader

.lr.ph36.preheader:                               ; preds = %.preheader
  %10 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP12ChainElementSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef 0) #6
  %11 = load ptr, ptr %10, align 8, !tbaa !16
  invoke void @_ZN12ChainElement17linkLeftToElementEPS_(ptr noundef nonnull align 8 dereferenceable(88) %11, ptr noundef null)
          to label %12 unwind label %.loopexit.split-lp

12:                                               ; preds = %.lr.ph36.preheader
  %13 = call noundef i64 @_ZNKSt6vectorIP12ChainElementSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #6
  %14 = icmp eq i64 %13, 1
  %15 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP12ChainElementSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef 0) #6
  %16 = load ptr, ptr %15, align 8, !tbaa !16
  br i1 %14, label %.invoke, label %17

17:                                               ; preds = %12
  %18 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP12ChainElementSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef 1) #6
  %19 = load ptr, ptr %18, align 8, !tbaa !16
  br label %.invoke

.invoke:                                          ; preds = %12, %17
  %20 = phi ptr [ %19, %17 ], [ null, %12 ]
  invoke void @_ZN12ChainElement18linkRightToElementEPS_(ptr noundef nonnull align 8 dereferenceable(88) %16, ptr noundef %20)
          to label %21 unwind label %.loopexit.split-lp

21:                                               ; preds = %.invoke
  %22 = call noundef i64 @_ZNKSt6vectorIP12ChainElementSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #6
  %23 = icmp ugt i64 %22, 1
  br i1 %23, label %.lr.ph36.peel.next, label %._crit_edge

.lr.ph:                                           ; preds = %2, %43
  %indvars.iv = phi i64 [ %indvars.iv.next, %43 ], [ 0, %2 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %24 = invoke noalias noundef nonnull dereferenceable(88) ptr @_Znwm(i64 noundef 88) #7
          to label %25 unwind label %46

25:                                               ; preds = %.lr.ph
  invoke void @_ZN12ChainElementC1Ev(ptr noundef nonnull align 8 dereferenceable(88) %24)
          to label %26 unwind label %48

26:                                               ; preds = %25
  store ptr %24, ptr %3, align 8, !tbaa !16
  %27 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP12ChainElementSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %indvars.iv) #6
  %28 = load ptr, ptr %27, align 8, !tbaa !16
  %29 = load double, ptr %28, align 8, !tbaa !17
  %30 = load ptr, ptr %3, align 8, !tbaa !16
  store double %29, ptr %30, align 8, !tbaa !17
  %31 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP12ChainElementSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %indvars.iv) #6
  %32 = load ptr, ptr %31, align 8, !tbaa !16
  %33 = getelementptr inbounds i8, ptr %32, i64 8
  %34 = load double, ptr %33, align 8, !tbaa !20
  %35 = load ptr, ptr %3, align 8, !tbaa !16
  %36 = getelementptr inbounds i8, ptr %35, i64 8
  store double %34, ptr %36, align 8, !tbaa !20
  %37 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP12ChainElementSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %indvars.iv) #6
  %38 = load ptr, ptr %37, align 8, !tbaa !16
  %39 = getelementptr inbounds i8, ptr %38, i64 48
  %40 = load double, ptr %39, align 8, !tbaa !21
  %41 = load ptr, ptr %3, align 8, !tbaa !16
  %42 = getelementptr inbounds i8, ptr %41, i64 48
  store double %40, ptr %42, align 8, !tbaa !21
  invoke void @_ZNSt6vectorIP12ChainElementSaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %43 unwind label %46

43:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %44 = call noundef i64 @_ZNKSt6vectorIP12ChainElementSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #6
  %45 = icmp ugt i64 %44, %indvars.iv.next
  br i1 %45, label %.lr.ph, label %.preheader, !llvm.loop !22

46:                                               ; preds = %26, %.lr.ph
  %47 = landingpad { ptr, i32 }
          cleanup
  br label %50

48:                                               ; preds = %25
  %49 = landingpad { ptr, i32 }
          cleanup
  call void @_ZdlPvm(ptr noundef nonnull %24, i64 noundef 88) #8
  br label %50

50:                                               ; preds = %48, %46
  %.pn = phi { ptr, i32 } [ %47, %46 ], [ %49, %48 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  br label %70

._crit_edge:                                      ; preds = %67, %21, %.preheader
  ret void

.loopexit:                                        ; preds = %.lr.ph36.peel.next, %62, %63
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %70

.loopexit.split-lp:                               ; preds = %.invoke, %.lr.ph36.preheader
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %70

.lr.ph36.peel.next:                               ; preds = %21, %67
  %indvars.iv40 = phi i64 [ %indvars.iv.next41.pre-phi, %67 ], [ 1, %21 ]
  %51 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP12ChainElementSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %indvars.iv40) #6
  %52 = load ptr, ptr %51, align 8, !tbaa !16
  %53 = add nsw i64 %indvars.iv40, -1
  %54 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP12ChainElementSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %53) #6
  %55 = load ptr, ptr %54, align 8, !tbaa !16
  invoke void @_ZN12ChainElement17linkLeftToElementEPS_(ptr noundef nonnull align 8 dereferenceable(88) %52, ptr noundef %55)
          to label %56 unwind label %.loopexit

56:                                               ; preds = %.lr.ph36.peel.next
  %57 = call noundef i64 @_ZNKSt6vectorIP12ChainElementSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #6
  %58 = add i64 %57, -1
  %59 = icmp eq i64 %58, %indvars.iv40
  %60 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP12ChainElementSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %indvars.iv40) #6
  %61 = load ptr, ptr %60, align 8, !tbaa !16
  br i1 %59, label %62, label %63

62:                                               ; preds = %56
  invoke void @_ZN12ChainElement18linkRightToElementEPS_(ptr noundef nonnull align 8 dereferenceable(88) %61, ptr noundef null)
          to label %._crit_edge46 unwind label %.loopexit

._crit_edge46:                                    ; preds = %62
  %.pre = add nuw nsw i64 %indvars.iv40, 1
  br label %67

63:                                               ; preds = %56
  %64 = add nuw nsw i64 %indvars.iv40, 1
  %65 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP12ChainElementSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %64) #6
  %66 = load ptr, ptr %65, align 8, !tbaa !16
  invoke void @_ZN12ChainElement18linkRightToElementEPS_(ptr noundef nonnull align 8 dereferenceable(88) %61, ptr noundef %66)
          to label %67 unwind label %.loopexit

67:                                               ; preds = %._crit_edge46, %63
  %indvars.iv.next41.pre-phi = phi i64 [ %.pre, %._crit_edge46 ], [ %64, %63 ]
  %68 = call noundef i64 @_ZNKSt6vectorIP12ChainElementSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #6
  %69 = icmp ugt i64 %68, %indvars.iv.next41.pre-phi
  br i1 %69, label %.lr.ph36.peel.next, label %._crit_edge, !llvm.loop !24

70:                                               ; preds = %.loopexit, %.loopexit.split-lp, %50
  %.pn.pn = phi { ptr, i32 } [ %.pn, %50 ], [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @_ZNSt6vectorIP12ChainElementSaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  resume { ptr, i32 } %.pn.pn
}

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

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

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

declare i32 @__gxx_personality_v0(...)

declare void @_ZN12ChainElementC1Ev(ptr noundef nonnull align 8 dereferenceable(88)) unnamed_addr #4

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

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

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

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

declare void @_ZN12ChainElement17linkLeftToElementEPS_(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef) local_unnamed_addr #4

declare void @_ZN12ChainElement18linkRightToElementEPS_(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIP12ChainElementSaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0 align 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 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { "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 = { 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 #6 = { nounwind }
attributes #7 = { builtin allocsize(0) }
attributes #8 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 32}
!10 = !{!"_ZTS5Chain", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !11, i64 40}
!11 = !{!"_ZTSSt6vectorIP12ChainElementSaIS1_EE", !12, i64 0}
!12 = !{!"_ZTSSt12_Vector_baseIP12ChainElementSaIS1_EE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseIP12ChainElementSaIS1_EE12_Vector_implE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIP12ChainElementSaIS1_EE17_Vector_impl_dataE", !15, i64 0, !15, i64 8, !15, i64 16}
!15 = !{!"any pointer", !7, i64 0}
!16 = !{!15, !15, i64 0}
!17 = !{!18, !6, i64 0}
!18 = !{!"_ZTS12ChainElement", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !19, i64 64, !15, i64 72, !15, i64 80}
!19 = !{!"bool", !7, i64 0}
!20 = !{!18, !6, i64 8}
!21 = !{!18, !6, i64 48}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = distinct !{!24, !23, !25}
!25 = !{!"llvm.loop.peeled.count", i32 1}


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