; LLVM IR from Aryansh-S/USACO :: USACO/Training/2.4/BessieComeHome (BessieComeHome)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.Dijk = type <{ [110 x %"class.std::vector"], [110 x i32], [110 x i8], [2 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"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.3" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@p = external dso_local global i32, align 4
@ans = external dso_local global i32, align 4
@ans2 = external dso_local global i32, align 4
@edge = external dso_local global [100 x [100 x i32]], align 16
@anschr = external dso_local global i8, align 1
@d = external dso_local global %struct.Dijk, align 8
@cow = external dso_local global %"class.std::set", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3capc(i8 noundef signext) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4ctoic(i8 noundef signext) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %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 i8, align 1
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %"struct.std::pair.3", align 8
  %11 = alloca i32, align 4
  %12 = alloca %"struct.std::pair.3", align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %17 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  %20 = alloca ptr, align 8
  %21 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %22 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %23 = alloca ptr, align 8
  store i32 0, ptr %1, align 4
  %24 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %25 = getelementptr i8, ptr %24, i64 -24
  %26 = load i64, ptr %25, align 8
  %27 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %26
  %28 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %27, ptr noundef null)
  %29 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %30 = call noalias ptr @fopen(ptr noundef @.str.3, ptr noundef @.str.4)
  %31 = icmp ne ptr %30, null
  br i1 %31, label %32, label %37

32:                                               ; preds = %0
  %33 = load ptr, ptr @stdin, align 8, !tbaa !8
  %34 = call ptr @freopen(ptr noundef @.str.3, ptr noundef @.str.4, ptr noundef %33)
  %35 = load ptr, ptr @stdout, align 8, !tbaa !8
  %36 = call ptr @freopen(ptr noundef @.str.5, ptr noundef @.str.6, ptr noundef %35)
  br label %37

37:                                               ; preds = %32, %0
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !11
  br label %38

38:                                               ; preds = %58, %37
  %39 = load i32, ptr %2, align 4, !tbaa !11
  %40 = icmp ne i32 %39, 100
  br i1 %40, label %42, label %41

41:                                               ; preds = %38
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %61

42:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !11
  br label %43

43:                                               ; preds = %54, %42
  %44 = load i32, ptr %4, align 4, !tbaa !11
  %45 = icmp ne i32 %44, 100
  br i1 %45, label %47, label %46

46:                                               ; preds = %43
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %57

47:                                               ; preds = %43
  %48 = load i32, ptr %2, align 4, !tbaa !11
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [100 x [100 x i32]], ptr @edge, i64 0, i64 %49
  %51 = load i32, ptr %4, align 4, !tbaa !11
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [100 x i32], ptr %50, i64 0, i64 %52
  store i32 1061109567, ptr %53, align 4, !tbaa !11
  br label %54

54:                                               ; preds = %47
  %55 = load i32, ptr %4, align 4, !tbaa !11
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %4, align 4, !tbaa !11
  br label %43, !llvm.loop !13

57:                                               ; preds = %46
  br label %58

58:                                               ; preds = %57
  %59 = load i32, ptr %2, align 4, !tbaa !11
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %2, align 4, !tbaa !11
  br label %38, !llvm.loop !15

61:                                               ; preds = %41
  call void @_Z2inIiJEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) @p)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %62 = load i32, ptr @p, align 4, !tbaa !11
  %63 = icmp sgt i32 0, %62
  %64 = zext i1 %63 to i32
  %65 = sub nsw i32 0, %64
  store i32 %65, ptr %5, align 4, !tbaa !11
  br label %66

66:                                               ; preds = %142, %61
  %67 = load i32, ptr %5, align 4, !tbaa !11
  %68 = load i32, ptr @p, align 4, !tbaa !11
  %69 = load i32, ptr @p, align 4, !tbaa !11
  %70 = icmp sgt i32 0, %69
  %71 = zext i1 %70 to i32
  %72 = sub nsw i32 %68, %71
  %73 = icmp ne i32 %67, %72
  br i1 %73, label %75, label %74

74:                                               ; preds = %66
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %149

75:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  call void @_Z2inIcJciEEvRT_DpRT0_(ptr noundef nonnull align 1 dereferenceable(1) %6, ptr noundef nonnull align 1 dereferenceable(1) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %76 = load i8, ptr %6, align 1, !tbaa !16
  %77 = call noundef zeroext i1 @_Z3capc(i8 noundef signext %76)
  br i1 %77, label %78, label %90

78:                                               ; preds = %75
  %79 = load i8, ptr %6, align 1, !tbaa !16
  %80 = sext i8 %79 to i32
  %81 = icmp ne i32 %80, 90
  br i1 %81, label %82, label %90

82:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %83 = load i8, ptr %6, align 1, !tbaa !16
  %84 = call noundef i32 @_Z4ctoic(i8 noundef signext %83)
  store i32 %84, ptr %9, align 4, !tbaa !11
  %85 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48) @cow, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %86 = getelementptr inbounds { ptr, i8 }, ptr %10, i32 0, i32 0
  %87 = extractvalue { ptr, i8 } %85, 0
  store ptr %87, ptr %86, align 8
  %88 = getelementptr inbounds { ptr, i8 }, ptr %10, i32 0, i32 1
  %89 = extractvalue { ptr, i8 } %85, 1
  store i8 %89, ptr %88, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %90

90:                                               ; preds = %82, %78, %75
  %91 = load i8, ptr %7, align 1, !tbaa !16
  %92 = call noundef zeroext i1 @_Z3capc(i8 noundef signext %91)
  br i1 %92, label %93, label %105

93:                                               ; preds = %90
  %94 = load i8, ptr %7, align 1, !tbaa !16
  %95 = sext i8 %94 to i32
  %96 = icmp ne i32 %95, 90
  br i1 %96, label %97, label %105

97:                                               ; preds = %93
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %98 = load i8, ptr %7, align 1, !tbaa !16
  %99 = call noundef i32 @_Z4ctoic(i8 noundef signext %98)
  store i32 %99, ptr %11, align 4, !tbaa !11
  %100 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48) @cow, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %101 = getelementptr inbounds { ptr, i8 }, ptr %12, i32 0, i32 0
  %102 = extractvalue { ptr, i8 } %100, 0
  store ptr %102, ptr %101, align 8
  %103 = getelementptr inbounds { ptr, i8 }, ptr %12, i32 0, i32 1
  %104 = extractvalue { ptr, i8 } %100, 1
  store i8 %104, ptr %103, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %105

105:                                              ; preds = %97, %93, %90
  %106 = load i8, ptr %6, align 1, !tbaa !16
  %107 = call noundef i32 @_Z4ctoic(i8 noundef signext %106)
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [100 x [100 x i32]], ptr @edge, i64 0, i64 %108
  %110 = load i8, ptr %7, align 1, !tbaa !16
  %111 = call noundef i32 @_Z4ctoic(i8 noundef signext %110)
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [100 x i32], ptr %109, i64 0, i64 %112
  %114 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %113, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %115 = load i32, ptr %114, align 4, !tbaa !11
  %116 = load i8, ptr %6, align 1, !tbaa !16
  %117 = call noundef i32 @_Z4ctoic(i8 noundef signext %116)
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [100 x [100 x i32]], ptr @edge, i64 0, i64 %118
  %120 = load i8, ptr %7, align 1, !tbaa !16
  %121 = call noundef i32 @_Z4ctoic(i8 noundef signext %120)
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [100 x i32], ptr %119, i64 0, i64 %122
  store i32 %115, ptr %123, align 4, !tbaa !11
  %124 = load i8, ptr %7, align 1, !tbaa !16
  %125 = call noundef i32 @_Z4ctoic(i8 noundef signext %124)
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [100 x [100 x i32]], ptr @edge, i64 0, i64 %126
  %128 = load i8, ptr %6, align 1, !tbaa !16
  %129 = call noundef i32 @_Z4ctoic(i8 noundef signext %128)
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [100 x i32], ptr %127, i64 0, i64 %130
  %132 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %131, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %133 = load i32, ptr %132, align 4, !tbaa !11
  %134 = load i8, ptr %7, align 1, !tbaa !16
  %135 = call noundef i32 @_Z4ctoic(i8 noundef signext %134)
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [100 x [100 x i32]], ptr @edge, i64 0, i64 %136
  %138 = load i8, ptr %6, align 1, !tbaa !16
  %139 = call noundef i32 @_Z4ctoic(i8 noundef signext %138)
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [100 x i32], ptr %137, i64 0, i64 %140
  store i32 %133, ptr %141, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #6
  br label %142

142:                                              ; preds = %105
  %143 = load i32, ptr @p, align 4, !tbaa !11
  %144 = icmp sgt i32 0, %143
  %145 = zext i1 %144 to i64
  %146 = select i1 %144, i32 -1, i32 1
  %147 = load i32, ptr %5, align 4, !tbaa !11
  %148 = add nsw i32 %147, %146
  store i32 %148, ptr %5, align 4, !tbaa !11
  br label %66, !llvm.loop !17

149:                                              ; preds = %74
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !11
  br label %150

150:                                              ; preds = %173, %149
  %151 = load i32, ptr %13, align 4, !tbaa !11
  %152 = icmp ne i32 %151, 100
  br i1 %152, label %154, label %153

153:                                              ; preds = %150
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %176

154:                                              ; preds = %150
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 0, ptr %14, align 4, !tbaa !11
  br label %155

155:                                              ; preds = %169, %154
  %156 = load i32, ptr %14, align 4, !tbaa !11
  %157 = icmp ne i32 %156, 100
  br i1 %157, label %159, label %158

158:                                              ; preds = %155
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %172

159:                                              ; preds = %155
  %160 = load i32, ptr %13, align 4, !tbaa !11
  %161 = load i32, ptr %14, align 4, !tbaa !11
  %162 = load i32, ptr %13, align 4, !tbaa !11
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [100 x [100 x i32]], ptr @edge, i64 0, i64 %163
  %165 = load i32, ptr %14, align 4, !tbaa !11
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [100 x i32], ptr %164, i64 0, i64 %166
  %168 = load i32, ptr %167, align 4, !tbaa !11
  call void @_ZN4DijkIiLi110EE4add_Eiii(ptr noundef nonnull align 8 dereferenceable(3190) @d, i32 noundef %160, i32 noundef %161, i32 noundef %168)
  br label %169

169:                                              ; preds = %159
  %170 = load i32, ptr %14, align 4, !tbaa !11
  %171 = add nsw i32 %170, 1
  store i32 %171, ptr %14, align 4, !tbaa !11
  br label %155, !llvm.loop !18

172:                                              ; preds = %158
  br label %173

173:                                              ; preds = %172
  %174 = load i32, ptr %13, align 4, !tbaa !11
  %175 = add nsw i32 %174, 1
  store i32 %175, ptr %13, align 4, !tbaa !11
  br label %150, !llvm.loop !19

176:                                              ; preds = %153
  %177 = call noundef i32 @_Z4ctoic(i8 noundef signext 90)
  call void @_ZN4DijkIiLi110EE3updEi(ptr noundef nonnull align 8 dereferenceable(3190) @d, i32 noundef %177)
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  store ptr @cow, ptr %15, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %178 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @cow) #6
  %179 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %16, i32 0, i32 0
  store ptr %178, ptr %179, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %180 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @cow) #6
  %181 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %17, i32 0, i32 0
  store ptr %180, ptr %181, align 8
  br label %182

182:                                              ; preds = %192, %176
  %183 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(8) %17) #6
  br i1 %183, label %185, label %184

184:                                              ; preds = %182
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %194

185:                                              ; preds = %182
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %186 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %16) #6
  store ptr %186, ptr %18, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  %187 = load ptr, ptr %18, align 8, !tbaa !8
  %188 = load i32, ptr %187, align 4, !tbaa !11
  %189 = call noundef i32 @_ZN4DijkIiLi110EE5queryEi(ptr noundef nonnull align 8 dereferenceable(3190) @d, i32 noundef %188)
  store i32 %189, ptr %19, align 4, !tbaa !11
  %190 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) %19)
  %191 = load i32, ptr %190, align 4, !tbaa !11
  store i32 %191, ptr @ans, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  br label %192

192:                                              ; preds = %185
  %193 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorIiEppEv(ptr noundef nonnull align 8 dereferenceable(8) %16) #6
  br label %182

194:                                              ; preds = %184
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  store ptr @cow, ptr %20, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %195 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @cow) #6
  %196 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %21, i32 0, i32 0
  store ptr %195, ptr %196, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #6
  %197 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @cow) #6
  %198 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %22, i32 0, i32 0
  store ptr %197, ptr %198, align 8
  br label %199

199:                                              ; preds = %213, %194
  %200 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %21, ptr noundef nonnull align 8 dereferenceable(8) %22) #6
  br i1 %200, label %202, label %201

201:                                              ; preds = %199
  store i32 19, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  br label %215

202:                                              ; preds = %199
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #6
  %203 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %21) #6
  store ptr %203, ptr %23, align 8, !tbaa !8
  %204 = load ptr, ptr %23, align 8, !tbaa !8
  %205 = load i32, ptr %204, align 4, !tbaa !11
  %206 = call noundef i32 @_ZN4DijkIiLi110EE5queryEi(ptr noundef nonnull align 8 dereferenceable(3190) @d, i32 noundef %205)
  %207 = load i32, ptr @ans, align 4, !tbaa !11
  %208 = icmp eq i32 %206, %207
  br i1 %208, label %209, label %212

209:                                              ; preds = %202
  %210 = load ptr, ptr %23, align 8, !tbaa !8
  %211 = load i32, ptr %210, align 4, !tbaa !11
  store i32 %211, ptr @ans2, align 4, !tbaa !11
  br label %212

212:                                              ; preds = %209, %202
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  br label %213

213:                                              ; preds = %212
  %214 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorIiEppEv(ptr noundef nonnull align 8 dereferenceable(8) %21) #6
  br label %199

215:                                              ; preds = %201
  %216 = load i32, ptr @ans2, align 4, !tbaa !11
  %217 = add nsw i32 %216, 60
  %218 = trunc i32 %217 to i8
  store i8 %218, ptr @anschr, align 1, !tbaa !16
  %219 = load i8, ptr @anschr, align 1, !tbaa !16
  %220 = load i32, ptr @ans, align 4, !tbaa !11
  call void @_Z3outIcJiEEvT_DpT0_(i8 noundef signext %219, i32 noundef %220)
  ret i32 0
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #0 align 2

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #2

declare noalias ptr @fopen(ptr noundef, ptr noundef) #2

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #2

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) #4 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4DijkIiLi110EE4add_Eiii(ptr noundef nonnull align 8 dereferenceable(3190), i32 noundef, i32 noundef, i32 noundef) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4DijkIiLi110EE3updEi(ptr noundef nonnull align 8 dereferenceable(3190), i32 noundef) #4 align 2

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4DijkIiLi110EE5queryEi(ptr noundef nonnull align 8 dereferenceable(3190), i32 noundef) #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3outIcJiEEvT_DpT0_(i8 noundef signext, i32 noundef) #4

attributes #0 = { 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 #1 = { 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 #2 = { "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 #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{!10, !10, i64 0}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}


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

%struct.Dijk = type <{ [110 x %"class.std::vector"], [110 x i32], [110 x i8], [2 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"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::_Rb_tree_const_iterator" = type { ptr }

@p = external dso_local global i32, align 4
@ans = external dso_local global i32, align 4
@ans2 = external dso_local local_unnamed_addr global i32, align 4
@edge = external dso_local global [100 x [100 x i32]], align 16
@anschr = external dso_local local_unnamed_addr global i8, align 1
@d = external dso_local global %struct.Dijk, align 8
@cow = external dso_local global %"class.std::set", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3capc(i8 noundef signext) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4ctoic(i8 noundef signext) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca i8, align 1
  %2 = alloca i8, align 1
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %7 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %10 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %11 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %12 = getelementptr i8, ptr %11, i64 -24
  %13 = load i64, ptr %12, align 8
  %14 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %13
  %15 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %14, ptr noundef null)
  %16 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %17 = tail call noalias ptr @fopen(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4)
  %.not = icmp eq ptr %17, null
  br i1 %.not, label %23, label %18

18:                                               ; preds = %0
  %19 = load ptr, ptr @stdin, align 8, !tbaa !8
  %20 = tail call ptr @freopen(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4, ptr noundef %19)
  %21 = load ptr, ptr @stdout, align 8, !tbaa !8
  %22 = tail call ptr @freopen(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.6, ptr noundef %21)
  br label %23

23:                                               ; preds = %18, %0
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40000) @edge, i8 63, i64 40000, i1 false), !tbaa !11
  tail call void @_Z2inIiJEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) @p)
  %24 = load i32, ptr @p, align 4, !tbaa !11
  %.not3140 = icmp eq i32 %24, 0
  br i1 %.not3140, label %.preheader.preheader, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %23
  %.lobit.neg = ashr i32 %24, 31
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %40
  %.02641 = phi i32 [ %75, %40 ], [ %.lobit.neg, %.lr.ph.preheader ]
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %2) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  call void @_Z2inIcJciEEvRT_DpRT0_(ptr noundef nonnull align 1 dereferenceable(1) %1, ptr noundef nonnull align 1 dereferenceable(1) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %25 = load i8, ptr %1, align 1, !tbaa !13
  %26 = call noundef zeroext i1 @_Z3capc(i8 noundef signext %25)
  %27 = load i8, ptr %1, align 1
  %28 = icmp ne i8 %27, 90
  %or.cond = select i1 %26, i1 %28, i1 false
  br i1 %or.cond, label %29, label %32

29:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #8
  %30 = call noundef i32 @_Z4ctoic(i8 noundef signext %27)
  store i32 %30, ptr %4, align 4, !tbaa !11
  %31 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48) @cow, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #8
  br label %32

32:                                               ; preds = %29, %.lr.ph
  %33 = load i8, ptr %2, align 1, !tbaa !13
  %34 = call noundef zeroext i1 @_Z3capc(i8 noundef signext %33)
  %35 = load i8, ptr %2, align 1
  %36 = icmp ne i8 %35, 90
  %or.cond5 = select i1 %34, i1 %36, i1 false
  br i1 %or.cond5, label %37, label %40

37:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #8
  %38 = call noundef i32 @_Z4ctoic(i8 noundef signext %35)
  store i32 %38, ptr %5, align 4, !tbaa !11
  %39 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48) @cow, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  br label %40

40:                                               ; preds = %37, %32
  %41 = load i8, ptr %1, align 1, !tbaa !13
  %42 = call noundef i32 @_Z4ctoic(i8 noundef signext %41)
  %43 = sext i32 %42 to i64
  %44 = load i8, ptr %2, align 1, !tbaa !13
  %45 = call noundef i32 @_Z4ctoic(i8 noundef signext %44)
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [100 x [100 x i32]], ptr @edge, i64 0, i64 %43, i64 %46
  %48 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %47, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %49 = load i32, ptr %48, align 4, !tbaa !11
  %50 = load i8, ptr %1, align 1, !tbaa !13
  %51 = call noundef i32 @_Z4ctoic(i8 noundef signext %50)
  %52 = sext i32 %51 to i64
  %53 = load i8, ptr %2, align 1, !tbaa !13
  %54 = call noundef i32 @_Z4ctoic(i8 noundef signext %53)
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [100 x [100 x i32]], ptr @edge, i64 0, i64 %52, i64 %55
  store i32 %49, ptr %56, align 4, !tbaa !11
  %57 = load i8, ptr %2, align 1, !tbaa !13
  %58 = call noundef i32 @_Z4ctoic(i8 noundef signext %57)
  %59 = sext i32 %58 to i64
  %60 = load i8, ptr %1, align 1, !tbaa !13
  %61 = call noundef i32 @_Z4ctoic(i8 noundef signext %60)
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [100 x [100 x i32]], ptr @edge, i64 0, i64 %59, i64 %62
  %64 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %63, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %65 = load i32, ptr %64, align 4, !tbaa !11
  %66 = load i8, ptr %2, align 1, !tbaa !13
  %67 = call noundef i32 @_Z4ctoic(i8 noundef signext %66)
  %68 = sext i32 %67 to i64
  %69 = load i8, ptr %1, align 1, !tbaa !13
  %70 = call noundef i32 @_Z4ctoic(i8 noundef signext %69)
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [100 x [100 x i32]], ptr @edge, i64 0, i64 %68, i64 %71
  store i32 %65, ptr %72, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %1) #8
  %73 = load i32, ptr @p, align 4, !tbaa !11
  %.inv = icmp sgt i32 %73, -1
  %74 = select i1 %.inv, i32 1, i32 -1
  %75 = add nsw i32 %74, %.02641
  %.lobit.neg30 = ashr i32 %73, 31
  %76 = add i32 %.lobit.neg30, %73
  %.not31 = icmp eq i32 %75, %76
  br i1 %.not31, label %.preheader.preheader, label %.lr.ph, !llvm.loop !14

.preheader.preheader:                             ; preds = %40, %23
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %83
  %indvars.iv51 = phi i64 [ %indvars.iv.next52, %83 ], [ 0, %.preheader.preheader ]
  %77 = trunc nuw nsw i64 %indvars.iv51 to i32
  br label %84

78:                                               ; preds = %83
  %79 = call noundef i32 @_Z4ctoic(i8 noundef signext 90)
  call void @_ZN4DijkIiLi110EE3updEi(ptr noundef nonnull align 8 dereferenceable(3190) @d, i32 noundef %79)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #8
  %80 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @cow) #8
  store ptr %80, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  %81 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @cow) #8
  store ptr %81, ptr %7, align 8
  %82 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #8
  br i1 %82, label %.lr.ph44, label %._crit_edge

83:                                               ; preds = %84
  %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
  %.not32 = icmp eq i64 %indvars.iv.next52, 100
  br i1 %.not32, label %78, label %.preheader, !llvm.loop !16

84:                                               ; preds = %.preheader, %84
  %indvars.iv = phi i64 [ 0, %.preheader ], [ %indvars.iv.next, %84 ]
  %85 = getelementptr inbounds [100 x [100 x i32]], ptr @edge, i64 0, i64 %indvars.iv51, i64 %indvars.iv
  %86 = load i32, ptr %85, align 4, !tbaa !11
  %87 = trunc nuw nsw i64 %indvars.iv to i32
  call void @_ZN4DijkIiLi110EE4add_Eiii(ptr noundef nonnull align 8 dereferenceable(3190) @d, i32 noundef %77, i32 noundef %87, i32 noundef %86)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %.not33 = icmp eq i64 %indvars.iv.next, 100
  br i1 %.not33, label %83, label %84, !llvm.loop !17

._crit_edge:                                      ; preds = %.lr.ph44, %78
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #8
  %88 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @cow) #8
  store ptr %88, ptr %9, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #8
  %89 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @cow) #8
  store ptr %89, ptr %10, align 8
  %90 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #8
  br i1 %90, label %.lr.ph46, label %._crit_edge47

.lr.ph44:                                         ; preds = %78, %.lr.ph44
  %91 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #8
  %92 = load i32, ptr %91, align 4, !tbaa !11
  %93 = call noundef i32 @_ZN4DijkIiLi110EE5queryEi(ptr noundef nonnull align 8 dereferenceable(3190) @d, i32 noundef %92)
  store i32 %93, ptr %8, align 4, !tbaa !11
  %94 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %95 = load i32, ptr %94, align 4, !tbaa !11
  store i32 %95, ptr @ans, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #8
  %96 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorIiEppEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #8
  %97 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #8
  br i1 %97, label %.lr.ph44, label %._crit_edge

._crit_edge47:                                    ; preds = %109, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #8
  %98 = load i32, ptr @ans2, align 4, !tbaa !11
  %99 = trunc i32 %98 to i8
  %100 = add i8 %99, 60
  store i8 %100, ptr @anschr, align 1, !tbaa !13
  %101 = load i32, ptr @ans, align 4, !tbaa !11
  call void @_Z3outIcJiEEvT_DpT0_(i8 noundef signext %100, i32 noundef %101)
  ret i32 0

.lr.ph46:                                         ; preds = %._crit_edge, %109
  %102 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #8
  %103 = load i32, ptr %102, align 4, !tbaa !11
  %104 = call noundef i32 @_ZN4DijkIiLi110EE5queryEi(ptr noundef nonnull align 8 dereferenceable(3190) @d, i32 noundef %103)
  %105 = load i32, ptr @ans, align 4, !tbaa !11
  %106 = icmp eq i32 %104, %105
  br i1 %106, label %107, label %109

107:                                              ; preds = %.lr.ph46
  %108 = load i32, ptr %102, align 4, !tbaa !11
  store i32 %108, ptr @ans2, align 4, !tbaa !11
  br label %109

109:                                              ; preds = %107, %.lr.ph46
  %110 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorIiEppEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #8
  %111 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #8
  br i1 %111, label %.lr.ph46, label %._crit_edge47
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #0 align 2

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #3

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #5 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4DijkIiLi110EE4add_Eiii(ptr noundef nonnull align 8 dereferenceable(3190), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4DijkIiLi110EE3updEi(ptr noundef nonnull align 8 dereferenceable(3190), i32 noundef) local_unnamed_addr #5 align 2

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4DijkIiLi110EE5queryEi(ptr noundef nonnull align 8 dereferenceable(3190), i32 noundef) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3outIcJiEEvT_DpT0_(i8 noundef signext, i32 noundef) local_unnamed_addr #5

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

attributes #0 = { 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 #1 = { 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 #2 = { "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 #3 = { 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 #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = !{!10, !10, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}


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