; LLVM IR from pupnp/pupnp :: upnp/src/threadutil (ThreadPool)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.THREADPOOL = type { %union.pthread_mutex_t, %union.pthread_cond_t, %union.pthread_cond_t, i32, i32, i32, i32, i32, i32, %struct.FREELIST, %struct.LINKEDLIST, %struct.LINKEDLIST, %struct.LINKEDLIST, ptr, %struct.THREADPOOLATTR, %struct.TPOOLSTATS }
%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 }
%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 }
%struct.FREELIST = type { ptr, i64, i32, i32 }
%struct.LINKEDLIST = type { %struct.LISTNODE, %struct.LISTNODE, i64, %struct.FREELIST, ptr, ptr }
%struct.LISTNODE = type { ptr, ptr, ptr }
%struct.THREADPOOLATTR = type { i32, i32, i64, i32, i32, i32, i32, i32 }
%struct.TPOOLSTATS = type { double, i32, double, double, i32, double, double, i32, double, double, double, i32, i32, i32, i32, i32, i32, i32, i32 }

; Function Attrs: nounwind uwtable
define dso_local i32 @ThreadPoolInit(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !9
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = icmp ne ptr %9, null
  br i1 %10, label %12, label %11

11:                                               ; preds = %2
  store i32 22, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %149

12:                                               ; preds = %2
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.THREADPOOL, ptr %13, i32 0, i32 0
  %15 = call i32 @pthread_mutex_init(ptr noundef %14, ptr noundef null) #5
  %16 = load i32, ptr %6, align 4, !tbaa !9
  %17 = add nsw i32 %16, %15
  store i32 %17, ptr %6, align 4, !tbaa !9
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.THREADPOOL, ptr %18, i32 0, i32 0
  %20 = call i32 @pthread_mutex_lock(ptr noundef %19) #5
  %21 = load i32, ptr %6, align 4, !tbaa !9
  %22 = add nsw i32 %21, %20
  store i32 %22, ptr %6, align 4, !tbaa !9
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.THREADPOOL, ptr %23, i32 0, i32 1
  %25 = call i32 @pthread_cond_init(ptr noundef %24, ptr noundef null) #5
  %26 = load i32, ptr %6, align 4, !tbaa !9
  %27 = add nsw i32 %26, %25
  store i32 %27, ptr %6, align 4, !tbaa !9
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.THREADPOOL, ptr %28, i32 0, i32 2
  %30 = call i32 @pthread_cond_init(ptr noundef %29, ptr noundef null) #5
  %31 = load i32, ptr %6, align 4, !tbaa !9
  %32 = add nsw i32 %31, %30
  store i32 %32, ptr %6, align 4, !tbaa !9
  %33 = load i32, ptr %6, align 4, !tbaa !9
  %34 = icmp ne i32 %33, 0
  br i1 %34, label %35, label %48

35:                                               ; preds = %12
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.THREADPOOL, ptr %36, i32 0, i32 0
  %38 = call i32 @pthread_mutex_unlock(ptr noundef %37) #5
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.THREADPOOL, ptr %39, i32 0, i32 0
  %41 = call i32 @pthread_mutex_destroy(ptr noundef %40) #5
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.THREADPOOL, ptr %42, i32 0, i32 1
  %44 = call i32 @pthread_cond_destroy(ptr noundef %43) #5
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.THREADPOOL, ptr %45, i32 0, i32 2
  %47 = call i32 @pthread_cond_destroy(ptr noundef %46) #5
  store i32 11, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %149

48:                                               ; preds = %12
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = icmp ne ptr %49, null
  br i1 %50, label %51, label %55

51:                                               ; preds = %48
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.THREADPOOL, ptr %52, i32 0, i32 14
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %53, ptr align 8 %54, i64 40, i1 false), !tbaa.struct !11
  br label %59

55:                                               ; preds = %48
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.THREADPOOL, ptr %56, i32 0, i32 14
  %58 = call i32 @TPAttrInit(ptr noundef %57)
  br label %59

59:                                               ; preds = %55, %51
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.THREADPOOL, ptr %60, i32 0, i32 14
  %62 = getelementptr inbounds %struct.THREADPOOLATTR, ptr %61, i32 0, i32 7
  %63 = load i32, ptr %62, align 8, !tbaa !14
  %64 = call i32 @SetPolicyType(i32 noundef %63)
  %65 = icmp ne i32 %64, 0
  br i1 %65, label %66, label %79

66:                                               ; preds = %59
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.THREADPOOL, ptr %67, i32 0, i32 0
  %69 = call i32 @pthread_mutex_unlock(ptr noundef %68) #5
  %70 = load ptr, ptr %4, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.THREADPOOL, ptr %70, i32 0, i32 0
  %72 = call i32 @pthread_mutex_destroy(ptr noundef %71) #5
  %73 = load ptr, ptr %4, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.THREADPOOL, ptr %73, i32 0, i32 1
  %75 = call i32 @pthread_cond_destroy(ptr noundef %74) #5
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.THREADPOOL, ptr %76, i32 0, i32 2
  %78 = call i32 @pthread_cond_destroy(ptr noundef %77) #5
  store i32 536870912, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %149

79:                                               ; preds = %59
  %80 = load ptr, ptr %4, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.THREADPOOL, ptr %80, i32 0, i32 9
  %82 = call i32 @FreeListInit(ptr noundef %81, i64 noundef 48, i32 noundef 100)
  %83 = load i32, ptr %6, align 4, !tbaa !9
  %84 = add nsw i32 %83, %82
  store i32 %84, ptr %6, align 4, !tbaa !9
  %85 = load ptr, ptr %4, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.THREADPOOL, ptr %85, i32 0, i32 15
  call void @StatsInit(ptr noundef %86)
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.THREADPOOL, ptr %87, i32 0, i32 12
  %89 = call i32 @ListInit(ptr noundef %88, ptr noundef @CmpThreadPoolJob, ptr noundef null)
  %90 = load i32, ptr %6, align 4, !tbaa !9
  %91 = add nsw i32 %90, %89
  store i32 %91, ptr %6, align 4, !tbaa !9
  %92 = load ptr, ptr %4, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.THREADPOOL, ptr %92, i32 0, i32 11
  %94 = call i32 @ListInit(ptr noundef %93, ptr noundef @CmpThreadPoolJob, ptr noundef null)
  %95 = load i32, ptr %6, align 4, !tbaa !9
  %96 = add nsw i32 %95, %94
  store i32 %96, ptr %6, align 4, !tbaa !9
  %97 = load ptr, ptr %4, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.THREADPOOL, ptr %97, i32 0, i32 10
  %99 = call i32 @ListInit(ptr noundef %98, ptr noundef @CmpThreadPoolJob, ptr noundef null)
  %100 = load i32, ptr %6, align 4, !tbaa !9
  %101 = add nsw i32 %100, %99
  store i32 %101, ptr %6, align 4, !tbaa !9
  %102 = load i32, ptr %6, align 4, !tbaa !9
  %103 = icmp ne i32 %102, 0
  br i1 %103, label %104, label %105

104:                                              ; preds = %79
  store i32 11, ptr %6, align 4, !tbaa !9
  br label %138

105:                                              ; preds = %79
  %106 = load ptr, ptr %4, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.THREADPOOL, ptr %106, i32 0, i32 13
  store ptr null, ptr %107, align 8, !tbaa !22
  %108 = load ptr, ptr %4, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.THREADPOOL, ptr %108, i32 0, i32 3
  store i32 0, ptr %109, align 8, !tbaa !23
  %110 = load ptr, ptr %4, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.THREADPOOL, ptr %110, i32 0, i32 4
  store i32 0, ptr %111, align 4, !tbaa !24
  %112 = load ptr, ptr %4, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.THREADPOOL, ptr %112, i32 0, i32 5
  store i32 0, ptr %113, align 8, !tbaa !25
  %114 = load ptr, ptr %4, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.THREADPOOL, ptr %114, i32 0, i32 7
  store i32 0, ptr %115, align 8, !tbaa !26
  %116 = load ptr, ptr %4, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.THREADPOOL, ptr %116, i32 0, i32 8
  store i32 0, ptr %117, align 4, !tbaa !27
  %118 = load ptr, ptr %4, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.THREADPOOL, ptr %118, i32 0, i32 6
  store i32 0, ptr %119, align 4, !tbaa !28
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %120

120:                                              ; preds = %134, %105
  %121 = load i32, ptr %7, align 4, !tbaa !9
  %122 = load ptr, ptr %4, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.THREADPOOL, ptr %122, i32 0, i32 14
  %124 = getelementptr inbounds %struct.THREADPOOLATTR, ptr %123, i32 0, i32 0
  %125 = load i32, ptr %124, align 8, !tbaa !29
  %126 = icmp slt i32 %121, %125
  br i1 %126, label %127, label %137

127:                                              ; preds = %120
  %128 = load ptr, ptr %4, align 8, !tbaa !5
  %129 = call i32 @CreateWorker(ptr noundef %128)
  store i32 %129, ptr %6, align 4, !tbaa !9
  %130 = load i32, ptr %6, align 4, !tbaa !9
  %131 = icmp ne i32 %130, 0
  br i1 %131, label %132, label %133

132:                                              ; preds = %127
  br label %137

133:                                              ; preds = %127
  br label %134

134:                                              ; preds = %133
  %135 = load i32, ptr %7, align 4, !tbaa !9
  %136 = add nsw i32 %135, 1
  store i32 %136, ptr %7, align 4, !tbaa !9
  br label %120, !llvm.loop !30

137:                                              ; preds = %132, %120
  br label %138

138:                                              ; preds = %137, %104
  %139 = load ptr, ptr %4, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.THREADPOOL, ptr %139, i32 0, i32 0
  %141 = call i32 @pthread_mutex_unlock(ptr noundef %140) #5
  %142 = load i32, ptr %6, align 4, !tbaa !9
  %143 = icmp ne i32 %142, 0
  br i1 %143, label %144, label %147

144:                                              ; preds = %138
  %145 = load ptr, ptr %4, align 8, !tbaa !5
  %146 = call i32 @ThreadPoolShutdown(ptr noundef %145)
  br label %147

147:                                              ; preds = %144, %138
  %148 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %148, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %149

149:                                              ; preds = %147, %66, %35, %11
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  %150 = load i32, ptr %3, align 4
  ret i32 %150
}

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

; Function Attrs: nounwind
declare i32 @pthread_mutex_init(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind
declare i32 @pthread_mutex_lock(ptr noundef) #2

; Function Attrs: nounwind
declare i32 @pthread_cond_init(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind
declare i32 @pthread_mutex_unlock(ptr noundef) #2

; Function Attrs: nounwind
declare i32 @pthread_mutex_destroy(ptr noundef) #2

; Function Attrs: nounwind
declare i32 @pthread_cond_destroy(ptr noundef) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: nounwind uwtable
declare dso_local i32 @TPAttrInit(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i32 @SetPolicyType(i32 noundef) #0

declare i32 @FreeListInit(ptr noundef, i64 noundef, i32 noundef) #4

; Function Attrs: nounwind uwtable
declare hidden void @StatsInit(ptr noundef) #0

declare i32 @ListInit(ptr noundef, ptr noundef, ptr noundef) #4

; Function Attrs: nounwind uwtable
declare hidden i32 @CmpThreadPoolJob(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i32 @CreateWorker(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @ThreadPoolShutdown(ptr noundef) #0

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { "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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{i64 0, i64 4, !9, i64 4, i64 4, !9, i64 8, i64 8, !12, i64 16, i64 4, !9, i64 20, i64 4, !9, i64 24, i64 4, !9, i64 28, i64 4, !9, i64 32, i64 4, !9}
!12 = !{!13, !13, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!15, !10, i64 512}
!15 = !{!"THREADPOOL", !7, i64 0, !7, i64 40, !7, i64 88, !10, i64 136, !10, i64 140, !10, i64 144, !10, i64 148, !10, i64 152, !10, i64 156, !16, i64 160, !17, i64 184, !17, i64 280, !17, i64 376, !6, i64 472, !19, i64 480, !20, i64 520}
!16 = !{!"FREELIST", !6, i64 0, !13, i64 8, !10, i64 16, !10, i64 20}
!17 = !{!"LINKEDLIST", !18, i64 0, !18, i64 24, !13, i64 48, !16, i64 56, !6, i64 80, !6, i64 88}
!18 = !{!"LISTNODE", !6, i64 0, !6, i64 8, !6, i64 16}
!19 = !{!"THREADPOOLATTR", !10, i64 0, !10, i64 4, !13, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32}
!20 = !{!"TPOOLSTATS", !21, i64 0, !10, i64 8, !21, i64 16, !21, i64 24, !10, i64 32, !21, i64 40, !21, i64 48, !10, i64 56, !21, i64 64, !21, i64 72, !21, i64 80, !10, i64 88, !10, i64 92, !10, i64 96, !10, i64 100, !10, i64 104, !10, i64 108, !10, i64 112, !10, i64 116}
!21 = !{!"double", !7, i64 0}
!22 = !{!15, !6, i64 472}
!23 = !{!15, !10, i64 136}
!24 = !{!15, !10, i64 140}
!25 = !{!15, !10, i64 144}
!26 = !{!15, !10, i64 152}
!27 = !{!15, !10, i64 156}
!28 = !{!15, !10, i64 148}
!29 = !{!15, !10, i64 480}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}


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

; Function Attrs: nounwind uwtable
define dso_local i32 @ThreadPoolInit(ptr noundef %0, ptr noundef readonly %1) local_unnamed_addr #0 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %59, label %3

3:                                                ; preds = %2
  %4 = tail call i32 @pthread_mutex_init(ptr noundef nonnull %0, ptr noundef null) #5
  %5 = tail call i32 @pthread_mutex_lock(ptr noundef nonnull %0) #5
  %6 = add nsw i32 %5, %4
  %7 = getelementptr inbounds i8, ptr %0, i64 40
  %8 = tail call i32 @pthread_cond_init(ptr noundef nonnull %7, ptr noundef null) #5
  %9 = add nsw i32 %6, %8
  %10 = getelementptr inbounds i8, ptr %0, i64 88
  %11 = tail call i32 @pthread_cond_init(ptr noundef nonnull %10, ptr noundef null) #5
  %12 = sub i32 0, %11
  %.not57 = icmp eq i32 %9, %12
  br i1 %.not57, label %18, label %13

13:                                               ; preds = %3
  %14 = tail call i32 @pthread_mutex_unlock(ptr noundef nonnull %0) #5
  %15 = tail call i32 @pthread_mutex_destroy(ptr noundef nonnull %0) #5
  %16 = tail call i32 @pthread_cond_destroy(ptr noundef nonnull %7) #5
  %17 = tail call i32 @pthread_cond_destroy(ptr noundef nonnull %10) #5
  br label %59

18:                                               ; preds = %3
  %.not58 = icmp eq ptr %1, null
  %19 = getelementptr inbounds i8, ptr %0, i64 480
  br i1 %.not58, label %21, label %20

20:                                               ; preds = %18
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %19, ptr noundef nonnull align 8 dereferenceable(40) %1, i64 40, i1 false), !tbaa.struct !5
  br label %23

21:                                               ; preds = %18
  %22 = tail call i32 @TPAttrInit(ptr noundef nonnull %19)
  br label %23

23:                                               ; preds = %21, %20
  %24 = getelementptr inbounds i8, ptr %0, i64 480
  %25 = getelementptr inbounds i8, ptr %0, i64 512
  %26 = load i32, ptr %25, align 8, !tbaa !12
  %27 = tail call i32 @SetPolicyType(i32 noundef %26)
  %.not59 = icmp eq i32 %27, 0
  br i1 %.not59, label %33, label %28

28:                                               ; preds = %23
  %29 = tail call i32 @pthread_mutex_unlock(ptr noundef nonnull %0) #5
  %30 = tail call i32 @pthread_mutex_destroy(ptr noundef nonnull %0) #5
  %31 = tail call i32 @pthread_cond_destroy(ptr noundef nonnull %7) #5
  %32 = tail call i32 @pthread_cond_destroy(ptr noundef nonnull %10) #5
  br label %59

33:                                               ; preds = %23
  %34 = getelementptr inbounds i8, ptr %0, i64 160
  %35 = tail call i32 @FreeListInit(ptr noundef nonnull %34, i64 noundef 48, i32 noundef 100) #5
  %36 = getelementptr inbounds i8, ptr %0, i64 520
  tail call void @StatsInit(ptr noundef nonnull %36)
  %37 = getelementptr inbounds i8, ptr %0, i64 376
  %38 = tail call i32 @ListInit(ptr noundef nonnull %37, ptr noundef nonnull @CmpThreadPoolJob, ptr noundef null) #5
  %39 = add nsw i32 %38, %35
  %40 = getelementptr inbounds i8, ptr %0, i64 280
  %41 = tail call i32 @ListInit(ptr noundef nonnull %40, ptr noundef nonnull @CmpThreadPoolJob, ptr noundef null) #5
  %42 = add nsw i32 %39, %41
  %43 = getelementptr inbounds i8, ptr %0, i64 184
  %44 = tail call i32 @ListInit(ptr noundef nonnull %43, ptr noundef nonnull @CmpThreadPoolJob, ptr noundef null) #5
  %45 = sub i32 0, %44
  %.not60 = icmp eq i32 %42, %45
  br i1 %.not60, label %46, label %.loopexit

46:                                               ; preds = %33
  %47 = getelementptr inbounds i8, ptr %0, i64 472
  store ptr null, ptr %47, align 8, !tbaa !21
  %48 = getelementptr inbounds i8, ptr %0, i64 136
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %48, i8 0, i64 24, i1 false)
  %49 = load i32, ptr %24, align 8, !tbaa !22
  %50 = icmp sgt i32 %49, 0
  br i1 %50, label %.lr.ph, label %._crit_edge

51:                                               ; preds = %.lr.ph
  %52 = add nuw nsw i32 %.066, 1
  %53 = load i32, ptr %24, align 8, !tbaa !22
  %54 = icmp slt i32 %52, %53
  br i1 %54, label %.lr.ph, label %._crit_edge, !llvm.loop !23

.lr.ph:                                           ; preds = %46, %51
  %.066 = phi i32 [ %52, %51 ], [ 0, %46 ]
  %55 = tail call i32 @CreateWorker(ptr noundef nonnull %0)
  %.not61 = icmp eq i32 %55, 0
  br i1 %.not61, label %51, label %.loopexit

._crit_edge:                                      ; preds = %51, %46
  %56 = tail call i32 @pthread_mutex_unlock(ptr noundef nonnull %0) #5
  br label %59

.loopexit:                                        ; preds = %.lr.ph, %33
  %.1.ph = phi i32 [ 11, %33 ], [ %55, %.lr.ph ]
  %57 = tail call i32 @pthread_mutex_unlock(ptr noundef nonnull %0) #5
  %58 = tail call i32 @ThreadPoolShutdown(ptr noundef nonnull %0)
  br label %59

59:                                               ; preds = %._crit_edge, %.loopexit, %2, %28, %13
  %.050 = phi i32 [ 11, %13 ], [ 536870912, %28 ], [ 22, %2 ], [ %.1.ph, %.loopexit ], [ 0, %._crit_edge ]
  ret i32 %.050
}

; Function Attrs: nounwind
declare i32 @pthread_mutex_init(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind
declare i32 @pthread_mutex_lock(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind
declare i32 @pthread_cond_init(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind
declare i32 @pthread_mutex_unlock(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind
declare i32 @pthread_mutex_destroy(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind
declare i32 @pthread_cond_destroy(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @TPAttrInit(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @SetPolicyType(i32 noundef) local_unnamed_addr #0

declare i32 @FreeListInit(ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden void @StatsInit(ptr noundef) local_unnamed_addr #0

declare i32 @ListInit(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden i32 @CmpThreadPoolJob(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i32 @CreateWorker(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @ThreadPoolShutdown(ptr noundef) local_unnamed_addr #0

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{i64 0, i64 4, !6, i64 4, i64 4, !6, i64 8, i64 8, !10, i64 16, i64 4, !6, i64 20, i64 4, !6, i64 24, i64 4, !6, i64 28, i64 4, !6, i64 32, i64 4, !6}
!6 = !{!7, !7, i64 0}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!13, !7, i64 512}
!13 = !{!"THREADPOOL", !8, i64 0, !8, i64 40, !8, i64 88, !7, i64 136, !7, i64 140, !7, i64 144, !7, i64 148, !7, i64 152, !7, i64 156, !14, i64 160, !16, i64 184, !16, i64 280, !16, i64 376, !15, i64 472, !18, i64 480, !19, i64 520}
!14 = !{!"FREELIST", !15, i64 0, !11, i64 8, !7, i64 16, !7, i64 20}
!15 = !{!"any pointer", !8, i64 0}
!16 = !{!"LINKEDLIST", !17, i64 0, !17, i64 24, !11, i64 48, !14, i64 56, !15, i64 80, !15, i64 88}
!17 = !{!"LISTNODE", !15, i64 0, !15, i64 8, !15, i64 16}
!18 = !{!"THREADPOOLATTR", !7, i64 0, !7, i64 4, !11, i64 8, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32}
!19 = !{!"TPOOLSTATS", !20, i64 0, !7, i64 8, !20, i64 16, !20, i64 24, !7, i64 32, !20, i64 40, !20, i64 48, !7, i64 56, !20, i64 64, !20, i64 72, !20, i64 80, !7, i64 88, !7, i64 92, !7, i64 96, !7, i64 100, !7, i64 104, !7, i64 108, !7, i64 112, !7, i64 116}
!20 = !{!"double", !8, i64 0}
!21 = !{!13, !15, i64 472}
!22 = !{!13, !7, i64 480}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass