; LLVM IR from vczh/herodb :: Kernel/Source/Vlpp.ll (ZN2vl18threading_internal14ThreadPoolStopEb)

; 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.vl::SpinLock" = type { %"class.vl::Object", i64 }
%"class.vl::Object" = type { ptr }
%"class.vl::SpinLock::Scope" = type { %"class.vl::Object", ptr }
%"struct.vl::threading_internal::ThreadPoolData" = type { %"class.vl::Semaphore", %"class.vl::EventObject", %"class.vl::Ptr.1125", ptr, i8, %"class.vl::collections::List.1126" }
%"class.vl::Semaphore" = type { %"class.vl::WaitableObject", ptr }
%"class.vl::WaitableObject" = type { %"class.vl::Object" }
%"class.vl::EventObject" = type { %"class.vl::WaitableObject", ptr }
%"class.vl::Ptr.1125" = type { ptr, ptr, ptr, ptr }
%"class.vl::collections::List.1126" = type { %"class.vl::collections::ListBase.base.1132", %"class.vl::collections::IEnumerable.1130" }
%"class.vl::collections::ListBase.base.1132" = type <{ %"class.vl::collections::ArrayBase.base.1131", i64, i8 }>
%"class.vl::collections::ArrayBase.base.1131" = type { %"class.vl::collections::ListStore.1129", ptr, i64 }
%"class.vl::collections::ListStore.1129" = type { %"class.vl::Object" }
%"class.vl::collections::IEnumerable.1130" = type { %"class.vl::Interface" }
%"class.vl::Interface" = type { ptr }

@_ZN2vl18threading_internal14threadPoolLockE = external dso_local global %"class.vl::SpinLock", align 8
@_ZN2vl18threading_internal14threadPoolDataE = external dso_local global ptr, align 8

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

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN2vl11EventObject4WaitEv(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN2vl18threading_internal14ThreadPoolStopEb(i1 noundef zeroext %0) #2 personality ptr @__gxx_personality_v0 {
  %2 = alloca i1, align 1
  %3 = alloca i8, align 1
  %4 = alloca i8, align 1
  %5 = alloca ptr, align 8
  %6 = alloca %"class.vl::SpinLock::Scope", align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i8, align 1
  %13 = alloca ptr, align 8
  %14 = alloca %"class.vl::SpinLock::Scope", align 8
  %15 = zext i1 %0 to i8
  store i8 %15, ptr %3, align 1, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %4) #5
  store i8 1, ptr %4, align 1, !tbaa !5
  %16 = load i8, ptr %4, align 1, !tbaa !5, !range !9, !noundef !10
  %17 = trunc i8 %16 to i1
  br i1 %17, label %18, label %63

18:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #5
  call void @_ZN2vl8SpinLock5ScopeC1ERS0_(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(16) @_ZN2vl18threading_internal14threadPoolLockE)
  store ptr %6, ptr %5, align 8, !tbaa !11
  br label %19

19:                                               ; preds = %59, %18
  %20 = load i8, ptr %4, align 1, !tbaa !5, !range !9, !noundef !10
  %21 = trunc i8 %20 to i1
  br i1 %21, label %23, label %22

22:                                               ; preds = %19
  store i32 2, ptr %7, align 4
  br label %60

23:                                               ; preds = %19
  %24 = load ptr, ptr @_ZN2vl18threading_internal14threadPoolDataE, align 8, !tbaa !11
  %25 = icmp ne ptr %24, null
  br i1 %25, label %27, label %26

26:                                               ; preds = %23
  store i1 false, ptr %2, align 1
  store i32 1, ptr %7, align 4
  br label %60

27:                                               ; preds = %23
  %28 = load ptr, ptr @_ZN2vl18threading_internal14threadPoolDataE, align 8, !tbaa !11
  %29 = getelementptr inbounds %"struct.vl::threading_internal::ThreadPoolData", ptr %28, i32 0, i32 4
  %30 = load volatile i8, ptr %29, align 8, !tbaa !13, !range !9, !noundef !10
  %31 = trunc i8 %30 to i1
  br i1 %31, label %32, label %33

32:                                               ; preds = %27
  store i1 false, ptr %2, align 1
  store i32 1, ptr %7, align 4
  br label %60

33:                                               ; preds = %27
  %34 = load ptr, ptr @_ZN2vl18threading_internal14threadPoolDataE, align 8, !tbaa !11
  %35 = getelementptr inbounds %"struct.vl::threading_internal::ThreadPoolData", ptr %34, i32 0, i32 4
  store volatile i8 1, ptr %35, align 8, !tbaa !13
  %36 = load i8, ptr %3, align 1, !tbaa !5, !range !9, !noundef !10
  %37 = trunc i8 %36 to i1
  br i1 %37, label %38, label %51

38:                                               ; preds = %33
  %39 = load ptr, ptr @_ZN2vl18threading_internal14threadPoolDataE, align 8, !tbaa !11
  %40 = getelementptr inbounds %"struct.vl::threading_internal::ThreadPoolData", ptr %39, i32 0, i32 2
  %41 = load ptr, ptr @_ZN2vl18threading_internal14threadPoolDataE, align 8, !tbaa !11
  %42 = getelementptr inbounds %"struct.vl::threading_internal::ThreadPoolData", ptr %41, i32 0, i32 3
  store ptr %40, ptr %42, align 8, !tbaa !25
  %43 = load ptr, ptr @_ZN2vl18threading_internal14threadPoolDataE, align 8, !tbaa !11
  %44 = getelementptr inbounds %"struct.vl::threading_internal::ThreadPoolData", ptr %43, i32 0, i32 2
  %45 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN2vl3PtrINS_18threading_internal14ThreadPoolTaskEEaSEPS2_(ptr noundef nonnull align 8 dereferenceable(32) %44, ptr noundef null)
          to label %46 unwind label %47

46:                                               ; preds = %38
  br label %51

47:                                               ; preds = %51, %38
  %48 = landingpad { ptr, i32 }
          cleanup
  %49 = extractvalue { ptr, i32 } %48, 0
  store ptr %49, ptr %8, align 8
  %50 = extractvalue { ptr, i32 } %48, 1
  store i32 %50, ptr %9, align 4
  call void @_ZN2vl8SpinLock5ScopeD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #5
  br label %119

51:                                               ; preds = %46, %33
  %52 = load ptr, ptr @_ZN2vl18threading_internal14threadPoolDataE, align 8, !tbaa !11
  %53 = getelementptr inbounds %"struct.vl::threading_internal::ThreadPoolData", ptr %52, i32 0, i32 0
  %54 = load ptr, ptr @_ZN2vl18threading_internal14threadPoolDataE, align 8, !tbaa !11
  %55 = getelementptr inbounds %"struct.vl::threading_internal::ThreadPoolData", ptr %54, i32 0, i32 5
  %56 = invoke noundef i64 @_ZNK2vl11collections9ArrayBaseIPNS_6ThreadEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %55)
          to label %57 unwind label %47

57:                                               ; preds = %51
  %58 = call noundef i64 @_ZN2vl9Semaphore7ReleaseEl(ptr noundef nonnull align 8 dereferenceable(16) %53, i64 noundef %56)
  br label %59

59:                                               ; preds = %57
  store i8 0, ptr %4, align 1, !tbaa !5
  br label %19, !llvm.loop !26

60:                                               ; preds = %32, %26, %22
  call void @_ZN2vl8SpinLock5ScopeD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  %61 = load i32, ptr %7, align 4
  switch i32 %61, label %64 [
    i32 2, label %62
  ]

62:                                               ; preds = %60
  br label %63

63:                                               ; preds = %62, %1
  store i32 0, ptr %7, align 4
  br label %64

64:                                               ; preds = %63, %60
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #5
  %65 = load i32, ptr %7, align 4
  switch i32 %65, label %124 [
    i32 0, label %66
    i32 1, label %117
  ]

66:                                               ; preds = %64
  %67 = load ptr, ptr @_ZN2vl18threading_internal14threadPoolDataE, align 8, !tbaa !11
  %68 = getelementptr inbounds %"struct.vl::threading_internal::ThreadPoolData", ptr %67, i32 0, i32 1
  %69 = call noundef zeroext i1 @_ZN2vl11EventObject4WaitEv(ptr noundef nonnull align 8 dereferenceable(16) %68)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  store i64 0, ptr %10, align 8, !tbaa !28
  br label %70

70:                                               ; preds = %95, %66
  %71 = load i64, ptr %10, align 8, !tbaa !28
  %72 = load ptr, ptr @_ZN2vl18threading_internal14threadPoolDataE, align 8, !tbaa !11
  %73 = getelementptr inbounds %"struct.vl::threading_internal::ThreadPoolData", ptr %72, i32 0, i32 5
  %74 = call noundef i64 @_ZNK2vl11collections9ArrayBaseIPNS_6ThreadEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %73)
  %75 = icmp slt i64 %71, %74
  br i1 %75, label %77, label %76

76:                                               ; preds = %70
  store i32 5, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %98

77:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %78 = load ptr, ptr @_ZN2vl18threading_internal14threadPoolDataE, align 8, !tbaa !11
  %79 = getelementptr inbounds %"struct.vl::threading_internal::ThreadPoolData", ptr %78, i32 0, i32 5
  %80 = load i64, ptr %10, align 8, !tbaa !28
  %81 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN2vl11collections4ListIPNS_6ThreadES3_EixEl(ptr noundef nonnull align 8 dereferenceable(33) %79, i64 noundef %80)
  %82 = load ptr, ptr %81, align 8, !tbaa !11
  store ptr %82, ptr %11, align 8, !tbaa !11
  %83 = load ptr, ptr %11, align 8, !tbaa !11
  %84 = load ptr, ptr %83, align 8, !tbaa !29
  %85 = getelementptr inbounds ptr, ptr %84, i64 2
  %86 = load ptr, ptr %85, align 8
  %87 = call noundef zeroext i1 %86(ptr noundef nonnull align 8 dereferenceable(20) %83)
  %88 = load ptr, ptr %11, align 8, !tbaa !11
  %89 = icmp eq ptr %88, null
  br i1 %89, label %94, label %90

90:                                               ; preds = %77
  %91 = load ptr, ptr %88, align 8, !tbaa !29
  %92 = getelementptr inbounds ptr, ptr %91, i64 1
  %93 = load ptr, ptr %92, align 8
  call void %93(ptr noundef nonnull align 8 dereferenceable(20) %88) #5
  br label %94

94:                                               ; preds = %90, %77
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %95

95:                                               ; preds = %94
  %96 = load i64, ptr %10, align 8, !tbaa !28
  %97 = add nsw i64 %96, 1
  store i64 %97, ptr %10, align 8, !tbaa !28
  br label %70, !llvm.loop !31

98:                                               ; preds = %76
  %99 = load ptr, ptr @_ZN2vl18threading_internal14threadPoolDataE, align 8, !tbaa !11
  %100 = getelementptr inbounds %"struct.vl::threading_internal::ThreadPoolData", ptr %99, i32 0, i32 5
  %101 = call noundef zeroext i1 @_ZN2vl11collections8ListBaseIPNS_6ThreadES3_E5ClearEv(ptr noundef nonnull align 8 dereferenceable(33) %100)
  call void @llvm.lifetime.start.p0(i64 1, ptr %12) #5
  store i8 1, ptr %12, align 1, !tbaa !5
  %102 = load i8, ptr %12, align 1, !tbaa !5, !range !9, !noundef !10
  %103 = trunc i8 %102 to i1
  br i1 %103, label %104, label %116

104:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #5
  call void @_ZN2vl8SpinLock5ScopeC1ERS0_(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 8 dereferenceable(16) @_ZN2vl18threading_internal14threadPoolLockE)
  store ptr %14, ptr %13, align 8, !tbaa !11
  br label %105

105:                                              ; preds = %114, %104
  %106 = load i8, ptr %12, align 1, !tbaa !5, !range !9, !noundef !10
  %107 = trunc i8 %106 to i1
  br i1 %107, label %109, label %108

108:                                              ; preds = %105
  store i32 8, ptr %7, align 4
  call void @_ZN2vl8SpinLock5ScopeD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %14) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %115

109:                                              ; preds = %105
  %110 = load ptr, ptr @_ZN2vl18threading_internal14threadPoolDataE, align 8, !tbaa !11
  %111 = icmp eq ptr %110, null
  br i1 %111, label %113, label %112

112:                                              ; preds = %109
  call void @_ZN2vl18threading_internal14ThreadPoolDataD2Ev(ptr noundef nonnull align 8 dereferenceable(128) %110) #5
  call void @_ZdlPvm(ptr noundef %110, i64 noundef 128) #6
  br label %113

113:                                              ; preds = %112, %109
  store ptr null, ptr @_ZN2vl18threading_internal14threadPoolDataE, align 8, !tbaa !11
  br label %114

114:                                              ; preds = %113
  store i8 0, ptr %12, align 1, !tbaa !5
  br label %105, !llvm.loop !32

115:                                              ; preds = %108
  br label %116

116:                                              ; preds = %115, %98
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #5
  store i1 true, ptr %2, align 1
  br label %117

117:                                              ; preds = %116, %64
  %118 = load i1, ptr %2, align 1
  ret i1 %118

119:                                              ; preds = %47
  %120 = load ptr, ptr %8, align 8
  %121 = load i32, ptr %9, align 4
  %122 = insertvalue { ptr, i32 } poison, ptr %120, 0
  %123 = insertvalue { ptr, i32 } %122, i32 %121, 1
  resume { ptr, i32 } %123

124:                                              ; preds = %64
  unreachable
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN2vl11collections4ListIPNS_6ThreadES3_EixEl(ptr noundef nonnull align 8 dereferenceable(33), i64 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN2vl11collections8ListBaseIPNS_6ThreadES3_E5ClearEv(ptr noundef nonnull align 8 dereferenceable(33)) #2 align 2

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

declare void @_ZN2vl8SpinLock5ScopeC1ERS0_(ptr, ptr)

declare void @_ZN2vl8SpinLock5ScopeD1Ev(ptr)

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { inlinehint 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 #5 = { nounwind }
attributes #6 = { 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 = !{!"bool", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{i8 0, i8 2}
!10 = !{}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !6, i64 72}
!14 = !{!"_ZTSN2vl18threading_internal14ThreadPoolDataE", !15, i64 0, !18, i64 16, !19, i64 32, !12, i64 64, !6, i64 72, !20, i64 80}
!15 = !{!"_ZTSN2vl9SemaphoreE", !16, i64 0, !12, i64 8}
!16 = !{!"_ZTSN2vl14WaitableObjectE", !17, i64 0}
!17 = !{!"_ZTSN2vl6ObjectE"}
!18 = !{!"_ZTSN2vl11EventObjectE", !16, i64 0, !12, i64 8}
!19 = !{!"_ZTSN2vl3PtrINS_18threading_internal14ThreadPoolTaskEEE", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!20 = !{!"_ZTSN2vl11collections4ListIPNS_6ThreadES3_EE", !21, i64 0}
!21 = !{!"_ZTSN2vl11collections8ListBaseIPNS_6ThreadES3_EE", !22, i64 0, !24, i64 24, !6, i64 32}
!22 = !{!"_ZTSN2vl11collections9ArrayBaseIPNS_6ThreadEEE", !23, i64 0, !12, i64 8, !24, i64 16}
!23 = !{!"_ZTSN2vl11collections9ListStoreIPNS_6ThreadELb1EEE", !17, i64 0}
!24 = !{!"long", !7, i64 0}
!25 = !{!14, !12, i64 64}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!24, !24, i64 0}
!29 = !{!30, !30, i64 0}
!30 = !{!"vtable pointer", !8, i64 0}
!31 = distinct !{!31, !27}
!32 = distinct !{!32, !27}


; 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.vl::SpinLock" = type { %"class.vl::Object", i64 }
%"class.vl::Object" = type { ptr }
%"class.vl::SpinLock::Scope" = type { %"class.vl::Object", ptr }

@_ZN2vl18threading_internal14threadPoolLockE = external dso_local global %"class.vl::SpinLock", align 8
@_ZN2vl18threading_internal14threadPoolDataE = external dso_local local_unnamed_addr global ptr, align 8

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

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN2vl11EventObject4WaitEv(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN2vl18threading_internal14ThreadPoolStopEb(i1 noundef zeroext %0) local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.vl::SpinLock::Scope", align 8
  %3 = alloca %"class.vl::SpinLock::Scope", align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #5
  call void @_ZN2vl8SpinLock5ScopeC1ERS0_(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(16) @_ZN2vl18threading_internal14threadPoolLockE)
  %4 = load ptr, ptr @_ZN2vl18threading_internal14threadPoolDataE, align 8, !tbaa !5
  %.not.us39 = icmp eq ptr %4, null
  br i1 %0, label %.split.us, label %.split

.split.us:                                        ; preds = %1
  br i1 %.not.us39, label %.split28.us, label %.lr.ph41

.lr.ph41:                                         ; preds = %.split.us
  %5 = getelementptr inbounds i8, ptr %4, i64 72
  %6 = load volatile i8, ptr %5, align 8, !tbaa !9, !range !22, !noundef !23
  %7 = trunc nuw i8 %6 to i1
  br i1 %7, label %.split28.us, label %8

8:                                                ; preds = %.lr.ph41
  store volatile i8 1, ptr %5, align 8, !tbaa !9
  %9 = getelementptr inbounds i8, ptr %4, i64 32
  %10 = getelementptr inbounds i8, ptr %4, i64 64
  store ptr %9, ptr %10, align 8, !tbaa !24
  %11 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN2vl3PtrINS_18threading_internal14ThreadPoolTaskEEaSEPS2_(ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef null)
          to label %.split33.us unwind label %.split30.us

.split33.us:                                      ; preds = %8
  %12 = load ptr, ptr @_ZN2vl18threading_internal14threadPoolDataE, align 8, !tbaa !5
  br label %17

.split30.us:                                      ; preds = %8
  %13 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN2vl8SpinLock5ScopeD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %2) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #5
  resume { ptr, i32 } %13

.split:                                           ; preds = %1
  br i1 %.not.us39, label %.split28.us, label %.lr.ph

.lr.ph:                                           ; preds = %.split
  %14 = getelementptr inbounds i8, ptr %4, i64 72
  %15 = load volatile i8, ptr %14, align 8, !tbaa !9, !range !22, !noundef !23
  %16 = trunc nuw i8 %15 to i1
  br i1 %16, label %.split28.us, label %.split33

.split33:                                         ; preds = %.lr.ph
  store volatile i8 1, ptr %14, align 8, !tbaa !9
  br label %17

.split28.us:                                      ; preds = %.split, %.lr.ph, %.split.us, %.lr.ph41
  call void @_ZN2vl8SpinLock5ScopeD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %2) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #5
  br label %51

17:                                               ; preds = %.split33.us, %.split33
  %.sink49 = phi ptr [ %12, %.split33.us ], [ %4, %.split33 ]
  %18 = getelementptr inbounds i8, ptr %.sink49, i64 80
  %19 = call noundef i64 @_ZNK2vl11collections9ArrayBaseIPNS_6ThreadEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %18)
  %20 = call noundef i64 @_ZN2vl9Semaphore7ReleaseEl(ptr noundef nonnull align 8 dereferenceable(16) %.sink49, i64 noundef %19)
  call void @_ZN2vl8SpinLock5ScopeD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %2) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #5
  %21 = load ptr, ptr @_ZN2vl18threading_internal14threadPoolDataE, align 8, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %21, i64 16
  %23 = call noundef zeroext i1 @_ZN2vl11EventObject4WaitEv(ptr noundef nonnull align 8 dereferenceable(16) %22)
  %24 = load ptr, ptr @_ZN2vl18threading_internal14threadPoolDataE, align 8, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %24, i64 80
  %26 = call noundef i64 @_ZNK2vl11collections9ArrayBaseIPNS_6ThreadEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %25)
  %27 = icmp sgt i64 %26, 0
  br i1 %27, label %.lr.ph46, label %.critedge21

.critedge21:                                      ; preds = %.lr.ph46, %17
  %28 = load ptr, ptr @_ZN2vl18threading_internal14threadPoolDataE, align 8, !tbaa !5
  %29 = getelementptr inbounds i8, ptr %28, i64 80
  %30 = call noundef zeroext i1 @_ZN2vl11collections8ListBaseIPNS_6ThreadES3_E5ClearEv(ptr noundef nonnull align 8 dereferenceable(33) %29)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #5
  call void @_ZN2vl8SpinLock5ScopeC1ERS0_(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) @_ZN2vl18threading_internal14threadPoolLockE)
  %31 = load ptr, ptr @_ZN2vl18threading_internal14threadPoolDataE, align 8, !tbaa !5
  %32 = icmp eq ptr %31, null
  br i1 %32, label %50, label %49

.lr.ph46:                                         ; preds = %17, %.lr.ph46
  %.01645 = phi i64 [ %44, %.lr.ph46 ], [ 0, %17 ]
  %33 = load ptr, ptr @_ZN2vl18threading_internal14threadPoolDataE, align 8, !tbaa !5
  %34 = getelementptr inbounds i8, ptr %33, i64 80
  %35 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN2vl11collections4ListIPNS_6ThreadES3_EixEl(ptr noundef nonnull align 8 dereferenceable(33) %34, i64 noundef %.01645)
  %36 = load ptr, ptr %35, align 8, !tbaa !5
  %37 = load ptr, ptr %36, align 8, !tbaa !25
  %38 = getelementptr inbounds i8, ptr %37, i64 16
  %39 = load ptr, ptr %38, align 8
  %40 = call noundef zeroext i1 %39(ptr noundef nonnull align 8 dereferenceable(20) %36)
  %41 = load ptr, ptr %36, align 8, !tbaa !25
  %42 = getelementptr inbounds i8, ptr %41, i64 8
  %43 = load ptr, ptr %42, align 8
  call void %43(ptr noundef nonnull align 8 dereferenceable(20) %36) #5
  %44 = add nuw nsw i64 %.01645, 1
  %45 = load ptr, ptr @_ZN2vl18threading_internal14threadPoolDataE, align 8, !tbaa !5
  %46 = getelementptr inbounds i8, ptr %45, i64 80
  %47 = call noundef i64 @_ZNK2vl11collections9ArrayBaseIPNS_6ThreadEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %46)
  %48 = icmp slt i64 %44, %47
  br i1 %48, label %.lr.ph46, label %.critedge21, !llvm.loop !27

49:                                               ; preds = %.critedge21
  call void @_ZN2vl18threading_internal14ThreadPoolDataD2Ev(ptr noundef nonnull align 8 dereferenceable(128) %31) #5
  call void @_ZdlPvm(ptr noundef nonnull %31, i64 noundef 128) #6
  br label %50

50:                                               ; preds = %49, %.critedge21
  store ptr null, ptr @_ZN2vl18threading_internal14threadPoolDataE, align 8, !tbaa !5
  call void @_ZN2vl8SpinLock5ScopeD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #5
  br label %51

51:                                               ; preds = %.split28.us, %50
  %.3 = phi i1 [ false, %.split28.us ], [ true, %50 ]
  ret i1 %.3
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZN2vl3PtrINS_18threading_internal14ThreadPoolTaskEEaSEPS2_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN2vl11collections4ListIPNS_6ThreadES3_EixEl(ptr noundef nonnull align 8 dereferenceable(33), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN2vl11collections8ListBaseIPNS_6ThreadES3_E5ClearEv(ptr noundef nonnull align 8 dereferenceable(33)) local_unnamed_addr #2 align 2

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

declare void @_ZN2vl8SpinLock5ScopeC1ERS0_(ptr, ptr) local_unnamed_addr

declare void @_ZN2vl8SpinLock5ScopeD1Ev(ptr) local_unnamed_addr

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { inlinehint 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 #5 = { nounwind }
attributes #6 = { 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, !16, i64 72}
!10 = !{!"_ZTSN2vl18threading_internal14ThreadPoolDataE", !11, i64 0, !14, i64 16, !15, i64 32, !6, i64 64, !16, i64 72, !17, i64 80}
!11 = !{!"_ZTSN2vl9SemaphoreE", !12, i64 0, !6, i64 8}
!12 = !{!"_ZTSN2vl14WaitableObjectE", !13, i64 0}
!13 = !{!"_ZTSN2vl6ObjectE"}
!14 = !{!"_ZTSN2vl11EventObjectE", !12, i64 0, !6, i64 8}
!15 = !{!"_ZTSN2vl3PtrINS_18threading_internal14ThreadPoolTaskEEE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!16 = !{!"bool", !7, i64 0}
!17 = !{!"_ZTSN2vl11collections4ListIPNS_6ThreadES3_EE", !18, i64 0}
!18 = !{!"_ZTSN2vl11collections8ListBaseIPNS_6ThreadES3_EE", !19, i64 0, !21, i64 24, !16, i64 32}
!19 = !{!"_ZTSN2vl11collections9ArrayBaseIPNS_6ThreadEEE", !20, i64 0, !6, i64 8, !21, i64 16}
!20 = !{!"_ZTSN2vl11collections9ListStoreIPNS_6ThreadELb1EEE", !13, i64 0}
!21 = !{!"long", !7, i64 0}
!22 = !{i8 0, i8 2}
!23 = !{}
!24 = !{!10, !6, i64 64}
!25 = !{!26, !26, i64 0}
!26 = !{!"vtable pointer", !8, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass