; LLVM IR from glaretechnologies/substrata :: resonance-audio/resonance_audio/geometrical_acoustics (parallel_for)

; 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.vraudio::TaskThreadPool" = type { %"struct.std::atomic", %"struct.std::atomic.0", %"class.std::vector", %"class.std::condition_variable", %"class.std::mutex" }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%"struct.std::atomic.0" = type { %"struct.std::__atomic_base.1" }
%"struct.std::__atomic_base.1" = type { i8 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<vraudio::TaskThreadPool::WorkerThread, std::allocator<vraudio::TaskThreadPool::WorkerThread>>::_Vector_impl" }
%"struct.std::_Vector_base<vraudio::TaskThreadPool::WorkerThread, std::allocator<vraudio::TaskThreadPool::WorkerThread>>::_Vector_impl" = type { %"struct.std::_Vector_base<vraudio::TaskThreadPool::WorkerThread, std::allocator<vraudio::TaskThreadPool::WorkerThread>>::_Vector_impl_data" }
%"struct.std::_Vector_base<vraudio::TaskThreadPool::WorkerThread, std::allocator<vraudio::TaskThreadPool::WorkerThread>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"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::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.FatalLogger = type { %"class.std::__cxx11::basic_ostringstream" }
%"class.std::__cxx11::basic_ostringstream" = type { %"class.std::basic_ostream.base", %"class.std::__cxx11::basic_stringbuf", %"class.std::basic_ios" }
%"class.std::basic_ostream.base" = type { ptr }
%"class.std::__cxx11::basic_stringbuf" = type { %"class.std::basic_streambuf", i32, %"class.std::__cxx11::basic_string" }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%class.NullLogger = type { i8 }
%"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 { i64, ptr }

@.str = external hidden unnamed_addr constant [131 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7vraudio11ParallelForEjmRKSt8functionIFvmEE(i32 noundef %0, i64 noundef %1, ptr noundef nonnull align 8 dereferenceable(32) %2) #0 personality ptr @__gxx_personality_v0 {
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %"class.vraudio::TaskThreadPool", align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca %class.FatalLogger, align 8
  %11 = alloca i1, align 1
  %12 = alloca i1, align 1
  %13 = alloca %class.NullLogger, align 1
  %14 = alloca i64, align 8
  %15 = alloca %"class.std::function", align 8
  %16 = alloca %class.anon, align 8
  %17 = alloca %"class.std::function", align 8
  %18 = alloca %class.FatalLogger, align 8
  %19 = alloca i1, align 1
  %20 = alloca i1, align 1
  %21 = alloca %class.NullLogger, align 1
  store i32 %0, ptr %4, align 4, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !9
  store ptr %2, ptr %6, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 120, ptr %7) #5
  call void @_ZN7vraudio14TaskThreadPoolC1Ev(ptr noundef nonnull align 8 dereferenceable(120) %7)
  %22 = load i32, ptr %4, align 4, !tbaa !5
  %23 = zext i32 %22 to i64
  store i1 false, ptr %11, align 1
  store i1 false, ptr %12, align 1
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #5
  %24 = invoke noundef zeroext i1 @_ZN7vraudio14TaskThreadPool15StartThreadPoolEm(ptr noundef nonnull align 8 dereferenceable(120) %7, i64 noundef %23)
          to label %25 unwind label %46

25:                                               ; preds = %3
  br i1 %24, label %30, label %26

26:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 376, ptr %10) #5
  store i1 true, ptr %11, align 1
  invoke void @_ZN11FatalLoggerC2EPKci(ptr noundef nonnull align 8 dereferenceable(376) %10, ptr noundef @.str, i32 noundef 32)
          to label %27 unwind label %50

27:                                               ; preds = %26
  store i1 true, ptr %12, align 1
  %28 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN11FatalLogger9GetStreamEv(ptr noundef nonnull align 8 dereferenceable(376) %10)
          to label %29 unwind label %54

29:                                               ; preds = %27
  br label %33

30:                                               ; preds = %25
  %31 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN10NullLogger9GetStreamEv(ptr noundef nonnull align 1 dereferenceable(1) %13)
          to label %32 unwind label %58

32:                                               ; preds = %30
  br label %33

33:                                               ; preds = %32, %29
  %34 = phi ptr [ %28, %29 ], [ %31, %32 ]
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #5
  %35 = load i1, ptr %12, align 1
  br i1 %35, label %36, label %37

36:                                               ; preds = %33
  call void @_ZN11FatalLoggerD2Ev(ptr noundef nonnull align 8 dereferenceable(376) %10) #5
  br label %37

37:                                               ; preds = %36, %33
  %38 = load i1, ptr %11, align 1
  br i1 %38, label %39, label %40

39:                                               ; preds = %37
  call void @llvm.lifetime.end.p0(i64 376, ptr %10) #5
  br label %40

40:                                               ; preds = %39, %37
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  store i64 0, ptr %14, align 8, !tbaa !9
  br label %41

41:                                               ; preds = %103, %40
  %42 = load i64, ptr %14, align 8, !tbaa !9
  %43 = load i64, ptr %5, align 8, !tbaa !9
  %44 = icmp ult i64 %42, %43
  br i1 %44, label %70, label %45

45:                                               ; preds = %41
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %137

46:                                               ; preds = %137, %3
  %47 = landingpad { ptr, i32 }
          cleanup
  %48 = extractvalue { ptr, i32 } %47, 0
  store ptr %48, ptr %8, align 8
  %49 = extractvalue { ptr, i32 } %47, 1
  store i32 %49, ptr %9, align 4
  br label %139

50:                                               ; preds = %26
  %51 = landingpad { ptr, i32 }
          cleanup
  %52 = extractvalue { ptr, i32 } %51, 0
  store ptr %52, ptr %8, align 8
  %53 = extractvalue { ptr, i32 } %51, 1
  store i32 %53, ptr %9, align 4
  br label %66

54:                                               ; preds = %27
  %55 = landingpad { ptr, i32 }
          cleanup
  %56 = extractvalue { ptr, i32 } %55, 0
  store ptr %56, ptr %8, align 8
  %57 = extractvalue { ptr, i32 } %55, 1
  store i32 %57, ptr %9, align 4
  br label %62

58:                                               ; preds = %30
  %59 = landingpad { ptr, i32 }
          cleanup
  %60 = extractvalue { ptr, i32 } %59, 0
  store ptr %60, ptr %8, align 8
  %61 = extractvalue { ptr, i32 } %59, 1
  store i32 %61, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #5
  br label %62

62:                                               ; preds = %58, %54
  %63 = load i1, ptr %12, align 1
  br i1 %63, label %64, label %65

64:                                               ; preds = %62
  call void @_ZN11FatalLoggerD2Ev(ptr noundef nonnull align 8 dereferenceable(376) %10) #5
  br label %65

65:                                               ; preds = %64, %62
  br label %66

66:                                               ; preds = %65, %50
  %67 = load i1, ptr %11, align 1
  br i1 %67, label %68, label %69

68:                                               ; preds = %66
  call void @llvm.lifetime.end.p0(i64 376, ptr %10) #5
  br label %69

69:                                               ; preds = %68, %66
  br label %139

70:                                               ; preds = %41
  br label %71

71:                                               ; preds = %75, %70
  %72 = invoke noundef zeroext i1 @_ZN7vraudio14TaskThreadPool31WaitUntilWorkerBecomesAvailableEv(ptr noundef nonnull align 8 dereferenceable(120) %7)
          to label %73 unwind label %76

73:                                               ; preds = %71
  %74 = xor i1 %72, true
  br i1 %74, label %75, label %80

75:                                               ; preds = %73
  br label %71, !llvm.loop !13

76:                                               ; preds = %71
  %77 = landingpad { ptr, i32 }
          cleanup
  %78 = extractvalue { ptr, i32 } %77, 0
  store ptr %78, ptr %8, align 8
  %79 = extractvalue { ptr, i32 } %77, 1
  store i32 %79, ptr %9, align 4
  br label %136

80:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 32, ptr %15) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr %16) #5
  %81 = getelementptr inbounds %class.anon, ptr %16, i32 0, i32 0
  %82 = load i64, ptr %14, align 8, !tbaa !9
  store i64 %82, ptr %81, align 8, !tbaa !15
  %83 = getelementptr inbounds %class.anon, ptr %16, i32 0, i32 1
  %84 = load ptr, ptr %6, align 8, !tbaa !11
  store ptr %84, ptr %83, align 8, !tbaa !11
  call void @"_ZNSt8functionIFvvEEC2IZN7vraudio11ParallelForEjmRKS_IFvmEEE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %15, ptr noundef nonnull align 8 dereferenceable(16) %16) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #5
  store i1 false, ptr %19, align 1
  store i1 false, ptr %20, align 1
  call void @llvm.lifetime.start.p0(i64 1, ptr %21) #5
  invoke void @_ZNSt8functionIFvvEEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(32) %17, ptr noundef nonnull align 8 dereferenceable(32) %15)
          to label %85 unwind label %106

85:                                               ; preds = %80
  %86 = invoke noundef zeroext i1 @_ZN7vraudio14TaskThreadPool17RunOnWorkerThreadESt8functionIFvvEE(ptr noundef nonnull align 8 dereferenceable(120) %7, ptr noundef %17)
          to label %87 unwind label %110

87:                                               ; preds = %85
  br i1 %86, label %92, label %88

88:                                               ; preds = %87
  call void @llvm.lifetime.start.p0(i64 376, ptr %18) #5
  store i1 true, ptr %19, align 1
  invoke void @_ZN11FatalLoggerC2EPKci(ptr noundef nonnull align 8 dereferenceable(376) %18, ptr noundef @.str, i32 noundef 39)
          to label %89 unwind label %114

89:                                               ; preds = %88
  store i1 true, ptr %20, align 1
  %90 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN11FatalLogger9GetStreamEv(ptr noundef nonnull align 8 dereferenceable(376) %18)
          to label %91 unwind label %118

91:                                               ; preds = %89
  br label %95

92:                                               ; preds = %87
  %93 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN10NullLogger9GetStreamEv(ptr noundef nonnull align 1 dereferenceable(1) %21)
          to label %94 unwind label %122

94:                                               ; preds = %92
  br label %95

95:                                               ; preds = %94, %91
  %96 = phi ptr [ %90, %91 ], [ %93, %94 ]
  call void @llvm.lifetime.end.p0(i64 1, ptr %21) #5
  %97 = load i1, ptr %20, align 1
  br i1 %97, label %98, label %99

98:                                               ; preds = %95
  call void @_ZN11FatalLoggerD2Ev(ptr noundef nonnull align 8 dereferenceable(376) %18) #5
  br label %99

99:                                               ; preds = %98, %95
  %100 = load i1, ptr %19, align 1
  br i1 %100, label %101, label %102

101:                                              ; preds = %99
  call void @llvm.lifetime.end.p0(i64 376, ptr %18) #5
  br label %102

102:                                              ; preds = %101, %99
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %17) #5
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %15) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %15) #5
  br label %103

103:                                              ; preds = %102
  %104 = load i64, ptr %14, align 8, !tbaa !9
  %105 = add i64 %104, 1
  store i64 %105, ptr %14, align 8, !tbaa !9
  br label %41, !llvm.loop !17

106:                                              ; preds = %80
  %107 = landingpad { ptr, i32 }
          cleanup
  %108 = extractvalue { ptr, i32 } %107, 0
  store ptr %108, ptr %8, align 8
  %109 = extractvalue { ptr, i32 } %107, 1
  store i32 %109, ptr %9, align 4
  br label %135

110:                                              ; preds = %85
  %111 = landingpad { ptr, i32 }
          cleanup
  %112 = extractvalue { ptr, i32 } %111, 0
  store ptr %112, ptr %8, align 8
  %113 = extractvalue { ptr, i32 } %111, 1
  store i32 %113, ptr %9, align 4
  br label %134

114:                                              ; preds = %88
  %115 = landingpad { ptr, i32 }
          cleanup
  %116 = extractvalue { ptr, i32 } %115, 0
  store ptr %116, ptr %8, align 8
  %117 = extractvalue { ptr, i32 } %115, 1
  store i32 %117, ptr %9, align 4
  br label %130

118:                                              ; preds = %89
  %119 = landingpad { ptr, i32 }
          cleanup
  %120 = extractvalue { ptr, i32 } %119, 0
  store ptr %120, ptr %8, align 8
  %121 = extractvalue { ptr, i32 } %119, 1
  store i32 %121, ptr %9, align 4
  br label %126

122:                                              ; preds = %92
  %123 = landingpad { ptr, i32 }
          cleanup
  %124 = extractvalue { ptr, i32 } %123, 0
  store ptr %124, ptr %8, align 8
  %125 = extractvalue { ptr, i32 } %123, 1
  store i32 %125, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %21) #5
  br label %126

126:                                              ; preds = %122, %118
  %127 = load i1, ptr %20, align 1
  br i1 %127, label %128, label %129

128:                                              ; preds = %126
  call void @_ZN11FatalLoggerD2Ev(ptr noundef nonnull align 8 dereferenceable(376) %18) #5
  br label %129

129:                                              ; preds = %128, %126
  br label %130

130:                                              ; preds = %129, %114
  %131 = load i1, ptr %19, align 1
  br i1 %131, label %132, label %133

132:                                              ; preds = %130
  call void @llvm.lifetime.end.p0(i64 376, ptr %18) #5
  br label %133

133:                                              ; preds = %132, %130
  br label %134

134:                                              ; preds = %133, %110
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %17) #5
  br label %135

135:                                              ; preds = %134, %106
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %15) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %15) #5
  br label %136

136:                                              ; preds = %135, %76
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %139

137:                                              ; preds = %45
  invoke void @_ZN7vraudio14TaskThreadPool14StopThreadPoolEv(ptr noundef nonnull align 8 dereferenceable(120) %7)
          to label %138 unwind label %46

138:                                              ; preds = %137
  call void @_ZN7vraudio14TaskThreadPoolD1Ev(ptr noundef nonnull align 8 dereferenceable(120) %7) #5
  call void @llvm.lifetime.end.p0(i64 120, ptr %7) #5
  ret void

139:                                              ; preds = %136, %69, %46
  call void @_ZN7vraudio14TaskThreadPoolD1Ev(ptr noundef nonnull align 8 dereferenceable(120) %7) #5
  call void @llvm.lifetime.end.p0(i64 120, ptr %7) #5
  br label %140

140:                                              ; preds = %139
  %141 = load ptr, ptr %8, align 8
  %142 = load i32, ptr %9, align 4
  %143 = insertvalue { ptr, i32 } poison, ptr %141, 0
  %144 = insertvalue { ptr, i32 } %143, i32 %142, 1
  resume { ptr, i32 } %144
}

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

declare void @_ZN7vraudio14TaskThreadPoolC1Ev(ptr noundef nonnull align 8 dereferenceable(120)) unnamed_addr #2

declare noundef zeroext i1 @_ZN7vraudio14TaskThreadPool15StartThreadPoolEm(ptr noundef nonnull align 8 dereferenceable(120), i64 noundef) #2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11FatalLoggerC2EPKci(ptr noundef nonnull align 8 dereferenceable(376), ptr noundef, i32 noundef) unnamed_addr #0 align 2

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

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

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

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

declare noundef zeroext i1 @_ZN7vraudio14TaskThreadPool31WaitUntilWorkerBecomesAvailableEv(ptr noundef nonnull align 8 dereferenceable(120)) #2

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

declare noundef zeroext i1 @_ZN7vraudio14TaskThreadPool17RunOnWorkerThreadESt8functionIFvvEE(ptr noundef nonnull align 8 dereferenceable(120), ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt8functionIFvvEEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 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

declare void @_ZN7vraudio14TaskThreadPool14StopThreadPoolEv(ptr noundef nonnull align 8 dereferenceable(120)) #2

; Function Attrs: nounwind
declare void @_ZN7vraudio14TaskThreadPoolD1Ev(ptr noundef nonnull align 8 dereferenceable(120)) unnamed_addr #4

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 "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 }

!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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !10, i64 0}
!16 = !{!"_ZTSZN7vraudio11ParallelForEjmRKSt8functionIFvmEEE3$_0", !10, i64 0, !12, i64 8}
!17 = distinct !{!17, !14}


; 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.vraudio::TaskThreadPool" = type { %"struct.std::atomic", %"struct.std::atomic.0", %"class.std::vector", %"class.std::condition_variable", %"class.std::mutex" }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%"struct.std::atomic.0" = type { %"struct.std::__atomic_base.1" }
%"struct.std::__atomic_base.1" = type { i8 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<vraudio::TaskThreadPool::WorkerThread, std::allocator<vraudio::TaskThreadPool::WorkerThread>>::_Vector_impl" }
%"struct.std::_Vector_base<vraudio::TaskThreadPool::WorkerThread, std::allocator<vraudio::TaskThreadPool::WorkerThread>>::_Vector_impl" = type { %"struct.std::_Vector_base<vraudio::TaskThreadPool::WorkerThread, std::allocator<vraudio::TaskThreadPool::WorkerThread>>::_Vector_impl_data" }
%"struct.std::_Vector_base<vraudio::TaskThreadPool::WorkerThread, std::allocator<vraudio::TaskThreadPool::WorkerThread>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"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::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.FatalLogger = type { %"class.std::__cxx11::basic_ostringstream" }
%"class.std::__cxx11::basic_ostringstream" = type { %"class.std::basic_ostream.base", %"class.std::__cxx11::basic_stringbuf", %"class.std::basic_ios" }
%"class.std::basic_ostream.base" = type { ptr }
%"class.std::__cxx11::basic_stringbuf" = type { %"class.std::basic_streambuf", i32, %"class.std::__cxx11::basic_string" }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%class.NullLogger = type { i8 }
%"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 { i64, ptr }

@.str = external hidden unnamed_addr constant [131 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7vraudio11ParallelForEjmRKSt8functionIFvmEE(i32 noundef %0, i64 noundef %1, ptr noundef nonnull align 8 dereferenceable(32) %2) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.vraudio::TaskThreadPool", align 8
  %5 = alloca %class.FatalLogger, align 8
  %6 = alloca %class.NullLogger, align 1
  %7 = alloca %"class.std::function", align 8
  %8 = alloca %class.anon, align 8
  %9 = alloca %"class.std::function", align 8
  %10 = alloca %class.FatalLogger, align 8
  %11 = alloca %class.NullLogger, align 1
  call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %4) #5
  call void @_ZN7vraudio14TaskThreadPoolC1Ev(ptr noundef nonnull align 8 dereferenceable(120) %4)
  %12 = zext i32 %0 to i64
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #5
  %13 = invoke noundef zeroext i1 @_ZN7vraudio14TaskThreadPool15StartThreadPoolEm(ptr noundef nonnull align 8 dereferenceable(120) %4, i64 noundef %12)
          to label %14 unwind label %21

14:                                               ; preds = %3
  br i1 %13, label %16, label %15

15:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 376, ptr nonnull %5) #5
  invoke void @_ZN11FatalLoggerC2EPKci(ptr noundef nonnull align 8 dereferenceable(376) %5, ptr noundef nonnull @.str, i32 noundef 32)
          to label %18 unwind label %24

16:                                               ; preds = %14
  %17 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN10NullLogger9GetStreamEv(ptr noundef nonnull align 1 dereferenceable(1) %6)
          to label %.thread unwind label %.thread37

.thread:                                          ; preds = %16
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #5
  br label %.critedge

18:                                               ; preds = %15
  %19 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN11FatalLogger9GetStreamEv(ptr noundef nonnull align 8 dereferenceable(376) %5)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #5
  call void @_ZN11FatalLoggerD2Ev(ptr noundef nonnull align 8 dereferenceable(376) %5) #5
  call void @llvm.lifetime.end.p0(i64 376, ptr nonnull %5) #5
  br label %.critedge

.critedge:                                        ; preds = %.thread, %18
  %.not = icmp eq i64 %1, 0
  br i1 %.not, label %._crit_edge, label %.preheader.lr.ph

.preheader.lr.ph:                                 ; preds = %.critedge
  %20 = getelementptr inbounds i8, ptr %8, i64 8
  br label %.preheader

.preheader:                                       ; preds = %.preheader.lr.ph, %.critedge36
  %.01642 = phi i64 [ 0, %.preheader.lr.ph ], [ %40, %.critedge36 ]
  br label %26

._crit_edge:                                      ; preds = %.critedge36, %.critedge
  invoke void @_ZN7vraudio14TaskThreadPool14StopThreadPoolEv(ptr noundef nonnull align 8 dereferenceable(120) %4)
          to label %50 unwind label %21

21:                                               ; preds = %._crit_edge, %3
  %22 = landingpad { ptr, i32 }
          cleanup
  br label %51

.thread37:                                        ; preds = %16
  %23 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #5
  br label %51

24:                                               ; preds = %15
  %25 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 376, ptr nonnull %5) #5
  br label %51

26:                                               ; preds = %.preheader, %28
  %27 = invoke noundef zeroext i1 @_ZN7vraudio14TaskThreadPool31WaitUntilWorkerBecomesAvailableEv(ptr noundef nonnull align 8 dereferenceable(120) %4)
          to label %28 unwind label %29

28:                                               ; preds = %26
  br i1 %27, label %31, label %26, !llvm.loop !5

29:                                               ; preds = %26
  %30 = landingpad { ptr, i32 }
          cleanup
  br label %51

31:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #5
  store i64 %.01642, ptr %8, align 8, !tbaa !7
  store ptr %2, ptr %20, align 8, !tbaa !13
  call void @"_ZNSt8functionIFvvEEC2IZN7vraudio11ParallelForEjmRKS_IFvmEEE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef nonnull align 8 dereferenceable(16) %8) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %11) #5
  invoke void @_ZNSt8functionIFvvEEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef nonnull align 8 dereferenceable(32) %7)
          to label %32 unwind label %41

32:                                               ; preds = %31
  %33 = invoke noundef zeroext i1 @_ZN7vraudio14TaskThreadPool17RunOnWorkerThreadESt8functionIFvvEE(ptr noundef nonnull align 8 dereferenceable(120) %4, ptr noundef nonnull %9)
          to label %34 unwind label %43

34:                                               ; preds = %32
  br i1 %33, label %36, label %35

35:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 376, ptr nonnull %10) #5
  invoke void @_ZN11FatalLoggerC2EPKci(ptr noundef nonnull align 8 dereferenceable(376) %10, ptr noundef nonnull @.str, i32 noundef 39)
          to label %38 unwind label %46

36:                                               ; preds = %34
  %37 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN10NullLogger9GetStreamEv(ptr noundef nonnull align 1 dereferenceable(1) %11)
          to label %.thread39 unwind label %.thread40

.thread39:                                        ; preds = %36
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %11) #5
  br label %.critedge36

38:                                               ; preds = %35
  %39 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN11FatalLogger9GetStreamEv(ptr noundef nonnull align 8 dereferenceable(376) %10)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %11) #5
  call void @_ZN11FatalLoggerD2Ev(ptr noundef nonnull align 8 dereferenceable(376) %10) #5
  call void @llvm.lifetime.end.p0(i64 376, ptr nonnull %10) #5
  br label %.critedge36

.critedge36:                                      ; preds = %.thread39, %38
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #5
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #5
  %40 = add nuw i64 %.01642, 1
  %exitcond.not = icmp eq i64 %40, %1
  br i1 %exitcond.not, label %._crit_edge, label %.preheader, !llvm.loop !14

41:                                               ; preds = %31
  %42 = landingpad { ptr, i32 }
          cleanup
  br label %49

43:                                               ; preds = %32
  %44 = landingpad { ptr, i32 }
          cleanup
  br label %48

.thread40:                                        ; preds = %36
  %45 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %11) #5
  br label %48

46:                                               ; preds = %35
  %47 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 376, ptr nonnull %10) #5
  br label %48

48:                                               ; preds = %.thread40, %46, %43
  %.pn29.pn = phi { ptr, i32 } [ %47, %46 ], [ %44, %43 ], [ %45, %.thread40 ]
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #5
  br label %49

49:                                               ; preds = %48, %41
  %.pn29.pn.pn = phi { ptr, i32 } [ %.pn29.pn, %48 ], [ %42, %41 ]
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #5
  br label %51

50:                                               ; preds = %._crit_edge
  call void @_ZN7vraudio14TaskThreadPoolD1Ev(ptr noundef nonnull align 8 dereferenceable(120) %4) #5
  call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %4) #5
  ret void

51:                                               ; preds = %.thread37, %29, %49, %24, %21
  %.pn29.pn.pn.pn.pn = phi { ptr, i32 } [ %22, %21 ], [ %25, %24 ], [ %.pn29.pn.pn, %49 ], [ %30, %29 ], [ %23, %.thread37 ]
  call void @_ZN7vraudio14TaskThreadPoolD1Ev(ptr noundef nonnull align 8 dereferenceable(120) %4) #5
  call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %4) #5
  resume { ptr, i32 } %.pn29.pn.pn.pn.pn
}

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

declare void @_ZN7vraudio14TaskThreadPoolC1Ev(ptr noundef nonnull align 8 dereferenceable(120)) unnamed_addr #2

declare noundef zeroext i1 @_ZN7vraudio14TaskThreadPool15StartThreadPoolEm(ptr noundef nonnull align 8 dereferenceable(120), i64 noundef) local_unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11FatalLoggerC2EPKci(ptr noundef nonnull align 8 dereferenceable(376), ptr noundef, i32 noundef) unnamed_addr #0 align 2

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

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

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

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

declare noundef zeroext i1 @_ZN7vraudio14TaskThreadPool31WaitUntilWorkerBecomesAvailableEv(ptr noundef nonnull align 8 dereferenceable(120)) local_unnamed_addr #2

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

declare noundef zeroext i1 @_ZN7vraudio14TaskThreadPool17RunOnWorkerThreadESt8functionIFvvEE(ptr noundef nonnull align 8 dereferenceable(120), ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt8functionIFvvEEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 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

declare void @_ZN7vraudio14TaskThreadPool14StopThreadPoolEv(ptr noundef nonnull align 8 dereferenceable(120)) local_unnamed_addr #2

; Function Attrs: nounwind
declare void @_ZN7vraudio14TaskThreadPoolD1Ev(ptr noundef nonnull align 8 dereferenceable(120)) unnamed_addr #4

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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 "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 }

!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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !9, i64 0}
!8 = !{!"_ZTSZN7vraudio11ParallelForEjmRKSt8functionIFvmEEE3$_0", !9, i64 0, !12, i64 8}
!9 = !{!"long", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"any pointer", !10, i64 0}
!13 = !{!12, !12, i64 0}
!14 = distinct !{!14, !6}


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