; LLVM IR from stan-dev/math :: lib/tbb_2020.3/src/perf (perf)

; 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.Perf::SessionSettings" = type { i64, ptr, ptr }
%"struct.Perf::internal::TestResults" = type <{ ptr, i64, %"class.std::vector.14", %"class.std::vector.14", %"class.std::vector.19", %"class.std::vector.24", ptr, i8, [7 x i8] }>
%"class.std::vector.14" = type { %"struct.std::_Vector_base.15" }
%"struct.std::_Vector_base.15" = type { %"struct.std::_Vector_base<Perf::internal::TimingSeries, std::allocator<Perf::internal::TimingSeries>>::_Vector_impl" }
%"struct.std::_Vector_base<Perf::internal::TimingSeries, std::allocator<Perf::internal::TimingSeries>>::_Vector_impl" = type { %"struct.std::_Vector_base<Perf::internal::TimingSeries, std::allocator<Perf::internal::TimingSeries>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Perf::internal::TimingSeries, std::allocator<Perf::internal::TimingSeries>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.19" = type { %"struct.std::_Vector_base.20" }
%"struct.std::_Vector_base.20" = type { %"struct.std::_Vector_base<const char *, std::allocator<const char *>>::_Vector_impl" }
%"struct.std::_Vector_base<const char *, std::allocator<const char *>>::_Vector_impl" = type { %"struct.std::_Vector_base<const char *, std::allocator<const char *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<const char *, std::allocator<const char *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.24" = type { %"struct.std::_Vector_base.25" }
%"struct.std::_Vector_base.25" = type { %"struct.std::_Vector_base<Perf::internal::RunResults, std::allocator<Perf::internal::RunResults>>::_Vector_impl" }
%"struct.std::_Vector_base<Perf::internal::RunResults, std::allocator<Perf::internal::RunResults>>::_Vector_impl" = type { %"struct.std::_Vector_base<Perf::internal::RunResults, std::allocator<Perf::internal::RunResults>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Perf::internal::RunResults, std::allocator<Perf::internal::RunResults>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.Perf::internal::RunResults" = type { %"struct.Perf::internal::RunConfig", %"struct.Perf::internal::TimingSeries" }
%"struct.Perf::internal::RunConfig" = type { i32, i32, i32, i32, i32 }
%"struct.Perf::internal::TimingSeries" = type { %"class.std::vector", double, double, double, double }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@_ZN4Perf11theSettingsE = external dso_local global %"struct.Perf::SessionSettings", align 8
@_ZN4Perf8internalL7NumRunsE = external hidden global i64, align 8
@.str.22 = external hidden unnamed_addr constant [80 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [25 x i8], align 1

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Perf8internal12InitTestDataERNS0_11TestResultsEiiiiiRi(ptr noundef nonnull align 8 dereferenceable(121) %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, ptr noundef nonnull align 4 dereferenceable(4) %6) #1 {
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  store ptr %0, ptr %8, align 8, !tbaa !5
  store i32 %1, ptr %9, align 4, !tbaa !9
  store i32 %2, ptr %10, align 4, !tbaa !9
  store i32 %3, ptr %11, align 4, !tbaa !9
  store i32 %4, ptr %12, align 4, !tbaa !9
  store i32 %5, ptr %13, align 4, !tbaa !9
  store ptr %6, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  %16 = load i32, ptr %9, align 4, !tbaa !9
  %17 = load i32, ptr %10, align 4, !tbaa !9
  %18 = load i32, ptr %11, align 4, !tbaa !9
  %19 = load i32, ptr %12, align 4, !tbaa !9
  %20 = load i32, ptr %13, align 4, !tbaa !9
  %21 = call noundef i32 @_ZN4Perf8internal15TestResultIndexEiiiii(i32 noundef %16, i32 noundef %17, i32 noundef %18, i32 noundef %19, i32 noundef %20)
  %22 = sext i32 %21 to i64
  store i64 %22, ptr %15, align 8, !tbaa !11
  %23 = load i64, ptr %15, align 8, !tbaa !11
  %24 = load ptr, ptr %8, align 8, !tbaa !5
  %25 = getelementptr inbounds %"struct.Perf::internal::TestResults", ptr %24, i32 0, i32 5
  %26 = call noundef i64 @_ZNKSt6vectorIN4Perf8internal10RunResultsESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %25) #3
  %27 = icmp ult i64 %23, %26
  br i1 %27, label %28, label %29

28:                                               ; preds = %7
  br label %30

29:                                               ; preds = %7
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str.22, i32 noundef 662, ptr noundef @.str.34, ptr noundef null)
  br label %30

30:                                               ; preds = %29, %28
  %31 = load ptr, ptr %8, align 8, !tbaa !5
  %32 = getelementptr inbounds %"struct.Perf::internal::TestResults", ptr %31, i32 0, i32 5
  %33 = load i64, ptr %15, align 8, !tbaa !11
  %34 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorIN4Perf8internal10RunResultsESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %32, i64 noundef %33) #3
  %35 = getelementptr inbounds %"struct.Perf::internal::RunResults", ptr %34, i32 0, i32 1
  %36 = getelementptr inbounds %"struct.Perf::internal::TimingSeries", ptr %35, i32 0, i32 0
  %37 = load i64, ptr @_ZN4Perf11theSettingsE, align 8, !tbaa !13
  %38 = and i64 %37, 16
  %39 = icmp ne i64 %38, 0
  br i1 %39, label %40, label %50

40:                                               ; preds = %30
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  %42 = getelementptr inbounds %"struct.Perf::internal::TestResults", ptr %41, i32 0, i32 0
  %43 = load ptr, ptr %42, align 8, !tbaa !15
  %44 = load ptr, ptr %43, align 8, !tbaa !30
  %45 = getelementptr inbounds ptr, ptr %44, i64 6
  %46 = load ptr, ptr %45, align 8
  %47 = call noundef i32 %46(ptr noundef nonnull align 8 dereferenceable(8) %43)
  %48 = load i32, ptr %12, align 4, !tbaa !9
  %49 = add nsw i32 %47, %48
  br label %52

50:                                               ; preds = %30
  %51 = load i32, ptr %11, align 4, !tbaa !9
  br label %52

52:                                               ; preds = %50, %40
  %53 = phi i32 [ %49, %40 ], [ %51, %50 ]
  %54 = sext i32 %53 to i64
  %55 = load i64, ptr @_ZN4Perf8internalL7NumRunsE, align 8, !tbaa !11
  %56 = mul i64 %54, %55
  call void @_ZNSt6vectorIdSaIdEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %36, i64 noundef %56)
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !12, i64 0}
!14 = !{!"_ZTSN4Perf15SessionSettingsE", !12, i64 0, !6, i64 8, !6, i64 16}
!15 = !{!16, !6, i64 0}
!16 = !{!"_ZTSN4Perf8internal11TestResultsE", !6, i64 0, !12, i64 8, !17, i64 16, !17, i64 40, !21, i64 64, !25, i64 88, !6, i64 112, !29, i64 120}
!17 = !{!"_ZTSSt6vectorIN4Perf8internal12TimingSeriesESaIS2_EE", !18, i64 0}
!18 = !{!"_ZTSSt12_Vector_baseIN4Perf8internal12TimingSeriesESaIS2_EE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIN4Perf8internal12TimingSeriesESaIS2_EE12_Vector_implE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIN4Perf8internal12TimingSeriesESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!21 = !{!"_ZTSSt6vectorIPKcSaIS1_EE", !22, i64 0}
!22 = !{!"_ZTSSt12_Vector_baseIPKcSaIS1_EE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIPKcSaIS1_EE12_Vector_implE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIPKcSaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!25 = !{!"_ZTSSt6vectorIN4Perf8internal10RunResultsESaIS2_EE", !26, i64 0}
!26 = !{!"_ZTSSt12_Vector_baseIN4Perf8internal10RunResultsESaIS2_EE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseIN4Perf8internal10RunResultsESaIS2_EE12_Vector_implE", !28, i64 0}
!28 = !{!"_ZTSNSt12_Vector_baseIN4Perf8internal10RunResultsESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!29 = !{!"bool", !7, i64 0}
!30 = !{!31, !31, i64 0}
!31 = !{!"vtable pointer", !8, i64 0}


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

%"struct.Perf::SessionSettings" = type { i64, ptr, ptr }

@_ZN4Perf11theSettingsE = external dso_local local_unnamed_addr global %"struct.Perf::SessionSettings", align 8
@_ZN4Perf8internalL7NumRunsE = external hidden local_unnamed_addr global i64, align 8
@.str.22 = external hidden unnamed_addr constant [80 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [25 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11ReportErrorPKciS0_S0_(ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIN4Perf8internal10RunResultsESaIS2_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(80) ptr @_ZNSt6vectorIN4Perf8internal10RunResultsESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Perf8internal12InitTestDataERNS0_11TestResultsEiiiiiRi(ptr noundef nonnull align 8 dereferenceable(121) %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, ptr nocapture noundef nonnull readnone align 4 dereferenceable(4) %6) local_unnamed_addr #0 {
  %8 = tail call noundef i32 @_ZN4Perf8internal15TestResultIndexEiiiii(i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5)
  %9 = sext i32 %8 to i64
  %10 = getelementptr inbounds i8, ptr %0, i64 88
  %11 = tail call noundef i64 @_ZNKSt6vectorIN4Perf8internal10RunResultsESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #2
  %12 = icmp ugt i64 %11, %9
  br i1 %12, label %14, label %13

13:                                               ; preds = %7
  tail call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str.22, i32 noundef 662, ptr noundef nonnull @.str.34, ptr noundef null)
  br label %14

14:                                               ; preds = %7, %13
  %15 = tail call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorIN4Perf8internal10RunResultsESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %10, i64 noundef %9) #2
  %16 = load i64, ptr @_ZN4Perf11theSettingsE, align 8, !tbaa !5
  %17 = and i64 %16, 16
  %.not = icmp eq i64 %17, 0
  br i1 %.not, label %25, label %18

18:                                               ; preds = %14
  %19 = load ptr, ptr %0, align 8, !tbaa !11
  %20 = load ptr, ptr %19, align 8, !tbaa !26
  %21 = getelementptr inbounds i8, ptr %20, i64 48
  %22 = load ptr, ptr %21, align 8
  %23 = tail call noundef i32 %22(ptr noundef nonnull align 8 dereferenceable(8) %19)
  %24 = add nsw i32 %23, %4
  br label %25

25:                                               ; preds = %14, %18
  %26 = phi i32 [ %24, %18 ], [ %3, %14 ]
  %27 = getelementptr inbounds i8, ptr %15, i64 24
  %28 = sext i32 %26 to i64
  %29 = load i64, ptr @_ZN4Perf8internalL7NumRunsE, align 8, !tbaa !28
  %30 = mul i64 %29, %28
  tail call void @_ZNSt6vectorIdSaIdEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %27, i64 noundef %30)
  ret void
}

attributes #0 = { 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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind }

!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 = !{!"_ZTSN4Perf15SessionSettingsE", !7, i64 0, !10, i64 8, !10, i64 16}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_ZTSN4Perf8internal11TestResultsE", !10, i64 0, !7, i64 8, !13, i64 16, !13, i64 40, !17, i64 64, !21, i64 88, !10, i64 112, !25, i64 120}
!13 = !{!"_ZTSSt6vectorIN4Perf8internal12TimingSeriesESaIS2_EE", !14, i64 0}
!14 = !{!"_ZTSSt12_Vector_baseIN4Perf8internal12TimingSeriesESaIS2_EE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIN4Perf8internal12TimingSeriesESaIS2_EE12_Vector_implE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIN4Perf8internal12TimingSeriesESaIS2_EE17_Vector_impl_dataE", !10, i64 0, !10, i64 8, !10, i64 16}
!17 = !{!"_ZTSSt6vectorIPKcSaIS1_EE", !18, i64 0}
!18 = !{!"_ZTSSt12_Vector_baseIPKcSaIS1_EE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIPKcSaIS1_EE12_Vector_implE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIPKcSaIS1_EE17_Vector_impl_dataE", !10, i64 0, !10, i64 8, !10, i64 16}
!21 = !{!"_ZTSSt6vectorIN4Perf8internal10RunResultsESaIS2_EE", !22, i64 0}
!22 = !{!"_ZTSSt12_Vector_baseIN4Perf8internal10RunResultsESaIS2_EE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIN4Perf8internal10RunResultsESaIS2_EE12_Vector_implE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIN4Perf8internal10RunResultsESaIS2_EE17_Vector_impl_dataE", !10, i64 0, !10, i64 8, !10, i64 16}
!25 = !{!"bool", !8, i64 0}
!26 = !{!27, !27, i64 0}
!27 = !{!"vtable pointer", !9, i64 0}
!28 = !{!7, !7, i64 0}


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