; LLVM IR from bqi343/cp-notebook :: Contests/USACO Training/Ch 3/3.3 camelot (main)

; 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::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"struct.std::pair" = type { i32, i32 }
%struct.Dijkstra = type { [780 x i32] }
%"class.std::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator" = type { i8 }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@R = external dso_local global i32, align 4
@C = external dso_local global i32, align 4
@king = external dso_local global %"struct.std::pair", align 4
@xd = external dso_local global [8 x i32], align 16
@yd = external dso_local global [8 x i32], align 16
@ans = external dso_local global i32, align 4
@D = external dso_local global [780 x %struct.Dijkstra], align 16
@E = external dso_local global [780 x %struct.Dijkstra], align 16
@knight = external dso_local global %"class.std::vector.3", align 8
@.str.8 = external hidden unnamed_addr constant [8 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.9 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2io5setIOENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef) #0

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

; 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 @_Z7addEdgeiii(i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4testii(i32 noundef, i32 noundef) #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #4

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #5 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::__cxx11::basic_string", align 8
  %3 = alloca %"class.std::allocator", align 1
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i8, align 1
  %7 = alloca i32, align 4
  %8 = alloca %"struct.std::pair", align 4
  %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
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #8
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #8
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %2, ptr noundef @.str.8, ptr noundef nonnull align 1 dereferenceable(1) %3)
          to label %25 unwind label %50

25:                                               ; preds = %0
  invoke void @_ZN2io5setIOENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef %2)
          to label %26 unwind label %54

26:                                               ; preds = %25
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #8
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #8
  call void @_ZN2io2reIiJiEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) @R, ptr noundef nonnull align 4 dereferenceable(4) @C)
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) @R, ptr noundef nonnull align 4 dereferenceable(4) @C) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  call void @_ZN2io2reIcJiEEEvRT_DpRT0_(ptr noundef nonnull align 1 dereferenceable(1) %6, ptr noundef nonnull align 4 dereferenceable(4) %7)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  %27 = load i8, ptr %6, align 1, !tbaa !5
  %28 = sext i8 %27 to i32
  %29 = sub nsw i32 %28, 65
  store i32 %29, ptr %9, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  %30 = load i32, ptr %7, align 4, !tbaa !8
  %31 = sub nsw i32 %30, 1
  store i32 %31, ptr %10, align 4, !tbaa !8
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %8, ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %32 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) @king, ptr noundef nonnull align 4 dereferenceable(8) %8) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  br label %33

33:                                               ; preds = %41, %26
  %34 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 1 dereferenceable(1) %6)
  %35 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %34, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %36 = load ptr, ptr %35, align 8, !tbaa !10
  %37 = getelementptr i8, ptr %36, i64 -24
  %38 = load i64, ptr %37, align 8
  %39 = getelementptr inbounds i8, ptr %35, i64 %38
  %40 = call noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264) %39)
  br i1 %40, label %41, label %59

41:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  %42 = load i32, ptr @C, align 4, !tbaa !8
  %43 = load i8, ptr %6, align 1, !tbaa !5
  %44 = sext i8 %43 to i32
  %45 = sub nsw i32 %44, 65
  %46 = mul nsw i32 %42, %45
  %47 = load i32, ptr %7, align 4, !tbaa !8
  %48 = add nsw i32 %46, %47
  %49 = sub nsw i32 %48, 1
  store i32 %49, ptr %11, align 4, !tbaa !8
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) @knight, ptr noundef nonnull align 4 dereferenceable(4) %11)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  br label %33, !llvm.loop !12

50:                                               ; preds = %0
  %51 = landingpad { ptr, i32 }
          cleanup
  %52 = extractvalue { ptr, i32 } %51, 0
  store ptr %52, ptr %4, align 8
  %53 = extractvalue { ptr, i32 } %51, 1
  store i32 %53, ptr %5, align 4
  br label %58

54:                                               ; preds = %25
  %55 = landingpad { ptr, i32 }
          cleanup
  %56 = extractvalue { ptr, i32 } %55, 0
  store ptr %56, ptr %4, align 8
  %57 = extractvalue { ptr, i32 } %55, 1
  store i32 %57, ptr %5, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #8
  br label %58

58:                                               ; preds = %54, %50
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #8
  br label %225

59:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  store i32 0, ptr %12, align 4, !tbaa !8
  br label %60

60:                                               ; preds = %122, %59
  %61 = load i32, ptr %12, align 4, !tbaa !8
  %62 = load i32, ptr @R, align 4, !tbaa !8
  %63 = icmp slt i32 %61, %62
  br i1 %63, label %65, label %64

64:                                               ; preds = %60
  store i32 4, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %125

65:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  store i32 0, ptr %14, align 4, !tbaa !8
  br label %66

66:                                               ; preds = %118, %65
  %67 = load i32, ptr %14, align 4, !tbaa !8
  %68 = load i32, ptr @C, align 4, !tbaa !8
  %69 = icmp slt i32 %67, %68
  br i1 %69, label %71, label %70

70:                                               ; preds = %66
  store i32 7, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  br label %121

71:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  store i32 0, ptr %15, align 4, !tbaa !8
  br label %72

72:                                               ; preds = %114, %71
  %73 = load i32, ptr %15, align 4, !tbaa !8
  %74 = icmp slt i32 %73, 4
  br i1 %74, label %76, label %75

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

76:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  %77 = load i32, ptr %12, align 4, !tbaa !8
  %78 = load i32, ptr %15, align 4, !tbaa !8
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [8 x i32], ptr @xd, i64 0, i64 %79
  %81 = load i32, ptr %80, align 4, !tbaa !8
  %82 = add nsw i32 %77, %81
  store i32 %82, ptr %16, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  %83 = load i32, ptr %14, align 4, !tbaa !8
  %84 = load i32, ptr %15, align 4, !tbaa !8
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [8 x i32], ptr @yd, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !8
  %88 = add nsw i32 %83, %87
  store i32 %88, ptr %17, align 4, !tbaa !8
  %89 = load i32, ptr %16, align 4, !tbaa !8
  %90 = icmp sle i32 0, %89
  br i1 %90, label %91, label %113

91:                                               ; preds = %76
  %92 = load i32, ptr %16, align 4, !tbaa !8
  %93 = load i32, ptr @R, align 4, !tbaa !8
  %94 = icmp slt i32 %92, %93
  br i1 %94, label %95, label %113

95:                                               ; preds = %91
  %96 = load i32, ptr %17, align 4, !tbaa !8
  %97 = icmp sle i32 0, %96
  br i1 %97, label %98, label %113

98:                                               ; preds = %95
  %99 = load i32, ptr %17, align 4, !tbaa !8
  %100 = load i32, ptr @C, align 4, !tbaa !8
  %101 = icmp slt i32 %99, %100
  br i1 %101, label %102, label %113

102:                                              ; preds = %98
  %103 = load i32, ptr @C, align 4, !tbaa !8
  %104 = load i32, ptr %12, align 4, !tbaa !8
  %105 = mul nsw i32 %103, %104
  %106 = load i32, ptr %14, align 4, !tbaa !8
  %107 = add nsw i32 %105, %106
  %108 = load i32, ptr @C, align 4, !tbaa !8
  %109 = load i32, ptr %16, align 4, !tbaa !8
  %110 = mul nsw i32 %108, %109
  %111 = load i32, ptr %17, align 4, !tbaa !8
  %112 = add nsw i32 %110, %111
  call void @_Z7addEdgeiii(i32 noundef %107, i32 noundef %112, i32 noundef 1)
  br label %113

113:                                              ; preds = %102, %98, %95, %91, %76
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  br label %114

114:                                              ; preds = %113
  %115 = load i32, ptr %15, align 4, !tbaa !8
  %116 = add nsw i32 %115, 1
  store i32 %116, ptr %15, align 4, !tbaa !8
  br label %72, !llvm.loop !14

117:                                              ; preds = %75
  br label %118

118:                                              ; preds = %117
  %119 = load i32, ptr %14, align 4, !tbaa !8
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %14, align 4, !tbaa !8
  br label %66, !llvm.loop !15

121:                                              ; preds = %70
  br label %122

122:                                              ; preds = %121
  %123 = load i32, ptr %12, align 4, !tbaa !8
  %124 = add nsw i32 %123, 1
  store i32 %124, ptr %12, align 4, !tbaa !8
  br label %60, !llvm.loop !16

125:                                              ; preds = %64
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  store i32 0, ptr %18, align 4, !tbaa !8
  br label %126

126:                                              ; preds = %195, %125
  %127 = load i32, ptr %18, align 4, !tbaa !8
  %128 = load i32, ptr @R, align 4, !tbaa !8
  %129 = load i32, ptr @C, align 4, !tbaa !8
  %130 = mul nsw i32 %128, %129
  %131 = icmp slt i32 %127, %130
  br i1 %131, label %133, label %132

132:                                              ; preds = %126
  store i32 13, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  br label %198

133:                                              ; preds = %126
  %134 = load i32, ptr %18, align 4, !tbaa !8
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [780 x %struct.Dijkstra], ptr @D, i64 0, i64 %135
  %137 = load i32, ptr %18, align 4, !tbaa !8
  call void @_ZN8DijkstraILi780EE3genEi(ptr noundef nonnull align 4 dereferenceable(3120) %136, i32 noundef %137)
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #8
  store i32 0, ptr %19, align 4, !tbaa !8
  br label %138

138:                                              ; preds = %188, %133
  %139 = load i32, ptr %19, align 4, !tbaa !8
  %140 = load i32, ptr @R, align 4, !tbaa !8
  %141 = icmp slt i32 %139, %140
  br i1 %141, label %143, label %142

142:                                              ; preds = %138
  store i32 16, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  br label %191

143:                                              ; preds = %138
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #8
  store i32 0, ptr %20, align 4, !tbaa !8
  br label %144

144:                                              ; preds = %184, %143
  %145 = load i32, ptr %20, align 4, !tbaa !8
  %146 = load i32, ptr @C, align 4, !tbaa !8
  %147 = icmp slt i32 %145, %146
  br i1 %147, label %149, label %148

148:                                              ; preds = %144
  store i32 19, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  br label %187

149:                                              ; preds = %144
  %150 = load i32, ptr %18, align 4, !tbaa !8
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [780 x %struct.Dijkstra], ptr @D, i64 0, i64 %151
  %153 = getelementptr inbounds %struct.Dijkstra, ptr %152, i32 0, i32 0
  %154 = load i32, ptr @C, align 4, !tbaa !8
  %155 = load i32, ptr %19, align 4, !tbaa !8
  %156 = mul nsw i32 %154, %155
  %157 = load i32, ptr %20, align 4, !tbaa !8
  %158 = add nsw i32 %156, %157
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [780 x i32], ptr %153, i64 0, i64 %159
  %161 = load i32, ptr %160, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #8
  %162 = load i32, ptr %19, align 4, !tbaa !8
  %163 = load i32, ptr @king, align 4, !tbaa !17
  %164 = sub nsw i32 %162, %163
  %165 = call i32 @llvm.abs.i32(i32 %164, i1 true)
  store i32 %165, ptr %21, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #8
  %166 = load i32, ptr %20, align 4, !tbaa !8
  %167 = load i32, ptr getelementptr inbounds (%"struct.std::pair", ptr @king, i32 0, i32 1), align 4, !tbaa !19
  %168 = sub nsw i32 %166, %167
  %169 = call i32 @llvm.abs.i32(i32 %168, i1 true)
  store i32 %169, ptr %22, align 4, !tbaa !8
  %170 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %21, ptr noundef nonnull align 4 dereferenceable(4) %22)
  %171 = load i32, ptr %170, align 4, !tbaa !8
  %172 = add nsw i32 %161, %171
  %173 = load i32, ptr %18, align 4, !tbaa !8
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [780 x %struct.Dijkstra], ptr @E, i64 0, i64 %174
  %176 = getelementptr inbounds %struct.Dijkstra, ptr %175, i32 0, i32 0
  %177 = load i32, ptr @C, align 4, !tbaa !8
  %178 = load i32, ptr %19, align 4, !tbaa !8
  %179 = mul nsw i32 %177, %178
  %180 = load i32, ptr %20, align 4, !tbaa !8
  %181 = add nsw i32 %179, %180
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [780 x i32], ptr %176, i64 0, i64 %182
  store i32 %172, ptr %183, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #8
  br label %184

184:                                              ; preds = %149
  %185 = load i32, ptr %20, align 4, !tbaa !8
  %186 = add nsw i32 %185, 1
  store i32 %186, ptr %20, align 4, !tbaa !8
  br label %144, !llvm.loop !20

187:                                              ; preds = %148
  br label %188

188:                                              ; preds = %187
  %189 = load i32, ptr %19, align 4, !tbaa !8
  %190 = add nsw i32 %189, 1
  store i32 %190, ptr %19, align 4, !tbaa !8
  br label %138, !llvm.loop !21

191:                                              ; preds = %142
  %192 = load i32, ptr %18, align 4, !tbaa !8
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds [780 x %struct.Dijkstra], ptr @E, i64 0, i64 %193
  call void @_ZN8DijkstraILi780EE3genEv(ptr noundef nonnull align 4 dereferenceable(3120) %194)
  br label %195

195:                                              ; preds = %191
  %196 = load i32, ptr %18, align 4, !tbaa !8
  %197 = add nsw i32 %196, 1
  store i32 %197, ptr %18, align 4, !tbaa !8
  br label %126, !llvm.loop !22

198:                                              ; preds = %132
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #8
  store i32 0, ptr %23, align 4, !tbaa !8
  br label %199

199:                                              ; preds = %217, %198
  %200 = load i32, ptr %23, align 4, !tbaa !8
  %201 = load i32, ptr @R, align 4, !tbaa !8
  %202 = icmp slt i32 %200, %201
  br i1 %202, label %204, label %203

203:                                              ; preds = %199
  store i32 22, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #8
  br label %220

204:                                              ; preds = %199
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #8
  store i32 0, ptr %24, align 4, !tbaa !8
  br label %205

205:                                              ; preds = %213, %204
  %206 = load i32, ptr %24, align 4, !tbaa !8
  %207 = load i32, ptr @C, align 4, !tbaa !8
  %208 = icmp slt i32 %206, %207
  br i1 %208, label %210, label %209

209:                                              ; preds = %205
  store i32 25, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #8
  br label %216

210:                                              ; preds = %205
  %211 = load i32, ptr %23, align 4, !tbaa !8
  %212 = load i32, ptr %24, align 4, !tbaa !8
  call void @_Z4testii(i32 noundef %211, i32 noundef %212)
  br label %213

213:                                              ; preds = %210
  %214 = load i32, ptr %24, align 4, !tbaa !8
  %215 = add nsw i32 %214, 1
  store i32 %215, ptr %24, align 4, !tbaa !8
  br label %205, !llvm.loop !23

216:                                              ; preds = %209
  br label %217

217:                                              ; preds = %216
  %218 = load i32, ptr %23, align 4, !tbaa !8
  %219 = add nsw i32 %218, 1
  store i32 %219, ptr %23, align 4, !tbaa !8
  br label %199, !llvm.loop !24

220:                                              ; preds = %203
  %221 = load i32, ptr @ans, align 4, !tbaa !8
  %222 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %221)
  %223 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %222, ptr noundef @.str.9)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #8
  %224 = load i32, ptr %1, align 4
  ret i32 %224

225:                                              ; preds = %58
  %226 = load ptr, ptr %4, align 8
  %227 = load i32, ptr %5, align 4
  %228 = insertvalue { ptr, i32 } poison, ptr %226, 0
  %229 = insertvalue { ptr, i32 } %228, i32 %227, 1
  resume { ptr, i32 } %229
}

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #1 align 2

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(1)) #6

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #6

; Function Attrs: mustprogress uwtable
declare noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264)) #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8DijkstraILi780EE3genEi(ptr noundef nonnull align 4 dereferenceable(3120), i32 noundef) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8DijkstraILi780EE3genEv(ptr noundef nonnull align 4 dereferenceable(3120)) #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #7

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 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 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 #6 = { "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 = { inlinehint 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 #8 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"vtable pointer", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}
!17 = !{!18, !9, i64 0}
!18 = !{!"_ZTSSt4pairIiiE", !9, i64 0, !9, i64 4}
!19 = !{!18, !9, i64 4}
!20 = distinct !{!20, !13}
!21 = distinct !{!21, !13}
!22 = distinct !{!22, !13}
!23 = distinct !{!23, !13}
!24 = distinct !{!24, !13}


; 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::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"struct.std::pair" = type { i32, i32 }
%struct.Dijkstra = type { [780 x i32] }
%"class.std::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator" = type { i8 }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@R = external dso_local global i32, align 4
@C = external dso_local global i32, align 4
@king = external dso_local global %"struct.std::pair", align 4
@xd = external dso_local local_unnamed_addr global [8 x i32], align 16
@yd = external dso_local local_unnamed_addr global [8 x i32], align 16
@ans = external dso_local local_unnamed_addr global i32, align 4
@D = external dso_local global [780 x %struct.Dijkstra], align 16
@E = external dso_local global [780 x %struct.Dijkstra], align 16
@knight = external dso_local global %"class.std::vector.3", align 8
@.str.8 = external hidden unnamed_addr constant [8 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.9 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2io5setIOENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef) local_unnamed_addr #0

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

; 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 @_Z7addEdgeiii(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4testii(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #4

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #5 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::__cxx11::basic_string", align 8
  %2 = alloca %"class.std::allocator", align 1
  %3 = alloca i8, align 1
  %4 = alloca i32, align 4
  %5 = alloca %"struct.std::pair", align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %2) #8
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #8
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull @.str.8, ptr noundef nonnull align 1 dereferenceable(1) %2)
          to label %11 unwind label %44

11:                                               ; preds = %0
  invoke void @_ZN2io5setIOENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull %1)
          to label %12 unwind label %46

12:                                               ; preds = %11
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #8
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #8
  call void @_ZN2io2reIiJiEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) @R, ptr noundef nonnull align 4 dereferenceable(4) @C)
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) @R, ptr noundef nonnull align 4 dereferenceable(4) @C) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %3) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #8
  call void @_ZN2io2reIcJiEEEvRT_DpRT0_(ptr noundef nonnull align 1 dereferenceable(1) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #8
  %13 = load i8, ptr %3, align 1, !tbaa !5
  %14 = sext i8 %13 to i32
  %15 = add nsw i32 %14, -65
  store i32 %15, ptr %6, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #8
  %16 = load i32, ptr %4, align 4, !tbaa !8
  %17 = add nsw i32 %16, -1
  store i32 %17, ptr %7, align 4, !tbaa !8
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %18 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) @king, ptr noundef nonnull align 4 dereferenceable(8) %5) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 1 dereferenceable(1) %3)
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %21 = load ptr, ptr %20, align 8, !tbaa !10
  %22 = getelementptr i8, ptr %21, i64 -24
  %23 = load i64, ptr %22, align 8
  %24 = getelementptr inbounds i8, ptr %20, i64 %23
  %25 = call noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264) %24)
  br i1 %25, label %.lr.ph, label %.preheader63

.preheader63:                                     ; preds = %.lr.ph, %12
  %26 = load i32, ptr @R, align 4, !tbaa !8
  %27 = icmp sgt i32 %26, 0
  %.pre84 = load i32, ptr @C, align 4, !tbaa !8
  %28 = icmp sgt i32 %.pre84, 0
  %or.cond93 = select i1 %27, i1 %28, i1 false
  br i1 %or.cond93, label %.preheader62, label %.preheader60

.lr.ph:                                           ; preds = %12, %.lr.ph
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #8
  %29 = load i32, ptr @C, align 4, !tbaa !8
  %30 = load i8, ptr %3, align 1, !tbaa !5
  %31 = sext i8 %30 to i32
  %32 = add nsw i32 %31, -65
  %33 = mul nsw i32 %32, %29
  %34 = load i32, ptr %4, align 4, !tbaa !8
  %35 = add i32 %34, -1
  %36 = add i32 %35, %33
  store i32 %36, ptr %8, align 4, !tbaa !8
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) @knight, ptr noundef nonnull align 4 dereferenceable(4) %8)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #8
  %37 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 1 dereferenceable(1) %3)
  %38 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %37, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %39 = load ptr, ptr %38, align 8, !tbaa !10
  %40 = getelementptr i8, ptr %39, i64 -24
  %41 = load i64, ptr %40, align 8
  %42 = getelementptr inbounds i8, ptr %38, i64 %41
  %43 = call noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264) %42)
  br i1 %43, label %.lr.ph, label %.preheader63, !llvm.loop !12

44:                                               ; preds = %0
  %45 = landingpad { ptr, i32 }
          cleanup
  br label %48

46:                                               ; preds = %11
  %47 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #8
  br label %48

48:                                               ; preds = %46, %44
  %.pn = phi { ptr, i32 } [ %47, %46 ], [ %45, %44 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #8
  resume { ptr, i32 } %.pn

.preheader62:                                     ; preds = %.preheader63, %._crit_edge
  %49 = phi i32 [ %62, %._crit_edge ], [ %26, %.preheader63 ]
  %50 = phi i32 [ %63, %._crit_edge ], [ %.pre84, %.preheader63 ]
  %.05266 = phi i32 [ %64, %._crit_edge ], [ 0, %.preheader63 ]
  %51 = icmp sgt i32 %50, 0
  br i1 %51, label %.preheader61, label %._crit_edge

.preheader60:                                     ; preds = %._crit_edge, %.preheader63
  %52 = phi i32 [ %.pre84, %.preheader63 ], [ %63, %._crit_edge ]
  %53 = phi i32 [ %26, %.preheader63 ], [ %62, %._crit_edge ]
  %54 = mul nsw i32 %52, %53
  %55 = icmp sgt i32 %54, 0
  br i1 %55, label %.lr.ph73, label %.preheader58

.preheader61:                                     ; preds = %.preheader62, %131
  %56 = phi i32 [ %133, %131 ], [ %50, %.preheader62 ]
  %.05165 = phi i32 [ %132, %131 ], [ 0, %.preheader62 ]
  %57 = load i32, ptr @xd, align 16, !tbaa !8
  %58 = add nsw i32 %57, %.05266
  %59 = load i32, ptr @yd, align 16, !tbaa !8
  %60 = add nsw i32 %59, %.05165
  %61 = icmp sgt i32 %58, -1
  br i1 %61, label %66, label %77

._crit_edge.loopexit:                             ; preds = %131
  %.pre = load i32, ptr @R, align 4, !tbaa !8
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader62
  %62 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %49, %.preheader62 ]
  %63 = phi i32 [ %133, %._crit_edge.loopexit ], [ %50, %.preheader62 ]
  %64 = add nuw nsw i32 %.05266, 1
  %65 = icmp slt i32 %64, %62
  br i1 %65, label %.preheader62, label %.preheader60, !llvm.loop !14

66:                                               ; preds = %.preheader61
  %67 = load i32, ptr @R, align 4, !tbaa !8
  %68 = icmp slt i32 %58, %67
  %69 = icmp sgt i32 %60, -1
  %70 = icmp slt i32 %60, %56
  %71 = and i1 %69, %70
  %or.cond94 = select i1 %68, i1 %71, i1 false
  br i1 %or.cond94, label %72, label %77

72:                                               ; preds = %66
  %73 = mul nsw i32 %56, %.05266
  %74 = add nsw i32 %73, %.05165
  %75 = mul nsw i32 %56, %58
  %76 = add nuw nsw i32 %75, %60
  call void @_Z7addEdgeiii(i32 noundef %74, i32 noundef %76, i32 noundef 1)
  br label %77

77:                                               ; preds = %72, %66, %.preheader61
  %78 = load i32, ptr getelementptr inbounds (i8, ptr @xd, i64 4), align 4, !tbaa !8
  %79 = add nsw i32 %78, %.05266
  %80 = load i32, ptr getelementptr inbounds (i8, ptr @yd, i64 4), align 4, !tbaa !8
  %81 = add nsw i32 %80, %.05165
  %82 = icmp sgt i32 %79, -1
  br i1 %82, label %83, label %95

83:                                               ; preds = %77
  %84 = load i32, ptr @R, align 4, !tbaa !8
  %85 = icmp slt i32 %79, %84
  %86 = icmp sgt i32 %81, -1
  %or.cond.1 = select i1 %85, i1 %86, i1 false
  br i1 %or.cond.1, label %87, label %95

87:                                               ; preds = %83
  %88 = load i32, ptr @C, align 4, !tbaa !8
  %89 = icmp slt i32 %81, %88
  br i1 %89, label %90, label %95

90:                                               ; preds = %87
  %91 = mul nsw i32 %88, %.05266
  %92 = add nsw i32 %91, %.05165
  %93 = mul nsw i32 %88, %79
  %94 = add nuw nsw i32 %93, %81
  call void @_Z7addEdgeiii(i32 noundef %92, i32 noundef %94, i32 noundef 1)
  br label %95

95:                                               ; preds = %90, %87, %83, %77
  %96 = load i32, ptr getelementptr inbounds (i8, ptr @xd, i64 8), align 8, !tbaa !8
  %97 = add nsw i32 %96, %.05266
  %98 = load i32, ptr getelementptr inbounds (i8, ptr @yd, i64 8), align 8, !tbaa !8
  %99 = add nsw i32 %98, %.05165
  %100 = icmp sgt i32 %97, -1
  br i1 %100, label %101, label %113

101:                                              ; preds = %95
  %102 = load i32, ptr @R, align 4, !tbaa !8
  %103 = icmp slt i32 %97, %102
  %104 = icmp sgt i32 %99, -1
  %or.cond.2 = select i1 %103, i1 %104, i1 false
  br i1 %or.cond.2, label %105, label %113

105:                                              ; preds = %101
  %106 = load i32, ptr @C, align 4, !tbaa !8
  %107 = icmp slt i32 %99, %106
  br i1 %107, label %108, label %113

108:                                              ; preds = %105
  %109 = mul nsw i32 %106, %.05266
  %110 = add nsw i32 %109, %.05165
  %111 = mul nsw i32 %106, %97
  %112 = add nuw nsw i32 %111, %99
  call void @_Z7addEdgeiii(i32 noundef %110, i32 noundef %112, i32 noundef 1)
  br label %113

113:                                              ; preds = %108, %105, %101, %95
  %114 = load i32, ptr getelementptr inbounds (i8, ptr @xd, i64 12), align 4, !tbaa !8
  %115 = add nsw i32 %114, %.05266
  %116 = load i32, ptr getelementptr inbounds (i8, ptr @yd, i64 12), align 4, !tbaa !8
  %117 = add nsw i32 %116, %.05165
  %118 = icmp sgt i32 %115, -1
  br i1 %118, label %119, label %131

119:                                              ; preds = %113
  %120 = load i32, ptr @R, align 4, !tbaa !8
  %121 = icmp slt i32 %115, %120
  %122 = icmp sgt i32 %117, -1
  %or.cond.3 = select i1 %121, i1 %122, i1 false
  br i1 %or.cond.3, label %123, label %131

123:                                              ; preds = %119
  %124 = load i32, ptr @C, align 4, !tbaa !8
  %125 = icmp slt i32 %117, %124
  br i1 %125, label %126, label %131

126:                                              ; preds = %123
  %127 = mul nsw i32 %124, %.05266
  %128 = add nsw i32 %127, %.05165
  %129 = mul nsw i32 %124, %115
  %130 = add nuw nsw i32 %129, %117
  call void @_Z7addEdgeiii(i32 noundef %128, i32 noundef %130, i32 noundef 1)
  br label %131

131:                                              ; preds = %126, %123, %119, %113
  %132 = add nuw nsw i32 %.05165, 1
  %133 = load i32, ptr @C, align 4, !tbaa !8
  %134 = icmp slt i32 %132, %133
  br i1 %134, label %.preheader61, label %._crit_edge.loopexit, !llvm.loop !16

.preheader58:                                     ; preds = %._crit_edge71, %.preheader60
  %135 = phi i32 [ %52, %.preheader60 ], [ %151, %._crit_edge71 ]
  %136 = phi i32 [ %53, %.preheader60 ], [ %150, %._crit_edge71 ]
  %137 = icmp sgt i32 %136, 0
  %138 = icmp sgt i32 %135, 0
  %or.cond95 = and i1 %137, %138
  br i1 %or.cond95, label %.preheader, label %._crit_edge78

.lr.ph73:                                         ; preds = %.preheader60, %._crit_edge71
  %indvars.iv = phi i64 [ %indvars.iv.next, %._crit_edge71 ], [ 0, %.preheader60 ]
  %139 = getelementptr inbounds [780 x %struct.Dijkstra], ptr @D, i64 0, i64 %indvars.iv
  %140 = trunc nuw nsw i64 %indvars.iv to i32
  call void @_ZN8DijkstraILi780EE3genEi(ptr noundef nonnull align 4 dereferenceable(3120) %139, i32 noundef %140)
  %141 = load i32, ptr @R, align 4, !tbaa !8
  %142 = icmp sgt i32 %141, 0
  br i1 %142, label %.preheader59.lr.ph, label %._crit_edge71

.preheader59.lr.ph:                               ; preds = %.lr.ph73
  %143 = getelementptr inbounds [780 x %struct.Dijkstra], ptr @E, i64 0, i64 %indvars.iv
  %144 = load i32, ptr @C, align 4, !tbaa !8
  %145 = icmp sgt i32 %144, 0
  br i1 %145, label %.preheader59, label %._crit_edge71

.preheader59:                                     ; preds = %.preheader59.lr.ph, %._crit_edge69
  %146 = phi i32 [ %155, %._crit_edge69 ], [ %141, %.preheader59.lr.ph ]
  %147 = phi i32 [ %156, %._crit_edge69 ], [ %144, %.preheader59.lr.ph ]
  %.04670 = phi i32 [ %157, %._crit_edge69 ], [ 0, %.preheader59.lr.ph ]
  %148 = icmp sgt i32 %147, 0
  br i1 %148, label %.lr.ph68, label %._crit_edge69

._crit_edge71:                                    ; preds = %._crit_edge69, %.preheader59.lr.ph, %.lr.ph73
  %149 = getelementptr inbounds [780 x %struct.Dijkstra], ptr @E, i64 0, i64 %indvars.iv
  call void @_ZN8DijkstraILi780EE3genEv(ptr noundef nonnull align 4 dereferenceable(3120) %149)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %150 = load i32, ptr @R, align 4, !tbaa !8
  %151 = load i32, ptr @C, align 4, !tbaa !8
  %152 = mul nsw i32 %151, %150
  %153 = sext i32 %152 to i64
  %154 = icmp slt i64 %indvars.iv.next, %153
  br i1 %154, label %.lr.ph73, label %.preheader58, !llvm.loop !17

._crit_edge69.loopexit:                           ; preds = %.lr.ph68
  %.pre85 = load i32, ptr @R, align 4, !tbaa !8
  br label %._crit_edge69

._crit_edge69:                                    ; preds = %._crit_edge69.loopexit, %.preheader59
  %155 = phi i32 [ %.pre85, %._crit_edge69.loopexit ], [ %146, %.preheader59 ]
  %156 = phi i32 [ %174, %._crit_edge69.loopexit ], [ %147, %.preheader59 ]
  %157 = add nuw nsw i32 %.04670, 1
  %158 = icmp slt i32 %157, %155
  br i1 %158, label %.preheader59, label %._crit_edge71, !llvm.loop !18

.lr.ph68:                                         ; preds = %.preheader59, %.lr.ph68
  %159 = phi i32 [ %174, %.lr.ph68 ], [ %147, %.preheader59 ]
  %.04567 = phi i32 [ %179, %.lr.ph68 ], [ 0, %.preheader59 ]
  %160 = mul nsw i32 %159, %.04670
  %161 = add nsw i32 %160, %.04567
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [780 x i32], ptr %139, i64 0, i64 %162
  %164 = load i32, ptr %163, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #8
  %165 = load i32, ptr @king, align 4, !tbaa !19
  %166 = sub nsw i32 %.04670, %165
  %167 = call i32 @llvm.abs.i32(i32 %166, i1 true)
  store i32 %167, ptr %9, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #8
  %168 = load i32, ptr getelementptr inbounds (i8, ptr @king, i64 4), align 4, !tbaa !21
  %169 = sub nsw i32 %.04567, %168
  %170 = call i32 @llvm.abs.i32(i32 %169, i1 true)
  store i32 %170, ptr %10, align 4, !tbaa !8
  %171 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %172 = load i32, ptr %171, align 4, !tbaa !8
  %173 = add nsw i32 %172, %164
  %174 = load i32, ptr @C, align 4, !tbaa !8
  %175 = mul nsw i32 %174, %.04670
  %176 = add nsw i32 %175, %.04567
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds [780 x i32], ptr %143, i64 0, i64 %177
  store i32 %173, ptr %178, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #8
  %179 = add nuw nsw i32 %.04567, 1
  %180 = icmp slt i32 %179, %174
  br i1 %180, label %.lr.ph68, label %._crit_edge69.loopexit, !llvm.loop !22

.preheader:                                       ; preds = %.preheader58, %._crit_edge76
  %181 = phi i32 [ %187, %._crit_edge76 ], [ %136, %.preheader58 ]
  %182 = phi i32 [ %188, %._crit_edge76 ], [ %135, %.preheader58 ]
  %.04477 = phi i32 [ %189, %._crit_edge76 ], [ 0, %.preheader58 ]
  %183 = icmp sgt i32 %182, 0
  br i1 %183, label %.lr.ph75, label %._crit_edge76

._crit_edge78:                                    ; preds = %._crit_edge76, %.preheader58
  %184 = load i32, ptr @ans, align 4, !tbaa !8
  %185 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %184)
  %186 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %185, ptr noundef nonnull @.str.9)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #8
  ret i32 0

._crit_edge76.loopexit:                           ; preds = %.lr.ph75
  %.pre86 = load i32, ptr @R, align 4, !tbaa !8
  br label %._crit_edge76

._crit_edge76:                                    ; preds = %._crit_edge76.loopexit, %.preheader
  %187 = phi i32 [ %.pre86, %._crit_edge76.loopexit ], [ %181, %.preheader ]
  %188 = phi i32 [ %192, %._crit_edge76.loopexit ], [ %182, %.preheader ]
  %189 = add nuw nsw i32 %.04477, 1
  %190 = icmp slt i32 %189, %187
  br i1 %190, label %.preheader, label %._crit_edge78, !llvm.loop !23

.lr.ph75:                                         ; preds = %.preheader, %.lr.ph75
  %.074 = phi i32 [ %191, %.lr.ph75 ], [ 0, %.preheader ]
  call void @_Z4testii(i32 noundef %.04477, i32 noundef %.074)
  %191 = add nuw nsw i32 %.074, 1
  %192 = load i32, ptr @C, align 4, !tbaa !8
  %193 = icmp slt i32 %191, %192
  br i1 %193, label %.lr.ph75, label %._crit_edge76.loopexit, !llvm.loop !24
}

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #1 align 2

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #6

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #6

; Function Attrs: mustprogress uwtable
declare noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8DijkstraILi780EE3genEi(ptr noundef nonnull align 4 dereferenceable(3120), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8DijkstraILi780EE3genEv(ptr noundef nonnull align 4 dereferenceable(3120)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #7

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 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 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 #6 = { "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 = { inlinehint 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 #8 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"vtable pointer", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13, !15}
!15 = !{!"llvm.loop.unswitch.partial.disable"}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13}
!18 = distinct !{!18, !13, !15}
!19 = !{!20, !9, i64 0}
!20 = !{!"_ZTSSt4pairIiiE", !9, i64 0, !9, i64 4}
!21 = !{!20, !9, i64 4}
!22 = distinct !{!22, !13}
!23 = distinct !{!23, !13, !15}
!24 = distinct !{!24, !13}


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