; LLVM IR from yinqiwen/ardb :: src/common/channel/channel.ll (ZN4ardb7Channel7DoCloseEb)

; 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.ardb::Channel" = type { %"class.ardb::Runnable", %"struct.ardb::ChannelOptions", i8, i8, i32, %"class.ardb::ChannelPipeline", ptr, i32, i32, %"class.ardb::Buffer", %"class.ardb::Buffer", i32, ptr, ptr, ptr, ptr, i8, i8, i8, ptr, ptr, ptr }
%"class.ardb::Runnable" = type { ptr }
%"struct.ardb::ChannelOptions" = type <{ i32, i32, i8, [3 x i8], i32, i8, [3 x i8], i32, i32, i32, i8, i8, [2 x i8] }>
%"class.ardb::ChannelPipeline" = type { ptr, ptr, ptr, %"class.btree::btree_map" }
%"class.btree::btree_map" = type { %"class.btree::btree_map_container" }
%"class.btree::btree_map_container" = type { %"class.btree::btree_unique_container" }
%"class.btree::btree_unique_container" = type { %"class.btree::btree_container" }
%"class.btree::btree_container" = type { %"class.btree::btree" }
%"class.btree::btree" = type { %"struct.btree::btree<btree::btree_map_params<std::__cxx11::basic_string<char>, ardb::ChannelHandlerContext *, std::less<std::__cxx11::basic_string<char>>, std::allocator<std::pair<const std::__cxx11::basic_string<char>, ardb::ChannelHandlerContext *>>, 256>>::empty_base_handle" }
%"struct.btree::btree<btree::btree_map_params<std::__cxx11::basic_string<char>, ardb::ChannelHandlerContext *, std::less<std::__cxx11::basic_string<char>>, std::allocator<std::pair<const std::__cxx11::basic_string<char>, ardb::ChannelHandlerContext *>>, 256>>::empty_base_handle" = type { ptr }
%"class.ardb::Buffer" = type <{ ptr, i64, i64, i64, i8, [7 x i8] }>
%"struct.ardb::SendFileSetting" = type { i32, i64, i64, ptr, 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

declare void @aeDeleteFileEvent(ptr noundef, i32 noundef, i32 noundef) #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(288) ptr @_ZN4ardb7Channel10GetServiceEv(ptr noundef nonnull align 8 dereferenceable(256)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN4ardb14ChannelService15GetRawEventLoopEv(ptr noundef nonnull align 8 dereferenceable(288)) #2 align 2

declare i32 @close(i32 noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4ardb7Channel7DoCloseEb(ptr noundef nonnull align 8 dereferenceable(256) %0, i1 noundef zeroext %1) #3 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i8, align 1
  %5 = alloca i8, align 1
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i8, align 1
  %9 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %10 = zext i1 %1 to i8
  store i8 %10, ptr %4, align 1, !tbaa !9
  %11 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #5
  store i8 0, ptr %5, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %12 = load ptr, ptr %11, align 8, !tbaa !11
  %13 = getelementptr inbounds ptr, ptr %12, i64 16
  %14 = load ptr, ptr %13, align 8
  %15 = call noundef i32 %14(ptr noundef nonnull align 8 dereferenceable(256) %11)
  store i32 %15, ptr %6, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %16 = load ptr, ptr %11, align 8, !tbaa !11
  %17 = getelementptr inbounds ptr, ptr %16, i64 15
  %18 = load ptr, ptr %17, align 8
  %19 = call noundef i32 %18(ptr noundef nonnull align 8 dereferenceable(256) %11)
  store i32 %19, ptr %7, align 4, !tbaa !13
  %20 = load i32, ptr %6, align 4, !tbaa !13
  %21 = icmp sgt i32 %20, 0
  br i1 %21, label %22, label %26

22:                                               ; preds = %2
  %23 = call noundef nonnull align 8 dereferenceable(288) ptr @_ZN4ardb7Channel10GetServiceEv(ptr noundef nonnull align 8 dereferenceable(256) %11)
  %24 = call noundef ptr @_ZN4ardb14ChannelService15GetRawEventLoopEv(ptr noundef nonnull align 8 dereferenceable(288) %23)
  %25 = load i32, ptr %6, align 4, !tbaa !13
  call void @aeDeleteFileEvent(ptr noundef %24, i32 noundef %25, i32 noundef 3)
  store i8 1, ptr %5, align 1, !tbaa !9
  br label %26

26:                                               ; preds = %22, %2
  %27 = load i32, ptr %6, align 4, !tbaa !13
  %28 = load i32, ptr %7, align 4, !tbaa !13
  %29 = icmp ne i32 %27, %28
  br i1 %29, label %30, label %37

30:                                               ; preds = %26
  %31 = load i32, ptr %7, align 4, !tbaa !13
  %32 = icmp sgt i32 %31, 0
  br i1 %32, label %33, label %37

33:                                               ; preds = %30
  %34 = call noundef nonnull align 8 dereferenceable(288) ptr @_ZN4ardb7Channel10GetServiceEv(ptr noundef nonnull align 8 dereferenceable(256) %11)
  %35 = call noundef ptr @_ZN4ardb14ChannelService15GetRawEventLoopEv(ptr noundef nonnull align 8 dereferenceable(288) %34)
  %36 = load i32, ptr %7, align 4, !tbaa !13
  call void @aeDeleteFileEvent(ptr noundef %35, i32 noundef %36, i32 noundef 2)
  store i8 1, ptr %5, align 1, !tbaa !9
  br label %37

37:                                               ; preds = %33, %30, %26
  call void @_ZN4ardb7Channel20CancelFlushTimerTaskEv(ptr noundef nonnull align 8 dereferenceable(256) %11)
  %38 = getelementptr inbounds %"class.ardb::Channel", ptr %11, i32 0, i32 19
  %39 = load ptr, ptr %38, align 8, !tbaa !15
  %40 = icmp ne ptr null, %39
  br i1 %40, label %41, label %65

41:                                               ; preds = %37
  %42 = getelementptr inbounds %"class.ardb::Channel", ptr %11, i32 0, i32 19
  %43 = load ptr, ptr %42, align 8, !tbaa !15
  %44 = getelementptr inbounds %"struct.ardb::SendFileSetting", ptr %43, i32 0, i32 0
  %45 = load i32, ptr %44, align 8, !tbaa !28
  %46 = call i32 @close(i32 noundef %45)
  %47 = getelementptr inbounds %"class.ardb::Channel", ptr %11, i32 0, i32 19
  %48 = load ptr, ptr %47, align 8, !tbaa !15
  %49 = getelementptr inbounds %"struct.ardb::SendFileSetting", ptr %48, i32 0, i32 0
  store i32 -1, ptr %49, align 8, !tbaa !28
  %50 = getelementptr inbounds %"class.ardb::Channel", ptr %11, i32 0, i32 19
  %51 = load ptr, ptr %50, align 8, !tbaa !15
  %52 = getelementptr inbounds %"struct.ardb::SendFileSetting", ptr %51, i32 0, i32 5
  %53 = load ptr, ptr %52, align 8, !tbaa !30
  %54 = icmp ne ptr null, %53
  br i1 %54, label %55, label %64

55:                                               ; preds = %41
  %56 = getelementptr inbounds %"class.ardb::Channel", ptr %11, i32 0, i32 19
  %57 = load ptr, ptr %56, align 8, !tbaa !15
  %58 = getelementptr inbounds %"struct.ardb::SendFileSetting", ptr %57, i32 0, i32 5
  %59 = load ptr, ptr %58, align 8, !tbaa !30
  %60 = getelementptr inbounds %"class.ardb::Channel", ptr %11, i32 0, i32 19
  %61 = load ptr, ptr %60, align 8, !tbaa !15
  %62 = getelementptr inbounds %"struct.ardb::SendFileSetting", ptr %61, i32 0, i32 3
  %63 = load ptr, ptr %62, align 8, !tbaa !31
  call void %59(ptr noundef %63)
  br label %64

64:                                               ; preds = %55, %41
  br label %65

65:                                               ; preds = %64, %37
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #5
  store i8 0, ptr %8, align 1, !tbaa !9
  %66 = load i8, ptr %5, align 1, !tbaa !9, !range !32, !noundef !33
  %67 = trunc i8 %66 to i1
  br i1 %67, label %68, label %96

68:                                               ; preds = %65
  %69 = load ptr, ptr %11, align 8, !tbaa !11
  %70 = getelementptr inbounds ptr, ptr %69, i64 10
  %71 = load ptr, ptr %70, align 8
  %72 = call noundef zeroext i1 %71(ptr noundef nonnull align 8 dereferenceable(256) %11)
  br i1 %72, label %73, label %96

73:                                               ; preds = %68
  %74 = load i8, ptr %4, align 1, !tbaa !9, !range !32, !noundef !33
  %75 = trunc i8 %74 to i1
  br i1 %75, label %96, label %76

76:                                               ; preds = %73
  %77 = call noundef zeroext i1 @_ZN4ardb19fire_channel_closedEPNS_7ChannelE(ptr noundef %11)
  %78 = zext i1 %77 to i8
  store i8 %78, ptr %8, align 1, !tbaa !9
  %79 = getelementptr inbounds %"class.ardb::Channel", ptr %11, i32 0, i32 4
  %80 = load i32, ptr %79, align 8, !tbaa !34
  %81 = icmp ne i32 0, %80
  br i1 %81, label %82, label %95

82:                                               ; preds = %76
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %83 = call noundef nonnull align 8 dereferenceable(288) ptr @_ZN4ardb7Channel10GetServiceEv(ptr noundef nonnull align 8 dereferenceable(256) %11)
  %84 = getelementptr inbounds %"class.ardb::Channel", ptr %11, i32 0, i32 4
  %85 = load i32, ptr %84, align 8, !tbaa !34
  %86 = call noundef ptr @_ZN4ardb14ChannelService10GetChannelEj(ptr noundef nonnull align 8 dereferenceable(288) %83, i32 noundef %85)
  store ptr %86, ptr %9, align 8, !tbaa !5
  %87 = load ptr, ptr %9, align 8, !tbaa !5
  %88 = icmp ne ptr null, %87
  br i1 %88, label %89, label %94

89:                                               ; preds = %82
  %90 = load ptr, ptr %9, align 8, !tbaa !5
  %91 = load ptr, ptr %90, align 8, !tbaa !11
  %92 = getelementptr inbounds ptr, ptr %91, i64 3
  %93 = load ptr, ptr %92, align 8
  call void %93(ptr noundef nonnull align 8 dereferenceable(256) %90, ptr noundef %11)
  br label %94

94:                                               ; preds = %89, %82
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %95

95:                                               ; preds = %94, %76
  br label %96

96:                                               ; preds = %95, %73, %68, %65
  br label %97

97:                                               ; preds = %96
  %98 = getelementptr inbounds %"class.ardb::Channel", ptr %11, i32 0, i32 19
  %99 = load ptr, ptr %98, align 8, !tbaa !15
  %100 = icmp eq ptr %99, null
  br i1 %100, label %102, label %101

101:                                              ; preds = %97
  call void @_ZdlPvm(ptr noundef %99, i64 noundef 48) #6
  br label %102

102:                                              ; preds = %101, %97
  %103 = getelementptr inbounds %"class.ardb::Channel", ptr %11, i32 0, i32 19
  store ptr null, ptr %103, align 8, !tbaa !15
  br label %104

104:                                              ; preds = %102
  br label %105

105:                                              ; preds = %104
  %106 = getelementptr inbounds %"class.ardb::Channel", ptr %11, i32 0, i32 3
  %107 = load i8, ptr %106, align 1, !tbaa !35, !range !32, !noundef !33
  %108 = trunc i8 %107 to i1
  br i1 %108, label %115, label %109

109:                                              ; preds = %105
  %110 = load i8, ptr %4, align 1, !tbaa !9, !range !32, !noundef !33
  %111 = trunc i8 %110 to i1
  br i1 %111, label %115, label %112

112:                                              ; preds = %109
  %113 = getelementptr inbounds %"class.ardb::Channel", ptr %11, i32 0, i32 3
  store i8 1, ptr %113, align 1, !tbaa !35
  %114 = call noundef nonnull align 8 dereferenceable(288) ptr @_ZN4ardb7Channel10GetServiceEv(ptr noundef nonnull align 8 dereferenceable(256) %11)
  call void @_ZN4ardb14ChannelService13RemoveChannelEPNS_7ChannelE(ptr noundef nonnull align 8 dereferenceable(288) %114, ptr noundef %11)
  br label %115

115:                                              ; preds = %112, %109, %105
  %116 = load i8, ptr %8, align 1, !tbaa !9, !range !32, !noundef !33
  %117 = trunc i8 %116 to i1
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #5
  ret i1 %117
}

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

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

declare noundef zeroext i1 @_ZN4ardb19fire_channel_closedEPNS_7ChannelE(ptr noundef) #1

declare noundef ptr @_ZN4ardb14ChannelService10GetChannelEj(ptr noundef nonnull align 8 dereferenceable(288), i32 noundef) #1

declare void @_ZN4ardb14ChannelService13RemoveChannelEPNS_7ChannelE(ptr noundef nonnull align 8 dereferenceable(288), ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 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 = { 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 #5 = { nounwind }
attributes #6 = { 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 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"vtable pointer", !8, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !6, i64 232}
!16 = !{!"_ZTSN4ardb7ChannelE", !17, i64 0, !18, i64 8, !10, i64 44, !10, i64 45, !14, i64 48, !19, i64 56, !6, i64 88, !14, i64 96, !14, i64 100, !26, i64 104, !26, i64 144, !14, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !10, i64 224, !10, i64 225, !10, i64 226, !6, i64 232, !6, i64 240, !6, i64 248}
!17 = !{!"_ZTSN4ardb8RunnableE"}
!18 = !{!"_ZTSN4ardb14ChannelOptionsE", !14, i64 0, !14, i64 4, !10, i64 8, !14, i64 12, !10, i64 16, !14, i64 20, !14, i64 24, !14, i64 28, !10, i64 32, !10, i64 33}
!19 = !{!"_ZTSN4ardb15ChannelPipelineE", !6, i64 0, !6, i64 8, !6, i64 16, !20, i64 24}
!20 = !{!"_ZTSN5btree9btree_mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN4ardb21ChannelHandlerContextESt4lessIS6_ESaISt4pairIKS6_S9_EELi256EEE", !21, i64 0}
!21 = !{!"_ZTSN5btree19btree_map_containerINS_5btreeINS_16btree_map_paramsINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN4ardb21ChannelHandlerContextESt4lessIS8_ESaISt4pairIKS8_SB_EELi256EEEEEEE", !22, i64 0}
!22 = !{!"_ZTSN5btree22btree_unique_containerINS_5btreeINS_16btree_map_paramsINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN4ardb21ChannelHandlerContextESt4lessIS8_ESaISt4pairIKS8_SB_EELi256EEEEEEE", !23, i64 0}
!23 = !{!"_ZTSN5btree15btree_containerINS_5btreeINS_16btree_map_paramsINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN4ardb21ChannelHandlerContextESt4lessIS8_ESaISt4pairIKS8_SB_EELi256EEEEEEE", !24, i64 0}
!24 = !{!"_ZTSN5btree5btreeINS_16btree_map_paramsINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN4ardb21ChannelHandlerContextESt4lessIS7_ESaISt4pairIKS7_SA_EELi256EEEEE", !25, i64 0}
!25 = !{!"_ZTSN5btree5btreeINS_16btree_map_paramsINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN4ardb21ChannelHandlerContextESt4lessIS7_ESaISt4pairIKS7_SA_EELi256EEEE17empty_base_handleIS6_PNS_10btree_nodeISH_EEEE", !6, i64 0}
!26 = !{!"_ZTSN4ardb6BufferE", !6, i64 0, !27, i64 8, !27, i64 16, !27, i64 24, !10, i64 32}
!27 = !{!"long", !7, i64 0}
!28 = !{!29, !14, i64 0}
!29 = !{!"_ZTSN4ardb15SendFileSettingE", !14, i64 0, !27, i64 8, !27, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!30 = !{!29, !6, i64 40}
!31 = !{!29, !6, i64 24}
!32 = !{i8 0, i8 2}
!33 = !{}
!34 = !{!16, !14, i64 48}
!35 = !{!16, !10, i64 45}


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

declare void @aeDeleteFileEvent(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(288) ptr @_ZN4ardb7Channel10GetServiceEv(ptr noundef nonnull align 8 dereferenceable(256)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN4ardb14ChannelService15GetRawEventLoopEv(ptr noundef nonnull align 8 dereferenceable(288)) local_unnamed_addr #1 align 2

declare i32 @close(i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4ardb7Channel7DoCloseEb(ptr noundef nonnull align 8 dereferenceable(256) %0, i1 noundef zeroext %1) local_unnamed_addr #2 align 2 {
  %3 = load ptr, ptr %0, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %3, i64 128
  %5 = load ptr, ptr %4, align 8
  %6 = tail call noundef i32 %5(ptr noundef nonnull align 8 dereferenceable(256) %0)
  %7 = load ptr, ptr %0, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %7, i64 120
  %9 = load ptr, ptr %8, align 8
  %10 = tail call noundef i32 %9(ptr noundef nonnull align 8 dereferenceable(256) %0)
  %11 = icmp sgt i32 %6, 0
  br i1 %11, label %12, label %15

12:                                               ; preds = %2
  %13 = tail call noundef nonnull align 8 dereferenceable(288) ptr @_ZN4ardb7Channel10GetServiceEv(ptr noundef nonnull align 8 dereferenceable(256) %0)
  %14 = tail call noundef ptr @_ZN4ardb14ChannelService15GetRawEventLoopEv(ptr noundef nonnull align 8 dereferenceable(288) %13)
  tail call void @aeDeleteFileEvent(ptr noundef %14, i32 noundef %6, i32 noundef 3)
  br label %15

15:                                               ; preds = %12, %2
  %16 = icmp ne i32 %6, %10
  %17 = icmp sgt i32 %10, 0
  %or.cond = and i1 %16, %17
  br i1 %or.cond, label %18, label %21

18:                                               ; preds = %15
  %19 = tail call noundef nonnull align 8 dereferenceable(288) ptr @_ZN4ardb7Channel10GetServiceEv(ptr noundef nonnull align 8 dereferenceable(256) %0)
  %20 = tail call noundef ptr @_ZN4ardb14ChannelService15GetRawEventLoopEv(ptr noundef nonnull align 8 dereferenceable(288) %19)
  tail call void @aeDeleteFileEvent(ptr noundef %20, i32 noundef %10, i32 noundef 2)
  br label %21

21:                                               ; preds = %18, %15
  %.1 = phi i1 [ true, %18 ], [ %11, %15 ]
  tail call void @_ZN4ardb7Channel20CancelFlushTimerTaskEv(ptr noundef nonnull align 8 dereferenceable(256) %0)
  %22 = getelementptr inbounds i8, ptr %0, i64 232
  %23 = load ptr, ptr %22, align 8, !tbaa !8
  %.not = icmp eq ptr %23, null
  br i1 %.not, label %33, label %24

24:                                               ; preds = %21
  %25 = load i32, ptr %23, align 8, !tbaa !25
  %26 = tail call i32 @close(i32 noundef %25)
  %27 = load ptr, ptr %22, align 8, !tbaa !8
  store i32 -1, ptr %27, align 8, !tbaa !25
  %28 = getelementptr inbounds i8, ptr %27, i64 40
  %29 = load ptr, ptr %28, align 8, !tbaa !27
  %.not20 = icmp eq ptr %29, null
  br i1 %.not20, label %33, label %30

30:                                               ; preds = %24
  %31 = getelementptr inbounds i8, ptr %27, i64 24
  %32 = load ptr, ptr %31, align 8, !tbaa !28
  tail call void %29(ptr noundef %32)
  br label %33

33:                                               ; preds = %24, %30, %21
  br i1 %.1, label %34, label %51

34:                                               ; preds = %33
  %35 = load ptr, ptr %0, align 8, !tbaa !5
  %36 = getelementptr inbounds i8, ptr %35, i64 80
  %37 = load ptr, ptr %36, align 8
  %38 = tail call noundef zeroext i1 %37(ptr noundef nonnull align 8 dereferenceable(256) %0)
  %.not23 = xor i1 %38, true
  %brmerge = or i1 %.not23, %1
  br i1 %brmerge, label %51, label %39

39:                                               ; preds = %34
  %40 = tail call noundef zeroext i1 @_ZN4ardb19fire_channel_closedEPNS_7ChannelE(ptr noundef nonnull %0)
  %41 = getelementptr inbounds i8, ptr %0, i64 48
  %42 = load i32, ptr %41, align 8, !tbaa !29
  %.not21 = icmp eq i32 %42, 0
  br i1 %.not21, label %51, label %43

43:                                               ; preds = %39
  %44 = tail call noundef nonnull align 8 dereferenceable(288) ptr @_ZN4ardb7Channel10GetServiceEv(ptr noundef nonnull align 8 dereferenceable(256) %0)
  %45 = load i32, ptr %41, align 8, !tbaa !29
  %46 = tail call noundef ptr @_ZN4ardb14ChannelService10GetChannelEj(ptr noundef nonnull align 8 dereferenceable(288) %44, i32 noundef %45)
  %.not22 = icmp eq ptr %46, null
  br i1 %.not22, label %51, label %47

47:                                               ; preds = %43
  %48 = load ptr, ptr %46, align 8, !tbaa !5
  %49 = getelementptr inbounds i8, ptr %48, i64 24
  %50 = load ptr, ptr %49, align 8
  tail call void %50(ptr noundef nonnull align 8 dereferenceable(256) %46, ptr noundef nonnull %0)
  br label %51

51:                                               ; preds = %43, %47, %34, %33, %39
  %.013.shrunk = phi i1 [ %40, %39 ], [ false, %34 ], [ false, %33 ], [ %40, %47 ], [ %40, %43 ]
  %52 = load ptr, ptr %22, align 8, !tbaa !8
  %53 = icmp eq ptr %52, null
  br i1 %53, label %55, label %54

54:                                               ; preds = %51
  tail call void @_ZdlPvm(ptr noundef nonnull %52, i64 noundef 48) #4
  br label %55

55:                                               ; preds = %54, %51
  store ptr null, ptr %22, align 8, !tbaa !8
  %56 = getelementptr inbounds i8, ptr %0, i64 45
  %57 = load i8, ptr %56, align 1, !tbaa !30, !range !31, !noundef !32
  %58 = trunc nuw i8 %57 to i1
  %brmerge24 = or i1 %58, %1
  br i1 %brmerge24, label %61, label %59

59:                                               ; preds = %55
  store i8 1, ptr %56, align 1, !tbaa !30
  %60 = tail call noundef nonnull align 8 dereferenceable(288) ptr @_ZN4ardb7Channel10GetServiceEv(ptr noundef nonnull align 8 dereferenceable(256) %0)
  tail call void @_ZN4ardb14ChannelService13RemoveChannelEPNS_7ChannelE(ptr noundef nonnull align 8 dereferenceable(288) %60, ptr noundef nonnull %0)
  br label %61

61:                                               ; preds = %55, %59
  ret i1 %.013.shrunk
}

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

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

declare noundef zeroext i1 @_ZN4ardb19fire_channel_closedEPNS_7ChannelE(ptr noundef) local_unnamed_addr #0

declare noundef ptr @_ZN4ardb14ChannelService10GetChannelEj(ptr noundef nonnull align 8 dereferenceable(288), i32 noundef) local_unnamed_addr #0

declare void @_ZN4ardb14ChannelService13RemoveChannelEPNS_7ChannelE(ptr noundef nonnull align 8 dereferenceable(288), ptr noundef) local_unnamed_addr #0

attributes #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 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 = { 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 #4 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !16, i64 232}
!9 = !{!"_ZTSN4ardb7ChannelE", !10, i64 0, !11, i64 8, !14, i64 44, !14, i64 45, !12, i64 48, !15, i64 56, !16, i64 88, !12, i64 96, !12, i64 100, !23, i64 104, !23, i64 144, !12, i64 184, !16, i64 192, !16, i64 200, !16, i64 208, !16, i64 216, !14, i64 224, !14, i64 225, !14, i64 226, !16, i64 232, !16, i64 240, !16, i64 248}
!10 = !{!"_ZTSN4ardb8RunnableE"}
!11 = !{!"_ZTSN4ardb14ChannelOptionsE", !12, i64 0, !12, i64 4, !14, i64 8, !12, i64 12, !14, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !14, i64 32, !14, i64 33}
!12 = !{!"int", !13, i64 0}
!13 = !{!"omnipotent char", !7, i64 0}
!14 = !{!"bool", !13, i64 0}
!15 = !{!"_ZTSN4ardb15ChannelPipelineE", !16, i64 0, !16, i64 8, !16, i64 16, !17, i64 24}
!16 = !{!"any pointer", !13, i64 0}
!17 = !{!"_ZTSN5btree9btree_mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN4ardb21ChannelHandlerContextESt4lessIS6_ESaISt4pairIKS6_S9_EELi256EEE", !18, i64 0}
!18 = !{!"_ZTSN5btree19btree_map_containerINS_5btreeINS_16btree_map_paramsINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN4ardb21ChannelHandlerContextESt4lessIS8_ESaISt4pairIKS8_SB_EELi256EEEEEEE", !19, i64 0}
!19 = !{!"_ZTSN5btree22btree_unique_containerINS_5btreeINS_16btree_map_paramsINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN4ardb21ChannelHandlerContextESt4lessIS8_ESaISt4pairIKS8_SB_EELi256EEEEEEE", !20, i64 0}
!20 = !{!"_ZTSN5btree15btree_containerINS_5btreeINS_16btree_map_paramsINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN4ardb21ChannelHandlerContextESt4lessIS8_ESaISt4pairIKS8_SB_EELi256EEEEEEE", !21, i64 0}
!21 = !{!"_ZTSN5btree5btreeINS_16btree_map_paramsINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN4ardb21ChannelHandlerContextESt4lessIS7_ESaISt4pairIKS7_SA_EELi256EEEEE", !22, i64 0}
!22 = !{!"_ZTSN5btree5btreeINS_16btree_map_paramsINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPN4ardb21ChannelHandlerContextESt4lessIS7_ESaISt4pairIKS7_SA_EELi256EEEE17empty_base_handleIS6_PNS_10btree_nodeISH_EEEE", !16, i64 0}
!23 = !{!"_ZTSN4ardb6BufferE", !16, i64 0, !24, i64 8, !24, i64 16, !24, i64 24, !14, i64 32}
!24 = !{!"long", !13, i64 0}
!25 = !{!26, !12, i64 0}
!26 = !{!"_ZTSN4ardb15SendFileSettingE", !12, i64 0, !24, i64 8, !24, i64 16, !16, i64 24, !16, i64 32, !16, i64 40}
!27 = !{!26, !16, i64 40}
!28 = !{!26, !16, i64 24}
!29 = !{!9, !12, i64 48}
!30 = !{!9, !14, i64 45}
!31 = !{i8 0, i8 2}
!32 = !{}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass