; LLVM IR from ardiloot/NonlinearTMM :: NonlinearTMM/src/eigen-3.4.0/unsupported/test (cxx11_tensor_thread_local)

; 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.Eigen::ThreadPoolTempl" = type { %"class.Eigen::ThreadPoolInterface", [4 x i8], i32, i8, %"class.Eigen::MaxSizeVector", %"class.Eigen::MaxSizeVector.9", %"class.Eigen::MaxSizeVector.10", i32, %"struct.std::atomic", %"struct.std::atomic.11", %"struct.std::atomic.11", %"struct.std::atomic.11", %"class.Eigen::EventCount" }
%"class.Eigen::ThreadPoolInterface" = type { ptr }
%"class.Eigen::MaxSizeVector" = type { i64, i64, ptr }
%"class.Eigen::MaxSizeVector.9" = type { i64, i64, ptr }
%"class.Eigen::MaxSizeVector.10" = type { i64, i64, ptr }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%"struct.std::atomic.11" = type { %"struct.std::__atomic_base.12" }
%"struct.std::__atomic_base.12" = type { i8 }
%"class.Eigen::EventCount" = type { %"struct.std::atomic.13", ptr }
%"struct.std::atomic.13" = type { %"struct.std::__atomic_base.14" }
%"struct.std::__atomic_base.14" = type { i64 }
%"struct.Eigen::StlThreadEnvironment" = type { i8 }
%"class.Eigen::ThreadLocal" = type { [4 x i8], i32, %"class.Eigen::MaxSizeVector.15", %"class.Eigen::MaxSizeVector.16", %"struct.std::atomic.17", %"class.std::mutex", %"class.std::unordered_map" }
%"class.Eigen::MaxSizeVector.15" = type { i64, i64, ptr }
%"class.Eigen::MaxSizeVector.16" = type { i64, i64, ptr }
%"struct.std::atomic.17" = type { %"struct.std::__atomic_base.18" }
%"struct.std::__atomic_base.18" = type { i32 }
%"class.std::mutex" = type { %"class.std::__mutex_base" }
%"class.std::__mutex_base" = type { %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::unordered_map" = type { %"class.std::_Hashtable" }
%"class.std::_Hashtable" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }
%struct.InitCounter = type { i8 }
%"class.Eigen::Barrier" = type <{ %"class.std::mutex", %"class.std::condition_variable", %"struct.std::atomic", i8, [3 x i8] }>
%"class.std::condition_variable" = type { %"class.std::__condvar" }
%"class.std::__condvar" = type { %union.pthread_cond_t }
%union.pthread_cond_t = type { %struct.__pthread_cond_s }
%struct.__pthread_cond_s = type { %union.__atomic_wide_counter, %union.__atomic_wide_counter, [2 x i32], [2 x i32], i32, i32, [2 x i32] }
%union.__atomic_wide_counter = type { i64 }
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%class.anon = type { ptr, ptr }
%"class.std::function.24" = type { %"class.std::_Function_base", ptr }
%class.anon.27 = type { i8 }

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

declare i32 @__gxx_personality_v0(...)

; 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
define dso_local void @_Z24test_simple_thread_localv() #1 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"class.Eigen::ThreadPoolTempl", align 8
  %5 = alloca %"struct.Eigen::StlThreadEnvironment", align 1
  %6 = alloca %"class.Eigen::ThreadLocal", align 8
  %7 = alloca %struct.InitCounter, align 1
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %"class.Eigen::Barrier", align 8
  %12 = alloca i32, align 4
  %13 = alloca %"class.std::function", align 8
  %14 = alloca %class.anon, align 8
  %15 = alloca %"class.std::function.24", align 8
  %16 = alloca %class.anon.27, align 1
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 4, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 32, ptr %3, align 4, !tbaa !5
  %17 = call noundef i32 @_ZN5Eigen8internal6randomIiEENS0_13random_retvalINS0_36global_math_functions_filtering_baseIT_vE4typeEE4typeERKS4_SA_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  store i32 %17, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 128, ptr %4) #4
  %18 = load i32, ptr %1, align 4, !tbaa !5
  call void @_ZN5Eigen15ThreadPoolTemplINS_20StlThreadEnvironmentEEC2EiS1_(ptr noundef nonnull align 8 dereferenceable(128) %4, i32 noundef %18)
  call void @llvm.lifetime.start.p0(i64 160, ptr %6) #4
  %19 = load i32, ptr %1, align 4, !tbaa !5
  invoke void @_ZN5Eigen11ThreadLocalI7Counter11InitCounterNS_8internal22ThreadLocalNoOpReleaseIS1_EEEC2EiS2_(ptr noundef nonnull align 8 dereferenceable(160) %6, i32 noundef %19)
          to label %20 unwind label %30

20:                                               ; preds = %0
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %21 = load i32, ptr %1, align 4, !tbaa !5
  %22 = mul nsw i32 3, %21
  store i32 %22, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 96, ptr %11) #4
  %23 = load i32, ptr %10, align 4, !tbaa !5
  invoke void @_ZN5Eigen7BarrierC2Ej(ptr noundef nonnull align 8 dereferenceable(93) %11, i32 noundef %23)
          to label %24 unwind label %34

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

25:                                               ; preds = %42, %24
  %26 = load i32, ptr %12, align 4, !tbaa !5
  %27 = load i32, ptr %10, align 4, !tbaa !5
  %28 = icmp slt i32 %26, %27
  br i1 %28, label %38, label %29

29:                                               ; preds = %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %49

30:                                               ; preds = %0
  %31 = landingpad { ptr, i32 }
          cleanup
  %32 = extractvalue { ptr, i32 } %31, 0
  store ptr %32, ptr %8, align 8
  %33 = extractvalue { ptr, i32 } %31, 1
  store i32 %33, ptr %9, align 4
  br label %62

34:                                               ; preds = %20
  %35 = landingpad { ptr, i32 }
          cleanup
  %36 = extractvalue { ptr, i32 } %35, 0
  store ptr %36, ptr %8, align 8
  %37 = extractvalue { ptr, i32 } %35, 1
  store i32 %37, ptr %9, align 4
  br label %61

38:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #4
  %39 = getelementptr inbounds %class.anon, ptr %14, i32 0, i32 0
  store ptr %6, ptr %39, align 8, !tbaa !9
  %40 = getelementptr inbounds %class.anon, ptr %14, i32 0, i32 1
  store ptr %11, ptr %40, align 8, !tbaa !9
  call void @"_ZNSt8functionIFvvEEC2IZ24test_simple_thread_localvE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %13, ptr noundef nonnull align 8 dereferenceable(16) %14) #4
  invoke void @_ZN5Eigen15ThreadPoolTemplINS_20StlThreadEnvironmentEE8ScheduleESt8functionIFvvEE(ptr noundef nonnull align 8 dereferenceable(128) %4, ptr noundef %13)
          to label %41 unwind label %45

41:                                               ; preds = %38
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #4
  br label %42

42:                                               ; preds = %41
  %43 = load i32, ptr %12, align 4, !tbaa !5
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %12, align 4, !tbaa !5
  br label %25, !llvm.loop !11

45:                                               ; preds = %38
  %46 = landingpad { ptr, i32 }
          cleanup
  %47 = extractvalue { ptr, i32 } %46, 0
  store ptr %47, ptr %8, align 8
  %48 = extractvalue { ptr, i32 } %46, 1
  store i32 %48, ptr %9, align 4
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %60

49:                                               ; preds = %29
  invoke void @_ZN5Eigen7Barrier4WaitEv(ptr noundef nonnull align 8 dereferenceable(93) %11)
          to label %50 unwind label %52

50:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 1, ptr %16) #4
  call void @"_ZNSt8functionIFvNSt6thread2idER7CounterEEC2IZ24test_simple_thread_localvE3$_1vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %15, ptr noundef nonnull align 1 dereferenceable(1) %16) #4
  invoke void @_ZN5Eigen11ThreadLocalI7Counter11InitCounterNS_8internal22ThreadLocalNoOpReleaseIS1_EEE7ForEachESt8functionIFvNSt6thread2idERS1_EE(ptr noundef nonnull align 8 dereferenceable(160) %6, ptr noundef %15)
          to label %51 unwind label %56

51:                                               ; preds = %50
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %15) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %16) #4
  call void @_ZN5Eigen7BarrierD2Ev(ptr noundef nonnull align 8 dereferenceable(93) %11) #4
  call void @llvm.lifetime.end.p0(i64 96, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @_ZN5Eigen11ThreadLocalI7Counter11InitCounterNS_8internal22ThreadLocalNoOpReleaseIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(160) %6) #4
  call void @llvm.lifetime.end.p0(i64 160, ptr %6) #4
  call void @_ZN5Eigen15ThreadPoolTemplINS_20StlThreadEnvironmentEED2Ev(ptr noundef nonnull align 8 dereferenceable(128) %4) #4
  call void @llvm.lifetime.end.p0(i64 128, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #4
  ret void

52:                                               ; preds = %49
  %53 = landingpad { ptr, i32 }
          cleanup
  %54 = extractvalue { ptr, i32 } %53, 0
  store ptr %54, ptr %8, align 8
  %55 = extractvalue { ptr, i32 } %53, 1
  store i32 %55, ptr %9, align 4
  br label %60

56:                                               ; preds = %50
  %57 = landingpad { ptr, i32 }
          cleanup
  %58 = extractvalue { ptr, i32 } %57, 0
  store ptr %58, ptr %8, align 8
  %59 = extractvalue { ptr, i32 } %57, 1
  store i32 %59, ptr %9, align 4
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %15) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %16) #4
  br label %60

60:                                               ; preds = %56, %52, %45
  call void @_ZN5Eigen7BarrierD2Ev(ptr noundef nonnull align 8 dereferenceable(93) %11) #4
  br label %61

61:                                               ; preds = %60, %34
  call void @llvm.lifetime.end.p0(i64 96, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @_ZN5Eigen11ThreadLocalI7Counter11InitCounterNS_8internal22ThreadLocalNoOpReleaseIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(160) %6) #4
  br label %62

62:                                               ; preds = %61, %30
  call void @llvm.lifetime.end.p0(i64 160, ptr %6) #4
  call void @_ZN5Eigen15ThreadPoolTemplINS_20StlThreadEnvironmentEED2Ev(ptr noundef nonnull align 8 dereferenceable(128) %4) #4
  call void @llvm.lifetime.end.p0(i64 128, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #4
  br label %63

63:                                               ; preds = %62
  %64 = load ptr, ptr %8, align 8
  %65 = load i32, ptr %9, align 4
  %66 = insertvalue { ptr, i32 } poison, ptr %64, 0
  %67 = insertvalue { ptr, i32 } %66, i32 %65, 1
  resume { ptr, i32 } %67
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN5Eigen8internal6randomIiEENS0_13random_retvalINS0_36global_math_functions_filtering_baseIT_vE4typeEE4typeERKS4_SA_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5Eigen15ThreadPoolTemplINS_20StlThreadEnvironmentEEC2EiS1_(ptr noundef nonnull align 8 dereferenceable(128), i32 noundef) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5Eigen11ThreadLocalI7Counter11InitCounterNS_8internal22ThreadLocalNoOpReleaseIS1_EEEC2EiS2_(ptr noundef nonnull align 8 dereferenceable(160), i32 noundef) unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZNSt8functionIFvvEEC2IZ24test_simple_thread_localvE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5Eigen7Barrier4WaitEv(ptr noundef nonnull align 8 dereferenceable(93)) #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZNSt8functionIFvNSt6thread2idER7CounterEEC2IZ24test_simple_thread_localvE3$_1vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

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

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

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

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

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 = { 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"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.Eigen::ThreadPoolTempl" = type { %"class.Eigen::ThreadPoolInterface", [4 x i8], i32, i8, %"class.Eigen::MaxSizeVector", %"class.Eigen::MaxSizeVector.9", %"class.Eigen::MaxSizeVector.10", i32, %"struct.std::atomic", %"struct.std::atomic.11", %"struct.std::atomic.11", %"struct.std::atomic.11", %"class.Eigen::EventCount" }
%"class.Eigen::ThreadPoolInterface" = type { ptr }
%"class.Eigen::MaxSizeVector" = type { i64, i64, ptr }
%"class.Eigen::MaxSizeVector.9" = type { i64, i64, ptr }
%"class.Eigen::MaxSizeVector.10" = type { i64, i64, ptr }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%"struct.std::atomic.11" = type { %"struct.std::__atomic_base.12" }
%"struct.std::__atomic_base.12" = type { i8 }
%"class.Eigen::EventCount" = type { %"struct.std::atomic.13", ptr }
%"struct.std::atomic.13" = type { %"struct.std::__atomic_base.14" }
%"struct.std::__atomic_base.14" = type { i64 }
%"class.Eigen::ThreadLocal" = type { [4 x i8], i32, %"class.Eigen::MaxSizeVector.15", %"class.Eigen::MaxSizeVector.16", %"struct.std::atomic.17", %"class.std::mutex", %"class.std::unordered_map" }
%"class.Eigen::MaxSizeVector.15" = type { i64, i64, ptr }
%"class.Eigen::MaxSizeVector.16" = type { i64, i64, ptr }
%"struct.std::atomic.17" = type { %"struct.std::__atomic_base.18" }
%"struct.std::__atomic_base.18" = type { i32 }
%"class.std::mutex" = type { %"class.std::__mutex_base" }
%"class.std::__mutex_base" = type { %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::unordered_map" = type { %"class.std::_Hashtable" }
%"class.std::_Hashtable" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }
%"class.Eigen::Barrier" = type <{ %"class.std::mutex", %"class.std::condition_variable", %"struct.std::atomic", i8, [3 x i8] }>
%"class.std::condition_variable" = type { %"class.std::__condvar" }
%"class.std::__condvar" = type { %union.pthread_cond_t }
%union.pthread_cond_t = type { %struct.__pthread_cond_s }
%struct.__pthread_cond_s = type { %union.__atomic_wide_counter, %union.__atomic_wide_counter, [2 x i32], [2 x i32], i32, i32, [2 x i32] }
%union.__atomic_wide_counter = type { i64 }
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%class.anon = type { ptr, ptr }
%"class.std::function.24" = type { %"class.std::_Function_base", ptr }
%class.anon.27 = type { i8 }

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z24test_simple_thread_localv() local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"class.Eigen::ThreadPoolTempl", align 8
  %4 = alloca %"class.Eigen::ThreadLocal", align 8
  %5 = alloca %"class.Eigen::Barrier", align 8
  %6 = alloca %"class.std::function", align 8
  %7 = alloca %class.anon, align 8
  %8 = alloca %"class.std::function.24", align 8
  %9 = alloca %class.anon.27, align 1
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  store i32 4, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  store i32 32, ptr %2, align 4, !tbaa !5
  %10 = call noundef i32 @_ZN5Eigen8internal6randomIiEENS0_13random_retvalINS0_36global_math_functions_filtering_baseIT_vE4typeEE4typeERKS4_SA_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %3) #5
  call void @_ZN5Eigen15ThreadPoolTemplINS_20StlThreadEnvironmentEEC2EiS1_(ptr noundef nonnull align 8 dereferenceable(128) %3, i32 noundef %10)
  call void @llvm.lifetime.start.p0(i64 160, ptr nonnull %4) #5
  invoke void @_ZN5Eigen11ThreadLocalI7Counter11InitCounterNS_8internal22ThreadLocalNoOpReleaseIS1_EEEC2EiS2_(ptr noundef nonnull align 8 dereferenceable(160) %4, i32 noundef %10)
          to label %11 unwind label %15

11:                                               ; preds = %0
  %12 = mul nsw i32 %10, 3
  call void @llvm.lifetime.start.p0(i64 96, ptr nonnull %5) #5
  call void @_ZN5Eigen7BarrierC2Ej(ptr noundef nonnull align 8 dereferenceable(93) %5, i32 noundef %12)
  %13 = icmp sgt i32 %10, 0
  br i1 %13, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %11
  %14 = getelementptr inbounds i8, ptr %7, i64 8
  %smax = call i32 @llvm.smax.i32(i32 %12, i32 1)
  br label %17

._crit_edge:                                      ; preds = %18, %11
  invoke void @_ZN5Eigen7Barrier4WaitEv(ptr noundef nonnull align 8 dereferenceable(93) %5)
          to label %22 unwind label %24

15:                                               ; preds = %0
  %16 = landingpad { ptr, i32 }
          cleanup
  br label %29

17:                                               ; preds = %.lr.ph, %18
  %.013 = phi i32 [ 0, %.lr.ph ], [ %19, %18 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #5
  store ptr %4, ptr %7, align 8, !tbaa !9
  store ptr %5, ptr %14, align 8, !tbaa !9
  call void @"_ZNSt8functionIFvvEEC2IZ24test_simple_thread_localvE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef nonnull align 8 dereferenceable(16) %7) #5
  invoke void @_ZN5Eigen15ThreadPoolTemplINS_20StlThreadEnvironmentEE8ScheduleESt8functionIFvvEE(ptr noundef nonnull align 8 dereferenceable(128) %3, ptr noundef nonnull %6)
          to label %18 unwind label %20

18:                                               ; preds = %17
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #5
  %19 = add nuw nsw i32 %.013, 1
  %exitcond.not = icmp eq i32 %19, %smax
  br i1 %exitcond.not, label %._crit_edge, label %17, !llvm.loop !11

20:                                               ; preds = %17
  %21 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #5
  br label %28

22:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %9) #5
  call void @"_ZNSt8functionIFvNSt6thread2idER7CounterEEC2IZ24test_simple_thread_localvE3$_1vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef nonnull align 1 dereferenceable(1) %9) #5
  invoke void @_ZN5Eigen11ThreadLocalI7Counter11InitCounterNS_8internal22ThreadLocalNoOpReleaseIS1_EEE7ForEachESt8functionIFvNSt6thread2idERS1_EE(ptr noundef nonnull align 8 dereferenceable(160) %4, ptr noundef nonnull %8)
          to label %23 unwind label %26

23:                                               ; preds = %22
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %9) #5
  call void @_ZN5Eigen7BarrierD2Ev(ptr noundef nonnull align 8 dereferenceable(93) %5) #5
  call void @llvm.lifetime.end.p0(i64 96, ptr nonnull %5) #5
  call void @_ZN5Eigen11ThreadLocalI7Counter11InitCounterNS_8internal22ThreadLocalNoOpReleaseIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(160) %4) #5
  call void @llvm.lifetime.end.p0(i64 160, ptr nonnull %4) #5
  call void @_ZN5Eigen15ThreadPoolTemplINS_20StlThreadEnvironmentEED2Ev(ptr noundef nonnull align 8 dereferenceable(128) %3) #5
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %3) #5
  ret void

24:                                               ; preds = %._crit_edge
  %25 = landingpad { ptr, i32 }
          cleanup
  br label %28

26:                                               ; preds = %22
  %27 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %9) #5
  br label %28

28:                                               ; preds = %26, %24, %20
  %.pn = phi { ptr, i32 } [ %21, %20 ], [ %27, %26 ], [ %25, %24 ]
  call void @_ZN5Eigen7BarrierD2Ev(ptr noundef nonnull align 8 dereferenceable(93) %5) #5
  call void @llvm.lifetime.end.p0(i64 96, ptr nonnull %5) #5
  call void @_ZN5Eigen11ThreadLocalI7Counter11InitCounterNS_8internal22ThreadLocalNoOpReleaseIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(160) %4) #5
  br label %29

29:                                               ; preds = %28, %15
  %.pn.pn = phi { ptr, i32 } [ %.pn, %28 ], [ %16, %15 ]
  call void @llvm.lifetime.end.p0(i64 160, ptr nonnull %4) #5
  call void @_ZN5Eigen15ThreadPoolTemplINS_20StlThreadEnvironmentEED2Ev(ptr noundef nonnull align 8 dereferenceable(128) %3) #5
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %3) #5
  resume { ptr, i32 } %.pn.pn
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN5Eigen8internal6randomIiEENS0_13random_retvalINS0_36global_math_functions_filtering_baseIT_vE4typeEE4typeERKS4_SA_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5Eigen15ThreadPoolTemplINS_20StlThreadEnvironmentEEC2EiS1_(ptr noundef nonnull align 8 dereferenceable(128), i32 noundef) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5Eigen11ThreadLocalI7Counter11InitCounterNS_8internal22ThreadLocalNoOpReleaseIS1_EEEC2EiS2_(ptr noundef nonnull align 8 dereferenceable(160), i32 noundef) unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZNSt8functionIFvvEEC2IZ24test_simple_thread_localvE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZNSt8functionIFvNSt6thread2idER7CounterEEC2IZ24test_simple_thread_localvE3$_1vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4

attributes #0 = { mustprogress 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 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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