; LLVM IR from tangjz/acm-icpc :: lydsy/1003.ll (Z8shortestii)

; 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"

%"class.std::priority_queue" = type <{ %"class.std::vector", [8 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.Line = type { i32, i32, i32 }
%"struct.std::pair" = type { i32, i32 }

@Q = external dso_local global %"class.std::priority_queue", align 8
@line = external dso_local global [801 x %struct.Line], align 16
@m = external dso_local global i32, align 4
@head = external dso_local global [21 x i32], align 16
@dist = external dso_local global [21 x i32], align 16
@flag = external dso_local global [21 x [101 x i8]], align 16
@vis = external dso_local global [21 x i8], align 16

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z8shortestii(i32 noundef %0, i32 noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::pair", align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %"struct.std::pair", align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 16 @dist, i8 63, i64 84, i1 false)
  call void @llvm.memset.p0.i64(ptr align 16 @vis, i8 0, i64 21, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %15

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

19:                                               ; preds = %15
  store i32 2, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %49

20:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %21 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %21, ptr %8, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %41, %20
  %23 = load i32, ptr %8, align 4, !tbaa !5
  %24 = load i32, ptr %5, align 4, !tbaa !5
  %25 = icmp sle i32 %23, %24
  br i1 %25, label %27, label %26

26:                                               ; preds = %22
  store i32 5, ptr %7, align 4
  br label %44

27:                                               ; preds = %22
  %28 = load i32, ptr %6, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [21 x [101 x i8]], ptr @flag, i64 0, i64 %29
  %31 = load i32, ptr %8, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [101 x i8], ptr %30, i64 0, i64 %32
  %34 = load i8, ptr %33, align 1, !tbaa !9, !range !11, !noundef !12
  %35 = trunc i8 %34 to i1
  br i1 %35, label %36, label %40

36:                                               ; preds = %27
  %37 = load i32, ptr %6, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [21 x i8], ptr @vis, i64 0, i64 %38
  store i8 1, ptr %39, align 1, !tbaa !9
  store i32 5, ptr %7, align 4
  br label %44

40:                                               ; preds = %27
  br label %41

41:                                               ; preds = %40
  %42 = load i32, ptr %8, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %8, align 4, !tbaa !5
  br label %22, !llvm.loop !13

44:                                               ; preds = %36, %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %45

45:                                               ; preds = %44
  br label %46

46:                                               ; preds = %45
  %47 = load i32, ptr %6, align 4, !tbaa !5
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %6, align 4, !tbaa !5
  br label %15, !llvm.loop !15

49:                                               ; preds = %19
  store i32 0, ptr getelementptr inbounds ([21 x i32], ptr @dist, i64 0, i64 1), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 1, ptr %11, align 4, !tbaa !5
  %50 = call i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %11)
  store i64 %50, ptr %9, align 4
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 4 dereferenceable(8) %9)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br label %51

51:                                               ; preds = %144, %142, %49
  %52 = call noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %53 = xor i1 %52, true
  br i1 %53, label %54, label %145

54:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %55 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %56 = getelementptr inbounds %"struct.std::pair", ptr %55, i32 0, i32 1
  %57 = load i32, ptr %56, align 4, !tbaa !16
  store i32 %57, ptr %12, align 4, !tbaa !5
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %58 = load i32, ptr %12, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [21 x i8], ptr @vis, i64 0, i64 %59
  %61 = load i8, ptr %60, align 1, !tbaa !9, !range !11, !noundef !12
  %62 = trunc i8 %61 to i1
  br i1 %62, label %63, label %64

63:                                               ; preds = %54
  store i32 8, ptr %7, align 4
  br label %142, !llvm.loop !18

64:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %65 = load i32, ptr %12, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [21 x i32], ptr @head, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !5
  store i32 %68, ptr %13, align 4, !tbaa !5
  br label %69

69:                                               ; preds = %135, %64
  %70 = load i32, ptr %13, align 4, !tbaa !5
  %71 = icmp ne i32 %70, 0
  br i1 %71, label %73, label %72

72:                                               ; preds = %69
  store i32 10, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %141

73:                                               ; preds = %69
  %74 = load i32, ptr %13, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [801 x %struct.Line], ptr @line, i64 0, i64 %75
  %77 = getelementptr inbounds %struct.Line, ptr %76, i32 0, i32 0
  %78 = load i32, ptr %77, align 4, !tbaa !19
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [21 x i8], ptr @vis, i64 0, i64 %79
  %81 = load i8, ptr %80, align 1, !tbaa !9, !range !11, !noundef !12
  %82 = trunc i8 %81 to i1
  br i1 %82, label %83, label %84

83:                                               ; preds = %73
  br label %135

84:                                               ; preds = %73
  %85 = load i32, ptr %12, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [21 x i32], ptr @dist, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = load i32, ptr %13, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [801 x %struct.Line], ptr @line, i64 0, i64 %90
  %92 = getelementptr inbounds %struct.Line, ptr %91, i32 0, i32 1
  %93 = load i32, ptr %92, align 4, !tbaa !21
  %94 = add nsw i32 %88, %93
  %95 = load i32, ptr %13, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [801 x %struct.Line], ptr @line, i64 0, i64 %96
  %98 = getelementptr inbounds %struct.Line, ptr %97, i32 0, i32 0
  %99 = load i32, ptr %98, align 4, !tbaa !19
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [21 x i32], ptr @dist, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = icmp slt i32 %94, %102
  br i1 %103, label %104, label %134

104:                                              ; preds = %84
  %105 = load i32, ptr %12, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [21 x i32], ptr @dist, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = load i32, ptr %13, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [801 x %struct.Line], ptr @line, i64 0, i64 %110
  %112 = getelementptr inbounds %struct.Line, ptr %111, i32 0, i32 1
  %113 = load i32, ptr %112, align 4, !tbaa !21
  %114 = add nsw i32 %108, %113
  %115 = load i32, ptr %13, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [801 x %struct.Line], ptr @line, i64 0, i64 %116
  %118 = getelementptr inbounds %struct.Line, ptr %117, i32 0, i32 0
  %119 = load i32, ptr %118, align 4, !tbaa !19
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [21 x i32], ptr @dist, i64 0, i64 %120
  store i32 %114, ptr %121, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %122 = load i32, ptr %13, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [801 x %struct.Line], ptr @line, i64 0, i64 %123
  %125 = getelementptr inbounds %struct.Line, ptr %124, i32 0, i32 0
  %126 = load i32, ptr %125, align 4, !tbaa !19
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [21 x i32], ptr @dist, i64 0, i64 %127
  %129 = load i32, ptr %13, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [801 x %struct.Line], ptr @line, i64 0, i64 %130
  %132 = getelementptr inbounds %struct.Line, ptr %131, i32 0, i32 0
  %133 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %128, ptr noundef nonnull align 4 dereferenceable(4) %132)
  store i64 %133, ptr %14, align 4
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 4 dereferenceable(8) %14)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  br label %134

134:                                              ; preds = %104, %84
  br label %135

135:                                              ; preds = %134, %83
  %136 = load i32, ptr %13, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [801 x %struct.Line], ptr @line, i64 0, i64 %137
  %139 = getelementptr inbounds %struct.Line, ptr %138, i32 0, i32 2
  %140 = load i32, ptr %139, align 4, !tbaa !22
  store i32 %140, ptr %13, align 4, !tbaa !5
  br label %69, !llvm.loop !23

141:                                              ; preds = %72
  store i32 0, ptr %7, align 4
  br label %142

142:                                              ; preds = %141, %63
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  %143 = load i32, ptr %7, align 4
  switch i32 %143, label %168 [
    i32 0, label %144
    i32 8, label %51
  ]

144:                                              ; preds = %142
  br label %51, !llvm.loop !18

145:                                              ; preds = %51
  %146 = load i32, ptr @m, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [21 x i32], ptr @dist, i64 0, i64 %147
  %149 = load i32, ptr %148, align 4, !tbaa !5
  %150 = icmp eq i32 %149, 1061109567
  br i1 %150, label %151, label %156

151:                                              ; preds = %145
  %152 = load i32, ptr @m, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [21 x i32], ptr @dist, i64 0, i64 %153
  %155 = load i32, ptr %154, align 4, !tbaa !5
  store i32 %155, ptr %3, align 4
  br label %166

156:                                              ; preds = %145
  %157 = load i32, ptr @m, align 4, !tbaa !5
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [21 x i32], ptr @dist, i64 0, i64 %158
  %160 = load i32, ptr %159, align 4, !tbaa !5
  %161 = load i32, ptr %5, align 4, !tbaa !5
  %162 = load i32, ptr %4, align 4, !tbaa !5
  %163 = sub nsw i32 %161, %162
  %164 = add nsw i32 %163, 1
  %165 = mul nsw i32 %160, %164
  store i32 %165, ptr %3, align 4
  br label %166

166:                                              ; preds = %156, %151
  %167 = load i32, ptr %3, align 4
  ret i32 %167

168:                                              ; preds = %142
  unreachable
}

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #0

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #0

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = !{i8 0, i8 2}
!12 = !{}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{!17, !6, i64 4}
!17 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!18 = distinct !{!18, !14}
!19 = !{!20, !6, i64 0}
!20 = !{!"_ZTS4Line", !6, i64 0, !6, i64 4, !6, i64 8}
!21 = !{!20, !6, i64 4}
!22 = !{!20, !6, i64 8}
!23 = distinct !{!23, !14}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::priority_queue" = type <{ %"class.std::vector", [8 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.Line = type { i32, i32, i32 }
%"struct.std::pair" = type { i32, i32 }

@Q = external dso_local global %"class.std::priority_queue", align 8
@line = external dso_local global [801 x %struct.Line], align 16
@m = external dso_local local_unnamed_addr global i32, align 4
@head = external dso_local local_unnamed_addr global [21 x i32], align 16
@dist = external dso_local global [21 x i32], align 16
@flag = external dso_local local_unnamed_addr global [21 x [101 x i8]], align 16
@vis = external dso_local local_unnamed_addr global [21 x i8], align 16

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z8shortestii(i32 noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = alloca %"struct.std::pair", align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::pair", align 8
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(84) @dist, i8 63, i64 84, i1 false)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(21) @vis, i8 0, i64 21, i1 false)
  %7 = load i32, ptr @m, align 4, !tbaa !5
  %.not35 = icmp slt i32 %7, 1
  %.not3133 = icmp sgt i32 %0, %1
  %or.cond = or i1 %.not35, %.not3133
  br i1 %or.cond, label %._crit_edge, label %.preheader.preheader

.preheader.preheader:                             ; preds = %2
  %8 = sext i32 %0 to i64
  %9 = add i32 %1, 1
  %10 = zext nneg i32 %7 to i64
  %xtraiter = and i64 %10, 1
  %11 = icmp eq i32 %7, 1
  br i1 %11, label %._crit_edge.loopexit.unr-lcssa, label %.preheader.preheader.new

.preheader.preheader.new:                         ; preds = %.preheader.preheader
  %unroll_iter = and i64 %10, 2147483646
  br label %.preheader

.preheader:                                       ; preds = %..loopexit32_crit_edge.1, %.preheader.preheader.new
  %indvars.iv47 = phi i64 [ 1, %.preheader.preheader.new ], [ %indvars.iv.next48.1, %..loopexit32_crit_edge.1 ]
  %niter = phi i64 [ 0, %.preheader.preheader.new ], [ %niter.next.1, %..loopexit32_crit_edge.1 ]
  br label %21

._crit_edge.loopexit.unr-lcssa:                   ; preds = %..loopexit32_crit_edge.1, %.preheader.preheader
  %indvars.iv47.unr = phi i64 [ 1, %.preheader.preheader ], [ %indvars.iv.next48.1, %..loopexit32_crit_edge.1 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.preheader.epil

.preheader.epil:                                  ; preds = %._crit_edge.loopexit.unr-lcssa, %15
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %15 ], [ %8, %._crit_edge.loopexit.unr-lcssa ]
  %12 = getelementptr inbounds [21 x [101 x i8]], ptr @flag, i64 0, i64 %indvars.iv47.unr, i64 %indvars.iv.epil
  %13 = load i8, ptr %12, align 1, !tbaa !9, !range !11, !noundef !12
  %14 = trunc nuw i8 %13 to i1
  br i1 %14, label %16, label %15

15:                                               ; preds = %.preheader.epil
  %indvars.iv.next.epil = add nsw i64 %indvars.iv.epil, 1
  %lftr.wideiv.epil = trunc i64 %indvars.iv.next.epil to i32
  %exitcond.not.epil = icmp eq i32 %9, %lftr.wideiv.epil
  br i1 %exitcond.not.epil, label %._crit_edge, label %.preheader.epil, !llvm.loop !13

16:                                               ; preds = %.preheader.epil
  %17 = getelementptr inbounds [21 x i8], ptr @vis, i64 0, i64 %indvars.iv47.unr
  store i8 1, ptr %17, align 1, !tbaa !9
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %15, %16, %2
  store i32 0, ptr getelementptr inbounds (i8, ptr @dist, i64 4), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #4
  store i32 1, ptr %5, align 4, !tbaa !5
  %18 = call i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  store i64 %18, ptr %3, align 8
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 4 dereferenceable(8) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  %19 = call noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  br i1 %19, label %._crit_edge44, label %.lr.ph43

20:                                               ; preds = %21
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
  %exitcond.not = icmp eq i32 %9, %lftr.wideiv
  br i1 %exitcond.not, label %..loopexit32_crit_edge, label %21, !llvm.loop !13

21:                                               ; preds = %.preheader, %20
  %indvars.iv = phi i64 [ %8, %.preheader ], [ %indvars.iv.next, %20 ]
  %22 = getelementptr inbounds [21 x [101 x i8]], ptr @flag, i64 0, i64 %indvars.iv47, i64 %indvars.iv
  %23 = load i8, ptr %22, align 1, !tbaa !9, !range !11, !noundef !12
  %24 = trunc nuw i8 %23 to i1
  br i1 %24, label %25, label %20

25:                                               ; preds = %21
  %26 = getelementptr inbounds [21 x i8], ptr @vis, i64 0, i64 %indvars.iv47
  store i8 1, ptr %26, align 1, !tbaa !9
  br label %..loopexit32_crit_edge

..loopexit32_crit_edge:                           ; preds = %20, %25
  %indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1
  br label %27

27:                                               ; preds = %31, %..loopexit32_crit_edge
  %indvars.iv.1 = phi i64 [ %8, %..loopexit32_crit_edge ], [ %indvars.iv.next.1, %31 ]
  %28 = getelementptr inbounds [21 x [101 x i8]], ptr @flag, i64 0, i64 %indvars.iv.next48, i64 %indvars.iv.1
  %29 = load i8, ptr %28, align 1, !tbaa !9, !range !11, !noundef !12
  %30 = trunc nuw i8 %29 to i1
  br i1 %30, label %32, label %31

31:                                               ; preds = %27
  %indvars.iv.next.1 = add nsw i64 %indvars.iv.1, 1
  %lftr.wideiv.1 = trunc i64 %indvars.iv.next.1 to i32
  %exitcond.not.1 = icmp eq i32 %9, %lftr.wideiv.1
  br i1 %exitcond.not.1, label %..loopexit32_crit_edge.1, label %27, !llvm.loop !13

32:                                               ; preds = %27
  %33 = getelementptr inbounds [21 x i8], ptr @vis, i64 0, i64 %indvars.iv.next48
  store i8 1, ptr %33, align 1, !tbaa !9
  br label %..loopexit32_crit_edge.1

..loopexit32_crit_edge.1:                         ; preds = %31, %32
  %indvars.iv.next48.1 = add nuw nsw i64 %indvars.iv47, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.loopexit.unr-lcssa, label %.preheader, !llvm.loop !15

.lr.ph43:                                         ; preds = %._crit_edge, %.loopexit
  %34 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %35 = getelementptr inbounds i8, ptr %34, i64 4
  %36 = load i32, ptr %35, align 4, !tbaa !16
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [21 x i8], ptr @vis, i64 0, i64 %37
  %39 = load i8, ptr %38, align 1, !tbaa !9, !range !11, !noundef !12
  %40 = trunc nuw i8 %39 to i1
  br i1 %40, label %.loopexit, label %41, !llvm.loop !18

41:                                               ; preds = %.lr.ph43
  %42 = getelementptr inbounds [21 x i32], ptr @head, i64 0, i64 %37
  %.038 = load i32, ptr %42, align 4, !tbaa !5
  %.not3039 = icmp eq i32 %.038, 0
  br i1 %.not3039, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %41
  %43 = getelementptr inbounds [21 x i32], ptr @dist, i64 0, i64 %37
  br label %44

44:                                               ; preds = %.lr.ph, %62
  %.040 = phi i32 [ %.038, %.lr.ph ], [ %.0, %62 ]
  %45 = sext i32 %.040 to i64
  %46 = getelementptr inbounds [801 x %struct.Line], ptr @line, i64 0, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !19
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [21 x i8], ptr @vis, i64 0, i64 %48
  %50 = load i8, ptr %49, align 1, !tbaa !9, !range !11, !noundef !12
  %51 = trunc nuw i8 %50 to i1
  br i1 %51, label %62, label %52

52:                                               ; preds = %44
  %53 = load i32, ptr %43, align 4, !tbaa !5
  %54 = getelementptr inbounds i8, ptr %46, i64 4
  %55 = load i32, ptr %54, align 4, !tbaa !21
  %56 = add nsw i32 %55, %53
  %57 = getelementptr inbounds [21 x i32], ptr @dist, i64 0, i64 %48
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = icmp slt i32 %56, %58
  br i1 %59, label %60, label %62

60:                                               ; preds = %52
  store i32 %56, ptr %57, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  %61 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %57, ptr noundef nonnull align 4 dereferenceable(4) %46)
  store i64 %61, ptr %6, align 8
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 4 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  br label %62

62:                                               ; preds = %52, %60, %44
  %63 = getelementptr inbounds i8, ptr %46, i64 8
  %.0 = load i32, ptr %63, align 4, !tbaa !5
  %.not30 = icmp eq i32 %.0, 0
  br i1 %.not30, label %.loopexit, label %44, !llvm.loop !22

.loopexit:                                        ; preds = %62, %41, %.lr.ph43
  %64 = call noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  br i1 %64, label %._crit_edge44, label %.lr.ph43

._crit_edge44:                                    ; preds = %.loopexit, %._crit_edge
  %65 = load i32, ptr @m, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [21 x i32], ptr @dist, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = icmp eq i32 %68, 1061109567
  %reass.sub = sub i32 %1, %0
  %70 = add i32 %reass.sub, 1
  %71 = mul nsw i32 %68, %70
  %.025 = select i1 %69, i32 1061109567, i32 %71
  ret i32 %.025
}

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = !{i8 0, i8 2}
!12 = !{}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{!17, !6, i64 4}
!17 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!18 = distinct !{!18, !14}
!19 = !{!20, !6, i64 0}
!20 = !{!"_ZTS4Line", !6, i64 0, !6, i64 4, !6, i64 8}
!21 = !{!20, !6, i64 4}
!22 = distinct !{!22, !14}


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