; LLVM IR from Tunghohin/Competitive_Coding :: Luogu/p5960.ll (Z4spfaii)

; 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::stack" = 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 [10010 x i32], align 16
@dist = external dso_local global [10010 x i32], align 16
@vis = external dso_local global [10010 x i8], align 16

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z4spfaii(i32 noundef %0, i32 noundef %1) #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca i1, align 1
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"class.std::stack", 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
  store i32 %0, ptr %4, align 4, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 80, ptr %6) #5
  call void @_ZNSt5stackIiSt5dequeIiSaIiEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %6)
  call void @llvm.memset.p0.i64(ptr align 16 @dist, i8 63, i64 40040, i1 false)
  call void @llvm.memset.p0.i64(ptr align 16 @vis, i8 0, i64 10010, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %15

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

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

20:                                               ; preds = %15
  invoke void @_ZNSt5stackIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %6, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %21 unwind label %30

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

27:                                               ; preds = %21
  %28 = load i32, ptr %8, align 4, !tbaa !5
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr %8, align 4, !tbaa !5
  br label %15, !llvm.loop !11

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

34:                                               ; preds = %19
  br label %35

35:                                               ; preds = %136, %34
  %36 = invoke noundef zeroext i1 @_ZNKSt5stackIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %6)
          to label %37 unwind label %55

37:                                               ; preds = %35
  %38 = xor i1 %36, true
  br i1 %38, label %39, label %138

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

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

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

51:                                               ; preds = %125, %43
  %52 = load i32, ptr %12, align 4, !tbaa !5
  %53 = icmp ne i32 %52, 0
  br i1 %53, label %63, label %54

54:                                               ; preds = %51
  store i32 7, ptr %13, align 4
  br label %131

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

59:                                               ; preds = %41, %39
  %60 = landingpad { ptr, i32 }
          cleanup
  %61 = extractvalue { ptr, i32 } %60, 0
  store ptr %61, ptr %9, align 8
  %62 = extractvalue { ptr, i32 } %60, 1
  store i32 %62, ptr %10, align 4
  br label %137

63:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %64 = load i32, ptr %12, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [10010 x %struct.edge], ptr @e, i64 0, i64 %65
  %67 = getelementptr inbounds %struct.edge, ptr %66, i32 0, i32 0
  %68 = load i32, ptr %67, align 4, !tbaa !13
  store i32 %68, ptr %14, align 4, !tbaa !5
  %69 = load i32, ptr %14, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [10010 x i32], ptr @dist, i64 0, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = load i32, ptr %11, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [10010 x i32], ptr @dist, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = load i32, ptr %12, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [10010 x %struct.edge], ptr @e, i64 0, i64 %78
  %80 = getelementptr inbounds %struct.edge, ptr %79, i32 0, i32 1
  %81 = load i32, ptr %80, align 4, !tbaa !15
  %82 = add nsw i32 %76, %81
  %83 = icmp sgt i32 %72, %82
  br i1 %83, label %84, label %121

84:                                               ; preds = %63
  %85 = load i32, ptr %11, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [10010 x i32], ptr @dist, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = load i32, ptr %12, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [10010 x %struct.edge], ptr @e, i64 0, i64 %90
  %92 = getelementptr inbounds %struct.edge, ptr %91, i32 0, i32 1
  %93 = load i32, ptr %92, align 4, !tbaa !15
  %94 = add nsw i32 %88, %93
  %95 = load i32, ptr %14, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [10010 x i32], ptr @dist, i64 0, i64 %96
  store i32 %94, ptr %97, align 4, !tbaa !5
  %98 = load i32, ptr %14, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [10010 x i8], ptr @vis, i64 0, i64 %99
  %101 = load i8, ptr %100, align 1, !tbaa !9, !range !16, !noundef !17
  %102 = trunc i8 %101 to i1
  br i1 %102, label %120, label %103

103:                                              ; preds = %84
  invoke void @_ZNSt5stackIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %6, ptr noundef nonnull align 4 dereferenceable(4) %14)
          to label %104 unwind label %115

104:                                              ; preds = %103
  %105 = load i32, ptr %14, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [10010 x i8], ptr @vis, i64 0, i64 %106
  store i8 1, ptr %107, align 1, !tbaa !9
  %108 = load i32, ptr %7, align 4, !tbaa !5
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr %7, align 4, !tbaa !5
  %110 = load i32, ptr %7, align 4, !tbaa !5
  %111 = load i32, ptr %4, align 4, !tbaa !5
  %112 = mul nsw i32 4, %111
  %113 = icmp sge i32 %110, %112
  br i1 %113, label %114, label %119

114:                                              ; preds = %104
  store i1 false, ptr %3, align 1
  store i32 1, ptr %13, align 4
  br label %122

115:                                              ; preds = %103
  %116 = landingpad { ptr, i32 }
          cleanup
  %117 = extractvalue { ptr, i32 } %116, 0
  store ptr %117, ptr %9, align 8
  %118 = extractvalue { ptr, i32 } %116, 1
  store i32 %118, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %137

119:                                              ; preds = %104
  br label %120

120:                                              ; preds = %119, %84
  br label %121

121:                                              ; preds = %120, %63
  store i32 0, ptr %13, align 4
  br label %122

122:                                              ; preds = %121, %114
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  %123 = load i32, ptr %13, align 4
  switch i32 %123, label %131 [
    i32 0, label %124
  ]

124:                                              ; preds = %122
  br label %125

125:                                              ; preds = %124
  %126 = load i32, ptr %12, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [10010 x %struct.edge], ptr @e, i64 0, i64 %127
  %129 = getelementptr inbounds %struct.edge, ptr %128, i32 0, i32 2
  %130 = load i32, ptr %129, align 4, !tbaa !18
  store i32 %130, ptr %12, align 4, !tbaa !5
  br label %51, !llvm.loop !19

131:                                              ; preds = %122, %54
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  %132 = load i32, ptr %13, align 4
  switch i32 %132, label %134 [
    i32 7, label %133
  ]

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

134:                                              ; preds = %133, %131
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  %135 = load i32, ptr %13, align 4
  switch i32 %135, label %139 [
    i32 0, label %136
  ]

136:                                              ; preds = %134
  br label %35, !llvm.loop !20

137:                                              ; preds = %115, %59
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %141

138:                                              ; preds = %37
  store i1 true, ptr %3, align 1
  store i32 1, ptr %13, align 4
  br label %139

139:                                              ; preds = %138, %134
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @_ZNSt5stackIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %6) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr %6) #5
  %140 = load i1, ptr %3, align 1
  ret i1 %140

141:                                              ; preds = %137, %55, %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @_ZNSt5stackIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %6) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr %6) #5
  br label %142

142:                                              ; preds = %141
  %143 = load ptr, ptr %9, align 8
  %144 = load i32, ptr %10, align 4
  %145 = insertvalue { ptr, i32 } poison, ptr %143, 0
  %146 = insertvalue { ptr, i32 } %145, i32 %144, 1
  resume { ptr, i32 } %146
}

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5stackIiSt5dequeIiSaIiEEE4pushERKi(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) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt5stackIiSt5dequeIiSaIiEEE5emptyEv(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 @_ZNSt5stackIiSt5dequeIiSaIiEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80)) #3 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt5stackIiSt5dequeIiSaIiEEED2Ev(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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!14, !6, i64 0}
!14 = !{!"_ZTS4edge", !6, i64 0, !6, i64 4, !6, i64 8}
!15 = !{!14, !6, i64 4}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!14, !6, i64 8}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}


; 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::stack" = 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 [10010 x i32], align 16
@dist = external dso_local local_unnamed_addr global [10010 x i32], align 16
@vis = external dso_local local_unnamed_addr global [10010 x i8], align 16

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z4spfaii(i32 noundef %0, i32 noundef %1) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::stack", align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %3) #5
  call void @_ZNSt5stackIiSt5dequeIiSaIiEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40040) @dist, i8 63, i64 40040, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(10010) @vis, i8 0, i64 10010, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  store i32 1, ptr %4, align 4, !tbaa !5
  %.not48 = icmp slt i32 %1, 1
  br i1 %.not48, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %8, %2
  %.026.lcssa = phi i32 [ 0, %2 ], [ %12, %8 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  %6 = call noundef zeroext i1 @_ZNKSt5stackIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  br i1 %6, label %.thread40, label %.lr.ph59

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

.lr.ph:                                           ; preds = %2, %8
  %.02649 = phi i32 [ %12, %8 ], [ 0, %2 ]
  invoke void @_ZNSt5stackIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %8 unwind label %14

8:                                                ; preds = %.lr.ph
  %9 = load i32, ptr %4, align 4, !tbaa !5
  %10 = sext i32 %9 to i64
  %11 = getelementptr inbounds [10010 x i8], ptr @vis, i64 0, i64 %10
  store i8 1, ptr %11, align 1, !tbaa !9
  %12 = add nuw nsw i32 %.02649, 1
  %13 = add nsw i32 %9, 1
  store i32 %13, 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

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

.loopexit:                                        ; preds = %48, %17
  %.228.lcssa = phi i32 [ %.12757, %17 ], [ %.43039, %48 ]
  %16 = call noundef zeroext i1 @_ZNKSt5stackIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  br i1 %16, label %.thread40, label %17, !llvm.loop !13

17:                                               ; preds = %.lr.ph59, %.loopexit
  %.12757 = phi i32 [ %.026.lcssa, %.lr.ph59 ], [ %.228.lcssa, %.loopexit ]
  %18 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5stackIiSt5dequeIiSaIiEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %19 = load i32, ptr %18, align 4, !tbaa !5
  call void @_ZNSt5stackIiSt5dequeIiSaIiEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [10010 x i8], ptr @vis, i64 0, i64 %20
  store i8 0, ptr %21, align 1, !tbaa !9
  %22 = getelementptr inbounds [10010 x i32], ptr @head, i64 0, i64 %20
  %.02150 = load i32, ptr %22, align 4, !tbaa !5
  %.not3451 = icmp eq i32 %.02150, 0
  br i1 %.not3451, label %.loopexit, label %.lr.ph55

.lr.ph55:                                         ; preds = %17
  %23 = getelementptr inbounds [10010 x i32], ptr @dist, i64 0, i64 %20
  br label %24

24:                                               ; preds = %.lr.ph55, %48
  %.02153 = phi i32 [ %.02150, %.lr.ph55 ], [ %.021, %48 ]
  %.22852 = phi i32 [ %.12757, %.lr.ph55 ], [ %.43039, %48 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  %25 = sext i32 %.02153 to i64
  %26 = getelementptr inbounds [10010 x %struct.edge], ptr @e, i64 0, i64 %25
  %27 = load i32, ptr %26, align 4, !tbaa !14
  store i32 %27, ptr %5, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [10010 x i32], ptr @dist, i64 0, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %31 = load i32, ptr %23, align 4, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %26, i64 4
  %33 = load i32, ptr %32, align 4, !tbaa !16
  %34 = add nsw i32 %33, %31
  %35 = icmp sgt i32 %30, %34
  br i1 %35, label %36, label %.thread

36:                                               ; preds = %24
  store i32 %34, ptr %29, align 4, !tbaa !5
  %37 = getelementptr inbounds [10010 x i8], ptr @vis, i64 0, i64 %28
  %38 = load i8, ptr %37, align 1, !tbaa !9, !range !17, !noundef !18
  %39 = trunc nuw i8 %38 to i1
  br i1 %39, label %.thread, label %40

40:                                               ; preds = %36
  invoke void @_ZNSt5stackIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(4) %5)
          to label %43 unwind label %41

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

.thread:                                          ; preds = %36, %24
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  br label %48

43:                                               ; preds = %40
  %44 = load i32, ptr %5, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [10010 x i8], ptr @vis, i64 0, i64 %45
  store i8 1, ptr %46, align 1, !tbaa !9
  %47 = add nsw i32 %.22852, 1
  %.not35 = icmp slt i32 %47, %7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  br i1 %.not35, label %48, label %.thread40

48:                                               ; preds = %.thread, %43
  %.43039 = phi i32 [ %.22852, %.thread ], [ %47, %43 ]
  %49 = getelementptr inbounds i8, ptr %26, i64 8
  %.021 = load i32, ptr %49, align 4, !tbaa !5
  %.not34 = icmp eq i32 %.021, 0
  br i1 %.not34, label %.loopexit, label %24, !llvm.loop !19

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

51:                                               ; preds = %41, %14
  %.pn = phi { ptr, i32 } [ %15, %14 ], [ %42, %41 ]
  call void @_ZNSt5stackIiSt5dequeIiSaIiEEED2Ev(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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5stackIiSt5dequeIiSaIiEEE4pushERKi(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) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt5stackIiSt5dequeIiSaIiEEE5emptyEv(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 @_ZNSt5stackIiSt5dequeIiSaIiEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #3 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt5stackIiSt5dequeIiSaIiEEED2Ev(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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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, !6, i64 8}
!16 = !{!15, !6, i64 4}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = distinct !{!19, !12}


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