; LLVM IR from upupming/algorithm :: acwing/算法竞赛进阶指南/0x51-线性DP/277. 饼干 (main)

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

%struct.P = type { i32, i32, i32 }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%class.anon = type { i8 }

@p = external dso_local global [40 x %struct.P], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@ans = external dso_local global [40 x i32], align 16
@f = external dso_local global [40 x [5010 x i64]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %class.anon, align 1
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %17 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef nonnull align 4 dereferenceable(4) @m)
  call void @llvm.memset.p0.i64(ptr align 16 @f, i8 63, i64 1603200, i1 false)
  store i64 0, ptr @f, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 1, ptr %2, align 4, !tbaa !9
  br label %18

18:                                               ; preds = %34, %0
  %19 = load i32, ptr %2, align 4, !tbaa !9
  %20 = load i32, ptr @n, align 4, !tbaa !9
  %21 = icmp sle i32 %19, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %37

23:                                               ; preds = %18
  %24 = load i32, ptr %2, align 4, !tbaa !9
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [40 x %struct.P], ptr @p, i64 0, i64 %25
  %27 = getelementptr inbounds %struct.P, ptr %26, i32 0, i32 0
  %28 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %27)
  %29 = load i32, ptr %2, align 4, !tbaa !9
  %30 = load i32, ptr %2, align 4, !tbaa !9
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [40 x %struct.P], ptr @p, i64 0, i64 %31
  %33 = getelementptr inbounds %struct.P, ptr %32, i32 0, i32 1
  store i32 %29, ptr %33, align 4, !tbaa !11
  br label %34

34:                                               ; preds = %23
  %35 = load i32, ptr %2, align 4, !tbaa !9
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %2, align 4, !tbaa !9
  br label %18, !llvm.loop !13

37:                                               ; preds = %22
  %38 = load i32, ptr @n, align 4, !tbaa !9
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds %struct.P, ptr getelementptr inbounds (%struct.P, ptr @p, i64 1), i64 %39
  call void @"_ZSt4sortIP1PZ4mainE3$_0EvT_S3_T0_"(ptr noundef getelementptr inbounds (%struct.P, ptr @p, i64 1), ptr noundef %40)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 1, ptr %4, align 4, !tbaa !9
  br label %41

41:                                               ; preds = %63, %37
  %42 = load i32, ptr %4, align 4, !tbaa !9
  %43 = load i32, ptr @n, align 4, !tbaa !9
  %44 = icmp sle i32 %42, %43
  br i1 %44, label %46, label %45

45:                                               ; preds = %41
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %66

46:                                               ; preds = %41
  %47 = load i32, ptr %4, align 4, !tbaa !9
  %48 = sub nsw i32 %47, 1
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [40 x %struct.P], ptr @p, i64 0, i64 %49
  %51 = getelementptr inbounds %struct.P, ptr %50, i32 0, i32 2
  %52 = load i32, ptr %51, align 4, !tbaa !15
  %53 = load i32, ptr %4, align 4, !tbaa !9
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [40 x %struct.P], ptr @p, i64 0, i64 %54
  %56 = getelementptr inbounds %struct.P, ptr %55, i32 0, i32 0
  %57 = load i32, ptr %56, align 4, !tbaa !16
  %58 = add nsw i32 %52, %57
  %59 = load i32, ptr %4, align 4, !tbaa !9
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [40 x %struct.P], ptr @p, i64 0, i64 %60
  %62 = getelementptr inbounds %struct.P, ptr %61, i32 0, i32 2
  store i32 %58, ptr %62, align 4, !tbaa !15
  br label %63

63:                                               ; preds = %46
  %64 = load i32, ptr %4, align 4, !tbaa !9
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %4, align 4, !tbaa !9
  br label %41, !llvm.loop !17

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

67:                                               ; preds = %149, %66
  %68 = load i32, ptr %5, align 4, !tbaa !9
  %69 = load i32, ptr @n, align 4, !tbaa !9
  %70 = icmp sle i32 %68, %69
  br i1 %70, label %72, label %71

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

72:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %73 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %73, ptr %7, align 4, !tbaa !9
  br label %74

74:                                               ; preds = %145, %72
  %75 = load i32, ptr %7, align 4, !tbaa !9
  %76 = load i32, ptr @m, align 4, !tbaa !9
  %77 = icmp sle i32 %75, %76
  br i1 %77, label %79, label %78

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

79:                                               ; preds = %74
  %80 = load i32, ptr %5, align 4, !tbaa !9
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [40 x [5010 x i64]], ptr @f, i64 0, i64 %81
  %83 = load i32, ptr %7, align 4, !tbaa !9
  %84 = load i32, ptr %5, align 4, !tbaa !9
  %85 = sub nsw i32 %83, %84
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [5010 x i64], ptr %82, i64 0, i64 %86
  %88 = load i64, ptr %87, align 8, !tbaa !5
  %89 = load i32, ptr %5, align 4, !tbaa !9
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [40 x [5010 x i64]], ptr @f, i64 0, i64 %90
  %92 = load i32, ptr %7, align 4, !tbaa !9
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [5010 x i64], ptr %91, i64 0, i64 %93
  store i64 %88, ptr %94, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %95

95:                                               ; preds = %141, %79
  %96 = load i32, ptr %8, align 4, !tbaa !9
  %97 = load i32, ptr %5, align 4, !tbaa !9
  %98 = icmp slt i32 %96, %97
  br i1 %98, label %100, label %99

99:                                               ; preds = %95
  store i32 14, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %144

100:                                              ; preds = %95
  %101 = load i32, ptr %5, align 4, !tbaa !9
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [40 x [5010 x i64]], ptr @f, i64 0, i64 %102
  %104 = load i32, ptr %7, align 4, !tbaa !9
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [5010 x i64], ptr %103, i64 0, i64 %105
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %107 = load i32, ptr %8, align 4, !tbaa !9
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [40 x [5010 x i64]], ptr @f, i64 0, i64 %108
  %110 = load i32, ptr %7, align 4, !tbaa !9
  %111 = load i32, ptr %5, align 4, !tbaa !9
  %112 = load i32, ptr %8, align 4, !tbaa !9
  %113 = sub nsw i32 %111, %112
  %114 = sub nsw i32 %110, %113
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [5010 x i64], ptr %109, i64 0, i64 %115
  %117 = load i64, ptr %116, align 8, !tbaa !5
  %118 = load i32, ptr %8, align 4, !tbaa !9
  %119 = load i32, ptr %5, align 4, !tbaa !9
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [40 x %struct.P], ptr @p, i64 0, i64 %120
  %122 = getelementptr inbounds %struct.P, ptr %121, i32 0, i32 2
  %123 = load i32, ptr %122, align 4, !tbaa !15
  %124 = load i32, ptr %8, align 4, !tbaa !9
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [40 x %struct.P], ptr @p, i64 0, i64 %125
  %127 = getelementptr inbounds %struct.P, ptr %126, i32 0, i32 2
  %128 = load i32, ptr %127, align 4, !tbaa !15
  %129 = sub nsw i32 %123, %128
  %130 = mul nsw i32 %118, %129
  %131 = sext i32 %130 to i64
  %132 = add nsw i64 %117, %131
  store i64 %132, ptr %9, align 8, !tbaa !5
  %133 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %106, ptr noundef nonnull align 8 dereferenceable(8) %9)
  %134 = load i64, ptr %133, align 8, !tbaa !5
  %135 = load i32, ptr %5, align 4, !tbaa !9
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [40 x [5010 x i64]], ptr @f, i64 0, i64 %136
  %138 = load i32, ptr %7, align 4, !tbaa !9
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [5010 x i64], ptr %137, i64 0, i64 %139
  store i64 %134, ptr %140, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  br label %141

141:                                              ; preds = %100
  %142 = load i32, ptr %8, align 4, !tbaa !9
  %143 = add nsw i32 %142, 1
  store i32 %143, ptr %8, align 4, !tbaa !9
  br label %95, !llvm.loop !18

144:                                              ; preds = %99
  br label %145

145:                                              ; preds = %144
  %146 = load i32, ptr %7, align 4, !tbaa !9
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %7, align 4, !tbaa !9
  br label %74, !llvm.loop !19

148:                                              ; preds = %78
  br label %149

149:                                              ; preds = %148
  %150 = load i32, ptr %5, align 4, !tbaa !9
  %151 = add nsw i32 %150, 1
  store i32 %151, ptr %5, align 4, !tbaa !9
  br label %67, !llvm.loop !20

152:                                              ; preds = %71
  %153 = load i32, ptr @n, align 4, !tbaa !9
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [40 x [5010 x i64]], ptr @f, i64 0, i64 %154
  %156 = load i32, ptr @m, align 4, !tbaa !9
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [5010 x i64], ptr %155, i64 0, i64 %157
  %159 = load i64, ptr %158, align 8, !tbaa !5
  %160 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %159)
  %161 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %160, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %162 = load i32, ptr @n, align 4, !tbaa !9
  store i32 %162, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %163 = load i32, ptr @m, align 4, !tbaa !9
  store i32 %163, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %164

164:                                              ; preds = %274, %152
  %165 = load i32, ptr %10, align 4, !tbaa !9
  %166 = icmp ne i32 %165, 0
  br i1 %166, label %167, label %170

167:                                              ; preds = %164
  %168 = load i32, ptr %11, align 4, !tbaa !9
  %169 = icmp ne i32 %168, 0
  br label %170

170:                                              ; preds = %167, %164
  %171 = phi i1 [ false, %164 ], [ %169, %167 ]
  br i1 %171, label %172, label %275

172:                                              ; preds = %170
  %173 = load i32, ptr %11, align 4, !tbaa !9
  %174 = load i32, ptr %10, align 4, !tbaa !9
  %175 = icmp sge i32 %173, %174
  br i1 %175, label %176, label %200

176:                                              ; preds = %172
  %177 = load i32, ptr %10, align 4, !tbaa !9
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [40 x [5010 x i64]], ptr @f, i64 0, i64 %178
  %180 = load i32, ptr %11, align 4, !tbaa !9
  %181 = sext i32 %180 to i64
  %182 = getelementptr inbounds [5010 x i64], ptr %179, i64 0, i64 %181
  %183 = load i64, ptr %182, align 8, !tbaa !5
  %184 = load i32, ptr %10, align 4, !tbaa !9
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [40 x [5010 x i64]], ptr @f, i64 0, i64 %185
  %187 = load i32, ptr %11, align 4, !tbaa !9
  %188 = load i32, ptr %10, align 4, !tbaa !9
  %189 = sub nsw i32 %187, %188
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds [5010 x i64], ptr %186, i64 0, i64 %190
  %192 = load i64, ptr %191, align 8, !tbaa !5
  %193 = icmp eq i64 %183, %192
  br i1 %193, label %194, label %200

194:                                              ; preds = %176
  %195 = load i32, ptr %10, align 4, !tbaa !9
  %196 = load i32, ptr %11, align 4, !tbaa !9
  %197 = sub nsw i32 %196, %195
  store i32 %197, ptr %11, align 4, !tbaa !9
  %198 = load i32, ptr %12, align 4, !tbaa !9
  %199 = add nsw i32 %198, 1
  store i32 %199, ptr %12, align 4, !tbaa !9
  br label %274

200:                                              ; preds = %176, %172
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %201

201:                                              ; preds = %269, %200
  %202 = load i32, ptr %13, align 4, !tbaa !9
  %203 = load i32, ptr %10, align 4, !tbaa !9
  %204 = icmp slt i32 %202, %203
  br i1 %204, label %206, label %205

205:                                              ; preds = %201
  store i32 19, ptr %6, align 4
  br label %272

206:                                              ; preds = %201
  %207 = load i32, ptr %10, align 4, !tbaa !9
  %208 = sext i32 %207 to i64
  %209 = getelementptr inbounds [40 x [5010 x i64]], ptr @f, i64 0, i64 %208
  %210 = load i32, ptr %11, align 4, !tbaa !9
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [5010 x i64], ptr %209, i64 0, i64 %211
  %213 = load i64, ptr %212, align 8, !tbaa !5
  %214 = load i32, ptr %13, align 4, !tbaa !9
  %215 = sext i32 %214 to i64
  %216 = getelementptr inbounds [40 x [5010 x i64]], ptr @f, i64 0, i64 %215
  %217 = load i32, ptr %11, align 4, !tbaa !9
  %218 = load i32, ptr %10, align 4, !tbaa !9
  %219 = load i32, ptr %13, align 4, !tbaa !9
  %220 = sub nsw i32 %218, %219
  %221 = sub nsw i32 %217, %220
  %222 = sext i32 %221 to i64
  %223 = getelementptr inbounds [5010 x i64], ptr %216, i64 0, i64 %222
  %224 = load i64, ptr %223, align 8, !tbaa !5
  %225 = load i32, ptr %13, align 4, !tbaa !9
  %226 = load i32, ptr %10, align 4, !tbaa !9
  %227 = sext i32 %226 to i64
  %228 = getelementptr inbounds [40 x %struct.P], ptr @p, i64 0, i64 %227
  %229 = getelementptr inbounds %struct.P, ptr %228, i32 0, i32 2
  %230 = load i32, ptr %229, align 4, !tbaa !15
  %231 = load i32, ptr %13, align 4, !tbaa !9
  %232 = sext i32 %231 to i64
  %233 = getelementptr inbounds [40 x %struct.P], ptr @p, i64 0, i64 %232
  %234 = getelementptr inbounds %struct.P, ptr %233, i32 0, i32 2
  %235 = load i32, ptr %234, align 4, !tbaa !15
  %236 = sub nsw i32 %230, %235
  %237 = mul nsw i32 %225, %236
  %238 = sext i32 %237 to i64
  %239 = add nsw i64 %224, %238
  %240 = icmp eq i64 %213, %239
  br i1 %240, label %241, label %268

241:                                              ; preds = %206
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %242 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %242, ptr %14, align 4, !tbaa !9
  br label %243

243:                                              ; preds = %258, %241
  %244 = load i32, ptr %14, align 4, !tbaa !9
  %245 = load i32, ptr %13, align 4, !tbaa !9
  %246 = icmp sgt i32 %244, %245
  br i1 %246, label %248, label %247

247:                                              ; preds = %243
  store i32 22, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %261

248:                                              ; preds = %243
  %249 = load i32, ptr %12, align 4, !tbaa !9
  %250 = add nsw i32 1, %249
  %251 = load i32, ptr %14, align 4, !tbaa !9
  %252 = sext i32 %251 to i64
  %253 = getelementptr inbounds [40 x %struct.P], ptr @p, i64 0, i64 %252
  %254 = getelementptr inbounds %struct.P, ptr %253, i32 0, i32 1
  %255 = load i32, ptr %254, align 4, !tbaa !11
  %256 = sext i32 %255 to i64
  %257 = getelementptr inbounds [40 x i32], ptr @ans, i64 0, i64 %256
  store i32 %250, ptr %257, align 4, !tbaa !9
  br label %258

258:                                              ; preds = %248
  %259 = load i32, ptr %14, align 4, !tbaa !9
  %260 = add nsw i32 %259, -1
  store i32 %260, ptr %14, align 4, !tbaa !9
  br label %243, !llvm.loop !21

261:                                              ; preds = %247
  %262 = load i32, ptr %11, align 4, !tbaa !9
  %263 = load i32, ptr %10, align 4, !tbaa !9
  %264 = load i32, ptr %13, align 4, !tbaa !9
  %265 = sub nsw i32 %263, %264
  %266 = sub nsw i32 %262, %265
  store i32 %266, ptr %11, align 4, !tbaa !9
  %267 = load i32, ptr %13, align 4, !tbaa !9
  store i32 %267, ptr %10, align 4, !tbaa !9
  store i32 19, ptr %6, align 4
  br label %272

268:                                              ; preds = %206
  br label %269

269:                                              ; preds = %268
  %270 = load i32, ptr %13, align 4, !tbaa !9
  %271 = add nsw i32 %270, 1
  store i32 %271, ptr %13, align 4, !tbaa !9
  br label %201, !llvm.loop !22

272:                                              ; preds = %261, %205
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %273

273:                                              ; preds = %272
  br label %274

274:                                              ; preds = %273, %194
  br label %164, !llvm.loop !23

275:                                              ; preds = %170
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  store i32 1, ptr %15, align 4, !tbaa !9
  br label %276

276:                                              ; preds = %288, %275
  %277 = load i32, ptr %15, align 4, !tbaa !9
  %278 = load i32, ptr @n, align 4, !tbaa !9
  %279 = icmp sle i32 %277, %278
  br i1 %279, label %281, label %280

280:                                              ; preds = %276
  store i32 25, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %291

281:                                              ; preds = %276
  %282 = load i32, ptr %15, align 4, !tbaa !9
  %283 = sext i32 %282 to i64
  %284 = getelementptr inbounds [40 x i32], ptr @ans, i64 0, i64 %283
  %285 = load i32, ptr %284, align 4, !tbaa !9
  %286 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %285)
  %287 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %286, ptr noundef @.str)
  br label %288

288:                                              ; preds = %281
  %289 = load i32, ptr %15, align 4, !tbaa !9
  %290 = add nsw i32 %289, 1
  store i32 %290, ptr %15, align 4, !tbaa !9
  br label %276, !llvm.loop !24

291:                                              ; preds = %280
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  %292 = load i32, ptr %1, align 4
  ret i32 %292
}

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIP1PZ4mainE3$_0EvT_S3_T0_"(ptr noundef, ptr noundef) #4

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #6 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #6 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #4

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

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

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

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

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


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

%struct.P = type { i32, i32, i32 }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@p = external dso_local global [40 x %struct.P], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@ans = external dso_local local_unnamed_addr global [40 x i32], align 16
@f = external dso_local global [40 x [5010 x i64]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i64, align 8
  %2 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %3 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(4) @m)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1603200) @f, i8 63, i64 1603200, i1 false)
  store i64 0, ptr @f, align 16, !tbaa !5
  %4 = load i32, ptr @n, align 4, !tbaa !9
  %.not100 = icmp slt i32 %4, 1
  br i1 %.not100, label %.._crit_edge_crit_edge, label %.lr.ph

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre = sext i32 %4 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.._crit_edge_crit_edge ], [ %14, %.lr.ph ]
  %5 = getelementptr inbounds %struct.P, ptr getelementptr inbounds (i8, ptr @p, i64 12), i64 %.pre-phi
  tail call void @"_ZSt4sortIP1PZ4mainE3$_0EvT_S3_T0_"(ptr noundef nonnull getelementptr inbounds (i8, ptr @p, i64 12), ptr noundef nonnull %5)
  %6 = load i32, ptr @n, align 4, !tbaa !9
  %.not87102 = icmp slt i32 %6, 1
  br i1 %.not87102, label %.preheader96.thread, label %.lr.ph105.preheader

.preheader96.thread:                              ; preds = %._crit_edge
  %.pre163167 = load i32, ptr @m, align 4, !tbaa !9
  br label %.preheader96.._crit_edge113_crit_edge

.lr.ph105.preheader:                              ; preds = %._crit_edge
  %7 = zext nneg i32 %6 to i64
  %xtraiter = and i64 %7, 1
  %8 = icmp eq i32 %6, 1
  br i1 %8, label %.preheader96.unr-lcssa, label %.lr.ph105.preheader.new

.lr.ph105.preheader.new:                          ; preds = %.lr.ph105.preheader
  %unroll_iter = and i64 %7, 2147483646
  br label %.lr.ph105

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %9 = getelementptr inbounds [40 x %struct.P], ptr @p, i64 0, i64 %indvars.iv
  %10 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %11 = getelementptr inbounds i8, ptr %9, i64 4
  %12 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %12, ptr %11, align 4, !tbaa !11
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %13 = load i32, ptr @n, align 4, !tbaa !9
  %14 = sext i32 %13 to i64
  %.not.not = icmp slt i64 %indvars.iv, %14
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !13

.preheader96.unr-lcssa:                           ; preds = %.lr.ph105, %.lr.ph105.preheader
  %indvars.iv135.unr = phi i64 [ 1, %.lr.ph105.preheader ], [ %indvars.iv.next136.1, %.lr.ph105 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader96, label %.lr.ph105.epil

.lr.ph105.epil:                                   ; preds = %.preheader96.unr-lcssa
  %15 = add nsw i64 %indvars.iv135.unr, -1
  %16 = getelementptr inbounds [40 x %struct.P], ptr @p, i64 0, i64 %15, i32 2
  %17 = load i32, ptr %16, align 4, !tbaa !15
  %18 = getelementptr inbounds [40 x %struct.P], ptr @p, i64 0, i64 %indvars.iv135.unr
  %19 = load i32, ptr %18, align 4, !tbaa !16
  %20 = add nsw i32 %19, %17
  %21 = getelementptr inbounds i8, ptr %18, i64 8
  store i32 %20, ptr %21, align 4, !tbaa !15
  br label %.preheader96

.preheader96:                                     ; preds = %.preheader96.unr-lcssa, %.lr.ph105.epil
  %.pre163 = load i32, ptr @m, align 4, !tbaa !9
  br i1 %.not87102, label %.preheader96.._crit_edge113_crit_edge, label %.preheader95

.preheader96.._crit_edge113_crit_edge:            ; preds = %.preheader96.thread, %.preheader96
  %.pre163168 = phi i32 [ %.pre163167, %.preheader96.thread ], [ %.pre163, %.preheader96 ]
  %.pre164 = sext i32 %6 to i64
  br label %._crit_edge113

.lr.ph105:                                        ; preds = %.lr.ph105, %.lr.ph105.preheader.new
  %indvars.iv135 = phi i64 [ 1, %.lr.ph105.preheader.new ], [ %indvars.iv.next136.1, %.lr.ph105 ]
  %niter = phi i64 [ 0, %.lr.ph105.preheader.new ], [ %niter.next.1, %.lr.ph105 ]
  %22 = add nsw i64 %indvars.iv135, -1
  %23 = getelementptr inbounds [40 x %struct.P], ptr @p, i64 0, i64 %22, i32 2
  %24 = load i32, ptr %23, align 4, !tbaa !15
  %25 = getelementptr inbounds [40 x %struct.P], ptr @p, i64 0, i64 %indvars.iv135
  %26 = load i32, ptr %25, align 4, !tbaa !16
  %27 = add nsw i32 %26, %24
  %28 = getelementptr inbounds i8, ptr %25, i64 8
  store i32 %27, ptr %28, align 4, !tbaa !15
  %indvars.iv.next136 = add nuw nsw i64 %indvars.iv135, 1
  %29 = getelementptr inbounds [40 x %struct.P], ptr @p, i64 0, i64 %indvars.iv135, i32 2
  %30 = load i32, ptr %29, align 4, !tbaa !15
  %31 = getelementptr inbounds [40 x %struct.P], ptr @p, i64 0, i64 %indvars.iv.next136
  %32 = load i32, ptr %31, align 4, !tbaa !16
  %33 = add nsw i32 %32, %30
  %34 = getelementptr inbounds i8, ptr %31, i64 8
  store i32 %33, ptr %34, align 4, !tbaa !15
  %indvars.iv.next136.1 = add nuw nsw i64 %indvars.iv135, 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 %.preheader96.unr-lcssa, label %.lr.ph105, !llvm.loop !17

.preheader95:                                     ; preds = %.preheader96, %._crit_edge110
  %35 = phi i32 [ %50, %._crit_edge110 ], [ %6, %.preheader96 ]
  %36 = phi i32 [ %51, %._crit_edge110 ], [ %.pre163, %.preheader96 ]
  %indvars.iv143 = phi i64 [ %indvars.iv.next144, %._crit_edge110 ], [ 1, %.preheader96 ]
  %37 = sext i32 %36 to i64
  %.not91107 = icmp sgt i64 %indvars.iv143, %37
  br i1 %.not91107, label %._crit_edge110, label %.lr.ph109

.lr.ph109:                                        ; preds = %.preheader95
  %38 = getelementptr inbounds [40 x %struct.P], ptr @p, i64 0, i64 %indvars.iv143, i32 2
  br label %53

._crit_edge113:                                   ; preds = %._crit_edge110, %.preheader96.._crit_edge113_crit_edge
  %.pre-phi165 = phi i64 [ %.pre164, %.preheader96.._crit_edge113_crit_edge ], [ %52, %._crit_edge110 ]
  %39 = phi i32 [ %.pre163168, %.preheader96.._crit_edge113_crit_edge ], [ %51, %._crit_edge110 ]
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [40 x [5010 x i64]], ptr @f, i64 0, i64 %.pre-phi165, i64 %40
  %42 = load i64, ptr %41, align 8, !tbaa !5
  %43 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %42)
  %44 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %43, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %45 = load i32, ptr @n, align 4, !tbaa !9
  %46 = load i32, ptr @m, align 4, !tbaa !9
  %47 = icmp ne i32 %45, 0
  %48 = icmp ne i32 %46, 0
  %49 = select i1 %47, i1 %48, i1 false
  br i1 %49, label %.lr.ph124, label %.preheader

._crit_edge110.loopexit:                          ; preds = %58
  %.pre162 = load i32, ptr @n, align 4, !tbaa !9
  br label %._crit_edge110

._crit_edge110:                                   ; preds = %._crit_edge110.loopexit, %.preheader95
  %50 = phi i32 [ %.pre162, %._crit_edge110.loopexit ], [ %35, %.preheader95 ]
  %51 = phi i32 [ %59, %._crit_edge110.loopexit ], [ %36, %.preheader95 ]
  %indvars.iv.next144 = add nuw nsw i64 %indvars.iv143, 1
  %52 = sext i32 %50 to i64
  %.not88.not = icmp slt i64 %indvars.iv143, %52
  br i1 %.not88.not, label %.preheader95, label %._crit_edge113, !llvm.loop !18

53:                                               ; preds = %.lr.ph109, %58
  %indvars.iv145 = phi i64 [ %indvars.iv143, %.lr.ph109 ], [ %indvars.iv.next146, %58 ]
  %54 = sub nuw nsw i64 %indvars.iv145, %indvars.iv143
  %55 = getelementptr inbounds [40 x [5010 x i64]], ptr @f, i64 0, i64 %indvars.iv143, i64 %54
  %56 = load i64, ptr %55, align 8, !tbaa !5
  %57 = getelementptr inbounds [40 x [5010 x i64]], ptr @f, i64 0, i64 %indvars.iv143, i64 %indvars.iv145
  store i64 %56, ptr %57, align 8, !tbaa !5
  br label %61

58:                                               ; preds = %61
  %indvars.iv.next146 = add nuw nsw i64 %indvars.iv145, 1
  %59 = load i32, ptr @m, align 4, !tbaa !9
  %60 = sext i32 %59 to i64
  %.not91.not = icmp slt i64 %indvars.iv145, %60
  br i1 %.not91.not, label %53, label %._crit_edge110.loopexit, !llvm.loop !19

61:                                               ; preds = %53, %61
  %indvars.iv138 = phi i64 [ 0, %53 ], [ %indvars.iv.next139, %61 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  %62 = add nuw nsw i64 %54, %indvars.iv138
  %sext = shl i64 %62, 32
  %63 = ashr exact i64 %sext, 32
  %64 = getelementptr inbounds [40 x [5010 x i64]], ptr @f, i64 0, i64 %indvars.iv138, i64 %63
  %65 = load i64, ptr %64, align 8, !tbaa !5
  %66 = load i32, ptr %38, align 4, !tbaa !15
  %67 = getelementptr inbounds [40 x %struct.P], ptr @p, i64 0, i64 %indvars.iv138, i32 2
  %68 = load i32, ptr %67, align 4, !tbaa !15
  %69 = sub nsw i32 %66, %68
  %70 = sext i32 %69 to i64
  %71 = mul nsw i64 %indvars.iv138, %70
  %72 = add nsw i64 %65, %71
  store i64 %72, ptr %1, align 8, !tbaa !5
  %73 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %57, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %74 = load i64, ptr %73, align 8, !tbaa !5
  store i64 %74, ptr %57, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  %indvars.iv.next139 = add nuw nsw i64 %indvars.iv138, 1
  %exitcond142.not = icmp eq i64 %indvars.iv.next139, %indvars.iv143
  br i1 %exitcond142.not, label %58, label %61, !llvm.loop !20

.preheader:                                       ; preds = %.loopexit, %._crit_edge113
  %.not89125 = icmp slt i32 %45, 1
  br i1 %.not89125, label %._crit_edge128, label %.lr.ph127

.lr.ph124:                                        ; preds = %._crit_edge113, %.loopexit
  %.074122 = phi i32 [ %.1, %.loopexit ], [ 0, %._crit_edge113 ]
  %.075121 = phi i32 [ %.2, %.loopexit ], [ %46, %._crit_edge113 ]
  %.077120 = phi i32 [ %.279, %.loopexit ], [ %45, %._crit_edge113 ]
  %.not90 = icmp slt i32 %.075121, %.077120
  br i1 %.not90, label %87, label %75

75:                                               ; preds = %.lr.ph124
  %76 = sext i32 %.077120 to i64
  %77 = sext i32 %.075121 to i64
  %78 = getelementptr inbounds [40 x [5010 x i64]], ptr @f, i64 0, i64 %76, i64 %77
  %79 = load i64, ptr %78, align 8, !tbaa !5
  %80 = sub nsw i32 %.075121, %.077120
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [40 x [5010 x i64]], ptr @f, i64 0, i64 %76, i64 %81
  %83 = load i64, ptr %82, align 8, !tbaa !5
  %84 = icmp eq i64 %79, %83
  br i1 %84, label %85, label %87

85:                                               ; preds = %75
  %86 = add nsw i32 %.074122, 1
  br label %.loopexit

87:                                               ; preds = %75, %.lr.ph124
  %88 = icmp sgt i32 %.077120, 0
  br i1 %88, label %.lr.ph117, label %.loopexit

.lr.ph117:                                        ; preds = %87
  %89 = zext nneg i32 %.077120 to i64
  %90 = sext i32 %.075121 to i64
  %91 = getelementptr inbounds [40 x [5010 x i64]], ptr @f, i64 0, i64 %89, i64 %90
  %92 = load i64, ptr %91, align 8, !tbaa !5
  %93 = getelementptr inbounds [40 x %struct.P], ptr @p, i64 0, i64 %89, i32 2
  %94 = load i32, ptr %93, align 4, !tbaa !15
  %95 = zext nneg i32 %.077120 to i64
  br label %96

96:                                               ; preds = %.lr.ph117, %120
  %indvars.iv150 = phi i64 [ 0, %.lr.ph117 ], [ %indvars.iv.next151, %120 ]
  %97 = trunc i64 %indvars.iv150 to i32
  %98 = sub i32 %97, %.077120
  %99 = add i32 %98, %.075121
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [40 x [5010 x i64]], ptr @f, i64 0, i64 %indvars.iv150, i64 %100
  %102 = load i64, ptr %101, align 8, !tbaa !5
  %103 = getelementptr inbounds [40 x %struct.P], ptr @p, i64 0, i64 %indvars.iv150, i32 2
  %104 = load i32, ptr %103, align 4, !tbaa !15
  %105 = sub nsw i32 %94, %104
  %106 = sext i32 %105 to i64
  %107 = mul nsw i64 %indvars.iv150, %106
  %108 = add nsw i64 %102, %107
  %109 = icmp eq i64 %92, %108
  br i1 %109, label %.preheader93, label %120

.preheader93:                                     ; preds = %96
  %110 = trunc nuw nsw i64 %indvars.iv150 to i32
  %111 = icmp sgt i32 %.077120, %110
  br i1 %111, label %.lr.ph119, label %.loopexit

.lr.ph119:                                        ; preds = %.preheader93
  %112 = add nsw i32 %.074122, 1
  %sext166 = shl i64 %indvars.iv150, 32
  %113 = ashr exact i64 %sext166, 32
  br label %114

114:                                              ; preds = %.lr.ph119, %114
  %indvars.iv156 = phi i64 [ %95, %.lr.ph119 ], [ %indvars.iv.next157, %114 ]
  %115 = getelementptr inbounds [40 x %struct.P], ptr @p, i64 0, i64 %indvars.iv156, i32 1
  %116 = load i32, ptr %115, align 4, !tbaa !11
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [40 x i32], ptr @ans, i64 0, i64 %117
  store i32 %112, ptr %118, align 4, !tbaa !9
  %indvars.iv.next157 = add nsw i64 %indvars.iv156, -1
  %119 = icmp sgt i64 %indvars.iv.next157, %113
  br i1 %119, label %114, label %.loopexit, !llvm.loop !21

120:                                              ; preds = %96
  %indvars.iv.next151 = add nuw nsw i64 %indvars.iv150, 1
  %exitcond155.not = icmp eq i64 %indvars.iv.next151, %89
  br i1 %exitcond155.not, label %.loopexit, label %96, !llvm.loop !22

.loopexit:                                        ; preds = %120, %114, %87, %.preheader93, %85
  %.279 = phi i32 [ %.077120, %85 ], [ %110, %.preheader93 ], [ %.077120, %87 ], [ %110, %114 ], [ %.077120, %120 ]
  %.2 = phi i32 [ %80, %85 ], [ %99, %.preheader93 ], [ %.075121, %87 ], [ %99, %114 ], [ %.075121, %120 ]
  %.1 = phi i32 [ %86, %85 ], [ %.074122, %.preheader93 ], [ %.074122, %87 ], [ %.074122, %114 ], [ %.074122, %120 ]
  %121 = icmp ne i32 %.279, 0
  %122 = icmp ne i32 %.2, 0
  %123 = and i1 %121, %122
  br i1 %123, label %.lr.ph124, label %.preheader, !llvm.loop !23

._crit_edge128:                                   ; preds = %.lr.ph127, %.preheader
  ret i32 0

.lr.ph127:                                        ; preds = %.preheader, %.lr.ph127
  %indvars.iv159 = phi i64 [ %indvars.iv.next160, %.lr.ph127 ], [ 1, %.preheader ]
  %124 = getelementptr inbounds [40 x i32], ptr @ans, i64 0, i64 %indvars.iv159
  %125 = load i32, ptr %124, align 4, !tbaa !9
  %126 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %125)
  %127 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %126, ptr noundef nonnull @.str)
  %indvars.iv.next160 = add nuw nsw i64 %indvars.iv159, 1
  %128 = load i32, ptr @n, align 4, !tbaa !9
  %129 = sext i32 %128 to i64
  %.not89.not = icmp slt i64 %indvars.iv159, %129
  br i1 %.not89.not, label %.lr.ph127, label %._crit_edge128, !llvm.loop !24
}

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIP1PZ4mainE3$_0EvT_S3_T0_"(ptr noundef, ptr noundef) local_unnamed_addr #4

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #6 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #6 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #4

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

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

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

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

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


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