; LLVM IR from VastoLorde95/Competitive-Programming :: Hackerrank/Codeagon 2016/Problem D/D.ll (Z2goii)

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

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

@n = external dso_local global i32, align 4
@g = external dso_local global [3001 x [3001 x [2 x i32]]], align 16
@inf = external dso_local global i32, align 4
@d = external dso_local global [3001 x [2 x i32]], align 16
@v = external dso_local global [3001 x [2 x i32]], align 16

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z2goii(i32 noundef %0, i32 noundef %1) #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %"class.std::priority_queue", align 8
  %8 = alloca %"struct.std::pair", align 4
  %9 = alloca i32, align 4
  %10 = alloca %"struct.std::pair.0", align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca { i64, i32 }, align 8
  %15 = alloca %"struct.std::pair", align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca %"struct.std::pair", align 4
  %22 = alloca i32, align 4
  %23 = alloca %"struct.std::pair.0", align 4
  %24 = alloca i32, align 4
  %25 = alloca { i64, i32 }, align 8
  %26 = alloca i32, align 4
  %27 = alloca %"struct.std::pair", align 4
  %28 = alloca i32, align 4
  %29 = alloca %"struct.std::pair.0", align 4
  %30 = alloca i32, align 4
  %31 = alloca { i64, i32 }, align 8
  %32 = alloca i32, align 4
  %33 = alloca %"struct.std::pair", align 4
  %34 = alloca i32, align 4
  %35 = alloca %"struct.std::pair.0", align 4
  %36 = alloca i32, align 4
  %37 = alloca { i64, i32 }, align 8
  store i32 %0, ptr %4, align 4, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %61, %2
  %39 = load i32, ptr %6, align 4, !tbaa !5
  %40 = load i32, ptr @n, align 4, !tbaa !5
  %41 = icmp sle i32 %39, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %38
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %64

43:                                               ; preds = %38
  %44 = load i32, ptr @inf, align 4, !tbaa !5
  %45 = load i32, ptr %6, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [3001 x [2 x i32]], ptr @d, i64 0, i64 %46
  %48 = getelementptr inbounds [2 x i32], ptr %47, i64 0, i64 1
  store i32 %44, ptr %48, align 4, !tbaa !5
  %49 = load i32, ptr %6, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [3001 x [2 x i32]], ptr @d, i64 0, i64 %50
  %52 = getelementptr inbounds [2 x i32], ptr %51, i64 0, i64 0
  store i32 %44, ptr %52, align 8, !tbaa !5
  %53 = load i32, ptr %6, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [3001 x [2 x i32]], ptr @v, i64 0, i64 %54
  %56 = getelementptr inbounds [2 x i32], ptr %55, i64 0, i64 0
  store i32 0, ptr %56, align 8, !tbaa !5
  %57 = load i32, ptr %6, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [3001 x [2 x i32]], ptr @v, i64 0, i64 %58
  %60 = getelementptr inbounds [2 x i32], ptr %59, i64 0, i64 1
  store i32 0, ptr %60, align 4, !tbaa !5
  br label %61

61:                                               ; preds = %43
  %62 = load i32, ptr %6, align 4, !tbaa !5
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr %6, align 4, !tbaa !5
  br label %38, !llvm.loop !9

64:                                               ; preds = %42
  %65 = load i32, ptr %4, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [3001 x [2 x i32]], ptr @d, i64 0, i64 %66
  %68 = getelementptr inbounds [2 x i32], ptr %67, i64 0, i64 0
  store i32 0, ptr %68, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %7) #5
  call void @_ZNSt14priority_queueISt4pairIiS0_IiiEESt6vectorIS2_SaIS2_EESt4lessIS2_EEC2IS5_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %7)
  call void @llvm.lifetime.start.p0(i64 12, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !5
  %69 = invoke i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %70 unwind label %98

70:                                               ; preds = %64
  store i64 %69, ptr %10, align 4
  %71 = invoke { i64, i32 } @_ZSt9make_pairIiSt4pairIiiEES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(8) %10)
          to label %72 unwind label %98

72:                                               ; preds = %70
  store { i64, i32 } %71, ptr %14, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %8, ptr align 8 %14, i64 12, i1 false)
  invoke void @_ZNSt14priority_queueISt4pairIiS0_IiiEESt6vectorIS2_SaIS2_EESt4lessIS2_EE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(25) %7, ptr noundef nonnull align 4 dereferenceable(12) %8)
          to label %73 unwind label %98

73:                                               ; preds = %72
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %8) #5
  br label %74

74:                                               ; preds = %324, %322, %73
  %75 = invoke noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIiS0_IiiEESt6vectorIS2_SaIS2_EESt4lessIS2_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %7)
          to label %76 unwind label %102

76:                                               ; preds = %74
  %77 = xor i1 %75, true
  br i1 %77, label %78, label %326

78:                                               ; preds = %76
  call void @llvm.lifetime.start.p0(i64 12, ptr %15) #5
  %79 = invoke noundef nonnull align 4 dereferenceable(12) ptr @_ZNKSt14priority_queueISt4pairIiS0_IiiEESt6vectorIS2_SaIS2_EESt4lessIS2_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %7)
          to label %80 unwind label %106

80:                                               ; preds = %78
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %79, i64 12, i1 false)
  invoke void @_ZNSt14priority_queueISt4pairIiS0_IiiEESt6vectorIS2_SaIS2_EESt4lessIS2_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %7)
          to label %81 unwind label %106

81:                                               ; preds = %80
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %82 = getelementptr inbounds %"struct.std::pair", ptr %15, i32 0, i32 1
  %83 = getelementptr inbounds %"struct.std::pair.0", ptr %82, i32 0, i32 1
  %84 = load i32, ptr %83, align 4, !tbaa !11
  store i32 %84, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %85 = getelementptr inbounds %"struct.std::pair", ptr %15, i32 0, i32 1
  %86 = getelementptr inbounds %"struct.std::pair.0", ptr %85, i32 0, i32 0
  %87 = load i32, ptr %86, align 4, !tbaa !14
  %88 = sub nsw i32 0, %87
  store i32 %88, ptr %17, align 4, !tbaa !5
  %89 = load i32, ptr %16, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [3001 x [2 x i32]], ptr @v, i64 0, i64 %90
  %92 = load i32, ptr %17, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [2 x i32], ptr %91, i64 0, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = icmp ne i32 %95, 0
  br i1 %96, label %97, label %110

97:                                               ; preds = %81
  store i32 5, ptr %18, align 4
  br label %322, !llvm.loop !15

98:                                               ; preds = %72, %70, %64
  %99 = landingpad { ptr, i32 }
          cleanup
  %100 = extractvalue { ptr, i32 } %99, 0
  store ptr %100, ptr %12, align 8
  %101 = extractvalue { ptr, i32 } %99, 1
  store i32 %101, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %8) #5
  br label %357

102:                                              ; preds = %343, %74
  %103 = landingpad { ptr, i32 }
          cleanup
  %104 = extractvalue { ptr, i32 } %103, 0
  store ptr %104, ptr %12, align 8
  %105 = extractvalue { ptr, i32 } %103, 1
  store i32 %105, ptr %13, align 4
  br label %357

106:                                              ; preds = %80, %78
  %107 = landingpad { ptr, i32 }
          cleanup
  %108 = extractvalue { ptr, i32 } %107, 0
  store ptr %108, ptr %12, align 8
  %109 = extractvalue { ptr, i32 } %107, 1
  store i32 %109, ptr %13, align 4
  br label %325

110:                                              ; preds = %81
  %111 = load i32, ptr %16, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [3001 x [2 x i32]], ptr @v, i64 0, i64 %112
  %114 = load i32, ptr %17, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [2 x i32], ptr %113, i64 0, i64 %115
  store i32 1, ptr %116, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  store i32 1, ptr %19, align 4, !tbaa !5
  br label %117

117:                                              ; preds = %317, %110
  %118 = load i32, ptr %19, align 4, !tbaa !5
  %119 = load i32, ptr @n, align 4, !tbaa !5
  %120 = icmp sle i32 %118, %119
  br i1 %120, label %122, label %121

121:                                              ; preds = %117
  store i32 7, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  br label %321

122:                                              ; preds = %117
  %123 = load i32, ptr %19, align 4, !tbaa !5
  %124 = load i32, ptr %16, align 4, !tbaa !5
  %125 = icmp eq i32 %123, %124
  br i1 %125, label %126, label %127

126:                                              ; preds = %122
  br label %317

127:                                              ; preds = %122
  %128 = load i32, ptr %16, align 4, !tbaa !5
  %129 = icmp eq i32 %128, 2
  br i1 %129, label %130, label %134

130:                                              ; preds = %127
  %131 = load i32, ptr %19, align 4, !tbaa !5
  %132 = icmp eq i32 %131, 4
  br i1 %132, label %133, label %134

133:                                              ; preds = %130
  br label %134

134:                                              ; preds = %133, %130, %127
  %135 = load i32, ptr %16, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [3001 x [3001 x [2 x i32]]], ptr @g, i64 0, i64 %136
  %138 = load i32, ptr %19, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [3001 x [2 x i32]], ptr %137, i64 0, i64 %139
  %141 = getelementptr inbounds [2 x i32], ptr %140, i64 0, i64 0
  %142 = load i32, ptr %141, align 8, !tbaa !5
  %143 = load i32, ptr @inf, align 4, !tbaa !5
  %144 = icmp eq i32 %142, %143
  br i1 %144, label %145, label %157

145:                                              ; preds = %134
  %146 = load i32, ptr %16, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [3001 x [3001 x [2 x i32]]], ptr @g, i64 0, i64 %147
  %149 = load i32, ptr %19, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [3001 x [2 x i32]], ptr %148, i64 0, i64 %150
  %152 = getelementptr inbounds [2 x i32], ptr %151, i64 0, i64 1
  %153 = load i32, ptr %152, align 4, !tbaa !5
  %154 = load i32, ptr @inf, align 4, !tbaa !5
  %155 = icmp eq i32 %153, %154
  br i1 %155, label %156, label %157

156:                                              ; preds = %145
  br label %317

157:                                              ; preds = %145, %134
  %158 = load i32, ptr %19, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [3001 x [2 x i32]], ptr @v, i64 0, i64 %159
  %161 = getelementptr inbounds [2 x i32], ptr %160, i64 0, i64 0
  %162 = load i32, ptr %161, align 8, !tbaa !5
  %163 = icmp ne i32 %162, 0
  br i1 %163, label %213, label %164

164:                                              ; preds = %157
  %165 = load i32, ptr %17, align 4, !tbaa !5
  %166 = icmp ne i32 %165, 0
  br i1 %166, label %213, label %167

167:                                              ; preds = %164
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  %168 = load i32, ptr %16, align 4, !tbaa !5
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [3001 x [2 x i32]], ptr @d, i64 0, i64 %169
  %171 = load i32, ptr %17, align 4, !tbaa !5
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [2 x i32], ptr %170, i64 0, i64 %172
  %174 = load i32, ptr %173, align 4, !tbaa !5
  %175 = load i32, ptr %16, align 4, !tbaa !5
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [3001 x [3001 x [2 x i32]]], ptr @g, i64 0, i64 %176
  %178 = load i32, ptr %19, align 4, !tbaa !5
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [3001 x [2 x i32]], ptr %177, i64 0, i64 %179
  %181 = getelementptr inbounds [2 x i32], ptr %180, i64 0, i64 0
  %182 = load i32, ptr %181, align 8, !tbaa !5
  %183 = add nsw i32 %174, %182
  store i32 %183, ptr %20, align 4, !tbaa !5
  %184 = load i32, ptr %20, align 4, !tbaa !5
  %185 = load i32, ptr %19, align 4, !tbaa !5
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [3001 x [2 x i32]], ptr @d, i64 0, i64 %186
  %188 = getelementptr inbounds [2 x i32], ptr %187, i64 0, i64 0
  %189 = load i32, ptr %188, align 8, !tbaa !5
  %190 = icmp slt i32 %184, %189
  br i1 %190, label %191, label %212

191:                                              ; preds = %167
  %192 = load i32, ptr %20, align 4, !tbaa !5
  %193 = load i32, ptr %19, align 4, !tbaa !5
  %194 = sext i32 %193 to i64
  %195 = getelementptr inbounds [3001 x [2 x i32]], ptr @d, i64 0, i64 %194
  %196 = getelementptr inbounds [2 x i32], ptr %195, i64 0, i64 0
  store i32 %192, ptr %196, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr %21) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #5
  %197 = load i32, ptr %19, align 4, !tbaa !5
  %198 = sext i32 %197 to i64
  %199 = getelementptr inbounds [3001 x [2 x i32]], ptr @d, i64 0, i64 %198
  %200 = getelementptr inbounds [2 x i32], ptr %199, i64 0, i64 0
  %201 = load i32, ptr %200, align 8, !tbaa !5
  %202 = sub nsw i32 0, %201
  store i32 %202, ptr %22, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #5
  store i32 0, ptr %24, align 4, !tbaa !5
  %203 = invoke i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %24, ptr noundef nonnull align 4 dereferenceable(4) %19)
          to label %204 unwind label %208

204:                                              ; preds = %191
  store i64 %203, ptr %23, align 4
  %205 = invoke { i64, i32 } @_ZSt9make_pairIiSt4pairIiiEES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %22, ptr noundef nonnull align 4 dereferenceable(8) %23)
          to label %206 unwind label %208

206:                                              ; preds = %204
  store { i64, i32 } %205, ptr %25, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %21, ptr align 8 %25, i64 12, i1 false)
  invoke void @_ZNSt14priority_queueISt4pairIiS0_IiiEESt6vectorIS2_SaIS2_EESt4lessIS2_EE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(25) %7, ptr noundef nonnull align 4 dereferenceable(12) %21)
          to label %207 unwind label %208

207:                                              ; preds = %206
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %21) #5
  br label %212

208:                                              ; preds = %206, %204, %191
  %209 = landingpad { ptr, i32 }
          cleanup
  %210 = extractvalue { ptr, i32 } %209, 0
  store ptr %210, ptr %12, align 8
  %211 = extractvalue { ptr, i32 } %209, 1
  store i32 %211, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  br label %320

212:                                              ; preds = %207, %167
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  br label %213

213:                                              ; preds = %212, %164, %157
  %214 = load i32, ptr %19, align 4, !tbaa !5
  %215 = sext i32 %214 to i64
  %216 = getelementptr inbounds [3001 x [2 x i32]], ptr @v, i64 0, i64 %215
  %217 = getelementptr inbounds [2 x i32], ptr %216, i64 0, i64 1
  %218 = load i32, ptr %217, align 4, !tbaa !5
  %219 = icmp ne i32 %218, 0
  br i1 %219, label %316, label %220

220:                                              ; preds = %213
  %221 = load i32, ptr %17, align 4, !tbaa !5
  %222 = icmp ne i32 %221, 0
  br i1 %222, label %223, label %269

223:                                              ; preds = %220
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #5
  %224 = load i32, ptr %16, align 4, !tbaa !5
  %225 = sext i32 %224 to i64
  %226 = getelementptr inbounds [3001 x [2 x i32]], ptr @d, i64 0, i64 %225
  %227 = load i32, ptr %17, align 4, !tbaa !5
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds [2 x i32], ptr %226, i64 0, i64 %228
  %230 = load i32, ptr %229, align 4, !tbaa !5
  %231 = load i32, ptr %16, align 4, !tbaa !5
  %232 = sext i32 %231 to i64
  %233 = getelementptr inbounds [3001 x [3001 x [2 x i32]]], ptr @g, i64 0, i64 %232
  %234 = load i32, ptr %19, align 4, !tbaa !5
  %235 = sext i32 %234 to i64
  %236 = getelementptr inbounds [3001 x [2 x i32]], ptr %233, i64 0, i64 %235
  %237 = getelementptr inbounds [2 x i32], ptr %236, i64 0, i64 0
  %238 = load i32, ptr %237, align 8, !tbaa !5
  %239 = add nsw i32 %230, %238
  store i32 %239, ptr %26, align 4, !tbaa !5
  %240 = load i32, ptr %26, align 4, !tbaa !5
  %241 = load i32, ptr %19, align 4, !tbaa !5
  %242 = sext i32 %241 to i64
  %243 = getelementptr inbounds [3001 x [2 x i32]], ptr @d, i64 0, i64 %242
  %244 = getelementptr inbounds [2 x i32], ptr %243, i64 0, i64 1
  %245 = load i32, ptr %244, align 4, !tbaa !5
  %246 = icmp slt i32 %240, %245
  br i1 %246, label %247, label %268

247:                                              ; preds = %223
  %248 = load i32, ptr %26, align 4, !tbaa !5
  %249 = load i32, ptr %19, align 4, !tbaa !5
  %250 = sext i32 %249 to i64
  %251 = getelementptr inbounds [3001 x [2 x i32]], ptr @d, i64 0, i64 %250
  %252 = getelementptr inbounds [2 x i32], ptr %251, i64 0, i64 1
  store i32 %248, ptr %252, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr %27) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #5
  %253 = load i32, ptr %19, align 4, !tbaa !5
  %254 = sext i32 %253 to i64
  %255 = getelementptr inbounds [3001 x [2 x i32]], ptr @d, i64 0, i64 %254
  %256 = getelementptr inbounds [2 x i32], ptr %255, i64 0, i64 1
  %257 = load i32, ptr %256, align 4, !tbaa !5
  %258 = sub nsw i32 0, %257
  store i32 %258, ptr %28, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #5
  store i32 -1, ptr %30, align 4, !tbaa !5
  %259 = invoke i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %30, ptr noundef nonnull align 4 dereferenceable(4) %19)
          to label %260 unwind label %264

260:                                              ; preds = %247
  store i64 %259, ptr %29, align 4
  %261 = invoke { i64, i32 } @_ZSt9make_pairIiSt4pairIiiEES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %28, ptr noundef nonnull align 4 dereferenceable(8) %29)
          to label %262 unwind label %264

262:                                              ; preds = %260
  store { i64, i32 } %261, ptr %31, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %27, ptr align 8 %31, i64 12, i1 false)
  invoke void @_ZNSt14priority_queueISt4pairIiS0_IiiEESt6vectorIS2_SaIS2_EESt4lessIS2_EE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(25) %7, ptr noundef nonnull align 4 dereferenceable(12) %27)
          to label %263 unwind label %264

263:                                              ; preds = %262
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %27) #5
  br label %268

264:                                              ; preds = %262, %260, %247
  %265 = landingpad { ptr, i32 }
          cleanup
  %266 = extractvalue { ptr, i32 } %265, 0
  store ptr %266, ptr %12, align 8
  %267 = extractvalue { ptr, i32 } %265, 1
  store i32 %267, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %27) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #5
  br label %320

268:                                              ; preds = %263, %223
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #5
  br label %315

269:                                              ; preds = %220
  call void @llvm.lifetime.start.p0(i64 4, ptr %32) #5
  %270 = load i32, ptr %16, align 4, !tbaa !5
  %271 = sext i32 %270 to i64
  %272 = getelementptr inbounds [3001 x [2 x i32]], ptr @d, i64 0, i64 %271
  %273 = load i32, ptr %17, align 4, !tbaa !5
  %274 = sext i32 %273 to i64
  %275 = getelementptr inbounds [2 x i32], ptr %272, i64 0, i64 %274
  %276 = load i32, ptr %275, align 4, !tbaa !5
  %277 = load i32, ptr %16, align 4, !tbaa !5
  %278 = sext i32 %277 to i64
  %279 = getelementptr inbounds [3001 x [3001 x [2 x i32]]], ptr @g, i64 0, i64 %278
  %280 = load i32, ptr %19, align 4, !tbaa !5
  %281 = sext i32 %280 to i64
  %282 = getelementptr inbounds [3001 x [2 x i32]], ptr %279, i64 0, i64 %281
  %283 = getelementptr inbounds [2 x i32], ptr %282, i64 0, i64 1
  %284 = load i32, ptr %283, align 4, !tbaa !5
  %285 = add nsw i32 %276, %284
  store i32 %285, ptr %32, align 4, !tbaa !5
  %286 = load i32, ptr %32, align 4, !tbaa !5
  %287 = load i32, ptr %19, align 4, !tbaa !5
  %288 = sext i32 %287 to i64
  %289 = getelementptr inbounds [3001 x [2 x i32]], ptr @d, i64 0, i64 %288
  %290 = getelementptr inbounds [2 x i32], ptr %289, i64 0, i64 1
  %291 = load i32, ptr %290, align 4, !tbaa !5
  %292 = icmp slt i32 %286, %291
  br i1 %292, label %293, label %314

293:                                              ; preds = %269
  %294 = load i32, ptr %32, align 4, !tbaa !5
  %295 = load i32, ptr %19, align 4, !tbaa !5
  %296 = sext i32 %295 to i64
  %297 = getelementptr inbounds [3001 x [2 x i32]], ptr @d, i64 0, i64 %296
  %298 = getelementptr inbounds [2 x i32], ptr %297, i64 0, i64 1
  store i32 %294, ptr %298, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr %33) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %34) #5
  %299 = load i32, ptr %19, align 4, !tbaa !5
  %300 = sext i32 %299 to i64
  %301 = getelementptr inbounds [3001 x [2 x i32]], ptr @d, i64 0, i64 %300
  %302 = getelementptr inbounds [2 x i32], ptr %301, i64 0, i64 1
  %303 = load i32, ptr %302, align 4, !tbaa !5
  %304 = sub nsw i32 0, %303
  store i32 %304, ptr %34, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %35) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %36) #5
  store i32 -1, ptr %36, align 4, !tbaa !5
  %305 = invoke i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %36, ptr noundef nonnull align 4 dereferenceable(4) %19)
          to label %306 unwind label %310

306:                                              ; preds = %293
  store i64 %305, ptr %35, align 4
  %307 = invoke { i64, i32 } @_ZSt9make_pairIiSt4pairIiiEES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %34, ptr noundef nonnull align 4 dereferenceable(8) %35)
          to label %308 unwind label %310

308:                                              ; preds = %306
  store { i64, i32 } %307, ptr %37, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %33, ptr align 8 %37, i64 12, i1 false)
  invoke void @_ZNSt14priority_queueISt4pairIiS0_IiiEESt6vectorIS2_SaIS2_EESt4lessIS2_EE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(25) %7, ptr noundef nonnull align 4 dereferenceable(12) %33)
          to label %309 unwind label %310

309:                                              ; preds = %308
  call void @llvm.lifetime.end.p0(i64 4, ptr %36) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %35) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %34) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %33) #5
  br label %314

310:                                              ; preds = %308, %306, %293
  %311 = landingpad { ptr, i32 }
          cleanup
  %312 = extractvalue { ptr, i32 } %311, 0
  store ptr %312, ptr %12, align 8
  %313 = extractvalue { ptr, i32 } %311, 1
  store i32 %313, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %36) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %35) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %34) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %33) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #5
  br label %320

314:                                              ; preds = %309, %269
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #5
  br label %315

315:                                              ; preds = %314, %268
  br label %316

316:                                              ; preds = %315, %213
  br label %317

317:                                              ; preds = %316, %156, %126
  %318 = load i32, ptr %19, align 4, !tbaa !5
  %319 = add nsw i32 %318, 1
  store i32 %319, ptr %19, align 4, !tbaa !5
  br label %117, !llvm.loop !16

320:                                              ; preds = %310, %264, %208
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %325

321:                                              ; preds = %121
  store i32 0, ptr %18, align 4
  br label %322

322:                                              ; preds = %321, %97
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %15) #5
  %323 = load i32, ptr %18, align 4
  switch i32 %323, label %363 [
    i32 0, label %324
    i32 5, label %74
  ]

324:                                              ; preds = %322
  br label %74, !llvm.loop !15

325:                                              ; preds = %320, %106
  call void @llvm.lifetime.end.p0(i64 12, ptr %15) #5
  br label %357

326:                                              ; preds = %76
  %327 = load i32, ptr %5, align 4, !tbaa !5
  %328 = sext i32 %327 to i64
  %329 = getelementptr inbounds [3001 x [2 x i32]], ptr @d, i64 0, i64 %328
  %330 = getelementptr inbounds [2 x i32], ptr %329, i64 0, i64 0
  %331 = load i32, ptr %330, align 8, !tbaa !5
  %332 = load i32, ptr @inf, align 4, !tbaa !5
  %333 = icmp eq i32 %331, %332
  br i1 %333, label %334, label %343

334:                                              ; preds = %326
  %335 = load i32, ptr %5, align 4, !tbaa !5
  %336 = sext i32 %335 to i64
  %337 = getelementptr inbounds [3001 x [2 x i32]], ptr @d, i64 0, i64 %336
  %338 = getelementptr inbounds [2 x i32], ptr %337, i64 0, i64 1
  %339 = load i32, ptr %338, align 4, !tbaa !5
  %340 = load i32, ptr @inf, align 4, !tbaa !5
  %341 = icmp eq i32 %339, %340
  br i1 %341, label %342, label %343

342:                                              ; preds = %334
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %18, align 4
  br label %355

343:                                              ; preds = %334, %326
  %344 = load i32, ptr %5, align 4, !tbaa !5
  %345 = sext i32 %344 to i64
  %346 = getelementptr inbounds [3001 x [2 x i32]], ptr @d, i64 0, i64 %345
  %347 = getelementptr inbounds [2 x i32], ptr %346, i64 0, i64 0
  %348 = load i32, ptr %5, align 4, !tbaa !5
  %349 = sext i32 %348 to i64
  %350 = getelementptr inbounds [3001 x [2 x i32]], ptr @d, i64 0, i64 %349
  %351 = getelementptr inbounds [2 x i32], ptr %350, i64 0, i64 1
  %352 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %347, ptr noundef nonnull align 4 dereferenceable(4) %351)
          to label %353 unwind label %102

353:                                              ; preds = %343
  %354 = load i32, ptr %352, align 4, !tbaa !5
  store i32 %354, ptr %3, align 4
  store i32 1, ptr %18, align 4
  br label %355

355:                                              ; preds = %353, %342
  call void @_ZNSt14priority_queueISt4pairIiS0_IiiEESt6vectorIS2_SaIS2_EESt4lessIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %7) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %7) #5
  %356 = load i32, ptr %3, align 4
  ret i32 %356

357:                                              ; preds = %325, %102, %98
  call void @_ZNSt14priority_queueISt4pairIiS0_IiiEESt6vectorIS2_SaIS2_EESt4lessIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %7) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %7) #5
  br label %358

358:                                              ; preds = %357
  %359 = load ptr, ptr %12, align 8
  %360 = load i32, ptr %13, align 4
  %361 = insertvalue { ptr, i32 } poison, ptr %359, 0
  %362 = insertvalue { ptr, i32 } %361, i32 %360, 1
  resume { ptr, i32 } %362

363:                                              ; preds = %322
  unreachable
}

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

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

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = !{!12, !6, i64 8}
!12 = !{!"_ZTSSt4pairIiS_IiiEE", !6, i64 0, !13, i64 4}
!13 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!14 = !{!12, !6, i64 4}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !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<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, %"struct.std::pair.0" }
%"struct.std::pair.0" = type { i32, i32 }

@n = external dso_local local_unnamed_addr global i32, align 4
@g = external dso_local local_unnamed_addr global [3001 x [3001 x [2 x i32]]], align 16
@inf = external dso_local local_unnamed_addr global i32, align 4
@d = external dso_local global [3001 x [2 x i32]], align 16
@v = external dso_local local_unnamed_addr global [3001 x [2 x i32]], align 16

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z2goii(i32 noundef %0, i32 noundef %1) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = alloca %"class.std::priority_queue", align 8
  %5 = alloca %"struct.std::pair", align 8
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::pair.0", align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %"struct.std::pair", align 8
  %11 = alloca i32, align 4
  %12 = alloca %"struct.std::pair.0", align 8
  %13 = alloca i32, align 4
  %14 = alloca %"struct.std::pair", align 8
  %15 = alloca i32, align 4
  %16 = alloca %"struct.std::pair.0", align 8
  %17 = alloca i32, align 4
  %18 = alloca %"struct.std::pair", align 8
  %19 = alloca i32, align 4
  %20 = alloca %"struct.std::pair.0", align 8
  %21 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  %22 = load i32, ptr @n, align 4, !tbaa !5
  %.not70 = icmp slt i32 %22, 1
  br i1 %.not70, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2
  %23 = load i32, ptr @inf, align 4, !tbaa !5
  %24 = zext nneg i32 %22 to i64
  %25 = shl nuw nsw i64 %24, 3
  tail call void @llvm.memset.p0.i64(ptr nonnull align 8 getelementptr inbounds (i8, ptr @v, i64 8), i8 0, i64 %25, i1 false), !tbaa !5
  %26 = add nuw i32 %22, 1
  %wide.trip.count = zext i32 %26 to i64
  %27 = zext nneg i32 %22 to i64
  %min.iters.check = icmp ult i32 %22, 4
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph
  %indvars.iv.ph = phi i64 [ 1, %.lr.ph ], [ %ind.end, %middle.block ]
  br label %scalar.ph

vector.ph:                                        ; preds = %.lr.ph
  %n.vec = and i64 %27, 2147483644
  %ind.end = or disjoint i64 %n.vec, 1
  %broadcast.splatinsert = insertelement <2 x i32> poison, i32 %23, i64 0
  %28 = shufflevector <2 x i32> %broadcast.splatinsert, <2 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %29 = or disjoint i64 %index, 3
  %30 = getelementptr inbounds [3001 x [2 x i32]], ptr @d, i64 0, i64 %offset.idx
  %31 = getelementptr inbounds [3001 x [2 x i32]], ptr @d, i64 0, i64 %29
  store <4 x i32> %28, ptr %30, align 8, !tbaa !5
  store <4 x i32> %28, ptr %31, align 8, !tbaa !5
  %index.next = add nuw i64 %index, 4
  %32 = icmp eq i64 %index.next, %n.vec
  br i1 %32, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %27
  br i1 %cmp.n, label %._crit_edge, label %scalar.ph.preheader

._crit_edge:                                      ; preds = %scalar.ph, %middle.block, %2
  %33 = sext i32 %0 to i64
  %34 = getelementptr inbounds [3001 x [2 x i32]], ptr @d, i64 0, i64 %33
  store i32 0, ptr %34, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #5
  call void @_ZNSt14priority_queueISt4pairIiS0_IiiEESt6vectorIS2_SaIS2_EESt4lessIS2_EEC2IS5_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %4)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #5
  store i32 0, ptr %8, align 4, !tbaa !5
  %35 = invoke i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %3)
          to label %38 unwind label %50

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %36 = getelementptr inbounds [3001 x [2 x i32]], ptr @d, i64 0, i64 %indvars.iv
  %37 = getelementptr inbounds i8, ptr %36, i64 4
  store i32 %23, ptr %37, align 4, !tbaa !5
  store i32 %23, ptr %36, align 8, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %scalar.ph, !llvm.loop !13

38:                                               ; preds = %._crit_edge
  store i64 %35, ptr %7, align 8
  %39 = invoke { i64, i32 } @_ZSt9make_pairIiSt4pairIiiEES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(8) %7)
          to label %40 unwind label %50

40:                                               ; preds = %38
  %.fca.0.extract37 = extractvalue { i64, i32 } %39, 0
  %.fca.1.extract38 = extractvalue { i64, i32 } %39, 1
  store i64 %.fca.0.extract37, ptr %5, align 8
  %.sroa.240.0..sroa_idx = getelementptr inbounds i8, ptr %5, i64 8
  store i32 %.fca.1.extract38, ptr %.sroa.240.0..sroa_idx, align 8
  invoke void @_ZNSt14priority_queueISt4pairIiS0_IiiEESt6vectorIS2_SaIS2_EESt4lessIS2_EE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(25) %4, ptr noundef nonnull align 4 dereferenceable(12) %5)
          to label %.split80 unwind label %50

.split80:                                         ; preds = %40
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #5
  %41 = call noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIiS0_IiiEESt6vectorIS2_SaIS2_EESt4lessIS2_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %4)
  br i1 %41, label %._crit_edge82, label %.lr.ph81

.lr.ph81:                                         ; preds = %.split80
  %.sroa.214.0..sroa_idx = getelementptr inbounds i8, ptr %10, i64 8
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %18, i64 8
  %.sroa.28.0..sroa_idx = getelementptr inbounds i8, ptr %14, i64 8
  br label %42

42:                                               ; preds = %.lr.ph81, %145
  %43 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNKSt14priority_queueISt4pairIiS0_IiiEESt6vectorIS2_SaIS2_EESt4lessIS2_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %4)
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %43, i64 4
  %.sroa.4.0.copyload = load i32, ptr %.sroa.4.0..sroa_idx, align 4
  %.sroa.4.0.copyload.fr = freeze i32 %.sroa.4.0.copyload
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %43, i64 8
  %.sroa.5.0.copyload = load i32, ptr %.sroa.5.0..sroa_idx, align 4
  invoke void @_ZNSt14priority_queueISt4pairIiS0_IiiEESt6vectorIS2_SaIS2_EESt4lessIS2_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %4)
          to label %44 unwind label %52

44:                                               ; preds = %42
  %45 = sub nsw i32 0, %.sroa.4.0.copyload.fr
  %46 = sext i32 %.sroa.5.0.copyload to i64
  %47 = sext i32 %45 to i64
  %48 = getelementptr inbounds [3001 x [2 x i32]], ptr @v, i64 0, i64 %46, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %.not64 = icmp eq i32 %49, 0
  br i1 %.not64, label %54, label %145, !llvm.loop !14

50:                                               ; preds = %40, %38, %._crit_edge
  %51 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #5
  br label %161

52:                                               ; preds = %42
  %53 = landingpad { ptr, i32 }
          cleanup
  br label %161

54:                                               ; preds = %44
  store i32 1, ptr %48, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #5
  store i32 1, ptr %9, align 4, !tbaa !5
  %55 = load i32, ptr @n, align 4, !tbaa !5
  %.not6572 = icmp slt i32 %55, 1
  br i1 %.not6572, label %._crit_edge76, label %.lr.ph75

.lr.ph75:                                         ; preds = %54
  %.not = icmp eq i32 %.sroa.4.0.copyload.fr, 0
  %56 = getelementptr inbounds [3001 x [2 x i32]], ptr @d, i64 0, i64 %46, i64 %47
  br i1 %.not, label %.lr.ph75.split, label %.lr.ph75.split.us

.lr.ph75.split.us:                                ; preds = %.lr.ph75, %86
  %57 = phi i32 [ %87, %86 ], [ %55, %.lr.ph75 ]
  %58 = phi i32 [ %89, %86 ], [ 1, %.lr.ph75 ]
  %59 = icmp eq i32 %58, %.sroa.5.0.copyload
  br i1 %59, label %86, label %60

60:                                               ; preds = %.lr.ph75.split.us
  %61 = sext i32 %58 to i64
  %62 = getelementptr inbounds [3001 x [3001 x [2 x i32]]], ptr @g, i64 0, i64 %46, i64 %61
  %63 = load i32, ptr %62, align 8, !tbaa !5
  %64 = load i32, ptr @inf, align 4, !tbaa !5
  %65 = icmp eq i32 %63, %64
  br i1 %65, label %66, label %70

66:                                               ; preds = %60
  %67 = getelementptr inbounds i8, ptr %62, i64 4
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = icmp eq i32 %68, %63
  br i1 %69, label %86, label %70

70:                                               ; preds = %66, %60
  %71 = getelementptr inbounds [3001 x [2 x i32]], ptr @v, i64 0, i64 %61, i64 1
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %.not66.us = icmp eq i32 %72, 0
  br i1 %.not66.us, label %73, label %86

73:                                               ; preds = %70
  %74 = load i32, ptr %56, align 4, !tbaa !5
  %75 = add nsw i32 %63, %74
  %76 = getelementptr inbounds [3001 x [2 x i32]], ptr @d, i64 0, i64 %61, i64 1
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = icmp slt i32 %75, %77
  br i1 %78, label %79, label %86

79:                                               ; preds = %73
  store i32 %75, ptr %76, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %14) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %15) #5
  %80 = sub nsw i32 0, %75
  store i32 %80, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %16) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %17) #5
  store i32 -1, ptr %17, align 4, !tbaa !5
  %81 = invoke i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %17, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %82 unwind label %.split78.us

82:                                               ; preds = %79
  store i64 %81, ptr %16, align 8
  %83 = invoke { i64, i32 } @_ZSt9make_pairIiSt4pairIiiEES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %15, ptr noundef nonnull align 4 dereferenceable(8) %16)
          to label %84 unwind label %.split78.us

84:                                               ; preds = %82
  %.fca.0.extract5.us = extractvalue { i64, i32 } %83, 0
  %.fca.1.extract6.us = extractvalue { i64, i32 } %83, 1
  store i64 %.fca.0.extract5.us, ptr %14, align 8
  store i32 %.fca.1.extract6.us, ptr %.sroa.28.0..sroa_idx, align 8
  invoke void @_ZNSt14priority_queueISt4pairIiS0_IiiEESt6vectorIS2_SaIS2_EESt4lessIS2_EE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(25) %4, ptr noundef nonnull align 4 dereferenceable(12) %14)
          to label %85 unwind label %.split78.us

85:                                               ; preds = %84
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %15) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %14) #5
  %.pre = load i32, ptr %9, align 4, !tbaa !5
  %.pre86 = load i32, ptr @n, align 4, !tbaa !5
  br label %86

86:                                               ; preds = %85, %73, %70, %66, %.lr.ph75.split.us
  %87 = phi i32 [ %.pre86, %85 ], [ %57, %73 ], [ %57, %70 ], [ %57, %66 ], [ %57, %.lr.ph75.split.us ]
  %88 = phi i32 [ %.pre, %85 ], [ %58, %73 ], [ %58, %70 ], [ %58, %66 ], [ %.sroa.5.0.copyload, %.lr.ph75.split.us ]
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %9, align 4, !tbaa !5
  %.not65.us.not = icmp slt i32 %88, %87
  br i1 %.not65.us.not, label %.lr.ph75.split.us, label %._crit_edge76, !llvm.loop !15

.split78.us:                                      ; preds = %84, %82, %79
  %90 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %15) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %14) #5
  br label %144

._crit_edge76:                                    ; preds = %86, %140, %54
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #5
  br label %145

.lr.ph75.split:                                   ; preds = %.lr.ph75, %140
  %storemerge73 = phi i32 [ %142, %140 ], [ 1, %.lr.ph75 ]
  %91 = icmp eq i32 %storemerge73, %.sroa.5.0.copyload
  br i1 %91, label %140, label %92

92:                                               ; preds = %.lr.ph75.split
  %93 = sext i32 %storemerge73 to i64
  %94 = getelementptr inbounds [3001 x [3001 x [2 x i32]]], ptr @g, i64 0, i64 %46, i64 %93
  %95 = load i32, ptr %94, align 8, !tbaa !5
  %96 = load i32, ptr @inf, align 4, !tbaa !5
  %97 = icmp eq i32 %95, %96
  br i1 %97, label %98, label %102

98:                                               ; preds = %92
  %99 = getelementptr inbounds i8, ptr %94, i64 4
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = icmp eq i32 %100, %95
  br i1 %101, label %140, label %102

102:                                              ; preds = %98, %92
  %103 = getelementptr inbounds [3001 x [2 x i32]], ptr @v, i64 0, i64 %93
  %104 = load i32, ptr %103, align 8, !tbaa !5
  %.not83 = icmp eq i32 %104, 0
  br i1 %.not83, label %105, label %119

105:                                              ; preds = %102
  %106 = load i32, ptr %56, align 4, !tbaa !5
  %107 = add nsw i32 %106, %95
  %108 = getelementptr inbounds [3001 x [2 x i32]], ptr @d, i64 0, i64 %93
  %109 = load i32, ptr %108, align 8, !tbaa !5
  %110 = icmp slt i32 %107, %109
  br i1 %110, label %111, label %119

111:                                              ; preds = %105
  store i32 %107, ptr %108, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %10) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #5
  %112 = sub nsw i32 0, %107
  store i32 %112, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %13) #5
  store i32 0, ptr %13, align 4, !tbaa !5
  %113 = invoke i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %13, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %114 unwind label %.split

114:                                              ; preds = %111
  store i64 %113, ptr %12, align 8
  %115 = invoke { i64, i32 } @_ZSt9make_pairIiSt4pairIiiEES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(8) %12)
          to label %116 unwind label %.split

116:                                              ; preds = %114
  %.fca.0.extract11 = extractvalue { i64, i32 } %115, 0
  %.fca.1.extract12 = extractvalue { i64, i32 } %115, 1
  store i64 %.fca.0.extract11, ptr %10, align 8
  store i32 %.fca.1.extract12, ptr %.sroa.214.0..sroa_idx, align 8
  invoke void @_ZNSt14priority_queueISt4pairIiS0_IiiEESt6vectorIS2_SaIS2_EESt4lessIS2_EE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(25) %4, ptr noundef nonnull align 4 dereferenceable(12) %10)
          to label %117 unwind label %.split

117:                                              ; preds = %116
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %10) #5
  %.pre87 = load i32, ptr %9, align 4, !tbaa !5
  %.pre89 = sext i32 %.pre87 to i64
  br label %119

.split:                                           ; preds = %116, %114, %111
  %118 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %10) #5
  br label %144

119:                                              ; preds = %105, %117, %102
  %.pre-phi = phi i64 [ %93, %105 ], [ %.pre89, %117 ], [ %93, %102 ]
  %120 = phi i32 [ %storemerge73, %105 ], [ %.pre87, %117 ], [ %storemerge73, %102 ]
  %121 = getelementptr inbounds [3001 x [2 x i32]], ptr @v, i64 0, i64 %.pre-phi, i64 1
  %122 = load i32, ptr %121, align 4, !tbaa !5
  %.not66 = icmp eq i32 %122, 0
  br i1 %.not66, label %123, label %140

123:                                              ; preds = %119
  %124 = load i32, ptr %56, align 4, !tbaa !5
  %125 = getelementptr inbounds [3001 x [3001 x [2 x i32]]], ptr @g, i64 0, i64 %46, i64 %.pre-phi, i64 1
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = add nsw i32 %126, %124
  %128 = getelementptr inbounds [3001 x [2 x i32]], ptr @d, i64 0, i64 %.pre-phi, i64 1
  %129 = load i32, ptr %128, align 4, !tbaa !5
  %130 = icmp slt i32 %127, %129
  br i1 %130, label %131, label %140

131:                                              ; preds = %123
  store i32 %127, ptr %128, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %18) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %19) #5
  %132 = sub nsw i32 0, %127
  store i32 %132, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %20) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %21) #5
  store i32 -1, ptr %21, align 4, !tbaa !5
  %133 = invoke i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %21, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %134 unwind label %138

134:                                              ; preds = %131
  store i64 %133, ptr %20, align 8
  %135 = invoke { i64, i32 } @_ZSt9make_pairIiSt4pairIiiEES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %19, ptr noundef nonnull align 4 dereferenceable(8) %20)
          to label %136 unwind label %138

136:                                              ; preds = %134
  %.fca.0.extract = extractvalue { i64, i32 } %135, 0
  %.fca.1.extract = extractvalue { i64, i32 } %135, 1
  store i64 %.fca.0.extract, ptr %18, align 8
  store i32 %.fca.1.extract, ptr %.sroa.2.0..sroa_idx, align 8
  invoke void @_ZNSt14priority_queueISt4pairIiS0_IiiEESt6vectorIS2_SaIS2_EESt4lessIS2_EE4pushEOS2_(ptr noundef nonnull align 8 dereferenceable(25) %4, ptr noundef nonnull align 4 dereferenceable(12) %18)
          to label %137 unwind label %138

137:                                              ; preds = %136
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %21) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %20) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %19) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %18) #5
  %.pre88 = load i32, ptr %9, align 4, !tbaa !5
  br label %140

138:                                              ; preds = %136, %134, %131
  %139 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %21) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %20) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %19) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %18) #5
  br label %144

140:                                              ; preds = %123, %137, %119, %98, %.lr.ph75.split
  %141 = phi i32 [ %120, %123 ], [ %.pre88, %137 ], [ %120, %119 ], [ %storemerge73, %98 ], [ %.sroa.5.0.copyload, %.lr.ph75.split ]
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %9, align 4, !tbaa !5
  %143 = load i32, ptr @n, align 4, !tbaa !5
  %.not65.not = icmp slt i32 %141, %143
  br i1 %.not65.not, label %.lr.ph75.split, label %._crit_edge76, !llvm.loop !15

144:                                              ; preds = %138, %.split78.us, %.split
  %.pn = phi { ptr, i32 } [ %90, %.split78.us ], [ %139, %138 ], [ %118, %.split ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #5
  br label %161

145:                                              ; preds = %44, %._crit_edge76
  %146 = call noundef zeroext i1 @_ZNKSt14priority_queueISt4pairIiS0_IiiEESt6vectorIS2_SaIS2_EESt4lessIS2_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %4)
  br i1 %146, label %._crit_edge82, label %42

._crit_edge82:                                    ; preds = %145, %.split80
  %147 = sext i32 %1 to i64
  %148 = getelementptr inbounds [3001 x [2 x i32]], ptr @d, i64 0, i64 %147
  %149 = load i32, ptr %148, align 8, !tbaa !5
  %150 = load i32, ptr @inf, align 4, !tbaa !5
  %151 = icmp eq i32 %149, %150
  br i1 %151, label %152, label %156

152:                                              ; preds = %._crit_edge82
  %153 = getelementptr inbounds i8, ptr %148, i64 4
  %154 = load i32, ptr %153, align 4, !tbaa !5
  %155 = icmp eq i32 %154, %149
  br i1 %155, label %160, label %156

156:                                              ; preds = %152, %._crit_edge82
  %157 = getelementptr inbounds i8, ptr %148, i64 4
  %158 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %148, ptr noundef nonnull align 4 dereferenceable(4) %157)
  %159 = load i32, ptr %158, align 4, !tbaa !5
  br label %160

160:                                              ; preds = %152, %156
  %.0 = phi i32 [ %159, %156 ], [ -1, %152 ]
  call void @_ZNSt14priority_queueISt4pairIiS0_IiiEESt6vectorIS2_SaIS2_EESt4lessIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %4) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #5
  ret i32 %.0

161:                                              ; preds = %52, %144, %50
  %.pn.pn.pn = phi { ptr, i32 } [ %51, %50 ], [ %.pn, %144 ], [ %53, %52 ]
  call void @_ZNSt14priority_queueISt4pairIiS0_IiiEESt6vectorIS2_SaIS2_EESt4lessIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %4) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #5
  resume { ptr, i32 } %.pn.pn.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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt14priority_queueISt4pairIiS0_IiiEESt6vectorIS2_SaIS2_EESt4lessIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #3 align 2

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}


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