; LLVM IR from lzyrapx/Competitive-Programming :: 51Nod/1459（最短路径）（spfa）.ll (Z4spfav)

; 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.node = type { i32, i32, i32, i32 }
%"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 }

@n = external dso_local global i32, align 4
@s = external dso_local global i32, align 4
@w = external dso_local global [1010 x i32], align 16
@edge = external dso_local global [251000 x %struct.node], align 16
@head = external dso_local global [1010 x i32], align 16
@q1 = external dso_local global %"class.std::deque", align 8
@d = external dso_local global [1010 x i32], align 16
@f = external dso_local global [1010 x i32], align 16
@vis = external dso_local global [1010 x i8], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z4spfav() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %5

5:                                                ; preds = %14, %0
  %6 = load i32, ptr %1, align 4, !tbaa !5
  %7 = load i32, ptr @n, align 4, !tbaa !5
  %8 = icmp slt i32 %6, %7
  br i1 %8, label %10, label %9

9:                                                ; preds = %5
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #4
  br label %17

10:                                               ; preds = %5
  %11 = load i32, ptr %1, align 4, !tbaa !5
  %12 = sext i32 %11 to i64
  %13 = getelementptr inbounds [1010 x i32], ptr @d, i64 0, i64 %12
  store i32 1000000007, ptr %13, align 4, !tbaa !5
  br label %14

14:                                               ; preds = %10
  %15 = load i32, ptr %1, align 4, !tbaa !5
  %16 = add nsw i32 %15, 1
  store i32 %16, ptr %1, align 4, !tbaa !5
  br label %5, !llvm.loop !9

17:                                               ; preds = %9
  %18 = load i32, ptr @s, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [1010 x i32], ptr @d, i64 0, i64 %19
  store i32 0, ptr %20, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 16 @f, i8 0, i64 4040, i1 false)
  call void @llvm.memset.p0.i64(ptr align 16 @vis, i8 0, i64 1010, i1 false)
  call void @_ZNSt5dequeIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(80) @q1, ptr noundef nonnull align 4 dereferenceable(4) @s)
  %21 = load i32, ptr @s, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [1010 x i8], ptr @vis, i64 0, i64 %22
  store i8 1, ptr %23, align 1, !tbaa !11
  br label %24

24:                                               ; preds = %194, %17
  %25 = call noundef zeroext i1 @_ZNKSt5dequeIiSaIiEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) @q1) #4
  %26 = xor i1 %25, true
  br i1 %26, label %27, label %195

27:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  %28 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5dequeIiSaIiEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) @q1) #4
  %29 = load i32, ptr %28, align 4, !tbaa !5
  store i32 %29, ptr %2, align 4, !tbaa !5
  call void @_ZNSt5dequeIiSaIiEE9pop_frontEv(ptr noundef nonnull align 8 dereferenceable(80) @q1) #4
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [1010 x i8], ptr @vis, i64 0, i64 %31
  store i8 0, ptr %32, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [1010 x i32], ptr @head, i64 0, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !5
  store i32 %36, ptr %3, align 4, !tbaa !5
  br label %37

37:                                               ; preds = %188, %27
  %38 = load i32, ptr %3, align 4, !tbaa !5
  %39 = icmp ne i32 %38, -1
  br i1 %39, label %41, label %40

40:                                               ; preds = %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %194

41:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %42 = load i32, ptr %3, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [251000 x %struct.node], ptr @edge, i64 0, i64 %43
  %45 = getelementptr inbounds %struct.node, ptr %44, i32 0, i32 1
  %46 = load i32, ptr %45, align 4, !tbaa !13
  store i32 %46, ptr %4, align 4, !tbaa !5
  %47 = load i32, ptr %4, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [1010 x i32], ptr @d, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = load i32, ptr %2, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [1010 x i32], ptr @d, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = load i32, ptr %3, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [251000 x %struct.node], ptr @edge, i64 0, i64 %56
  %58 = getelementptr inbounds %struct.node, ptr %57, i32 0, i32 2
  %59 = load i32, ptr %58, align 8, !tbaa !15
  %60 = add nsw i32 %54, %59
  %61 = icmp sgt i32 %50, %60
  br i1 %61, label %62, label %115

62:                                               ; preds = %41
  %63 = load i32, ptr %2, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [1010 x i32], ptr @d, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = load i32, ptr %3, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [251000 x %struct.node], ptr @edge, i64 0, i64 %68
  %70 = getelementptr inbounds %struct.node, ptr %69, i32 0, i32 2
  %71 = load i32, ptr %70, align 8, !tbaa !15
  %72 = add nsw i32 %66, %71
  %73 = load i32, ptr %4, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [1010 x i32], ptr @d, i64 0, i64 %74
  store i32 %72, ptr %75, align 4, !tbaa !5
  %76 = load i32, ptr %2, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [1010 x i32], ptr @f, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = load i32, ptr %4, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [1010 x i32], ptr @w, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = add nsw i32 %79, %83
  %85 = load i32, ptr %4, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [1010 x i32], ptr @f, i64 0, i64 %86
  store i32 %84, ptr %87, align 4, !tbaa !5
  %88 = load i32, ptr %4, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [1010 x i8], ptr @vis, i64 0, i64 %89
  %91 = load i8, ptr %90, align 1, !tbaa !11, !range !16, !noundef !17
  %92 = trunc i8 %91 to i1
  br i1 %92, label %114, label %93

93:                                               ; preds = %62
  %94 = load i32, ptr %4, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [1010 x i8], ptr @vis, i64 0, i64 %95
  store i8 1, ptr %96, align 1, !tbaa !11
  %97 = call noundef zeroext i1 @_ZNKSt5dequeIiSaIiEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) @q1) #4
  br i1 %97, label %112, label %98

98:                                               ; preds = %93
  %99 = load i32, ptr %4, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [1010 x i32], ptr @d, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5dequeIiSaIiEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) @q1) #4
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [1010 x i32], ptr @d, i64 0, i64 %105
  %107 = load i32, ptr %106, align 4, !tbaa !5
  %108 = icmp sgt i32 %102, %107
  br i1 %108, label %109, label %110

109:                                              ; preds = %98
  call void @_ZNSt5dequeIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(80) @q1, ptr noundef nonnull align 4 dereferenceable(4) %4)
  br label %111

110:                                              ; preds = %98
  call void @_ZNSt5dequeIiSaIiEE10push_frontERKi(ptr noundef nonnull align 8 dereferenceable(80) @q1, ptr noundef nonnull align 4 dereferenceable(4) %4)
  br label %111

111:                                              ; preds = %110, %109
  br label %113

112:                                              ; preds = %93
  call void @_ZNSt5dequeIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(80) @q1, ptr noundef nonnull align 4 dereferenceable(4) %4)
  br label %113

113:                                              ; preds = %112, %111
  br label %114

114:                                              ; preds = %113, %62
  br label %187

115:                                              ; preds = %41
  %116 = load i32, ptr %4, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [1010 x i32], ptr @d, i64 0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = load i32, ptr %2, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [1010 x i32], ptr @d, i64 0, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !5
  %124 = load i32, ptr %3, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [251000 x %struct.node], ptr @edge, i64 0, i64 %125
  %127 = getelementptr inbounds %struct.node, ptr %126, i32 0, i32 2
  %128 = load i32, ptr %127, align 8, !tbaa !15
  %129 = add nsw i32 %123, %128
  %130 = icmp eq i32 %119, %129
  br i1 %130, label %131, label %186

131:                                              ; preds = %115
  %132 = load i32, ptr %4, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [1010 x i32], ptr @f, i64 0, i64 %133
  %135 = load i32, ptr %134, align 4, !tbaa !5
  %136 = load i32, ptr %2, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [1010 x i32], ptr @f, i64 0, i64 %137
  %139 = load i32, ptr %138, align 4, !tbaa !5
  %140 = load i32, ptr %4, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [1010 x i32], ptr @w, i64 0, i64 %141
  %143 = load i32, ptr %142, align 4, !tbaa !5
  %144 = add nsw i32 %139, %143
  %145 = icmp sle i32 %135, %144
  br i1 %145, label %146, label %186

146:                                              ; preds = %131
  %147 = load i32, ptr %2, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [1010 x i32], ptr @f, i64 0, i64 %148
  %150 = load i32, ptr %149, align 4, !tbaa !5
  %151 = load i32, ptr %4, align 4, !tbaa !5
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [1010 x i32], ptr @w, i64 0, i64 %152
  %154 = load i32, ptr %153, align 4, !tbaa !5
  %155 = add nsw i32 %150, %154
  %156 = load i32, ptr %4, align 4, !tbaa !5
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [1010 x i32], ptr @f, i64 0, i64 %157
  store i32 %155, ptr %158, align 4, !tbaa !5
  %159 = load i32, ptr %4, align 4, !tbaa !5
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [1010 x i8], ptr @vis, i64 0, i64 %160
  %162 = load i8, ptr %161, align 1, !tbaa !11, !range !16, !noundef !17
  %163 = trunc i8 %162 to i1
  br i1 %163, label %185, label %164

164:                                              ; preds = %146
  %165 = load i32, ptr %4, align 4, !tbaa !5
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [1010 x i8], ptr @vis, i64 0, i64 %166
  store i8 1, ptr %167, align 1, !tbaa !11
  %168 = call noundef zeroext i1 @_ZNKSt5dequeIiSaIiEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) @q1) #4
  br i1 %168, label %183, label %169

169:                                              ; preds = %164
  %170 = load i32, ptr %4, align 4, !tbaa !5
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [1010 x i32], ptr @d, i64 0, i64 %171
  %173 = load i32, ptr %172, align 4, !tbaa !5
  %174 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5dequeIiSaIiEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) @q1) #4
  %175 = load i32, ptr %174, align 4, !tbaa !5
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [1010 x i32], ptr @d, i64 0, i64 %176
  %178 = load i32, ptr %177, align 4, !tbaa !5
  %179 = icmp sgt i32 %173, %178
  br i1 %179, label %180, label %181

180:                                              ; preds = %169
  call void @_ZNSt5dequeIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(80) @q1, ptr noundef nonnull align 4 dereferenceable(4) %4)
  br label %182

181:                                              ; preds = %169
  call void @_ZNSt5dequeIiSaIiEE10push_frontERKi(ptr noundef nonnull align 8 dereferenceable(80) @q1, ptr noundef nonnull align 4 dereferenceable(4) %4)
  br label %182

182:                                              ; preds = %181, %180
  br label %184

183:                                              ; preds = %164
  call void @_ZNSt5dequeIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(80) @q1, ptr noundef nonnull align 4 dereferenceable(4) %4)
  br label %184

184:                                              ; preds = %183, %182
  br label %185

185:                                              ; preds = %184, %146
  br label %186

186:                                              ; preds = %185, %131, %115
  br label %187

187:                                              ; preds = %186, %114
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %188

188:                                              ; preds = %187
  %189 = load i32, ptr %3, align 4, !tbaa !5
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds [251000 x %struct.node], ptr @edge, i64 0, i64 %190
  %192 = getelementptr inbounds %struct.node, ptr %191, i32 0, i32 3
  %193 = load i32, ptr %192, align 4, !tbaa !18
  store i32 %193, ptr %3, align 4, !tbaa !5
  br label %37, !llvm.loop !19

194:                                              ; preds = %40
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %24, !llvm.loop !20

195:                                              ; preds = %24
  ret void
}

; 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: 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 @_ZNSt5dequeIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 4 dereferenceable(4)) #0 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5dequeIiSaIiEE10push_frontERKi(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 4 dereferenceable(4)) #0 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 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!14, !6, i64 4}
!14 = !{!"_ZTS4node", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12}
!15 = !{!14, !6, i64 8}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!14, !6, i64 12}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}


; 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.node = type { i32, i32, i32, i32 }
%"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 }

@n = external dso_local local_unnamed_addr global i32, align 4
@s = external dso_local global i32, align 4
@w = external dso_local local_unnamed_addr global [1010 x i32], align 16
@edge = external dso_local local_unnamed_addr global [251000 x %struct.node], align 16
@head = external dso_local local_unnamed_addr global [1010 x i32], align 16
@q1 = external dso_local global %"class.std::deque", align 8
@d = external dso_local local_unnamed_addr global [1010 x i32], align 16
@f = external dso_local local_unnamed_addr global [1010 x i32], align 16
@vis = external dso_local local_unnamed_addr global [1010 x i8], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z4spfav() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = load i32, ptr @n, align 4, !tbaa !5
  %3 = icmp sgt i32 %2, 0
  br i1 %3, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %0
  %wide.trip.count = zext nneg i32 %2 to i64
  %min.iters.check = icmp ult i32 %2, 8
  br i1 %min.iters.check, label %.lr.ph.preheader32, label %vector.ph

.lr.ph.preheader32:                               ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %wide.trip.count, 2147483640
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %4 = getelementptr inbounds [1010 x i32], ptr @d, i64 0, i64 %index
  %5 = getelementptr inbounds i8, ptr %4, i64 16
  store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %4, align 16, !tbaa !5
  store <4 x i32> <i32 1000000007, i32 1000000007, i32 1000000007, i32 1000000007>, ptr %5, align 16, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %6 = icmp eq i64 %index.next, %n.vec
  br i1 %6, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader32

._crit_edge:                                      ; preds = %.lr.ph, %middle.block, %0
  %7 = load i32, ptr @s, align 4, !tbaa !5
  %8 = sext i32 %7 to i64
  %9 = getelementptr inbounds [1010 x i32], ptr @d, i64 0, i64 %8
  store i32 0, ptr %9, align 4, !tbaa !5
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4040) @f, i8 0, i64 4040, i1 false)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1010) @vis, i8 0, i64 1010, i1 false)
  tail call void @_ZNSt5dequeIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(80) @q1, ptr noundef nonnull align 4 dereferenceable(4) @s)
  %10 = load i32, ptr @s, align 4, !tbaa !5
  %11 = sext i32 %10 to i64
  %12 = getelementptr inbounds [1010 x i8], ptr @vis, i64 0, i64 %11
  store i8 1, ptr %12, align 1, !tbaa !13
  %13 = tail call noundef zeroext i1 @_ZNKSt5dequeIiSaIiEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) @q1) #4
  br i1 %13, label %._crit_edge30, label %.lr.ph29

.lr.ph:                                           ; preds = %.lr.ph.preheader32, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader32 ]
  %14 = getelementptr inbounds [1010 x i32], ptr @d, i64 0, i64 %indvars.iv
  store i32 1000000007, ptr %14, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !15

.loopexit:                                        ; preds = %90, %.lr.ph29
  %15 = call noundef zeroext i1 @_ZNKSt5dequeIiSaIiEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) @q1) #4
  br i1 %15, label %._crit_edge30, label %.lr.ph29, !llvm.loop !16

.lr.ph29:                                         ; preds = %._crit_edge, %.loopexit
  %16 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5dequeIiSaIiEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) @q1) #4
  %17 = load i32, ptr %16, align 4, !tbaa !5
  call void @_ZNSt5dequeIiSaIiEE9pop_frontEv(ptr noundef nonnull align 8 dereferenceable(80) @q1) #4
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [1010 x i8], ptr @vis, i64 0, i64 %18
  store i8 0, ptr %19, align 1, !tbaa !13
  %20 = getelementptr inbounds [1010 x i32], ptr @head, i64 0, i64 %18
  %.023 = load i32, ptr %20, align 4, !tbaa !5
  %.not24 = icmp eq i32 %.023, -1
  br i1 %.not24, label %.loopexit, label %.lr.ph27

.lr.ph27:                                         ; preds = %.lr.ph29
  %21 = getelementptr inbounds [1010 x i32], ptr @d, i64 0, i64 %18
  %22 = getelementptr inbounds [1010 x i32], ptr @f, i64 0, i64 %18
  br label %23

23:                                               ; preds = %.lr.ph27, %90
  %.025 = phi i32 [ %.023, %.lr.ph27 ], [ %.0, %90 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  %24 = sext i32 %.025 to i64
  %25 = getelementptr inbounds [251000 x %struct.node], ptr @edge, i64 0, i64 %24
  %26 = getelementptr inbounds i8, ptr %25, i64 4
  %27 = load i32, ptr %26, align 4, !tbaa !17
  store i32 %27, ptr %1, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [1010 x i32], ptr @d, i64 0, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %31 = load i32, ptr %21, align 4, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %25, i64 8
  %33 = load i32, ptr %32, align 8, !tbaa !19
  %34 = add nsw i32 %33, %31
  %35 = icmp sgt i32 %30, %34
  br i1 %35, label %36, label %61

36:                                               ; preds = %23
  store i32 %34, ptr %29, align 4, !tbaa !5
  %37 = load i32, ptr %22, align 4, !tbaa !5
  %38 = getelementptr inbounds [1010 x i32], ptr @w, i64 0, i64 %28
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = add nsw i32 %39, %37
  %41 = getelementptr inbounds [1010 x i32], ptr @f, i64 0, i64 %28
  store i32 %40, ptr %41, align 4, !tbaa !5
  %42 = getelementptr inbounds [1010 x i8], ptr @vis, i64 0, i64 %28
  %43 = load i8, ptr %42, align 1, !tbaa !13, !range !20, !noundef !21
  %44 = trunc nuw i8 %43 to i1
  br i1 %44, label %90, label %45

45:                                               ; preds = %36
  store i8 1, ptr %42, align 1, !tbaa !13
  %46 = call noundef zeroext i1 @_ZNKSt5dequeIiSaIiEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) @q1) #4
  br i1 %46, label %60, label %47

47:                                               ; preds = %45
  %48 = load i32, ptr %1, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [1010 x i32], ptr @d, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5dequeIiSaIiEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) @q1) #4
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [1010 x i32], ptr @d, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = icmp sgt i32 %51, %56
  br i1 %57, label %58, label %59

58:                                               ; preds = %47
  call void @_ZNSt5dequeIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(80) @q1, ptr noundef nonnull align 4 dereferenceable(4) %1)
  br label %90

59:                                               ; preds = %47
  call void @_ZNSt5dequeIiSaIiEE10push_frontERKi(ptr noundef nonnull align 8 dereferenceable(80) @q1, ptr noundef nonnull align 4 dereferenceable(4) %1)
  br label %90

60:                                               ; preds = %45
  call void @_ZNSt5dequeIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(80) @q1, ptr noundef nonnull align 4 dereferenceable(4) %1)
  br label %90

61:                                               ; preds = %23
  %62 = icmp eq i32 %30, %34
  br i1 %62, label %63, label %90

63:                                               ; preds = %61
  %64 = getelementptr inbounds [1010 x i32], ptr @f, i64 0, i64 %28
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = load i32, ptr %22, align 4, !tbaa !5
  %67 = getelementptr inbounds [1010 x i32], ptr @w, i64 0, i64 %28
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = add nsw i32 %68, %66
  %.not21 = icmp sgt i32 %65, %69
  br i1 %.not21, label %90, label %70

70:                                               ; preds = %63
  store i32 %69, ptr %64, align 4, !tbaa !5
  %71 = getelementptr inbounds [1010 x i8], ptr @vis, i64 0, i64 %28
  %72 = load i8, ptr %71, align 1, !tbaa !13, !range !20, !noundef !21
  %73 = trunc nuw i8 %72 to i1
  br i1 %73, label %90, label %74

74:                                               ; preds = %70
  store i8 1, ptr %71, align 1, !tbaa !13
  %75 = call noundef zeroext i1 @_ZNKSt5dequeIiSaIiEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) @q1) #4
  br i1 %75, label %89, label %76

76:                                               ; preds = %74
  %77 = load i32, ptr %1, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [1010 x i32], ptr @d, i64 0, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5dequeIiSaIiEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) @q1) #4
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [1010 x i32], ptr @d, i64 0, i64 %83
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = icmp sgt i32 %80, %85
  br i1 %86, label %87, label %88

87:                                               ; preds = %76
  call void @_ZNSt5dequeIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(80) @q1, ptr noundef nonnull align 4 dereferenceable(4) %1)
  br label %90

88:                                               ; preds = %76
  call void @_ZNSt5dequeIiSaIiEE10push_frontERKi(ptr noundef nonnull align 8 dereferenceable(80) @q1, ptr noundef nonnull align 4 dereferenceable(4) %1)
  br label %90

89:                                               ; preds = %74
  call void @_ZNSt5dequeIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(80) @q1, ptr noundef nonnull align 4 dereferenceable(4) %1)
  br label %90

90:                                               ; preds = %61, %63, %89, %88, %87, %70, %36, %58, %59, %60
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  %91 = getelementptr inbounds i8, ptr %25, i64 12
  %.0 = load i32, ptr %91, align 4, !tbaa !5
  %.not = icmp eq i32 %.0, -1
  br i1 %.not, label %.loopexit, label %23, !llvm.loop !22

._crit_edge30:                                    ; preds = %.loopexit, %._crit_edge
  ret void
}

; 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 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 @_ZNSt5dequeIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5dequeIiSaIiEE10push_frontERKi(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 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 = { 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 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = distinct !{!15, !10, !12, !11}
!16 = distinct !{!16, !10}
!17 = !{!18, !6, i64 4}
!18 = !{!"_ZTS4node", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12}
!19 = !{!18, !6, i64 8}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = distinct !{!22, !10}


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