; LLVM IR from CodersForLife/Data-Structures-Algorithms :: Graphs/Prim.ll (ZN5Graph3MSTEi)

; 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.std::_List_iterator" = type { ptr }
%class.Graph = type { %class.Minheap, i32, ptr }
%class.Minheap = type { %"class.std::vector", ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::__cxx11::list" = type { %"class.std::__cxx11::_List_base" }
%"class.std::__cxx11::_List_base" = type { %"struct.std::__cxx11::_List_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_List_impl" }
%"struct.std::__cxx11::_List_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_List_impl" = type { %"struct.std::__detail::_List_node_header" }
%"struct.std::__detail::_List_node_header" = type { %"struct.std::__detail::_List_node_base", i64 }
%"struct.std::__detail::_List_node_base" = type { ptr, ptr }
%"struct.std::pair" = type { i32, i32 }

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN7Minheap11extract_minEv(ptr noundef nonnull align 8 dereferenceable(32)) #0 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN7Minheap6insertEii(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i32 noundef) #0 align 2

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

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN5Graph3MSTEi(ptr noundef nonnull align 8 dereferenceable(48) %0, i32 noundef %1) #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::_List_iterator", align 8
  %8 = alloca %"struct.std::_List_iterator", align 8
  %9 = alloca %"struct.std::_List_iterator", align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %"struct.std::_List_iterator", align 8
  %13 = alloca %"struct.std::_List_iterator", align 8
  %14 = alloca %"struct.std::_List_iterator", align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %15 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %16 = getelementptr inbounds %class.Graph, ptr %15, i32 0, i32 1
  %17 = load i32, ptr %16, align 8, !tbaa !11
  %18 = add nsw i32 %17, 1
  %19 = sext i32 %18 to i64
  %20 = call noalias noundef nonnull ptr @_Znam(i64 noundef %19) #5
  store ptr %20, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %21

21:                                               ; preds = %32, %2
  %22 = load i32, ptr %6, align 4, !tbaa !9
  %23 = getelementptr inbounds %class.Graph, ptr %15, i32 0, i32 1
  %24 = load i32, ptr %23, align 8, !tbaa !11
  %25 = icmp sle i32 %22, %24
  br i1 %25, label %27, label %26

26:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %35

27:                                               ; preds = %21
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = load i32, ptr %6, align 4, !tbaa !9
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds i8, ptr %28, i64 %30
  store i8 0, ptr %31, align 1, !tbaa !18
  br label %32

32:                                               ; preds = %27
  %33 = load i32, ptr %6, align 4, !tbaa !9
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %6, align 4, !tbaa !9
  br label %21, !llvm.loop !20

35:                                               ; preds = %26
  %36 = getelementptr inbounds %class.Minheap, ptr %15, i32 0, i32 1
  %37 = load ptr, ptr %36, align 8, !tbaa !22
  %38 = load i32, ptr %4, align 4, !tbaa !9
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds i32, ptr %37, i64 %39
  store i32 0, ptr %40, align 4, !tbaa !9
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = load i32, ptr %4, align 4, !tbaa !9
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds i8, ptr %41, i64 %43
  store i8 1, ptr %44, align 1, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %45 = getelementptr inbounds %class.Graph, ptr %15, i32 0, i32 2
  %46 = load ptr, ptr %45, align 8, !tbaa !23
  %47 = load i32, ptr %4, align 4, !tbaa !9
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds %"class.std::__cxx11::list", ptr %46, i64 %48
  %50 = call ptr @_ZNSt7__cxx114listISt4pairIiiESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %49) #4
  %51 = getelementptr inbounds %"struct.std::_List_iterator", ptr %7, i32 0, i32 0
  store ptr %50, ptr %51, align 8
  br label %52

52:                                               ; preds = %61, %35
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %53 = getelementptr inbounds %class.Graph, ptr %15, i32 0, i32 2
  %54 = load ptr, ptr %53, align 8, !tbaa !23
  %55 = load i32, ptr %4, align 4, !tbaa !9
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds %"class.std::__cxx11::list", ptr %54, i64 %56
  %58 = call ptr @_ZNSt7__cxx114listISt4pairIiiESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %57) #4
  %59 = getelementptr inbounds %"struct.std::_List_iterator", ptr %8, i32 0, i32 0
  store ptr %58, ptr %59, align 8
  %60 = call noundef zeroext i1 @_ZStneRKSt14_List_iteratorISt4pairIiiEES4_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br i1 %60, label %61, label %78

61:                                               ; preds = %52
  %62 = call noundef ptr @_ZNKSt14_List_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #4
  %63 = getelementptr inbounds %"struct.std::pair", ptr %62, i32 0, i32 0
  %64 = load i32, ptr %63, align 4, !tbaa !24
  %65 = call noundef ptr @_ZNKSt14_List_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #4
  %66 = getelementptr inbounds %"struct.std::pair", ptr %65, i32 0, i32 1
  %67 = load i32, ptr %66, align 4, !tbaa !26
  %68 = getelementptr inbounds %class.Minheap, ptr %15, i32 0, i32 1
  %69 = load ptr, ptr %68, align 8, !tbaa !22
  %70 = load i32, ptr %4, align 4, !tbaa !9
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds i32, ptr %69, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !9
  %74 = add nsw i32 %67, %73
  %75 = call noundef i32 @_ZN7Minheap6insertEii(ptr noundef nonnull align 8 dereferenceable(32) %15, i32 noundef %64, i32 noundef %74)
  %76 = call ptr @_ZNSt14_List_iteratorISt4pairIiiEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %7, i32 noundef 0) #4
  %77 = getelementptr inbounds %"struct.std::_List_iterator", ptr %9, i32 0, i32 0
  store ptr %76, ptr %77, align 8
  br label %52, !llvm.loop !27

78:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %79

79:                                               ; preds = %135, %78
  %80 = getelementptr inbounds %class.Minheap, ptr %15, i32 0, i32 0
  %81 = call noundef zeroext i1 @_ZNKSt6vectorIiSaIiEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %80) #4
  %82 = xor i1 %81, true
  br i1 %82, label %83, label %136

83:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %84 = call noundef i32 @_ZN7Minheap11extract_minEv(ptr noundef nonnull align 8 dereferenceable(32) %15)
  store i32 %84, ptr %11, align 4, !tbaa !9
  %85 = getelementptr inbounds %class.Minheap, ptr %15, i32 0, i32 1
  %86 = load ptr, ptr %85, align 8, !tbaa !22
  %87 = load i32, ptr %11, align 4, !tbaa !9
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds i32, ptr %86, i64 %88
  %90 = load i32, ptr %89, align 4, !tbaa !9
  %91 = load i32, ptr %10, align 4, !tbaa !9
  %92 = add nsw i32 %91, %90
  store i32 %92, ptr %10, align 4, !tbaa !9
  %93 = load ptr, ptr %5, align 8, !tbaa !5
  %94 = load i32, ptr %11, align 4, !tbaa !9
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds i8, ptr %93, i64 %95
  store i8 1, ptr %96, align 1, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %97 = getelementptr inbounds %class.Graph, ptr %15, i32 0, i32 2
  %98 = load ptr, ptr %97, align 8, !tbaa !23
  %99 = load i32, ptr %11, align 4, !tbaa !9
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds %"class.std::__cxx11::list", ptr %98, i64 %100
  %102 = call ptr @_ZNSt7__cxx114listISt4pairIiiESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %101) #4
  %103 = getelementptr inbounds %"struct.std::_List_iterator", ptr %12, i32 0, i32 0
  store ptr %102, ptr %103, align 8
  br label %104

104:                                              ; preds = %132, %83
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %105 = getelementptr inbounds %class.Graph, ptr %15, i32 0, i32 2
  %106 = load ptr, ptr %105, align 8, !tbaa !23
  %107 = load i32, ptr %11, align 4, !tbaa !9
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds %"class.std::__cxx11::list", ptr %106, i64 %108
  %110 = call ptr @_ZNSt7__cxx114listISt4pairIiiESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %109) #4
  %111 = getelementptr inbounds %"struct.std::_List_iterator", ptr %13, i32 0, i32 0
  store ptr %110, ptr %111, align 8
  %112 = call noundef zeroext i1 @_ZStneRKSt14_List_iteratorISt4pairIiiEES4_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(8) %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  br i1 %112, label %113, label %135

113:                                              ; preds = %104
  %114 = load ptr, ptr %5, align 8, !tbaa !5
  %115 = call noundef ptr @_ZNKSt14_List_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #4
  %116 = getelementptr inbounds %"struct.std::pair", ptr %115, i32 0, i32 0
  %117 = load i32, ptr %116, align 4, !tbaa !24
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds i8, ptr %114, i64 %118
  %120 = load i8, ptr %119, align 1, !tbaa !18, !range !28, !noundef !29
  %121 = trunc i8 %120 to i1
  %122 = zext i1 %121 to i32
  %123 = icmp eq i32 %122, 0
  br i1 %123, label %124, label %132

124:                                              ; preds = %113
  %125 = call noundef ptr @_ZNKSt14_List_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #4
  %126 = getelementptr inbounds %"struct.std::pair", ptr %125, i32 0, i32 0
  %127 = load i32, ptr %126, align 4, !tbaa !24
  %128 = call noundef ptr @_ZNKSt14_List_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #4
  %129 = getelementptr inbounds %"struct.std::pair", ptr %128, i32 0, i32 1
  %130 = load i32, ptr %129, align 4, !tbaa !26
  %131 = call noundef i32 @_ZN7Minheap6insertEii(ptr noundef nonnull align 8 dereferenceable(32) %15, i32 noundef %127, i32 noundef %130)
  br label %132

132:                                              ; preds = %124, %113
  %133 = call ptr @_ZNSt14_List_iteratorISt4pairIiiEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %12, i32 noundef 0) #4
  %134 = getelementptr inbounds %"struct.std::_List_iterator", ptr %14, i32 0, i32 0
  store ptr %133, ptr %134, align 8
  br label %104, !llvm.loop !30

135:                                              ; preds = %104
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %79, !llvm.loop !31

136:                                              ; preds = %79
  %137 = load i32, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  ret i32 %137
}

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { nounwind }
attributes #5 = { builtin allocsize(0) }

!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 32}
!12 = !{!"_ZTS5Graph", !13, i64 0, !10, i64 32, !6, i64 40}
!13 = !{!"_ZTS7Minheap", !14, i64 0, !6, i64 24}
!14 = !{!"_ZTSSt6vectorIiSaIiEE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!18 = !{!19, !19, i64 0}
!19 = !{!"bool", !7, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!13, !6, i64 24}
!23 = !{!12, !6, i64 40}
!24 = !{!25, !10, i64 0}
!25 = !{!"_ZTSSt4pairIiiE", !10, i64 0, !10, i64 4}
!26 = !{!25, !10, i64 4}
!27 = distinct !{!27, !21}
!28 = !{i8 0, i8 2}
!29 = !{}
!30 = distinct !{!30, !21}
!31 = distinct !{!31, !21}


; 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.std::_List_iterator" = type { ptr }
%"class.std::__cxx11::list" = type { %"class.std::__cxx11::_List_base" }
%"class.std::__cxx11::_List_base" = type { %"struct.std::__cxx11::_List_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_List_impl" }
%"struct.std::__cxx11::_List_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_List_impl" = type { %"struct.std::__detail::_List_node_header" }
%"struct.std::__detail::_List_node_header" = type { %"struct.std::__detail::_List_node_base", i64 }
%"struct.std::__detail::_List_node_base" = type { ptr, ptr }

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN7Minheap11extract_minEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #0 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN7Minheap6insertEii(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i32 noundef) local_unnamed_addr #0 align 2

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

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN5Graph3MSTEi(ptr noundef nonnull align 8 dereferenceable(48) %0, i32 noundef %1) local_unnamed_addr #0 align 2 {
  %3 = alloca %"struct.std::_List_iterator", align 8
  %4 = alloca %"struct.std::_List_iterator", align 8
  %5 = alloca %"struct.std::_List_iterator", align 8
  %6 = alloca %"struct.std::_List_iterator", align 8
  %7 = getelementptr inbounds i8, ptr %0, i64 32
  %8 = load i32, ptr %7, align 8, !tbaa !5
  %9 = add i32 %8, 1
  %10 = sext i32 %9 to i64
  %11 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %10) #5
  %.not20 = icmp slt i32 %8, 0
  br i1 %.not20, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %2
  %12 = zext i32 %9 to i64
  tail call void @llvm.memset.p0.i64(ptr nonnull align 1 %11, i8 0, i64 %12, i1 false), !tbaa !16
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph.preheader, %2
  %13 = getelementptr inbounds i8, ptr %0, i64 24
  %14 = load ptr, ptr %13, align 8, !tbaa !18
  %15 = sext i32 %1 to i64
  %16 = getelementptr inbounds i32, ptr %14, i64 %15
  store i32 0, ptr %16, align 4, !tbaa !19
  %17 = getelementptr inbounds i8, ptr %11, i64 %15
  store i8 1, ptr %17, align 1, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %18 = getelementptr inbounds i8, ptr %0, i64 40
  %19 = load ptr, ptr %18, align 8, !tbaa !20
  %20 = getelementptr inbounds %"class.std::__cxx11::list", ptr %19, i64 %15
  %21 = tail call ptr @_ZNSt7__cxx114listISt4pairIiiESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #6
  store ptr %21, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %22 = load ptr, ptr %18, align 8, !tbaa !20
  %23 = getelementptr inbounds %"class.std::__cxx11::list", ptr %22, i64 %15
  %24 = tail call ptr @_ZNSt7__cxx114listISt4pairIiiESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %23) #6
  store ptr %24, ptr %4, align 8
  %25 = call noundef zeroext i1 @_ZStneRKSt14_List_iteratorISt4pairIiiEES4_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  br i1 %25, label %.lr.ph23, label %.preheader

.preheader:                                       ; preds = %.lr.ph23, %._crit_edge
  %26 = call noundef zeroext i1 @_ZNKSt6vectorIiSaIiEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  br i1 %26, label %._crit_edge29, label %.lr.ph28

.lr.ph23:                                         ; preds = %._crit_edge, %.lr.ph23
  %27 = call noundef ptr @_ZNKSt14_List_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  %28 = load i32, ptr %27, align 4, !tbaa !21
  %29 = call noundef ptr @_ZNKSt14_List_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  %30 = getelementptr inbounds i8, ptr %29, i64 4
  %31 = load i32, ptr %30, align 4, !tbaa !23
  %32 = load ptr, ptr %13, align 8, !tbaa !18
  %33 = getelementptr inbounds i32, ptr %32, i64 %15
  %34 = load i32, ptr %33, align 4, !tbaa !19
  %35 = add nsw i32 %34, %31
  %36 = call noundef i32 @_ZN7Minheap6insertEii(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef %28, i32 noundef %35)
  %37 = call ptr @_ZNSt14_List_iteratorISt4pairIiiEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %3, i32 noundef 0) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %38 = load ptr, ptr %18, align 8, !tbaa !20
  %39 = getelementptr inbounds %"class.std::__cxx11::list", ptr %38, i64 %15
  %40 = call ptr @_ZNSt7__cxx114listISt4pairIiiESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %39) #6
  store ptr %40, ptr %4, align 8
  %41 = call noundef zeroext i1 @_ZStneRKSt14_List_iteratorISt4pairIiiEES4_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  br i1 %41, label %.lr.ph23, label %.preheader, !llvm.loop !24

.lr.ph28:                                         ; preds = %.preheader, %._crit_edge26
  %.01927 = phi i32 [ %47, %._crit_edge26 ], [ 0, %.preheader ]
  %42 = call noundef i32 @_ZN7Minheap11extract_minEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %43 = load ptr, ptr %13, align 8, !tbaa !18
  %44 = sext i32 %42 to i64
  %45 = getelementptr inbounds i32, ptr %43, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !19
  %47 = add nsw i32 %46, %.01927
  %48 = getelementptr inbounds i8, ptr %11, i64 %44
  store i8 1, ptr %48, align 1, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %49 = load ptr, ptr %18, align 8, !tbaa !20
  %50 = getelementptr inbounds %"class.std::__cxx11::list", ptr %49, i64 %44
  %51 = call ptr @_ZNSt7__cxx114listISt4pairIiiESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %50) #6
  store ptr %51, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %52 = load ptr, ptr %18, align 8, !tbaa !20
  %53 = getelementptr inbounds %"class.std::__cxx11::list", ptr %52, i64 %44
  %54 = call ptr @_ZNSt7__cxx114listISt4pairIiiESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %53) #6
  store ptr %54, ptr %6, align 8
  %55 = call noundef zeroext i1 @_ZStneRKSt14_List_iteratorISt4pairIiiEES4_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  br i1 %55, label %.lr.ph25, label %._crit_edge26

.lr.ph25:                                         ; preds = %.lr.ph28, %69
  %56 = call noundef ptr @_ZNKSt14_List_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  %57 = load i32, ptr %56, align 4, !tbaa !21
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds i8, ptr %11, i64 %58
  %60 = load i8, ptr %59, align 1, !tbaa !16, !range !26, !noundef !27
  %61 = icmp eq i8 %60, 0
  br i1 %61, label %62, label %69

62:                                               ; preds = %.lr.ph25
  %63 = call noundef ptr @_ZNKSt14_List_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  %64 = load i32, ptr %63, align 4, !tbaa !21
  %65 = call noundef ptr @_ZNKSt14_List_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  %66 = getelementptr inbounds i8, ptr %65, i64 4
  %67 = load i32, ptr %66, align 4, !tbaa !23
  %68 = call noundef i32 @_ZN7Minheap6insertEii(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef %64, i32 noundef %67)
  br label %69

69:                                               ; preds = %62, %.lr.ph25
  %70 = call ptr @_ZNSt14_List_iteratorISt4pairIiiEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %5, i32 noundef 0) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %71 = load ptr, ptr %18, align 8, !tbaa !20
  %72 = getelementptr inbounds %"class.std::__cxx11::list", ptr %71, i64 %44
  %73 = call ptr @_ZNSt7__cxx114listISt4pairIiiESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %72) #6
  store ptr %73, ptr %6, align 8
  %74 = call noundef zeroext i1 @_ZStneRKSt14_List_iteratorISt4pairIiiEES4_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  br i1 %74, label %.lr.ph25, label %._crit_edge26, !llvm.loop !28

._crit_edge26:                                    ; preds = %69, %.lr.ph28
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  %75 = call noundef zeroext i1 @_ZNKSt6vectorIiSaIiEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  br i1 %75, label %._crit_edge29, label %.lr.ph28, !llvm.loop !29

._crit_edge29:                                    ; preds = %._crit_edge26, %.preheader
  %.019.lcssa = phi i32 [ 0, %.preheader ], [ %47, %._crit_edge26 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  ret i32 %.019.lcssa
}

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

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

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { builtin allocsize(0) }
attributes #6 = { 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, !15, i64 32}
!6 = !{!"_ZTS5Graph", !7, i64 0, !15, i64 32, !12, i64 40}
!7 = !{!"_ZTS7Minheap", !8, i64 0, !12, i64 24}
!8 = !{!"_ZTSSt6vectorIiSaIiEE", !9, i64 0}
!9 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !10, i64 0}
!10 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !11, i64 0}
!11 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !12, i64 0, !12, i64 8, !12, i64 16}
!12 = !{!"any pointer", !13, i64 0}
!13 = !{!"omnipotent char", !14, i64 0}
!14 = !{!"Simple C++ TBAA"}
!15 = !{!"int", !13, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"bool", !13, i64 0}
!18 = !{!7, !12, i64 24}
!19 = !{!15, !15, i64 0}
!20 = !{!6, !12, i64 40}
!21 = !{!22, !15, i64 0}
!22 = !{!"_ZTSSt4pairIiiE", !15, i64 0, !15, i64 4}
!23 = !{!22, !15, i64 4}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{i8 0, i8 2}
!27 = !{}
!28 = distinct !{!28, !25}
!29 = distinct !{!29, !25}


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