; LLVM IR from bqi343/cp-notebook :: Contests/USACO Solutions/2015-16/Open 2016/Plat (landscape_dp)

; 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.std::pair" = type { i8, i32 }

@X = external dso_local global i64, align 8
@Y = external dso_local global i64, align 8
@Z = external dso_local global i64, align 8
@pres = external dso_local global [1000002 x i64], align 16
@prel = external dso_local global [1000002 x i64], align 16
@cu = external dso_local global [1000002 x i64], align 16
@p = external dso_local global [1000002 x i64], align 16

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z3cumii(i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_Z6genpreRSt6vectorISt4pairIciESaIS1_EE(ptr noundef nonnull align 8 dereferenceable(24) %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 1, ptr %3, align 4, !tbaa !9
  br label %8

8:                                                ; preds = %49, %1
  %9 = load i32, ptr %3, align 4, !tbaa !9
  %10 = sext i32 %9 to i64
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = call noundef i64 @_ZNKSt6vectorISt4pairIciESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %11) #5
  %13 = icmp ult i64 %10, %12
  br i1 %13, label %15, label %14

14:                                               ; preds = %8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %52

15:                                               ; preds = %8
  %16 = load ptr, ptr %2, align 8, !tbaa !5
  %17 = load i32, ptr %3, align 4, !tbaa !9
  %18 = sext i32 %17 to i64
  %19 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIciESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %16, i64 noundef %18) #5
  %20 = getelementptr inbounds %"struct.std::pair", ptr %19, i32 0, i32 1
  %21 = load i32, ptr %20, align 4, !tbaa !11
  %22 = load ptr, ptr %2, align 8, !tbaa !5
  %23 = load i32, ptr %3, align 4, !tbaa !9
  %24 = sub nsw i32 %23, 1
  %25 = sext i32 %24 to i64
  %26 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIciESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %22, i64 noundef %25) #5
  %27 = getelementptr inbounds %"struct.std::pair", ptr %26, i32 0, i32 1
  %28 = load i32, ptr %27, align 4, !tbaa !11
  %29 = sub nsw i32 %21, %28
  %30 = call i32 @llvm.abs.i32(i32 %29, i1 true)
  %31 = sext i32 %30 to i64
  %32 = load i32, ptr %3, align 4, !tbaa !9
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [1000002 x i64], ptr @cu, i64 0, i64 %33
  store i64 %31, ptr %34, align 8, !tbaa !13
  %35 = load i32, ptr %3, align 4, !tbaa !9
  %36 = icmp sgt i32 %35, 1
  br i1 %36, label %37, label %48

37:                                               ; preds = %15
  %38 = load i32, ptr %3, align 4, !tbaa !9
  %39 = sub nsw i32 %38, 2
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [1000002 x i64], ptr @cu, i64 0, i64 %40
  %42 = load i64, ptr %41, align 8, !tbaa !13
  %43 = load i32, ptr %3, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [1000002 x i64], ptr @cu, i64 0, i64 %44
  %46 = load i64, ptr %45, align 8, !tbaa !13
  %47 = add nsw i64 %46, %42
  store i64 %47, ptr %45, align 8, !tbaa !13
  br label %48

48:                                               ; preds = %37, %15
  br label %49

49:                                               ; preds = %48
  %50 = load i32, ptr %3, align 4, !tbaa !9
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %3, align 4, !tbaa !9
  br label %8, !llvm.loop !15

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

53:                                               ; preds = %243, %52
  %54 = load i32, ptr %4, align 4, !tbaa !9
  %55 = sext i32 %54 to i64
  %56 = load ptr, ptr %2, align 8, !tbaa !5
  %57 = call noundef i64 @_ZNKSt6vectorISt4pairIciESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %56) #5
  %58 = add i64 %57, 1
  %59 = icmp ult i64 %55, %58
  br i1 %59, label %61, label %60

60:                                               ; preds = %53
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %246

61:                                               ; preds = %53
  %62 = load i32, ptr %4, align 4, !tbaa !9
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [1000002 x i64], ptr @prel, i64 0, i64 %63
  store i64 1000000000000000000, ptr %64, align 8, !tbaa !13
  %65 = load i32, ptr %4, align 4, !tbaa !9
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [1000002 x i64], ptr @pres, i64 0, i64 %66
  store i64 1000000000000000000, ptr %67, align 8, !tbaa !13
  %68 = load i32, ptr %4, align 4, !tbaa !9
  %69 = icmp sgt i32 %68, 1
  br i1 %69, label %70, label %109

70:                                               ; preds = %61
  %71 = load i32, ptr %4, align 4, !tbaa !9
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [1000002 x i64], ptr @pres, i64 0, i64 %72
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %74 = load i32, ptr %4, align 4, !tbaa !9
  %75 = sub nsw i32 %74, 2
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [1000002 x i64], ptr @pres, i64 0, i64 %76
  %78 = load i32, ptr %4, align 4, !tbaa !9
  %79 = sub nsw i32 %78, 2
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [1000002 x i64], ptr @prel, i64 0, i64 %80
  %82 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %77, ptr noundef nonnull align 8 dereferenceable(8) %81)
  %83 = load i64, ptr %82, align 8, !tbaa !13
  %84 = load i64, ptr @Z, align 8, !tbaa !13
  %85 = load ptr, ptr %2, align 8, !tbaa !5
  %86 = load i32, ptr %4, align 4, !tbaa !9
  %87 = sub nsw i32 %86, 1
  %88 = sext i32 %87 to i64
  %89 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIciESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %85, i64 noundef %88) #5
  %90 = getelementptr inbounds %"struct.std::pair", ptr %89, i32 0, i32 1
  %91 = load i32, ptr %90, align 4, !tbaa !11
  %92 = load ptr, ptr %2, align 8, !tbaa !5
  %93 = load i32, ptr %4, align 4, !tbaa !9
  %94 = sub nsw i32 %93, 2
  %95 = sext i32 %94 to i64
  %96 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIciESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %92, i64 noundef %95) #5
  %97 = getelementptr inbounds %"struct.std::pair", ptr %96, i32 0, i32 1
  %98 = load i32, ptr %97, align 4, !tbaa !11
  %99 = sub nsw i32 %91, %98
  %100 = call i32 @llvm.abs.i32(i32 %99, i1 true)
  %101 = sext i32 %100 to i64
  %102 = mul nsw i64 %84, %101
  %103 = add nsw i64 %83, %102
  store i64 %103, ptr %5, align 8, !tbaa !13
  %104 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %73, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %105 = load i64, ptr %104, align 8, !tbaa !13
  %106 = load i32, ptr %4, align 4, !tbaa !9
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [1000002 x i64], ptr @pres, i64 0, i64 %107
  store i64 %105, ptr %108, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  br label %109

109:                                              ; preds = %70, %61
  %110 = load i32, ptr %4, align 4, !tbaa !9
  %111 = icmp sgt i32 %110, 3
  br i1 %111, label %112, label %146

112:                                              ; preds = %109
  %113 = load i32, ptr %4, align 4, !tbaa !9
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [1000002 x i64], ptr @prel, i64 0, i64 %114
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %116 = load i32, ptr %4, align 4, !tbaa !9
  %117 = sub nsw i32 %116, 2
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [1000002 x i64], ptr @prel, i64 0, i64 %118
  %120 = load i64, ptr %119, align 8, !tbaa !13
  %121 = load i64, ptr @Z, align 8, !tbaa !13
  %122 = load ptr, ptr %2, align 8, !tbaa !5
  %123 = load i32, ptr %4, align 4, !tbaa !9
  %124 = sub nsw i32 %123, 2
  %125 = sext i32 %124 to i64
  %126 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIciESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %122, i64 noundef %125) #5
  %127 = getelementptr inbounds %"struct.std::pair", ptr %126, i32 0, i32 1
  %128 = load i32, ptr %127, align 4, !tbaa !11
  %129 = load ptr, ptr %2, align 8, !tbaa !5
  %130 = load i32, ptr %4, align 4, !tbaa !9
  %131 = sub nsw i32 %130, 3
  %132 = sext i32 %131 to i64
  %133 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIciESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %129, i64 noundef %132) #5
  %134 = getelementptr inbounds %"struct.std::pair", ptr %133, i32 0, i32 1
  %135 = load i32, ptr %134, align 4, !tbaa !11
  %136 = sub nsw i32 %128, %135
  %137 = call i32 @llvm.abs.i32(i32 %136, i1 true)
  %138 = sext i32 %137 to i64
  %139 = mul nsw i64 %121, %138
  %140 = add nsw i64 %120, %139
  store i64 %140, ptr %6, align 8, !tbaa !13
  %141 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %115, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %142 = load i64, ptr %141, align 8, !tbaa !13
  %143 = load i32, ptr %4, align 4, !tbaa !9
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [1000002 x i64], ptr @prel, i64 0, i64 %144
  store i64 %142, ptr %145, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %146

146:                                              ; preds = %112, %109
  %147 = load i32, ptr %4, align 4, !tbaa !9
  %148 = icmp sge i32 %147, 2
  br i1 %148, label %149, label %158

149:                                              ; preds = %146
  %150 = load i32, ptr %4, align 4, !tbaa !9
  %151 = sub nsw i32 %150, 2
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [1000002 x i64], ptr @p, i64 0, i64 %152
  %154 = load i64, ptr %153, align 8, !tbaa !13
  %155 = load i32, ptr %4, align 4, !tbaa !9
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [1000002 x i64], ptr @p, i64 0, i64 %156
  store i64 %154, ptr %157, align 8, !tbaa !13
  br label %162

158:                                              ; preds = %146
  %159 = load i32, ptr %4, align 4, !tbaa !9
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [1000002 x i64], ptr @p, i64 0, i64 %160
  store i64 0, ptr %161, align 8, !tbaa !13
  br label %162

162:                                              ; preds = %158, %149
  br label %163

163:                                              ; preds = %236, %162
  %164 = load i64, ptr @Z, align 8, !tbaa !13
  %165 = load ptr, ptr %2, align 8, !tbaa !5
  %166 = load i32, ptr %4, align 4, !tbaa !9
  %167 = sub nsw i32 %166, 1
  %168 = sext i32 %167 to i64
  %169 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIciESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %165, i64 noundef %168) #5
  %170 = getelementptr inbounds %"struct.std::pair", ptr %169, i32 0, i32 1
  %171 = load i32, ptr %170, align 4, !tbaa !11
  %172 = load ptr, ptr %2, align 8, !tbaa !5
  %173 = load i32, ptr %4, align 4, !tbaa !9
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [1000002 x i64], ptr @p, i64 0, i64 %174
  %176 = load i64, ptr %175, align 8, !tbaa !13
  %177 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIciESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %172, i64 noundef %176) #5
  %178 = getelementptr inbounds %"struct.std::pair", ptr %177, i32 0, i32 1
  %179 = load i32, ptr %178, align 4, !tbaa !11
  %180 = sub nsw i32 %171, %179
  %181 = call i32 @llvm.abs.i32(i32 %180, i1 true)
  %182 = sext i32 %181 to i64
  %183 = mul nsw i64 %164, %182
  %184 = load i64, ptr @X, align 8, !tbaa !13
  %185 = load i64, ptr @Y, align 8, !tbaa !13
  %186 = add nsw i64 %184, %185
  %187 = icmp sgt i64 %183, %186
  br i1 %187, label %188, label %242

188:                                              ; preds = %163
  %189 = load i32, ptr %4, align 4, !tbaa !9
  %190 = sub nsw i32 %189, 1
  %191 = sext i32 %190 to i64
  %192 = load i32, ptr %4, align 4, !tbaa !9
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds [1000002 x i64], ptr @p, i64 0, i64 %193
  %195 = load i64, ptr %194, align 8, !tbaa !13
  %196 = sub nsw i64 %191, %195
  %197 = srem i64 %196, 2
  %198 = icmp eq i64 %197, 1
  br i1 %198, label %199, label %236

199:                                              ; preds = %188
  %200 = load i32, ptr %4, align 4, !tbaa !9
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds [1000002 x i64], ptr @prel, i64 0, i64 %201
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %203 = load i32, ptr %4, align 4, !tbaa !9
  %204 = sext i32 %203 to i64
  %205 = getelementptr inbounds [1000002 x i64], ptr @p, i64 0, i64 %204
  %206 = load i64, ptr %205, align 8, !tbaa !13
  %207 = getelementptr inbounds [1000002 x i64], ptr @pres, i64 0, i64 %206
  %208 = load i32, ptr %4, align 4, !tbaa !9
  %209 = sext i32 %208 to i64
  %210 = getelementptr inbounds [1000002 x i64], ptr @p, i64 0, i64 %209
  %211 = load i64, ptr %210, align 8, !tbaa !13
  %212 = getelementptr inbounds [1000002 x i64], ptr @prel, i64 0, i64 %211
  %213 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %207, ptr noundef nonnull align 8 dereferenceable(8) %212)
  %214 = load i64, ptr %213, align 8, !tbaa !13
  %215 = load i64, ptr @X, align 8, !tbaa !13
  %216 = add nsw i64 %214, %215
  %217 = load i64, ptr @Y, align 8, !tbaa !13
  %218 = add nsw i64 %216, %217
  %219 = load i64, ptr @Z, align 8, !tbaa !13
  %220 = load i32, ptr %4, align 4, !tbaa !9
  %221 = sext i32 %220 to i64
  %222 = getelementptr inbounds [1000002 x i64], ptr @p, i64 0, i64 %221
  %223 = load i64, ptr %222, align 8, !tbaa !13
  %224 = add nsw i64 %223, 1
  %225 = trunc i64 %224 to i32
  %226 = load i32, ptr %4, align 4, !tbaa !9
  %227 = sub nsw i32 %226, 2
  %228 = call noundef i64 @_Z3cumii(i32 noundef %225, i32 noundef %227)
  %229 = mul nsw i64 %219, %228
  %230 = add nsw i64 %218, %229
  store i64 %230, ptr %7, align 8, !tbaa !13
  %231 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %202, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %232 = load i64, ptr %231, align 8, !tbaa !13
  %233 = load i32, ptr %4, align 4, !tbaa !9
  %234 = sext i32 %233 to i64
  %235 = getelementptr inbounds [1000002 x i64], ptr @prel, i64 0, i64 %234
  store i64 %232, ptr %235, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %236

236:                                              ; preds = %199, %188
  %237 = load i32, ptr %4, align 4, !tbaa !9
  %238 = sext i32 %237 to i64
  %239 = getelementptr inbounds [1000002 x i64], ptr @p, i64 0, i64 %238
  %240 = load i64, ptr %239, align 8, !tbaa !13
  %241 = add nsw i64 %240, 1
  store i64 %241, ptr %239, align 8, !tbaa !13
  br label %163, !llvm.loop !17

242:                                              ; preds = %163
  br label %243

243:                                              ; preds = %242
  %244 = load i32, ptr %4, align 4, !tbaa !9
  %245 = add nsw i32 %244, 1
  store i32 %245, ptr %4, align 4, !tbaa !9
  br label %53, !llvm.loop !18

246:                                              ; preds = %60
  ret void
}

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

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

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

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

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

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

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"any pointer", !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 = !{!"_ZTSSt4pairIciE", !7, i64 0, !10, i64 4}
!13 = !{!14, !14, i64 0}
!14 = !{!"long long", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}


; 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"

@X = external dso_local local_unnamed_addr global i64, align 8
@Y = external dso_local local_unnamed_addr global i64, align 8
@Z = external dso_local local_unnamed_addr global i64, align 8
@pres = external dso_local global [1000002 x i64], align 16
@prel = external dso_local global [1000002 x i64], align 16
@cu = external dso_local local_unnamed_addr global [1000002 x i64], align 16
@p = external dso_local local_unnamed_addr global [1000002 x i64], align 16

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z3cumii(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z6genpreRSt6vectorISt4pairIciESaIS1_EE(ptr noundef nonnull align 8 dereferenceable(24) %0) local_unnamed_addr #0 {
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = tail call noundef i64 @_ZNKSt6vectorISt4pairIciESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  %6 = icmp ugt i64 %5, 1
  br i1 %6, label %7, label %.preheader

7:                                                ; preds = %1
  %8 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIciESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 1) #4
  %9 = getelementptr inbounds i8, ptr %8, i64 4
  %10 = load i32, ptr %9, align 4, !tbaa !5
  %11 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIciESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 0) #4
  %12 = getelementptr inbounds i8, ptr %11, i64 4
  %13 = load i32, ptr %12, align 4, !tbaa !5
  %14 = sub nsw i32 %10, %13
  %15 = tail call i32 @llvm.abs.i32(i32 %14, i1 true)
  %16 = zext nneg i32 %15 to i64
  store i64 %16, ptr getelementptr inbounds (i8, ptr @cu, i64 8), align 8, !tbaa !10
  %17 = tail call noundef i64 @_ZNKSt6vectorISt4pairIciESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  %18 = icmp ugt i64 %17, 2
  br i1 %18, label %.lr.ph.peel.next, label %.preheader

.preheader:                                       ; preds = %.lr.ph.peel.next, %7, %1
  %19 = tail call noundef i64 @_ZNKSt6vectorISt4pairIciESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  %20 = add i64 %19, -1
  %21 = icmp ult i64 %20, -2
  br i1 %21, label %.lr.ph55, label %._crit_edge

.lr.ph.peel.next:                                 ; preds = %7, %.lr.ph.peel.next
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph.peel.next ], [ 2, %7 ]
  %22 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIciESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %indvars.iv) #4
  %23 = getelementptr inbounds i8, ptr %22, i64 4
  %24 = load i32, ptr %23, align 4, !tbaa !5
  %25 = add nsw i64 %indvars.iv, -1
  %26 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIciESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %25) #4
  %27 = getelementptr inbounds i8, ptr %26, i64 4
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = sub nsw i32 %24, %28
  %30 = tail call i32 @llvm.abs.i32(i32 %29, i1 true)
  %31 = zext nneg i32 %30 to i64
  %32 = getelementptr inbounds [1000002 x i64], ptr @cu, i64 0, i64 %indvars.iv
  %33 = add nsw i64 %indvars.iv, -2
  %34 = getelementptr inbounds [1000002 x i64], ptr @cu, i64 0, i64 %33
  %35 = load i64, ptr %34, align 8, !tbaa !10
  %36 = add nsw i64 %35, %31
  store i64 %36, ptr %32, align 8, !tbaa !10
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %37 = tail call noundef i64 @_ZNKSt6vectorISt4pairIciESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  %38 = icmp ugt i64 %37, %indvars.iv.next
  br i1 %38, label %.lr.ph.peel.next, label %.preheader, !llvm.loop !12

._crit_edge:                                      ; preds = %131, %.preheader
  ret void

.lr.ph55:                                         ; preds = %.preheader, %131
  %indvars.iv58 = phi i64 [ %indvars.iv.next59, %131 ], [ 1, %.preheader ]
  %39 = getelementptr inbounds [1000002 x i64], ptr @prel, i64 0, i64 %indvars.iv58
  store i64 1000000000000000000, ptr %39, align 8, !tbaa !10
  %40 = getelementptr inbounds [1000002 x i64], ptr @pres, i64 0, i64 %indvars.iv58
  store i64 1000000000000000000, ptr %40, align 8, !tbaa !10
  %41 = icmp ugt i64 %indvars.iv58, 1
  br i1 %41, label %42, label %84

42:                                               ; preds = %.lr.ph55
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  %43 = add nsw i64 %indvars.iv58, -2
  %44 = getelementptr inbounds [1000002 x i64], ptr @pres, i64 0, i64 %43
  %45 = getelementptr inbounds [1000002 x i64], ptr @prel, i64 0, i64 %43
  %46 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %44, ptr noundef nonnull align 8 dereferenceable(8) %45)
  %47 = load i64, ptr %46, align 8, !tbaa !10
  %48 = load i64, ptr @Z, align 8, !tbaa !10
  %49 = add nsw i64 %indvars.iv58, -1
  %50 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIciESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %49) #4
  %51 = getelementptr inbounds i8, ptr %50, i64 4
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIciESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %43) #4
  %54 = getelementptr inbounds i8, ptr %53, i64 4
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = sub nsw i32 %52, %55
  %57 = call i32 @llvm.abs.i32(i32 %56, i1 true)
  %58 = zext nneg i32 %57 to i64
  %59 = mul nsw i64 %48, %58
  %60 = add nsw i64 %59, %47
  store i64 %60, ptr %2, align 8, !tbaa !10
  %61 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %40, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %62 = load i64, ptr %61, align 8, !tbaa !10
  store i64 %62, ptr %40, align 8, !tbaa !10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  %63 = icmp ugt i64 %indvars.iv58, 3
  br i1 %63, label %64, label %81

64:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4
  %65 = load i64, ptr %45, align 8, !tbaa !10
  %66 = load i64, ptr @Z, align 8, !tbaa !10
  %67 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIciESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %43) #4
  %68 = getelementptr inbounds i8, ptr %67, i64 4
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = add nsw i64 %indvars.iv58, -3
  %71 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIciESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %70) #4
  %72 = getelementptr inbounds i8, ptr %71, i64 4
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = sub nsw i32 %69, %73
  %75 = call i32 @llvm.abs.i32(i32 %74, i1 true)
  %76 = zext nneg i32 %75 to i64
  %77 = mul nsw i64 %66, %76
  %78 = add nsw i64 %77, %65
  store i64 %78, ptr %3, align 8, !tbaa !10
  %79 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %39, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %80 = load i64, ptr %79, align 8, !tbaa !10
  store i64 %80, ptr %39, align 8, !tbaa !10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  br label %81

81:                                               ; preds = %64, %42
  %82 = getelementptr inbounds [1000002 x i64], ptr @p, i64 0, i64 %43
  %83 = load i64, ptr %82, align 8, !tbaa !10
  br label %84

84:                                               ; preds = %.lr.ph55, %81
  %.sink = phi i64 [ %83, %81 ], [ 0, %.lr.ph55 ]
  %.pre-phi63 = phi i64 [ %43, %81 ], [ -1, %.lr.ph55 ]
  %.pre-phi = phi i64 [ %49, %81 ], [ 0, %.lr.ph55 ]
  %85 = getelementptr inbounds [1000002 x i64], ptr @p, i64 0, i64 %indvars.iv58
  store i64 %.sink, ptr %85, align 8, !tbaa !10
  %86 = getelementptr inbounds [1000002 x i64], ptr @p, i64 0, i64 %indvars.iv58
  %87 = trunc nsw i64 %.pre-phi63 to i32
  br label %88

88:                                               ; preds = %128, %84
  %89 = load i64, ptr @Z, align 8, !tbaa !10
  %90 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIciESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %.pre-phi) #4
  %91 = getelementptr inbounds i8, ptr %90, i64 4
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = load i64, ptr %86, align 8, !tbaa !10
  %94 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIciESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %93) #4
  %95 = getelementptr inbounds i8, ptr %94, i64 4
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = sub nsw i32 %92, %96
  %98 = call i32 @llvm.abs.i32(i32 %97, i1 true)
  %99 = zext nneg i32 %98 to i64
  %100 = mul nsw i64 %89, %99
  %101 = load i64, ptr @X, align 8, !tbaa !10
  %102 = load i64, ptr @Y, align 8, !tbaa !10
  %103 = add nsw i64 %102, %101
  %104 = icmp sgt i64 %100, %103
  br i1 %104, label %105, label %131

105:                                              ; preds = %88
  %106 = load i64, ptr %86, align 8, !tbaa !10
  %107 = sub nsw i64 %.pre-phi, %106
  %108 = and i64 %107, -9223372036854775807
  %109 = icmp eq i64 %108, 1
  br i1 %109, label %110, label %128

110:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %111 = getelementptr inbounds [1000002 x i64], ptr @pres, i64 0, i64 %106
  %112 = getelementptr inbounds [1000002 x i64], ptr @prel, i64 0, i64 %106
  %113 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %111, ptr noundef nonnull align 8 dereferenceable(8) %112)
  %114 = load i64, ptr %113, align 8, !tbaa !10
  %115 = load i64, ptr @X, align 8, !tbaa !10
  %116 = add nsw i64 %115, %114
  %117 = load i64, ptr @Y, align 8, !tbaa !10
  %118 = add nsw i64 %116, %117
  %119 = load i64, ptr @Z, align 8, !tbaa !10
  %120 = load i64, ptr %86, align 8, !tbaa !10
  %121 = trunc i64 %120 to i32
  %122 = add i32 %121, 1
  %123 = call noundef i64 @_Z3cumii(i32 noundef %122, i32 noundef %87)
  %124 = mul nsw i64 %123, %119
  %125 = add nsw i64 %118, %124
  store i64 %125, ptr %4, align 8, !tbaa !10
  %126 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %39, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %127 = load i64, ptr %126, align 8, !tbaa !10
  store i64 %127, ptr %39, align 8, !tbaa !10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  %.pre = load i64, ptr %86, align 8, !tbaa !10
  br label %128

128:                                              ; preds = %110, %105
  %129 = phi i64 [ %.pre, %110 ], [ %106, %105 ]
  %130 = add nsw i64 %129, 1
  store i64 %130, ptr %86, align 8, !tbaa !10
  br label %88, !llvm.loop !15

131:                                              ; preds = %88
  %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
  %132 = call noundef i64 @_ZNKSt6vectorISt4pairIciESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  %133 = add i64 %132, 1
  %134 = icmp ugt i64 %133, %indvars.iv.next59
  br i1 %134, label %.lr.ph55, label %._crit_edge, !llvm.loop !16
}

; 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 nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorISt4pairIciESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

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

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

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

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

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { 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, !9, i64 4}
!6 = !{!"_ZTSSt4pairIciE", !7, i64 0, !9, i64 4}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"long long", !7, i64 0}
!12 = distinct !{!12, !13, !14}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!"llvm.loop.peeled.count", i32 1}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}


; Effective O3 passes: ADCEPass,CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopFullUnrollPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass