; LLVM IR from bqi343/cp-notebook :: Contests/USACO Solutions/2016-17/Feb 2017/Gold (17 Feb G1)

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

%"class.std::priority_queue" = type <{ %"class.std::vector", [8 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<std::pair<int, int>, std::pair<int, int>>, std::allocator<std::pair<std::pair<int, int>, std::pair<int, int>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<std::pair<int, int>, std::pair<int, int>>, std::allocator<std::pair<std::pair<int, int>, std::pair<int, int>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<std::pair<int, int>, std::pair<int, int>>, std::allocator<std::pair<std::pair<int, int>, std::pair<int, int>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<std::pair<int, int>, std::pair<int, int>>, std::allocator<std::pair<std::pair<int, int>, std::pair<int, int>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::basic_ifstream" = type { %"class.std::basic_istream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_istream.base" = type { ptr, i64 }
%"class.std::basic_filebuf" = type { %"class.std::basic_streambuf", %union.pthread_mutex_t, %"class.std::__basic_file", i32, %struct.__mbstate_t, %struct.__mbstate_t, %struct.__mbstate_t, ptr, i64, i8, i8, i8, i8, ptr, ptr, i8, ptr, ptr, i64, ptr, ptr }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::__basic_file" = type <{ ptr, i8, [7 x i8] }>
%struct.__mbstate_t = type { i32, %union.anon }
%union.anon = type { i32 }
%"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::basic_ofstream" = type { %"class.std::basic_ostream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_ostream.base" = type { ptr }
%"struct.std::pair" = type { %"struct.std::pair.0", %"struct.std::pair.0" }
%"struct.std::pair.0" = type { i32, i32 }

@N = external dso_local global i32, align 4
@T = external dso_local global i32, align 4
@cost = external dso_local global [100 x [100 x i32]], align 16
@MOD = external dso_local global i32, align 4
@best = external dso_local global [100 x [100 x [3 x i32]]], align 16
@xdir = external dso_local global [4 x i32], align 16
@ydir = external dso_local global [4 x i32], align 16
@todo = external dso_local global %"class.std::priority_queue", align 8
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [12 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::basic_ifstream", align 8
  %3 = alloca %"class.std::basic_ofstream", align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, 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
  %11 = alloca i32, align 4
  %12 = alloca %"struct.std::pair", align 4
  %13 = alloca %"struct.std::pair.0", align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca %"struct.std::pair.0", align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca %"struct.std::pair", align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca %"struct.std::pair", align 4
  %24 = alloca %"struct.std::pair.0", align 4
  %25 = alloca i32, align 4
  %26 = alloca %"struct.std::pair.0", align 4
  %27 = alloca %"struct.std::pair", align 4
  %28 = alloca %"struct.std::pair.0", align 4
  %29 = alloca i32, align 4
  %30 = alloca %"struct.std::pair.0", align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 520, ptr %2) #6
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(256) %2, ptr noundef @.str, i32 noundef 8)
  call void @llvm.lifetime.start.p0(i64 512, ptr %3) #6
  invoke void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(248) %3, ptr noundef @.str.1, i32 noundef 16)
          to label %31 unwind label %41

31:                                               ; preds = %0
  %32 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(4) @N)
          to label %33 unwind label %45

33:                                               ; preds = %31
  %34 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %32, ptr noundef nonnull align 4 dereferenceable(4) @T)
          to label %35 unwind label %45

35:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %79, %35
  %37 = load i32, ptr %6, align 4, !tbaa !5
  %38 = load i32, ptr @N, align 4, !tbaa !5
  %39 = icmp slt i32 %37, %38
  br i1 %39, label %49, label %40

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

41:                                               ; preds = %0
  %42 = landingpad { ptr, i32 }
          cleanup
  %43 = extractvalue { ptr, i32 } %42, 0
  store ptr %43, ptr %4, align 8
  %44 = extractvalue { ptr, i32 } %42, 1
  store i32 %44, ptr %5, align 4
  br label %334

45:                                               ; preds = %119, %33, %31
  %46 = landingpad { ptr, i32 }
          cleanup
  %47 = extractvalue { ptr, i32 } %46, 0
  store ptr %47, ptr %4, align 8
  %48 = extractvalue { ptr, i32 } %46, 1
  store i32 %48, ptr %5, align 4
  br label %333

49:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %75, %49
  %51 = load i32, ptr %8, align 4, !tbaa !5
  %52 = load i32, ptr @N, align 4, !tbaa !5
  %53 = icmp slt i32 %51, %52
  br i1 %53, label %55, label %54

54:                                               ; preds = %50
  store i32 5, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %78

55:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %56

56:                                               ; preds = %71, %55
  %57 = load i32, ptr %9, align 4, !tbaa !5
  %58 = icmp slt i32 %57, 3
  br i1 %58, label %60, label %59

59:                                               ; preds = %56
  store i32 8, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %74

60:                                               ; preds = %56
  %61 = load i32, ptr @MOD, align 4, !tbaa !5
  %62 = load i32, ptr %6, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [100 x [100 x [3 x i32]]], ptr @best, i64 0, i64 %63
  %65 = load i32, ptr %8, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [100 x [3 x i32]], ptr %64, i64 0, i64 %66
  %68 = load i32, ptr %9, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [3 x i32], ptr %67, i64 0, i64 %69
  store i32 %61, ptr %70, align 4, !tbaa !5
  br label %71

71:                                               ; preds = %60
  %72 = load i32, ptr %9, align 4, !tbaa !5
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %9, align 4, !tbaa !5
  br label %56, !llvm.loop !9

74:                                               ; preds = %59
  br label %75

75:                                               ; preds = %74
  %76 = load i32, ptr %8, align 4, !tbaa !5
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %8, align 4, !tbaa !5
  br label %50, !llvm.loop !11

78:                                               ; preds = %54
  br label %79

79:                                               ; preds = %78
  %80 = load i32, ptr %6, align 4, !tbaa !5
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr %6, align 4, !tbaa !5
  br label %36, !llvm.loop !12

82:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %83

83:                                               ; preds = %111, %82
  %84 = load i32, ptr %10, align 4, !tbaa !5
  %85 = load i32, ptr @N, align 4, !tbaa !5
  %86 = icmp slt i32 %84, %85
  br i1 %86, label %88, label %87

87:                                               ; preds = %83
  store i32 11, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %114

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

89:                                               ; preds = %103, %88
  %90 = load i32, ptr %11, align 4, !tbaa !5
  %91 = load i32, ptr @N, align 4, !tbaa !5
  %92 = icmp slt i32 %90, %91
  br i1 %92, label %94, label %93

93:                                               ; preds = %89
  store i32 14, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %110

94:                                               ; preds = %89
  %95 = load i32, ptr %10, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [100 x [100 x i32]], ptr @cost, i64 0, i64 %96
  %98 = load i32, ptr %11, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [100 x i32], ptr %97, i64 0, i64 %99
  %101 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(4) %100)
          to label %102 unwind label %106

102:                                              ; preds = %94
  br label %103

103:                                              ; preds = %102
  %104 = load i32, ptr %11, align 4, !tbaa !5
  %105 = add nsw i32 %104, 1
  store i32 %105, ptr %11, align 4, !tbaa !5
  br label %89, !llvm.loop !13

106:                                              ; preds = %94
  %107 = landingpad { ptr, i32 }
          cleanup
  %108 = extractvalue { ptr, i32 } %107, 0
  store ptr %108, ptr %4, align 8
  %109 = extractvalue { ptr, i32 } %107, 1
  store i32 %109, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %333

110:                                              ; preds = %93
  br label %111

111:                                              ; preds = %110
  %112 = load i32, ptr %10, align 4, !tbaa !5
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %10, align 4, !tbaa !5
  br label %83, !llvm.loop !14

114:                                              ; preds = %87
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 0, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store i32 0, ptr %15, align 4, !tbaa !5
  invoke void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %13, ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 4 dereferenceable(4) %15)
          to label %115 unwind label %152

115:                                              ; preds = %114
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  store i32 0, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  store i32 0, ptr %18, align 4, !tbaa !5
  invoke void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %16, ptr noundef nonnull align 4 dereferenceable(4) %17, ptr noundef nonnull align 4 dereferenceable(4) %18)
          to label %116 unwind label %156

116:                                              ; preds = %115
  invoke void @_ZNSt4pairIS_IiiES0_EC2IS0_S0_TnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKS0_S9_(ptr noundef nonnull align 4 dereferenceable(16) %12, ptr noundef nonnull align 4 dereferenceable(8) %13, ptr noundef nonnull align 4 dereferenceable(8) %16)
          to label %117 unwind label %156

117:                                              ; preds = %116
  invoke void @_ZNSt14priority_queueISt4pairIS0_IiiES1_ESt6vectorIS2_SaIS2_EESt4lessIS2_EE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(25) @todo, ptr noundef nonnull align 4 dereferenceable(16) %12)
          to label %118 unwind label %156

118:                                              ; preds = %117
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #6
  br label %119

119:                                              ; preds = %326, %324, %118
  %120 = invoke noundef i64 @_ZNKSt14priority_queueISt4pairIS0_IiiES1_ESt6vectorIS2_SaIS2_EESt4lessIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(25) @todo)
          to label %121 unwind label %45

121:                                              ; preds = %119
  %122 = icmp ne i64 %120, 0
  br i1 %122, label %123, label %328

123:                                              ; preds = %121
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #6
  %124 = invoke noundef nonnull align 4 dereferenceable(16) ptr @_ZNKSt14priority_queueISt4pairIS0_IiiES1_ESt6vectorIS2_SaIS2_EESt4lessIS2_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @todo)
          to label %125 unwind label %161

125:                                              ; preds = %123
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 4 %124, i64 16, i1 false)
  invoke void @_ZNSt14priority_queueISt4pairIS0_IiiES1_ESt6vectorIS2_SaIS2_EESt4lessIS2_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) @todo)
          to label %126 unwind label %161

126:                                              ; preds = %125
  %127 = getelementptr inbounds %"struct.std::pair", ptr %19, i32 0, i32 0
  %128 = getelementptr inbounds %"struct.std::pair.0", ptr %127, i32 0, i32 0
  %129 = load i32, ptr %128, align 4, !tbaa !15
  %130 = sub nsw i32 0, %129
  %131 = getelementptr inbounds %"struct.std::pair", ptr %19, i32 0, i32 0
  %132 = getelementptr inbounds %"struct.std::pair.0", ptr %131, i32 0, i32 0
  store i32 %130, ptr %132, align 4, !tbaa !15
  %133 = getelementptr inbounds %"struct.std::pair", ptr %19, i32 0, i32 1
  %134 = getelementptr inbounds %"struct.std::pair.0", ptr %133, i32 0, i32 0
  %135 = load i32, ptr %134, align 4, !tbaa !18
  %136 = load i32, ptr @N, align 4, !tbaa !5
  %137 = sub nsw i32 %136, 1
  %138 = icmp eq i32 %135, %137
  br i1 %138, label %139, label %165

139:                                              ; preds = %126
  %140 = getelementptr inbounds %"struct.std::pair", ptr %19, i32 0, i32 1
  %141 = getelementptr inbounds %"struct.std::pair.0", ptr %140, i32 0, i32 1
  %142 = load i32, ptr %141, align 4, !tbaa !19
  %143 = load i32, ptr @N, align 4, !tbaa !5
  %144 = sub nsw i32 %143, 1
  %145 = icmp eq i32 %142, %144
  br i1 %145, label %146, label %165

146:                                              ; preds = %139
  %147 = getelementptr inbounds %"struct.std::pair", ptr %19, i32 0, i32 0
  %148 = getelementptr inbounds %"struct.std::pair.0", ptr %147, i32 0, i32 0
  %149 = load i32, ptr %148, align 4, !tbaa !15
  %150 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %3, i32 noundef %149)
          to label %151 unwind label %161

151:                                              ; preds = %146
  store i32 0, ptr %1, align 4
  store i32 1, ptr %7, align 4
  br label %324

152:                                              ; preds = %114
  %153 = landingpad { ptr, i32 }
          cleanup
  %154 = extractvalue { ptr, i32 } %153, 0
  store ptr %154, ptr %4, align 8
  %155 = extractvalue { ptr, i32 } %153, 1
  store i32 %155, ptr %5, align 4
  br label %160

156:                                              ; preds = %117, %116, %115
  %157 = landingpad { ptr, i32 }
          cleanup
  %158 = extractvalue { ptr, i32 } %157, 0
  store ptr %158, ptr %4, align 8
  %159 = extractvalue { ptr, i32 } %157, 1
  store i32 %159, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  br label %160

160:                                              ; preds = %156, %152
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #6
  br label %333

161:                                              ; preds = %146, %125, %123
  %162 = landingpad { ptr, i32 }
          cleanup
  %163 = extractvalue { ptr, i32 } %162, 0
  store ptr %163, ptr %4, align 8
  %164 = extractvalue { ptr, i32 } %162, 1
  store i32 %164, ptr %5, align 4
  br label %327

165:                                              ; preds = %139, %126
  %166 = getelementptr inbounds %"struct.std::pair", ptr %19, i32 0, i32 1
  %167 = getelementptr inbounds %"struct.std::pair.0", ptr %166, i32 0, i32 0
  %168 = load i32, ptr %167, align 4, !tbaa !18
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [100 x [100 x [3 x i32]]], ptr @best, i64 0, i64 %169
  %171 = getelementptr inbounds %"struct.std::pair", ptr %19, i32 0, i32 1
  %172 = getelementptr inbounds %"struct.std::pair.0", ptr %171, i32 0, i32 1
  %173 = load i32, ptr %172, align 4, !tbaa !19
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [100 x [3 x i32]], ptr %170, i64 0, i64 %174
  %176 = getelementptr inbounds %"struct.std::pair", ptr %19, i32 0, i32 0
  %177 = getelementptr inbounds %"struct.std::pair.0", ptr %176, i32 0, i32 1
  %178 = load i32, ptr %177, align 4, !tbaa !20
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [3 x i32], ptr %175, i64 0, i64 %179
  %181 = load i32, ptr %180, align 4, !tbaa !5
  %182 = load i32, ptr @MOD, align 4, !tbaa !5
  %183 = icmp ne i32 %181, %182
  br i1 %183, label %184, label %185

184:                                              ; preds = %165
  store i32 17, ptr %7, align 4
  br label %324, !llvm.loop !21

185:                                              ; preds = %165
  %186 = getelementptr inbounds %"struct.std::pair", ptr %19, i32 0, i32 0
  %187 = getelementptr inbounds %"struct.std::pair.0", ptr %186, i32 0, i32 0
  %188 = load i32, ptr %187, align 4, !tbaa !15
  %189 = getelementptr inbounds %"struct.std::pair", ptr %19, i32 0, i32 1
  %190 = getelementptr inbounds %"struct.std::pair.0", ptr %189, i32 0, i32 0
  %191 = load i32, ptr %190, align 4, !tbaa !18
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds [100 x [100 x [3 x i32]]], ptr @best, i64 0, i64 %192
  %194 = getelementptr inbounds %"struct.std::pair", ptr %19, i32 0, i32 1
  %195 = getelementptr inbounds %"struct.std::pair.0", ptr %194, i32 0, i32 1
  %196 = load i32, ptr %195, align 4, !tbaa !19
  %197 = sext i32 %196 to i64
  %198 = getelementptr inbounds [100 x [3 x i32]], ptr %193, i64 0, i64 %197
  %199 = getelementptr inbounds %"struct.std::pair", ptr %19, i32 0, i32 0
  %200 = getelementptr inbounds %"struct.std::pair.0", ptr %199, i32 0, i32 1
  %201 = load i32, ptr %200, align 4, !tbaa !20
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds [3 x i32], ptr %198, i64 0, i64 %202
  store i32 %188, ptr %203, align 4, !tbaa !5
  %204 = getelementptr inbounds %"struct.std::pair", ptr %19, i32 0, i32 0
  %205 = getelementptr inbounds %"struct.std::pair.0", ptr %204, i32 0, i32 1
  %206 = load i32, ptr %205, align 4, !tbaa !20
  %207 = add nsw i32 %206, 1
  %208 = srem i32 %207, 3
  %209 = getelementptr inbounds %"struct.std::pair", ptr %19, i32 0, i32 0
  %210 = getelementptr inbounds %"struct.std::pair.0", ptr %209, i32 0, i32 1
  store i32 %208, ptr %210, align 4, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  store i32 0, ptr %20, align 4, !tbaa !5
  br label %211

211:                                              ; preds = %319, %185
  %212 = load i32, ptr %20, align 4, !tbaa !5
  %213 = icmp slt i32 %212, 4
  br i1 %213, label %215, label %214

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

215:                                              ; preds = %211
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  %216 = getelementptr inbounds %"struct.std::pair", ptr %19, i32 0, i32 1
  %217 = getelementptr inbounds %"struct.std::pair.0", ptr %216, i32 0, i32 0
  %218 = load i32, ptr %217, align 4, !tbaa !18
  %219 = load i32, ptr %20, align 4, !tbaa !5
  %220 = sext i32 %219 to i64
  %221 = getelementptr inbounds [4 x i32], ptr @xdir, i64 0, i64 %220
  %222 = load i32, ptr %221, align 4, !tbaa !5
  %223 = add nsw i32 %218, %222
  store i32 %223, ptr %21, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  %224 = getelementptr inbounds %"struct.std::pair", ptr %19, i32 0, i32 1
  %225 = getelementptr inbounds %"struct.std::pair.0", ptr %224, i32 0, i32 1
  %226 = load i32, ptr %225, align 4, !tbaa !19
  %227 = load i32, ptr %20, align 4, !tbaa !5
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds [4 x i32], ptr @ydir, i64 0, i64 %228
  %230 = load i32, ptr %229, align 4, !tbaa !5
  %231 = add nsw i32 %226, %230
  store i32 %231, ptr %22, align 4, !tbaa !5
  %232 = load i32, ptr %21, align 4, !tbaa !5
  %233 = icmp sge i32 %232, 0
  br i1 %233, label %234, label %318

234:                                              ; preds = %215
  %235 = load i32, ptr %21, align 4, !tbaa !5
  %236 = load i32, ptr @N, align 4, !tbaa !5
  %237 = icmp slt i32 %235, %236
  br i1 %237, label %238, label %318

238:                                              ; preds = %234
  %239 = load i32, ptr %22, align 4, !tbaa !5
  %240 = icmp sge i32 %239, 0
  br i1 %240, label %241, label %318

241:                                              ; preds = %238
  %242 = load i32, ptr %22, align 4, !tbaa !5
  %243 = load i32, ptr @N, align 4, !tbaa !5
  %244 = icmp slt i32 %242, %243
  br i1 %244, label %245, label %318

245:                                              ; preds = %241
  %246 = load i32, ptr %21, align 4, !tbaa !5
  %247 = sext i32 %246 to i64
  %248 = getelementptr inbounds [100 x [100 x [3 x i32]]], ptr @best, i64 0, i64 %247
  %249 = load i32, ptr %22, align 4, !tbaa !5
  %250 = sext i32 %249 to i64
  %251 = getelementptr inbounds [100 x [3 x i32]], ptr %248, i64 0, i64 %250
  %252 = getelementptr inbounds %"struct.std::pair", ptr %19, i32 0, i32 0
  %253 = getelementptr inbounds %"struct.std::pair.0", ptr %252, i32 0, i32 1
  %254 = load i32, ptr %253, align 4, !tbaa !20
  %255 = sext i32 %254 to i64
  %256 = getelementptr inbounds [3 x i32], ptr %251, i64 0, i64 %255
  %257 = load i32, ptr %256, align 4, !tbaa !5
  %258 = load i32, ptr @MOD, align 4, !tbaa !5
  %259 = icmp eq i32 %257, %258
  br i1 %259, label %260, label %318

260:                                              ; preds = %245
  %261 = getelementptr inbounds %"struct.std::pair", ptr %19, i32 0, i32 0
  %262 = getelementptr inbounds %"struct.std::pair.0", ptr %261, i32 0, i32 1
  %263 = load i32, ptr %262, align 4, !tbaa !20
  %264 = icmp eq i32 %263, 0
  br i1 %264, label %265, label %295

265:                                              ; preds = %260
  call void @llvm.lifetime.start.p0(i64 16, ptr %23) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #6
  %266 = getelementptr inbounds %"struct.std::pair", ptr %19, i32 0, i32 0
  %267 = getelementptr inbounds %"struct.std::pair.0", ptr %266, i32 0, i32 0
  %268 = load i32, ptr %267, align 4, !tbaa !15
  %269 = load i32, ptr @T, align 4, !tbaa !5
  %270 = add nsw i32 %268, %269
  %271 = load i32, ptr %21, align 4, !tbaa !5
  %272 = sext i32 %271 to i64
  %273 = getelementptr inbounds [100 x [100 x i32]], ptr @cost, i64 0, i64 %272
  %274 = load i32, ptr %22, align 4, !tbaa !5
  %275 = sext i32 %274 to i64
  %276 = getelementptr inbounds [100 x i32], ptr %273, i64 0, i64 %275
  %277 = load i32, ptr %276, align 4, !tbaa !5
  %278 = add nsw i32 %270, %277
  %279 = sub nsw i32 0, %278
  store i32 %279, ptr %25, align 4, !tbaa !5
  %280 = getelementptr inbounds %"struct.std::pair", ptr %19, i32 0, i32 0
  %281 = getelementptr inbounds %"struct.std::pair.0", ptr %280, i32 0, i32 1
  invoke void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %24, ptr noundef nonnull align 4 dereferenceable(4) %25, ptr noundef nonnull align 4 dereferenceable(4) %281)
          to label %282 unwind label %286

282:                                              ; preds = %265
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #6
  invoke void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %26, ptr noundef nonnull align 4 dereferenceable(4) %21, ptr noundef nonnull align 4 dereferenceable(4) %22)
          to label %283 unwind label %290

283:                                              ; preds = %282
  invoke void @_ZNSt4pairIS_IiiES0_EC2IS0_S0_TnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKS0_S9_(ptr noundef nonnull align 4 dereferenceable(16) %23, ptr noundef nonnull align 4 dereferenceable(8) %24, ptr noundef nonnull align 4 dereferenceable(8) %26)
          to label %284 unwind label %290

284:                                              ; preds = %283
  invoke void @_ZNSt14priority_queueISt4pairIS0_IiiES1_ESt6vectorIS2_SaIS2_EESt4lessIS2_EE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(25) @todo, ptr noundef nonnull align 4 dereferenceable(16) %23)
          to label %285 unwind label %290

285:                                              ; preds = %284
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #6
  br label %317

286:                                              ; preds = %265
  %287 = landingpad { ptr, i32 }
          cleanup
  %288 = extractvalue { ptr, i32 } %287, 0
  store ptr %288, ptr %4, align 8
  %289 = extractvalue { ptr, i32 } %287, 1
  store i32 %289, ptr %5, align 4
  br label %294

290:                                              ; preds = %284, %283, %282
  %291 = landingpad { ptr, i32 }
          cleanup
  %292 = extractvalue { ptr, i32 } %291, 0
  store ptr %292, ptr %4, align 8
  %293 = extractvalue { ptr, i32 } %291, 1
  store i32 %293, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #6
  br label %294

294:                                              ; preds = %290, %286
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #6
  br label %322

295:                                              ; preds = %260
  call void @llvm.lifetime.start.p0(i64 16, ptr %27) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #6
  %296 = getelementptr inbounds %"struct.std::pair", ptr %19, i32 0, i32 0
  %297 = getelementptr inbounds %"struct.std::pair.0", ptr %296, i32 0, i32 0
  %298 = load i32, ptr %297, align 4, !tbaa !15
  %299 = load i32, ptr @T, align 4, !tbaa !5
  %300 = add nsw i32 %298, %299
  %301 = sub nsw i32 0, %300
  store i32 %301, ptr %29, align 4, !tbaa !5
  %302 = getelementptr inbounds %"struct.std::pair", ptr %19, i32 0, i32 0
  %303 = getelementptr inbounds %"struct.std::pair.0", ptr %302, i32 0, i32 1
  invoke void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %28, ptr noundef nonnull align 4 dereferenceable(4) %29, ptr noundef nonnull align 4 dereferenceable(4) %303)
          to label %304 unwind label %308

304:                                              ; preds = %295
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #6
  invoke void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %30, ptr noundef nonnull align 4 dereferenceable(4) %21, ptr noundef nonnull align 4 dereferenceable(4) %22)
          to label %305 unwind label %312

305:                                              ; preds = %304
  invoke void @_ZNSt4pairIS_IiiES0_EC2IS0_S0_TnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKS0_S9_(ptr noundef nonnull align 4 dereferenceable(16) %27, ptr noundef nonnull align 4 dereferenceable(8) %28, ptr noundef nonnull align 4 dereferenceable(8) %30)
          to label %306 unwind label %312

306:                                              ; preds = %305
  invoke void @_ZNSt14priority_queueISt4pairIS0_IiiES1_ESt6vectorIS2_SaIS2_EESt4lessIS2_EE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(25) @todo, ptr noundef nonnull align 4 dereferenceable(16) %27)
          to label %307 unwind label %312

307:                                              ; preds = %306
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %27) #6
  br label %317

308:                                              ; preds = %295
  %309 = landingpad { ptr, i32 }
          cleanup
  %310 = extractvalue { ptr, i32 } %309, 0
  store ptr %310, ptr %4, align 8
  %311 = extractvalue { ptr, i32 } %309, 1
  store i32 %311, ptr %5, align 4
  br label %316

312:                                              ; preds = %306, %305, %304
  %313 = landingpad { ptr, i32 }
          cleanup
  %314 = extractvalue { ptr, i32 } %313, 0
  store ptr %314, ptr %4, align 8
  %315 = extractvalue { ptr, i32 } %313, 1
  store i32 %315, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #6
  br label %316

316:                                              ; preds = %312, %308
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %27) #6
  br label %322

317:                                              ; preds = %307, %285
  br label %318

318:                                              ; preds = %317, %245, %241, %238, %234, %215
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %319

319:                                              ; preds = %318
  %320 = load i32, ptr %20, align 4, !tbaa !5
  %321 = add nsw i32 %320, 1
  store i32 %321, ptr %20, align 4, !tbaa !5
  br label %211, !llvm.loop !22

322:                                              ; preds = %316, %294
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  br label %327

323:                                              ; preds = %214
  store i32 0, ptr %7, align 4
  br label %324

324:                                              ; preds = %323, %184, %151
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #6
  %325 = load i32, ptr %7, align 4
  switch i32 %325, label %329 [
    i32 0, label %326
    i32 17, label %119
  ]

326:                                              ; preds = %324
  br label %119, !llvm.loop !21

327:                                              ; preds = %322, %161
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #6
  br label %333

328:                                              ; preds = %121
  store i32 0, ptr %7, align 4
  br label %329

329:                                              ; preds = %328, %324
  call void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248) %3) #6
  call void @llvm.lifetime.end.p0(i64 512, ptr %3) #6
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %2) #6
  call void @llvm.lifetime.end.p0(i64 520, ptr %2) #6
  %330 = load i32, ptr %7, align 4
  switch i32 %330, label %340 [
    i32 0, label %331
    i32 1, label %331
  ]

331:                                              ; preds = %329, %329
  %332 = load i32, ptr %1, align 4
  ret i32 %332

333:                                              ; preds = %327, %160, %106, %45
  call void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248) %3) #6
  br label %334

334:                                              ; preds = %333, %41
  call void @llvm.lifetime.end.p0(i64 512, ptr %3) #6
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %2) #6
  call void @llvm.lifetime.end.p0(i64 520, ptr %2) #6
  br label %335

335:                                              ; preds = %334
  %336 = load ptr, ptr %4, align 8
  %337 = load i32, ptr %5, align 4
  %338 = insertvalue { ptr, i32 } poison, ptr %336, 0
  %339 = insertvalue { ptr, i32 } %338, i32 %337, 1
  resume { ptr, i32 } %339

340:                                              ; preds = %329
  unreachable
}

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

; Function Attrs: mustprogress uwtable
declare void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(256), ptr noundef, i32 noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(248), ptr noundef, i32 noundef) unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

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

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

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

; 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 #4 align 2

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248)) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256)) unnamed_addr #4 align 2

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = !{!16, !6, i64 0}
!16 = !{!"_ZTSSt4pairIS_IiiES0_E", !17, i64 0, !17, i64 8}
!17 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!18 = !{!16, !6, i64 8}
!19 = !{!16, !6, i64 12}
!20 = !{!16, !6, i64 4}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}


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

%"class.std::priority_queue" = type <{ %"class.std::vector", [8 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<std::pair<int, int>, std::pair<int, int>>, std::allocator<std::pair<std::pair<int, int>, std::pair<int, int>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<std::pair<int, int>, std::pair<int, int>>, std::allocator<std::pair<std::pair<int, int>, std::pair<int, int>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<std::pair<int, int>, std::pair<int, int>>, std::allocator<std::pair<std::pair<int, int>, std::pair<int, int>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<std::pair<int, int>, std::pair<int, int>>, std::allocator<std::pair<std::pair<int, int>, std::pair<int, int>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::basic_ifstream" = type { %"class.std::basic_istream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_istream.base" = type { ptr, i64 }
%"class.std::basic_filebuf" = type { %"class.std::basic_streambuf", %union.pthread_mutex_t, %"class.std::__basic_file", i32, %struct.__mbstate_t, %struct.__mbstate_t, %struct.__mbstate_t, ptr, i64, i8, i8, i8, i8, ptr, ptr, i8, ptr, ptr, i64, ptr, ptr }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::__basic_file" = type <{ ptr, i8, [7 x i8] }>
%struct.__mbstate_t = type { i32, %union.anon }
%union.anon = type { i32 }
%"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::basic_ofstream" = type { %"class.std::basic_ostream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_ostream.base" = type { ptr }
%"struct.std::pair" = type { %"struct.std::pair.0", %"struct.std::pair.0" }
%"struct.std::pair.0" = type { i32, i32 }

@N = external dso_local global i32, align 4
@T = external dso_local global i32, align 4
@cost = external dso_local global [100 x [100 x i32]], align 16
@MOD = external dso_local local_unnamed_addr global i32, align 4
@best = external dso_local local_unnamed_addr global [100 x [100 x [3 x i32]]], align 16
@xdir = external dso_local local_unnamed_addr global [4 x i32], align 16
@ydir = external dso_local local_unnamed_addr global [4 x i32], align 16
@todo = external dso_local global %"class.std::priority_queue", align 8
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [12 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::basic_ifstream", align 8
  %2 = alloca %"class.std::basic_ofstream", align 8
  %3 = alloca %"struct.std::pair", align 4
  %4 = alloca %"struct.std::pair.0", align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::pair.0", align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %"struct.std::pair", align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %"struct.std::pair", align 4
  %14 = alloca %"struct.std::pair.0", align 4
  %15 = alloca i32, align 4
  %16 = alloca %"struct.std::pair.0", align 4
  %17 = alloca %"struct.std::pair", align 4
  %18 = alloca %"struct.std::pair.0", align 4
  %19 = alloca i32, align 4
  %20 = alloca %"struct.std::pair.0", align 4
  call void @llvm.lifetime.start.p0(i64 520, ptr nonnull %1) #6
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(256) %1, ptr noundef nonnull @.str, i32 noundef 8)
  call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %2) #6
  invoke void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(248) %2, ptr noundef nonnull @.str.1, i32 noundef 16)
          to label %21 unwind label %38

21:                                               ; preds = %0
  %22 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 4 dereferenceable(4) @N)
          to label %23 unwind label %40

23:                                               ; preds = %21
  %24 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %22, ptr noundef nonnull align 4 dereferenceable(4) @T)
          to label %.preheader58 unwind label %40

.preheader58:                                     ; preds = %23
  %25 = load i32, ptr @N, align 4, !tbaa !5
  %26 = icmp sgt i32 %25, 0
  br i1 %26, label %.preheader57.lr.ph, label %._crit_edge66

.preheader57.lr.ph:                               ; preds = %.preheader58
  %27 = load i32, ptr @MOD, align 4
  %wide.trip.count80 = zext nneg i32 %25 to i64
  %xtraiter = and i64 %wide.trip.count80, 1
  %28 = icmp eq i32 %25, 1
  %unroll_iter = and i64 %wide.trip.count80, 2147483646
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader57.us

.preheader57.us:                                  ; preds = %._crit_edge.us, %.preheader57.lr.ph
  %indvars.iv77 = phi i64 [ %indvars.iv.next78, %._crit_edge.us ], [ 0, %.preheader57.lr.ph ]
  br i1 %28, label %._crit_edge.us.unr-lcssa, label %.preheader56.us

.preheader56.us:                                  ; preds = %.preheader57.us, %.preheader56.us
  %indvars.iv = phi i64 [ %indvars.iv.next.1, %.preheader56.us ], [ 0, %.preheader57.us ]
  %niter = phi i64 [ %niter.next.1, %.preheader56.us ], [ 0, %.preheader57.us ]
  %29 = getelementptr inbounds [100 x [100 x [3 x i32]]], ptr @best, i64 0, i64 %indvars.iv77, i64 %indvars.iv, i64 0
  store i32 %27, ptr %29, align 8, !tbaa !5
  %30 = getelementptr inbounds [100 x [100 x [3 x i32]]], ptr @best, i64 0, i64 %indvars.iv77, i64 %indvars.iv, i64 1
  store i32 %27, ptr %30, align 4, !tbaa !5
  %31 = getelementptr inbounds [100 x [100 x [3 x i32]]], ptr @best, i64 0, i64 %indvars.iv77, i64 %indvars.iv, i64 2
  store i32 %27, ptr %31, align 8, !tbaa !5
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %32 = getelementptr inbounds [100 x [100 x [3 x i32]]], ptr @best, i64 0, i64 %indvars.iv77, i64 %indvars.iv.next, i64 0
  store i32 %27, ptr %32, align 4, !tbaa !5
  %33 = getelementptr inbounds [100 x [100 x [3 x i32]]], ptr @best, i64 0, i64 %indvars.iv77, i64 %indvars.iv.next, i64 1
  store i32 %27, ptr %33, align 8, !tbaa !5
  %34 = getelementptr inbounds [100 x [100 x [3 x i32]]], ptr @best, i64 0, i64 %indvars.iv77, i64 %indvars.iv.next, i64 2
  store i32 %27, ptr %34, align 4, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.us.unr-lcssa, label %.preheader56.us, !llvm.loop !9

._crit_edge.us.unr-lcssa:                         ; preds = %.preheader56.us, %.preheader57.us
  %indvars.iv.unr = phi i64 [ 0, %.preheader57.us ], [ %indvars.iv.next.1, %.preheader56.us ]
  br i1 %lcmp.mod.not, label %._crit_edge.us, label %.preheader56.us.epil

.preheader56.us.epil:                             ; preds = %._crit_edge.us.unr-lcssa
  %35 = getelementptr inbounds [100 x [100 x [3 x i32]]], ptr @best, i64 0, i64 %indvars.iv77, i64 %indvars.iv.unr, i64 0
  store i32 %27, ptr %35, align 4, !tbaa !5
  %36 = getelementptr inbounds [100 x [100 x [3 x i32]]], ptr @best, i64 0, i64 %indvars.iv77, i64 %indvars.iv.unr, i64 1
  store i32 %27, ptr %36, align 4, !tbaa !5
  %37 = getelementptr inbounds [100 x [100 x [3 x i32]]], ptr @best, i64 0, i64 %indvars.iv77, i64 %indvars.iv.unr, i64 2
  store i32 %27, ptr %37, align 4, !tbaa !5
  br label %._crit_edge.us

._crit_edge.us:                                   ; preds = %._crit_edge.us.unr-lcssa, %.preheader56.us.epil
  %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
  %exitcond81.not = icmp eq i64 %indvars.iv.next78, %wide.trip.count80
  br i1 %exitcond81.not, label %.preheader55, label %.preheader57.us, !llvm.loop !11

.preheader55:                                     ; preds = %._crit_edge.us
  br i1 %26, label %.preheader, label %._crit_edge66

38:                                               ; preds = %0
  %39 = landingpad { ptr, i32 }
          cleanup
  br label %241

40:                                               ; preds = %23, %21
  %41 = landingpad { ptr, i32 }
          cleanup
  br label %240

.preheader:                                       ; preds = %.preheader55, %._crit_edge
  %42 = phi i32 [ %44, %._crit_edge ], [ %25, %.preheader55 ]
  %indvars.iv85 = phi i64 [ %indvars.iv.next86, %._crit_edge ], [ 0, %.preheader55 ]
  %43 = icmp sgt i32 %42, 0
  br i1 %43, label %.lr.ph, label %.preheader.._crit_edge_crit_edge

.preheader.._crit_edge_crit_edge:                 ; preds = %.preheader
  %.pre = sext i32 %42 to i64
  br label %._crit_edge

._crit_edge66:                                    ; preds = %._crit_edge, %.preheader58, %.preheader55
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  store i32 0, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %7, ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %9)
  call void @_ZNSt4pairIS_IiiES0_EC2IS0_S0_TnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKS0_S9_(ptr noundef nonnull align 4 dereferenceable(16) %3, ptr noundef nonnull align 4 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(8) %7)
  invoke void @_ZNSt14priority_queueISt4pairIS0_IiiES1_ESt6vectorIS2_SaIS2_EESt4lessIS2_EE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(25) @todo, ptr noundef nonnull align 4 dereferenceable(16) %3)
          to label %54 unwind label %72

._crit_edge:                                      ; preds = %48, %.preheader.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.preheader.._crit_edge_crit_edge ], [ %50, %48 ]
  %44 = phi i32 [ %42, %.preheader.._crit_edge_crit_edge ], [ %49, %48 ]
  %indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
  %45 = icmp slt i64 %indvars.iv.next86, %.pre-phi
  br i1 %45, label %.preheader, label %._crit_edge66, !llvm.loop !12

.lr.ph:                                           ; preds = %.preheader, %48
  %indvars.iv82 = phi i64 [ %indvars.iv.next83, %48 ], [ 0, %.preheader ]
  %46 = getelementptr inbounds [100 x [100 x i32]], ptr @cost, i64 0, i64 %indvars.iv85, i64 %indvars.iv82
  %47 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 4 dereferenceable(4) %46)
          to label %48 unwind label %52

48:                                               ; preds = %.lr.ph
  %indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
  %49 = load i32, ptr @N, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = icmp slt i64 %indvars.iv.next83, %50
  br i1 %51, label %.lr.ph, label %._crit_edge, !llvm.loop !14

52:                                               ; preds = %.lr.ph
  %53 = landingpad { ptr, i32 }
          cleanup
  br label %240

54:                                               ; preds = %._crit_edge66
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #6
  %55 = call noundef i64 @_ZNKSt14priority_queueISt4pairIS0_IiiES1_ESt6vectorIS2_SaIS2_EESt4lessIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(25) @todo)
  %.not68 = icmp eq i64 %55, 0
  br i1 %.not68, label %.loopexit53, label %.lr.ph70

.lr.ph70:                                         ; preds = %54
  %56 = getelementptr inbounds i8, ptr %10, i64 8
  %57 = getelementptr inbounds i8, ptr %10, i64 12
  %58 = getelementptr inbounds i8, ptr %10, i64 4
  br label %59

59:                                               ; preds = %.lr.ph70, %.loopexit
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #6
  %60 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNKSt14priority_queueISt4pairIS0_IiiES1_ESt6vectorIS2_SaIS2_EESt4lessIS2_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @todo)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %10, ptr noundef nonnull align 4 dereferenceable(16) %60, i64 16, i1 false)
  invoke void @_ZNSt14priority_queueISt4pairIS0_IiiES1_ESt6vectorIS2_SaIS2_EESt4lessIS2_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) @todo)
          to label %61 unwind label %.loopexit54

61:                                               ; preds = %59
  %62 = load i32, ptr %10, align 4, !tbaa !15
  %63 = sub nsw i32 0, %62
  store i32 %63, ptr %10, align 4, !tbaa !15
  %64 = load i32, ptr %56, align 4, !tbaa !18
  %65 = load i32, ptr @N, align 4, !tbaa !5
  %66 = add nsw i32 %65, -1
  %67 = icmp eq i32 %64, %66
  %68 = load i32, ptr %57, align 4
  %69 = icmp eq i32 %68, %66
  %or.cond50 = select i1 %67, i1 %69, i1 false
  br i1 %or.cond50, label %70, label %74

70:                                               ; preds = %61
  %71 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %2, i32 noundef %63)
          to label %.thread unwind label %.loopexit.split-lp

.thread:                                          ; preds = %70
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #6
  br label %.loopexit53

72:                                               ; preds = %._crit_edge66
  %73 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #6
  br label %240

.loopexit54:                                      ; preds = %59
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %239

.loopexit.split-lp:                               ; preds = %70
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %239

74:                                               ; preds = %61
  %75 = sext i32 %64 to i64
  %76 = sext i32 %68 to i64
  %77 = load i32, ptr %58, align 4, !tbaa !19
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [100 x [100 x [3 x i32]]], ptr @best, i64 0, i64 %75, i64 %76, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = load i32, ptr @MOD, align 4, !tbaa !5
  %.not41 = icmp eq i32 %80, %81
  br i1 %.not41, label %82, label %.loopexit, !llvm.loop !20

82:                                               ; preds = %74
  store i32 %63, ptr %79, align 4, !tbaa !5
  %83 = add nsw i32 %77, 1
  %84 = srem i32 %83, 3
  store i32 %84, ptr %58, align 4, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #6
  %85 = load i32, ptr @xdir, align 16, !tbaa !5
  %86 = add nsw i32 %85, %64
  store i32 %86, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #6
  %87 = load i32, ptr @ydir, align 16, !tbaa !5
  %88 = add nsw i32 %87, %68
  store i32 %88, ptr %12, align 4, !tbaa !5
  %89 = icmp sgt i32 %86, -1
  br i1 %89, label %90, label %117

90:                                               ; preds = %82
  %91 = icmp slt i32 %86, %65
  %92 = icmp sgt i32 %88, -1
  %93 = icmp slt i32 %88, %65
  %94 = and i1 %92, %93
  %or.cond51 = select i1 %91, i1 %94, i1 false
  br i1 %or.cond51, label %95, label %117

95:                                               ; preds = %90
  %96 = zext nneg i32 %86 to i64
  %97 = zext nneg i32 %88 to i64
  %98 = sext i32 %84 to i64
  %99 = getelementptr inbounds [100 x [100 x [3 x i32]]], ptr @best, i64 0, i64 %96, i64 %97, i64 %98
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = icmp eq i32 %100, %80
  br i1 %101, label %102, label %117

102:                                              ; preds = %95
  %103 = icmp eq i32 %84, 0
  br i1 %103, label %104, label %112

104:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %13) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %14) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %15) #6
  %105 = load i32, ptr @T, align 4, !tbaa !5
  %106 = getelementptr inbounds [100 x [100 x i32]], ptr @cost, i64 0, i64 %96, i64 %97
  %107 = load i32, ptr %106, align 4, !tbaa !5
  %108 = add i32 %105, %107
  %.neg93 = sub i32 %62, %108
  store i32 %.neg93, ptr %15, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %14, ptr noundef nonnull align 4 dereferenceable(4) %15, ptr noundef nonnull align 4 dereferenceable(4) %58)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %16) #6
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %16, ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %12)
  call void @_ZNSt4pairIS_IiiES0_EC2IS0_S0_TnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKS0_S9_(ptr noundef nonnull align 4 dereferenceable(16) %13, ptr noundef nonnull align 4 dereferenceable(8) %14, ptr noundef nonnull align 4 dereferenceable(8) %16)
  invoke void @_ZNSt14priority_queueISt4pairIS0_IiiES1_ESt6vectorIS2_SaIS2_EESt4lessIS2_EE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(25) @todo, ptr noundef nonnull align 4 dereferenceable(16) %13)
          to label %109 unwind label %110

109:                                              ; preds = %104
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %13) #6
  br label %117

110:                                              ; preds = %228, %188, %148, %104
  %111 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %13) #6
  br label %237

112:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %17) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %18) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %19) #6
  %113 = load i32, ptr @T, align 4, !tbaa !5
  %.neg = sub i32 %62, %113
  store i32 %.neg, ptr %19, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %18, ptr noundef nonnull align 4 dereferenceable(4) %19, ptr noundef nonnull align 4 dereferenceable(4) %58)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %20) #6
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %20, ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %12)
  call void @_ZNSt4pairIS_IiiES0_EC2IS0_S0_TnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKS0_S9_(ptr noundef nonnull align 4 dereferenceable(16) %17, ptr noundef nonnull align 4 dereferenceable(8) %18, ptr noundef nonnull align 4 dereferenceable(8) %20)
  invoke void @_ZNSt14priority_queueISt4pairIS0_IiiES1_ESt6vectorIS2_SaIS2_EESt4lessIS2_EE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(25) @todo, ptr noundef nonnull align 4 dereferenceable(16) %17)
          to label %114 unwind label %115

114:                                              ; preds = %112
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %18) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %17) #6
  br label %117

115:                                              ; preds = %222, %182, %142, %112
  %116 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %18) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %17) #6
  br label %237

117:                                              ; preds = %109, %114, %95, %90, %82
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #6
  %118 = load i32, ptr %56, align 4, !tbaa !18
  %119 = load i32, ptr getelementptr inbounds (i8, ptr @xdir, i64 4), align 4, !tbaa !5
  %120 = add nsw i32 %119, %118
  store i32 %120, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #6
  %121 = load i32, ptr %57, align 4, !tbaa !21
  %122 = load i32, ptr getelementptr inbounds (i8, ptr @ydir, i64 4), align 4, !tbaa !5
  %123 = add nsw i32 %122, %121
  store i32 %123, ptr %12, align 4, !tbaa !5
  %124 = icmp sgt i32 %120, -1
  br i1 %124, label %125, label %157

125:                                              ; preds = %117
  %126 = load i32, ptr @N, align 4, !tbaa !5
  %127 = icmp slt i32 %120, %126
  %128 = icmp sgt i32 %123, -1
  %129 = icmp slt i32 %123, %126
  %130 = and i1 %128, %129
  %or.cond51.1 = select i1 %127, i1 %130, i1 false
  br i1 %or.cond51.1, label %131, label %157

131:                                              ; preds = %125
  %132 = zext nneg i32 %120 to i64
  %133 = zext nneg i32 %123 to i64
  %134 = load i32, ptr %58, align 4, !tbaa !19
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [100 x [100 x [3 x i32]]], ptr @best, i64 0, i64 %132, i64 %133, i64 %135
  %137 = load i32, ptr %136, align 4, !tbaa !5
  %138 = load i32, ptr @MOD, align 4, !tbaa !5
  %139 = icmp eq i32 %137, %138
  br i1 %139, label %140, label %157

140:                                              ; preds = %131
  %141 = icmp eq i32 %134, 0
  br i1 %141, label %148, label %142

142:                                              ; preds = %140
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %17) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %18) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %19) #6
  %143 = load i32, ptr %10, align 4, !tbaa !15
  %144 = load i32, ptr @T, align 4, !tbaa !5
  %145 = add nsw i32 %143, %144
  %146 = sub nsw i32 0, %145
  store i32 %146, ptr %19, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %18, ptr noundef nonnull align 4 dereferenceable(4) %19, ptr noundef nonnull align 4 dereferenceable(4) %58)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %20) #6
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %20, ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %12)
  call void @_ZNSt4pairIS_IiiES0_EC2IS0_S0_TnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKS0_S9_(ptr noundef nonnull align 4 dereferenceable(16) %17, ptr noundef nonnull align 4 dereferenceable(8) %18, ptr noundef nonnull align 4 dereferenceable(8) %20)
  invoke void @_ZNSt14priority_queueISt4pairIS0_IiiES1_ESt6vectorIS2_SaIS2_EESt4lessIS2_EE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(25) @todo, ptr noundef nonnull align 4 dereferenceable(16) %17)
          to label %147 unwind label %115

147:                                              ; preds = %142
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %18) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %17) #6
  br label %157

148:                                              ; preds = %140
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %13) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %14) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %15) #6
  %149 = load i32, ptr %10, align 4, !tbaa !15
  %150 = load i32, ptr @T, align 4, !tbaa !5
  %151 = add nsw i32 %149, %150
  %152 = getelementptr inbounds [100 x [100 x i32]], ptr @cost, i64 0, i64 %132, i64 %133
  %153 = load i32, ptr %152, align 4, !tbaa !5
  %154 = add nsw i32 %151, %153
  %155 = sub nsw i32 0, %154
  store i32 %155, ptr %15, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %14, ptr noundef nonnull align 4 dereferenceable(4) %15, ptr noundef nonnull align 4 dereferenceable(4) %58)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %16) #6
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %16, ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %12)
  call void @_ZNSt4pairIS_IiiES0_EC2IS0_S0_TnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKS0_S9_(ptr noundef nonnull align 4 dereferenceable(16) %13, ptr noundef nonnull align 4 dereferenceable(8) %14, ptr noundef nonnull align 4 dereferenceable(8) %16)
  invoke void @_ZNSt14priority_queueISt4pairIS0_IiiES1_ESt6vectorIS2_SaIS2_EESt4lessIS2_EE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(25) @todo, ptr noundef nonnull align 4 dereferenceable(16) %13)
          to label %156 unwind label %110

156:                                              ; preds = %148
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %13) #6
  br label %157

157:                                              ; preds = %156, %147, %131, %125, %117
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #6
  %158 = load i32, ptr %56, align 4, !tbaa !18
  %159 = load i32, ptr getelementptr inbounds (i8, ptr @xdir, i64 8), align 8, !tbaa !5
  %160 = add nsw i32 %159, %158
  store i32 %160, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #6
  %161 = load i32, ptr %57, align 4, !tbaa !21
  %162 = load i32, ptr getelementptr inbounds (i8, ptr @ydir, i64 8), align 8, !tbaa !5
  %163 = add nsw i32 %162, %161
  store i32 %163, ptr %12, align 4, !tbaa !5
  %164 = icmp sgt i32 %160, -1
  br i1 %164, label %165, label %197

165:                                              ; preds = %157
  %166 = load i32, ptr @N, align 4, !tbaa !5
  %167 = icmp slt i32 %160, %166
  %168 = icmp sgt i32 %163, -1
  %169 = icmp slt i32 %163, %166
  %170 = and i1 %168, %169
  %or.cond51.2 = select i1 %167, i1 %170, i1 false
  br i1 %or.cond51.2, label %171, label %197

171:                                              ; preds = %165
  %172 = zext nneg i32 %160 to i64
  %173 = zext nneg i32 %163 to i64
  %174 = load i32, ptr %58, align 4, !tbaa !19
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [100 x [100 x [3 x i32]]], ptr @best, i64 0, i64 %172, i64 %173, i64 %175
  %177 = load i32, ptr %176, align 4, !tbaa !5
  %178 = load i32, ptr @MOD, align 4, !tbaa !5
  %179 = icmp eq i32 %177, %178
  br i1 %179, label %180, label %197

180:                                              ; preds = %171
  %181 = icmp eq i32 %174, 0
  br i1 %181, label %188, label %182

182:                                              ; preds = %180
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %17) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %18) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %19) #6
  %183 = load i32, ptr %10, align 4, !tbaa !15
  %184 = load i32, ptr @T, align 4, !tbaa !5
  %185 = add nsw i32 %183, %184
  %186 = sub nsw i32 0, %185
  store i32 %186, ptr %19, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %18, ptr noundef nonnull align 4 dereferenceable(4) %19, ptr noundef nonnull align 4 dereferenceable(4) %58)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %20) #6
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %20, ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %12)
  call void @_ZNSt4pairIS_IiiES0_EC2IS0_S0_TnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKS0_S9_(ptr noundef nonnull align 4 dereferenceable(16) %17, ptr noundef nonnull align 4 dereferenceable(8) %18, ptr noundef nonnull align 4 dereferenceable(8) %20)
  invoke void @_ZNSt14priority_queueISt4pairIS0_IiiES1_ESt6vectorIS2_SaIS2_EESt4lessIS2_EE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(25) @todo, ptr noundef nonnull align 4 dereferenceable(16) %17)
          to label %187 unwind label %115

187:                                              ; preds = %182
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %18) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %17) #6
  br label %197

188:                                              ; preds = %180
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %13) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %14) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %15) #6
  %189 = load i32, ptr %10, align 4, !tbaa !15
  %190 = load i32, ptr @T, align 4, !tbaa !5
  %191 = add nsw i32 %189, %190
  %192 = getelementptr inbounds [100 x [100 x i32]], ptr @cost, i64 0, i64 %172, i64 %173
  %193 = load i32, ptr %192, align 4, !tbaa !5
  %194 = add nsw i32 %191, %193
  %195 = sub nsw i32 0, %194
  store i32 %195, ptr %15, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %14, ptr noundef nonnull align 4 dereferenceable(4) %15, ptr noundef nonnull align 4 dereferenceable(4) %58)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %16) #6
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %16, ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %12)
  call void @_ZNSt4pairIS_IiiES0_EC2IS0_S0_TnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKS0_S9_(ptr noundef nonnull align 4 dereferenceable(16) %13, ptr noundef nonnull align 4 dereferenceable(8) %14, ptr noundef nonnull align 4 dereferenceable(8) %16)
  invoke void @_ZNSt14priority_queueISt4pairIS0_IiiES1_ESt6vectorIS2_SaIS2_EESt4lessIS2_EE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(25) @todo, ptr noundef nonnull align 4 dereferenceable(16) %13)
          to label %196 unwind label %110

196:                                              ; preds = %188
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %13) #6
  br label %197

197:                                              ; preds = %196, %187, %171, %165, %157
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #6
  %198 = load i32, ptr %56, align 4, !tbaa !18
  %199 = load i32, ptr getelementptr inbounds (i8, ptr @xdir, i64 12), align 4, !tbaa !5
  %200 = add nsw i32 %199, %198
  store i32 %200, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #6
  %201 = load i32, ptr %57, align 4, !tbaa !21
  %202 = load i32, ptr getelementptr inbounds (i8, ptr @ydir, i64 12), align 4, !tbaa !5
  %203 = add nsw i32 %202, %201
  store i32 %203, ptr %12, align 4, !tbaa !5
  %204 = icmp sgt i32 %200, -1
  br i1 %204, label %205, label %.loopexit.loopexit

205:                                              ; preds = %197
  %206 = load i32, ptr @N, align 4, !tbaa !5
  %207 = icmp slt i32 %200, %206
  %208 = icmp sgt i32 %203, -1
  %209 = icmp slt i32 %203, %206
  %210 = and i1 %208, %209
  %or.cond51.3 = select i1 %207, i1 %210, i1 false
  br i1 %or.cond51.3, label %211, label %.loopexit.loopexit

211:                                              ; preds = %205
  %212 = zext nneg i32 %200 to i64
  %213 = zext nneg i32 %203 to i64
  %214 = load i32, ptr %58, align 4, !tbaa !19
  %215 = sext i32 %214 to i64
  %216 = getelementptr inbounds [100 x [100 x [3 x i32]]], ptr @best, i64 0, i64 %212, i64 %213, i64 %215
  %217 = load i32, ptr %216, align 4, !tbaa !5
  %218 = load i32, ptr @MOD, align 4, !tbaa !5
  %219 = icmp eq i32 %217, %218
  br i1 %219, label %220, label %.loopexit.loopexit

220:                                              ; preds = %211
  %221 = icmp eq i32 %214, 0
  br i1 %221, label %228, label %222

222:                                              ; preds = %220
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %17) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %18) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %19) #6
  %223 = load i32, ptr %10, align 4, !tbaa !15
  %224 = load i32, ptr @T, align 4, !tbaa !5
  %225 = add nsw i32 %223, %224
  %226 = sub nsw i32 0, %225
  store i32 %226, ptr %19, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %18, ptr noundef nonnull align 4 dereferenceable(4) %19, ptr noundef nonnull align 4 dereferenceable(4) %58)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %20) #6
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %20, ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %12)
  call void @_ZNSt4pairIS_IiiES0_EC2IS0_S0_TnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKS0_S9_(ptr noundef nonnull align 4 dereferenceable(16) %17, ptr noundef nonnull align 4 dereferenceable(8) %18, ptr noundef nonnull align 4 dereferenceable(8) %20)
  invoke void @_ZNSt14priority_queueISt4pairIS0_IiiES1_ESt6vectorIS2_SaIS2_EESt4lessIS2_EE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(25) @todo, ptr noundef nonnull align 4 dereferenceable(16) %17)
          to label %227 unwind label %115

227:                                              ; preds = %222
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %18) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %17) #6
  br label %.loopexit.loopexit

228:                                              ; preds = %220
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %13) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %14) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %15) #6
  %229 = load i32, ptr %10, align 4, !tbaa !15
  %230 = load i32, ptr @T, align 4, !tbaa !5
  %231 = add nsw i32 %229, %230
  %232 = getelementptr inbounds [100 x [100 x i32]], ptr @cost, i64 0, i64 %212, i64 %213
  %233 = load i32, ptr %232, align 4, !tbaa !5
  %234 = add nsw i32 %231, %233
  %235 = sub nsw i32 0, %234
  store i32 %235, ptr %15, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %14, ptr noundef nonnull align 4 dereferenceable(4) %15, ptr noundef nonnull align 4 dereferenceable(4) %58)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %16) #6
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %16, ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %12)
  call void @_ZNSt4pairIS_IiiES0_EC2IS0_S0_TnNSt9enable_ifIXaaclsr5_PCCPE18_ConstructiblePairIT_T0_EEclsr5_PCCPE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKS0_S9_(ptr noundef nonnull align 4 dereferenceable(16) %13, ptr noundef nonnull align 4 dereferenceable(8) %14, ptr noundef nonnull align 4 dereferenceable(8) %16)
  invoke void @_ZNSt14priority_queueISt4pairIS0_IiiES1_ESt6vectorIS2_SaIS2_EESt4lessIS2_EE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(25) @todo, ptr noundef nonnull align 4 dereferenceable(16) %13)
          to label %236 unwind label %110

236:                                              ; preds = %228
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %13) #6
  br label %.loopexit.loopexit

.loopexit.loopexit:                               ; preds = %236, %227, %211, %205, %197
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #6
  br label %.loopexit

237:                                              ; preds = %115, %110
  %.pn = phi { ptr, i32 } [ %111, %110 ], [ %116, %115 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #6
  br label %239

.loopexit:                                        ; preds = %.loopexit.loopexit, %74
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #6
  %238 = call noundef i64 @_ZNKSt14priority_queueISt4pairIS0_IiiES1_ESt6vectorIS2_SaIS2_EESt4lessIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(25) @todo)
  %.not = icmp eq i64 %238, 0
  br i1 %.not, label %.loopexit53, label %59

239:                                              ; preds = %.loopexit54, %.loopexit.split-lp, %237
  %.pn43 = phi { ptr, i32 } [ %.pn, %237 ], [ %lpad.loopexit, %.loopexit54 ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #6
  br label %240

.loopexit53:                                      ; preds = %.loopexit, %54, %.thread
  call void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248) %2) #6
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %2) #6
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %1) #6
  call void @llvm.lifetime.end.p0(i64 520, ptr nonnull %1) #6
  ret i32 0

240:                                              ; preds = %239, %72, %52, %40
  %.pn45 = phi { ptr, i32 } [ %53, %52 ], [ %.pn43, %239 ], [ %73, %72 ], [ %41, %40 ]
  call void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248) %2) #6
  br label %241

241:                                              ; preds = %240, %38
  %.pn45.pn = phi { ptr, i32 } [ %.pn45, %240 ], [ %39, %38 ]
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %2) #6
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %1) #6
  call void @llvm.lifetime.end.p0(i64 520, ptr nonnull %1) #6
  resume { ptr, i32 } %.pn45.pn
}

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

; Function Attrs: mustprogress uwtable
declare void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(256), ptr noundef, i32 noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(248), ptr noundef, i32 noundef) unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

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 #3

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

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

; 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 #4 align 2

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248)) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256)) unnamed_addr #4 align 2

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13}
!13 = !{!"llvm.loop.unswitch.partial.disable"}
!14 = distinct !{!14, !10}
!15 = !{!16, !6, i64 0}
!16 = !{!"_ZTSSt4pairIS_IiiES0_E", !17, i64 0, !17, i64 8}
!17 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!18 = !{!16, !6, i64 8}
!19 = !{!16, !6, i64 4}
!20 = distinct !{!20, !10}
!21 = !{!16, !6, i64 12}


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