; LLVM IR from jingweizhanghuai/Morn :: src/ptc (morn_thread_pool)

; 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.ThreadPoolData = type { i64, %struct.MThreadSignal, ptr, ptr, ptr, ptr, i32 }
%struct.MThreadSignal = type { %union.pthread_mutex_t, %union.pthread_cond_t, %union.pthread_rwlock_t, i32 }
%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 }
%union.pthread_rwlock_t = type { %struct.__pthread_rwlock_arch_t }
%struct.__pthread_rwlock_arch_t = type { i32, i32, i32, i32, i32, i32, i32, i32, i8, [7 x i8], i64, i32 }
%struct.HandleThreadPool = type { ptr, i32, ptr, i32, i32, i32, i32, i32, %struct.MThreadSignal, ptr }
%struct.MList = type { i32, ptr }
%struct.ThreadBuffData = type { ptr, ptr, ptr, i32 }

@ThreadFunc.Sgn_valid = external hidden global i32, align 4
@ThreadFunc.Sgn_valid.1 = external hidden global i32, align 4

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @ThreadFunc(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.ThreadPoolData, ptr %6, i32 0, i32 2
  %8 = load ptr, ptr %7, align 8, !tbaa !9
  store ptr %8, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.HandleThreadPool, ptr %9, i32 0, i32 2
  %11 = load ptr, ptr %10, align 8, !tbaa !14
  store ptr %11, ptr %4, align 8, !tbaa !5
  br label %12

12:                                               ; preds = %157, %1
  br label %13

13:                                               ; preds = %12
  br label %14

14:                                               ; preds = %13
  br label %15

15:                                               ; preds = %14
  br label %16

16:                                               ; preds = %15
  %17 = load i32, ptr @ThreadFunc.Sgn_valid, align 4, !tbaa !16
  %18 = icmp eq i32 %17, 0
  br i1 %18, label %19, label %35

19:                                               ; preds = %16
  %20 = load ptr, ptr %2, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.ThreadPoolData, ptr %20, i32 0, i32 1
  %22 = getelementptr inbounds %struct.MThreadSignal, ptr %21, i32 0, i32 3
  %23 = atomicrmw xchg ptr %22, i32 -1135873169 seq_cst, align 8
  %24 = icmp ne i32 %23, -1135873169
  br i1 %24, label %25, label %34

25:                                               ; preds = %19
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.ThreadPoolData, ptr %26, i32 0, i32 1
  %28 = getelementptr inbounds %struct.MThreadSignal, ptr %27, i32 0, i32 0
  %29 = call i32 @pthread_mutex_init(ptr noundef %28, ptr noundef null) #4
  %30 = load ptr, ptr %2, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.ThreadPoolData, ptr %30, i32 0, i32 1
  %32 = getelementptr inbounds %struct.MThreadSignal, ptr %31, i32 0, i32 2
  %33 = call i32 @pthread_rwlock_init(ptr noundef %32, ptr noundef null) #4
  br label %34

34:                                               ; preds = %25, %19
  store i32 1, ptr @ThreadFunc.Sgn_valid, align 4, !tbaa !16
  br label %35

35:                                               ; preds = %34, %16
  br label %36

36:                                               ; preds = %35
  br label %37

37:                                               ; preds = %36
  %38 = load ptr, ptr %2, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.ThreadPoolData, ptr %38, i32 0, i32 1
  %40 = getelementptr inbounds %struct.MThreadSignal, ptr %39, i32 0, i32 0
  %41 = call i32 @pthread_mutex_lock(ptr noundef %40) #4
  br label %42

42:                                               ; preds = %37
  br label %43

43:                                               ; preds = %42
  br label %44

44:                                               ; preds = %50, %43
  %45 = load ptr, ptr %2, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.ThreadPoolData, ptr %45, i32 0, i32 6
  %47 = load volatile i32, ptr %46, align 8, !tbaa !17
  %48 = icmp eq i32 %47, 1
  %49 = xor i1 %48, true
  br i1 %49, label %50, label %58

50:                                               ; preds = %44
  %51 = load ptr, ptr %2, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.ThreadPoolData, ptr %51, i32 0, i32 1
  %53 = getelementptr inbounds %struct.MThreadSignal, ptr %52, i32 0, i32 1
  %54 = load ptr, ptr %2, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.ThreadPoolData, ptr %54, i32 0, i32 1
  %56 = getelementptr inbounds %struct.MThreadSignal, ptr %55, i32 0, i32 0
  %57 = call i32 @pthread_cond_wait(ptr noundef %53, ptr noundef %56)
  br label %44, !llvm.loop !18

58:                                               ; preds = %44
  %59 = load ptr, ptr %2, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.ThreadPoolData, ptr %59, i32 0, i32 1
  %61 = getelementptr inbounds %struct.MThreadSignal, ptr %60, i32 0, i32 0
  %62 = call i32 @pthread_mutex_unlock(ptr noundef %61) #4
  br label %63

63:                                               ; preds = %58
  br label %64

64:                                               ; preds = %63
  %65 = load ptr, ptr %2, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.ThreadPoolData, ptr %65, i32 0, i32 3
  %67 = load ptr, ptr %66, align 8, !tbaa !20
  %68 = icmp eq ptr %67, null
  br i1 %68, label %69, label %70

69:                                               ; preds = %64
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  ret void

70:                                               ; preds = %64
  %71 = load ptr, ptr %2, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.ThreadPoolData, ptr %71, i32 0, i32 3
  %73 = load ptr, ptr %72, align 8, !tbaa !20
  %74 = load ptr, ptr %2, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.ThreadPoolData, ptr %74, i32 0, i32 4
  %76 = load ptr, ptr %75, align 8, !tbaa !21
  %77 = load ptr, ptr %76, align 8, !tbaa !5
  call void %73(ptr noundef %77)
  %78 = load ptr, ptr %2, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.ThreadPoolData, ptr %78, i32 0, i32 5
  %80 = load ptr, ptr %79, align 8, !tbaa !22
  %81 = icmp ne ptr %80, null
  br i1 %81, label %82, label %86

82:                                               ; preds = %70
  %83 = load ptr, ptr %2, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.ThreadPoolData, ptr %83, i32 0, i32 5
  %85 = load ptr, ptr %84, align 8, !tbaa !22
  store i32 1, ptr %85, align 4, !tbaa !16
  br label %86

86:                                               ; preds = %82, %70
  %87 = load ptr, ptr %2, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.ThreadPoolData, ptr %87, i32 0, i32 4
  %89 = load ptr, ptr %88, align 8, !tbaa !21
  call void @m_Free(ptr noundef %89)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  br label %90

90:                                               ; preds = %86
  br label %91

91:                                               ; preds = %90
  %92 = load i32, ptr @ThreadFunc.Sgn_valid.1, align 4, !tbaa !16
  %93 = icmp eq i32 %92, 0
  br i1 %93, label %94, label %110

94:                                               ; preds = %91
  %95 = load ptr, ptr %3, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.HandleThreadPool, ptr %95, i32 0, i32 8
  %97 = getelementptr inbounds %struct.MThreadSignal, ptr %96, i32 0, i32 3
  %98 = atomicrmw xchg ptr %97, i32 -1135873169 seq_cst, align 8
  %99 = icmp ne i32 %98, -1135873169
  br i1 %99, label %100, label %109

100:                                              ; preds = %94
  %101 = load ptr, ptr %3, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.HandleThreadPool, ptr %101, i32 0, i32 8
  %103 = getelementptr inbounds %struct.MThreadSignal, ptr %102, i32 0, i32 0
  %104 = call i32 @pthread_mutex_init(ptr noundef %103, ptr noundef null) #4
  %105 = load ptr, ptr %3, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.HandleThreadPool, ptr %105, i32 0, i32 8
  %107 = getelementptr inbounds %struct.MThreadSignal, ptr %106, i32 0, i32 2
  %108 = call i32 @pthread_rwlock_init(ptr noundef %107, ptr noundef null) #4
  br label %109

109:                                              ; preds = %100, %94
  store i32 1, ptr @ThreadFunc.Sgn_valid.1, align 4, !tbaa !16
  br label %110

110:                                              ; preds = %109, %91
  br label %111

111:                                              ; preds = %110
  br label %112

112:                                              ; preds = %111
  %113 = load ptr, ptr %3, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.HandleThreadPool, ptr %113, i32 0, i32 8
  %115 = getelementptr inbounds %struct.MThreadSignal, ptr %114, i32 0, i32 0
  %116 = call i32 @pthread_mutex_lock(ptr noundef %115) #4
  br label %117

117:                                              ; preds = %112
  br label %118

118:                                              ; preds = %117
  %119 = load ptr, ptr %4, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.MList, ptr %119, i32 0, i32 0
  %121 = load i32, ptr %120, align 8, !tbaa !23
  %122 = icmp sgt i32 %121, 0
  br i1 %122, label %123, label %154

123:                                              ; preds = %118
  %124 = load ptr, ptr %4, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.MList, ptr %124, i32 0, i32 0
  %126 = load i32, ptr %125, align 8, !tbaa !23
  %127 = sub nsw i32 %126, 1
  %128 = load ptr, ptr %4, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.MList, ptr %128, i32 0, i32 0
  store i32 %127, ptr %129, align 8, !tbaa !23
  %130 = load ptr, ptr %4, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.MList, ptr %130, i32 0, i32 1
  %132 = load ptr, ptr %131, align 8, !tbaa !25
  %133 = load ptr, ptr %4, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.MList, ptr %133, i32 0, i32 0
  %135 = load i32, ptr %134, align 8, !tbaa !23
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds ptr, ptr %132, i64 %136
  %138 = load ptr, ptr %137, align 8, !tbaa !5
  store ptr %138, ptr %5, align 8, !tbaa !5
  %139 = load ptr, ptr %5, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.ThreadBuffData, ptr %139, i32 0, i32 0
  %141 = load ptr, ptr %140, align 8, !tbaa !26
  %142 = load ptr, ptr %2, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.ThreadPoolData, ptr %142, i32 0, i32 3
  store ptr %141, ptr %143, align 8, !tbaa !20
  %144 = load ptr, ptr %5, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.ThreadBuffData, ptr %144, i32 0, i32 1
  %146 = load ptr, ptr %145, align 8, !tbaa !28
  %147 = load ptr, ptr %2, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.ThreadPoolData, ptr %147, i32 0, i32 4
  store ptr %146, ptr %148, align 8, !tbaa !21
  %149 = load ptr, ptr %5, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.ThreadBuffData, ptr %149, i32 0, i32 2
  %151 = load ptr, ptr %150, align 8, !tbaa !29
  %152 = load ptr, ptr %2, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.ThreadPoolData, ptr %152, i32 0, i32 5
  store ptr %151, ptr %153, align 8, !tbaa !22
  br label %157

154:                                              ; preds = %118
  %155 = load ptr, ptr %2, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.ThreadPoolData, ptr %155, i32 0, i32 6
  store volatile i32 0, ptr %156, align 8, !tbaa !17
  br label %157

157:                                              ; preds = %154, %123
  %158 = load ptr, ptr %3, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.HandleThreadPool, ptr %158, i32 0, i32 8
  %160 = getelementptr inbounds %struct.MThreadSignal, ptr %159, i32 0, i32 0
  %161 = call i32 @pthread_mutex_unlock(ptr noundef %160) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  br label %12
}

declare i32 @pthread_cond_wait(ptr noundef, ptr noundef) #3

declare void @m_Free(ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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 = { 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, !6, i64 160}
!10 = !{!"ThreadPoolData", !11, i64 0, !12, i64 8, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !13, i64 192}
!11 = !{!"long", !7, i64 0}
!12 = !{!"MThreadSignal", !7, i64 0, !7, i64 40, !7, i64 88, !13, i64 144}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !6, i64 16}
!15 = !{!"HandleThreadPool", !6, i64 0, !13, i64 8, !6, i64 16, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 40, !12, i64 48, !6, i64 200}
!16 = !{!13, !13, i64 0}
!17 = !{!10, !13, i64 192}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!10, !6, i64 168}
!21 = !{!10, !6, i64 176}
!22 = !{!10, !6, i64 184}
!23 = !{!24, !13, i64 0}
!24 = !{!"MList", !13, i64 0, !6, i64 8}
!25 = !{!24, !6, i64 8}
!26 = !{!27, !6, i64 0}
!27 = !{!"ThreadBuffData", !6, i64 0, !6, i64 8, !6, i64 16, !13, i64 24}
!28 = !{!27, !6, i64 8}
!29 = !{!27, !6, i64 16}


; 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"

@ThreadFunc.Sgn_valid = external hidden local_unnamed_addr global i32, align 4
@ThreadFunc.Sgn_valid.1 = external hidden local_unnamed_addr global i32, align 4

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

; Function Attrs: nounwind
declare i32 @pthread_rwlock_init(ptr noundef, ptr noundef) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
define dso_local void @ThreadFunc(ptr noundef %0) local_unnamed_addr #1 {
  %2 = getelementptr inbounds i8, ptr %0, i64 160
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %3, i64 16
  %5 = load ptr, ptr %4, align 8, !tbaa !13
  %6 = getelementptr inbounds i8, ptr %0, i64 152
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  %8 = getelementptr inbounds i8, ptr %0, i64 96
  %9 = getelementptr inbounds i8, ptr %0, i64 192
  %10 = getelementptr inbounds i8, ptr %0, i64 48
  %11 = getelementptr inbounds i8, ptr %0, i64 168
  %12 = getelementptr inbounds i8, ptr %0, i64 176
  %13 = getelementptr inbounds i8, ptr %0, i64 184
  %14 = getelementptr inbounds i8, ptr %3, i64 192
  %15 = getelementptr inbounds i8, ptr %3, i64 48
  %16 = getelementptr inbounds i8, ptr %3, i64 136
  %17 = getelementptr inbounds i8, ptr %5, i64 8
  br label %18

18:                                               ; preds = %65, %1
  %19 = load i32, ptr @ThreadFunc.Sgn_valid, align 4, !tbaa !15
  %20 = icmp eq i32 %19, 0
  br i1 %20, label %21, label %27

21:                                               ; preds = %18
  %22 = atomicrmw xchg ptr %6, i32 -1135873169 seq_cst, align 8
  %.not = icmp eq i32 %22, -1135873169
  br i1 %.not, label %26, label %23

23:                                               ; preds = %21
  %24 = tail call i32 @pthread_mutex_init(ptr noundef nonnull %7, ptr noundef null) #3
  %25 = tail call i32 @pthread_rwlock_init(ptr noundef nonnull %8, ptr noundef null) #3
  br label %26

26:                                               ; preds = %23, %21
  store i32 1, ptr @ThreadFunc.Sgn_valid, align 4, !tbaa !15
  br label %27

27:                                               ; preds = %26, %18
  %28 = tail call i32 @pthread_mutex_lock(ptr noundef nonnull %7) #3
  %29 = load volatile i32, ptr %9, align 8, !tbaa !16
  %.not3538 = icmp eq i32 %29, 1
  br i1 %.not3538, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %27, %.lr.ph
  %30 = tail call i32 @pthread_cond_wait(ptr noundef nonnull %10, ptr noundef nonnull %7) #3
  %31 = load volatile i32, ptr %9, align 8, !tbaa !16
  %.not35 = icmp eq i32 %31, 1
  br i1 %.not35, label %._crit_edge, label %.lr.ph, !llvm.loop !17

._crit_edge:                                      ; preds = %.lr.ph, %27
  %32 = tail call i32 @pthread_mutex_unlock(ptr noundef nonnull %7) #3
  %33 = load ptr, ptr %11, align 8, !tbaa !19
  %34 = icmp eq ptr %33, null
  br i1 %34, label %35, label %36

35:                                               ; preds = %._crit_edge
  ret void

36:                                               ; preds = %._crit_edge
  %37 = load ptr, ptr %12, align 8, !tbaa !20
  %38 = load ptr, ptr %37, align 8, !tbaa !21
  tail call void %33(ptr noundef %38) #3
  %39 = load ptr, ptr %13, align 8, !tbaa !22
  %.not36 = icmp eq ptr %39, null
  br i1 %.not36, label %41, label %40

40:                                               ; preds = %36
  store i32 1, ptr %39, align 4, !tbaa !15
  br label %41

41:                                               ; preds = %40, %36
  %42 = load ptr, ptr %12, align 8, !tbaa !20
  tail call void @m_Free(ptr noundef %42) #3
  %43 = load i32, ptr @ThreadFunc.Sgn_valid.1, align 4, !tbaa !15
  %44 = icmp eq i32 %43, 0
  br i1 %44, label %45, label %51

45:                                               ; preds = %41
  %46 = atomicrmw xchg ptr %14, i32 -1135873169 seq_cst, align 8
  %.not37 = icmp eq i32 %46, -1135873169
  br i1 %.not37, label %50, label %47

47:                                               ; preds = %45
  %48 = tail call i32 @pthread_mutex_init(ptr noundef nonnull %15, ptr noundef null) #3
  %49 = tail call i32 @pthread_rwlock_init(ptr noundef nonnull %16, ptr noundef null) #3
  br label %50

50:                                               ; preds = %47, %45
  store i32 1, ptr @ThreadFunc.Sgn_valid.1, align 4, !tbaa !15
  br label %51

51:                                               ; preds = %50, %41
  %52 = tail call i32 @pthread_mutex_lock(ptr noundef nonnull %15) #3
  %53 = load i32, ptr %5, align 8, !tbaa !23
  %54 = icmp sgt i32 %53, 0
  br i1 %54, label %55, label %64

55:                                               ; preds = %51
  %56 = add nsw i32 %53, -1
  store i32 %56, ptr %5, align 8, !tbaa !23
  %57 = load ptr, ptr %17, align 8, !tbaa !25
  %58 = zext nneg i32 %56 to i64
  %59 = getelementptr inbounds ptr, ptr %57, i64 %58
  %60 = load ptr, ptr %59, align 8, !tbaa !21
  %61 = load <2 x ptr>, ptr %60, align 8, !tbaa !21
  store <2 x ptr> %61, ptr %11, align 8, !tbaa !21
  %62 = getelementptr inbounds i8, ptr %60, i64 16
  %63 = load ptr, ptr %62, align 8, !tbaa !26
  store ptr %63, ptr %13, align 8, !tbaa !22
  br label %65

64:                                               ; preds = %51
  store volatile i32 0, ptr %9, align 8, !tbaa !16
  br label %65

65:                                               ; preds = %64, %55
  %66 = tail call i32 @pthread_mutex_unlock(ptr noundef nonnull %15) #3
  br label %18
}

declare i32 @pthread_cond_wait(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @m_Free(ptr noundef) local_unnamed_addr #2

attributes #0 = { 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 = { 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 = { "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 = { 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 160}
!6 = !{!"ThreadPoolData", !7, i64 0, !10, i64 8, !12, i64 160, !12, i64 168, !12, i64 176, !12, i64 184, !11, i64 192}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"MThreadSignal", !8, i64 0, !8, i64 40, !8, i64 88, !11, i64 144}
!11 = !{!"int", !8, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!14, !12, i64 16}
!14 = !{!"HandleThreadPool", !12, i64 0, !11, i64 8, !12, i64 16, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !10, i64 48, !12, i64 200}
!15 = !{!11, !11, i64 0}
!16 = !{!6, !11, i64 192}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!6, !12, i64 168}
!20 = !{!6, !12, i64 176}
!21 = !{!12, !12, i64 0}
!22 = !{!6, !12, i64 184}
!23 = !{!24, !11, i64 0}
!24 = !{!"MList", !11, i64 0, !12, i64 8}
!25 = !{!24, !12, i64 8}
!26 = !{!27, !12, i64 16}
!27 = !{!"ThreadBuffData", !12, i64 0, !12, i64 8, !12, i64 16, !11, i64 24}


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