; LLVM IR from Tunghohin/Competitive_Coding :: Luogu/p3199.ll (Z5checkdi)

; 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, double }
%"class.std::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl" }
%"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl" = type { %"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl_data" }
%"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }

@e = external dso_local global [10010 x %struct.edge], align 16
@head = external dso_local global [3010 x i32], align 16
@dist = external dso_local global [3010 x double], align 16
@vis = external dso_local global [3010 x i8], align 16
@cnt = external dso_local global [3010 x i32], align 16

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z5checkdi(double noundef %0, i32 noundef %1) #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca i1, align 1
  %4 = alloca double, align 8
  %5 = alloca i32, align 4
  %6 = alloca %"class.std::queue", align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca double, align 8
  store double %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  call void @llvm.memset.p0.i64(ptr align 16 @dist, i8 0, i64 24080, i1 false)
  call void @llvm.memset.p0.i64(ptr align 16 @vis, i8 0, i64 3010, i1 false)
  call void @llvm.memset.p0.i64(ptr align 16 @cnt, i8 0, i64 12040, i1 false)
  call void @llvm.lifetime.start.p0(i64 80, ptr %6) #5
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %6)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 1, ptr %8, align 4, !tbaa !9
  br label %16

16:                                               ; preds = %26, %2
  %17 = load i32, ptr %8, align 4, !tbaa !9
  %18 = load i32, ptr %5, align 4, !tbaa !9
  %19 = icmp sle i32 %17, %18
  br i1 %19, label %21, label %20

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

21:                                               ; preds = %16
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %6, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %22 unwind label %29

22:                                               ; preds = %21
  %23 = load i32, ptr %8, align 4, !tbaa !9
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [3010 x i8], ptr @vis, i64 0, i64 %24
  store i8 1, ptr %25, align 1, !tbaa !11
  br label %26

26:                                               ; preds = %22
  %27 = load i32, ptr %8, align 4, !tbaa !9
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %8, align 4, !tbaa !9
  br label %16, !llvm.loop !13

29:                                               ; preds = %21
  %30 = landingpad { ptr, i32 }
          cleanup
  %31 = extractvalue { ptr, i32 } %30, 0
  store ptr %31, ptr %9, align 8
  %32 = extractvalue { ptr, i32 } %30, 1
  store i32 %32, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %154

33:                                               ; preds = %20
  br label %34

34:                                               ; preds = %149, %33
  %35 = invoke noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %6)
          to label %36 unwind label %54

36:                                               ; preds = %34
  %37 = xor i1 %35, true
  br i1 %37, label %38, label %151

38:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %39 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5queueIiSt5dequeIiSaIiEEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %6)
          to label %40 unwind label %58

40:                                               ; preds = %38
  %41 = load i32, ptr %39, align 4, !tbaa !9
  store i32 %41, ptr %11, align 4, !tbaa !9
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %6)
          to label %42 unwind label %58

42:                                               ; preds = %40
  %43 = load i32, ptr %11, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [3010 x i8], ptr @vis, i64 0, i64 %44
  store i8 0, ptr %45, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %46 = load i32, ptr %11, align 4, !tbaa !9
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [3010 x i32], ptr @head, i64 0, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !9
  store i32 %49, ptr %12, align 4, !tbaa !9
  br label %50

50:                                               ; preds = %138, %42
  %51 = load i32, ptr %12, align 4, !tbaa !9
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %62, label %53

53:                                               ; preds = %50
  store i32 7, ptr %13, align 4
  br label %144

54:                                               ; preds = %34
  %55 = landingpad { ptr, i32 }
          cleanup
  %56 = extractvalue { ptr, i32 } %55, 0
  store ptr %56, ptr %9, align 8
  %57 = extractvalue { ptr, i32 } %55, 1
  store i32 %57, ptr %10, align 4
  br label %154

58:                                               ; preds = %40, %38
  %59 = landingpad { ptr, i32 }
          cleanup
  %60 = extractvalue { ptr, i32 } %59, 0
  store ptr %60, ptr %9, align 8
  %61 = extractvalue { ptr, i32 } %59, 1
  store i32 %61, ptr %10, align 4
  br label %150

62:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %63 = load i32, ptr %12, align 4, !tbaa !9
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [10010 x %struct.edge], ptr @e, i64 0, i64 %64
  %66 = getelementptr inbounds %struct.edge, ptr %65, i32 0, i32 0
  %67 = load i32, ptr %66, align 16, !tbaa !15
  store i32 %67, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %68 = load i32, ptr %12, align 4, !tbaa !9
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [10010 x %struct.edge], ptr @e, i64 0, i64 %69
  %71 = getelementptr inbounds %struct.edge, ptr %70, i32 0, i32 2
  %72 = load double, ptr %71, align 8, !tbaa !17
  %73 = load double, ptr %4, align 8, !tbaa !5
  %74 = fsub double %72, %73
  store double %74, ptr %15, align 8, !tbaa !5
  %75 = load i32, ptr %14, align 4, !tbaa !9
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [3010 x double], ptr @dist, i64 0, i64 %76
  %78 = load double, ptr %77, align 8, !tbaa !5
  %79 = load i32, ptr %11, align 4, !tbaa !9
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [3010 x double], ptr @dist, i64 0, i64 %80
  %82 = load double, ptr %81, align 8, !tbaa !5
  %83 = load double, ptr %15, align 8, !tbaa !5
  %84 = fadd double %82, %83
  %85 = fcmp ogt double %78, %84
  br i1 %85, label %86, label %134

86:                                               ; preds = %62
  %87 = load i32, ptr %11, align 4, !tbaa !9
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [3010 x double], ptr @dist, i64 0, i64 %88
  %90 = load double, ptr %89, align 8, !tbaa !5
  %91 = load double, ptr %15, align 8, !tbaa !5
  %92 = fadd double %90, %91
  %93 = load i32, ptr %14, align 4, !tbaa !9
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [3010 x double], ptr @dist, i64 0, i64 %94
  store double %92, ptr %95, align 8, !tbaa !5
  %96 = load i32, ptr %11, align 4, !tbaa !9
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [3010 x i32], ptr @cnt, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !9
  %100 = add nsw i32 %99, 1
  %101 = load i32, ptr %14, align 4, !tbaa !9
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [3010 x i32], ptr @cnt, i64 0, i64 %102
  store i32 %100, ptr %103, align 4, !tbaa !9
  %104 = load i32, ptr %14, align 4, !tbaa !9
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [3010 x i32], ptr @cnt, i64 0, i64 %105
  %107 = load i32, ptr %106, align 4, !tbaa !9
  %108 = load i32, ptr %5, align 4, !tbaa !9
  %109 = icmp sge i32 %107, %108
  br i1 %109, label %115, label %110

110:                                              ; preds = %86
  %111 = load i32, ptr %7, align 4, !tbaa !9
  %112 = load i32, ptr %5, align 4, !tbaa !9
  %113 = mul nsw i32 4, %112
  %114 = icmp sgt i32 %111, %113
  br i1 %114, label %115, label %116

115:                                              ; preds = %110, %86
  store i1 true, ptr %3, align 1
  store i32 1, ptr %13, align 4
  br label %135

116:                                              ; preds = %110
  %117 = load i32, ptr %14, align 4, !tbaa !9
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [3010 x i8], ptr @vis, i64 0, i64 %118
  %120 = load i8, ptr %119, align 1, !tbaa !11, !range !18, !noundef !19
  %121 = trunc i8 %120 to i1
  br i1 %121, label %133, label %122

122:                                              ; preds = %116
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %6, ptr noundef nonnull align 4 dereferenceable(4) %14)
          to label %123 unwind label %129

123:                                              ; preds = %122
  %124 = load i32, ptr %14, align 4, !tbaa !9
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [3010 x i8], ptr @vis, i64 0, i64 %125
  store i8 1, ptr %126, align 1, !tbaa !11
  %127 = load i32, ptr %7, align 4, !tbaa !9
  %128 = add nsw i32 %127, 1
  store i32 %128, ptr %7, align 4, !tbaa !9
  br label %133

129:                                              ; preds = %122
  %130 = landingpad { ptr, i32 }
          cleanup
  %131 = extractvalue { ptr, i32 } %130, 0
  store ptr %131, ptr %9, align 8
  %132 = extractvalue { ptr, i32 } %130, 1
  store i32 %132, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %150

133:                                              ; preds = %123, %116
  br label %134

134:                                              ; preds = %133, %62
  store i32 0, ptr %13, align 4
  br label %135

135:                                              ; preds = %134, %115
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  %136 = load i32, ptr %13, align 4
  switch i32 %136, label %144 [
    i32 0, label %137
  ]

137:                                              ; preds = %135
  br label %138

138:                                              ; preds = %137
  %139 = load i32, ptr %12, align 4, !tbaa !9
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [10010 x %struct.edge], ptr @e, i64 0, i64 %140
  %142 = getelementptr inbounds %struct.edge, ptr %141, i32 0, i32 1
  %143 = load i32, ptr %142, align 4, !tbaa !20
  store i32 %143, ptr %12, align 4, !tbaa !9
  br label %50, !llvm.loop !21

144:                                              ; preds = %135, %53
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  %145 = load i32, ptr %13, align 4
  switch i32 %145, label %147 [
    i32 7, label %146
  ]

146:                                              ; preds = %144
  store i32 0, ptr %13, align 4
  br label %147

147:                                              ; preds = %146, %144
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  %148 = load i32, ptr %13, align 4
  switch i32 %148, label %152 [
    i32 0, label %149
  ]

149:                                              ; preds = %147
  br label %34, !llvm.loop !22

150:                                              ; preds = %129, %58
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %154

151:                                              ; preds = %36
  store i1 false, ptr %3, align 1
  store i32 1, ptr %13, align 4
  br label %152

152:                                              ; preds = %151, %147
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %6) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr %6) #5
  %153 = load i1, ptr %3, align 1
  ret i1 %153

154:                                              ; preds = %150, %54, %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %6) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr %6) #5
  br label %155

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

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) 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 nounwind willreturn memory(argmem: write) }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 = { 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 = !{!"double", !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, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !10, i64 0}
!16 = !{!"_ZTS4edge", !10, i64 0, !10, i64 4, !6, i64 8}
!17 = !{!16, !6, i64 8}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = !{!16, !10, i64 4}
!21 = distinct !{!21, !14}
!22 = distinct !{!22, !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, double }
%"class.std::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl" }
%"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl" = type { %"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl_data" }
%"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }

@e = external dso_local local_unnamed_addr global [10010 x %struct.edge], align 16
@head = external dso_local local_unnamed_addr global [3010 x i32], align 16
@dist = external dso_local local_unnamed_addr global [3010 x double], align 16
@vis = external dso_local local_unnamed_addr global [3010 x i8], align 16
@cnt = external dso_local local_unnamed_addr global [3010 x i32], align 16

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z5checkdi(double noundef %0, i32 noundef %1) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::queue", align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(24080) @dist, i8 0, i64 24080, i1 false)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(3010) @vis, i8 0, i64 3010, i1 false)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(12040) @cnt, i8 0, i64 12040, i1 false)
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %3) #5
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  store i32 1, ptr %4, align 4, !tbaa !5
  %.not50 = icmp slt i32 %1, 1
  br i1 %.not50, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %8, %2
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  %6 = call noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  br i1 %6, label %.loopexit45, label %.lr.ph59

.lr.ph59:                                         ; preds = %._crit_edge
  %7 = shl nsw i32 %1, 2
  br label %16

.lr.ph:                                           ; preds = %2, %8
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %8 unwind label %13

8:                                                ; preds = %.lr.ph
  %9 = load i32, ptr %4, align 4, !tbaa !5
  %10 = sext i32 %9 to i64
  %11 = getelementptr inbounds [3010 x i8], ptr @vis, i64 0, i64 %10
  store i8 1, ptr %11, align 1, !tbaa !9
  %12 = add nsw i32 %9, 1
  store i32 %12, ptr %4, align 4, !tbaa !5
  %.not.not = icmp slt i32 %9, %1
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !11

13:                                               ; preds = %.lr.ph
  %14 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  br label %56

.loopexit:                                        ; preds = %54, %16
  %.128.lcssa = phi i32 [ %.02757, %16 ], [ %.330.ph, %54 ]
  %15 = call noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  br i1 %15, label %.loopexit45, label %16, !llvm.loop !13

16:                                               ; preds = %.lr.ph59, %.loopexit
  %.02757 = phi i32 [ 0, %.lr.ph59 ], [ %.128.lcssa, %.loopexit ]
  %17 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5queueIiSt5dequeIiSaIiEEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %18 = load i32, ptr %17, align 4, !tbaa !5
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [3010 x i8], ptr @vis, i64 0, i64 %19
  store i8 0, ptr %20, align 1, !tbaa !9
  %21 = getelementptr inbounds [3010 x i32], ptr @head, i64 0, i64 %19
  %.02651 = load i32, ptr %21, align 4, !tbaa !5
  %.not3652 = icmp eq i32 %.02651, 0
  br i1 %.not3652, label %.loopexit, label %.lr.ph56

.lr.ph56:                                         ; preds = %16
  %22 = getelementptr inbounds [3010 x double], ptr @dist, i64 0, i64 %19
  %23 = getelementptr inbounds [3010 x i32], ptr @cnt, i64 0, i64 %19
  br label %24

24:                                               ; preds = %.lr.ph56, %54
  %.02654 = phi i32 [ %.02651, %.lr.ph56 ], [ %.026, %54 ]
  %.12853 = phi i32 [ %.02757, %.lr.ph56 ], [ %.330.ph, %54 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  %25 = sext i32 %.02654 to i64
  %26 = getelementptr inbounds [10010 x %struct.edge], ptr @e, i64 0, i64 %25
  %27 = load i32, ptr %26, align 16, !tbaa !14
  store i32 %27, ptr %5, align 4, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %26, i64 8
  %29 = load double, ptr %28, align 8, !tbaa !17
  %30 = fsub double %29, %0
  %31 = sext i32 %27 to i64
  %32 = getelementptr inbounds [3010 x double], ptr @dist, i64 0, i64 %31
  %33 = load double, ptr %32, align 8, !tbaa !18
  %34 = load double, ptr %22, align 8, !tbaa !18
  %35 = fadd double %30, %34
  %36 = fcmp ogt double %33, %35
  br i1 %36, label %37, label %54

37:                                               ; preds = %24
  store double %35, ptr %32, align 8, !tbaa !18
  %38 = load i32, ptr %23, align 4, !tbaa !5
  %39 = add nsw i32 %38, 1
  %40 = getelementptr inbounds [3010 x i32], ptr @cnt, i64 0, i64 %31
  store i32 %39, ptr %40, align 4, !tbaa !5
  %.not37 = icmp sge i32 %39, %1
  %41 = icmp sgt i32 %.12853, %7
  %or.cond = select i1 %.not37, i1 true, i1 %41
  br i1 %or.cond, label %.thread43, label %42

42:                                               ; preds = %37
  %43 = getelementptr inbounds [3010 x i8], ptr @vis, i64 0, i64 %31
  %44 = load i8, ptr %43, align 1, !tbaa !9, !range !19, !noundef !20
  %45 = trunc nuw i8 %44 to i1
  br i1 %45, label %54, label %46

46:                                               ; preds = %42
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(4) %5)
          to label %47 unwind label %52

47:                                               ; preds = %46
  %48 = load i32, ptr %5, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [3010 x i8], ptr @vis, i64 0, i64 %49
  store i8 1, ptr %50, align 1, !tbaa !9
  %51 = add nsw i32 %.12853, 1
  br label %54

52:                                               ; preds = %46
  %53 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  br label %56

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

54:                                               ; preds = %42, %47, %24
  %.330.ph = phi i32 [ %.12853, %24 ], [ %51, %47 ], [ %.12853, %42 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  %55 = getelementptr inbounds i8, ptr %26, i64 4
  %.026 = load i32, ptr %55, align 4, !tbaa !5
  %.not36 = icmp eq i32 %.026, 0
  br i1 %.not36, label %.loopexit, label %24, !llvm.loop !21

.loopexit45:                                      ; preds = %.loopexit, %._crit_edge, %.thread43
  %.4 = phi i1 [ true, %.thread43 ], [ false, %._crit_edge ], [ false, %.loopexit ]
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %3) #5
  ret i1 %.4

56:                                               ; preds = %52, %13
  %.pn = phi { ptr, i32 } [ %14, %13 ], [ %53, %52 ]
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %3) #5
  resume { ptr, i32 } %.pn
}

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 = { 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 = !{!"bool", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!15, !6, i64 0}
!15 = !{!"_ZTS4edge", !6, i64 0, !6, i64 4, !16, i64 8}
!16 = !{!"double", !7, i64 0}
!17 = !{!15, !16, i64 8}
!18 = !{!16, !16, i64 0}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = distinct !{!21, !12}


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