; LLVM IR from Tunghohin/Competitive_Coding :: Poj/poj3169.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::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 [40010 x %struct.edge], align 16
@head = external dso_local global [1010 x i32], align 16
@in_que = external dso_local global [1010 x i8], align 16
@dist = external dso_local global [1010 x i32], align 16
@cnt = external dso_local global [1010 x i32], 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::queue", align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %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 @_ZNSt5queueIiSt5dequeIiSaIiEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %6)
  call void @llvm.memset.p0.i64(ptr align 16 @cnt, i8 0, i64 4040, i1 false)
  call void @llvm.memset.p0.i64(ptr align 16 @in_que, i8 0, i64 1010, i1 false)
  call void @llvm.memset.p0.i64(ptr align 16 @dist, i8 63, i64 4040, i1 false)
  %15 = load i32, ptr %4, align 4, !tbaa !5
  %16 = icmp eq i32 %15, 1
  br i1 %16, label %17, label %39

17:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %31, %17
  %19 = load i32, ptr %7, align 4, !tbaa !5
  %20 = load i32, ptr %5, align 4, !tbaa !5
  %21 = icmp sle i32 %19, %20
  br i1 %21, label %23, label %22

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

23:                                               ; preds = %18
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %6, ptr noundef nonnull align 4 dereferenceable(4) %7)
          to label %24 unwind label %34

24:                                               ; preds = %23
  %25 = load i32, ptr %7, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [1010 x i8], ptr @in_que, i64 0, i64 %26
  store i8 1, ptr %27, align 1, !tbaa !9
  %28 = load i32, ptr %7, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [1010 x i32], ptr @dist, i64 0, i64 %29
  store i32 0, ptr %30, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %24
  %32 = load i32, ptr %7, align 4, !tbaa !5
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr %7, align 4, !tbaa !5
  br label %18, !llvm.loop !11

34:                                               ; preds = %23
  %35 = landingpad { ptr, i32 }
          cleanup
  %36 = extractvalue { ptr, i32 } %35, 0
  store ptr %36, ptr %8, align 8
  %37 = extractvalue { ptr, i32 } %35, 1
  store i32 %37, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %167

38:                                               ; preds = %22
  br label %45

39:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 1, ptr %10, align 4, !tbaa !5
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushEOi(ptr noundef nonnull align 8 dereferenceable(80) %6, ptr noundef nonnull align 4 dereferenceable(4) %10)
          to label %40 unwind label %41

40:                                               ; preds = %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  store i8 1, ptr getelementptr inbounds ([1010 x i8], ptr @in_que, i64 0, i64 1), align 1, !tbaa !9
  store i32 0, ptr getelementptr inbounds ([1010 x i32], ptr @dist, i64 0, i64 1), align 4, !tbaa !5
  br label %45

41:                                               ; preds = %39
  %42 = landingpad { ptr, i32 }
          cleanup
  %43 = extractvalue { ptr, i32 } %42, 0
  store ptr %43, ptr %8, align 8
  %44 = extractvalue { ptr, i32 } %42, 1
  store i32 %44, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %167

45:                                               ; preds = %40, %38
  br label %46

46:                                               ; preds = %155, %45
  %47 = invoke noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %6)
          to label %48 unwind label %66

48:                                               ; preds = %46
  %49 = xor i1 %47, true
  br i1 %49, label %50, label %157

50:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %51 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5queueIiSt5dequeIiSaIiEEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %6)
          to label %52 unwind label %70

52:                                               ; preds = %50
  %53 = load i32, ptr %51, align 4, !tbaa !5
  store i32 %53, ptr %11, align 4, !tbaa !5
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %6)
          to label %54 unwind label %70

54:                                               ; preds = %52
  %55 = load i32, ptr %11, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [1010 x i8], ptr @in_que, i64 0, i64 %56
  store i8 0, ptr %57, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %58 = load i32, ptr %11, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [1010 x i32], ptr @head, i64 0, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !5
  store i32 %61, ptr %12, align 4, !tbaa !5
  br label %62

62:                                               ; preds = %144, %54
  %63 = load i32, ptr %12, align 4, !tbaa !5
  %64 = icmp ne i32 %63, 0
  br i1 %64, label %74, label %65

65:                                               ; preds = %62
  store i32 7, ptr %13, align 4
  br label %150

66:                                               ; preds = %46
  %67 = landingpad { ptr, i32 }
          cleanup
  %68 = extractvalue { ptr, i32 } %67, 0
  store ptr %68, ptr %8, align 8
  %69 = extractvalue { ptr, i32 } %67, 1
  store i32 %69, ptr %9, align 4
  br label %167

70:                                               ; preds = %52, %50
  %71 = landingpad { ptr, i32 }
          cleanup
  %72 = extractvalue { ptr, i32 } %71, 0
  store ptr %72, ptr %8, align 8
  %73 = extractvalue { ptr, i32 } %71, 1
  store i32 %73, ptr %9, align 4
  br label %156

74:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %75 = load i32, ptr %12, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [40010 x %struct.edge], ptr @e, i64 0, i64 %76
  %78 = getelementptr inbounds %struct.edge, ptr %77, i32 0, i32 0
  %79 = load i32, ptr %78, align 4, !tbaa !13
  store i32 %79, ptr %14, align 4, !tbaa !5
  %80 = load i32, ptr %14, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [1010 x i32], ptr @dist, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = load i32, ptr %11, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [1010 x i32], ptr @dist, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = load i32, ptr %12, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [40010 x %struct.edge], ptr @e, i64 0, i64 %89
  %91 = getelementptr inbounds %struct.edge, ptr %90, i32 0, i32 1
  %92 = load i32, ptr %91, align 4, !tbaa !15
  %93 = add nsw i32 %87, %92
  %94 = icmp sgt i32 %83, %93
  br i1 %94, label %95, label %140

95:                                               ; preds = %74
  %96 = load i32, ptr %11, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [1010 x i32], ptr @dist, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = load i32, ptr %12, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [40010 x %struct.edge], ptr @e, i64 0, i64 %101
  %103 = getelementptr inbounds %struct.edge, ptr %102, i32 0, i32 1
  %104 = load i32, ptr %103, align 4, !tbaa !15
  %105 = add nsw i32 %99, %104
  %106 = load i32, ptr %14, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [1010 x i32], ptr @dist, i64 0, i64 %107
  store i32 %105, ptr %108, align 4, !tbaa !5
  %109 = load i32, ptr %11, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [1010 x i32], ptr @cnt, i64 0, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !5
  %113 = add nsw i32 %112, 1
  %114 = load i32, ptr %14, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [1010 x i32], ptr @cnt, i64 0, i64 %115
  store i32 %113, ptr %116, align 4, !tbaa !5
  %117 = load i32, ptr %14, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [1010 x i32], ptr @cnt, i64 0, i64 %118
  %120 = load i32, ptr %119, align 4, !tbaa !5
  %121 = load i32, ptr %5, align 4, !tbaa !5
  %122 = icmp sge i32 %120, %121
  br i1 %122, label %123, label %124

123:                                              ; preds = %95
  store i1 false, ptr %3, align 1
  store i32 1, ptr %13, align 4
  br label %141

124:                                              ; preds = %95
  %125 = load i32, ptr %14, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [1010 x i8], ptr @in_que, i64 0, i64 %126
  %128 = load i8, ptr %127, align 1, !tbaa !9, !range !16, !noundef !17
  %129 = trunc i8 %128 to i1
  br i1 %129, label %139, label %130

130:                                              ; preds = %124
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %6, ptr noundef nonnull align 4 dereferenceable(4) %14)
          to label %131 unwind label %135

131:                                              ; preds = %130
  %132 = load i32, ptr %14, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [1010 x i8], ptr @in_que, i64 0, i64 %133
  store i8 1, ptr %134, align 1, !tbaa !9
  br label %139

135:                                              ; preds = %130
  %136 = landingpad { ptr, i32 }
          cleanup
  %137 = extractvalue { ptr, i32 } %136, 0
  store ptr %137, ptr %8, align 8
  %138 = extractvalue { ptr, i32 } %136, 1
  store i32 %138, ptr %9, 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 %156

139:                                              ; preds = %131, %124
  br label %140

140:                                              ; preds = %139, %74
  store i32 0, ptr %13, align 4
  br label %141

141:                                              ; preds = %140, %123
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  %142 = load i32, ptr %13, align 4
  switch i32 %142, label %150 [
    i32 0, label %143
  ]

143:                                              ; preds = %141
  br label %144

144:                                              ; preds = %143
  %145 = load i32, ptr %12, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [40010 x %struct.edge], ptr @e, i64 0, i64 %146
  %148 = getelementptr inbounds %struct.edge, ptr %147, i32 0, i32 2
  %149 = load i32, ptr %148, align 4, !tbaa !18
  store i32 %149, ptr %12, align 4, !tbaa !5
  br label %62, !llvm.loop !19

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

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

153:                                              ; preds = %152, %150
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  %154 = load i32, ptr %13, align 4
  switch i32 %154, label %165 [
    i32 0, label %155
  ]

155:                                              ; preds = %153
  br label %46, !llvm.loop !20

156:                                              ; preds = %135, %70
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %167

157:                                              ; preds = %48
  %158 = load i32, ptr %5, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [1010 x i32], ptr @dist, i64 0, i64 %159
  %161 = load i32, ptr %160, align 4, !tbaa !5
  %162 = icmp sgt i32 %161, 530554783
  br i1 %162, label %163, label %164

163:                                              ; preds = %157
  store i1 false, ptr %3, align 1
  store i32 1, ptr %13, align 4
  br label %165

164:                                              ; preds = %157
  store i1 true, ptr %3, align 1
  store i32 1, ptr %13, align 4
  br label %165

165:                                              ; preds = %164, %163, %153
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %6) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr %6) #5
  %166 = load i1, ptr %3, align 1
  ret i1 %166

167:                                              ; preds = %156, %66, %41, %34
  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 %168

168:                                              ; preds = %167
  %169 = load ptr, ptr %8, align 8
  %170 = load i32, ptr %9, align 4
  %171 = insertvalue { ptr, i32 } poison, ptr %169, 0
  %172 = insertvalue { ptr, i32 } %171, i32 %170, 1
  resume { ptr, i32 } %172
}

; 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 @_ZNSt5queueIiSt5dequeIiSaIiEEEC2IS2_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 @_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) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushEOi(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 @_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 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::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 [40010 x %struct.edge], align 16
@head = external dso_local local_unnamed_addr global [1010 x i32], align 16
@in_que = external dso_local local_unnamed_addr global [1010 x i8], align 16
@dist = external dso_local local_unnamed_addr global [1010 x i32], align 16
@cnt = external dso_local local_unnamed_addr global [1010 x i32], 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::queue", align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  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.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4040) @cnt, i8 0, i64 4040, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1010) @in_que, i8 0, i64 1010, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4040) @dist, i8 63, i64 4040, i1 false)
  %7 = icmp eq i32 %0, 1
  br i1 %7, label %8, label %17

8:                                                ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  store i32 1, ptr %4, align 4, !tbaa !5
  %.not32 = icmp slt i32 %1, 1
  br i1 %.not32, label %._crit_edge, label %.lr.ph

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

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

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

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

17:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  store i32 1, ptr %5, align 4, !tbaa !5
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushEOi(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(4) %5)
          to label %18 unwind label %19

18:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  store i8 1, ptr getelementptr inbounds (i8, ptr @in_que, i64 1), align 1, !tbaa !9
  store i32 0, ptr getelementptr inbounds (i8, ptr @dist, i64 4), align 4, !tbaa !5
  br label %21

19:                                               ; preds = %17
  %20 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  br label %65

21:                                               ; preds = %18, %._crit_edge
  %22 = call noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  br i1 %22, label %.critedge31._crit_edge, label %.lr.ph39

.critedge31.loopexit:                             ; preds = %58, %.lr.ph39
  %23 = call noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  br i1 %23, label %.critedge31._crit_edge, label %.lr.ph39

.lr.ph39:                                         ; preds = %21, %.critedge31.loopexit
  %24 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5queueIiSt5dequeIiSaIiEEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %25 = load i32, ptr %24, align 4, !tbaa !5
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [1010 x i8], ptr @in_que, i64 0, i64 %26
  store i8 0, ptr %27, align 1, !tbaa !9
  %28 = getelementptr inbounds [1010 x i32], ptr @head, i64 0, i64 %26
  %.02133 = load i32, ptr %28, align 4, !tbaa !5
  %.not2734 = icmp eq i32 %.02133, 0
  br i1 %.not2734, label %.critedge31.loopexit, label %.lr.ph37

.lr.ph37:                                         ; preds = %.lr.ph39
  %29 = getelementptr inbounds [1010 x i32], ptr @dist, i64 0, i64 %26
  %30 = getelementptr inbounds [1010 x i32], ptr @cnt, i64 0, i64 %26
  br label %31

31:                                               ; preds = %.lr.ph37, %58
  %.02135 = phi i32 [ %.02133, %.lr.ph37 ], [ %.021, %58 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  %32 = sext i32 %.02135 to i64
  %33 = getelementptr inbounds [40010 x %struct.edge], ptr @e, i64 0, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !13
  store i32 %34, ptr %6, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [1010 x i32], ptr @dist, i64 0, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = load i32, ptr %29, align 4, !tbaa !5
  %39 = getelementptr inbounds i8, ptr %33, i64 4
  %40 = load i32, ptr %39, align 4, !tbaa !15
  %41 = add nsw i32 %40, %38
  %42 = icmp sgt i32 %37, %41
  br i1 %42, label %43, label %58

43:                                               ; preds = %31
  store i32 %41, ptr %36, align 4, !tbaa !5
  %44 = load i32, ptr %30, align 4, !tbaa !5
  %45 = add nsw i32 %44, 1
  %46 = getelementptr inbounds [1010 x i32], ptr @cnt, i64 0, i64 %35
  store i32 %45, ptr %46, align 4, !tbaa !5
  %.not28 = icmp slt i32 %45, %1
  br i1 %.not28, label %47, label %.critedge

47:                                               ; preds = %43
  %48 = getelementptr inbounds [1010 x i8], ptr @in_que, i64 0, i64 %35
  %49 = load i8, ptr %48, align 1, !tbaa !9, !range !16, !noundef !17
  %50 = trunc nuw i8 %49 to i1
  br i1 %50, label %58, label %51

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

52:                                               ; preds = %51
  %53 = load i32, ptr %6, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [1010 x i8], ptr @in_que, i64 0, i64 %54
  store i8 1, ptr %55, align 1, !tbaa !9
  br label %58

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

58:                                               ; preds = %31, %52, %47
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  %59 = getelementptr inbounds i8, ptr %33, i64 8
  %.021 = load i32, ptr %59, align 4, !tbaa !5
  %.not27 = icmp eq i32 %.021, 0
  br i1 %.not27, label %.critedge31.loopexit, label %31, !llvm.loop !18

.critedge:                                        ; preds = %43
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  br label %64, !llvm.loop !19

.critedge31._crit_edge:                           ; preds = %.critedge31.loopexit, %21
  %60 = sext i32 %1 to i64
  %61 = getelementptr inbounds [1010 x i32], ptr @dist, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = icmp slt i32 %62, 530554784
  br label %64

64:                                               ; preds = %.critedge, %.critedge31._crit_edge
  %.4 = phi i1 [ false, %.critedge ], [ %63, %.critedge31._crit_edge ]
  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

65:                                               ; preds = %56, %19, %15
  %.pn = phi { ptr, i32 } [ %16, %15 ], [ %57, %56 ], [ %20, %19 ]
  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 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 @_ZNSt5queueIiSt5dequeIiSaIiEEEC2IS2_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 @_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) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushEOi(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 @_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 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 = !{!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 = distinct !{!18, !12}
!19 = distinct !{!19, !12}


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