; LLVM IR from tangjz/acm-icpc :: lydsy/2907.ll (Z5solvev)

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@mx = external dso_local global i32, align 4
@a = external dso_local global [100001 x i32], align 16
@tot = external dso_local global i32, align 4
@ord = external dso_local global [100001 x i32], align 16
@rnk = external dso_local global [100001 x i32], align 16
@pL = external dso_local global [100001 x i32], align 16
@pR = external dso_local global [100001 x i32], align 16

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3cmpRKiS0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z5solvev() #2 {
  %1 = alloca i64, align 8
  %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 i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = load i32, ptr @m, align 4, !tbaa !5
  %15 = load i32, ptr @n, align 4, !tbaa !5
  %16 = icmp eq i32 %14, %15
  br i1 %16, label %28, label %17

17:                                               ; preds = %0
  %18 = load i32, ptr @mx, align 4, !tbaa !5
  %19 = load i32, ptr @n, align 4, !tbaa !5
  %20 = sub nsw i32 %19, 1
  %21 = icmp eq i32 %18, %20
  br i1 %21, label %28, label %22

22:                                               ; preds = %17
  %23 = load i32, ptr @m, align 4, !tbaa !5
  %24 = icmp sgt i32 %23, 1
  br i1 %24, label %25, label %29

25:                                               ; preds = %22
  %26 = load i32, ptr @mx, align 4, !tbaa !5
  %27 = icmp ne i32 %26, 0
  br i1 %27, label %29, label %28

28:                                               ; preds = %25, %17, %0
  store i64 3000000000, ptr %1, align 8
  br label %267

29:                                               ; preds = %25, %22
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  %30 = load i32, ptr @mx, align 4, !tbaa !5
  %31 = load i32, ptr @m, align 4, !tbaa !5
  %32 = sub nsw i32 %31, 1
  %33 = sub nsw i32 %30, %32
  store i32 %33, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  %34 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %35 = load i32, ptr %34, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  store i32 %35, ptr %2, align 4, !tbaa !5
  store i32 0, ptr @tot, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %36 = load i32, ptr @m, align 4, !tbaa !5
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr %5, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %49, %29
  %39 = load i32, ptr %5, align 4, !tbaa !5
  %40 = load i32, ptr @n, align 4, !tbaa !5
  %41 = icmp slt i32 %39, %40
  br i1 %41, label %43, label %42

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

43:                                               ; preds = %38
  %44 = load i32, ptr %5, align 4, !tbaa !5
  %45 = load i32, ptr @tot, align 4, !tbaa !5
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr @tot, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %47
  store i32 %44, ptr %48, align 4, !tbaa !5
  br label %49

49:                                               ; preds = %43
  %50 = load i32, ptr %5, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %5, align 4, !tbaa !5
  br label %38, !llvm.loop !9

52:                                               ; preds = %42
  %53 = load i32, ptr @tot, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds i32, ptr @ord, i64 %54
  %56 = getelementptr inbounds i32, ptr %55, i64 1
  call void @_ZSt4sortIPiPFbRKiS2_EEvT_S5_T0_(ptr noundef getelementptr inbounds (i32, ptr @ord, i64 1), ptr noundef %56, ptr noundef @_Z3cmpRKiS0_)
  store i32 0, ptr @ord, align 16, !tbaa !5
  %57 = load i32, ptr getelementptr inbounds ([100001 x i32], ptr @ord, i64 0, i64 1), align 4, !tbaa !5
  store i32 %57, ptr @pR, align 16, !tbaa !5
  %58 = load i32, ptr @n, align 4, !tbaa !5
  %59 = load i32, ptr @tot, align 4, !tbaa !5
  %60 = add nsw i32 %59, 1
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %61
  store i32 %58, ptr %62, align 4, !tbaa !5
  %63 = load i32, ptr @tot, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = load i32, ptr @n, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [100001 x i32], ptr @pL, i64 0, i64 %68
  store i32 %66, ptr %69, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %70

70:                                               ; preds = %105, %52
  %71 = load i32, ptr %6, align 4, !tbaa !5
  %72 = load i32, ptr @tot, align 4, !tbaa !5
  %73 = icmp sle i32 %71, %72
  br i1 %73, label %75, label %74

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

75:                                               ; preds = %70
  %76 = load i32, ptr %6, align 4, !tbaa !5
  %77 = load i32, ptr %6, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [100001 x i32], ptr @rnk, i64 0, i64 %81
  store i32 %76, ptr %82, align 4, !tbaa !5
  %83 = load i32, ptr %6, align 4, !tbaa !5
  %84 = sub nsw i32 %83, 1
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = load i32, ptr %6, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [100001 x i32], ptr @pL, i64 0, i64 %92
  store i32 %87, ptr %93, align 4, !tbaa !5
  %94 = load i32, ptr %6, align 4, !tbaa !5
  %95 = add nsw i32 %94, 1
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = load i32, ptr %6, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [100001 x i32], ptr @pR, i64 0, i64 %103
  store i32 %98, ptr %104, align 4, !tbaa !5
  br label %105

105:                                              ; preds = %75
  %106 = load i32, ptr %6, align 4, !tbaa !5
  %107 = add nsw i32 %106, 1
  store i32 %107, ptr %6, align 4, !tbaa !5
  br label %70, !llvm.loop !11

108:                                              ; preds = %74
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %109 = load i32, ptr @n, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !5
  %113 = load i32, ptr @n, align 4, !tbaa !5
  %114 = load i32, ptr %2, align 4, !tbaa !5
  %115 = sub nsw i32 %113, %114
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = sub nsw i32 %112, %118
  %120 = sext i32 %119 to i64
  store i64 %120, ptr %7, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %121

121:                                              ; preds = %143, %108
  %122 = load i32, ptr %10, align 4, !tbaa !5
  %123 = load i32, ptr %2, align 4, !tbaa !5
  %124 = icmp slt i32 %122, %123
  br i1 %124, label %126, label %125

125:                                              ; preds = %121
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %146

126:                                              ; preds = %121
  %127 = load i32, ptr %8, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [100001 x i32], ptr @pR, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !5
  store i32 %130, ptr %8, align 4, !tbaa !5
  %131 = load i32, ptr %8, align 4, !tbaa !5
  %132 = add nsw i32 %131, 1
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %133
  %135 = load i32, ptr %134, align 4, !tbaa !5
  %136 = load i32, ptr %8, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %137
  %139 = load i32, ptr %138, align 4, !tbaa !5
  %140 = sub nsw i32 %135, %139
  %141 = load i32, ptr %9, align 4, !tbaa !5
  %142 = add nsw i32 %141, %140
  store i32 %142, ptr %9, align 4, !tbaa !5
  br label %143

143:                                              ; preds = %126
  %144 = load i32, ptr %10, align 4, !tbaa !5
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %10, align 4, !tbaa !5
  br label %121, !llvm.loop !14

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

147:                                              ; preds = %246, %146
  %148 = load i32, ptr %11, align 4, !tbaa !5
  %149 = load i32, ptr %2, align 4, !tbaa !5
  %150 = icmp slt i32 %148, %149
  br i1 %150, label %152, label %151

151:                                              ; preds = %147
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %249

152:                                              ; preds = %147
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %153 = load i32, ptr @n, align 4, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %154
  %156 = load i32, ptr %155, align 4, !tbaa !5
  %157 = load i32, ptr @n, align 4, !tbaa !5
  %158 = load i32, ptr %11, align 4, !tbaa !5
  %159 = sub nsw i32 %157, %158
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %160
  %162 = load i32, ptr %161, align 4, !tbaa !5
  %163 = sub nsw i32 %156, %162
  %164 = sext i32 %163 to i64
  %165 = load i32, ptr %9, align 4, !tbaa !5
  %166 = sext i32 %165 to i64
  %167 = add nsw i64 %164, %166
  %168 = load i32, ptr %9, align 4, !tbaa !5
  %169 = sext i32 %168 to i64
  %170 = add nsw i64 %167, %169
  store i64 %170, ptr %12, align 8, !tbaa !12
  %171 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %172 = load i64, ptr %171, align 8, !tbaa !12
  store i64 %172, ptr %7, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %173 = load i32, ptr @n, align 4, !tbaa !5
  %174 = sub nsw i32 %173, 1
  %175 = load i32, ptr %11, align 4, !tbaa !5
  %176 = sub nsw i32 %174, %175
  store i32 %176, ptr %13, align 4, !tbaa !5
  %177 = load i32, ptr %13, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [100001 x i32], ptr @pL, i64 0, i64 %178
  %180 = load i32, ptr %179, align 4, !tbaa !5
  %181 = load i32, ptr %13, align 4, !tbaa !5
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [100001 x i32], ptr @pR, i64 0, i64 %182
  %184 = load i32, ptr %183, align 4, !tbaa !5
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [100001 x i32], ptr @pL, i64 0, i64 %185
  store i32 %180, ptr %186, align 4, !tbaa !5
  %187 = load i32, ptr %13, align 4, !tbaa !5
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds [100001 x i32], ptr @pR, i64 0, i64 %188
  %190 = load i32, ptr %189, align 4, !tbaa !5
  %191 = load i32, ptr %13, align 4, !tbaa !5
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds [100001 x i32], ptr @pL, i64 0, i64 %192
  %194 = load i32, ptr %193, align 4, !tbaa !5
  %195 = sext i32 %194 to i64
  %196 = getelementptr inbounds [100001 x i32], ptr @pR, i64 0, i64 %195
  store i32 %190, ptr %196, align 4, !tbaa !5
  %197 = load i32, ptr %13, align 4, !tbaa !5
  %198 = sext i32 %197 to i64
  %199 = getelementptr inbounds [100001 x i32], ptr @rnk, i64 0, i64 %198
  %200 = load i32, ptr %199, align 4, !tbaa !5
  %201 = load i32, ptr %8, align 4, !tbaa !5
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds [100001 x i32], ptr @rnk, i64 0, i64 %202
  %204 = load i32, ptr %203, align 4, !tbaa !5
  %205 = icmp sle i32 %200, %204
  br i1 %205, label %206, label %228

206:                                              ; preds = %152
  %207 = load i32, ptr %13, align 4, !tbaa !5
  %208 = add nsw i32 %207, 1
  %209 = sext i32 %208 to i64
  %210 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %209
  %211 = load i32, ptr %210, align 4, !tbaa !5
  %212 = load i32, ptr %13, align 4, !tbaa !5
  %213 = sext i32 %212 to i64
  %214 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %213
  %215 = load i32, ptr %214, align 4, !tbaa !5
  %216 = sub nsw i32 %211, %215
  %217 = load i32, ptr %9, align 4, !tbaa !5
  %218 = sub nsw i32 %217, %216
  store i32 %218, ptr %9, align 4, !tbaa !5
  %219 = load i32, ptr %13, align 4, !tbaa !5
  %220 = load i32, ptr %8, align 4, !tbaa !5
  %221 = icmp eq i32 %219, %220
  br i1 %221, label %222, label %227

222:                                              ; preds = %206
  %223 = load i32, ptr %8, align 4, !tbaa !5
  %224 = sext i32 %223 to i64
  %225 = getelementptr inbounds [100001 x i32], ptr @pL, i64 0, i64 %224
  %226 = load i32, ptr %225, align 4, !tbaa !5
  store i32 %226, ptr %8, align 4, !tbaa !5
  br label %227

227:                                              ; preds = %222, %206
  br label %245

228:                                              ; preds = %152
  %229 = load i32, ptr %8, align 4, !tbaa !5
  %230 = add nsw i32 %229, 1
  %231 = sext i32 %230 to i64
  %232 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %231
  %233 = load i32, ptr %232, align 4, !tbaa !5
  %234 = load i32, ptr %8, align 4, !tbaa !5
  %235 = sext i32 %234 to i64
  %236 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %235
  %237 = load i32, ptr %236, align 4, !tbaa !5
  %238 = sub nsw i32 %233, %237
  %239 = load i32, ptr %9, align 4, !tbaa !5
  %240 = sub nsw i32 %239, %238
  store i32 %240, ptr %9, align 4, !tbaa !5
  %241 = load i32, ptr %8, align 4, !tbaa !5
  %242 = sext i32 %241 to i64
  %243 = getelementptr inbounds [100001 x i32], ptr @pL, i64 0, i64 %242
  %244 = load i32, ptr %243, align 4, !tbaa !5
  store i32 %244, ptr %8, align 4, !tbaa !5
  br label %245

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

246:                                              ; preds = %245
  %247 = load i32, ptr %11, align 4, !tbaa !5
  %248 = add nsw i32 %247, 1
  store i32 %248, ptr %11, align 4, !tbaa !5
  br label %147, !llvm.loop !15

249:                                              ; preds = %151
  %250 = load i32, ptr @n, align 4, !tbaa !5
  %251 = sext i32 %250 to i64
  %252 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %251
  %253 = load i32, ptr %252, align 4, !tbaa !5
  %254 = load i32, ptr getelementptr inbounds ([100001 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
  %255 = sub nsw i32 %253, %254
  %256 = load i32, ptr @m, align 4, !tbaa !5
  %257 = sext i32 %256 to i64
  %258 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %257
  %259 = load i32, ptr %258, align 4, !tbaa !5
  %260 = add nsw i32 %255, %259
  %261 = load i32, ptr getelementptr inbounds ([100001 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
  %262 = sub nsw i32 %260, %261
  %263 = sext i32 %262 to i64
  %264 = load i64, ptr %7, align 8, !tbaa !12
  %265 = add nsw i64 %264, %263
  store i64 %265, ptr %7, align 8, !tbaa !12
  %266 = load i64, ptr %7, align 8, !tbaa !12
  store i64 %266, ptr %1, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %267

267:                                              ; preds = %249, %28
  %268 = load i64, ptr %1, align 8
  ret i64 %268
}

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

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

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

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


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

@n = external dso_local local_unnamed_addr global i32, align 4
@m = external dso_local local_unnamed_addr global i32, align 4
@mx = external dso_local local_unnamed_addr global i32, align 4
@a = external dso_local local_unnamed_addr global [100001 x i32], align 16
@tot = external dso_local local_unnamed_addr global i32, align 4
@ord = external dso_local global [100001 x i32], align 16
@rnk = external dso_local local_unnamed_addr global [100001 x i32], align 16
@pL = external dso_local local_unnamed_addr global [100001 x i32], align 16
@pR = external dso_local local_unnamed_addr global [100001 x i32], align 16

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3cmpRKiS0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z5solvev() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = load i32, ptr @m, align 4, !tbaa !5
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %7 = icmp eq i32 %5, %6
  br i1 %7, label %185, label %8

8:                                                ; preds = %0
  %9 = load i32, ptr @mx, align 4
  %10 = add nsw i32 %6, -1
  %11 = icmp eq i32 %9, %10
  br i1 %11, label %185, label %12

12:                                               ; preds = %8
  %13 = icmp slt i32 %5, 2
  %14 = icmp ne i32 %9, 0
  %or.cond = or i1 %13, %14
  br i1 %or.cond, label %15, label %185

15:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %reass.sub = sub i32 %9, %5
  %16 = add i32 %reass.sub, 1
  store i32 %16, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  %17 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %18 = load i32, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  store i32 0, ptr @tot, align 4, !tbaa !5
  %19 = load i32, ptr @m, align 4, !tbaa !5
  %20 = load i32, ptr @n, align 4, !tbaa !5
  %.05162 = add nsw i32 %19, 1
  %21 = icmp slt i32 %.05162, %20
  br i1 %21, label %.lr.ph.preheader, label %29

.lr.ph.preheader:                                 ; preds = %15
  %22 = xor i32 %19, -1
  %23 = add i32 %20, %22
  %wide.trip.count = zext i32 %23 to i64
  %min.iters.check = icmp ult i32 %23, 8
  br i1 %min.iters.check, label %.lr.ph.preheader106, label %vector.ph

.lr.ph.preheader106:                              ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  %.05163.ph = phi i32 [ %.05162, %.lr.ph.preheader ], [ %ind.end, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %wide.trip.count, 4294967288
  %.cast = trunc nuw i64 %n.vec to i32
  %ind.end = add i32 %.05162, %.cast
  %.splatinsert = insertelement <4 x i32> poison, i32 %.05162, i64 0
  %.splat = shufflevector <4 x i32> %.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  %induction = add <4 x i32> %.splat, <i32 0, i32 1, i32 2, i32 3>
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <4 x i32> [ %induction, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
  %24 = or disjoint i64 %index, 1
  %25 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %24
  %26 = getelementptr inbounds i8, ptr %25, i64 16
  store <4 x i32> %vec.ind, ptr %25, align 4, !tbaa !5
  store <4 x i32> %step.add, ptr %26, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
  %27 = icmp eq i64 %index.next, %n.vec
  br i1 %27, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader106

._crit_edge:                                      ; preds = %.lr.ph, %middle.block
  store i32 %23, ptr @tot, align 4, !tbaa !5
  %28 = sext i32 %23 to i64
  br label %29

29:                                               ; preds = %._crit_edge, %15
  %30 = phi i64 [ %28, %._crit_edge ], [ 0, %15 ]
  %31 = getelementptr inbounds i32, ptr @ord, i64 %30
  %32 = getelementptr inbounds i8, ptr %31, i64 4
  call void @_ZSt4sortIPiPFbRKiS2_EEvT_S5_T0_(ptr noundef nonnull getelementptr inbounds (i8, ptr @ord, i64 4), ptr noundef nonnull %32, ptr noundef nonnull @_Z3cmpRKiS0_)
  store i32 0, ptr @ord, align 16, !tbaa !5
  %33 = load i32, ptr getelementptr inbounds (i8, ptr @ord, i64 4), align 4, !tbaa !5
  store i32 %33, ptr @pR, align 16, !tbaa !5
  %34 = load i32, ptr @n, align 4, !tbaa !5
  %35 = load i32, ptr @tot, align 4, !tbaa !5
  %36 = add i32 %35, 1
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %37
  store i32 %34, ptr %38, align 4, !tbaa !5
  %39 = sext i32 %35 to i64
  %40 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = sext i32 %34 to i64
  %43 = getelementptr inbounds [100001 x i32], ptr @pL, i64 0, i64 %42
  store i32 %41, ptr %43, align 4, !tbaa !5
  %.not64 = icmp slt i32 %35, 1
  br i1 %.not64, label %._crit_edge68, label %.lr.ph67.preheader

.lr.ph67.preheader:                               ; preds = %29
  %wide.trip.count87 = zext i32 %36 to i64
  %.pre = load i32, ptr getelementptr inbounds (i8, ptr @ord, i64 4), align 4, !tbaa !5
  %44 = add nsw i64 %wide.trip.count87, -1
  %xtraiter = and i64 %44, 1
  %45 = icmp eq i32 %36, 2
  br i1 %45, label %._crit_edge68.loopexit.unr-lcssa, label %.lr.ph67.preheader.new

.lr.ph67.preheader.new:                           ; preds = %.lr.ph67.preheader
  %unroll_iter = and i64 %44, -2
  br label %.lr.ph67

.lr.ph:                                           ; preds = %.lr.ph.preheader106, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader106 ]
  %.05163 = phi i32 [ %.051, %.lr.ph ], [ %.05163.ph, %.lr.ph.preheader106 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %46 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %indvars.iv.next
  store i32 %.05163, ptr %46, align 4, !tbaa !5
  %.051 = add nsw i32 %.05163, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !13

._crit_edge68.loopexit.unr-lcssa:                 ; preds = %.lr.ph67, %.lr.ph67.preheader
  %.unr = phi i32 [ %.pre, %.lr.ph67.preheader ], [ %85, %.lr.ph67 ]
  %indvars.iv84.unr = phi i64 [ 1, %.lr.ph67.preheader ], [ %indvars.iv.next85.1, %.lr.ph67 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge68, label %.lr.ph67.epil

.lr.ph67.epil:                                    ; preds = %._crit_edge68.loopexit.unr-lcssa
  %47 = sext i32 %.unr to i64
  %48 = getelementptr inbounds [100001 x i32], ptr @rnk, i64 0, i64 %47
  %49 = trunc nuw nsw i64 %indvars.iv84.unr to i32
  store i32 %49, ptr %48, align 4, !tbaa !5
  %50 = add nsw i64 %indvars.iv84.unr, -1
  %51 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = getelementptr inbounds [100001 x i32], ptr @pL, i64 0, i64 %47
  store i32 %52, ptr %53, align 4, !tbaa !5
  %indvars.iv.next85.epil = add nuw nsw i64 %indvars.iv84.unr, 1
  %54 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %indvars.iv.next85.epil
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = getelementptr inbounds [100001 x i32], ptr @pR, i64 0, i64 %47
  store i32 %55, ptr %56, align 4, !tbaa !5
  br label %._crit_edge68

._crit_edge68:                                    ; preds = %.lr.ph67.epil, %._crit_edge68.loopexit.unr-lcssa, %29
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %57 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %42
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = sub nsw i32 %34, %18
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = sub nsw i32 %58, %62
  %64 = sext i32 %63 to i64
  store i64 %64, ptr %3, align 8, !tbaa !14
  %65 = icmp sgt i32 %18, 0
  br i1 %65, label %.lr.ph73.preheader, label %._crit_edge79

.lr.ph73.preheader:                               ; preds = %._crit_edge68
  %xtraiter107 = and i32 %18, 1
  %66 = icmp eq i32 %18, 1
  br i1 %66, label %.preheader.unr-lcssa, label %.lr.ph73.preheader.new

.lr.ph73.preheader.new:                           ; preds = %.lr.ph73.preheader
  %unroll_iter111 = and i32 %18, 2147483646
  br label %.lr.ph73

.lr.ph67:                                         ; preds = %.lr.ph67, %.lr.ph67.preheader.new
  %67 = phi i32 [ %.pre, %.lr.ph67.preheader.new ], [ %85, %.lr.ph67 ]
  %indvars.iv84 = phi i64 [ 1, %.lr.ph67.preheader.new ], [ %indvars.iv.next85.1, %.lr.ph67 ]
  %niter = phi i64 [ 0, %.lr.ph67.preheader.new ], [ %niter.next.1, %.lr.ph67 ]
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [100001 x i32], ptr @rnk, i64 0, i64 %68
  %70 = trunc nuw nsw i64 %indvars.iv84 to i32
  store i32 %70, ptr %69, align 4, !tbaa !5
  %71 = add nsw i64 %indvars.iv84, -1
  %72 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = getelementptr inbounds [100001 x i32], ptr @pL, i64 0, i64 %68
  store i32 %73, ptr %74, align 4, !tbaa !5
  %indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
  %75 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %indvars.iv.next85
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = getelementptr inbounds [100001 x i32], ptr @pR, i64 0, i64 %68
  store i32 %76, ptr %77, align 4, !tbaa !5
  %78 = sext i32 %76 to i64
  %79 = getelementptr inbounds [100001 x i32], ptr @rnk, i64 0, i64 %78
  %80 = trunc nuw nsw i64 %indvars.iv.next85 to i32
  store i32 %80, ptr %79, align 4, !tbaa !5
  %81 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %indvars.iv84
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = getelementptr inbounds [100001 x i32], ptr @pL, i64 0, i64 %78
  store i32 %82, ptr %83, align 4, !tbaa !5
  %indvars.iv.next85.1 = add nuw nsw i64 %indvars.iv84, 2
  %84 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %indvars.iv.next85.1
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = getelementptr inbounds [100001 x i32], ptr @pR, i64 0, i64 %78
  store i32 %85, ptr %86, align 4, !tbaa !5
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge68.loopexit.unr-lcssa, label %.lr.ph67, !llvm.loop !16

.preheader.unr-lcssa.loopexit:                    ; preds = %.lr.ph73
  %87 = sext i32 %112 to i64
  br label %.preheader.unr-lcssa

.preheader.unr-lcssa:                             ; preds = %.preheader.unr-lcssa.loopexit, %.lr.ph73.preheader
  %.lcssa105.ph = phi i32 [ poison, %.lr.ph73.preheader ], [ %112, %.preheader.unr-lcssa.loopexit ]
  %.lcssa104.ph = phi i32 [ poison, %.lr.ph73.preheader ], [ %122, %.preheader.unr-lcssa.loopexit ]
  %.04670.unr = phi i32 [ 0, %.lr.ph73.preheader ], [ %122, %.preheader.unr-lcssa.loopexit ]
  %.04769.unr = phi i64 [ 0, %.lr.ph73.preheader ], [ %87, %.preheader.unr-lcssa.loopexit ]
  %lcmp.mod108.not = icmp eq i32 %xtraiter107, 0
  br i1 %lcmp.mod108.not, label %.preheader, label %.lr.ph73.epil

.lr.ph73.epil:                                    ; preds = %.preheader.unr-lcssa
  %88 = getelementptr inbounds [100001 x i32], ptr @pR, i64 0, i64 %.04769.unr
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = add nsw i32 %89, 1
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %91
  %93 = load i32, ptr %92, align 4, !tbaa !5
  %94 = sext i32 %89 to i64
  %95 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = add i32 %93, %.04670.unr
  %98 = sub i32 %97, %96
  br label %.preheader

.preheader:                                       ; preds = %.preheader.unr-lcssa, %.lr.ph73.epil
  %.lcssa105 = phi i32 [ %.lcssa105.ph, %.preheader.unr-lcssa ], [ %89, %.lr.ph73.epil ]
  %.lcssa104 = phi i32 [ %.lcssa104.ph, %.preheader.unr-lcssa ], [ %98, %.lr.ph73.epil ]
  br i1 %65, label %.lr.ph78, label %._crit_edge79

.lr.ph73:                                         ; preds = %.lr.ph73, %.lr.ph73.preheader.new
  %.04670 = phi i32 [ 0, %.lr.ph73.preheader.new ], [ %122, %.lr.ph73 ]
  %.04769 = phi i32 [ 0, %.lr.ph73.preheader.new ], [ %112, %.lr.ph73 ]
  %niter112 = phi i32 [ 0, %.lr.ph73.preheader.new ], [ %niter112.next.1, %.lr.ph73 ]
  %99 = sext i32 %.04769 to i64
  %100 = getelementptr inbounds [100001 x i32], ptr @pR, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = add nsw i32 %101, 1
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = sext i32 %101 to i64
  %107 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = add i32 %105, %.04670
  %110 = sext i32 %101 to i64
  %111 = getelementptr inbounds [100001 x i32], ptr @pR, i64 0, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !5
  %113 = add nsw i32 %112, 1
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %114
  %116 = load i32, ptr %115, align 4, !tbaa !5
  %117 = sext i32 %112 to i64
  %118 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = add i32 %109, %116
  %121 = add i32 %108, %119
  %122 = sub i32 %120, %121
  %niter112.next.1 = add i32 %niter112, 2
  %niter112.ncmp.1 = icmp eq i32 %niter112.next.1, %unroll_iter111
  br i1 %niter112.ncmp.1, label %.preheader.unr-lcssa.loopexit, label %.lr.ph73, !llvm.loop !17

._crit_edge79.loopexit:                           ; preds = %183
  %.pre91 = sext i32 %149 to i64
  %.phi.trans.insert = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %.pre91
  %.pre92 = load i32, ptr %.phi.trans.insert, align 4, !tbaa !5
  br label %._crit_edge79

._crit_edge79:                                    ; preds = %._crit_edge68, %._crit_edge79.loopexit, %.preheader
  %123 = phi i64 [ %148, %._crit_edge79.loopexit ], [ %64, %.preheader ], [ %64, %._crit_edge68 ]
  %124 = phi i32 [ %.pre92, %._crit_edge79.loopexit ], [ %58, %.preheader ], [ %58, %._crit_edge68 ]
  %125 = load i32, ptr getelementptr inbounds (i8, ptr @a, i64 4), align 4, !tbaa !5
  %126 = load i32, ptr @m, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %127
  %129 = load i32, ptr %128, align 4, !tbaa !5
  %130 = shl i32 %125, 1
  %131 = sub i32 %124, %130
  %132 = add i32 %131, %129
  %133 = sext i32 %132 to i64
  %134 = add nsw i64 %123, %133
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  br label %185

.lr.ph78:                                         ; preds = %.preheader, %183
  %135 = phi i32 [ %149, %183 ], [ %34, %.preheader ]
  %.04477 = phi i32 [ %184, %183 ], [ 0, %.preheader ]
  %.176 = phi i32 [ %.2, %183 ], [ %.lcssa104, %.preheader ]
  %.14875 = phi i32 [ %.249, %183 ], [ %.lcssa105, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %136
  %138 = load i32, ptr %137, align 4, !tbaa !5
  %139 = sub nsw i32 %135, %.04477
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %140
  %142 = load i32, ptr %141, align 4, !tbaa !5
  %143 = sub nsw i32 %138, %142
  %144 = sext i32 %143 to i64
  %145 = sext i32 %.176 to i64
  %reass.add = shl nsw i64 %145, 1
  %146 = add nsw i64 %reass.add, %144
  store i64 %146, ptr %4, align 8, !tbaa !14
  %147 = 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)
  %148 = load i64, ptr %147, align 8, !tbaa !14
  store i64 %148, ptr %3, align 8, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  %149 = load i32, ptr @n, align 4, !tbaa !5
  %150 = xor i32 %.04477, -1
  %151 = add i32 %149, %150
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [100001 x i32], ptr @pL, i64 0, i64 %152
  %154 = load i32, ptr %153, align 4, !tbaa !5
  %155 = getelementptr inbounds [100001 x i32], ptr @pR, i64 0, i64 %152
  %156 = load i32, ptr %155, align 4, !tbaa !5
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [100001 x i32], ptr @pL, i64 0, i64 %157
  store i32 %154, ptr %158, align 4, !tbaa !5
  %159 = sext i32 %154 to i64
  %160 = getelementptr inbounds [100001 x i32], ptr @pR, i64 0, i64 %159
  store i32 %156, ptr %160, align 4, !tbaa !5
  %161 = getelementptr inbounds [100001 x i32], ptr @rnk, i64 0, i64 %152
  %162 = load i32, ptr %161, align 4, !tbaa !5
  %163 = sext i32 %.14875 to i64
  %164 = getelementptr inbounds [100001 x i32], ptr @rnk, i64 0, i64 %163
  %165 = load i32, ptr %164, align 4, !tbaa !5
  %.not56 = icmp sgt i32 %162, %165
  br i1 %.not56, label %174, label %166

166:                                              ; preds = %.lr.ph78
  %167 = sub i32 %149, %.04477
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %168
  %170 = load i32, ptr %169, align 4, !tbaa !5
  %171 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %152
  %172 = load i32, ptr %171, align 4, !tbaa !5
  %.neg57 = sub i32 %172, %170
  %173 = icmp eq i32 %151, %.14875
  br i1 %173, label %.sink.split, label %183

174:                                              ; preds = %.lr.ph78
  %175 = add nsw i32 %.14875, 1
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %176
  %178 = load i32, ptr %177, align 4, !tbaa !5
  %179 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %163
  %180 = load i32, ptr %179, align 4, !tbaa !5
  %.neg = sub i32 %180, %178
  br label %.sink.split

.sink.split:                                      ; preds = %166, %174
  %.neg57.pn.ph = phi i32 [ %.neg, %174 ], [ %.neg57, %166 ]
  %181 = getelementptr inbounds [100001 x i32], ptr @pL, i64 0, i64 %163
  %182 = load i32, ptr %181, align 4, !tbaa !5
  br label %183

183:                                              ; preds = %.sink.split, %166
  %.249 = phi i32 [ %.14875, %166 ], [ %182, %.sink.split ]
  %.neg57.pn = phi i32 [ %.neg57, %166 ], [ %.neg57.pn.ph, %.sink.split ]
  %.2 = add i32 %.neg57.pn, %.176
  %184 = add nuw nsw i32 %.04477, 1
  %exitcond90.not = icmp eq i32 %184, %18
  br i1 %exitcond90.not, label %._crit_edge79.loopexit, label %.lr.ph78, !llvm.loop !18

185:                                              ; preds = %0, %8, %12, %._crit_edge79
  %.0 = phi i64 [ %134, %._crit_edge79 ], [ 3000000000, %12 ], [ 3000000000, %8 ], [ 3000000000, %0 ]
  ret i64 %.0
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiPFbRKiS2_EEvT_S5_T0_(ptr noundef, 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 #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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = { nounwind }

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

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


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