; LLVM IR from bqi343/cp-notebook :: Implementations/content/graphs (12)/Advanced (LCTtest)

; 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.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_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 }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@LCT = external dso_local global [200005 x ptr], align 16
@adj = external dso_local global [200005 x %"class.std::set"], align 16
@.str.19 = external hidden unnamed_addr constant [3 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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z9connectedP5snodeS0_(ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z2aeii(i32 noundef, i32 noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z2deii(i32 noundef, i32 noundef) #1

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5qpathii(i32 noundef, i32 noundef) #1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4qlcaii(i32 noundef, i32 noundef) #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %30, %0
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = load i32, ptr @n, align 4, !tbaa !5
  %20 = add nsw i32 %19, 1
  %21 = icmp slt i32 %18, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  br label %37

23:                                               ; preds = %17
  %24 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 72) #9
  %25 = load i32, ptr %2, align 4, !tbaa !5
  invoke void @_ZN5snodeC2Ei(ptr noundef nonnull align 8 dereferenceable(72) %24, i32 noundef %25)
          to label %26 unwind label %33

26:                                               ; preds = %23
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [200005 x ptr], ptr @LCT, i64 0, i64 %28
  store ptr %24, ptr %29, align 8, !tbaa !9
  br label %30

30:                                               ; preds = %26
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %2, align 4, !tbaa !5
  br label %17, !llvm.loop !11

33:                                               ; preds = %23
  %34 = landingpad { ptr, i32 }
          cleanup
  %35 = extractvalue { ptr, i32 } %34, 0
  store ptr %35, ptr %3, align 8
  %36 = extractvalue { ptr, i32 } %34, 1
  store i32 %36, ptr %4, align 4
  call void @_ZdlPvm(ptr noundef %24, i64 noundef 72) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  br label %142

37:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  store i32 2, ptr %5, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %51, %37
  %39 = load i32, ptr %5, align 4, !tbaa !5
  %40 = load i32, ptr @n, align 4, !tbaa !5
  %41 = add nsw i32 %40, 1
  %42 = icmp slt i32 %39, %41
  br i1 %42, label %44, label %43

43:                                               ; preds = %38
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  br label %54

44:                                               ; preds = %38
  %45 = call i32 @rand() #8
  %46 = load i32, ptr %5, align 4, !tbaa !5
  %47 = sub nsw i32 %46, 1
  %48 = srem i32 %45, %47
  %49 = add nsw i32 %48, 1
  %50 = load i32, ptr %5, align 4, !tbaa !5
  call void @_Z2aeii(i32 noundef %49, i32 noundef %50)
  br label %51

51:                                               ; preds = %44
  %52 = load i32, ptr %5, align 4, !tbaa !5
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %5, align 4, !tbaa !5
  br label %38, !llvm.loop !13

54:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %55

55:                                               ; preds = %137, %54
  %56 = load i32, ptr %6, align 4, !tbaa !5
  %57 = icmp slt i32 %56, 10001
  br i1 %57, label %59, label %58

58:                                               ; preds = %55
  store i32 8, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  br label %140

59:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  %60 = call i32 @rand() #8
  %61 = load i32, ptr @n, align 4, !tbaa !5
  %62 = srem i32 %60, %61
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  %64 = call i32 @rand() #8
  %65 = load i32, ptr @n, align 4, !tbaa !5
  %66 = srem i32 %64, %65
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %10, align 4, !tbaa !5
  %68 = call i32 @rand() #8
  %69 = srem i32 %68, 3
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %8, align 4, !tbaa !5
  %71 = load i32, ptr %8, align 4, !tbaa !5
  %72 = icmp eq i32 %71, 1
  br i1 %72, label %73, label %76

73:                                               ; preds = %59
  %74 = load i32, ptr %9, align 4, !tbaa !5
  %75 = load i32, ptr %10, align 4, !tbaa !5
  call void @_Z5qpathii(i32 noundef %74, i32 noundef %75)
  br label %91

76:                                               ; preds = %59
  %77 = load i32, ptr %8, align 4, !tbaa !5
  %78 = icmp eq i32 %77, 2
  br i1 %78, label %79, label %82

79:                                               ; preds = %76
  %80 = load i32, ptr %9, align 4, !tbaa !5
  call void @_Z4rooti(i32 noundef %80)
  %81 = load i32, ptr %10, align 4, !tbaa !5
  call void @_Z4qsubi(i32 noundef %81)
  br label %90

82:                                               ; preds = %76
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  %83 = call i32 @rand() #8
  %84 = load i32, ptr @n, align 4, !tbaa !5
  %85 = srem i32 %83, %84
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %11, align 4, !tbaa !5
  %87 = load i32, ptr %9, align 4, !tbaa !5
  call void @_Z4rooti(i32 noundef %87)
  %88 = load i32, ptr %10, align 4, !tbaa !5
  %89 = load i32, ptr %11, align 4, !tbaa !5
  call void @_Z4qlcaii(i32 noundef %88, i32 noundef %89)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  br label %90

90:                                               ; preds = %82, %79
  br label %91

91:                                               ; preds = %90, %73
  %92 = load i32, ptr %6, align 4, !tbaa !5
  %93 = srem i32 %92, 10
  %94 = icmp eq i32 %93, 0
  br i1 %94, label %95, label %136

95:                                               ; preds = %91
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  %96 = call i32 @rand() #8
  %97 = load i32, ptr @n, align 4, !tbaa !5
  %98 = srem i32 %96, %97
  %99 = add nsw i32 %98, 1
  store i32 %99, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  %100 = load i32, ptr %12, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [200005 x %"class.std::set"], ptr @adj, i64 0, i64 %101
  %103 = call ptr @_ZSt5beginISt3setIiSt4lessIiESaIiEEEDTcldtfp_5beginEERT_(ptr noundef nonnull align 8 dereferenceable(48) %102)
  %104 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %14, i32 0, i32 0
  store ptr %103, ptr %104, align 8
  %105 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %14) #8
  %106 = load i32, ptr %105, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  store i32 %106, ptr %13, align 4, !tbaa !5
  %107 = load i32, ptr %12, align 4, !tbaa !5
  %108 = load i32, ptr %13, align 4, !tbaa !5
  call void @_Z2deii(i32 noundef %107, i32 noundef %108)
  br label %109

109:                                              ; preds = %134, %95
  br label %110

110:                                              ; preds = %109
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  %111 = call i32 @rand() #8
  %112 = load i32, ptr @n, align 4, !tbaa !5
  %113 = srem i32 %111, %112
  %114 = add nsw i32 %113, 1
  store i32 %114, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  %115 = call i32 @rand() #8
  %116 = load i32, ptr @n, align 4, !tbaa !5
  %117 = srem i32 %115, %116
  %118 = add nsw i32 %117, 1
  store i32 %118, ptr %16, align 4, !tbaa !5
  %119 = load i32, ptr %15, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [200005 x ptr], ptr @LCT, i64 0, i64 %120
  %122 = load ptr, ptr %121, align 8, !tbaa !9
  %123 = load i32, ptr %16, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [200005 x ptr], ptr @LCT, i64 0, i64 %124
  %126 = load ptr, ptr %125, align 8, !tbaa !9
  %127 = call noundef zeroext i1 @_Z9connectedP5snodeS0_(ptr noundef %122, ptr noundef %126)
  br i1 %127, label %131, label %128

128:                                              ; preds = %110
  %129 = load i32, ptr %15, align 4, !tbaa !5
  %130 = load i32, ptr %16, align 4, !tbaa !5
  call void @_Z2aeii(i32 noundef %129, i32 noundef %130)
  store i32 12, ptr %7, align 4
  br label %132

131:                                              ; preds = %110
  store i32 0, ptr %7, align 4
  br label %132

132:                                              ; preds = %131, %128
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  %133 = load i32, ptr %7, align 4
  switch i32 %133, label %147 [
    i32 0, label %134
    i32 12, label %135
  ]

134:                                              ; preds = %132
  br label %109, !llvm.loop !14

135:                                              ; preds = %132
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %136

136:                                              ; preds = %135, %91
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  br label %137

137:                                              ; preds = %136
  %138 = load i32, ptr %6, align 4, !tbaa !5
  %139 = add nsw i32 %138, 1
  store i32 %139, ptr %6, align 4, !tbaa !5
  br label %55, !llvm.loop !15

140:                                              ; preds = %58
  call void @_ZN6output2psIA3_cJEEEvRKT_DpRKT0_(ptr noundef nonnull align 1 dereferenceable(3) @.str.19)
  %141 = load i32, ptr %1, align 4
  ret i32 %141

142:                                              ; preds = %33
  %143 = load ptr, ptr %3, align 8
  %144 = load i32, ptr %4, align 4
  %145 = insertvalue { ptr, i32 } poison, ptr %143, 0
  %146 = insertvalue { ptr, i32 } %145, i32 %144, 1
  resume { ptr, i32 } %146

147:                                              ; preds = %132
  unreachable
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5snodeC2Ei(ptr noundef nonnull align 8 dereferenceable(72), i32 noundef) unnamed_addr #1 align 2

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

; Function Attrs: nounwind
declare i32 @rand() #6

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local ptr @_ZSt5beginISt3setIiSt4lessIiESaIiEEEDTcldtfp_5beginEERT_(ptr noundef nonnull align 8 dereferenceable(48)) #7

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6output2psIA3_cJEEEvRKT_DpRKT0_(ptr noundef nonnull align 1 dereferenceable(3)) #1

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 = { 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 norecurse 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 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 #5 = { 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 #6 = { 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 #7 = { 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}


; 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.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_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 }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@n = external dso_local local_unnamed_addr global i32, align 4
@LCT = external dso_local local_unnamed_addr global [200005 x ptr], align 16
@adj = external dso_local global [200005 x %"class.std::set"], align 16
@.str.19 = external hidden unnamed_addr constant [3 x i8], align 1

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z9connectedP5snodeS0_(ptr noundef, ptr noundef) local_unnamed_addr #1

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z4rooti(i32 noundef) local_unnamed_addr #2

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %2 = load i32, ptr @n, align 4, !tbaa !5
  %.not40 = icmp slt i32 %2, 1
  br i1 %.not40, label %.preheader.preheader, label %.lr.ph

.preheader37:                                     ; preds = %6
  %3 = icmp slt i32 %8, 2
  br i1 %3, label %.preheader.preheader, label %.lr.ph44

.preheader.preheader:                             ; preds = %.lr.ph44, %0, %.preheader37
  br label %.preheader

.lr.ph:                                           ; preds = %0, %6
  %indvars.iv = phi i64 [ %indvars.iv.next, %6 ], [ 1, %0 ]
  %4 = tail call noalias noundef nonnull dereferenceable(72) ptr @_Znwm(i64 noundef 72) #8
  %5 = trunc nuw nsw i64 %indvars.iv to i32
  invoke void @_ZN5snodeC2Ei(ptr noundef nonnull align 8 dereferenceable(72) %4, i32 noundef %5)
          to label %6 unwind label %10

6:                                                ; preds = %.lr.ph
  %7 = getelementptr inbounds [200005 x ptr], ptr @LCT, i64 0, i64 %indvars.iv
  store ptr %4, ptr %7, align 8, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %8 = load i32, ptr @n, align 4, !tbaa !5
  %9 = sext i32 %8 to i64
  %.not.not = icmp slt i64 %indvars.iv, %9
  br i1 %.not.not, label %.lr.ph, label %.preheader37, !llvm.loop !11

10:                                               ; preds = %.lr.ph
  %11 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %4, i64 noundef 72) #9
  resume { ptr, i32 } %11

.lr.ph44:                                         ; preds = %.preheader37, %.lr.ph44
  %.03043 = phi i32 [ %16, %.lr.ph44 ], [ 2, %.preheader37 ]
  %12 = tail call i32 @rand() #10
  %13 = add nsw i32 %.03043, -1
  %14 = srem i32 %12, %13
  %15 = add nsw i32 %14, 1
  tail call void @_Z2aeii(i32 noundef %15, i32 noundef %.03043)
  %16 = add nuw nsw i32 %.03043, 1
  %17 = load i32, ptr @n, align 4, !tbaa !5
  %.not34.not = icmp slt i32 %.03043, %17
  br i1 %.not34.not, label %.lr.ph44, label %.preheader.preheader, !llvm.loop !13

18:                                               ; preds = %65
  call void @_ZN6output2psIA3_cJEEEvRKT_DpRKT0_(ptr noundef nonnull align 1 dereferenceable(3) @.str.19)
  ret i32 0

.preheader:                                       ; preds = %.preheader.preheader, %65
  %.03145 = phi i32 [ %66, %65 ], [ 1, %.preheader.preheader ]
  %19 = call i32 @rand() #10
  %20 = load i32, ptr @n, align 4, !tbaa !5
  %21 = srem i32 %19, %20
  %22 = add nsw i32 %21, 1
  %23 = call i32 @rand() #10
  %24 = load i32, ptr @n, align 4, !tbaa !5
  %25 = srem i32 %23, %24
  %26 = add nsw i32 %25, 1
  %27 = call i32 @rand() #10
  %28 = srem i32 %27, 3
  switch i32 %28, label %31 [
    i32 0, label %29
    i32 1, label %30
  ]

29:                                               ; preds = %.preheader
  call void @_Z5qpathii(i32 noundef %22, i32 noundef %26)
  br label %36

30:                                               ; preds = %.preheader
  call void @_Z4rooti(i32 noundef %22)
  call void @_Z4qsubi(i32 noundef %26)
  br label %36

31:                                               ; preds = %.preheader
  %32 = call i32 @rand() #10
  %33 = load i32, ptr @n, align 4, !tbaa !5
  %34 = srem i32 %32, %33
  %35 = add nsw i32 %34, 1
  call void @_Z4rooti(i32 noundef %22)
  call void @_Z4qlcaii(i32 noundef %26, i32 noundef %35)
  br label %36

36:                                               ; preds = %30, %31, %29
  %.lhs.trunc = trunc nuw i32 %.03145 to i16
  %37 = urem i16 %.lhs.trunc, 10
  %38 = icmp eq i16 %37, 0
  br i1 %38, label %39, label %65

39:                                               ; preds = %36
  %40 = call i32 @rand() #10
  %41 = load i32, ptr @n, align 4, !tbaa !5
  %42 = srem i32 %40, %41
  %43 = add nsw i32 %42, 1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #10
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [200005 x %"class.std::set"], ptr @adj, i64 0, i64 %44
  %46 = call ptr @_ZSt5beginISt3setIiSt4lessIiESaIiEEEDTcldtfp_5beginEERT_(ptr noundef nonnull align 8 dereferenceable(48) %45)
  store ptr %46, ptr %1, align 8
  %47 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %1) #10
  %48 = load i32, ptr %47, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #10
  call void @_Z2deii(i32 noundef %43, i32 noundef %48)
  br label %49

49:                                               ; preds = %49, %39
  %50 = call i32 @rand() #10
  %51 = load i32, ptr @n, align 4, !tbaa !5
  %52 = srem i32 %50, %51
  %53 = add nsw i32 %52, 1
  %54 = call i32 @rand() #10
  %55 = load i32, ptr @n, align 4, !tbaa !5
  %56 = srem i32 %54, %55
  %57 = add nsw i32 %56, 1
  %58 = sext i32 %53 to i64
  %59 = getelementptr inbounds [200005 x ptr], ptr @LCT, i64 0, i64 %58
  %60 = load ptr, ptr %59, align 8, !tbaa !9
  %61 = sext i32 %57 to i64
  %62 = getelementptr inbounds [200005 x ptr], ptr @LCT, i64 0, i64 %61
  %63 = load ptr, ptr %62, align 8, !tbaa !9
  %64 = call noundef zeroext i1 @_Z9connectedP5snodeS0_(ptr noundef %60, ptr noundef %63)
  br i1 %64, label %49, label %.thread

.thread:                                          ; preds = %49
  call void @_Z2aeii(i32 noundef %53, i32 noundef %57)
  br label %65

65:                                               ; preds = %.thread, %36
  %66 = add nuw nsw i32 %.03145, 1
  %exitcond.not = icmp eq i32 %66, 10001
  br i1 %exitcond.not, label %18, label %.preheader, !llvm.loop !14
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5snodeC2Ei(ptr noundef nonnull align 8 dereferenceable(72), i32 noundef) unnamed_addr #1 align 2

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

; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local ptr @_ZSt5beginISt3setIiSt4lessIiESaIiEEEDTcldtfp_5beginEERT_(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #7

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6output2psIA3_cJEEEvRKT_DpRKT0_(ptr noundef nonnull align 1 dereferenceable(3)) local_unnamed_addr #1

attributes #0 = { mustprogress 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 = { 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 norecurse 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 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 #5 = { 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 #6 = { 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 #7 = { 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 #8 = { builtin allocsize(0) }
attributes #9 = { builtin nounwind }
attributes #10 = { 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, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}


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