; LLVM IR from ImperialCollegeLondon/pnflow :: src/pnm/pnflow/Element.ll (ZN4Elem26identifyConnectedPoreElemsEv)

; 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<Elem *, Elem *, std::_Identity<Elem *>, std::less<Elem *>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<Elem *, Elem *, std::_Identity<Elem *>, std::less<Elem *>>::_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::pair.39" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }
%class.Elem = type { %class.Apex, [5 x %class.SlvrElm], i8, i32, ptr, double, double, i32, %"class.std::vector", ptr, double, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, %"struct.std::pair", %"struct.std::pair", %"struct.std::pair", i32, i32, i32, i32, %class.var3 }
%class.Apex = type { ptr, i8, double, double, ptr, i32, double, double, double, double, i8, i8, i8, i8, %"struct.std::pair" }
%class.SlvrElm = type { i8, i8, i8, double, double }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<Elem *, std::allocator<Elem *>>::_Vector_impl" }
%"struct.std::_Vector_base<Elem *, std::allocator<Elem *>>::_Vector_impl" = type { %"struct.std::_Vector_base<Elem *, std::allocator<Elem *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Elem *, std::allocator<Elem *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, double }
%class.var3 = type { double, double, double }

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: 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 dso_local noundef i32 @_ZNK4Elem6nCnctsEv(ptr noundef nonnull align 8 dereferenceable(408)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK4Elem4neibEi(ptr noundef nonnull align 8 dereferenceable(408), i32 noundef) #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Elem26identifyConnectedPoreElemsEv(ptr noundef nonnull align 8 dereferenceable(408) %0) #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"class.std::set", align 8
  %6 = alloca %"class.std::set", align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::pair.39", align 8
  %10 = alloca ptr, align 8
  %11 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %12 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca %"struct.std::pair.39", align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %17 = load ptr, ptr %2, align 8
  call void @_ZN4Elem21setConnectedToNetworkEb(ptr noundef nonnull align 8 dereferenceable(408) %17, i1 noundef zeroext true)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %18

18:                                               ; preds = %113, %1
  %19 = load i32, ptr %3, align 4, !tbaa !9
  %20 = getelementptr inbounds %class.Elem, ptr %17, i32 0, i32 7
  %21 = load i32, ptr %20, align 8, !tbaa !11
  %22 = icmp slt i32 %19, %21
  br i1 %22, label %24, label %23

23:                                               ; preds = %18
  store i32 2, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  br label %116

24:                                               ; preds = %18
  %25 = getelementptr inbounds %class.Elem, ptr %17, i32 0, i32 8
  %26 = load i32, ptr %3, align 4, !tbaa !9
  %27 = sext i32 %26 to i64
  %28 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP4ElemSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %25, i64 noundef %27) #3
  %29 = load ptr, ptr %28, align 8, !tbaa !5
  %30 = call noundef zeroext i1 @_ZNK4Elem18connectedToNetworkEv(ptr noundef nonnull align 8 dereferenceable(408) %29)
  br i1 %30, label %112, label %31

31:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 48, ptr %5) #3
  call void @_ZNSt3setIP4ElemSt4lessIS1_ESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #3
  call void @llvm.lifetime.start.p0(i64 48, ptr %6) #3
  call void @_ZNSt3setIP4ElemSt4lessIS1_ESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %6) #3
  %32 = getelementptr inbounds %class.Elem, ptr %17, i32 0, i32 8
  %33 = load i32, ptr %3, align 4, !tbaa !9
  %34 = sext i32 %33 to i64
  %35 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP4ElemSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %32, i64 noundef %34) #3
  %36 = invoke { ptr, i8 } @_ZNSt3setIP4ElemSt4lessIS1_ESaIS1_EE6insertERKS1_(ptr noundef nonnull align 8 dereferenceable(48) %5, ptr noundef nonnull align 8 dereferenceable(8) %35)
          to label %37 unwind label %57

37:                                               ; preds = %31
  %38 = getelementptr inbounds { ptr, i8 }, ptr %9, i32 0, i32 0
  %39 = extractvalue { ptr, i8 } %36, 0
  store ptr %39, ptr %38, align 8
  %40 = getelementptr inbounds { ptr, i8 }, ptr %9, i32 0, i32 1
  %41 = extractvalue { ptr, i8 } %36, 1
  store i8 %41, ptr %40, align 8
  br label %42

42:                                               ; preds = %109, %37
  %43 = call noundef zeroext i1 @_ZNKSt3setIP4ElemSt4lessIS1_ESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(48) %5) #3
  %44 = xor i1 %43, true
  br i1 %44, label %45, label %110

45:                                               ; preds = %42
  %46 = invoke noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt3setIP4ElemSt4lessIS1_ESaIS1_EEaSERKS5_(ptr noundef nonnull align 8 dereferenceable(48) %6, ptr noundef nonnull align 8 dereferenceable(48) %5)
          to label %47 unwind label %57

47:                                               ; preds = %45
  call void @_ZNSt3setIP4ElemSt4lessIS1_ESaIS1_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) %5) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  store ptr %6, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %48 = load ptr, ptr %10, align 8, !tbaa !5
  %49 = call ptr @_ZNKSt3setIP4ElemSt4lessIS1_ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %48) #3
  %50 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %11, i32 0, i32 0
  store ptr %49, ptr %50, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %51 = load ptr, ptr %10, align 8, !tbaa !5
  %52 = call ptr @_ZNKSt3setIP4ElemSt4lessIS1_ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %51) #3
  %53 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %12, i32 0, i32 0
  store ptr %52, ptr %53, align 8
  br label %54

54:                                               ; preds = %106, %47
  %55 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIP4ElemES4_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %12) #3
  br i1 %55, label %61, label %56

56:                                               ; preds = %54
  store i32 7, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  br label %109

57:                                               ; preds = %45, %31
  %58 = landingpad { ptr, i32 }
          cleanup
  %59 = extractvalue { ptr, i32 } %58, 0
  store ptr %59, ptr %7, align 8
  %60 = extractvalue { ptr, i32 } %58, 1
  store i32 %60, ptr %8, align 4
  br label %111

61:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  %62 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorIP4ElemEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %11) #3
  %63 = load ptr, ptr %62, align 8, !tbaa !5
  store ptr %63, ptr %13, align 8, !tbaa !5
  %64 = load ptr, ptr %13, align 8, !tbaa !5
  %65 = invoke noundef zeroext i1 @_ZNK4Elem18connectedToNetworkEv(ptr noundef nonnull align 8 dereferenceable(408) %64)
          to label %66 unwind label %77

66:                                               ; preds = %61
  br i1 %65, label %105, label %67

67:                                               ; preds = %66
  %68 = load ptr, ptr %13, align 8, !tbaa !5
  invoke void @_ZN4Elem21setConnectedToNetworkEb(ptr noundef nonnull align 8 dereferenceable(408) %68, i1 noundef zeroext true)
          to label %69 unwind label %77

69:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %70

70:                                               ; preds = %96, %69
  %71 = load i32, ptr %14, align 4, !tbaa !9
  %72 = load ptr, ptr %13, align 8, !tbaa !5
  %73 = invoke noundef i32 @_ZNK4Elem6nCnctsEv(ptr noundef nonnull align 8 dereferenceable(408) %72)
          to label %74 unwind label %81

74:                                               ; preds = %70
  %75 = icmp slt i32 %71, %73
  br i1 %75, label %85, label %76

76:                                               ; preds = %74
  store i32 9, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  br label %104

77:                                               ; preds = %67, %61
  %78 = landingpad { ptr, i32 }
          cleanup
  %79 = extractvalue { ptr, i32 } %78, 0
  store ptr %79, ptr %7, align 8
  %80 = extractvalue { ptr, i32 } %78, 1
  store i32 %80, ptr %8, align 4
  br label %108

81:                                               ; preds = %70
  %82 = landingpad { ptr, i32 }
          cleanup
  %83 = extractvalue { ptr, i32 } %82, 0
  store ptr %83, ptr %7, align 8
  %84 = extractvalue { ptr, i32 } %82, 1
  store i32 %84, ptr %8, align 4
  br label %103

85:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  %86 = load ptr, ptr %13, align 8, !tbaa !5
  %87 = load i32, ptr %14, align 4, !tbaa !9
  %88 = invoke noundef ptr @_ZNK4Elem4neibEi(ptr noundef nonnull align 8 dereferenceable(408) %86, i32 noundef %87)
          to label %89 unwind label %99

89:                                               ; preds = %85
  store ptr %88, ptr %15, align 8, !tbaa !5
  %90 = invoke { ptr, i8 } @_ZNSt3setIP4ElemSt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) %5, ptr noundef nonnull align 8 dereferenceable(8) %15)
          to label %91 unwind label %99

91:                                               ; preds = %89
  %92 = getelementptr inbounds { ptr, i8 }, ptr %16, i32 0, i32 0
  %93 = extractvalue { ptr, i8 } %90, 0
  store ptr %93, ptr %92, align 8
  %94 = getelementptr inbounds { ptr, i8 }, ptr %16, i32 0, i32 1
  %95 = extractvalue { ptr, i8 } %90, 1
  store i8 %95, ptr %94, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  br label %96

96:                                               ; preds = %91
  %97 = load i32, ptr %14, align 4, !tbaa !9
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %14, align 4, !tbaa !9
  br label %70, !llvm.loop !22

99:                                               ; preds = %89, %85
  %100 = landingpad { ptr, i32 }
          cleanup
  %101 = extractvalue { ptr, i32 } %100, 0
  store ptr %101, ptr %7, align 8
  %102 = extractvalue { ptr, i32 } %100, 1
  store i32 %102, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  br label %103

103:                                              ; preds = %99, %81
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  br label %108

104:                                              ; preds = %76
  br label %105

105:                                              ; preds = %104, %66
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  br label %106

106:                                              ; preds = %105
  %107 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorIP4ElemEppEv(ptr noundef nonnull align 8 dereferenceable(8) %11) #3
  br label %54

108:                                              ; preds = %103, %77
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  br label %111

109:                                              ; preds = %56
  br label %42, !llvm.loop !24

110:                                              ; preds = %42
  call void @_ZNSt3setIP4ElemSt4lessIS1_ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %6) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr %6) #3
  call void @_ZNSt3setIP4ElemSt4lessIS1_ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr %5) #3
  br label %112

111:                                              ; preds = %108, %57
  call void @_ZNSt3setIP4ElemSt4lessIS1_ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %6) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr %6) #3
  call void @_ZNSt3setIP4ElemSt4lessIS1_ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  br label %117

112:                                              ; preds = %110, %24
  br label %113

113:                                              ; preds = %112
  %114 = load i32, ptr %3, align 4, !tbaa !9
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %3, align 4, !tbaa !9
  br label %18, !llvm.loop !25

116:                                              ; preds = %23
  ret void

117:                                              ; preds = %111
  %118 = load ptr, ptr %7, align 8
  %119 = load i32, ptr %8, align 4
  %120 = insertvalue { ptr, i32 } poison, ptr %118, 0
  %121 = insertvalue { ptr, i32 } %120, i32 %119, 1
  resume { ptr, i32 } %121
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4Elem21setConnectedToNetworkEb(ptr noundef nonnull align 8 dereferenceable(408), i1 noundef zeroext) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4Elem18connectedToNetworkEv(ptr noundef nonnull align 8 dereferenceable(408)) #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIP4ElemSt4lessIS1_ESaIS1_EE6insertERKS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt3setIP4ElemSt4lessIS1_ESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(48)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt3setIP4ElemSt4lessIS1_ESaIS1_EEaSERKS5_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(48)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIP4ElemSt4lessIS1_ESaIS1_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(48)) #1 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIP4ElemES4_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #1

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIP4ElemSt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

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

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

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 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 256}
!12 = !{!"_ZTS4Elem", !13, i64 0, !7, i64 104, !14, i64 224, !10, i64 228, !6, i64 232, !15, i64 240, !15, i64 248, !10, i64 256, !17, i64 264, !6, i64 288, !15, i64 296, !14, i64 304, !14, i64 305, !14, i64 306, !14, i64 307, !14, i64 308, !14, i64 309, !14, i64 310, !14, i64 311, !14, i64 312, !14, i64 313, !16, i64 320, !16, i64 336, !16, i64 352, !10, i64 368, !10, i64 372, !10, i64 376, !10, i64 380, !21, i64 384}
!13 = !{!"_ZTS4Apex", !14, i64 8, !15, i64 16, !15, i64 24, !6, i64 32, !10, i64 40, !15, i64 48, !15, i64 56, !15, i64 64, !15, i64 72, !14, i64 80, !14, i64 81, !14, i64 82, !14, i64 83, !16, i64 88}
!14 = !{!"bool", !7, i64 0}
!15 = !{!"double", !7, i64 0}
!16 = !{!"_ZTSSt4pairIidE", !10, i64 0, !15, i64 8}
!17 = !{!"_ZTSSt6vectorIP4ElemSaIS1_EE", !18, i64 0}
!18 = !{!"_ZTSSt12_Vector_baseIP4ElemSaIS1_EE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIP4ElemSaIS1_EE12_Vector_implE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIP4ElemSaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!21 = !{!"_ZTS4var3IdE", !15, i64 0, !15, i64 8, !15, i64 16}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = distinct !{!24, !23}
!25 = distinct !{!25, !23}


; 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<Elem *, Elem *, std::_Identity<Elem *>, std::less<Elem *>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<Elem *, Elem *, std::_Identity<Elem *>, std::less<Elem *>>::_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 }

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: mustprogress 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 dso_local noundef i32 @_ZNK4Elem6nCnctsEv(ptr noundef nonnull align 8 dereferenceable(408)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK4Elem4neibEi(ptr noundef nonnull align 8 dereferenceable(408), i32 noundef) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Elem26identifyConnectedPoreElemsEv(ptr noundef nonnull align 8 dereferenceable(408) %0) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.std::set", align 8
  %3 = alloca %"class.std::set", align 8
  %4 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %5 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %6 = alloca ptr, align 8
  tail call void @_ZN4Elem21setConnectedToNetworkEb(ptr noundef nonnull align 8 dereferenceable(408) %0, i1 noundef zeroext true)
  %7 = getelementptr inbounds i8, ptr %0, i64 256
  %8 = load i32, ptr %7, align 8, !tbaa !5
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.lr.ph28, label %._crit_edge29

.lr.ph28:                                         ; preds = %1
  %10 = getelementptr inbounds i8, ptr %0, i64 264
  br label %11

._crit_edge29:                                    ; preds = %42, %1
  ret void

11:                                               ; preds = %.lr.ph28, %42
  %indvars.iv = phi i64 [ 0, %.lr.ph28 ], [ %indvars.iv.next, %42 ]
  %12 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP4ElemSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %10, i64 noundef %indvars.iv) #3
  %13 = load ptr, ptr %12, align 8, !tbaa !20
  %14 = call noundef zeroext i1 @_ZNK4Elem18connectedToNetworkEv(ptr noundef nonnull align 8 dereferenceable(408) %13)
  br i1 %14, label %42, label %15

15:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %2) #3
  call void @_ZNSt3setIP4ElemSt4lessIS1_ESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #3
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %3) #3
  call void @_ZNSt3setIP4ElemSt4lessIS1_ESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #3
  %16 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP4ElemSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %10, i64 noundef %indvars.iv) #3
  %17 = invoke { ptr, i8 } @_ZNSt3setIP4ElemSt4lessIS1_ESaIS1_EE6insertERKS1_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(8) %16)
          to label %.preheader unwind label %.loopexit.split-lp

.preheader:                                       ; preds = %15
  %18 = call noundef zeroext i1 @_ZNKSt3setIP4ElemSt4lessIS1_ESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(48) %2) #3
  br i1 %18, label %._crit_edge25, label %.lr.ph24

.lr.ph24:                                         ; preds = %.preheader, %._crit_edge
  %19 = invoke noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt3setIP4ElemSt4lessIS1_ESaIS1_EEaSERKS5_(ptr noundef nonnull align 8 dereferenceable(48) %3, ptr noundef nonnull align 8 dereferenceable(48) %2)
          to label %20 unwind label %.loopexit21

20:                                               ; preds = %.lr.ph24
  call void @_ZNSt3setIP4ElemSt4lessIS1_ESaIS1_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  %21 = call ptr @_ZNKSt3setIP4ElemSt4lessIS1_ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %3) #3
  store ptr %21, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  %22 = call ptr @_ZNKSt3setIP4ElemSt4lessIS1_ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %3) #3
  store ptr %22, ptr %5, align 8
  %23 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIP4ElemES4_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  br i1 %23, label %.lr.ph23, label %._crit_edge

._crit_edge:                                      ; preds = %.loopexit, %20
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  %24 = call noundef zeroext i1 @_ZNKSt3setIP4ElemSt4lessIS1_ESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(48) %2) #3
  br i1 %24, label %._crit_edge25, label %.lr.ph24, !llvm.loop !21

.loopexit21:                                      ; preds = %.lr.ph24
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %41

.loopexit.split-lp:                               ; preds = %15
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %41

.lr.ph23:                                         ; preds = %20, %.loopexit
  %25 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorIP4ElemEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #3
  %26 = load ptr, ptr %25, align 8, !tbaa !20
  %27 = call noundef zeroext i1 @_ZNK4Elem18connectedToNetworkEv(ptr noundef nonnull align 8 dereferenceable(408) %26)
  br i1 %27, label %.loopexit, label %28

28:                                               ; preds = %.lr.ph23
  call void @_ZN4Elem21setConnectedToNetworkEb(ptr noundef nonnull align 8 dereferenceable(408) %26, i1 noundef zeroext true)
  %29 = call noundef i32 @_ZNK4Elem6nCnctsEv(ptr noundef nonnull align 8 dereferenceable(408) %26)
  %30 = icmp sgt i32 %29, 0
  br i1 %30, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %28, %33
  %.01722 = phi i32 [ %34, %33 ], [ 0, %28 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #3
  %31 = call noundef ptr @_ZNK4Elem4neibEi(ptr noundef nonnull align 8 dereferenceable(408) %26, i32 noundef %.01722)
  store ptr %31, ptr %6, align 8, !tbaa !20
  %32 = invoke { ptr, i8 } @_ZNSt3setIP4ElemSt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %33 unwind label %37

33:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  %34 = add nuw nsw i32 %.01722, 1
  %35 = call noundef i32 @_ZNK4Elem6nCnctsEv(ptr noundef nonnull align 8 dereferenceable(408) %26)
  %36 = icmp slt i32 %34, %35
  br i1 %36, label %.lr.ph, label %.loopexit, !llvm.loop !23

37:                                               ; preds = %.lr.ph
  %38 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  br label %41

.loopexit:                                        ; preds = %33, %28, %.lr.ph23
  %39 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorIP4ElemEppEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #3
  %40 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIP4ElemES4_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  br i1 %40, label %.lr.ph23, label %._crit_edge

._crit_edge25:                                    ; preds = %._crit_edge, %.preheader
  call void @_ZNSt3setIP4ElemSt4lessIS1_ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %3) #3
  call void @_ZNSt3setIP4ElemSt4lessIS1_ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %2) #3
  br label %42

41:                                               ; preds = %.loopexit21, %.loopexit.split-lp, %37
  %.pn = phi { ptr, i32 } [ %38, %37 ], [ %lpad.loopexit, %.loopexit21 ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @_ZNSt3setIP4ElemSt4lessIS1_ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %3) #3
  call void @_ZNSt3setIP4ElemSt4lessIS1_ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %2) #3
  resume { ptr, i32 } %.pn

42:                                               ; preds = %11, %._crit_edge25
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %43 = load i32, ptr %7, align 8, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = icmp slt i64 %indvars.iv.next, %44
  br i1 %45, label %11, label %._crit_edge29, !llvm.loop !24
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4Elem21setConnectedToNetworkEb(ptr noundef nonnull align 8 dereferenceable(408), i1 noundef zeroext) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4Elem18connectedToNetworkEv(ptr noundef nonnull align 8 dereferenceable(408)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIP4ElemSt4lessIS1_ESaIS1_EE6insertERKS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt3setIP4ElemSt4lessIS1_ESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt3setIP4ElemSt4lessIS1_ESaIS1_EEaSERKS5_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #2 align 2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIP4ElemES4_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIP4ElemSt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

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

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

attributes #0 = { mustprogress 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 = { 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, !13, i64 256}
!6 = !{!"_ZTS4Elem", !7, i64 0, !9, i64 104, !8, i64 224, !13, i64 228, !12, i64 232, !11, i64 240, !11, i64 248, !13, i64 256, !15, i64 264, !12, i64 288, !11, i64 296, !8, i64 304, !8, i64 305, !8, i64 306, !8, i64 307, !8, i64 308, !8, i64 309, !8, i64 310, !8, i64 311, !8, i64 312, !8, i64 313, !14, i64 320, !14, i64 336, !14, i64 352, !13, i64 368, !13, i64 372, !13, i64 376, !13, i64 380, !19, i64 384}
!7 = !{!"_ZTS4Apex", !8, i64 8, !11, i64 16, !11, i64 24, !12, i64 32, !13, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !8, i64 80, !8, i64 81, !8, i64 82, !8, i64 83, !14, i64 88}
!8 = !{!"bool", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"double", !9, i64 0}
!12 = !{!"any pointer", !9, i64 0}
!13 = !{!"int", !9, i64 0}
!14 = !{!"_ZTSSt4pairIidE", !13, i64 0, !11, i64 8}
!15 = !{!"_ZTSSt6vectorIP4ElemSaIS1_EE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIP4ElemSaIS1_EE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIP4ElemSaIS1_EE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIP4ElemSaIS1_EE17_Vector_impl_dataE", !12, i64 0, !12, i64 8, !12, i64 16}
!19 = !{!"_ZTS4var3IdE", !11, i64 0, !11, i64 8, !11, i64 16}
!20 = !{!12, !12, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}
!24 = distinct !{!24, !22}


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