; LLVM IR from eyangch/competitive-programming :: Codeforces/1328 (f)

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

@N = external dso_local global i32, align 4
@K = external dso_local global i32, align 4
@psame = external dso_local global [200000 x i32], align 16
@ssame = external dso_local global [200000 x i32], align 16
@a = external dso_local global [200000 x i64], align 16
@pfx = external dso_local global [200000 x i64], align 16
@sfx = external dso_local global [200000 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 i32, align 4
  %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 i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %17 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %18 = getelementptr i8, ptr %17, i64 -24
  %19 = load i64, ptr %18, align 8
  %20 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %19
  %21 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %20, ptr noundef null)
  %22 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %23 = 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)
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef nonnull align 4 dereferenceable(4) @K)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !8
  br label %25

25:                                               ; preds = %35, %0
  %26 = load i32, ptr %2, align 4, !tbaa !8
  %27 = load i32, ptr @N, align 4, !tbaa !8
  %28 = icmp slt i32 %26, %27
  br i1 %28, label %30, label %29

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

30:                                               ; preds = %25
  %31 = load i32, ptr %2, align 4, !tbaa !8
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %32
  %34 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %33)
  br label %35

35:                                               ; preds = %30
  %36 = load i32, ptr %2, align 4, !tbaa !8
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr %2, align 4, !tbaa !8
  br label %25, !llvm.loop !11

38:                                               ; preds = %29
  %39 = load i32, ptr @N, align 4, !tbaa !8
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds i64, ptr @a, i64 %40
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef @a, ptr noundef %41)
  %42 = load i64, ptr @a, align 16, !tbaa !13
  store i64 %42, ptr @pfx, align 16, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 1, ptr %3, align 4, !tbaa !8
  br label %43

43:                                               ; preds = %62, %38
  %44 = load i32, ptr %3, align 4, !tbaa !8
  %45 = load i32, ptr @N, align 4, !tbaa !8
  %46 = icmp slt i32 %44, %45
  br i1 %46, label %48, label %47

47:                                               ; preds = %43
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %65

48:                                               ; preds = %43
  %49 = load i32, ptr %3, align 4, !tbaa !8
  %50 = sub nsw i32 %49, 1
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [200000 x i64], ptr @pfx, i64 0, i64 %51
  %53 = load i64, ptr %52, align 8, !tbaa !13
  %54 = load i32, ptr %3, align 4, !tbaa !8
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %55
  %57 = load i64, ptr %56, align 8, !tbaa !13
  %58 = add nsw i64 %53, %57
  %59 = load i32, ptr %3, align 4, !tbaa !8
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [200000 x i64], ptr @pfx, i64 0, i64 %60
  store i64 %58, ptr %61, align 8, !tbaa !13
  br label %62

62:                                               ; preds = %48
  %63 = load i32, ptr %3, align 4, !tbaa !8
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %3, align 4, !tbaa !8
  br label %43, !llvm.loop !15

65:                                               ; preds = %47
  %66 = load i32, ptr @N, align 4, !tbaa !8
  %67 = sub nsw i32 %66, 1
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %68
  %70 = load i64, ptr %69, align 8, !tbaa !13
  %71 = load i32, ptr @N, align 4, !tbaa !8
  %72 = sub nsw i32 %71, 1
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [200000 x i64], ptr @sfx, i64 0, i64 %73
  store i64 %70, ptr %74, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  %75 = load i32, ptr @N, align 4, !tbaa !8
  %76 = sub nsw i32 %75, 2
  store i32 %76, ptr %4, align 4, !tbaa !8
  br label %77

77:                                               ; preds = %95, %65
  %78 = load i32, ptr %4, align 4, !tbaa !8
  %79 = icmp sge i32 %78, 0
  br i1 %79, label %81, label %80

80:                                               ; preds = %77
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %98

81:                                               ; preds = %77
  %82 = load i32, ptr %4, align 4, !tbaa !8
  %83 = add nsw i32 %82, 1
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [200000 x i64], ptr @sfx, i64 0, i64 %84
  %86 = load i64, ptr %85, align 8, !tbaa !13
  %87 = load i32, ptr %4, align 4, !tbaa !8
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %88
  %90 = load i64, ptr %89, align 8, !tbaa !13
  %91 = add nsw i64 %86, %90
  %92 = load i32, ptr %4, align 4, !tbaa !8
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [200000 x i64], ptr @sfx, i64 0, i64 %93
  store i64 %91, ptr %94, align 8, !tbaa !13
  br label %95

95:                                               ; preds = %81
  %96 = load i32, ptr %4, align 4, !tbaa !8
  %97 = add nsw i32 %96, -1
  store i32 %97, ptr %4, align 4, !tbaa !8
  br label %77, !llvm.loop !16

98:                                               ; preds = %80
  %99 = load i32, ptr @N, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  store i32 1, ptr %5, align 4, !tbaa !8
  %100 = call noundef ptr @_ZSt6fill_nIPiiiET_S1_T0_RKT1_(ptr noundef @psame, i32 noundef %99, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  %101 = load i32, ptr @N, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 1, ptr %6, align 4, !tbaa !8
  %102 = call noundef ptr @_ZSt6fill_nIPiiiET_S1_T0_RKT1_(ptr noundef @ssame, i32 noundef %101, ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 1, ptr %7, align 4, !tbaa !8
  br label %103

103:                                              ; preds = %130, %98
  %104 = load i32, ptr %7, align 4, !tbaa !8
  %105 = load i32, ptr @N, align 4, !tbaa !8
  %106 = icmp slt i32 %104, %105
  br i1 %106, label %108, label %107

107:                                              ; preds = %103
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %133

108:                                              ; preds = %103
  %109 = load i32, ptr %7, align 4, !tbaa !8
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %110
  %112 = load i64, ptr %111, align 8, !tbaa !13
  %113 = load i32, ptr %7, align 4, !tbaa !8
  %114 = sub nsw i32 %113, 1
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %115
  %117 = load i64, ptr %116, align 8, !tbaa !13
  %118 = icmp eq i64 %112, %117
  br i1 %118, label %119, label %129

119:                                              ; preds = %108
  %120 = load i32, ptr %7, align 4, !tbaa !8
  %121 = sub nsw i32 %120, 1
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [200000 x i32], ptr @psame, i64 0, i64 %122
  %124 = load i32, ptr %123, align 4, !tbaa !8
  %125 = add nsw i32 %124, 1
  %126 = load i32, ptr %7, align 4, !tbaa !8
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [200000 x i32], ptr @psame, i64 0, i64 %127
  store i32 %125, ptr %128, align 4, !tbaa !8
  br label %129

129:                                              ; preds = %119, %108
  br label %130

130:                                              ; preds = %129
  %131 = load i32, ptr %7, align 4, !tbaa !8
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %7, align 4, !tbaa !8
  br label %103, !llvm.loop !17

133:                                              ; preds = %107
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %134 = load i32, ptr @N, align 4, !tbaa !8
  %135 = sub nsw i32 %134, 2
  store i32 %135, ptr %8, align 4, !tbaa !8
  br label %136

136:                                              ; preds = %162, %133
  %137 = load i32, ptr %8, align 4, !tbaa !8
  %138 = icmp sge i32 %137, 0
  br i1 %138, label %140, label %139

139:                                              ; preds = %136
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %165

140:                                              ; preds = %136
  %141 = load i32, ptr %8, align 4, !tbaa !8
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %142
  %144 = load i64, ptr %143, align 8, !tbaa !13
  %145 = load i32, ptr %8, align 4, !tbaa !8
  %146 = add nsw i32 %145, 1
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %147
  %149 = load i64, ptr %148, align 8, !tbaa !13
  %150 = icmp eq i64 %144, %149
  br i1 %150, label %151, label %161

151:                                              ; preds = %140
  %152 = load i32, ptr %8, align 4, !tbaa !8
  %153 = add nsw i32 %152, 1
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [200000 x i32], ptr @ssame, i64 0, i64 %154
  %156 = load i32, ptr %155, align 4, !tbaa !8
  %157 = add nsw i32 %156, 1
  %158 = load i32, ptr %8, align 4, !tbaa !8
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [200000 x i32], ptr @ssame, i64 0, i64 %159
  store i32 %157, ptr %160, align 4, !tbaa !8
  br label %161

161:                                              ; preds = %151, %140
  br label %162

162:                                              ; preds = %161
  %163 = load i32, ptr %8, align 4, !tbaa !8
  %164 = add nsw i32 %163, -1
  store i32 %164, ptr %8, align 4, !tbaa !8
  br label %136, !llvm.loop !18

165:                                              ; preds = %139
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  store i64 100000000000000000, ptr %9, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 0, ptr %10, align 4, !tbaa !8
  br label %166

166:                                              ; preds = %268, %165
  %167 = load i32, ptr %10, align 4, !tbaa !8
  %168 = load i32, ptr @N, align 4, !tbaa !8
  %169 = icmp slt i32 %167, %168
  br i1 %169, label %171, label %170

170:                                              ; preds = %166
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %271

171:                                              ; preds = %166
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %172 = load i32, ptr %10, align 4, !tbaa !8
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %173
  %175 = load i64, ptr %174, align 8, !tbaa !13
  %176 = load i32, ptr %10, align 4, !tbaa !8
  %177 = add nsw i32 %176, 1
  %178 = sext i32 %177 to i64
  %179 = mul nsw i64 %175, %178
  %180 = load i32, ptr %10, align 4, !tbaa !8
  %181 = sext i32 %180 to i64
  %182 = getelementptr inbounds [200000 x i64], ptr @pfx, i64 0, i64 %181
  %183 = load i64, ptr %182, align 8, !tbaa !13
  %184 = sub nsw i64 %179, %183
  store i64 %184, ptr %11, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %185 = load i32, ptr %10, align 4, !tbaa !8
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [200000 x i64], ptr @sfx, i64 0, i64 %186
  %188 = load i64, ptr %187, align 8, !tbaa !13
  %189 = load i32, ptr %10, align 4, !tbaa !8
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %190
  %192 = load i64, ptr %191, align 8, !tbaa !13
  %193 = load i32, ptr @N, align 4, !tbaa !8
  %194 = load i32, ptr %10, align 4, !tbaa !8
  %195 = sub nsw i32 %193, %194
  %196 = sext i32 %195 to i64
  %197 = mul nsw i64 %192, %196
  %198 = sub nsw i64 %188, %197
  store i64 %198, ptr %12, align 8, !tbaa !13
  %199 = load i32, ptr %10, align 4, !tbaa !8
  %200 = add nsw i32 %199, 1
  %201 = load i32, ptr @K, align 4, !tbaa !8
  %202 = icmp sge i32 %200, %201
  br i1 %202, label %203, label %217

203:                                              ; preds = %171
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %204 = load i64, ptr %11, align 8, !tbaa !13
  %205 = load i32, ptr %10, align 4, !tbaa !8
  %206 = add nsw i32 %205, 1
  %207 = load i32, ptr %10, align 4, !tbaa !8
  %208 = sext i32 %207 to i64
  %209 = getelementptr inbounds [200000 x i32], ptr @psame, i64 0, i64 %208
  %210 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @K, ptr noundef nonnull align 4 dereferenceable(4) %209)
  %211 = load i32, ptr %210, align 4, !tbaa !8
  %212 = sub nsw i32 %206, %211
  %213 = sext i32 %212 to i64
  %214 = sub nsw i64 %204, %213
  store i64 %214, ptr %13, align 8, !tbaa !13
  %215 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %13)
  %216 = load i64, ptr %215, align 8, !tbaa !13
  store i64 %216, ptr %9, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %217

217:                                              ; preds = %203, %171
  %218 = load i32, ptr @N, align 4, !tbaa !8
  %219 = load i32, ptr %10, align 4, !tbaa !8
  %220 = sub nsw i32 %218, %219
  %221 = load i32, ptr @K, align 4, !tbaa !8
  %222 = icmp sge i32 %220, %221
  br i1 %222, label %223, label %238

223:                                              ; preds = %217
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %224 = load i64, ptr %12, align 8, !tbaa !13
  %225 = load i32, ptr @N, align 4, !tbaa !8
  %226 = load i32, ptr %10, align 4, !tbaa !8
  %227 = sub nsw i32 %225, %226
  %228 = load i32, ptr %10, align 4, !tbaa !8
  %229 = sext i32 %228 to i64
  %230 = getelementptr inbounds [200000 x i32], ptr @ssame, i64 0, i64 %229
  %231 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @K, ptr noundef nonnull align 4 dereferenceable(4) %230)
  %232 = load i32, ptr %231, align 4, !tbaa !8
  %233 = sub nsw i32 %227, %232
  %234 = sext i32 %233 to i64
  %235 = sub nsw i64 %224, %234
  store i64 %235, ptr %14, align 8, !tbaa !13
  %236 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %14)
  %237 = load i64, ptr %236, align 8, !tbaa !13
  store i64 %237, ptr %9, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  br label %238

238:                                              ; preds = %223, %217
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %239 = load i64, ptr %11, align 8, !tbaa !13
  %240 = load i64, ptr %12, align 8, !tbaa !13
  %241 = add nsw i64 %239, %240
  %242 = load i32, ptr @N, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  %243 = load i32, ptr %10, align 4, !tbaa !8
  %244 = sext i32 %243 to i64
  %245 = getelementptr inbounds [200000 x i32], ptr @psame, i64 0, i64 %244
  %246 = load i32, ptr %245, align 4, !tbaa !8
  %247 = load i32, ptr %10, align 4, !tbaa !8
  %248 = sext i32 %247 to i64
  %249 = getelementptr inbounds [200000 x i32], ptr @ssame, i64 0, i64 %248
  %250 = load i32, ptr %249, align 4, !tbaa !8
  %251 = add nsw i32 %246, %250
  %252 = sub nsw i32 %251, 1
  store i32 %252, ptr %16, align 4, !tbaa !8
  %253 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @K, ptr noundef nonnull align 4 dereferenceable(4) %16)
  %254 = load i32, ptr %253, align 4, !tbaa !8
  %255 = sub nsw i32 %242, %254
  %256 = sext i32 %255 to i64
  %257 = sub nsw i64 %241, %256
  store i64 %257, ptr %15, align 8, !tbaa !13
  %258 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %15)
  %259 = load i64, ptr %258, align 8, !tbaa !13
  store i64 %259, ptr %9, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  %260 = load i32, ptr %10, align 4, !tbaa !8
  %261 = sext i32 %260 to i64
  %262 = getelementptr inbounds [200000 x i32], ptr @psame, i64 0, i64 %261
  %263 = load i32, ptr %262, align 4, !tbaa !8
  %264 = load i32, ptr @K, align 4, !tbaa !8
  %265 = icmp sge i32 %263, %264
  br i1 %265, label %266, label %267

266:                                              ; preds = %238
  store i64 0, ptr %9, align 8, !tbaa !13
  br label %267

267:                                              ; preds = %266, %238
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br label %268

268:                                              ; preds = %267
  %269 = load i32, ptr %10, align 4, !tbaa !8
  %270 = add nsw i32 %269, 1
  store i32 %270, ptr %10, align 4, !tbaa !8
  br label %166, !llvm.loop !19

271:                                              ; preds = %170
  %272 = load i64, ptr %9, align 8, !tbaa !13
  %273 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %272)
  %274 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %273, ptr noundef @.str)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  %275 = load i32, ptr %1, align 4
  ret i32 %275
}

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

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

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

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

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

; 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 dso_local void @_ZSt4sortIPxEvT_S1_(ptr noundef, ptr noundef) #5

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

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

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

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

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

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

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

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


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

@N = external dso_local global i32, align 4
@K = external dso_local global i32, align 4
@psame = external dso_local global [200000 x i32], align 16
@ssame = external dso_local global [200000 x i32], align 16
@a = external dso_local global [200000 x i64], align 16
@pfx = external dso_local local_unnamed_addr global [200000 x i64], align 16
@sfx = external dso_local local_unnamed_addr global [200000 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 i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %9 = getelementptr i8, ptr %8, i64 -24
  %10 = load i64, ptr %9, align 8
  %11 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %10
  %12 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %11, ptr noundef null)
  %13 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %14 = 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)
  %15 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 4 dereferenceable(4) @K)
  %16 = load i32, ptr @N, align 4, !tbaa !8
  %17 = icmp sgt i32 %16, 0
  br i1 %17, label %.lr.ph, label %.._crit_edge_crit_edge

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre109 = sext i32 %16 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi110 = phi i64 [ %.pre109, %.._crit_edge_crit_edge ], [ %33, %.lr.ph ]
  %18 = getelementptr inbounds i64, ptr @a, i64 %.pre-phi110
  tail call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull @a, ptr noundef nonnull %18)
  %19 = load i64, ptr @a, align 16, !tbaa !11
  store i64 %19, ptr @pfx, align 16, !tbaa !11
  %20 = load i32, ptr @N, align 4, !tbaa !8
  %21 = icmp sgt i32 %20, 1
  br i1 %21, label %.lr.ph66.preheader, label %._crit_edge67.thread

._crit_edge67.thread:                             ; preds = %._crit_edge
  %22 = add nsw i32 %20, -1
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %23
  %25 = load i64, ptr %24, align 8, !tbaa !11
  %26 = getelementptr inbounds [200000 x i64], ptr @sfx, i64 0, i64 %23
  store i64 %25, ptr %26, align 8, !tbaa !11
  br label %._crit_edge72

.lr.ph66.preheader:                               ; preds = %._crit_edge
  %wide.trip.count = zext nneg i32 %20 to i64
  %27 = add nsw i64 %wide.trip.count, -1
  %28 = add nsw i64 %wide.trip.count, -2
  %xtraiter = and i64 %27, 3
  %29 = icmp ult i64 %28, 3
  br i1 %29, label %._crit_edge67.unr-lcssa, label %.lr.ph66.preheader.new

.lr.ph66.preheader.new:                           ; preds = %.lr.ph66.preheader
  %unroll_iter = and i64 %27, -4
  br label %.lr.ph66

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %30 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %indvars.iv
  %31 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %30)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %32 = load i32, ptr @N, align 4, !tbaa !8
  %33 = sext i32 %32 to i64
  %34 = icmp slt i64 %indvars.iv.next, %33
  br i1 %34, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge67.unr-lcssa:                          ; preds = %.lr.ph66, %.lr.ph66.preheader
  %.unr = phi i64 [ %19, %.lr.ph66.preheader ], [ %70, %.lr.ph66 ]
  %indvars.iv87.unr = phi i64 [ 1, %.lr.ph66.preheader ], [ %indvars.iv.next88.3, %.lr.ph66 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge67, label %.lr.ph66.epil

.lr.ph66.epil:                                    ; preds = %._crit_edge67.unr-lcssa, %.lr.ph66.epil
  %35 = phi i64 [ %38, %.lr.ph66.epil ], [ %.unr, %._crit_edge67.unr-lcssa ]
  %indvars.iv87.epil = phi i64 [ %indvars.iv.next88.epil, %.lr.ph66.epil ], [ %indvars.iv87.unr, %._crit_edge67.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph66.epil ], [ 0, %._crit_edge67.unr-lcssa ]
  %36 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %indvars.iv87.epil
  %37 = load i64, ptr %36, align 8, !tbaa !11
  %38 = add nsw i64 %37, %35
  %39 = getelementptr inbounds [200000 x i64], ptr @pfx, i64 0, i64 %indvars.iv87.epil
  store i64 %38, ptr %39, align 8, !tbaa !11
  %indvars.iv.next88.epil = add nuw nsw i64 %indvars.iv87.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge67, label %.lr.ph66.epil, !llvm.loop !15

._crit_edge67:                                    ; preds = %.lr.ph66.epil, %._crit_edge67.unr-lcssa
  %40 = add nsw i32 %20, -1
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %41
  %43 = load i64, ptr %42, align 8, !tbaa !11
  %44 = getelementptr inbounds [200000 x i64], ptr @sfx, i64 0, i64 %41
  store i64 %43, ptr %44, align 8, !tbaa !11
  br i1 %21, label %.lr.ph71.preheader, label %._crit_edge72

.lr.ph71.preheader:                               ; preds = %._crit_edge67
  %45 = add nsw i32 %20, -2
  %46 = zext i32 %45 to i64
  %47 = shl nuw nsw i64 %46, 3
  %48 = getelementptr i8, ptr @sfx, i64 %47
  %scevgep = getelementptr i8, ptr %48, i64 8
  %load_initial = load i64, ptr %scevgep, align 8
  %49 = add nuw nsw i64 %46, 1
  %xtraiter115 = and i64 %49, 3
  %lcmp.mod116.not = icmp eq i64 %xtraiter115, 0
  br i1 %lcmp.mod116.not, label %.lr.ph71.prol.loopexit, label %.lr.ph71.prol

.lr.ph71.prol:                                    ; preds = %.lr.ph71.preheader, %.lr.ph71.prol
  %store_forwarded.prol = phi i64 [ %52, %.lr.ph71.prol ], [ %load_initial, %.lr.ph71.preheader ]
  %indvars.iv90.prol = phi i64 [ %indvars.iv.next91.prol, %.lr.ph71.prol ], [ %46, %.lr.ph71.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %.lr.ph71.prol ], [ 0, %.lr.ph71.preheader ]
  %50 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %indvars.iv90.prol
  %51 = load i64, ptr %50, align 8, !tbaa !11
  %52 = add nsw i64 %51, %store_forwarded.prol
  %53 = getelementptr inbounds [200000 x i64], ptr @sfx, i64 0, i64 %indvars.iv90.prol
  store i64 %52, ptr %53, align 8, !tbaa !11
  %indvars.iv.next91.prol = add nsw i64 %indvars.iv90.prol, -1
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter115
  br i1 %prol.iter.cmp.not, label %.lr.ph71.prol.loopexit, label %.lr.ph71.prol, !llvm.loop !17

.lr.ph71.prol.loopexit:                           ; preds = %.lr.ph71.prol, %.lr.ph71.preheader
  %store_forwarded.unr = phi i64 [ %load_initial, %.lr.ph71.preheader ], [ %52, %.lr.ph71.prol ]
  %indvars.iv90.unr = phi i64 [ %46, %.lr.ph71.preheader ], [ %indvars.iv.next91.prol, %.lr.ph71.prol ]
  %54 = icmp ult i32 %45, 3
  br i1 %54, label %._crit_edge72, label %.lr.ph71

.lr.ph66:                                         ; preds = %.lr.ph66, %.lr.ph66.preheader.new
  %55 = phi i64 [ %19, %.lr.ph66.preheader.new ], [ %70, %.lr.ph66 ]
  %indvars.iv87 = phi i64 [ 1, %.lr.ph66.preheader.new ], [ %indvars.iv.next88.3, %.lr.ph66 ]
  %niter = phi i64 [ 0, %.lr.ph66.preheader.new ], [ %niter.next.3, %.lr.ph66 ]
  %56 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %indvars.iv87
  %57 = load i64, ptr %56, align 8, !tbaa !11
  %58 = add nsw i64 %57, %55
  %59 = getelementptr inbounds [200000 x i64], ptr @pfx, i64 0, i64 %indvars.iv87
  store i64 %58, ptr %59, align 8, !tbaa !11
  %indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
  %60 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %indvars.iv.next88
  %61 = load i64, ptr %60, align 8, !tbaa !11
  %62 = add nsw i64 %61, %58
  %63 = getelementptr inbounds [200000 x i64], ptr @pfx, i64 0, i64 %indvars.iv.next88
  store i64 %62, ptr %63, align 8, !tbaa !11
  %indvars.iv.next88.1 = add nuw nsw i64 %indvars.iv87, 2
  %64 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %indvars.iv.next88.1
  %65 = load i64, ptr %64, align 8, !tbaa !11
  %66 = add nsw i64 %65, %62
  %67 = getelementptr inbounds [200000 x i64], ptr @pfx, i64 0, i64 %indvars.iv.next88.1
  store i64 %66, ptr %67, align 8, !tbaa !11
  %indvars.iv.next88.2 = add nuw nsw i64 %indvars.iv87, 3
  %68 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %indvars.iv.next88.2
  %69 = load i64, ptr %68, align 8, !tbaa !11
  %70 = add nsw i64 %69, %66
  %71 = getelementptr inbounds [200000 x i64], ptr @pfx, i64 0, i64 %indvars.iv.next88.2
  store i64 %70, ptr %71, align 8, !tbaa !11
  %indvars.iv.next88.3 = add nuw nsw i64 %indvars.iv87, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge67.unr-lcssa, label %.lr.ph66, !llvm.loop !18

._crit_edge72:                                    ; preds = %.lr.ph71.prol.loopexit, %.lr.ph71, %._crit_edge67.thread, %._crit_edge67
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  store i32 1, ptr %1, align 4, !tbaa !8
  %72 = call noundef ptr @_ZSt6fill_nIPiiiET_S1_T0_RKT1_(ptr noundef nonnull @psame, i32 noundef %20, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  %73 = load i32, ptr @N, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  store i32 1, ptr %2, align 4, !tbaa !8
  %74 = call noundef ptr @_ZSt6fill_nIPiiiET_S1_T0_RKT1_(ptr noundef nonnull @ssame, i32 noundef %73, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  %75 = load i32, ptr @N, align 4, !tbaa !8
  %76 = icmp sgt i32 %75, 1
  br i1 %76, label %.lr.ph75.preheader, label %._crit_edge81

.lr.ph75.preheader:                               ; preds = %._crit_edge72
  %wide.trip.count96 = zext nneg i32 %75 to i64
  %.pre = load i64, ptr @a, align 16, !tbaa !11
  %77 = add nsw i64 %wide.trip.count96, -1
  %xtraiter117 = and i64 %77, 1
  %78 = icmp eq i32 %75, 2
  br i1 %78, label %._crit_edge76.unr-lcssa, label %.lr.ph75.preheader.new

.lr.ph75.preheader.new:                           ; preds = %.lr.ph75.preheader
  %unroll_iter121 = and i64 %77, -2
  br label %.lr.ph75

.lr.ph71:                                         ; preds = %.lr.ph71.prol.loopexit, %.lr.ph71
  %store_forwarded = phi i64 [ %93, %.lr.ph71 ], [ %store_forwarded.unr, %.lr.ph71.prol.loopexit ]
  %indvars.iv90 = phi i64 [ %indvars.iv.next91.3, %.lr.ph71 ], [ %indvars.iv90.unr, %.lr.ph71.prol.loopexit ]
  %79 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %indvars.iv90
  %80 = load i64, ptr %79, align 8, !tbaa !11
  %81 = add nsw i64 %80, %store_forwarded
  %82 = getelementptr inbounds [200000 x i64], ptr @sfx, i64 0, i64 %indvars.iv90
  store i64 %81, ptr %82, align 8, !tbaa !11
  %indvars.iv.next91 = add nsw i64 %indvars.iv90, -1
  %83 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %indvars.iv.next91
  %84 = load i64, ptr %83, align 8, !tbaa !11
  %85 = add nsw i64 %84, %81
  %86 = getelementptr inbounds [200000 x i64], ptr @sfx, i64 0, i64 %indvars.iv.next91
  store i64 %85, ptr %86, align 8, !tbaa !11
  %indvars.iv.next91.1 = add nsw i64 %indvars.iv90, -2
  %87 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %indvars.iv.next91.1
  %88 = load i64, ptr %87, align 8, !tbaa !11
  %89 = add nsw i64 %88, %85
  %90 = getelementptr inbounds [200000 x i64], ptr @sfx, i64 0, i64 %indvars.iv.next91.1
  store i64 %89, ptr %90, align 8, !tbaa !11
  %indvars.iv.next91.2 = add nsw i64 %indvars.iv90, -3
  %91 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %indvars.iv.next91.2
  %92 = load i64, ptr %91, align 8, !tbaa !11
  %93 = add nsw i64 %92, %89
  %94 = getelementptr inbounds [200000 x i64], ptr @sfx, i64 0, i64 %indvars.iv.next91.2
  store i64 %93, ptr %94, align 8, !tbaa !11
  %indvars.iv.next91.3 = add nsw i64 %indvars.iv90, -4
  %.not112.3 = icmp eq i64 %indvars.iv.next91.2, 0
  br i1 %.not112.3, label %._crit_edge72, label %.lr.ph71, !llvm.loop !19

._crit_edge76.unr-lcssa:                          ; preds = %137, %.lr.ph75.preheader
  %.unr119 = phi i64 [ %.pre, %.lr.ph75.preheader ], [ %130, %137 ]
  %indvars.iv93.unr = phi i64 [ 1, %.lr.ph75.preheader ], [ %indvars.iv.next94.1, %137 ]
  %lcmp.mod120.not = icmp eq i64 %xtraiter117, 0
  br i1 %lcmp.mod120.not, label %._crit_edge76, label %.lr.ph75.epil

.lr.ph75.epil:                                    ; preds = %._crit_edge76.unr-lcssa
  %95 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %indvars.iv93.unr
  %96 = load i64, ptr %95, align 8, !tbaa !11
  %97 = icmp eq i64 %96, %.unr119
  br i1 %97, label %98, label %._crit_edge76

98:                                               ; preds = %.lr.ph75.epil
  %99 = add nsw i64 %indvars.iv93.unr, -1
  %100 = getelementptr inbounds [200000 x i32], ptr @psame, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !8
  %102 = add nsw i32 %101, 1
  %103 = getelementptr inbounds [200000 x i32], ptr @psame, i64 0, i64 %indvars.iv93.unr
  store i32 %102, ptr %103, align 4, !tbaa !8
  br label %._crit_edge76

._crit_edge76:                                    ; preds = %.lr.ph75.epil, %98, %._crit_edge76.unr-lcssa
  br i1 %76, label %.lr.ph80.preheader, label %._crit_edge81

.lr.ph80.preheader:                               ; preds = %._crit_edge76
  %104 = add nsw i32 %75, -2
  %105 = zext i32 %104 to i64
  %106 = and i64 %105, 1
  %lcmp.mod124.not.not = icmp eq i64 %106, 0
  br i1 %lcmp.mod124.not.not, label %.lr.ph80.prol, label %.lr.ph80.prol.loopexit

.lr.ph80.prol:                                    ; preds = %.lr.ph80.preheader
  %107 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %105
  %108 = load i64, ptr %107, align 8, !tbaa !11
  %109 = or disjoint i64 %105, 1
  %110 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %109
  %111 = load i64, ptr %110, align 8, !tbaa !11
  %112 = icmp eq i64 %108, %111
  br i1 %112, label %113, label %.lr.ph80.prol.loopexit.unr-lcssa

113:                                              ; preds = %.lr.ph80.prol
  %114 = getelementptr inbounds [200000 x i32], ptr @ssame, i64 0, i64 %109
  %115 = load i32, ptr %114, align 4, !tbaa !8
  %116 = add nsw i32 %115, 1
  %117 = getelementptr inbounds [200000 x i32], ptr @ssame, i64 0, i64 %105
  store i32 %116, ptr %117, align 4, !tbaa !8
  br label %.lr.ph80.prol.loopexit.unr-lcssa

.lr.ph80.prol.loopexit.unr-lcssa:                 ; preds = %113, %.lr.ph80.prol
  %indvars.iv.next99.prol = add nsw i64 %105, -1
  br label %.lr.ph80.prol.loopexit

.lr.ph80.prol.loopexit:                           ; preds = %.lr.ph80.prol.loopexit.unr-lcssa, %.lr.ph80.preheader
  %indvars.iv98.unr = phi i64 [ %105, %.lr.ph80.preheader ], [ %indvars.iv.next99.prol, %.lr.ph80.prol.loopexit.unr-lcssa ]
  %118 = icmp eq i32 %104, 0
  br i1 %118, label %._crit_edge81, label %.lr.ph80

.lr.ph75:                                         ; preds = %137, %.lr.ph75.preheader.new
  %119 = phi i64 [ %.pre, %.lr.ph75.preheader.new ], [ %130, %137 ]
  %indvars.iv93 = phi i64 [ 1, %.lr.ph75.preheader.new ], [ %indvars.iv.next94.1, %137 ]
  %niter122 = phi i64 [ 0, %.lr.ph75.preheader.new ], [ %niter122.next.1, %137 ]
  %120 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %indvars.iv93
  %121 = load i64, ptr %120, align 8, !tbaa !11
  %122 = icmp eq i64 %121, %119
  br i1 %122, label %123, label %.lr.ph75.1

123:                                              ; preds = %.lr.ph75
  %124 = add nsw i64 %indvars.iv93, -1
  %125 = getelementptr inbounds [200000 x i32], ptr @psame, i64 0, i64 %124
  %126 = load i32, ptr %125, align 4, !tbaa !8
  %127 = add nsw i32 %126, 1
  %128 = getelementptr inbounds [200000 x i32], ptr @psame, i64 0, i64 %indvars.iv93
  store i32 %127, ptr %128, align 4, !tbaa !8
  br label %.lr.ph75.1

.lr.ph75.1:                                       ; preds = %.lr.ph75, %123
  %indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1
  %129 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %indvars.iv.next94
  %130 = load i64, ptr %129, align 8, !tbaa !11
  %131 = icmp eq i64 %130, %121
  br i1 %131, label %132, label %137

132:                                              ; preds = %.lr.ph75.1
  %133 = getelementptr inbounds [200000 x i32], ptr @psame, i64 0, i64 %indvars.iv93
  %134 = load i32, ptr %133, align 4, !tbaa !8
  %135 = add nsw i32 %134, 1
  %136 = getelementptr inbounds [200000 x i32], ptr @psame, i64 0, i64 %indvars.iv.next94
  store i32 %135, ptr %136, align 4, !tbaa !8
  br label %137

137:                                              ; preds = %132, %.lr.ph75.1
  %indvars.iv.next94.1 = add nuw nsw i64 %indvars.iv93, 2
  %niter122.next.1 = add i64 %niter122, 2
  %niter122.ncmp.1 = icmp eq i64 %niter122.next.1, %unroll_iter121
  br i1 %niter122.ncmp.1, label %._crit_edge76.unr-lcssa, label %.lr.ph75, !llvm.loop !20

._crit_edge81:                                    ; preds = %.lr.ph80.prol.loopexit, %158, %._crit_edge72, %._crit_edge76
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  store i64 100000000000000000, ptr %3, align 8, !tbaa !11
  %138 = icmp sgt i32 %75, 0
  br i1 %138, label %.lr.ph84.preheader, label %._crit_edge85

.lr.ph84.preheader:                               ; preds = %._crit_edge81
  %.pre104 = load i32, ptr @K, align 4, !tbaa !8
  br label %.lr.ph84

.lr.ph80:                                         ; preds = %.lr.ph80.prol.loopexit, %158
  %indvars.iv98 = phi i64 [ %indvars.iv.next99.1, %158 ], [ %indvars.iv98.unr, %.lr.ph80.prol.loopexit ]
  %139 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %indvars.iv98
  %140 = load i64, ptr %139, align 8, !tbaa !11
  %141 = add nuw nsw i64 %indvars.iv98, 1
  %142 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %141
  %143 = load i64, ptr %142, align 8, !tbaa !11
  %144 = icmp eq i64 %140, %143
  br i1 %144, label %145, label %.lr.ph80.1

145:                                              ; preds = %.lr.ph80
  %146 = getelementptr inbounds [200000 x i32], ptr @ssame, i64 0, i64 %141
  %147 = load i32, ptr %146, align 4, !tbaa !8
  %148 = add nsw i32 %147, 1
  %149 = getelementptr inbounds [200000 x i32], ptr @ssame, i64 0, i64 %indvars.iv98
  store i32 %148, ptr %149, align 4, !tbaa !8
  br label %.lr.ph80.1

.lr.ph80.1:                                       ; preds = %.lr.ph80, %145
  %indvars.iv.next99 = add nsw i64 %indvars.iv98, -1
  %150 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %indvars.iv.next99
  %151 = load i64, ptr %150, align 8, !tbaa !11
  %152 = icmp eq i64 %151, %140
  br i1 %152, label %153, label %158

153:                                              ; preds = %.lr.ph80.1
  %154 = getelementptr inbounds [200000 x i32], ptr @ssame, i64 0, i64 %indvars.iv98
  %155 = load i32, ptr %154, align 4, !tbaa !8
  %156 = add nsw i32 %155, 1
  %157 = getelementptr inbounds [200000 x i32], ptr @ssame, i64 0, i64 %indvars.iv.next99
  store i32 %156, ptr %157, align 4, !tbaa !8
  br label %158

158:                                              ; preds = %153, %.lr.ph80.1
  %indvars.iv.next99.1 = add nsw i64 %indvars.iv98, -2
  %159 = icmp sgt i64 %indvars.iv98, 1
  br i1 %159, label %.lr.ph80, label %._crit_edge81, !llvm.loop !21

._crit_edge85:                                    ; preds = %221, %._crit_edge81
  %160 = phi i64 [ 100000000000000000, %._crit_edge81 ], [ %222, %221 ]
  %161 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %160)
  %162 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %161, ptr noundef nonnull @.str)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  ret i32 0

.lr.ph84:                                         ; preds = %.lr.ph84.preheader, %221
  %163 = phi i32 [ %.pre104, %.lr.ph84.preheader ], [ %219, %221 ]
  %indvars.iv101 = phi i64 [ 0, %.lr.ph84.preheader ], [ %indvars.iv.next102, %221 ]
  %164 = phi i32 [ %75, %.lr.ph84.preheader ], [ %223, %221 ]
  %165 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %indvars.iv101
  %166 = load i64, ptr %165, align 8, !tbaa !11
  %indvars.iv.next102 = add nuw nsw i64 %indvars.iv101, 1
  %167 = mul nsw i64 %166, %indvars.iv.next102
  %168 = getelementptr inbounds [200000 x i64], ptr @pfx, i64 0, i64 %indvars.iv101
  %169 = load i64, ptr %168, align 8, !tbaa !11
  %170 = sub nsw i64 %167, %169
  %171 = getelementptr inbounds [200000 x i64], ptr @sfx, i64 0, i64 %indvars.iv101
  %172 = load i64, ptr %171, align 8, !tbaa !11
  %173 = trunc nuw nsw i64 %indvars.iv101 to i32
  %174 = sub nsw i32 %164, %173
  %175 = sext i32 %174 to i64
  %176 = mul nsw i64 %166, %175
  %177 = sub nsw i64 %172, %176
  %178 = sext i32 %163 to i64
  %.not = icmp slt i64 %indvars.iv.next102, %178
  br i1 %.not, label %189, label %179

179:                                              ; preds = %.lr.ph84
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %180 = getelementptr inbounds [200000 x i32], ptr @psame, i64 0, i64 %indvars.iv101
  %181 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @K, ptr noundef nonnull align 4 dereferenceable(4) %180)
  %182 = load i32, ptr %181, align 4, !tbaa !8
  %183 = trunc nuw nsw i64 %indvars.iv.next102 to i32
  %184 = sub nsw i32 %183, %182
  %185 = sext i32 %184 to i64
  %186 = sub nsw i64 %170, %185
  store i64 %186, ptr %4, align 8, !tbaa !11
  %187 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %188 = load i64, ptr %187, align 8, !tbaa !11
  store i64 %188, ptr %3, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  %.pre105 = load i32, ptr @N, align 4, !tbaa !8
  %.pre106 = load i32, ptr @K, align 4, !tbaa !8
  %.pre108 = sub nsw i32 %.pre105, %173
  br label %189

189:                                              ; preds = %179, %.lr.ph84
  %.pre-phi = phi i32 [ %.pre108, %179 ], [ %174, %.lr.ph84 ]
  %190 = phi i32 [ %.pre106, %179 ], [ %163, %.lr.ph84 ]
  %191 = phi i32 [ %.pre105, %179 ], [ %164, %.lr.ph84 ]
  %.not57 = icmp slt i32 %.pre-phi, %190
  br i1 %.not57, label %202, label %192

192:                                              ; preds = %189
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %193 = getelementptr inbounds [200000 x i32], ptr @ssame, i64 0, i64 %indvars.iv101
  %194 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @K, ptr noundef nonnull align 4 dereferenceable(4) %193)
  %195 = load i32, ptr %194, align 4, !tbaa !8
  %196 = add i32 %195, %173
  %197 = sub i32 %191, %196
  %198 = sext i32 %197 to i64
  %199 = sub nsw i64 %177, %198
  store i64 %199, ptr %5, align 8, !tbaa !11
  %200 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %201 = load i64, ptr %200, align 8, !tbaa !11
  store i64 %201, ptr %3, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  %.pre107 = load i32, ptr @N, align 4, !tbaa !8
  br label %202

202:                                              ; preds = %192, %189
  %203 = phi i32 [ %.pre107, %192 ], [ %191, %189 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  %204 = add nsw i64 %177, %170
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #7
  %205 = getelementptr inbounds [200000 x i32], ptr @psame, i64 0, i64 %indvars.iv101
  %206 = load i32, ptr %205, align 4, !tbaa !8
  %207 = getelementptr inbounds [200000 x i32], ptr @ssame, i64 0, i64 %indvars.iv101
  %208 = load i32, ptr %207, align 4, !tbaa !8
  %209 = add i32 %206, -1
  %210 = add i32 %209, %208
  store i32 %210, ptr %7, align 4, !tbaa !8
  %211 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @K, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %212 = load i32, ptr %211, align 4, !tbaa !8
  %213 = sub nsw i32 %203, %212
  %214 = sext i32 %213 to i64
  %215 = sub i64 %204, %214
  store i64 %215, ptr %6, align 8, !tbaa !11
  %216 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %217 = load i64, ptr %216, align 8, !tbaa !11
  store i64 %217, ptr %3, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  %218 = load i32, ptr %205, align 4, !tbaa !8
  %219 = load i32, ptr @K, align 4, !tbaa !8
  %.not58 = icmp slt i32 %218, %219
  br i1 %.not58, label %221, label %220

220:                                              ; preds = %202
  store i64 0, ptr %3, align 8, !tbaa !11
  br label %221

221:                                              ; preds = %220, %202
  %222 = phi i64 [ 0, %220 ], [ %217, %202 ]
  %223 = load i32, ptr @N, align 4, !tbaa !8
  %224 = sext i32 %223 to i64
  %225 = icmp slt i64 %indvars.iv.next102, %224
  br i1 %225, label %.lr.ph84, label %._crit_edge85, !llvm.loop !22
}

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

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

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 #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 uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4 align 2

; 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 dso_local void @_ZSt4sortIPxEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #5

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

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

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

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

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

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

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


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