; LLVM IR from codeIIEST/Algorithms :: Competitive Coding/Tree/Minimum Spanning Tree/Prims/Prims.ll (Z7PrimMSTP5Graphi)

; 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::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%struct.Graph = type { i32, ptr }
%struct.MinHeap = type { i32, i32, ptr, ptr }
%struct.MinHeapNode = type { i32, i64 }
%struct.adjList = type { ptr }
%struct.adjListNode = type { i32, i32, ptr }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_Z13createMinHeapi(i32 noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7isEmptyP7MinHeap(ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_Z10extractMinP7MinHeap(ptr noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z11decreaseKeyP7MinHeapix(ptr noundef, i32 noundef, i64 noundef) #1

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z7PrimMSTP5Graphi(ptr noundef %0, i32 noundef %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.Graph, ptr %18, i32 0, i32 0
  %20 = load i32, ptr %19, align 8, !tbaa !11
  store i32 %20, ptr %7, align 4, !tbaa !9
  %21 = load i32, ptr %7, align 4, !tbaa !9
  %22 = zext i32 %21 to i64
  %23 = call ptr @llvm.stacksave.p0()
  store ptr %23, ptr %8, align 8
  %24 = alloca i64, i64 %22, align 16
  store i64 %22, ptr %9, align 8
  %25 = load i32, ptr %7, align 4, !tbaa !9
  %26 = zext i32 %25 to i64
  %27 = alloca i64, i64 %26, align 16
  store i64 %26, ptr %10, align 8
  %28 = load i32, ptr %7, align 4, !tbaa !9
  %29 = zext i32 %28 to i64
  %30 = alloca i64, i64 %29, align 16
  store i64 %29, ptr %11, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %31 = load i32, ptr %7, align 4, !tbaa !9
  %32 = call noundef ptr @_Z13createMinHeapi(i32 noundef %31)
  store ptr %32, ptr %12, align 8, !tbaa !5
  store i64 0, ptr %5, align 8, !tbaa !13
  br label %33

33:                                               ; preds = %71, %2
  %34 = load i64, ptr %5, align 8, !tbaa !13
  %35 = load i32, ptr %7, align 4, !tbaa !9
  %36 = sext i32 %35 to i64
  %37 = icmp slt i64 %34, %36
  br i1 %37, label %38, label %74

38:                                               ; preds = %33
  %39 = load i64, ptr %5, align 8, !tbaa !13
  %40 = load i32, ptr %4, align 4, !tbaa !9
  %41 = sext i32 %40 to i64
  %42 = icmp eq i64 %39, %41
  br i1 %42, label %43, label %44

43:                                               ; preds = %38
  br label %71

44:                                               ; preds = %38
  %45 = load i64, ptr %5, align 8, !tbaa !13
  %46 = getelementptr inbounds i64, ptr %27, i64 %45
  store i64 -1, ptr %46, align 8, !tbaa !13
  %47 = load i64, ptr %5, align 8, !tbaa !13
  %48 = getelementptr inbounds i64, ptr %30, i64 %47
  store i64 -1, ptr %48, align 8, !tbaa !13
  %49 = call noundef i32 @_ZNSt14numeric_limitsIiE3maxEv() #5
  %50 = sext i32 %49 to i64
  %51 = load i64, ptr %5, align 8, !tbaa !13
  %52 = getelementptr inbounds i64, ptr %24, i64 %51
  store i64 %50, ptr %52, align 8, !tbaa !13
  %53 = load i64, ptr %5, align 8, !tbaa !13
  %54 = trunc i64 %53 to i32
  %55 = load i64, ptr %5, align 8, !tbaa !13
  %56 = getelementptr inbounds i64, ptr %24, i64 %55
  %57 = load i64, ptr %56, align 8, !tbaa !13
  %58 = call noundef ptr @_Z14newMinHeapNodeix(i32 noundef %54, i64 noundef %57)
  %59 = load ptr, ptr %12, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.MinHeap, ptr %59, i32 0, i32 3
  %61 = load ptr, ptr %60, align 8, !tbaa !15
  %62 = load i64, ptr %5, align 8, !tbaa !13
  %63 = getelementptr inbounds ptr, ptr %61, i64 %62
  store ptr %58, ptr %63, align 8, !tbaa !5
  %64 = load i64, ptr %5, align 8, !tbaa !13
  %65 = trunc i64 %64 to i32
  %66 = load ptr, ptr %12, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.MinHeap, ptr %66, i32 0, i32 2
  %68 = load ptr, ptr %67, align 8, !tbaa !17
  %69 = load i64, ptr %5, align 8, !tbaa !13
  %70 = getelementptr inbounds i32, ptr %68, i64 %69
  store i32 %65, ptr %70, align 4, !tbaa !9
  br label %71

71:                                               ; preds = %44, %43
  %72 = load i64, ptr %5, align 8, !tbaa !13
  %73 = add nsw i64 %72, 1
  store i64 %73, ptr %5, align 8, !tbaa !13
  br label %33, !llvm.loop !18

74:                                               ; preds = %33
  %75 = load i32, ptr %4, align 4, !tbaa !9
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds i64, ptr %24, i64 %76
  store i64 0, ptr %77, align 8, !tbaa !13
  %78 = load i32, ptr %4, align 4, !tbaa !9
  %79 = load i32, ptr %4, align 4, !tbaa !9
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds i64, ptr %24, i64 %80
  %82 = load i64, ptr %81, align 8, !tbaa !13
  %83 = call noundef ptr @_Z14newMinHeapNodeix(i32 noundef %78, i64 noundef %82)
  %84 = load ptr, ptr %12, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.MinHeap, ptr %84, i32 0, i32 3
  %86 = load ptr, ptr %85, align 8, !tbaa !15
  %87 = load i32, ptr %4, align 4, !tbaa !9
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds ptr, ptr %86, i64 %88
  store ptr %83, ptr %89, align 8, !tbaa !5
  %90 = load i32, ptr %4, align 4, !tbaa !9
  %91 = load ptr, ptr %12, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.MinHeap, ptr %91, i32 0, i32 2
  %93 = load ptr, ptr %92, align 8, !tbaa !17
  %94 = load i32, ptr %4, align 4, !tbaa !9
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds i32, ptr %93, i64 %95
  store i32 %90, ptr %96, align 4, !tbaa !9
  %97 = load i32, ptr %7, align 4, !tbaa !9
  %98 = load ptr, ptr %12, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.MinHeap, ptr %98, i32 0, i32 0
  store i32 %97, ptr %99, align 8, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  store i64 0, ptr %13, align 8, !tbaa !13
  br label %100

100:                                              ; preds = %189, %74
  %101 = load ptr, ptr %12, align 8, !tbaa !5
  %102 = call noundef i32 @_Z7isEmptyP7MinHeap(ptr noundef %101)
  %103 = icmp ne i32 %102, 0
  %104 = xor i1 %103, true
  br i1 %104, label %105, label %190

105:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %106 = load ptr, ptr %12, align 8, !tbaa !5
  %107 = call noundef ptr @_Z10extractMinP7MinHeap(ptr noundef %106)
  store ptr %107, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %108 = load ptr, ptr %14, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.MinHeapNode, ptr %108, i32 0, i32 0
  %110 = load i32, ptr %109, align 8, !tbaa !21
  store i32 %110, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %111 = load ptr, ptr %3, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.Graph, ptr %111, i32 0, i32 1
  %113 = load ptr, ptr %112, align 8, !tbaa !23
  %114 = load i32, ptr %15, align 4, !tbaa !9
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds %struct.adjList, ptr %113, i64 %115
  %117 = getelementptr inbounds %struct.adjList, ptr %116, i32 0, i32 0
  %118 = load ptr, ptr %117, align 8, !tbaa !24
  store ptr %118, ptr %16, align 8, !tbaa !5
  br label %119

119:                                              ; preds = %185, %105
  %120 = load ptr, ptr %16, align 8, !tbaa !5
  %121 = icmp ne ptr %120, null
  br i1 %121, label %122, label %189

122:                                              ; preds = %119
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %123 = load ptr, ptr %16, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.adjListNode, ptr %123, i32 0, i32 0
  %125 = load i32, ptr %124, align 8, !tbaa !26
  store i32 %125, ptr %17, align 4, !tbaa !9
  %126 = load ptr, ptr %12, align 8, !tbaa !5
  %127 = load i32, ptr %17, align 4, !tbaa !9
  %128 = call noundef zeroext i1 @_Z11isInMinHeapP7MinHeapi(ptr noundef %126, i32 noundef %127)
  br i1 %128, label %129, label %185

129:                                              ; preds = %122
  %130 = load ptr, ptr %16, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.adjListNode, ptr %130, i32 0, i32 1
  %132 = load i32, ptr %131, align 4, !tbaa !28
  %133 = sext i32 %132 to i64
  %134 = load i32, ptr %17, align 4, !tbaa !9
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds i64, ptr %24, i64 %135
  %137 = load i64, ptr %136, align 8, !tbaa !13
  %138 = icmp slt i64 %133, %137
  br i1 %138, label %139, label %185

139:                                              ; preds = %129
  %140 = load i32, ptr %15, align 4, !tbaa !9
  %141 = sext i32 %140 to i64
  %142 = load i32, ptr %17, align 4, !tbaa !9
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds i64, ptr %27, i64 %143
  store i64 %141, ptr %144, align 8, !tbaa !13
  %145 = load i32, ptr %17, align 4, !tbaa !9
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds i64, ptr %24, i64 %146
  %148 = load i64, ptr %147, align 8, !tbaa !13
  %149 = call noundef i32 @_ZNSt14numeric_limitsIiE3maxEv() #5
  %150 = sext i32 %149 to i64
  %151 = icmp ne i64 %148, %150
  br i1 %151, label %152, label %164

152:                                              ; preds = %139
  %153 = load i32, ptr %17, align 4, !tbaa !9
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds i64, ptr %24, i64 %154
  %156 = load i64, ptr %155, align 8, !tbaa !13
  %157 = load ptr, ptr %16, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.adjListNode, ptr %157, i32 0, i32 1
  %159 = load i32, ptr %158, align 4, !tbaa !28
  %160 = sext i32 %159 to i64
  %161 = sub nsw i64 %156, %160
  %162 = load i64, ptr %13, align 8, !tbaa !13
  %163 = sub nsw i64 %162, %161
  store i64 %163, ptr %13, align 8, !tbaa !13
  br label %171

164:                                              ; preds = %139
  %165 = load ptr, ptr %16, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.adjListNode, ptr %165, i32 0, i32 1
  %167 = load i32, ptr %166, align 4, !tbaa !28
  %168 = sext i32 %167 to i64
  %169 = load i64, ptr %13, align 8, !tbaa !13
  %170 = add nsw i64 %169, %168
  store i64 %170, ptr %13, align 8, !tbaa !13
  br label %171

171:                                              ; preds = %164, %152
  %172 = load ptr, ptr %16, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.adjListNode, ptr %172, i32 0, i32 1
  %174 = load i32, ptr %173, align 4, !tbaa !28
  %175 = sext i32 %174 to i64
  %176 = load i32, ptr %17, align 4, !tbaa !9
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds i64, ptr %24, i64 %177
  store i64 %175, ptr %178, align 8, !tbaa !13
  %179 = load ptr, ptr %12, align 8, !tbaa !5
  %180 = load i32, ptr %17, align 4, !tbaa !9
  %181 = load i32, ptr %17, align 4, !tbaa !9
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds i64, ptr %24, i64 %182
  %184 = load i64, ptr %183, align 8, !tbaa !13
  call void @_Z11decreaseKeyP7MinHeapix(ptr noundef %179, i32 noundef %180, i64 noundef %184)
  br label %185

185:                                              ; preds = %171, %129, %122
  %186 = load ptr, ptr %16, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct.adjListNode, ptr %186, i32 0, i32 2
  %188 = load ptr, ptr %187, align 8, !tbaa !29
  store ptr %188, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %119, !llvm.loop !30

189:                                              ; preds = %119
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %100, !llvm.loop !31

190:                                              ; preds = %100
  store i64 0, ptr %5, align 8, !tbaa !13
  br label %191

191:                                              ; preds = %205, %190
  %192 = load i64, ptr %5, align 8, !tbaa !13
  %193 = load i32, ptr %7, align 4, !tbaa !9
  %194 = sext i32 %193 to i64
  %195 = icmp slt i64 %192, %194
  br i1 %195, label %196, label %208

196:                                              ; preds = %191
  %197 = load i64, ptr %5, align 8, !tbaa !13
  %198 = getelementptr inbounds i64, ptr %27, i64 %197
  %199 = load i64, ptr %198, align 8, !tbaa !13
  %200 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %199)
  %201 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %200, ptr noundef @.str)
  %202 = load i64, ptr %5, align 8, !tbaa !13
  %203 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %201, i64 noundef %202)
  %204 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %203, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %205

205:                                              ; preds = %196
  %206 = load i64, ptr %5, align 8, !tbaa !13
  %207 = add nsw i64 %206, 1
  store i64 %207, ptr %5, align 8, !tbaa !13
  br label %191, !llvm.loop !32

208:                                              ; preds = %191
  %209 = load i64, ptr %13, align 8, !tbaa !13
  %210 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %209)
  %211 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %210, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  %212 = load ptr, ptr %8, align 8
  call void @llvm.stackrestore.p0(ptr %212)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNSt14numeric_limitsIiE3maxEv() #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #4

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #2 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #4

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn }
attributes #4 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 0}
!12 = !{!"_ZTS5Graph", !10, i64 0, !6, i64 8}
!13 = !{!14, !14, i64 0}
!14 = !{!"long long", !7, i64 0}
!15 = !{!16, !6, i64 16}
!16 = !{!"_ZTS7MinHeap", !10, i64 0, !10, i64 4, !6, i64 8, !6, i64 16}
!17 = !{!16, !6, i64 8}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!16, !10, i64 0}
!21 = !{!22, !10, i64 0}
!22 = !{!"_ZTS11MinHeapNode", !10, i64 0, !14, i64 8}
!23 = !{!12, !6, i64 8}
!24 = !{!25, !6, i64 0}
!25 = !{!"_ZTS7adjList", !6, i64 0}
!26 = !{!27, !10, i64 0}
!27 = !{!"_ZTS11adjListNode", !10, i64 0, !10, i64 4, !6, i64 8}
!28 = !{!27, !10, i64 4}
!29 = !{!27, !6, i64 8}
!30 = distinct !{!30, !19}
!31 = distinct !{!31, !19}
!32 = distinct !{!32, !19}


; 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::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%struct.adjList = type { ptr }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_Z14newMinHeapNodeix(i32 noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_Z13createMinHeapi(i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7isEmptyP7MinHeap(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_Z10extractMinP7MinHeap(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z11decreaseKeyP7MinHeapix(ptr noundef, i32 noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z11isInMinHeapP7MinHeapi(ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_Z7PrimMSTP5Graphi(ptr nocapture noundef readonly %0, i32 noundef %1) local_unnamed_addr #1 {
  %3 = load i32, ptr %0, align 8, !tbaa !5
  %4 = zext i32 %3 to i64
  %5 = alloca i64, i64 %4, align 16
  %6 = alloca i64, i64 %4, align 16
  %7 = tail call noundef ptr @_Z13createMinHeapi(i32 noundef %3)
  %8 = sext i32 %3 to i64
  %9 = icmp sgt i32 %3, 0
  %10 = sext i32 %1 to i64
  br i1 %9, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %2
  %11 = getelementptr inbounds i8, ptr %7, i64 16
  %12 = getelementptr inbounds i8, ptr %7, i64 8
  br label %13

13:                                               ; preds = %.lr.ph, %26
  %.068 = phi i64 [ 0, %.lr.ph ], [ %27, %26 ]
  %14 = icmp eq i64 %.068, %10
  br i1 %14, label %26, label %15

15:                                               ; preds = %13
  %16 = getelementptr inbounds i64, ptr %6, i64 %.068
  store i64 -1, ptr %16, align 8, !tbaa !11
  %17 = tail call noundef i32 @_ZNSt14numeric_limitsIiE3maxEv() #3
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds i64, ptr %5, i64 %.068
  store i64 %18, ptr %19, align 8, !tbaa !11
  %20 = trunc i64 %.068 to i32
  %21 = tail call noundef ptr @_Z14newMinHeapNodeix(i32 noundef %20, i64 noundef %18)
  %22 = load ptr, ptr %11, align 8, !tbaa !13
  %23 = getelementptr inbounds ptr, ptr %22, i64 %.068
  store ptr %21, ptr %23, align 8, !tbaa !15
  %24 = load ptr, ptr %12, align 8, !tbaa !16
  %25 = getelementptr inbounds i32, ptr %24, i64 %.068
  store i32 %20, ptr %25, align 4, !tbaa !17
  br label %26

26:                                               ; preds = %13, %15
  %27 = add nuw nsw i64 %.068, 1
  %exitcond.not = icmp eq i64 %27, %8
  br i1 %exitcond.not, label %._crit_edge, label %13, !llvm.loop !18

._crit_edge:                                      ; preds = %26, %2
  %28 = getelementptr inbounds i64, ptr %5, i64 %10
  store i64 0, ptr %28, align 8, !tbaa !11
  %29 = tail call noundef ptr @_Z14newMinHeapNodeix(i32 noundef %1, i64 noundef 0)
  %30 = getelementptr inbounds i8, ptr %7, i64 16
  %31 = load ptr, ptr %30, align 8, !tbaa !13
  %32 = getelementptr inbounds ptr, ptr %31, i64 %10
  store ptr %29, ptr %32, align 8, !tbaa !15
  %33 = getelementptr inbounds i8, ptr %7, i64 8
  %34 = load ptr, ptr %33, align 8, !tbaa !16
  %35 = getelementptr inbounds i32, ptr %34, i64 %10
  store i32 %1, ptr %35, align 4, !tbaa !17
  store i32 %3, ptr %7, align 8, !tbaa !20
  %36 = tail call noundef i32 @_Z7isEmptyP7MinHeap(ptr noundef nonnull %7)
  %.not76 = icmp eq i32 %36, 0
  br i1 %.not76, label %.lr.ph79, label %.preheader

.lr.ph79:                                         ; preds = %._crit_edge
  %37 = getelementptr inbounds i8, ptr %0, i64 8
  br label %39

.loopexit:                                        ; preds = %62, %39
  %.163.lcssa = phi i64 [ %.06277, %39 ], [ %.3, %62 ]
  %38 = tail call noundef i32 @_Z7isEmptyP7MinHeap(ptr noundef nonnull %7)
  %.not = icmp eq i32 %38, 0
  br i1 %.not, label %39, label %.preheader, !llvm.loop !21

.preheader:                                       ; preds = %.loopexit, %._crit_edge
  %.062.lcssa = phi i64 [ 0, %._crit_edge ], [ %.163.lcssa, %.loopexit ]
  br i1 %9, label %.lr.ph82, label %._crit_edge83

39:                                               ; preds = %.lr.ph79, %.loopexit
  %.06277 = phi i64 [ 0, %.lr.ph79 ], [ %.163.lcssa, %.loopexit ]
  %40 = tail call noundef ptr @_Z10extractMinP7MinHeap(ptr noundef nonnull %7)
  %41 = load i32, ptr %40, align 8, !tbaa !22
  %42 = load ptr, ptr %37, align 8, !tbaa !24
  %43 = sext i32 %41 to i64
  %44 = getelementptr inbounds %struct.adjList, ptr %42, i64 %43
  %.06169 = load ptr, ptr %44, align 8, !tbaa !15
  %.not6570 = icmp eq ptr %.06169, null
  br i1 %.not6570, label %.loopexit, label %.lr.ph74

.lr.ph74:                                         ; preds = %39, %62
  %.06172 = phi ptr [ %.061, %62 ], [ %.06169, %39 ]
  %.16371 = phi i64 [ %.3, %62 ], [ %.06277, %39 ]
  %45 = load i32, ptr %.06172, align 8, !tbaa !25
  %46 = tail call noundef zeroext i1 @_Z11isInMinHeapP7MinHeapi(ptr noundef nonnull %7, i32 noundef %45)
  br i1 %46, label %47, label %62

47:                                               ; preds = %.lr.ph74
  %48 = getelementptr inbounds i8, ptr %.06172, i64 4
  %49 = load i32, ptr %48, align 4, !tbaa !27
  %50 = sext i32 %49 to i64
  %51 = sext i32 %45 to i64
  %52 = getelementptr inbounds i64, ptr %5, i64 %51
  %53 = load i64, ptr %52, align 8, !tbaa !11
  %54 = icmp sgt i64 %53, %50
  br i1 %54, label %55, label %62

55:                                               ; preds = %47
  %56 = getelementptr inbounds i64, ptr %6, i64 %51
  store i64 %43, ptr %56, align 8, !tbaa !11
  %57 = tail call noundef i32 @_ZNSt14numeric_limitsIiE3maxEv() #3
  %58 = sext i32 %57 to i64
  %.not66 = icmp eq i64 %53, %58
  %59 = load i32, ptr %48, align 4, !tbaa !27
  %60 = sext i32 %59 to i64
  %.neg = select i1 %.not66, i64 0, i64 %53
  %.16371.sink = sub i64 %.16371, %.neg
  %61 = add i64 %.16371.sink, %60
  store i64 %60, ptr %52, align 8, !tbaa !11
  tail call void @_Z11decreaseKeyP7MinHeapix(ptr noundef nonnull %7, i32 noundef %45, i64 noundef %60)
  br label %62

62:                                               ; preds = %55, %47, %.lr.ph74
  %.3 = phi i64 [ %61, %55 ], [ %.16371, %47 ], [ %.16371, %.lr.ph74 ]
  %63 = getelementptr inbounds i8, ptr %.06172, i64 8
  %.061 = load ptr, ptr %63, align 8, !tbaa !15
  %.not65 = icmp eq ptr %.061, null
  br i1 %.not65, label %.loopexit, label %.lr.ph74, !llvm.loop !28

.lr.ph82:                                         ; preds = %.preheader, %.lr.ph82
  %.181 = phi i64 [ %70, %.lr.ph82 ], [ 0, %.preheader ]
  %64 = getelementptr inbounds i64, ptr %6, i64 %.181
  %65 = load i64, ptr %64, align 8, !tbaa !11
  %66 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %65)
  %67 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %66, ptr noundef nonnull @.str)
  %68 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %67, i64 noundef %.181)
  %69 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %68, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %70 = add nuw nsw i64 %.181, 1
  %exitcond84.not = icmp eq i64 %70, %8
  br i1 %exitcond84.not, label %._crit_edge83, label %.lr.ph82, !llvm.loop !29

._crit_edge83:                                    ; preds = %.lr.ph82, %.preheader
  %71 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.062.lcssa)
  %72 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %71, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNSt14numeric_limitsIiE3maxEv() local_unnamed_addr #0 align 2

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #2

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { inlinehint mustprogress 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, !7, i64 0}
!6 = !{!"_ZTS5Graph", !7, i64 0, !10, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !8, i64 0}
!13 = !{!14, !10, i64 16}
!14 = !{!"_ZTS7MinHeap", !7, i64 0, !7, i64 4, !10, i64 8, !10, i64 16}
!15 = !{!10, !10, i64 0}
!16 = !{!14, !10, i64 8}
!17 = !{!7, !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!14, !7, i64 0}
!21 = distinct !{!21, !19}
!22 = !{!23, !7, i64 0}
!23 = !{!"_ZTS11MinHeapNode", !7, i64 0, !12, i64 8}
!24 = !{!6, !10, i64 8}
!25 = !{!26, !7, i64 0}
!26 = !{!"_ZTS11adjListNode", !7, i64 0, !7, i64 4, !10, i64 8}
!27 = !{!26, !7, i64 4}
!28 = distinct !{!28, !19}
!29 = distinct !{!29, !19}


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