; LLVM IR from cjmcv/hpc :: coroutine/libco/libco/src/co_routine.ll (Z12co_eventloopP11stCoEpoll_tPFiPvES1_)

; 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.stCoEpoll_t = type { i32, ptr, ptr, ptr, ptr }
%struct.co_epoll_res = type { i32, ptr, ptr }
%struct.epoll_event = type <{ i32, %union.epoll_data }>
%union.epoll_data = type { ptr }
%struct.stTimeoutItem_t = type { ptr, ptr, ptr, i64, ptr, ptr, ptr, i8 }
%struct.stTimeoutItemLink_t = type { ptr, ptr }

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

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i64 @_ZL9GetTickMSv() #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z10AddTimeoutP11stTimeout_tP15stTimeoutItem_ty(ptr noundef, ptr noundef, i64 noundef) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z7AddTailI15stTimeoutItem_t19stTimeoutItemLink_tEvPT0_PT_(ptr noundef, ptr noundef) #3

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z12co_eventloopP11stCoEpoll_tPFiPvES1_(ptr noundef %0, ptr noundef %1, ptr noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.stCoEpoll_t, ptr %17, i32 0, i32 4
  %19 = load ptr, ptr %18, align 8, !tbaa !9
  %20 = icmp ne ptr %19, null
  br i1 %20, label %25, label %21

21:                                               ; preds = %3
  %22 = call noundef ptr @_Z18co_epoll_res_alloci(i32 noundef 10240)
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.stCoEpoll_t, ptr %23, i32 0, i32 4
  store ptr %22, ptr %24, align 8, !tbaa !9
  br label %25

25:                                               ; preds = %21, %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.stCoEpoll_t, ptr %26, i32 0, i32 4
  %28 = load ptr, ptr %27, align 8, !tbaa !9
  store ptr %28, ptr %7, align 8, !tbaa !5
  br label %29

29:                                               ; preds = %165, %25
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.stCoEpoll_t, ptr %30, i32 0, i32 0
  %32 = load i32, ptr %31, align 8, !tbaa !12
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = call noundef i32 @_Z13co_epoll_waitiP12co_epoll_resii(i32 noundef %32, ptr noundef %33, i32 noundef 10240, i32 noundef 1)
  store i32 %34, ptr %8, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.stCoEpoll_t, ptr %35, i32 0, i32 3
  %37 = load ptr, ptr %36, align 8, !tbaa !14
  store ptr %37, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.stCoEpoll_t, ptr %38, i32 0, i32 2
  %40 = load ptr, ptr %39, align 8, !tbaa !15
  store ptr %40, ptr %10, align 8, !tbaa !5
  %41 = load ptr, ptr %10, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %41, i8 0, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 0, ptr %11, align 4, !tbaa !13
  br label %42

42:                                               ; preds = %76, %29
  %43 = load i32, ptr %11, align 4, !tbaa !13
  %44 = load i32, ptr %8, align 4, !tbaa !13
  %45 = icmp slt i32 %43, %44
  br i1 %45, label %47, label %46

46:                                               ; preds = %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %79

47:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.co_epoll_res, ptr %48, i32 0, i32 1
  %50 = load ptr, ptr %49, align 8, !tbaa !16
  %51 = load i32, ptr %11, align 4, !tbaa !13
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds %struct.epoll_event, ptr %50, i64 %52
  %54 = getelementptr inbounds %struct.epoll_event, ptr %53, i32 0, i32 1
  %55 = load ptr, ptr %54, align 1, !tbaa !18
  store ptr %55, ptr %12, align 8, !tbaa !5
  %56 = load ptr, ptr %12, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.stTimeoutItem_t, ptr %56, i32 0, i32 4
  %58 = load ptr, ptr %57, align 8, !tbaa !19
  %59 = icmp ne ptr %58, null
  br i1 %59, label %60, label %72

60:                                               ; preds = %47
  %61 = load ptr, ptr %12, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.stTimeoutItem_t, ptr %61, i32 0, i32 4
  %63 = load ptr, ptr %62, align 8, !tbaa !19
  %64 = load ptr, ptr %12, align 8, !tbaa !5
  %65 = load ptr, ptr %7, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.co_epoll_res, ptr %65, i32 0, i32 1
  %67 = load ptr, ptr %66, align 8, !tbaa !16
  %68 = load i32, ptr %11, align 4, !tbaa !13
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds %struct.epoll_event, ptr %67, i64 %69
  %71 = load ptr, ptr %9, align 8, !tbaa !5
  call void %63(ptr noundef %64, ptr noundef nonnull align 1 dereferenceable(12) %70, ptr noundef %71)
  br label %75

72:                                               ; preds = %47
  %73 = load ptr, ptr %9, align 8, !tbaa !5
  %74 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_Z7AddTailI15stTimeoutItem_t19stTimeoutItemLink_tEvPT0_PT_(ptr noundef %73, ptr noundef %74)
  br label %75

75:                                               ; preds = %72, %60
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  br label %76

76:                                               ; preds = %75
  %77 = load i32, ptr %11, align 4, !tbaa !13
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %11, align 4, !tbaa !13
  br label %42, !llvm.loop !23

79:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %80 = call noundef i64 @_ZL9GetTickMSv()
  store i64 %80, ptr %13, align 8, !tbaa !25
  %81 = load ptr, ptr %4, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.stCoEpoll_t, ptr %81, i32 0, i32 1
  %83 = load ptr, ptr %82, align 8, !tbaa !26
  %84 = load i64, ptr %13, align 8, !tbaa !25
  %85 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_Z14TakeAllTimeoutP11stTimeout_tyP19stTimeoutItemLink_t(ptr noundef %83, i64 noundef %84, ptr noundef %85)
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %86 = load ptr, ptr %10, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.stTimeoutItemLink_t, ptr %86, i32 0, i32 0
  %88 = load ptr, ptr %87, align 8, !tbaa !27
  store ptr %88, ptr %14, align 8, !tbaa !5
  br label %89

89:                                               ; preds = %92, %79
  %90 = load ptr, ptr %14, align 8, !tbaa !5
  %91 = icmp ne ptr %90, null
  br i1 %91, label %92, label %98

92:                                               ; preds = %89
  %93 = load ptr, ptr %14, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.stTimeoutItem_t, ptr %93, i32 0, i32 7
  store i8 1, ptr %94, align 8, !tbaa !29
  %95 = load ptr, ptr %14, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.stTimeoutItem_t, ptr %95, i32 0, i32 1
  %97 = load ptr, ptr %96, align 8, !tbaa !30
  store ptr %97, ptr %14, align 8, !tbaa !5
  br label %89, !llvm.loop !31

98:                                               ; preds = %89
  %99 = load ptr, ptr %9, align 8, !tbaa !5
  %100 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_Z4JoinI15stTimeoutItem_t19stTimeoutItemLink_tEvPT0_S3_(ptr noundef %99, ptr noundef %100)
  %101 = load ptr, ptr %9, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.stTimeoutItemLink_t, ptr %101, i32 0, i32 0
  %103 = load ptr, ptr %102, align 8, !tbaa !27
  store ptr %103, ptr %14, align 8, !tbaa !5
  br label %104

104:                                              ; preds = %148, %135, %98
  %105 = load ptr, ptr %14, align 8, !tbaa !5
  %106 = icmp ne ptr %105, null
  br i1 %106, label %107, label %152

107:                                              ; preds = %104
  %108 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_Z7PopHeadI15stTimeoutItem_t19stTimeoutItemLink_tEvPT0_(ptr noundef %108)
  %109 = load ptr, ptr %14, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.stTimeoutItem_t, ptr %109, i32 0, i32 7
  %111 = load i8, ptr %110, align 8, !tbaa !29, !range !32, !noundef !33
  %112 = trunc i8 %111 to i1
  br i1 %112, label %113, label %138

113:                                              ; preds = %107
  %114 = load i64, ptr %13, align 8, !tbaa !25
  %115 = load ptr, ptr %14, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.stTimeoutItem_t, ptr %115, i32 0, i32 3
  %117 = load i64, ptr %116, align 8, !tbaa !34
  %118 = icmp ult i64 %114, %117
  br i1 %118, label %119, label %138

119:                                              ; preds = %113
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %120 = load ptr, ptr %4, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.stCoEpoll_t, ptr %120, i32 0, i32 1
  %122 = load ptr, ptr %121, align 8, !tbaa !26
  %123 = load ptr, ptr %14, align 8, !tbaa !5
  %124 = load i64, ptr %13, align 8, !tbaa !25
  %125 = call noundef i32 @_Z10AddTimeoutP11stTimeout_tP15stTimeoutItem_ty(ptr noundef %122, ptr noundef %123, i64 noundef %124)
  store i32 %125, ptr %15, align 4, !tbaa !13
  %126 = load i32, ptr %15, align 4, !tbaa !13
  %127 = icmp ne i32 %126, 0
  br i1 %127, label %134, label %128

128:                                              ; preds = %119
  %129 = load ptr, ptr %14, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.stTimeoutItem_t, ptr %129, i32 0, i32 7
  store i8 0, ptr %130, align 8, !tbaa !29
  %131 = load ptr, ptr %9, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.stTimeoutItemLink_t, ptr %131, i32 0, i32 0
  %133 = load ptr, ptr %132, align 8, !tbaa !27
  store ptr %133, ptr %14, align 8, !tbaa !5
  store i32 9, ptr %16, align 4
  br label %135, !llvm.loop !35

134:                                              ; preds = %119
  store i32 0, ptr %16, align 4
  br label %135

135:                                              ; preds = %134, %128
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  %136 = load i32, ptr %16, align 4
  switch i32 %136, label %167 [
    i32 0, label %137
    i32 9, label %104
  ]

137:                                              ; preds = %135
  br label %138

138:                                              ; preds = %137, %113, %107
  %139 = load ptr, ptr %14, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.stTimeoutItem_t, ptr %139, i32 0, i32 5
  %141 = load ptr, ptr %140, align 8, !tbaa !36
  %142 = icmp ne ptr %141, null
  br i1 %142, label %143, label %148

143:                                              ; preds = %138
  %144 = load ptr, ptr %14, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.stTimeoutItem_t, ptr %144, i32 0, i32 5
  %146 = load ptr, ptr %145, align 8, !tbaa !36
  %147 = load ptr, ptr %14, align 8, !tbaa !5
  call void %146(ptr noundef %147)
  br label %148

148:                                              ; preds = %143, %138
  %149 = load ptr, ptr %9, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.stTimeoutItemLink_t, ptr %149, i32 0, i32 0
  %151 = load ptr, ptr %150, align 8, !tbaa !27
  store ptr %151, ptr %14, align 8, !tbaa !5
  br label %104, !llvm.loop !35

152:                                              ; preds = %104
  %153 = load ptr, ptr %5, align 8, !tbaa !5
  %154 = icmp ne ptr %153, null
  br i1 %154, label %155, label %162

155:                                              ; preds = %152
  %156 = load ptr, ptr %5, align 8, !tbaa !5
  %157 = load ptr, ptr %6, align 8, !tbaa !5
  %158 = call noundef i32 %156(ptr noundef %157)
  %159 = icmp eq i32 -1, %158
  br i1 %159, label %160, label %161

160:                                              ; preds = %155
  store i32 2, ptr %16, align 4
  br label %163

161:                                              ; preds = %155
  br label %162

162:                                              ; preds = %161, %152
  store i32 0, ptr %16, align 4
  br label %163

163:                                              ; preds = %162, %160
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  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 4, ptr %8) #7
  %164 = load i32, ptr %16, align 4
  switch i32 %164, label %167 [
    i32 0, label %165
    i32 2, label %166
  ]

165:                                              ; preds = %163
  br label %29, !llvm.loop !37

166:                                              ; preds = %163
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  ret void

167:                                              ; preds = %163, %135
  unreachable
}

declare noundef ptr @_Z18co_epoll_res_alloci(i32 noundef) #5

declare noundef i32 @_Z13co_epoll_waitiP12co_epoll_resii(i32 noundef, ptr noundef, i32 noundef, i32 noundef) #5

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z4JoinI15stTimeoutItem_t19stTimeoutItemLink_tEvPT0_S3_(ptr noundef, ptr noundef) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z7PopHeadI15stTimeoutItem_t19stTimeoutItemLink_tEvPT0_(ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { 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, !6, i64 32}
!10 = !{!"_ZTS11stCoEpoll_t", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 0}
!13 = !{!11, !11, i64 0}
!14 = !{!10, !6, i64 24}
!15 = !{!10, !6, i64 16}
!16 = !{!17, !6, i64 8}
!17 = !{!"_ZTS12co_epoll_res", !11, i64 0, !6, i64 8, !6, i64 16}
!18 = !{!7, !7, i64 0}
!19 = !{!20, !6, i64 32}
!20 = !{!"_ZTS15stTimeoutItem_t", !6, i64 0, !6, i64 8, !6, i64 16, !21, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !22, i64 56}
!21 = !{!"long long", !7, i64 0}
!22 = !{!"bool", !7, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!21, !21, i64 0}
!26 = !{!10, !6, i64 8}
!27 = !{!28, !6, i64 0}
!28 = !{!"_ZTS19stTimeoutItemLink_t", !6, i64 0, !6, i64 8}
!29 = !{!20, !22, i64 56}
!30 = !{!20, !6, i64 8}
!31 = distinct !{!31, !24}
!32 = !{i8 0, i8 2}
!33 = !{}
!34 = !{!20, !21, i64 24}
!35 = distinct !{!35, !24}
!36 = !{!20, !6, i64 40}
!37 = distinct !{!37, !24}


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

%struct.epoll_event = type <{ i32, %union.epoll_data }>
%union.epoll_data = type { ptr }

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i64 @_ZL9GetTickMSv() local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z10AddTimeoutP11stTimeout_tP15stTimeoutItem_ty(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z7AddTailI15stTimeoutItem_t19stTimeoutItemLink_tEvPT0_PT_(ptr noundef, ptr noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z12co_eventloopP11stCoEpoll_tPFiPvES1_(ptr nocapture noundef %0, ptr noundef readonly %1, ptr noundef %2) local_unnamed_addr #1 {
  %4 = getelementptr inbounds i8, ptr %0, i64 32
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %.not = icmp eq ptr %5, null
  br i1 %.not, label %6, label %8

6:                                                ; preds = %3
  %7 = tail call noundef ptr @_Z18co_epoll_res_alloci(i32 noundef 10240)
  store ptr %7, ptr %4, align 8, !tbaa !5
  br label %8

8:                                                ; preds = %6, %3
  %9 = phi ptr [ %7, %6 ], [ %5, %3 ]
  %10 = getelementptr inbounds i8, ptr %0, i64 24
  %11 = getelementptr inbounds i8, ptr %0, i64 16
  %12 = getelementptr inbounds i8, ptr %9, i64 8
  %13 = getelementptr inbounds i8, ptr %0, i64 8
  %.not59 = icmp eq ptr %1, null
  br label %14

14:                                               ; preds = %.backedge85, %8
  %15 = load i32, ptr %0, align 8, !tbaa !11
  %16 = tail call noundef i32 @_Z13co_epoll_waitiP12co_epoll_resii(i32 noundef %15, ptr noundef %9, i32 noundef 10240, i32 noundef 1)
  %17 = load ptr, ptr %10, align 8, !tbaa !12
  %18 = load ptr, ptr %11, align 8, !tbaa !13
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %18, i8 0, i64 16, i1 false)
  %19 = icmp sgt i32 %16, 0
  br i1 %19, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %14
  %wide.trip.count = zext nneg i32 %16 to i64
  br label %.lr.ph

._crit_edge:                                      ; preds = %30, %14
  %20 = tail call noundef i64 @_ZL9GetTickMSv()
  %21 = load ptr, ptr %13, align 8, !tbaa !14
  tail call void @_Z14TakeAllTimeoutP11stTimeout_tyP19stTimeoutItemLink_t(ptr noundef %21, i64 noundef %20, ptr noundef %18)
  %.05172 = load ptr, ptr %18, align 8, !tbaa !15
  %.not5773 = icmp eq ptr %.05172, null
  br i1 %.not5773, label %._crit_edge77, label %.lr.ph76

.lr.ph:                                           ; preds = %.lr.ph.preheader, %30
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %30 ]
  %22 = load ptr, ptr %12, align 8, !tbaa !16
  %23 = getelementptr inbounds %struct.epoll_event, ptr %22, i64 %indvars.iv
  %24 = getelementptr inbounds i8, ptr %23, i64 4
  %25 = load ptr, ptr %24, align 1, !tbaa !18
  %26 = getelementptr inbounds i8, ptr %25, i64 32
  %27 = load ptr, ptr %26, align 8, !tbaa !19
  %.not62 = icmp eq ptr %27, null
  br i1 %.not62, label %29, label %28

28:                                               ; preds = %.lr.ph
  tail call void %27(ptr noundef nonnull %25, ptr noundef nonnull align 1 dereferenceable(12) %23, ptr noundef %17)
  br label %30

29:                                               ; preds = %.lr.ph
  tail call void @_Z7AddTailI15stTimeoutItem_t19stTimeoutItemLink_tEvPT0_PT_(ptr noundef %17, ptr noundef nonnull %25)
  br label %30

30:                                               ; preds = %29, %28
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !23

.lr.ph76:                                         ; preds = %._crit_edge, %.lr.ph76
  %.05174 = phi ptr [ %.051, %.lr.ph76 ], [ %.05172, %._crit_edge ]
  %31 = getelementptr inbounds i8, ptr %.05174, i64 56
  store i8 1, ptr %31, align 8, !tbaa !25
  %32 = getelementptr inbounds i8, ptr %.05174, i64 8
  %.051 = load ptr, ptr %32, align 8, !tbaa !15
  %.not57 = icmp eq ptr %.051, null
  br i1 %.not57, label %._crit_edge77, label %.lr.ph76, !llvm.loop !26

._crit_edge77:                                    ; preds = %.lr.ph76, %._crit_edge
  tail call void @_Z4JoinI15stTimeoutItem_t19stTimeoutItemLink_tEvPT0_S3_(ptr noundef %17, ptr noundef nonnull %18)
  %.15278 = load ptr, ptr %17, align 8, !tbaa !27
  %.not5879 = icmp eq ptr %.15278, null
  br i1 %.not5879, label %._crit_edge83, label %.lr.ph82

.lr.ph82:                                         ; preds = %._crit_edge77, %.backedge
  %.15280 = phi ptr [ %.152, %.backedge ], [ %.15278, %._crit_edge77 ]
  tail call void @_Z7PopHeadI15stTimeoutItem_t19stTimeoutItemLink_tEvPT0_(ptr noundef nonnull %17)
  %33 = getelementptr inbounds i8, ptr %.15280, i64 56
  %34 = load i8, ptr %33, align 8, !tbaa !25, !range !29, !noundef !30
  %35 = trunc nuw i8 %34 to i1
  br i1 %35, label %36, label %.thread

36:                                               ; preds = %.lr.ph82
  %37 = getelementptr inbounds i8, ptr %.15280, i64 24
  %38 = load i64, ptr %37, align 8, !tbaa !31
  %39 = icmp ult i64 %20, %38
  br i1 %39, label %40, label %.thread

40:                                               ; preds = %36
  %41 = load ptr, ptr %13, align 8, !tbaa !14
  %42 = tail call noundef i32 @_Z10AddTimeoutP11stTimeout_tP15stTimeoutItem_ty(ptr noundef %41, ptr noundef nonnull %.15280, i64 noundef %20)
  %.not60 = icmp eq i32 %42, 0
  br i1 %.not60, label %43, label %.thread

43:                                               ; preds = %40
  store i8 0, ptr %33, align 8, !tbaa !25
  br label %.backedge

.thread:                                          ; preds = %40, %36, %.lr.ph82
  %44 = getelementptr inbounds i8, ptr %.15280, i64 40
  %45 = load ptr, ptr %44, align 8, !tbaa !32
  %.not61 = icmp eq ptr %45, null
  br i1 %.not61, label %.backedge, label %46

46:                                               ; preds = %.thread
  tail call void %45(ptr noundef nonnull %.15280)
  br label %.backedge

.backedge:                                        ; preds = %.thread, %46, %43
  %.152 = load ptr, ptr %17, align 8, !tbaa !27
  %.not58 = icmp eq ptr %.152, null
  br i1 %.not58, label %._crit_edge83, label %.lr.ph82, !llvm.loop !33

._crit_edge83:                                    ; preds = %.backedge, %._crit_edge77
  br i1 %.not59, label %.backedge85, label %47

.backedge85:                                      ; preds = %._crit_edge83, %47
  br label %14

47:                                               ; preds = %._crit_edge83
  %48 = tail call noundef i32 %1(ptr noundef %2)
  %49 = icmp eq i32 %48, -1
  br i1 %49, label %50, label %.backedge85

50:                                               ; preds = %47
  ret void
}

declare noundef ptr @_Z18co_epoll_res_alloci(i32 noundef) local_unnamed_addr #4

declare noundef i32 @_Z13co_epoll_waitiP12co_epoll_resii(i32 noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #4

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z4JoinI15stTimeoutItem_t19stTimeoutItemLink_tEvPT0_S3_(ptr noundef, ptr noundef) local_unnamed_addr #2

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

attributes #0 = { 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 #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 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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" }

!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, !10, i64 32}
!6 = !{!"_ZTS11stCoEpoll_t", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 0}
!12 = !{!6, !10, i64 24}
!13 = !{!6, !10, i64 16}
!14 = !{!6, !10, i64 8}
!15 = !{!10, !10, i64 0}
!16 = !{!17, !10, i64 8}
!17 = !{!"_ZTS12co_epoll_res", !7, i64 0, !10, i64 8, !10, i64 16}
!18 = !{!8, !8, i64 0}
!19 = !{!20, !10, i64 32}
!20 = !{!"_ZTS15stTimeoutItem_t", !10, i64 0, !10, i64 8, !10, i64 16, !21, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !22, i64 56}
!21 = !{!"long long", !8, i64 0}
!22 = !{!"bool", !8, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!20, !22, i64 56}
!26 = distinct !{!26, !24}
!27 = !{!28, !10, i64 0}
!28 = !{!"_ZTS19stTimeoutItemLink_t", !10, i64 0, !10, i64 8}
!29 = !{i8 0, i8 2}
!30 = !{}
!31 = !{!20, !21, i64 24}
!32 = !{!20, !10, i64 40}
!33 = distinct !{!33, !24}


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