; LLVM IR from jrouwe/JoltPhysics :: Jolt/Core/JobSystemThreadPool.ll (ZN3JPH19JobSystemThreadPool10ThreadMainEi)

; 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.JPH::FPExceptionsEnable" = type { i8 }
%"class.JPH::JobSystemThreadPool" = type <{ %"class.JPH::JobSystemWithBarrier", %"class.std::function", %"class.std::function", [40 x i8], %"class.JPH::FixedSizeFreeList", %"class.JPH::Array", [1024 x %"struct.std::atomic.2"], ptr, [32 x i8], %"struct.std::atomic", [60 x i8], %"class.JPH::Semaphore", %"struct.std::atomic.6", [63 x i8] }>
%"class.JPH::JobSystemWithBarrier" = type { %"class.JPH::JobSystem", i32, ptr }
%"class.JPH::JobSystem" = type { ptr }
%"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.JPH::FixedSizeFreeList" = type <{ i32, i32, i32, i32, i32, [4 x i8], ptr, [32 x i8], %"class.JPH::Mutex", %"struct.std::atomic", %"struct.std::atomic", %"struct.std::atomic.0", %"struct.std::atomic", [60 x i8] }>
%"class.JPH::Mutex" = type { %"class.std::mutex", %"class.std::thread::id" }
%"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::thread::id" = type { i64 }
%"struct.std::atomic.0" = type { %"struct.std::__atomic_base.1" }
%"struct.std::__atomic_base.1" = type { i64 }
%"class.JPH::Array" = type { i64, i64, ptr }
%"struct.std::atomic.2" = type { %"struct.std::__atomic_base.3" }
%"struct.std::__atomic_base.3" = type { ptr }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%"class.JPH::Semaphore" = type { %"struct.std::atomic.4", %union.sem_t, [24 x i8] }
%"struct.std::atomic.4" = type { %"struct.std::__atomic_base.5" }
%"struct.std::__atomic_base.5" = type { i32 }
%union.sem_t = type { i64, [24 x i8] }
%"struct.std::atomic.6" = type { %"struct.std::__atomic_base.7" }
%"struct.std::__atomic_base.7" = type { i8 }

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNKSt13__atomic_baseIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNSt6atomicIPN3JPH9JobSystem3JobEE8exchangeES3_St12memory_order(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, i32 noundef) #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN3JPH9JobSystem3Job7ExecuteEv(ptr noundef nonnull align 8 dereferenceable(56)) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH9JobSystem3Job7ReleaseEv(ptr noundef nonnull align 8 dereferenceable(56)) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3JPH19JobSystemThreadPool10ThreadMainEi(ptr noundef nonnull align 64 dereferenceable(8768) %0, i32 noundef %1) #3 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca [64 x i8], align 16
  %6 = alloca %"class.JPH::FPExceptionsEnable", align 1
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %10 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 64, ptr %5) #6
  %11 = getelementptr inbounds [64 x i8], ptr %5, i64 0, i64 0
  %12 = load i32, ptr %4, align 4, !tbaa !9
  %13 = add nsw i32 %12, 1
  %14 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %11, i64 noundef 64, ptr noundef @.str.5, i32 noundef %13) #6
  %15 = getelementptr inbounds [64 x i8], ptr %5, i64 0, i64 0
  call void @_ZN3JPHL13SetThreadNameEPKc(ptr noundef %15)
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #6
  %16 = getelementptr inbounds %"class.JPH::JobSystemThreadPool", ptr %10, i32 0, i32 1
  %17 = load i32, ptr %4, align 4, !tbaa !9
  call void @_ZNKSt8functionIFviEEclEi(ptr noundef nonnull align 8 dereferenceable(32) %16, i32 noundef %17)
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %18 = getelementptr inbounds %"class.JPH::JobSystemThreadPool", ptr %10, i32 0, i32 7
  %19 = load ptr, ptr %18, align 8, !tbaa !11
  %20 = load i32, ptr %4, align 4, !tbaa !9
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds %"struct.std::atomic", ptr %19, i64 %21
  store ptr %22, ptr %7, align 8, !tbaa !5
  br label %23

23:                                               ; preds = %58, %2
  %24 = getelementptr inbounds %"class.JPH::JobSystemThreadPool", ptr %10, i32 0, i32 12
  %25 = call noundef zeroext i1 @_ZNKSt6atomicIbEcvbEv(ptr noundef nonnull align 1 dereferenceable(1) %24) #6
  %26 = xor i1 %25, true
  br i1 %26, label %27, label %59

27:                                               ; preds = %23
  %28 = getelementptr inbounds %"class.JPH::JobSystemThreadPool", ptr %10, i32 0, i32 11
  call void @_ZN3JPH9Semaphore7AcquireEj(ptr noundef nonnull align 64 dereferenceable(40) %28, i32 noundef 1)
  br label %29

29:                                               ; preds = %55, %27
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = call noundef i32 @_ZNKSt13__atomic_baseIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %30) #6
  %32 = getelementptr inbounds %"class.JPH::JobSystemThreadPool", ptr %10, i32 0, i32 9
  %33 = call noundef i32 @_ZNKSt13__atomic_baseIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %32) #6
  %34 = icmp ne i32 %31, %33
  br i1 %34, label %35, label %58

35:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %36 = getelementptr inbounds %"class.JPH::JobSystemThreadPool", ptr %10, i32 0, i32 6
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = call noundef i32 @_ZNKSt13__atomic_baseIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %37) #6
  %39 = and i32 %38, 1023
  %40 = zext i32 %39 to i64
  %41 = getelementptr inbounds [1024 x %"struct.std::atomic.2"], ptr %36, i64 0, i64 %40
  store ptr %41, ptr %8, align 8, !tbaa !5
  %42 = load ptr, ptr %8, align 8, !tbaa !5
  %43 = call noundef ptr @_ZNKSt6atomicIPN3JPH9JobSystem3JobEE4loadESt12memory_order(ptr noundef nonnull align 8 dereferenceable(8) %42, i32 noundef 5) #6
  %44 = icmp ne ptr %43, null
  br i1 %44, label %45, label %55

45:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %46 = load ptr, ptr %8, align 8, !tbaa !5
  %47 = call noundef ptr @_ZNSt6atomicIPN3JPH9JobSystem3JobEE8exchangeES3_St12memory_order(ptr noundef nonnull align 8 dereferenceable(8) %46, ptr noundef null, i32 noundef 5) #6
  store ptr %47, ptr %9, align 8, !tbaa !5
  %48 = load ptr, ptr %9, align 8, !tbaa !5
  %49 = icmp ne ptr %48, null
  br i1 %49, label %50, label %54

50:                                               ; preds = %45
  %51 = load ptr, ptr %9, align 8, !tbaa !5
  %52 = call noundef i32 @_ZN3JPH9JobSystem3Job7ExecuteEv(ptr noundef nonnull align 8 dereferenceable(56) %51)
  %53 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_ZN3JPH9JobSystem3Job7ReleaseEv(ptr noundef nonnull align 8 dereferenceable(56) %53)
  br label %54

54:                                               ; preds = %50, %45
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %55

55:                                               ; preds = %54, %35
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  %57 = call noundef i32 @_ZNSt13__atomic_baseIjEppEi(ptr noundef nonnull align 4 dereferenceable(4) %56, i32 noundef 0) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %29, !llvm.loop !34

58:                                               ; preds = %29
  br label %23, !llvm.loop !36

59:                                               ; preds = %23
  %60 = getelementptr inbounds %"class.JPH::JobSystemThreadPool", ptr %10, i32 0, i32 2
  %61 = load i32, ptr %4, align 4, !tbaa !9
  call void @_ZNKSt8functionIFviEEclEi(ptr noundef nonnull align 8 dereferenceable(32) %60, i32 noundef %61)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 64, ptr %5) #6
  ret void
}

; Function Attrs: nounwind
declare i32 @snprintf(ptr noundef, i64 noundef, ptr noundef, ...) #4

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN3JPHL13SetThreadNameEPKc(ptr noundef) #3

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6atomicIbEcvbEv(ptr noundef nonnull align 1 dereferenceable(1)) #1 align 2

declare void @_ZN3JPH9Semaphore7AcquireEj(ptr noundef nonnull align 64 dereferenceable(40), i32 noundef) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt6atomicIPN3JPH9JobSystem3JobEE4loadESt12memory_order(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #1 align 2

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 8536}
!12 = !{!"_ZTSN3JPH19JobSystemThreadPoolE", !13, i64 0, !15, i64 24, !15, i64 56, !17, i64 128, !27, i64 320, !7, i64 344, !6, i64 8536, !23, i64 8576, !28, i64 8640, !31, i64 8704}
!13 = !{!"_ZTSN3JPH20JobSystemWithBarrierE", !14, i64 0, !10, i64 8, !6, i64 16}
!14 = !{!"_ZTSN3JPH9JobSystemE"}
!15 = !{!"_ZTSSt8functionIFviEE", !16, i64 0, !6, i64 24}
!16 = !{!"_ZTSSt14_Function_base", !7, i64 0, !6, i64 16}
!17 = !{!"_ZTSN3JPH17FixedSizeFreeListINS_9JobSystem3JobEEE", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !6, i64 24, !18, i64 64, !23, i64 112, !23, i64 116, !25, i64 120, !23, i64 128}
!18 = !{!"_ZTSN3JPH5MutexE", !19, i64 0, !21, i64 40}
!19 = !{!"_ZTSSt5mutex", !20, i64 0}
!20 = !{!"_ZTSSt12__mutex_base", !7, i64 0}
!21 = !{!"_ZTSNSt6thread2idE", !22, i64 0}
!22 = !{!"long", !7, i64 0}
!23 = !{!"_ZTSSt6atomicIjE", !24, i64 0}
!24 = !{!"_ZTSSt13__atomic_baseIjE", !10, i64 0}
!25 = !{!"_ZTSSt6atomicImE", !26, i64 0}
!26 = !{!"_ZTSSt13__atomic_baseImE", !22, i64 0}
!27 = !{!"_ZTSN3JPH5ArrayISt6threadNS_12STLAllocatorIS1_EEEE", !22, i64 0, !22, i64 8, !6, i64 16}
!28 = !{!"_ZTSN3JPH9SemaphoreE", !29, i64 0, !7, i64 8}
!29 = !{!"_ZTSSt6atomicIiE", !30, i64 0}
!30 = !{!"_ZTSSt13__atomic_baseIiE", !10, i64 0}
!31 = !{!"_ZTSSt6atomicIbE", !32, i64 0}
!32 = !{!"_ZTSSt13__atomic_baseIbE", !33, i64 0}
!33 = !{!"bool", !7, i64 0}
!34 = distinct !{!34, !35}
!35 = !{!"llvm.loop.mustprogress"}
!36 = distinct !{!36, !35}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%"struct.std::atomic.2" = type { %"struct.std::__atomic_base.3" }
%"struct.std::__atomic_base.3" = type { ptr }

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

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

; 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 nounwind uwtable
declare dso_local noundef i32 @_ZNKSt13__atomic_baseIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNSt6atomicIPN3JPH9JobSystem3JobEE8exchangeES3_St12memory_order(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN3JPH9JobSystem3Job7ExecuteEv(ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH9JobSystem3Job7ReleaseEv(ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3JPH19JobSystemThreadPool10ThreadMainEi(ptr noundef nonnull align 64 dereferenceable(8768) %0, i32 noundef %1) local_unnamed_addr #3 align 2 {
  %3 = alloca [64 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %3) #6
  %4 = add nsw i32 %1, 1
  %5 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %3, i64 noundef 64, ptr noundef nonnull @.str.5, i32 noundef %4) #6
  call void @_ZN3JPHL13SetThreadNameEPKc(ptr noundef nonnull %3)
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  call void @_ZNKSt8functionIFviEEclEi(ptr noundef nonnull align 8 dereferenceable(32) %6, i32 noundef %1)
  %7 = getelementptr inbounds i8, ptr %0, i64 8536
  %8 = load ptr, ptr %7, align 8, !tbaa !5
  %9 = sext i32 %1 to i64
  %10 = getelementptr inbounds %"struct.std::atomic", ptr %8, i64 %9
  %11 = getelementptr inbounds i8, ptr %0, i64 8704
  %12 = call noundef zeroext i1 @_ZNKSt6atomicIbEcvbEv(ptr noundef nonnull align 1 dereferenceable(1) %11) #6
  br i1 %12, label %._crit_edge, label %.lr.ph15

.lr.ph15:                                         ; preds = %2
  %13 = getelementptr inbounds i8, ptr %0, i64 8640
  %14 = getelementptr inbounds i8, ptr %0, i64 8576
  %15 = getelementptr inbounds i8, ptr %0, i64 344
  br label %17

.loopexit:                                        ; preds = %29, %17
  %16 = call noundef zeroext i1 @_ZNKSt6atomicIbEcvbEv(ptr noundef nonnull align 1 dereferenceable(1) %11) #6
  br i1 %16, label %._crit_edge, label %17, !llvm.loop !32

17:                                               ; preds = %.lr.ph15, %.loopexit
  call void @_ZN3JPH9Semaphore7AcquireEj(ptr noundef nonnull align 64 dereferenceable(40) %13, i32 noundef 1)
  %18 = call noundef i32 @_ZNKSt13__atomic_baseIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %10) #6
  %19 = call noundef i32 @_ZNKSt13__atomic_baseIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %14) #6
  %.not14 = icmp eq i32 %18, %19
  br i1 %.not14, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %17, %29
  %20 = call noundef i32 @_ZNKSt13__atomic_baseIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %10) #6
  %21 = and i32 %20, 1023
  %22 = zext nneg i32 %21 to i64
  %23 = getelementptr inbounds [1024 x %"struct.std::atomic.2"], ptr %15, i64 0, i64 %22
  %24 = call noundef ptr @_ZNKSt6atomicIPN3JPH9JobSystem3JobEE4loadESt12memory_order(ptr noundef nonnull align 8 dereferenceable(8) %23, i32 noundef 5) #6
  %.not12 = icmp eq ptr %24, null
  br i1 %.not12, label %29, label %25

25:                                               ; preds = %.lr.ph
  %26 = call noundef ptr @_ZNSt6atomicIPN3JPH9JobSystem3JobEE8exchangeES3_St12memory_order(ptr noundef nonnull align 8 dereferenceable(8) %23, ptr noundef null, i32 noundef 5) #6
  %.not13 = icmp eq ptr %26, null
  br i1 %.not13, label %29, label %27

27:                                               ; preds = %25
  %28 = call noundef i32 @_ZN3JPH9JobSystem3Job7ExecuteEv(ptr noundef nonnull align 8 dereferenceable(56) %26)
  call void @_ZN3JPH9JobSystem3Job7ReleaseEv(ptr noundef nonnull align 8 dereferenceable(56) %26)
  br label %29

29:                                               ; preds = %25, %27, %.lr.ph
  %30 = call noundef i32 @_ZNSt13__atomic_baseIjEppEi(ptr noundef nonnull align 4 dereferenceable(4) %10, i32 noundef 0) #6
  %31 = call noundef i32 @_ZNKSt13__atomic_baseIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %10) #6
  %32 = call noundef i32 @_ZNKSt13__atomic_baseIjEcvjEv(ptr noundef nonnull align 4 dereferenceable(4) %14) #6
  %.not = icmp eq i32 %31, %32
  br i1 %.not, label %.loopexit, label %.lr.ph, !llvm.loop !34

._crit_edge:                                      ; preds = %.loopexit, %2
  %33 = getelementptr inbounds i8, ptr %0, i64 56
  call void @_ZNKSt8functionIFviEEclEi(ptr noundef nonnull align 8 dereferenceable(32) %33, i32 noundef %1)
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %3) #6
  ret void
}

; Function Attrs: nofree nounwind
declare noundef i32 @snprintf(ptr noalias nocapture noundef writeonly, i64 noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN3JPHL13SetThreadNameEPKc(ptr noundef) local_unnamed_addr #3

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6atomicIbEcvbEv(ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #1 align 2

declare void @_ZN3JPH9Semaphore7AcquireEj(ptr noundef nonnull align 64 dereferenceable(40), i32 noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt6atomicIPN3JPH9JobSystem3JobEE4loadESt12memory_order(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #1 align 2

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 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 = { nofree 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

!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, !12, i64 8536}
!6 = !{!"_ZTSN3JPH19JobSystemThreadPoolE", !7, i64 0, !13, i64 24, !13, i64 56, !15, i64 128, !25, i64 320, !10, i64 344, !12, i64 8536, !21, i64 8576, !26, i64 8640, !29, i64 8704}
!7 = !{!"_ZTSN3JPH20JobSystemWithBarrierE", !8, i64 0, !9, i64 8, !12, i64 16}
!8 = !{!"_ZTSN3JPH9JobSystemE"}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"any pointer", !10, i64 0}
!13 = !{!"_ZTSSt8functionIFviEE", !14, i64 0, !12, i64 24}
!14 = !{!"_ZTSSt14_Function_base", !10, i64 0, !12, i64 16}
!15 = !{!"_ZTSN3JPH17FixedSizeFreeListINS_9JobSystem3JobEEE", !9, i64 0, !9, i64 4, !9, i64 8, !9, i64 12, !9, i64 16, !12, i64 24, !16, i64 64, !21, i64 112, !21, i64 116, !23, i64 120, !21, i64 128}
!16 = !{!"_ZTSN3JPH5MutexE", !17, i64 0, !19, i64 40}
!17 = !{!"_ZTSSt5mutex", !18, i64 0}
!18 = !{!"_ZTSSt12__mutex_base", !10, i64 0}
!19 = !{!"_ZTSNSt6thread2idE", !20, i64 0}
!20 = !{!"long", !10, i64 0}
!21 = !{!"_ZTSSt6atomicIjE", !22, i64 0}
!22 = !{!"_ZTSSt13__atomic_baseIjE", !9, i64 0}
!23 = !{!"_ZTSSt6atomicImE", !24, i64 0}
!24 = !{!"_ZTSSt13__atomic_baseImE", !20, i64 0}
!25 = !{!"_ZTSN3JPH5ArrayISt6threadNS_12STLAllocatorIS1_EEEE", !20, i64 0, !20, i64 8, !12, i64 16}
!26 = !{!"_ZTSN3JPH9SemaphoreE", !27, i64 0, !10, i64 8}
!27 = !{!"_ZTSSt6atomicIiE", !28, i64 0}
!28 = !{!"_ZTSSt13__atomic_baseIiE", !9, i64 0}
!29 = !{!"_ZTSSt6atomicIbE", !30, i64 0}
!30 = !{!"_ZTSSt13__atomic_baseIbE", !31, i64 0}
!31 = !{!"bool", !10, i64 0}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}
!34 = distinct !{!34, !33}


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