; LLVM IR from tangjz/acm-icpc :: lydsy (3245)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl" }
%"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl" = type { %"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl_data" }
%"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::priority_queue" = type <{ %"class.std::vector.0", [8 x i8] }>
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::pair<double, int>, std::allocator<std::pair<double, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<double, int>, std::allocator<std::pair<double, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<double, int>, std::allocator<std::pair<double, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<double, int>, std::allocator<std::pair<double, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.edge = type { i32, i32, i32 }
%"struct.std::pair" = type <{ double, i32, [4 x i8] }>
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@d = external dso_local global i32, align 4
@pre = external dso_local global [75651 x i32], align 16
@ans = external dso_local global [151 x i32], align 16
@dis = external dso_local global [75651 x double], align 16
@e = external dso_local global [151 x %"class.std::vector"], align 16
@Q = external dso_local global %"class.std::priority_queue", align 8
@vis = external dso_local global [75651 x i8], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %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.edge, align 4
  %10 = alloca %"struct.std::pair", align 8
  %11 = alloca i32, align 4
  %12 = alloca { double, i32 }, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %17 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  %22 = alloca %"struct.std::pair", align 8
  %23 = alloca { double, i32 }, align 8
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %27 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m, ptr noundef @d)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %28

28:                                               ; preds = %49, %0
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = load i32, ptr @n, align 4, !tbaa !5
  %31 = icmp slt i32 %29, %30
  br i1 %31, label %33, label %32

32:                                               ; preds = %28
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %52

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

34:                                               ; preds = %45, %33
  %35 = load i32, ptr %4, align 4, !tbaa !5
  %36 = icmp slt i32 %35, 501
  br i1 %36, label %38, label %37

37:                                               ; preds = %34
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %48

38:                                               ; preds = %34
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = mul nsw i32 %39, 501
  %41 = load i32, ptr %4, align 4, !tbaa !5
  %42 = add nsw i32 %40, %41
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [75651 x double], ptr @dis, i64 0, i64 %43
  store double 1.000000e+10, ptr %44, align 8, !tbaa !9
  br label %45

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

48:                                               ; preds = %37
  br label %49

49:                                               ; preds = %48
  %50 = load i32, ptr %2, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %2, align 4, !tbaa !5
  br label %28, !llvm.loop !13

52:                                               ; preds = %32
  br label %53

53:                                               ; preds = %56, %52
  %54 = call noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIdiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %55 = xor i1 %54, true
  br i1 %55, label %56, label %57

56:                                               ; preds = %53
  call void @_ZNSt14priority_queueISt4pairIdiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  br label %53, !llvm.loop !14

57:                                               ; preds = %53
  br label %58

58:                                               ; preds = %62, %57
  %59 = load i32, ptr @m, align 4, !tbaa !5
  %60 = add nsw i32 %59, -1
  store i32 %60, ptr @m, align 4, !tbaa !5
  %61 = icmp ne i32 %59, 0
  br i1 %61, label %62, label %73

62:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %63 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %5, ptr noundef %6, ptr noundef %8, ptr noundef %7)
  %64 = load i32, ptr %5, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [151 x %"class.std::vector"], ptr @e, i64 0, i64 %65
  call void @llvm.lifetime.start.p0(i64 12, ptr %9) #7
  %67 = getelementptr inbounds %struct.edge, ptr %9, i32 0, i32 0
  %68 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %68, ptr %67, align 4, !tbaa !15
  %69 = getelementptr inbounds %struct.edge, ptr %9, i32 0, i32 1
  %70 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %70, ptr %69, align 4, !tbaa !17
  %71 = getelementptr inbounds %struct.edge, ptr %9, i32 0, i32 2
  %72 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %72, ptr %71, align 4, !tbaa !18
  call void @_ZNSt6vectorI4edgeSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(24) %66, ptr noundef nonnull align 4 dereferenceable(12) %9)
  call void @llvm.lifetime.end.p0(i64 12, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %58, !llvm.loop !19

73:                                               ; preds = %58
  store double 0.000000e+00, ptr getelementptr inbounds ([75651 x double], ptr @dis, i64 0, i64 70), align 16, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 70, ptr %11, align 4, !tbaa !5
  %74 = call { double, i32 } @_ZSt9make_pairIRdiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) getelementptr inbounds ([75651 x double], ptr @dis, i64 0, i64 70), ptr noundef nonnull align 4 dereferenceable(4) %11)
  store { double, i32 } %74, ptr %12, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 %12, i64 12, i1 false)
  call void @_ZNSt14priority_queueISt4pairIdiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 8 dereferenceable(12) %10)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #7
  br label %75

75:                                               ; preds = %177, %175, %73
  %76 = call noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIdiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %77 = xor i1 %76, true
  br i1 %77, label %78, label %178

78:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %79 = call noundef nonnull align 8 dereferenceable(12) ptr @_ZNKSt14priority_queueISt4pairIdiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %80 = getelementptr inbounds %"struct.std::pair", ptr %79, i32 0, i32 1
  %81 = load i32, ptr %80, align 8, !tbaa !20
  store i32 %81, ptr %13, align 4, !tbaa !5
  call void @_ZNSt14priority_queueISt4pairIdiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %82 = load i32, ptr %13, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [75651 x i8], ptr @vis, i64 0, i64 %83
  %85 = load i8, ptr %84, align 1, !tbaa !22, !range !24, !noundef !25
  %86 = trunc i8 %85 to i1
  br i1 %86, label %87, label %88

87:                                               ; preds = %78
  store i32 12, ptr %3, align 4
  br label %175, !llvm.loop !26

88:                                               ; preds = %78
  %89 = load i32, ptr %13, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [75651 x i8], ptr @vis, i64 0, i64 %90
  store i8 1, ptr %91, align 1, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %92 = load i32, ptr %13, align 4, !tbaa !5
  %93 = sdiv i32 %92, 501
  store i32 %93, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %94 = load i32, ptr %13, align 4, !tbaa !5
  %95 = srem i32 %94, 501
  store i32 %95, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %96 = load i32, ptr %14, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [151 x %"class.std::vector"], ptr @e, i64 0, i64 %97
  %99 = call ptr @_ZNSt6vectorI4edgeSaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %98) #7
  %100 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %16, i32 0, i32 0
  store ptr %99, ptr %100, align 8
  br label %101

101:                                              ; preds = %172, %88
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %102 = load i32, ptr %14, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [151 x %"class.std::vector"], ptr @e, i64 0, i64 %103
  %105 = call ptr @_ZNSt6vectorI4edgeSaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %104) #7
  %106 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %17, i32 0, i32 0
  store ptr %105, ptr %106, align 8
  %107 = call noundef zeroext i1 @_ZN9__gnu_cxxneIP4edgeSt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(8) %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  br i1 %107, label %109, label %108

108:                                              ; preds = %101
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  br label %174

109:                                              ; preds = %101
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %110 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIP4edgeSt6vectorIS1_SaIS1_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %16) #7
  %111 = getelementptr inbounds %struct.edge, ptr %110, i32 0, i32 0
  store ptr %111, ptr %18, align 8, !tbaa !27
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %112 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIP4edgeSt6vectorIS1_SaIS1_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %16) #7
  %113 = getelementptr inbounds %struct.edge, ptr %112, i32 0, i32 1
  store ptr %113, ptr %19, align 8, !tbaa !27
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  %114 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIP4edgeSt6vectorIS1_SaIS1_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %16) #7
  %115 = getelementptr inbounds %struct.edge, ptr %114, i32 0, i32 2
  %116 = load i32, ptr %115, align 4, !tbaa !18
  %117 = icmp ne i32 %116, 0
  br i1 %117, label %119, label %118

118:                                              ; preds = %109
  br label %122

119:                                              ; preds = %109
  %120 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIP4edgeSt6vectorIS1_SaIS1_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %16) #7
  %121 = getelementptr inbounds %struct.edge, ptr %120, i32 0, i32 2
  br label %122

122:                                              ; preds = %119, %118
  %123 = phi ptr [ %15, %118 ], [ %121, %119 ]
  store ptr %123, ptr %20, align 8, !tbaa !27
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  %124 = load ptr, ptr %18, align 8, !tbaa !27
  %125 = load i32, ptr %124, align 4, !tbaa !5
  %126 = mul nsw i32 %125, 501
  %127 = load ptr, ptr %20, align 8, !tbaa !27
  %128 = load i32, ptr %127, align 4, !tbaa !5
  %129 = add nsw i32 %126, %128
  store i32 %129, ptr %21, align 4, !tbaa !5
  %130 = load i32, ptr %21, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [75651 x double], ptr @dis, i64 0, i64 %131
  %133 = load double, ptr %132, align 8, !tbaa !9
  %134 = load i32, ptr %13, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [75651 x double], ptr @dis, i64 0, i64 %135
  %137 = load double, ptr %136, align 8, !tbaa !9
  %138 = load ptr, ptr %19, align 8, !tbaa !27
  %139 = load i32, ptr %138, align 4, !tbaa !5
  %140 = sitofp i32 %139 to double
  %141 = load ptr, ptr %20, align 8, !tbaa !27
  %142 = load i32, ptr %141, align 4, !tbaa !5
  %143 = sitofp i32 %142 to double
  %144 = fdiv double %140, %143
  %145 = fadd double %137, %144
  %146 = fcmp ogt double %133, %145
  br i1 %146, label %147, label %171

147:                                              ; preds = %122
  %148 = load i32, ptr %13, align 4, !tbaa !5
  %149 = load i32, ptr %21, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [75651 x i32], ptr @pre, i64 0, i64 %150
  store i32 %148, ptr %151, align 4, !tbaa !5
  %152 = load i32, ptr %13, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [75651 x double], ptr @dis, i64 0, i64 %153
  %155 = load double, ptr %154, align 8, !tbaa !9
  %156 = load ptr, ptr %19, align 8, !tbaa !27
  %157 = load i32, ptr %156, align 4, !tbaa !5
  %158 = sitofp i32 %157 to double
  %159 = load ptr, ptr %20, align 8, !tbaa !27
  %160 = load i32, ptr %159, align 4, !tbaa !5
  %161 = sitofp i32 %160 to double
  %162 = fdiv double %158, %161
  %163 = fadd double %155, %162
  %164 = load i32, ptr %21, align 4, !tbaa !5
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [75651 x double], ptr @dis, i64 0, i64 %165
  store double %163, ptr %166, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %22) #7
  %167 = load i32, ptr %21, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [75651 x double], ptr @dis, i64 0, i64 %168
  %170 = call { double, i32 } @_ZSt9make_pairIRdRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 8 dereferenceable(8) %169, ptr noundef nonnull align 4 dereferenceable(4) %21)
  store { double, i32 } %170, ptr %23, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %22, ptr align 8 %23, i64 12, i1 false)
  call void @_ZNSt14priority_queueISt4pairIdiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 8 dereferenceable(12) %22)
  call void @llvm.lifetime.end.p0(i64 16, ptr %22) #7
  br label %171

171:                                              ; preds = %147, %122
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  br label %172

172:                                              ; preds = %171
  %173 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIP4edgeSt6vectorIS1_SaIS1_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %16) #7
  br label %101, !llvm.loop !29

174:                                              ; preds = %108
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  store i32 0, ptr %3, align 4
  br label %175

175:                                              ; preds = %174, %87
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  %176 = load i32, ptr %3, align 4
  switch i32 %176, label %247 [
    i32 0, label %177
    i32 12, label %75
  ]

177:                                              ; preds = %175
  br label %75, !llvm.loop !26

178:                                              ; preds = %75
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #7
  %179 = load i32, ptr @d, align 4, !tbaa !5
  %180 = mul nsw i32 %179, 501
  %181 = add nsw i32 %180, 1
  store i32 %181, ptr %24, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #7
  store i32 2, ptr %25, align 4, !tbaa !5
  br label %182

182:                                              ; preds = %205, %178
  %183 = load i32, ptr %25, align 4, !tbaa !5
  %184 = icmp slt i32 %183, 501
  br i1 %184, label %186, label %185

185:                                              ; preds = %182
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #7
  br label %208

186:                                              ; preds = %182
  %187 = load i32, ptr %24, align 4, !tbaa !5
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds [75651 x double], ptr @dis, i64 0, i64 %188
  %190 = load double, ptr %189, align 8, !tbaa !9
  %191 = load i32, ptr @d, align 4, !tbaa !5
  %192 = mul nsw i32 %191, 501
  %193 = load i32, ptr %25, align 4, !tbaa !5
  %194 = add nsw i32 %192, %193
  %195 = sext i32 %194 to i64
  %196 = getelementptr inbounds [75651 x double], ptr @dis, i64 0, i64 %195
  %197 = load double, ptr %196, align 8, !tbaa !9
  %198 = fcmp ogt double %190, %197
  br i1 %198, label %199, label %204

199:                                              ; preds = %186
  %200 = load i32, ptr @d, align 4, !tbaa !5
  %201 = mul nsw i32 %200, 501
  %202 = load i32, ptr %25, align 4, !tbaa !5
  %203 = add nsw i32 %201, %202
  store i32 %203, ptr %24, align 4, !tbaa !5
  br label %204

204:                                              ; preds = %199, %186
  br label %205

205:                                              ; preds = %204
  %206 = load i32, ptr %25, align 4, !tbaa !5
  %207 = add nsw i32 %206, 1
  store i32 %207, ptr %25, align 4, !tbaa !5
  br label %182, !llvm.loop !30

208:                                              ; preds = %185
  store i32 0, ptr @ans, align 16, !tbaa !5
  br label %209

209:                                              ; preds = %219, %208
  %210 = load i32, ptr %24, align 4, !tbaa !5
  %211 = icmp ne i32 %210, 0
  br i1 %211, label %212, label %224

212:                                              ; preds = %209
  %213 = load i32, ptr %24, align 4, !tbaa !5
  %214 = sdiv i32 %213, 501
  %215 = load i32, ptr @ans, align 16, !tbaa !5
  %216 = add nsw i32 %215, 1
  store i32 %216, ptr @ans, align 16, !tbaa !5
  %217 = sext i32 %216 to i64
  %218 = getelementptr inbounds [151 x i32], ptr @ans, i64 0, i64 %217
  store i32 %214, ptr %218, align 4, !tbaa !5
  br label %219

219:                                              ; preds = %212
  %220 = load i32, ptr %24, align 4, !tbaa !5
  %221 = sext i32 %220 to i64
  %222 = getelementptr inbounds [75651 x i32], ptr @pre, i64 0, i64 %221
  %223 = load i32, ptr %222, align 4, !tbaa !5
  store i32 %223, ptr %24, align 4, !tbaa !5
  br label %209, !llvm.loop !31

224:                                              ; preds = %209
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #7
  %225 = load i32, ptr @ans, align 16, !tbaa !5
  store i32 %225, ptr %26, align 4, !tbaa !5
  br label %226

226:                                              ; preds = %242, %224
  %227 = load i32, ptr %26, align 4, !tbaa !5
  %228 = icmp ne i32 %227, 0
  br i1 %228, label %230, label %229

229:                                              ; preds = %226
  store i32 23, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #7
  br label %245

230:                                              ; preds = %226
  %231 = load i32, ptr %26, align 4, !tbaa !5
  %232 = sext i32 %231 to i64
  %233 = getelementptr inbounds [151 x i32], ptr @ans, i64 0, i64 %232
  %234 = load i32, ptr %233, align 4, !tbaa !5
  %235 = load i32, ptr %26, align 4, !tbaa !5
  %236 = icmp eq i32 %235, 1
  %237 = zext i1 %236 to i64
  %238 = getelementptr inbounds [3 x i8], ptr @.str.4, i64 0, i64 %237
  %239 = load i8, ptr %238, align 1, !tbaa !32
  %240 = sext i8 %239 to i32
  %241 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %234, i32 noundef %240)
  br label %242

242:                                              ; preds = %230
  %243 = load i32, ptr %26, align 4, !tbaa !5
  %244 = add nsw i32 %243, -1
  store i32 %244, ptr %26, align 4, !tbaa !5
  br label %226, !llvm.loop !33

245:                                              ; preds = %229
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #7
  %246 = load i32, ptr %1, align 4
  ret i32 %246

247:                                              ; preds = %175
  unreachable
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #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 nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIdiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25)) #3 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI4edgeSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(12)) #4 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local { double, i32 } @_ZSt9make_pairIRdiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) #4

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIP4edgeSt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #6

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { double, i32 } @_ZSt9make_pairIRdRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) #4

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

declare i32 @printf(ptr noundef, ...) #1

attributes #0 = { mustprogress norecurse 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 = { "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 #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 = { 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #7 = { 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 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = !{!16, !6, i64 0}
!16 = !{!"_ZTS4edge", !6, i64 0, !6, i64 4, !6, i64 8}
!17 = !{!16, !6, i64 4}
!18 = !{!16, !6, i64 8}
!19 = distinct !{!19, !12}
!20 = !{!21, !6, i64 8}
!21 = !{!"_ZTSSt4pairIdiE", !10, i64 0, !6, i64 8}
!22 = !{!23, !23, i64 0}
!23 = !{!"bool", !7, i64 0}
!24 = !{i8 0, i8 2}
!25 = !{}
!26 = distinct !{!26, !12}
!27 = !{!28, !28, i64 0}
!28 = !{!"any pointer", !7, i64 0}
!29 = distinct !{!29, !12}
!30 = distinct !{!30, !12}
!31 = distinct !{!31, !12}
!32 = !{!7, !7, i64 0}
!33 = distinct !{!33, !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"

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl" }
%"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl" = type { %"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl_data" }
%"struct.std::_Vector_base<edge, std::allocator<edge>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::priority_queue" = type <{ %"class.std::vector.0", [8 x i8] }>
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::pair<double, int>, std::allocator<std::pair<double, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<double, int>, std::allocator<std::pair<double, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<double, int>, std::allocator<std::pair<double, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<double, int>, std::allocator<std::pair<double, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.edge = type { i32, i32, i32 }
%"struct.std::pair" = type <{ double, i32, [4 x i8] }>
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@d = external dso_local global i32, align 4
@pre = external dso_local local_unnamed_addr global [75651 x i32], align 16
@ans = external dso_local local_unnamed_addr global [151 x i32], align 16
@dis = external dso_local global [75651 x double], align 16
@e = external dso_local global [151 x %"class.std::vector"], align 16
@Q = external dso_local global %"class.std::priority_queue", align 8
@vis = external dso_local local_unnamed_addr global [75651 x i8], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %struct.edge, align 4
  %6 = alloca %"struct.std::pair", align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %10 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %11 = alloca i32, align 4
  %12 = alloca %"struct.std::pair", align 8
  %13 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @d)
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %15 = icmp sgt i32 %14, 0
  br i1 %15, label %.preheader45.preheader, label %.preheader44

.preheader45.preheader:                           ; preds = %0
  %wide.trip.count = zext nneg i32 %14 to i64
  br label %.preheader45

.preheader45:                                     ; preds = %.preheader45.preheader, %middle.block
  %indvars.iv69 = phi i64 [ 0, %.preheader45.preheader ], [ %indvars.iv.next70, %middle.block ]
  %16 = mul nuw nsw i64 %indvars.iv69, 501
  br label %vector.body

vector.body:                                      ; preds = %vector.body.1, %.preheader45
  %index = phi i64 [ 0, %.preheader45 ], [ %index.next.3, %vector.body.1 ]
  %offset.idx = or disjoint i64 %index, 1
  %17 = add nuw nsw i64 %offset.idx, %16
  %18 = getelementptr inbounds [75651 x double], ptr @dis, i64 0, i64 %17
  %19 = getelementptr inbounds i8, ptr %18, i64 16
  store <2 x double> <double 1.000000e+10, double 1.000000e+10>, ptr %18, align 8, !tbaa !9
  store <2 x double> <double 1.000000e+10, double 1.000000e+10>, ptr %19, align 8, !tbaa !9
  %20 = icmp eq i64 %index, 496
  br i1 %20, label %middle.block, label %vector.body.1, !llvm.loop !11

vector.body.1:                                    ; preds = %vector.body
  %offset.idx.1 = or disjoint i64 %index, 5
  %21 = add nuw nsw i64 %offset.idx.1, %16
  %22 = getelementptr inbounds [75651 x double], ptr @dis, i64 0, i64 %21
  %23 = getelementptr inbounds i8, ptr %22, i64 16
  store <2 x double> <double 1.000000e+10, double 1.000000e+10>, ptr %22, align 8, !tbaa !9
  store <2 x double> <double 1.000000e+10, double 1.000000e+10>, ptr %23, align 8, !tbaa !9
  %offset.idx.2 = or disjoint i64 %index, 9
  %24 = add nuw nsw i64 %offset.idx.2, %16
  %25 = getelementptr inbounds [75651 x double], ptr @dis, i64 0, i64 %24
  %26 = getelementptr inbounds i8, ptr %25, i64 16
  store <2 x double> <double 1.000000e+10, double 1.000000e+10>, ptr %25, align 8, !tbaa !9
  store <2 x double> <double 1.000000e+10, double 1.000000e+10>, ptr %26, align 8, !tbaa !9
  %offset.idx.3 = or disjoint i64 %index, 13
  %27 = add nuw nsw i64 %offset.idx.3, %16
  %28 = getelementptr inbounds [75651 x double], ptr @dis, i64 0, i64 %27
  %29 = getelementptr inbounds i8, ptr %28, i64 16
  store <2 x double> <double 1.000000e+10, double 1.000000e+10>, ptr %28, align 8, !tbaa !9
  store <2 x double> <double 1.000000e+10, double 1.000000e+10>, ptr %29, align 8, !tbaa !9
  %index.next.3 = add nuw nsw i64 %index, 16
  br label %vector.body

.preheader44:                                     ; preds = %middle.block, %0
  %30 = tail call noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIdiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  br i1 %30, label %.preheader, label %.lr.ph

middle.block:                                     ; preds = %vector.body
  %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
  %exitcond72.not = icmp eq i64 %indvars.iv.next70, %wide.trip.count
  br i1 %exitcond72.not, label %.preheader44, label %.preheader45, !llvm.loop !15

.preheader:                                       ; preds = %.lr.ph, %.preheader44
  %31 = load i32, ptr @m, align 4, !tbaa !5
  %32 = add nsw i32 %31, -1
  store i32 %32, ptr @m, align 4, !tbaa !5
  %.not48 = icmp eq i32 %31, 0
  br i1 %.not48, label %._crit_edge, label %.lr.ph49

.lr.ph49:                                         ; preds = %.preheader
  %33 = getelementptr inbounds i8, ptr %5, i64 4
  %34 = getelementptr inbounds i8, ptr %5, i64 8
  br label %36

.lr.ph:                                           ; preds = %.preheader44, %.lr.ph
  tail call void @_ZNSt14priority_queueISt4pairIdiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %35 = tail call noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIdiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  br i1 %35, label %.preheader, label %.lr.ph, !llvm.loop !16

36:                                               ; preds = %.lr.ph49, %36
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  %37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %4, ptr noundef nonnull %3)
  %38 = load i32, ptr %1, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [151 x %"class.std::vector"], ptr @e, i64 0, i64 %39
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %5) #6
  %41 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %41, ptr %5, align 4, !tbaa !17
  %42 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %42, ptr %33, align 4, !tbaa !19
  %43 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %43, ptr %34, align 4, !tbaa !20
  call void @_ZNSt6vectorI4edgeSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(24) %40, ptr noundef nonnull align 4 dereferenceable(12) %5)
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %44 = load i32, ptr @m, align 4, !tbaa !5
  %45 = add nsw i32 %44, -1
  store i32 %45, ptr @m, align 4, !tbaa !5
  %.not = icmp eq i32 %44, 0
  br i1 %.not, label %._crit_edge, label %36, !llvm.loop !21

._crit_edge:                                      ; preds = %36, %.preheader
  store double 0.000000e+00, ptr getelementptr inbounds (i8, ptr @dis, i64 560), align 16, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #6
  store i32 70, ptr %7, align 4, !tbaa !5
  %46 = call { double, i32 } @_ZSt9make_pairIRdiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) getelementptr inbounds (i8, ptr @dis, i64 560), ptr noundef nonnull align 4 dereferenceable(4) %7)
  %.fca.0.extract26 = extractvalue { double, i32 } %46, 0
  %.fca.1.extract27 = extractvalue { double, i32 } %46, 1
  store double %.fca.0.extract26, ptr %6, align 8
  %.sroa.229.0..sroa_idx = getelementptr inbounds i8, ptr %6, i64 8
  store i32 %.fca.1.extract27, ptr %.sroa.229.0..sroa_idx, align 8
  call void @_ZNSt14priority_queueISt4pairIdiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 8 dereferenceable(12) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #6
  %47 = call noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIdiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  br i1 %47, label %._crit_edge55, label %.lr.ph54

.lr.ph54:                                         ; preds = %._crit_edge
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %12, i64 8
  br label %48

48:                                               ; preds = %.lr.ph54, %104
  %49 = call noundef nonnull align 8 dereferenceable(12) ptr @_ZNKSt14priority_queueISt4pairIdiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %50 = getelementptr inbounds i8, ptr %49, i64 8
  %51 = load i32, ptr %50, align 8, !tbaa !22
  call void @_ZNSt14priority_queueISt4pairIdiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [75651 x i8], ptr @vis, i64 0, i64 %52
  %54 = load i8, ptr %53, align 1, !tbaa !24, !range !26, !noundef !27
  %55 = trunc nuw i8 %54 to i1
  br i1 %55, label %104, label %56, !llvm.loop !28

56:                                               ; preds = %48
  store i8 1, ptr %53, align 1, !tbaa !24
  %57 = sdiv i32 %51, 501
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8)
  %58 = srem i32 %51, 501
  store i32 %58, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #6
  %59 = sext i32 %57 to i64
  %60 = getelementptr inbounds [151 x %"class.std::vector"], ptr @e, i64 0, i64 %59
  %61 = call ptr @_ZNSt6vectorI4edgeSaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %60) #6
  store ptr %61, ptr %9, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #6
  %62 = call ptr @_ZNSt6vectorI4edgeSaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %60) #6
  store ptr %62, ptr %10, align 8
  %63 = call noundef zeroext i1 @_ZN9__gnu_cxxneIP4edgeSt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #6
  br i1 %63, label %.lr.ph51, label %._crit_edge52

.lr.ph51:                                         ; preds = %56
  %64 = getelementptr inbounds [75651 x double], ptr @dis, i64 0, i64 %52
  br label %65

._crit_edge52:                                    ; preds = %100, %56
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8)
  br label %104

65:                                               ; preds = %.lr.ph51, %100
  %66 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIP4edgeSt6vectorIS1_SaIS1_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  %67 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIP4edgeSt6vectorIS1_SaIS1_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  %68 = getelementptr inbounds i8, ptr %67, i64 4
  %69 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIP4edgeSt6vectorIS1_SaIS1_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  %70 = getelementptr inbounds i8, ptr %69, i64 8
  %71 = load i32, ptr %70, align 4, !tbaa !20
  %.not43 = icmp eq i32 %71, 0
  br i1 %.not43, label %75, label %72

72:                                               ; preds = %65
  %73 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIP4edgeSt6vectorIS1_SaIS1_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  %74 = getelementptr inbounds i8, ptr %73, i64 8
  br label %75

75:                                               ; preds = %65, %72
  %76 = phi ptr [ %74, %72 ], [ %8, %65 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #6
  %77 = load i32, ptr %66, align 4, !tbaa !5
  %78 = mul nsw i32 %77, 501
  %79 = load i32, ptr %76, align 4, !tbaa !5
  %80 = add nsw i32 %78, %79
  store i32 %80, ptr %11, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [75651 x double], ptr @dis, i64 0, i64 %81
  %83 = load double, ptr %82, align 8, !tbaa !9
  %84 = load double, ptr %64, align 8, !tbaa !9
  %85 = load i32, ptr %68, align 4, !tbaa !5
  %86 = sitofp i32 %85 to double
  %87 = sitofp i32 %79 to double
  %88 = fdiv double %86, %87
  %89 = fadd double %84, %88
  %90 = fcmp ogt double %83, %89
  br i1 %90, label %91, label %100

91:                                               ; preds = %75
  %92 = getelementptr inbounds [75651 x i32], ptr @pre, i64 0, i64 %81
  store i32 %51, ptr %92, align 4, !tbaa !5
  %93 = load i32, ptr %68, align 4, !tbaa !5
  %94 = sitofp i32 %93 to double
  %95 = load i32, ptr %76, align 4, !tbaa !5
  %96 = sitofp i32 %95 to double
  %97 = fdiv double %94, %96
  %98 = fadd double %84, %97
  store double %98, ptr %82, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %12) #6
  %99 = call { double, i32 } @_ZSt9make_pairIRdRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 8 dereferenceable(8) %82, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %.fca.0.extract = extractvalue { double, i32 } %99, 0
  %.fca.1.extract = extractvalue { double, i32 } %99, 1
  store double %.fca.0.extract, ptr %12, align 8
  store i32 %.fca.1.extract, ptr %.sroa.2.0..sroa_idx, align 8
  call void @_ZNSt14priority_queueISt4pairIdiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) @Q, ptr noundef nonnull align 8 dereferenceable(12) %12)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %12) #6
  br label %100

100:                                              ; preds = %91, %75
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #6
  %101 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIP4edgeSt6vectorIS1_SaIS1_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #6
  %102 = call ptr @_ZNSt6vectorI4edgeSaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %60) #6
  store ptr %102, ptr %10, align 8
  %103 = call noundef zeroext i1 @_ZN9__gnu_cxxneIP4edgeSt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #6
  br i1 %103, label %65, label %._crit_edge52, !llvm.loop !29

104:                                              ; preds = %48, %._crit_edge52
  %105 = call noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIdiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) @Q)
  br i1 %105, label %._crit_edge55, label %48

._crit_edge55:                                    ; preds = %104, %._crit_edge
  %106 = load i32, ptr @d, align 4, !tbaa !5
  %107 = mul nsw i32 %106, 501
  %108 = add nsw i32 %107, 1
  %109 = sext i32 %107 to i64
  br label %111

110:                                              ; preds = %111
  store i32 0, ptr @ans, align 16, !tbaa !5
  %.not4158 = icmp eq i32 %.1, 0
  br i1 %.not4158, label %._crit_edge67, label %.lr.ph61

111:                                              ; preds = %120, %._crit_edge55
  %indvars.iv73 = phi i64 [ 2, %._crit_edge55 ], [ %indvars.iv.next74.1, %120 ]
  %.03856 = phi i32 [ %108, %._crit_edge55 ], [ %.1.1, %120 ]
  %112 = sext i32 %.03856 to i64
  %113 = getelementptr inbounds [75651 x double], ptr @dis, i64 0, i64 %112
  %114 = load double, ptr %113, align 8, !tbaa !9
  %115 = add nsw i64 %indvars.iv73, %109
  %116 = getelementptr inbounds [75651 x double], ptr @dis, i64 0, i64 %115
  %117 = load double, ptr %116, align 8, !tbaa !9
  %118 = fcmp ogt double %114, %117
  %119 = trunc nsw i64 %115 to i32
  %.1 = select i1 %118, i32 %119, i32 %.03856
  %exitcond76.not = icmp eq i64 %indvars.iv73, 500
  br i1 %exitcond76.not, label %110, label %120, !llvm.loop !30

120:                                              ; preds = %111
  %indvars.iv.next74 = or disjoint i64 %indvars.iv73, 1
  %121 = sext i32 %.1 to i64
  %122 = getelementptr inbounds [75651 x double], ptr @dis, i64 0, i64 %121
  %123 = load double, ptr %122, align 8, !tbaa !9
  %124 = add nsw i64 %indvars.iv.next74, %109
  %125 = getelementptr inbounds [75651 x double], ptr @dis, i64 0, i64 %124
  %126 = load double, ptr %125, align 8, !tbaa !9
  %127 = fcmp ogt double %123, %126
  %128 = trunc nsw i64 %124 to i32
  %.1.1 = select i1 %127, i32 %128, i32 %.1
  %indvars.iv.next74.1 = add nuw nsw i64 %indvars.iv73, 2
  br label %111

.lr.ph61:                                         ; preds = %110, %.lr.ph61
  %.259 = phi i32 [ %136, %.lr.ph61 ], [ %.1, %110 ]
  %129 = sdiv i32 %.259, 501
  %130 = load i32, ptr @ans, align 16, !tbaa !5
  %131 = add nsw i32 %130, 1
  store i32 %131, ptr @ans, align 16, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [151 x i32], ptr @ans, i64 0, i64 %132
  store i32 %129, ptr %133, align 4, !tbaa !5
  %134 = sext i32 %.259 to i64
  %135 = getelementptr inbounds [75651 x i32], ptr @pre, i64 0, i64 %134
  %136 = load i32, ptr %135, align 4, !tbaa !5
  %.not41 = icmp eq i32 %136, 0
  br i1 %.not41, label %._crit_edge62, label %.lr.ph61, !llvm.loop !31

._crit_edge62:                                    ; preds = %.lr.ph61
  %.pre = load i32, ptr @ans, align 16, !tbaa !5
  %.not4263 = icmp eq i32 %.pre, 0
  br i1 %.not4263, label %._crit_edge67, label %.lr.ph66.preheader

.lr.ph66.preheader:                               ; preds = %._crit_edge62
  %137 = sext i32 %.pre to i64
  br label %.lr.ph66

._crit_edge67:                                    ; preds = %.lr.ph66, %110, %._crit_edge62
  ret i32 0

.lr.ph66:                                         ; preds = %.lr.ph66.preheader, %.lr.ph66
  %indvars.iv77 = phi i64 [ %137, %.lr.ph66.preheader ], [ %indvars.iv.next78, %.lr.ph66 ]
  %138 = getelementptr inbounds [151 x i32], ptr @ans, i64 0, i64 %indvars.iv77
  %139 = load i32, ptr %138, align 4, !tbaa !5
  %140 = icmp eq i64 %indvars.iv77, 1
  %141 = zext i1 %140 to i64
  %142 = getelementptr inbounds [3 x i8], ptr @.str.4, i64 0, i64 %141
  %143 = load i8, ptr %142, align 1, !tbaa !32
  %144 = sext i8 %143 to i32
  %145 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %139, i32 noundef %144)
  %indvars.iv.next78 = add nsw i64 %indvars.iv77, -1
  %.not42 = icmp eq i64 %indvars.iv.next78, 0
  br i1 %.not42, label %._crit_edge67, label %.lr.ph66, !llvm.loop !33
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIdiESt6vectorIS1_SaIS1_EESt7greaterIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25)) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI4edgeSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #4 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local { double, i32 } @_ZSt9make_pairIRdiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIP4edgeSt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { double, i32 } @_ZSt9make_pairIRdRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

attributes #0 = { mustprogress norecurse 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 = { nofree nounwind "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 #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 = { 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 #5 = { 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 #6 = { 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 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = !{!18, !6, i64 0}
!18 = !{!"_ZTS4edge", !6, i64 0, !6, i64 4, !6, i64 8}
!19 = !{!18, !6, i64 4}
!20 = !{!18, !6, i64 8}
!21 = distinct !{!21, !12}
!22 = !{!23, !6, i64 8}
!23 = !{!"_ZTSSt4pairIdiE", !10, i64 0, !6, i64 8}
!24 = !{!25, !25, i64 0}
!25 = !{!"bool", !7, i64 0}
!26 = !{i8 0, i8 2}
!27 = !{}
!28 = distinct !{!28, !12}
!29 = distinct !{!29, !12}
!30 = distinct !{!30, !12}
!31 = distinct !{!31, !12}
!32 = !{!7, !7, i64 0}
!33 = distinct !{!33, !12}


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