; LLVM IR from mkazhdan/DMG :: Util/BaseMultiStreamIO.ll (ZN19MultiStreamIOServer9_IOThreadEPv)

; 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.MultiStreamIOServer = type <{ ptr, ptr, %"class.std::vector", %"class.boost::recursive_timed_mutex", %"class.boost::recursive_timed_mutex", ptr, i8, [7 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<IOClient *, std::allocator<IOClient *>>::_Vector_impl" }
%"struct.std::_Vector_base<IOClient *, std::allocator<IOClient *>>::_Vector_impl" = type { %"struct.std::_Vector_base<IOClient *, std::allocator<IOClient *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<IOClient *, std::allocator<IOClient *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.boost::recursive_timed_mutex" = type <{ %union.pthread_mutex_t, %union.pthread_cond_t, i8, [7 x i8], i64, i32, [4 x i8] }>
%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 }

@_ZZN19MultiStreamIOServer9_IOThreadEPvE8threadID = external hidden global i32, align 4
@.str.15 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [48 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 uwtable
declare dso_local void @_ZN8IOClient9SetServerEP19MultiStreamIOServer(ptr noundef nonnull align 8 dereferenceable(128), ptr noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN19MultiStreamIOServer9_IOThreadEPv(ptr noundef %0) #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i8, align 1
  %8 = alloca i8, align 1
  %9 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  %10 = load i32, ptr @_ZZN19MultiStreamIOServer9_IOThreadEPvE8threadID, align 4, !tbaa !9
  %11 = add nsw i32 %10, 1
  store i32 %11, ptr @_ZZN19MultiStreamIOServer9_IOThreadEPvE8threadID, align 4, !tbaa !9
  store i32 %10, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %12, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %class.MultiStreamIOServer, ptr %13, i32 0, i32 2
  store ptr %14, 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
  br label %15

15:                                               ; preds = %108, %1
  br label %16

16:                                               ; preds = %15
  %17 = call noundef zeroext i1 @_ZN5boost11this_thread22interruption_requestedEv() #5
  br i1 %17, label %18, label %19

18:                                               ; preds = %16
  br label %109

19:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #5
  store i8 0, ptr %7, align 1, !tbaa !11
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %class.MultiStreamIOServer, ptr %20, i32 0, i32 3
  call void @_Z20EnterCriticalSectionPN5boost21recursive_timed_mutexExPKc(ptr noundef %21, i64 noundef 100, ptr noundef @.str.15)
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %class.MultiStreamIOServer, ptr %22, i32 0, i32 5
  %24 = load ptr, ptr %23, align 8, !tbaa !13
  %25 = icmp ne ptr %24, null
  br i1 %25, label %26, label %40

26:                                               ; preds = %19
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %class.MultiStreamIOServer, ptr %27, i32 0, i32 5
  %29 = load ptr, ptr %28, align 8, !tbaa !13
  %30 = load ptr, ptr %29, align 8, !tbaa !21
  %31 = getelementptr inbounds ptr, ptr %30, i64 0
  %32 = load ptr, ptr %31, align 8
  %33 = call noundef i32 %32(ptr noundef nonnull align 8 dereferenceable(128) %29)
  %34 = icmp eq i32 %33, 0
  br i1 %34, label %35, label %36

35:                                               ; preds = %26
  call void @_Z15SleepThisThreadi(i32 noundef 0)
  br label %39

36:                                               ; preds = %26
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %class.MultiStreamIOServer, ptr %37, i32 0, i32 5
  store ptr null, ptr %38, align 8, !tbaa !13
  br label %39

39:                                               ; preds = %36, %35
  store i8 1, ptr %7, align 1, !tbaa !11
  br label %40

40:                                               ; preds = %39, %19
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds %class.MultiStreamIOServer, ptr %41, i32 0, i32 3
  call void @_Z20LeaveCriticalSectionPN5boost21recursive_timed_mutexE(ptr noundef %42)
  %43 = load i8, ptr %7, align 1, !tbaa !11, !range !23, !noundef !24
  %44 = trunc i8 %43 to i1
  br i1 %44, label %108, label %45

45:                                               ; preds = %40
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds %class.MultiStreamIOServer, ptr %46, i32 0, i32 4
  call void @_Z20EnterCriticalSectionPN5boost21recursive_timed_mutexExPKc(ptr noundef %47, i64 noundef 100, ptr noundef @.str.16)
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #5
  store i8 0, ptr %8, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %48

48:                                               ; preds = %97, %45
  %49 = load i32, ptr %9, align 4, !tbaa !9
  %50 = sext i32 %49 to i64
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = call noundef i64 @_ZNKSt6vectorIP8IOClientSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %51) #5
  %53 = icmp ult i64 %50, %52
  br i1 %53, label %54, label %58

54:                                               ; preds = %48
  %55 = load i8, ptr %8, align 1, !tbaa !11, !range !23, !noundef !24
  %56 = trunc i8 %55 to i1
  %57 = xor i1 %56, true
  br label %58

58:                                               ; preds = %54, %48
  %59 = phi i1 [ false, %48 ], [ %57, %54 ]
  br i1 %59, label %61, label %60

60:                                               ; preds = %58
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %100

61:                                               ; preds = %58
  %62 = load i32, ptr %6, align 4, !tbaa !9
  %63 = add nsw i32 %62, 1
  %64 = sext i32 %63 to i64
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = call noundef i64 @_ZNKSt6vectorIP8IOClientSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %65) #5
  %67 = urem i64 %64, %66
  %68 = trunc i64 %67 to i32
  store i32 %68, ptr %6, align 4, !tbaa !9
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = load i32, ptr %6, align 4, !tbaa !9
  %71 = sext i32 %70 to i64
  %72 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP8IOClientSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %69, i64 noundef %71) #5
  %73 = load ptr, ptr %72, align 8, !tbaa !5
  %74 = load ptr, ptr %73, align 8, !tbaa !21
  %75 = getelementptr inbounds ptr, ptr %74, i64 0
  %76 = load ptr, ptr %75, align 8
  %77 = call noundef i32 %76(ptr noundef nonnull align 8 dereferenceable(128) %73)
  switch i32 %77, label %96 [
    i32 2, label %78
    i32 1, label %95
  ]

78:                                               ; preds = %61
  %79 = load ptr, ptr %5, align 8, !tbaa !5
  %80 = load i32, ptr %6, align 4, !tbaa !9
  %81 = sext i32 %80 to i64
  %82 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP8IOClientSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %79, i64 noundef %81) #5
  %83 = load ptr, ptr %82, align 8, !tbaa !5
  call void @_ZN8IOClient9SetServerEP19MultiStreamIOServer(ptr noundef nonnull align 8 dereferenceable(128) %83, ptr noundef null)
  %84 = load ptr, ptr %5, align 8, !tbaa !5
  %85 = load ptr, ptr %5, align 8, !tbaa !5
  %86 = call noundef i64 @_ZNKSt6vectorIP8IOClientSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %85) #5
  %87 = sub i64 %86, 1
  %88 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP8IOClientSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %84, i64 noundef %87) #5
  %89 = load ptr, ptr %88, align 8, !tbaa !5
  %90 = load ptr, ptr %5, align 8, !tbaa !5
  %91 = load i32, ptr %6, align 4, !tbaa !9
  %92 = sext i32 %91 to i64
  %93 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP8IOClientSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %90, i64 noundef %92) #5
  store ptr %89, ptr %93, align 8, !tbaa !5
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZNSt6vectorIP8IOClientSaIS1_EE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %94) #5
  br label %95

95:                                               ; preds = %78, %61
  store i8 1, ptr %8, align 1, !tbaa !11
  br label %96

96:                                               ; preds = %95, %61
  br label %97

97:                                               ; preds = %96
  %98 = load i32, ptr %9, align 4, !tbaa !9
  %99 = add nsw i32 %98, 1
  store i32 %99, ptr %9, align 4, !tbaa !9
  br label %48, !llvm.loop !25

100:                                              ; preds = %60
  %101 = load ptr, ptr %4, align 8, !tbaa !5
  %102 = getelementptr inbounds %class.MultiStreamIOServer, ptr %101, i32 0, i32 4
  call void @_Z20LeaveCriticalSectionPN5boost21recursive_timed_mutexE(ptr noundef %102)
  %103 = load i8, ptr %8, align 1, !tbaa !11, !range !23, !noundef !24
  %104 = trunc i8 %103 to i1
  br i1 %104, label %106, label %105

105:                                              ; preds = %100
  call void @_Z15SleepThisThreadi(i32 noundef 1)
  br label %107

106:                                              ; preds = %100
  call void @_Z15SleepThisThreadi(i32 noundef 0)
  br label %107

107:                                              ; preds = %106, %105
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #5
  br label %108

108:                                              ; preds = %107, %40
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #5
  br label %15, !llvm.loop !27

109:                                              ; preds = %18
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  ret i32 0
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z20EnterCriticalSectionPN5boost21recursive_timed_mutexExPKc(ptr noundef, i64 noundef, ptr noundef) #2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z20LeaveCriticalSectionPN5boost21recursive_timed_mutexE(ptr noundef) #2

; Function Attrs: nounwind
declare noundef zeroext i1 @_ZN5boost11this_thread22interruption_requestedEv() #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z15SleepThisThreadi(i32 noundef) #2

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 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 = !{!"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, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!14, !6, i64 264}
!14 = !{!"_ZTS19MultiStreamIOServer", !6, i64 8, !15, i64 16, !19, i64 40, !19, i64 152, !6, i64 264, !12, i64 272}
!15 = !{!"_ZTSSt6vectorIP8IOClientSaIS1_EE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIP8IOClientSaIS1_EE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIP8IOClientSaIS1_EE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIP8IOClientSaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!19 = !{!"_ZTSN5boost21recursive_timed_mutexE", !7, i64 0, !7, i64 40, !12, i64 88, !20, i64 96, !10, i64 104}
!20 = !{!"long", !7, i64 0}
!21 = !{!22, !22, i64 0}
!22 = !{!"vtable pointer", !8, i64 0}
!23 = !{i8 0, i8 2}
!24 = !{}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = distinct !{!27, !26}


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

@_ZZN19MultiStreamIOServer9_IOThreadEPvE8threadID = external hidden local_unnamed_addr global i32, align 4
@.str.15 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [48 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8IOClient9SetServerEP19MultiStreamIOServer(ptr noundef nonnull align 8 dereferenceable(128), ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN19MultiStreamIOServer9_IOThreadEPv(ptr noundef %0) local_unnamed_addr #0 align 2 {
  %2 = load i32, ptr @_ZZN19MultiStreamIOServer9_IOThreadEPvE8threadID, align 4, !tbaa !5
  %3 = add nsw i32 %2, 1
  store i32 %3, ptr @_ZZN19MultiStreamIOServer9_IOThreadEPvE8threadID, align 4, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 16
  %5 = tail call noundef zeroext i1 @_ZN5boost11this_thread22interruption_requestedEv() #4
  br i1 %5, label %._crit_edge38, label %.lr.ph37

.lr.ph37:                                         ; preds = %1
  %6 = getelementptr inbounds i8, ptr %0, i64 40
  %7 = getelementptr inbounds i8, ptr %0, i64 264
  %8 = getelementptr inbounds i8, ptr %0, i64 152
  br label %9

9:                                                ; preds = %.lr.ph37, %47
  %.02735 = phi i32 [ 0, %.lr.ph37 ], [ %.2, %47 ]
  tail call void @_Z20EnterCriticalSectionPN5boost21recursive_timed_mutexExPKc(ptr noundef nonnull %6, i64 noundef 100, ptr noundef nonnull @.str.15)
  %10 = load ptr, ptr %7, align 8, !tbaa !9
  %.not.not = icmp eq ptr %10, null
  br i1 %.not.not, label %19, label %11

11:                                               ; preds = %9
  %12 = load ptr, ptr %10, align 8, !tbaa !19
  %13 = load ptr, ptr %12, align 8
  %14 = tail call noundef i32 %13(ptr noundef nonnull align 8 dereferenceable(128) %10)
  %15 = icmp eq i32 %14, 0
  br i1 %15, label %16, label %17

16:                                               ; preds = %11
  tail call void @_Z15SleepThisThreadi(i32 noundef 0)
  br label %18

17:                                               ; preds = %11
  store ptr null, ptr %7, align 8, !tbaa !9
  br label %18

18:                                               ; preds = %16, %17
  tail call void @_Z20LeaveCriticalSectionPN5boost21recursive_timed_mutexE(ptr noundef nonnull %6)
  br label %47

19:                                               ; preds = %9
  tail call void @_Z20LeaveCriticalSectionPN5boost21recursive_timed_mutexE(ptr noundef nonnull %6)
  tail call void @_Z20EnterCriticalSectionPN5boost21recursive_timed_mutexExPKc(ptr noundef nonnull %8, i64 noundef 100, ptr noundef nonnull @.str.16)
  %20 = tail call noundef i64 @_ZNKSt6vectorIP8IOClientSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #4
  %21 = icmp eq i64 %20, 0
  br i1 %21, label %._crit_edge.thread, label %.lr.ph

._crit_edge.thread:                               ; preds = %19
  tail call void @_Z20LeaveCriticalSectionPN5boost21recursive_timed_mutexE(ptr noundef nonnull %8)
  br label %45

._crit_edge:                                      ; preds = %42
  tail call void @_Z20LeaveCriticalSectionPN5boost21recursive_timed_mutexE(ptr noundef nonnull %8)
  br i1 %.1, label %46, label %45

.lr.ph:                                           ; preds = %19, %42
  %indvars.iv = phi i64 [ %indvars.iv.next, %42 ], [ 0, %19 ]
  %.12831 = phi i32 [ %26, %42 ], [ %.02735, %19 ]
  %22 = add nsw i32 %.12831, 1
  %23 = sext i32 %22 to i64
  %24 = tail call noundef i64 @_ZNKSt6vectorIP8IOClientSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #4
  %25 = urem i64 %23, %24
  %26 = trunc i64 %25 to i32
  %sext = shl i64 %25, 32
  %27 = ashr exact i64 %sext, 32
  %28 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP8IOClientSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %27) #4
  %29 = load ptr, ptr %28, align 8, !tbaa !21
  %30 = load ptr, ptr %29, align 8, !tbaa !19
  %31 = load ptr, ptr %30, align 8
  %32 = tail call noundef i32 %31(ptr noundef nonnull align 8 dereferenceable(128) %29)
  switch i32 %32, label %42 [
    i32 2, label %33
    i32 1, label %41
  ]

33:                                               ; preds = %.lr.ph
  %34 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP8IOClientSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %27) #4
  %35 = load ptr, ptr %34, align 8, !tbaa !21
  tail call void @_ZN8IOClient9SetServerEP19MultiStreamIOServer(ptr noundef nonnull align 8 dereferenceable(128) %35, ptr noundef null)
  %36 = tail call noundef i64 @_ZNKSt6vectorIP8IOClientSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #4
  %37 = add i64 %36, -1
  %38 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP8IOClientSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %37) #4
  %39 = load ptr, ptr %38, align 8, !tbaa !21
  %40 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP8IOClientSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %27) #4
  store ptr %39, ptr %40, align 8, !tbaa !21
  tail call void @_ZNSt6vectorIP8IOClientSaIS1_EE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #4
  br label %41

41:                                               ; preds = %33, %.lr.ph
  br label %42

42:                                               ; preds = %.lr.ph, %41
  %.1 = phi i1 [ false, %.lr.ph ], [ true, %41 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %43 = tail call noundef i64 @_ZNKSt6vectorIP8IOClientSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #4
  %44 = icmp ule i64 %43, %indvars.iv.next
  %.not30 = or i1 %44, %.1
  br i1 %.not30, label %._crit_edge, label %.lr.ph, !llvm.loop !22

45:                                               ; preds = %._crit_edge.thread, %._crit_edge
  %.128.lcssa41 = phi i32 [ %.02735, %._crit_edge.thread ], [ %26, %._crit_edge ]
  tail call void @_Z15SleepThisThreadi(i32 noundef 1)
  br label %47

46:                                               ; preds = %._crit_edge
  tail call void @_Z15SleepThisThreadi(i32 noundef 0)
  br label %47

47:                                               ; preds = %18, %45, %46
  %.2 = phi i32 [ %.02735, %18 ], [ %26, %46 ], [ %.128.lcssa41, %45 ]
  %48 = tail call noundef zeroext i1 @_ZN5boost11this_thread22interruption_requestedEv() #4
  br i1 %48, label %._crit_edge38, label %9, !llvm.loop !24

._crit_edge38:                                    ; preds = %47, %1
  ret i32 0
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z20EnterCriticalSectionPN5boost21recursive_timed_mutexExPKc(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z20LeaveCriticalSectionPN5boost21recursive_timed_mutexE(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind
declare noundef zeroext i1 @_ZN5boost11this_thread22interruption_requestedEv() local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z15SleepThisThreadi(i32 noundef) local_unnamed_addr #1

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

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

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 = { 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 #2 = { 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 #3 = { 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 264}
!10 = !{!"_ZTS19MultiStreamIOServer", !11, i64 8, !12, i64 16, !16, i64 40, !16, i64 152, !11, i64 264, !17, i64 272}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"_ZTSSt6vectorIP8IOClientSaIS1_EE", !13, i64 0}
!13 = !{!"_ZTSSt12_Vector_baseIP8IOClientSaIS1_EE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIP8IOClientSaIS1_EE12_Vector_implE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIP8IOClientSaIS1_EE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!16 = !{!"_ZTSN5boost21recursive_timed_mutexE", !7, i64 0, !7, i64 40, !17, i64 88, !18, i64 96, !6, i64 104}
!17 = !{!"bool", !7, i64 0}
!18 = !{!"long", !7, i64 0}
!19 = !{!20, !20, i64 0}
!20 = !{!"vtable pointer", !8, i64 0}
!21 = !{!11, !11, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = distinct !{!24, !23}


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