; LLVM IR from turi-code/SFrame :: oss_src/fileio/oss_webstor/asyncurl.ll (ZN7webstor8internal9AsyncLoop6pendOpEPS1_Pvm)

; 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.webstor::internal::auto_scope.9" = type { ptr }
%"class.webstor::internal::AsyncLoop" = type <{ ptr, i8, [7 x i8], %"class.webstor::internal::TaskCtrl", i32, [4 x i8], %"class.webstor::internal::SocketPool", %"class.webstor::internal::ExLockSync", ptr, %"class.std::vector", %"class.std::vector", i64, i8, [7 x i8] }>
%"class.webstor::internal::TaskCtrl" = type { %"class.webstor::internal::auto_scope" }
%"class.webstor::internal::auto_scope" = type { i64 }
%"class.webstor::internal::SocketPool" = type { ptr, %"class.webstor::internal::EventSync" }
%"class.webstor::internal::EventSync" = type <{ %union.pthread_mutex_t, %"class.std::set", 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 }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<webstor::internal::EventWaiter *, webstor::internal::EventWaiter *, std::_Identity<webstor::internal::EventWaiter *>, std::less<webstor::internal::EventWaiter *>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<webstor::internal::EventWaiter *, webstor::internal::EventWaiter *, std::_Identity<webstor::internal::EventWaiter *>, std::less<webstor::internal::EventWaiter *>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.webstor::internal::ExLockSync" = type { %"union.webstor::internal::ExLockSync::Data" }
%"union.webstor::internal::ExLockSync::Data" = type { %union.pthread_mutex_t }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<void *, std::allocator<void *>>::_Vector_impl" }
%"struct.std::_Vector_base<void *, std::allocator<void *>>::_Vector_impl" = type { %"struct.std::_Vector_base<void *, std::allocator<void *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<void *, std::allocator<void *>>::_Vector_impl_data" = type { ptr, ptr, ptr }

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #1

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

declare void @_ZN7webstor8internal10ExLockSync9claimLockEv(ptr noundef nonnull align 8 dereferenceable(40)) #2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7webstor8internal9AsyncLoop6pendOpEPS1_Pvm(ptr noundef %0, ptr noundef %1, i64 noundef %2) #4 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca %"class.webstor::internal::auto_scope.9", align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i64 %2, ptr %6, align 8, !tbaa !9
  br label %19

19:                                               ; preds = %3
  br label %20

20:                                               ; preds = %19
  br label %21

21:                                               ; preds = %20
  br label %22

22:                                               ; preds = %21
  br label %23

23:                                               ; preds = %111, %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  store i64 0, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  store i64 0, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %24, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %25, ptr %10, align 8, !tbaa !5
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %"class.webstor::internal::AsyncLoop", ptr %26, i32 0, i32 8
  %28 = load volatile ptr, ptr %27, align 8, !tbaa !11
  %29 = icmp ne ptr %28, null
  br i1 %29, label %30, label %65

30:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  store i64 1, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %31 = load i64, ptr %6, align 8, !tbaa !9
  %32 = udiv i64 %31, 2
  store i64 %32, ptr %13, align 8, !tbaa !9
  %33 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(8) %13)
  %34 = load i64, ptr %33, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  store i64 %34, ptr %11, align 8, !tbaa !9
  store i64 -1, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %35, ptr %14, align 8, !tbaa !5
  br label %36

36:                                               ; preds = %55, %30
  %37 = load ptr, ptr %14, align 8, !tbaa !5
  %38 = icmp ne ptr %37, null
  br i1 %38, label %40, label %39

39:                                               ; preds = %36
  store i32 8, ptr %15, align 4
  br label %59

40:                                               ; preds = %36
  call void @_ZN7webstor8internal15cpuMemLoadFenceEv()
  %41 = load ptr, ptr %14, align 8, !tbaa !5
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = load i64, ptr %11, align 8, !tbaa !9
  %44 = call noundef zeroext i1 @_ZN7webstor8internal9AsyncLoop6pendOpEPvmPm(ptr noundef nonnull align 8 dereferenceable(241) %41, ptr noundef %42, i64 noundef %43, ptr noundef %7)
  br i1 %44, label %45, label %46

45:                                               ; preds = %40
  store i32 1, ptr %15, align 4
  br label %59

46:                                               ; preds = %40
  %47 = load i64, ptr %7, align 8, !tbaa !9
  %48 = load i64, ptr %8, align 8, !tbaa !9
  %49 = icmp ult i64 %47, %48
  br i1 %49, label %50, label %53

50:                                               ; preds = %46
  %51 = load i64, ptr %7, align 8, !tbaa !9
  store i64 %51, ptr %8, align 8, !tbaa !9
  %52 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %52, ptr %9, align 8, !tbaa !5
  br label %53

53:                                               ; preds = %50, %46
  %54 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %54, ptr %10, align 8, !tbaa !5
  br label %55

55:                                               ; preds = %53
  %56 = load ptr, ptr %14, align 8, !tbaa !5
  %57 = getelementptr inbounds %"class.webstor::internal::AsyncLoop", ptr %56, i32 0, i32 8
  %58 = load volatile ptr, ptr %57, align 8, !tbaa !11
  store ptr %58, ptr %14, align 8, !tbaa !5
  br label %36, !llvm.loop !32

59:                                               ; preds = %45, %39
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  %60 = load i32, ptr %15, align 4
  switch i32 %60, label %62 [
    i32 8, label %61
  ]

61:                                               ; preds = %59
  store i32 0, ptr %15, align 4
  br label %62

62:                                               ; preds = %61, %59
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  %63 = load i32, ptr %15, align 4
  switch i32 %63, label %109 [
    i32 0, label %64
  ]

64:                                               ; preds = %62
  br label %65

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

66:                                               ; preds = %65
  br label %67

67:                                               ; preds = %66
  br label %68

68:                                               ; preds = %67
  %69 = load i64, ptr %8, align 8, !tbaa !9
  %70 = load i64, ptr %6, align 8, !tbaa !9
  %71 = icmp ult i64 %69, %70
  br i1 %71, label %72, label %78

72:                                               ; preds = %68
  %73 = load ptr, ptr %9, align 8, !tbaa !5
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = load i64, ptr %6, align 8, !tbaa !9
  %76 = call noundef zeroext i1 @_ZN7webstor8internal9AsyncLoop6pendOpEPvmPm(ptr noundef nonnull align 8 dereferenceable(241) %73, ptr noundef %74, i64 noundef %75, ptr noundef %7)
  br i1 %76, label %77, label %78

77:                                               ; preds = %72
  store i32 1, ptr %15, align 4
  br label %109

78:                                               ; preds = %72, %68
  %79 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 248) #8
  invoke void @_ZN7webstor8internal9AsyncLoopC1Ev(ptr noundef nonnull align 8 dereferenceable(241) %79)
          to label %80 unwind label %95

80:                                               ; preds = %78
  store ptr %79, ptr %9, align 8, !tbaa !5
  %81 = load ptr, ptr %4, align 8, !tbaa !5
  %82 = getelementptr inbounds %"class.webstor::internal::AsyncLoop", ptr %81, i32 0, i32 7
  call void @_ZN7webstor8internal10ExLockSync9claimLockEv(ptr noundef nonnull align 8 dereferenceable(40) %82)
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  %84 = getelementptr inbounds %"class.webstor::internal::AsyncLoop", ptr %83, i32 0, i32 7
  call void @_ZN7webstor8internal10auto_scopeIPNS0_10ExLockSyncENS0_13ExLockDeleterELy0EEC2ES3_(ptr noundef nonnull align 8 dereferenceable(8) %18, ptr noundef %84)
  br label %85

85:                                               ; preds = %91, %80
  %86 = load ptr, ptr %10, align 8, !tbaa !5
  %87 = getelementptr inbounds %"class.webstor::internal::AsyncLoop", ptr %86, i32 0, i32 8
  %88 = load volatile ptr, ptr %87, align 8, !tbaa !11
  %89 = icmp ne ptr %88, null
  br i1 %89, label %90, label %99

90:                                               ; preds = %85
  br label %91

91:                                               ; preds = %90
  %92 = load ptr, ptr %10, align 8, !tbaa !5
  %93 = getelementptr inbounds %"class.webstor::internal::AsyncLoop", ptr %92, i32 0, i32 8
  %94 = load volatile ptr, ptr %93, align 8, !tbaa !11
  store ptr %94, ptr %10, align 8, !tbaa !5
  br label %85, !llvm.loop !34

95:                                               ; preds = %78
  %96 = landingpad { ptr, i32 }
          cleanup
  %97 = extractvalue { ptr, i32 } %96, 0
  store ptr %97, ptr %16, align 8
  %98 = extractvalue { ptr, i32 } %96, 1
  store i32 %98, ptr %17, align 4
  call void @_ZdlPvm(ptr noundef %79, i64 noundef 248) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  br label %113

99:                                               ; preds = %85
  %100 = load ptr, ptr %9, align 8, !tbaa !5
  %101 = load ptr, ptr %10, align 8, !tbaa !5
  %102 = getelementptr inbounds %"class.webstor::internal::AsyncLoop", ptr %101, i32 0, i32 8
  store volatile ptr %100, ptr %102, align 8, !tbaa !11
  call void @_ZN7webstor8internal10auto_scopeIPNS0_10ExLockSyncENS0_13ExLockDeleterELy0EED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  %103 = load ptr, ptr %9, align 8, !tbaa !5
  %104 = load ptr, ptr %5, align 8, !tbaa !5
  %105 = load i64, ptr %6, align 8, !tbaa !9
  %106 = call noundef zeroext i1 @_ZN7webstor8internal9AsyncLoop6pendOpEPvmPm(ptr noundef nonnull align 8 dereferenceable(241) %103, ptr noundef %104, i64 noundef %105, ptr noundef %7)
  br i1 %106, label %107, label %108

107:                                              ; preds = %99
  store i32 1, ptr %15, align 4
  br label %109

108:                                              ; preds = %99
  store i32 0, ptr %15, align 4
  br label %109

109:                                              ; preds = %108, %107, %77, %62
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  %110 = load i32, ptr %15, align 4
  switch i32 %110, label %118 [
    i32 0, label %111
    i32 1, label %112
  ]

111:                                              ; preds = %109
  br label %23, !llvm.loop !35

112:                                              ; preds = %109
  ret void

113:                                              ; preds = %95
  %114 = load ptr, ptr %16, align 8
  %115 = load i32, ptr %17, align 4
  %116 = insertvalue { ptr, i32 } poison, ptr %114, 0
  %117 = insertvalue { ptr, i32 } %116, i32 %115, 1
  resume { ptr, i32 } %117

118:                                              ; preds = %109
  unreachable
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN7webstor8internal15cpuMemLoadFenceEv() #5

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7webstor8internal9AsyncLoop6pendOpEPvmPm(ptr noundef nonnull align 8 dereferenceable(241), ptr noundef, i64 noundef, ptr noundef) #4 align 2

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #6

declare void @_ZN7webstor8internal9AsyncLoopC1Ev(ptr)

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nobuiltin 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 = { "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 = { 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 #5 = { inlinehint 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 #6 = { nobuiltin allocsize(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 #7 = { nounwind }
attributes #8 = { builtin allocsize(0) }
attributes #9 = { builtin 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 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 176}
!12 = !{!"_ZTSN7webstor8internal9AsyncLoopE", !6, i64 0, !13, i64 8, !14, i64 16, !16, i64 24, !17, i64 32, !27, i64 136, !6, i64 176, !28, i64 184, !28, i64 208, !10, i64 232, !13, i64 240}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"_ZTSN7webstor8internal8TaskCtrlE", !15, i64 0}
!15 = !{!"_ZTSN7webstor8internal10auto_scopeImNS0_15TaskCtrlDeleterELy0EEE", !10, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = !{!"_ZTSN7webstor8internal10SocketPoolE", !6, i64 0, !18, i64 8}
!18 = !{!"_ZTSN7webstor8internal9EventSyncE", !7, i64 0, !19, i64 40, !16, i64 88}
!19 = !{!"_ZTSSt3setIPN7webstor8internal11EventWaiterESt4lessIS3_ESaIS3_EE", !20, i64 0}
!20 = !{!"_ZTSSt8_Rb_treeIPN7webstor8internal11EventWaiterES3_St9_IdentityIS3_ESt4lessIS3_ESaIS3_EE", !21, i64 0}
!21 = !{!"_ZTSNSt8_Rb_treeIPN7webstor8internal11EventWaiterES3_St9_IdentityIS3_ESt4lessIS3_ESaIS3_EE13_Rb_tree_implIS7_Lb1EEE", !22, i64 0, !24, i64 8}
!22 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessIPN7webstor8internal11EventWaiterEEE", !23, i64 0}
!23 = !{!"_ZTSSt4lessIPN7webstor8internal11EventWaiterEE"}
!24 = !{!"_ZTSSt15_Rb_tree_header", !25, i64 0, !10, i64 32}
!25 = !{!"_ZTSSt18_Rb_tree_node_base", !26, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!26 = !{!"_ZTSSt14_Rb_tree_color", !7, i64 0}
!27 = !{!"_ZTSN7webstor8internal10ExLockSyncE", !7, i64 0}
!28 = !{!"_ZTSSt6vectorIPvSaIS0_EE", !29, i64 0}
!29 = !{!"_ZTSSt12_Vector_baseIPvSaIS0_EE", !30, i64 0}
!30 = !{!"_ZTSNSt12_Vector_baseIPvSaIS0_EE12_Vector_implE", !31, i64 0}
!31 = !{!"_ZTSNSt12_Vector_baseIPvSaIS0_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}
!34 = distinct !{!34, !33}
!35 = distinct !{!35, !33}


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

%"class.webstor::internal::auto_scope.9" = type { ptr }

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #1

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

declare void @_ZN7webstor8internal10ExLockSync9claimLockEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7webstor8internal9AsyncLoop6pendOpEPS1_Pvm(ptr noundef %0, ptr noundef %1, i64 noundef %2) local_unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca %"class.webstor::internal::auto_scope.9", align 8
  %8 = getelementptr inbounds i8, ptr %0, i64 176
  %9 = lshr i64 %2, 1
  %.not4355 = icmp eq ptr %0, null
  %10 = getelementptr inbounds i8, ptr %0, i64 136
  br i1 %.not4355, label %.split.us, label %.split

.split.us:                                        ; preds = %3
  %.not82 = icmp eq i64 %2, 0
  br label %11

11:                                               ; preds = %25, %.split.us
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  store i64 0, ptr %4, align 8, !tbaa !5
  %12 = load volatile ptr, ptr %8, align 8, !tbaa !9
  %.not.us = icmp eq ptr %12, null
  br i1 %.not.us, label %.thread.us, label %.thread.us.thread

.thread.us.thread:                                ; preds = %11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #8
  store i64 1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #8
  store i64 %9, ptr %6, align 8, !tbaa !5
  %13 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  br label %16

.thread.us:                                       ; preds = %11
  br i1 %.not82, label %16, label %14

14:                                               ; preds = %.thread.us
  %15 = call noundef zeroext i1 @_ZN7webstor8internal9AsyncLoop6pendOpEPvmPm(ptr noundef nonnull align 8 dereferenceable(241) null, ptr noundef %1, i64 noundef %2, ptr noundef nonnull %4)
  br i1 %15, label %select.unfold, label %16

16:                                               ; preds = %.thread.us.thread, %14, %.thread.us
  %17 = call noalias noundef nonnull dereferenceable(248) ptr @_Znwm(i64 noundef 248) #9
  invoke void @_ZN7webstor8internal9AsyncLoopC1Ev(ptr noundef nonnull align 8 dereferenceable(241) %17)
          to label %18 unwind label %.split65.us

18:                                               ; preds = %16
  call void @_ZN7webstor8internal10ExLockSync9claimLockEv(ptr noundef nonnull align 8 dereferenceable(40) %10)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  call void @_ZN7webstor8internal10auto_scopeIPNS0_10ExLockSyncENS0_13ExLockDeleterELy0EEC2ES3_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull %10)
  %19 = load volatile ptr, ptr inttoptr (i64 176 to ptr), align 16, !tbaa !9
  %.not4461.us = icmp eq ptr %19, null
  br i1 %.not4461.us, label %._crit_edge.us, label %.lr.ph62.us

.lr.ph62.us:                                      ; preds = %18, %.lr.ph62.us
  %20 = phi ptr [ %22, %.lr.ph62.us ], [ inttoptr (i64 176 to ptr), %18 ]
  %21 = load volatile ptr, ptr %20, align 8, !tbaa !9
  %22 = getelementptr inbounds i8, ptr %21, i64 176
  %23 = load volatile ptr, ptr %22, align 8, !tbaa !9
  %.not44.us = icmp eq ptr %23, null
  br i1 %.not44.us, label %._crit_edge.us, label %.lr.ph62.us, !llvm.loop !31

._crit_edge.us:                                   ; preds = %.lr.ph62.us, %18
  %.lcssa.us = phi ptr [ inttoptr (i64 176 to ptr), %18 ], [ %22, %.lr.ph62.us ]
  store volatile ptr %17, ptr %.lcssa.us, align 8, !tbaa !9
  call void @_ZN7webstor8internal10auto_scopeIPNS0_10ExLockSyncENS0_13ExLockDeleterELy0EED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  %24 = call noundef zeroext i1 @_ZN7webstor8internal9AsyncLoop6pendOpEPvmPm(ptr noundef nonnull align 8 dereferenceable(241) %17, ptr noundef %1, i64 noundef %2, ptr noundef nonnull %4)
  br i1 %24, label %select.unfold, label %25

25:                                               ; preds = %._crit_edge.us
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  br label %11

.split65.us:                                      ; preds = %16
  %26 = landingpad { ptr, i32 }
          cleanup
  br label %50

.split:                                           ; preds = %3, %52
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  store i64 0, ptr %4, align 8, !tbaa !5
  %27 = load volatile ptr, ptr %8, align 8, !tbaa !9
  %.not = icmp eq ptr %27, null
  br i1 %.not, label %.thread, label %.lr.ph

.lr.ph:                                           ; preds = %.split
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #8
  store i64 1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #8
  store i64 %9, ptr %6, align 8, !tbaa !5
  %28 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %29 = load i64, ptr %28, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  br label %30

30:                                               ; preds = %.lr.ph, %32
  %.058 = phi i64 [ -1, %.lr.ph ], [ %spec.select45, %32 ]
  %.03257 = phi ptr [ %0, %.lr.ph ], [ %spec.select, %32 ]
  %.03756 = phi ptr [ %0, %.lr.ph ], [ %36, %32 ]
  call void @_ZN7webstor8internal15cpuMemLoadFenceEv()
  %31 = call noundef zeroext i1 @_ZN7webstor8internal9AsyncLoop6pendOpEPvmPm(ptr noundef nonnull align 8 dereferenceable(241) %.03756, ptr noundef %1, i64 noundef %29, ptr noundef nonnull %4)
  br i1 %31, label %select.unfold, label %32

32:                                               ; preds = %30
  %33 = load i64, ptr %4, align 8, !tbaa !5
  %34 = icmp ult i64 %33, %.058
  %spec.select = select i1 %34, ptr %.03756, ptr %.03257
  %spec.select45 = call i64 @llvm.umin.i64(i64 %33, i64 %.058)
  %35 = getelementptr inbounds i8, ptr %.03756, i64 176
  %36 = load volatile ptr, ptr %35, align 8, !tbaa !9
  %.not43 = icmp eq ptr %36, null
  br i1 %.not43, label %.thread, label %30, !llvm.loop !33

.thread:                                          ; preds = %32, %.split
  %.139 = phi ptr [ %0, %.split ], [ %.03756, %32 ]
  %.234 = phi ptr [ %0, %.split ], [ %spec.select, %32 ]
  %.2 = phi i64 [ 0, %.split ], [ %spec.select45, %32 ]
  %37 = icmp ult i64 %.2, %2
  br i1 %37, label %38, label %40

38:                                               ; preds = %.thread
  %39 = call noundef zeroext i1 @_ZN7webstor8internal9AsyncLoop6pendOpEPvmPm(ptr noundef nonnull align 8 dereferenceable(241) %.234, ptr noundef %1, i64 noundef %2, ptr noundef nonnull %4)
  br i1 %39, label %select.unfold, label %40

40:                                               ; preds = %38, %.thread
  %41 = call noalias noundef nonnull dereferenceable(248) ptr @_Znwm(i64 noundef 248) #9
  invoke void @_ZN7webstor8internal9AsyncLoopC1Ev(ptr noundef nonnull align 8 dereferenceable(241) %41)
          to label %42 unwind label %.split65

42:                                               ; preds = %40
  call void @_ZN7webstor8internal10ExLockSync9claimLockEv(ptr noundef nonnull align 8 dereferenceable(40) %10)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  call void @_ZN7webstor8internal10auto_scopeIPNS0_10ExLockSyncENS0_13ExLockDeleterELy0EEC2ES3_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull %10)
  %43 = getelementptr inbounds i8, ptr %.139, i64 176
  %44 = load volatile ptr, ptr %43, align 8, !tbaa !9
  %.not4461 = icmp eq ptr %44, null
  br i1 %.not4461, label %._crit_edge, label %.lr.ph62

.lr.ph62:                                         ; preds = %42, %.lr.ph62
  %45 = phi ptr [ %47, %.lr.ph62 ], [ %43, %42 ]
  %46 = load volatile ptr, ptr %45, align 8, !tbaa !9
  %47 = getelementptr inbounds i8, ptr %46, i64 176
  %48 = load volatile ptr, ptr %47, align 8, !tbaa !9
  %.not44 = icmp eq ptr %48, null
  br i1 %.not44, label %._crit_edge, label %.lr.ph62, !llvm.loop !31

.split65:                                         ; preds = %40
  %49 = landingpad { ptr, i32 }
          cleanup
  br label %50

50:                                               ; preds = %.split65.us, %.split65
  %.us-phi = phi ptr [ %41, %.split65 ], [ %17, %.split65.us ]
  %.us-phi66 = phi { ptr, i32 } [ %49, %.split65 ], [ %26, %.split65.us ]
  call void @_ZdlPvm(ptr noundef nonnull %.us-phi, i64 noundef 248) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  resume { ptr, i32 } %.us-phi66

._crit_edge:                                      ; preds = %.lr.ph62, %42
  %.lcssa = phi ptr [ %43, %42 ], [ %47, %.lr.ph62 ]
  store volatile ptr %41, ptr %.lcssa, align 8, !tbaa !9
  call void @_ZN7webstor8internal10auto_scopeIPNS0_10ExLockSyncENS0_13ExLockDeleterELy0EED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  %51 = call noundef zeroext i1 @_ZN7webstor8internal9AsyncLoop6pendOpEPvmPm(ptr noundef nonnull align 8 dereferenceable(241) %41, ptr noundef %1, i64 noundef %2, ptr noundef nonnull %4)
  br i1 %51, label %select.unfold, label %52

52:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  br label %.split

select.unfold:                                    ; preds = %38, %._crit_edge, %30, %._crit_edge.us, %14
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN7webstor8internal15cpuMemLoadFenceEv() local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7webstor8internal9AsyncLoop6pendOpEPvmPm(ptr noundef nonnull align 8 dereferenceable(241), ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #4 align 2

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #6

declare void @_ZN7webstor8internal9AsyncLoopC1Ev(ptr) local_unnamed_addr

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #7

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nobuiltin 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 = { "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 = { 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 #5 = { inlinehint 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 #6 = { nobuiltin allocsize(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 #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
attributes #9 = { builtin allocsize(0) }
attributes #10 = { builtin 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 176}
!10 = !{!"_ZTSN7webstor8internal9AsyncLoopE", !11, i64 0, !12, i64 8, !13, i64 16, !15, i64 24, !16, i64 32, !26, i64 136, !11, i64 176, !27, i64 184, !27, i64 208, !6, i64 232, !12, i64 240}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!"_ZTSN7webstor8internal8TaskCtrlE", !14, i64 0}
!14 = !{!"_ZTSN7webstor8internal10auto_scopeImNS0_15TaskCtrlDeleterELy0EEE", !6, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!"_ZTSN7webstor8internal10SocketPoolE", !11, i64 0, !17, i64 8}
!17 = !{!"_ZTSN7webstor8internal9EventSyncE", !7, i64 0, !18, i64 40, !15, i64 88}
!18 = !{!"_ZTSSt3setIPN7webstor8internal11EventWaiterESt4lessIS3_ESaIS3_EE", !19, i64 0}
!19 = !{!"_ZTSSt8_Rb_treeIPN7webstor8internal11EventWaiterES3_St9_IdentityIS3_ESt4lessIS3_ESaIS3_EE", !20, i64 0}
!20 = !{!"_ZTSNSt8_Rb_treeIPN7webstor8internal11EventWaiterES3_St9_IdentityIS3_ESt4lessIS3_ESaIS3_EE13_Rb_tree_implIS7_Lb1EEE", !21, i64 0, !23, i64 8}
!21 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessIPN7webstor8internal11EventWaiterEEE", !22, i64 0}
!22 = !{!"_ZTSSt4lessIPN7webstor8internal11EventWaiterEE"}
!23 = !{!"_ZTSSt15_Rb_tree_header", !24, i64 0, !6, i64 32}
!24 = !{!"_ZTSSt18_Rb_tree_node_base", !25, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!25 = !{!"_ZTSSt14_Rb_tree_color", !7, i64 0}
!26 = !{!"_ZTSN7webstor8internal10ExLockSyncE", !7, i64 0}
!27 = !{!"_ZTSSt6vectorIPvSaIS0_EE", !28, i64 0}
!28 = !{!"_ZTSSt12_Vector_baseIPvSaIS0_EE", !29, i64 0}
!29 = !{!"_ZTSNSt12_Vector_baseIPvSaIS0_EE12_Vector_implE", !30, i64 0}
!30 = !{!"_ZTSNSt12_Vector_baseIPvSaIS0_EE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}
!33 = distinct !{!33, !32}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass