; LLVM IR from Tunghohin/Competitive_Coding :: Uva/uva11374.ll (Z8dijkstraiPiS_)

; 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.edge = type { i32, i32, i32 }
%"class.std::priority_queue" = type <{ %"class.std::vector", [8 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }

@e = external dso_local global [2020 x %struct.edge], align 16
@head = external dso_local global [510 x i32], align 16
@vis = external dso_local global [510 x i8], align 16

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

18:                                               ; preds = %34, %3
  %19 = load i32, ptr %7, align 4, !tbaa !5
  %20 = icmp slt i32 %19, 510
  br i1 %20, label %22, label %21

21:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %37

22:                                               ; preds = %18
  %23 = load i32, ptr %7, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [510 x i8], ptr @vis, i64 0, i64 %24
  store i8 0, ptr %25, align 1, !tbaa !11
  %26 = load ptr, ptr %6, align 8, !tbaa !9
  %27 = load i32, ptr %7, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds i32, ptr %26, i64 %28
  store i32 -1, ptr %29, align 4, !tbaa !5
  %30 = load ptr, ptr %5, align 8, !tbaa !9
  %31 = load i32, ptr %7, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds i32, ptr %30, i64 %32
  store i32 1061109567, ptr %33, align 4, !tbaa !5
  br label %34

34:                                               ; preds = %22
  %35 = load i32, ptr %7, align 4, !tbaa !5
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %7, align 4, !tbaa !5
  br label %18, !llvm.loop !13

37:                                               ; preds = %21
  %38 = load ptr, ptr %5, align 8, !tbaa !9
  %39 = load i32, ptr %4, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds i32, ptr %38, i64 %40
  store i32 0, ptr %41, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %8) #5
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %8)
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %42 = load ptr, ptr %5, align 8, !tbaa !9
  %43 = load i32, ptr %4, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds i32, ptr %42, i64 %44
  invoke void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %9, ptr noundef nonnull align 4 dereferenceable(4) %45, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %46 unwind label %63

46:                                               ; preds = %37
  invoke void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) %8, ptr noundef nonnull align 4 dereferenceable(8) %9)
          to label %47 unwind label %63

47:                                               ; preds = %46
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %48

48:                                               ; preds = %153, %151, %47
  %49 = invoke noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %8)
          to label %50 unwind label %67

50:                                               ; preds = %48
  %51 = xor i1 %49, true
  br i1 %51, label %52, label %155

52:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %53 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %8)
          to label %54 unwind label %71

54:                                               ; preds = %52
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %12, ptr align 4 %53, i64 8, i1 false)
  invoke void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %8)
          to label %55 unwind label %71

55:                                               ; preds = %54
  %56 = getelementptr inbounds %"struct.std::pair", ptr %12, i32 0, i32 1
  %57 = load i32, ptr %56, align 4, !tbaa !15
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [510 x i8], ptr @vis, i64 0, i64 %58
  %60 = load i8, ptr %59, align 1, !tbaa !11, !range !17, !noundef !18
  %61 = trunc i8 %60 to i1
  br i1 %61, label %62, label %75

62:                                               ; preds = %55
  store i32 5, ptr %13, align 4
  br label %151, !llvm.loop !19

63:                                               ; preds = %46, %37
  %64 = landingpad { ptr, i32 }
          cleanup
  %65 = extractvalue { ptr, i32 } %64, 0
  store ptr %65, ptr %10, align 8
  %66 = extractvalue { ptr, i32 } %64, 1
  store i32 %66, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %156

67:                                               ; preds = %48
  %68 = landingpad { ptr, i32 }
          cleanup
  %69 = extractvalue { ptr, i32 } %68, 0
  store ptr %69, ptr %10, align 8
  %70 = extractvalue { ptr, i32 } %68, 1
  store i32 %70, ptr %11, align 4
  br label %156

71:                                               ; preds = %54, %52
  %72 = landingpad { ptr, i32 }
          cleanup
  %73 = extractvalue { ptr, i32 } %72, 0
  store ptr %73, ptr %10, align 8
  %74 = extractvalue { ptr, i32 } %72, 1
  store i32 %74, ptr %11, align 4
  br label %154

75:                                               ; preds = %55
  %76 = getelementptr inbounds %"struct.std::pair", ptr %12, i32 0, i32 1
  %77 = load i32, ptr %76, align 4, !tbaa !15
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [510 x i8], ptr @vis, i64 0, i64 %78
  store i8 1, ptr %79, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %80 = getelementptr inbounds %"struct.std::pair", ptr %12, i32 0, i32 1
  %81 = load i32, ptr %80, align 4, !tbaa !15
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [510 x i32], ptr @head, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  store i32 %84, ptr %14, align 4, !tbaa !5
  br label %85

85:                                               ; preds = %144, %75
  %86 = load i32, ptr %14, align 4, !tbaa !5
  %87 = icmp ne i32 %86, 0
  br i1 %87, label %89, label %88

88:                                               ; preds = %85
  store i32 7, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %150

89:                                               ; preds = %85
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %90 = load i32, ptr %14, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [2020 x %struct.edge], ptr @e, i64 0, i64 %91
  %93 = getelementptr inbounds %struct.edge, ptr %92, i32 0, i32 0
  %94 = load i32, ptr %93, align 4, !tbaa !20
  store i32 %94, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %95 = load i32, ptr %14, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [2020 x %struct.edge], ptr @e, i64 0, i64 %96
  %98 = getelementptr inbounds %struct.edge, ptr %97, i32 0, i32 2
  %99 = load i32, ptr %98, align 4, !tbaa !22
  store i32 %99, ptr %16, align 4, !tbaa !5
  %100 = load ptr, ptr %5, align 8, !tbaa !9
  %101 = load i32, ptr %15, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds i32, ptr %100, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = load ptr, ptr %5, align 8, !tbaa !9
  %106 = getelementptr inbounds %"struct.std::pair", ptr %12, i32 0, i32 1
  %107 = load i32, ptr %106, align 4, !tbaa !15
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds i32, ptr %105, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = load i32, ptr %16, align 4, !tbaa !5
  %112 = add nsw i32 %110, %111
  %113 = icmp sgt i32 %104, %112
  br i1 %113, label %114, label %143

114:                                              ; preds = %89
  %115 = load ptr, ptr %5, align 8, !tbaa !9
  %116 = getelementptr inbounds %"struct.std::pair", ptr %12, i32 0, i32 1
  %117 = load i32, ptr %116, align 4, !tbaa !15
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds i32, ptr %115, i64 %118
  %120 = load i32, ptr %119, align 4, !tbaa !5
  %121 = load i32, ptr %16, align 4, !tbaa !5
  %122 = add nsw i32 %120, %121
  %123 = load ptr, ptr %5, align 8, !tbaa !9
  %124 = load i32, ptr %15, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds i32, ptr %123, i64 %125
  store i32 %122, ptr %126, align 4, !tbaa !5
  %127 = getelementptr inbounds %"struct.std::pair", ptr %12, i32 0, i32 1
  %128 = load i32, ptr %127, align 4, !tbaa !15
  %129 = load ptr, ptr %6, align 8, !tbaa !9
  %130 = load i32, ptr %15, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds i32, ptr %129, i64 %131
  store i32 %128, ptr %132, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %133 = load ptr, ptr %5, align 8, !tbaa !9
  %134 = load i32, ptr %15, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds i32, ptr %133, i64 %135
  invoke void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %17, ptr noundef nonnull align 4 dereferenceable(4) %136, ptr noundef nonnull align 4 dereferenceable(4) %15)
          to label %137 unwind label %139

137:                                              ; preds = %114
  invoke void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) %8, ptr noundef nonnull align 4 dereferenceable(8) %17)
          to label %138 unwind label %139

138:                                              ; preds = %137
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  br label %143

139:                                              ; preds = %137, %114
  %140 = landingpad { ptr, i32 }
          cleanup
  %141 = extractvalue { ptr, i32 } %140, 0
  store ptr %141, ptr %10, align 8
  %142 = extractvalue { ptr, i32 } %140, 1
  store i32 %142, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %154

143:                                              ; preds = %138, %89
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %144

144:                                              ; preds = %143
  %145 = load i32, ptr %14, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [2020 x %struct.edge], ptr @e, i64 0, i64 %146
  %148 = getelementptr inbounds %struct.edge, ptr %147, i32 0, i32 1
  %149 = load i32, ptr %148, align 4, !tbaa !23
  store i32 %149, ptr %14, align 4, !tbaa !5
  br label %85, !llvm.loop !24

150:                                              ; preds = %88
  store i32 0, ptr %13, align 4
  br label %151

151:                                              ; preds = %150, %62
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  %152 = load i32, ptr %13, align 4
  switch i32 %152, label %162 [
    i32 0, label %153
    i32 5, label %48
  ]

153:                                              ; preds = %151
  br label %48, !llvm.loop !19

154:                                              ; preds = %139, %71
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br label %156

155:                                              ; preds = %50
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %8) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #5
  ret void

156:                                              ; preds = %154, %67, %63
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %8) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #5
  br label %157

157:                                              ; preds = %156
  %158 = load ptr, ptr %10, align 8
  %159 = load i32, ptr %11, align 4
  %160 = insertvalue { ptr, i32 } poison, ptr %158, 0
  %161 = insertvalue { ptr, i32 } %160, i32 %159, 1
  resume { ptr, i32 } %161

162:                                              ; preds = %151
  unreachable
}

; 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 nounwind uwtable
declare dso_local void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25), ptr noundef nonnull align 4 dereferenceable(8)) #0 align 2

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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25)) #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #4 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !6, i64 4}
!16 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = distinct !{!19, !14}
!20 = !{!21, !6, i64 0}
!21 = !{!"_ZTS4edge", !6, i64 0, !6, i64 4, !6, i64 8}
!22 = !{!21, !6, i64 8}
!23 = !{!21, !6, i64 4}
!24 = distinct !{!24, !14}


; 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.edge = type { i32, i32, i32 }
%"class.std::priority_queue" = type <{ %"class.std::vector", [8 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }

@e = external dso_local local_unnamed_addr global [2020 x %struct.edge], align 16
@head = external dso_local local_unnamed_addr global [510 x i32], align 16
@vis = external dso_local local_unnamed_addr global [510 x i8], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z8dijkstraiPiS_(i32 noundef %0, ptr noundef %1, ptr nocapture noundef writeonly %2) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
vector.memcheck:
  %3 = alloca i32, align 4
  %4 = alloca %"class.std::priority_queue", align 8
  %5 = alloca %"struct.std::pair", align 4
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::pair", align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  %8 = ptrtoint ptr %1 to i64
  %9 = ptrtoint ptr %2 to i64
  %10 = sub i64 %8, %9
  %diff.check = icmp ult i64 %10, 32
  br i1 %diff.check, label %scalar.ph.preheader, label %vector.body

scalar.ph.preheader:                              ; preds = %vector.body, %vector.memcheck
  %indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 504, %vector.body ]
  br label %scalar.ph

vector.body:                                      ; preds = %vector.memcheck, %vector.body.1
  %index = phi i64 [ %index.next.1, %vector.body.1 ], [ 0, %vector.memcheck ]
  %11 = getelementptr inbounds [510 x i8], ptr @vis, i64 0, i64 %index
  %12 = getelementptr inbounds i8, ptr %11, i64 4
  store <4 x i8> zeroinitializer, ptr %11, align 16, !tbaa !9
  store <4 x i8> zeroinitializer, ptr %12, align 4, !tbaa !9
  %13 = getelementptr inbounds i32, ptr %2, i64 %index
  %14 = getelementptr inbounds i8, ptr %13, i64 16
  store <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>, ptr %13, align 4, !tbaa !5
  store <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>, ptr %14, align 4, !tbaa !5
  %15 = getelementptr inbounds i32, ptr %1, i64 %index
  %16 = getelementptr inbounds i8, ptr %15, i64 16
  store <4 x i32> <i32 1061109567, i32 1061109567, i32 1061109567, i32 1061109567>, ptr %15, align 4, !tbaa !5
  store <4 x i32> <i32 1061109567, i32 1061109567, i32 1061109567, i32 1061109567>, ptr %16, align 4, !tbaa !5
  %17 = icmp eq i64 %index, 496
  br i1 %17, label %scalar.ph.preheader, label %vector.body.1, !llvm.loop !11

vector.body.1:                                    ; preds = %vector.body
  %index.next = or disjoint i64 %index, 8
  %18 = getelementptr inbounds [510 x i8], ptr @vis, i64 0, i64 %index.next
  %19 = getelementptr inbounds i8, ptr %18, i64 4
  store <4 x i8> zeroinitializer, ptr %18, align 8, !tbaa !9
  store <4 x i8> zeroinitializer, ptr %19, align 4, !tbaa !9
  %20 = getelementptr inbounds i32, ptr %2, i64 %index.next
  %21 = getelementptr inbounds i8, ptr %20, i64 16
  store <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>, ptr %20, align 4, !tbaa !5
  store <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>, ptr %21, align 4, !tbaa !5
  %22 = getelementptr inbounds i32, ptr %1, i64 %index.next
  %23 = getelementptr inbounds i8, ptr %22, i64 16
  store <4 x i32> <i32 1061109567, i32 1061109567, i32 1061109567, i32 1061109567>, ptr %22, align 4, !tbaa !5
  store <4 x i32> <i32 1061109567, i32 1061109567, i32 1061109567, i32 1061109567>, ptr %23, align 4, !tbaa !5
  %index.next.1 = add nuw nsw i64 %index, 16
  br label %vector.body

.loopexit40:                                      ; preds = %scalar.ph
  %24 = sext i32 %0 to i64
  %25 = getelementptr inbounds i32, ptr %1, i64 %24
  store i32 0, ptr %25, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #4
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %4)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(4) %25, ptr noundef nonnull align 4 dereferenceable(4) %3)
  invoke void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) %4, ptr noundef nonnull align 4 dereferenceable(8) %5)
          to label %32 unwind label %40

scalar.ph:                                        ; preds = %scalar.ph, %scalar.ph.preheader
  %indvars.iv = phi i64 [ %indvars.iv.ph, %scalar.ph.preheader ], [ %indvars.iv.next.1, %scalar.ph ]
  %26 = getelementptr inbounds [510 x i8], ptr @vis, i64 0, i64 %indvars.iv
  store i8 0, ptr %26, align 2, !tbaa !9
  %27 = getelementptr inbounds i32, ptr %2, i64 %indvars.iv
  store i32 -1, ptr %27, align 4, !tbaa !5
  %28 = getelementptr inbounds i32, ptr %1, i64 %indvars.iv
  store i32 1061109567, ptr %28, align 4, !tbaa !5
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %29 = getelementptr inbounds [510 x i8], ptr @vis, i64 0, i64 %indvars.iv.next
  store i8 0, ptr %29, align 1, !tbaa !9
  %30 = getelementptr inbounds i32, ptr %2, i64 %indvars.iv.next
  store i32 -1, ptr %30, align 4, !tbaa !5
  %31 = getelementptr inbounds i32, ptr %1, i64 %indvars.iv.next
  store i32 1061109567, ptr %31, align 4, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, 510
  br i1 %exitcond.not.1, label %.loopexit40, label %scalar.ph, !llvm.loop !15

32:                                               ; preds = %.loopexit40
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  %33 = call noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %4)
  br i1 %33, label %._crit_edge, label %.lr.ph38

.lr.ph38:                                         ; preds = %32, %.loopexit
  %34 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %4)
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %34, i64 4
  %.sroa.4.0.copyload = load i32, ptr %.sroa.4.0..sroa_idx, align 4
  invoke void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %4)
          to label %35 unwind label %42

35:                                               ; preds = %.lr.ph38
  %36 = sext i32 %.sroa.4.0.copyload to i64
  %37 = getelementptr inbounds [510 x i8], ptr @vis, i64 0, i64 %36
  %38 = load i8, ptr %37, align 1, !tbaa !9, !range !16, !noundef !17
  %39 = trunc nuw i8 %38 to i1
  br i1 %39, label %.loopexit, label %44, !llvm.loop !18

40:                                               ; preds = %.loopexit40
  %41 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  br label %67

42:                                               ; preds = %.lr.ph38
  %43 = landingpad { ptr, i32 }
          cleanup
  br label %67

44:                                               ; preds = %35
  store i8 1, ptr %37, align 1, !tbaa !9
  %45 = getelementptr inbounds [510 x i32], ptr @head, i64 0, i64 %36
  %.02735 = load i32, ptr %45, align 4, !tbaa !5
  %.not36 = icmp eq i32 %.02735, 0
  br i1 %.not36, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %44
  %46 = getelementptr inbounds i32, ptr %1, i64 %36
  br label %47

47:                                               ; preds = %.lr.ph, %64
  %.02737 = phi i32 [ %.02735, %.lr.ph ], [ %.027, %64 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #4
  %48 = sext i32 %.02737 to i64
  %49 = getelementptr inbounds [2020 x %struct.edge], ptr @e, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !19
  store i32 %50, ptr %6, align 4, !tbaa !5
  %51 = getelementptr inbounds i8, ptr %49, i64 8
  %52 = load i32, ptr %51, align 4, !tbaa !21
  %53 = sext i32 %50 to i64
  %54 = getelementptr inbounds i32, ptr %1, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = load i32, ptr %46, align 4, !tbaa !5
  %57 = add nsw i32 %56, %52
  %58 = icmp sgt i32 %55, %57
  br i1 %58, label %59, label %64

59:                                               ; preds = %47
  store i32 %57, ptr %54, align 4, !tbaa !5
  %60 = getelementptr inbounds i32, ptr %2, i64 %53
  store i32 %.sroa.4.0.copyload, ptr %60, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %7, ptr noundef nonnull align 4 dereferenceable(4) %54, ptr noundef nonnull align 4 dereferenceable(4) %6)
  invoke void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) %4, ptr noundef nonnull align 4 dereferenceable(8) %7)
          to label %61 unwind label %62

61:                                               ; preds = %59
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  br label %64

62:                                               ; preds = %59
  %63 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #4
  br label %67

64:                                               ; preds = %61, %47
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #4
  %65 = getelementptr inbounds i8, ptr %49, i64 4
  %.027 = load i32, ptr %65, align 4, !tbaa !5
  %.not = icmp eq i32 %.027, 0
  br i1 %.not, label %.loopexit, label %47, !llvm.loop !22

.loopexit:                                        ; preds = %64, %44, %35
  %66 = call noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %4)
  br i1 %66, label %._crit_edge, label %.lr.ph38

._crit_edge:                                      ; preds = %.loopexit, %32
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %4) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #4
  ret void

67:                                               ; preds = %42, %62, %40
  %.pn.pn = phi { ptr, i32 } [ %41, %40 ], [ %63, %62 ], [ %43, %42 ]
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %4) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #4
  resume { ptr, i32 } %.pn.pn
}

; 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 nounwind uwtable
declare dso_local void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #0 align 2

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

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #3 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 = { 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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !12, !13}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = distinct !{!18, !12}
!19 = !{!20, !6, i64 0}
!20 = !{!"_ZTS4edge", !6, i64 0, !6, i64 4, !6, i64 8}
!21 = !{!20, !6, i64 8}
!22 = distinct !{!22, !12}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass