; LLVM IR from tangjz/acm-icpc :: codeforces/complete (1175G)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.anon = type { i8 }
%"struct.std::pair" = type { i32, i32 }

@sL = external dso_local global [40003 x %"class.std::vector"], align 16
@sR = external dso_local global [40003 x %"class.std::vector"], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [20003 x i32], align 16
@pL = external dso_local global [20001 x i32], align 16
@pR = external dso_local global [20001 x i32], align 16
@ord = external dso_local global [20001 x i32], align 16
@f = external dso_local global [2 x [20001 x i32]], align 16
@cur = external dso_local global i32, align 4
@pre = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

; 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
declare dso_local void @_Z7seg_updiiiSt4pairIiiE(i32 noundef, i32 noundef, i32 noundef, i64) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7seg_idxii(i32 noundef, i32 noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z7seg_queiiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z7seg_updiiiiSt4pairIiiE(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i64) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z7seg_queiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #4 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %class.anon, align 1
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %"class.std::vector", align 8
  %11 = alloca %"class.std::vector", align 8
  %12 = alloca i32, align 4
  %13 = alloca %"struct.std::pair", align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca %"struct.std::pair", align 4
  %19 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  %21 = load i32, ptr @n, align 4, !tbaa !5
  %22 = add nsw i32 %21, 1
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [20003 x i32], ptr @a, i64 0, i64 %23
  store i32 1061109567, ptr %24, align 4, !tbaa !5
  store i32 1061109567, ptr @a, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %25

25:                                               ; preds = %71, %0
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = load i32, ptr @n, align 4, !tbaa !5
  %28 = icmp sle i32 %26, %27
  br i1 %28, label %30, label %29

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

30:                                               ; preds = %25
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds i32, ptr @a, i64 %32
  %34 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef %33)
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = load i32, ptr %2, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [20001 x i32], ptr @pL, i64 0, i64 %37
  store i32 %35, ptr %38, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %54, %30
  %40 = load i32, ptr %2, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [20001 x i32], ptr @pL, i64 0, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %44 = sub nsw i32 %43, 1
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [20003 x i32], ptr @a, i64 0, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = load i32, ptr %2, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [20003 x i32], ptr @a, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = icmp slt i32 %47, %51
  br i1 %52, label %53, label %66

53:                                               ; preds = %39
  br label %54

54:                                               ; preds = %53
  %55 = load i32, ptr %2, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [20001 x i32], ptr @pL, i64 0, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = sub nsw i32 %58, 1
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [20001 x i32], ptr @pL, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = load i32, ptr %2, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [20001 x i32], ptr @pL, i64 0, i64 %64
  store i32 %62, ptr %65, align 4, !tbaa !5
  br label %39, !llvm.loop !9

66:                                               ; preds = %39
  %67 = load i32, ptr %2, align 4, !tbaa !5
  %68 = load i32, ptr %2, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [20001 x i32], ptr @ord, i64 0, i64 %69
  store i32 %67, ptr %70, align 4, !tbaa !5
  br label %71

71:                                               ; preds = %66
  %72 = load i32, ptr %2, align 4, !tbaa !5
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %2, align 4, !tbaa !5
  br label %25, !llvm.loop !11

74:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  %75 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %75, ptr %3, align 4, !tbaa !5
  br label %76

76:                                               ; preds = %113, %74
  %77 = load i32, ptr %3, align 4, !tbaa !5
  %78 = icmp sge i32 %77, 1
  br i1 %78, label %80, label %79

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

80:                                               ; preds = %76
  %81 = load i32, ptr %3, align 4, !tbaa !5
  %82 = load i32, ptr %3, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [20001 x i32], ptr @pR, i64 0, i64 %83
  store i32 %81, ptr %84, align 4, !tbaa !5
  br label %85

85:                                               ; preds = %100, %80
  %86 = load i32, ptr %3, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [20001 x i32], ptr @pR, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = add nsw i32 %89, 1
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [20003 x i32], ptr @a, i64 0, i64 %91
  %93 = load i32, ptr %92, align 4, !tbaa !5
  %94 = load i32, ptr %3, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [20003 x i32], ptr @a, i64 0, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = icmp sle i32 %93, %97
  br i1 %98, label %99, label %112

99:                                               ; preds = %85
  br label %100

100:                                              ; preds = %99
  %101 = load i32, ptr %3, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [20001 x i32], ptr @pR, i64 0, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = add nsw i32 %104, 1
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [20001 x i32], ptr @pR, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = load i32, ptr %3, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [20001 x i32], ptr @pR, i64 0, i64 %110
  store i32 %108, ptr %111, align 4, !tbaa !5
  br label %85, !llvm.loop !12

112:                                              ; preds = %85
  br label %113

113:                                              ; preds = %112
  %114 = load i32, ptr %3, align 4, !tbaa !5
  %115 = add nsw i32 %114, -1
  store i32 %115, ptr %3, align 4, !tbaa !5
  br label %76, !llvm.loop !13

116:                                              ; preds = %79
  %117 = load i32, ptr @n, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds i32, ptr @ord, i64 %118
  %120 = getelementptr inbounds i32, ptr %119, i64 1
  call void @"_ZSt4sortIPiZ4mainE3$_0EvT_S2_T0_"(ptr noundef getelementptr inbounds (i32, ptr @ord, i64 1), ptr noundef %120)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %121

121:                                              ; preds = %137, %116
  %122 = load i32, ptr %5, align 4, !tbaa !5
  %123 = load i32, ptr @n, align 4, !tbaa !5
  %124 = icmp sle i32 %122, %123
  br i1 %124, label %126, label %125

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

126:                                              ; preds = %121
  %127 = load i32, ptr %5, align 4, !tbaa !5
  %128 = icmp ne i32 %127, 0
  %129 = zext i1 %128 to i64
  %130 = select i1 %128, i32 1061109567, i32 0
  %131 = load i32, ptr @cur, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [2 x [20001 x i32]], ptr @f, i64 0, i64 %132
  %134 = load i32, ptr %5, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [20001 x i32], ptr %133, i64 0, i64 %135
  store i32 %130, ptr %136, align 4, !tbaa !5
  br label %137

137:                                              ; preds = %126
  %138 = load i32, ptr %5, align 4, !tbaa !5
  %139 = add nsw i32 %138, 1
  store i32 %139, ptr %5, align 4, !tbaa !5
  br label %121, !llvm.loop !14

140:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %141

141:                                              ; preds = %249, %140
  %142 = load i32, ptr %6, align 4, !tbaa !5
  %143 = load i32, ptr @m, align 4, !tbaa !5
  %144 = icmp sle i32 %142, %143
  br i1 %144, label %146, label %145

145:                                              ; preds = %141
  store i32 17, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  br label %252

146:                                              ; preds = %141
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) @cur, ptr noundef nonnull align 4 dereferenceable(4) @pre) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  %147 = call noundef i32 @_Z7seg_idxii(i32 noundef 1, i32 noundef 1)
  store i32 %147, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  %148 = load i32, ptr @n, align 4, !tbaa !5
  %149 = load i32, ptr @n, align 4, !tbaa !5
  %150 = call noundef i32 @_Z7seg_idxii(i32 noundef %148, i32 noundef %149)
  store i32 %150, ptr %9, align 4, !tbaa !5
  br label %151

151:                                              ; preds = %163, %146
  %152 = load i32, ptr %8, align 4, !tbaa !5
  %153 = load i32, ptr %9, align 4, !tbaa !5
  %154 = icmp sle i32 %152, %153
  br i1 %154, label %156, label %155

155:                                              ; preds = %151
  store i32 20, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  br label %166

156:                                              ; preds = %151
  call void @llvm.lifetime.start.p0(i64 24, ptr %10) #8
  call void @llvm.memset.p0.i64(ptr align 8 %10, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #8
  %157 = load i32, ptr %8, align 4, !tbaa !5
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [40003 x %"class.std::vector"], ptr @sL, i64 0, i64 %158
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE4swapERS3_(ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 8 dereferenceable(24) %159) #8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #8
  call void @llvm.memset.p0.i64(ptr align 8 %11, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #8
  %160 = load i32, ptr %8, align 4, !tbaa !5
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [40003 x %"class.std::vector"], ptr @sR, i64 0, i64 %161
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE4swapERS3_(ptr noundef nonnull align 8 dereferenceable(24) %11, ptr noundef nonnull align 8 dereferenceable(24) %162) #8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #8
  br label %163

163:                                              ; preds = %156
  %164 = load i32, ptr %8, align 4, !tbaa !5
  %165 = add nsw i32 %164, 1
  store i32 %165, ptr %8, align 4, !tbaa !5
  br label %151, !llvm.loop !15

166:                                              ; preds = %155
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  %167 = load i32, ptr @n, align 4, !tbaa !5
  %168 = sub nsw i32 %167, 1
  store i32 %168, ptr %12, align 4, !tbaa !5
  br label %169

169:                                              ; preds = %186, %166
  %170 = load i32, ptr %12, align 4, !tbaa !5
  %171 = icmp sge i32 %170, 0
  br i1 %171, label %173, label %172

172:                                              ; preds = %169
  store i32 23, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %189

173:                                              ; preds = %169
  %174 = load i32, ptr @n, align 4, !tbaa !5
  %175 = load i32, ptr %12, align 4, !tbaa !5
  %176 = add nsw i32 %175, 1
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  %177 = load i32, ptr %12, align 4, !tbaa !5
  %178 = sub nsw i32 0, %177
  store i32 %178, ptr %14, align 4, !tbaa !5
  %179 = load i32, ptr @pre, align 4, !tbaa !5
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [2 x [20001 x i32]], ptr @f, i64 0, i64 %180
  %182 = load i32, ptr %12, align 4, !tbaa !5
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [20001 x i32], ptr %181, i64 0, i64 %183
  call void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %13, ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 4 dereferenceable(4) %184)
  %185 = load i64, ptr %13, align 4
  call void @_Z7seg_updiiiSt4pairIiiE(i32 noundef 1, i32 noundef %174, i32 noundef %176, i64 %185)
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  br label %186

186:                                              ; preds = %173
  %187 = load i32, ptr %12, align 4, !tbaa !5
  %188 = add nsw i32 %187, -1
  store i32 %188, ptr %12, align 4, !tbaa !5
  br label %169, !llvm.loop !16

189:                                              ; preds = %172
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  store i32 1, ptr %15, align 4, !tbaa !5
  br label %190

190:                                              ; preds = %221, %189
  %191 = load i32, ptr %15, align 4, !tbaa !5
  %192 = load i32, ptr @n, align 4, !tbaa !5
  %193 = icmp sle i32 %191, %192
  br i1 %193, label %195, label %194

194:                                              ; preds = %190
  store i32 26, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  br label %224

195:                                              ; preds = %190
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  %196 = load i32, ptr %15, align 4, !tbaa !5
  %197 = sext i32 %196 to i64
  %198 = getelementptr inbounds [20001 x i32], ptr @ord, i64 0, i64 %197
  %199 = load i32, ptr %198, align 4, !tbaa !5
  store i32 %199, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  %200 = load i32, ptr @n, align 4, !tbaa !5
  %201 = load i32, ptr %16, align 4, !tbaa !5
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds [20001 x i32], ptr @pL, i64 0, i64 %202
  %204 = load i32, ptr %203, align 4, !tbaa !5
  %205 = load i32, ptr %16, align 4, !tbaa !5
  %206 = load i32, ptr %16, align 4, !tbaa !5
  %207 = sext i32 %206 to i64
  %208 = getelementptr inbounds [20003 x i32], ptr @a, i64 0, i64 %207
  %209 = load i32, ptr %208, align 4, !tbaa !5
  %210 = call noundef i32 @_Z7seg_queiiiii(i32 noundef 1, i32 noundef %200, i32 noundef %204, i32 noundef %205, i32 noundef %209)
  store i32 %210, ptr %17, align 4, !tbaa !5
  %211 = load i32, ptr @n, align 4, !tbaa !5
  %212 = load i32, ptr %16, align 4, !tbaa !5
  %213 = load i32, ptr %16, align 4, !tbaa !5
  %214 = sext i32 %213 to i64
  %215 = getelementptr inbounds [20001 x i32], ptr @pR, i64 0, i64 %214
  %216 = load i32, ptr %215, align 4, !tbaa !5
  %217 = load i32, ptr %16, align 4, !tbaa !5
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds [20003 x i32], ptr @a, i64 0, i64 %218
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %18, ptr noundef nonnull align 4 dereferenceable(4) %219, ptr noundef nonnull align 4 dereferenceable(4) %17)
  %220 = load i64, ptr %18, align 4
  call void @_Z7seg_updiiiiSt4pairIiiE(i32 noundef 1, i32 noundef %211, i32 noundef %212, i32 noundef %216, i64 %220)
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  br label %221

221:                                              ; preds = %195
  %222 = load i32, ptr %15, align 4, !tbaa !5
  %223 = add nsw i32 %222, 1
  store i32 %223, ptr %15, align 4, !tbaa !5
  br label %190, !llvm.loop !17

224:                                              ; preds = %194
  %225 = load i32, ptr @cur, align 4, !tbaa !5
  %226 = sext i32 %225 to i64
  %227 = getelementptr inbounds [2 x [20001 x i32]], ptr @f, i64 0, i64 %226
  %228 = getelementptr inbounds [20001 x i32], ptr %227, i64 0, i64 0
  store i32 1061109567, ptr %228, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #8
  store i32 1, ptr %19, align 4, !tbaa !5
  br label %229

229:                                              ; preds = %245, %224
  %230 = load i32, ptr %19, align 4, !tbaa !5
  %231 = load i32, ptr @n, align 4, !tbaa !5
  %232 = icmp sle i32 %230, %231
  br i1 %232, label %234, label %233

233:                                              ; preds = %229
  store i32 29, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  br label %248

234:                                              ; preds = %229
  %235 = load i32, ptr @n, align 4, !tbaa !5
  %236 = load i32, ptr %19, align 4, !tbaa !5
  %237 = load i32, ptr %19, align 4, !tbaa !5
  %238 = call noundef i32 @_Z7seg_queiiii(i32 noundef 1, i32 noundef %235, i32 noundef %236, i32 noundef %237)
  %239 = load i32, ptr @cur, align 4, !tbaa !5
  %240 = sext i32 %239 to i64
  %241 = getelementptr inbounds [2 x [20001 x i32]], ptr @f, i64 0, i64 %240
  %242 = load i32, ptr %19, align 4, !tbaa !5
  %243 = sext i32 %242 to i64
  %244 = getelementptr inbounds [20001 x i32], ptr %241, i64 0, i64 %243
  store i32 %238, ptr %244, align 4, !tbaa !5
  br label %245

245:                                              ; preds = %234
  %246 = load i32, ptr %19, align 4, !tbaa !5
  %247 = add nsw i32 %246, 1
  store i32 %247, ptr %19, align 4, !tbaa !5
  br label %229, !llvm.loop !18

248:                                              ; preds = %233
  br label %249

249:                                              ; preds = %248
  %250 = load i32, ptr %6, align 4, !tbaa !5
  %251 = add nsw i32 %250, 1
  store i32 %251, ptr %6, align 4, !tbaa !5
  br label %141, !llvm.loop !19

252:                                              ; preds = %145
  %253 = load i32, ptr @cur, align 4, !tbaa !5
  %254 = sext i32 %253 to i64
  %255 = getelementptr inbounds [2 x [20001 x i32]], ptr @f, i64 0, i64 %254
  %256 = load i32, ptr @n, align 4, !tbaa !5
  %257 = sext i32 %256 to i64
  %258 = getelementptr inbounds [20001 x i32], ptr %255, i64 0, i64 %257
  %259 = load i32, ptr %258, align 4, !tbaa !5
  %260 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %259)
  ret i32 0
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #5

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIPiZ4mainE3$_0EvT_S2_T0_"(ptr noundef, ptr noundef) #6

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #0 align 2

declare i32 @printf(ptr noundef, ...) #5

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 = { 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 #5 = { "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 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { 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 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}


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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }

@sL = external dso_local global [40003 x %"class.std::vector"], align 16
@sR = external dso_local global [40003 x %"class.std::vector"], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [20003 x i32], align 16
@pL = external dso_local local_unnamed_addr global [20001 x i32], align 16
@pR = external dso_local local_unnamed_addr global [20001 x i32], align 16
@ord = external dso_local global [20001 x i32], align 16
@f = external dso_local global [2 x [20001 x i32]], align 16
@cur = external dso_local global i32, align 4
@pre = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

; 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
declare dso_local void @_Z7seg_updiiiSt4pairIiiE(i32 noundef, i32 noundef, i32 noundef, i64) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7seg_idxii(i32 noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z7seg_queiiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z7seg_updiiiiSt4pairIiiE(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i64) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z7seg_queiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 {
  %1 = alloca %"class.std::vector", align 8
  %2 = alloca %"class.std::vector", align 8
  %3 = alloca %"struct.std::pair", align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::pair", align 8
  %7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %8 = load i32, ptr @n, align 4, !tbaa !5
  %9 = add nsw i32 %8, 1
  %10 = sext i32 %9 to i64
  %11 = getelementptr inbounds [20003 x i32], ptr @a, i64 0, i64 %10
  store i32 1061109567, ptr %11, align 4, !tbaa !5
  store i32 1061109567, ptr @a, align 16, !tbaa !5
  %.not68 = icmp slt i32 %8, 1
  br i1 %.not68, label %.preheader67.._crit_edge78_crit_edge, label %.lr.ph71

.preheader67:                                     ; preds = %._crit_edge
  %12 = icmp sgt i32 %32, 0
  br i1 %12, label %.lr.ph77.preheader, label %.preheader67.._crit_edge78_crit_edge

.preheader67.._crit_edge78_crit_edge:             ; preds = %0, %.preheader67
  %.lcssa129 = phi i32 [ %32, %.preheader67 ], [ %8, %0 ]
  %.pre127 = sext i32 %.lcssa129 to i64
  br label %._crit_edge78

.lr.ph77.preheader:                               ; preds = %.preheader67
  %13 = zext nneg i32 %32 to i64
  br label %.lr.ph77

.lr.ph71:                                         ; preds = %0, %._crit_edge
  %indvars.iv = phi i64 [ %indvars.iv.next, %._crit_edge ], [ 1, %0 ]
  %14 = getelementptr inbounds i32, ptr @a, i64 %indvars.iv
  %15 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %14)
  %16 = getelementptr inbounds [20001 x i32], ptr @pL, i64 0, i64 %indvars.iv
  %17 = load i32, ptr %14, align 4, !tbaa !5
  %18 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %18, ptr %16, align 4, !tbaa !5
  %19 = add nsw i64 %indvars.iv, -1
  %20 = getelementptr inbounds [20003 x i32], ptr @a, i64 0, i64 %19
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = icmp slt i32 %21, %17
  br i1 %22, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph71, %.lr.ph
  %23 = phi i64 [ %27, %.lr.ph ], [ %19, %.lr.ph71 ]
  %24 = getelementptr inbounds [20001 x i32], ptr @pL, i64 0, i64 %23
  %25 = load i32, ptr %24, align 4, !tbaa !5
  store i32 %25, ptr %16, align 4, !tbaa !5
  %26 = add nsw i32 %25, -1
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [20003 x i32], ptr @a, i64 0, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = icmp slt i32 %29, %17
  br i1 %30, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph71
  %31 = getelementptr inbounds [20001 x i32], ptr @ord, i64 0, i64 %indvars.iv
  store i32 %18, ptr %31, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %32 = load i32, ptr @n, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %.not.not = icmp slt i64 %indvars.iv, %33
  br i1 %.not.not, label %.lr.ph71, label %.preheader67, !llvm.loop !11

._crit_edge78:                                    ; preds = %._crit_edge75, %.preheader67.._crit_edge78_crit_edge
  %.pre-phi = phi i64 [ %.pre127, %.preheader67.._crit_edge78_crit_edge ], [ %13, %._crit_edge75 ]
  %34 = getelementptr inbounds i32, ptr @ord, i64 %.pre-phi
  %35 = getelementptr inbounds i8, ptr %34, i64 4
  tail call void @"_ZSt4sortIPiZ4mainE3$_0EvT_S2_T0_"(ptr noundef nonnull getelementptr inbounds (i8, ptr @ord, i64 4), ptr noundef nonnull %35)
  %36 = load i32, ptr @n, align 4, !tbaa !5
  %.not5879 = icmp slt i32 %36, 0
  br i1 %.not5879, label %.preheader66, label %.lr.ph82

.lr.ph82:                                         ; preds = %._crit_edge78
  %37 = load i32, ptr @cur, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = add nuw i32 %36, 1
  %wide.trip.count = zext i32 %39 to i64
  %40 = getelementptr inbounds [2 x [20001 x i32]], ptr @f, i64 0, i64 %38, i64 0
  store i32 0, ptr %40, align 4, !tbaa !5
  %exitcond.peel.not = icmp eq i32 %36, 0
  br i1 %exitcond.peel.not, label %.preheader66, label %.peel.next.preheader

.peel.next.preheader:                             ; preds = %.lr.ph82
  %41 = zext nneg i32 %36 to i64
  %min.iters.check = icmp ult i32 %36, 8
  br i1 %min.iters.check, label %.peel.next.preheader146, label %vector.ph

.peel.next.preheader146:                          ; preds = %middle.block, %.peel.next.preheader
  %indvars.iv109.ph = phi i64 [ 1, %.peel.next.preheader ], [ %ind.end, %middle.block ]
  br label %.peel.next

vector.ph:                                        ; preds = %.peel.next.preheader
  %n.vec = and i64 %41, 2147483640
  %ind.end = or disjoint i64 %n.vec, 1
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %42 = getelementptr inbounds [2 x [20001 x i32]], ptr @f, i64 0, i64 %38, i64 %offset.idx
  %43 = getelementptr inbounds i8, ptr %42, i64 16
  store <4 x i32> <i32 1061109567, i32 1061109567, i32 1061109567, i32 1061109567>, ptr %42, align 4, !tbaa !5
  store <4 x i32> <i32 1061109567, i32 1061109567, i32 1061109567, i32 1061109567>, ptr %43, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %44 = icmp eq i64 %index.next, %n.vec
  br i1 %44, label %middle.block, label %vector.body, !llvm.loop !12

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %41
  br i1 %cmp.n, label %.preheader66, label %.peel.next.preheader146

.lr.ph77:                                         ; preds = %.lr.ph77.preheader, %._crit_edge75
  %indvars.iv106 = phi i64 [ %13, %.lr.ph77.preheader ], [ %indvars.iv.next107, %._crit_edge75 ]
  %45 = getelementptr inbounds [20001 x i32], ptr @pR, i64 0, i64 %indvars.iv106
  %46 = getelementptr inbounds [20003 x i32], ptr @a, i64 0, i64 %indvars.iv106
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = trunc nuw nsw i64 %indvars.iv106 to i32
  store i32 %48, ptr %45, align 4, !tbaa !5
  %49 = add nuw nsw i64 %indvars.iv106, 1
  %50 = getelementptr inbounds [20003 x i32], ptr @a, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %.not6472 = icmp sgt i32 %51, %47
  br i1 %.not6472, label %._crit_edge75, label %.lr.ph74

.lr.ph74:                                         ; preds = %.lr.ph77, %.lr.ph74
  %52 = phi i64 [ %56, %.lr.ph74 ], [ %49, %.lr.ph77 ]
  %53 = getelementptr inbounds [20001 x i32], ptr @pR, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  store i32 %54, ptr %45, align 4, !tbaa !5
  %55 = add nsw i32 %54, 1
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [20003 x i32], ptr @a, i64 0, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %.not64 = icmp sgt i32 %58, %47
  br i1 %.not64, label %._crit_edge75, label %.lr.ph74, !llvm.loop !16

._crit_edge75:                                    ; preds = %.lr.ph74, %.lr.ph77
  %indvars.iv.next107 = add nsw i64 %indvars.iv106, -1
  %59 = icmp sgt i64 %indvars.iv106, 1
  br i1 %59, label %.lr.ph77, label %._crit_edge78, !llvm.loop !17

.preheader66:                                     ; preds = %.peel.next, %middle.block, %.lr.ph82, %._crit_edge78
  %60 = load i32, ptr @m, align 4, !tbaa !5
  %.not59100 = icmp slt i32 %60, 1
  br i1 %.not59100, label %.preheader66.._crit_edge103_crit_edge, label %.lr.ph102

.preheader66.._crit_edge103_crit_edge:            ; preds = %.preheader66
  %.pre126 = load i32, ptr @cur, align 4, !tbaa !5
  br label %._crit_edge103

.peel.next:                                       ; preds = %.peel.next.preheader146, %.peel.next
  %indvars.iv109 = phi i64 [ %indvars.iv.next110, %.peel.next ], [ %indvars.iv109.ph, %.peel.next.preheader146 ]
  %61 = getelementptr inbounds [2 x [20001 x i32]], ptr @f, i64 0, i64 %38, i64 %indvars.iv109
  store i32 1061109567, ptr %61, align 4, !tbaa !5
  %indvars.iv.next110 = add nuw nsw i64 %indvars.iv109, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next110, %wide.trip.count
  br i1 %exitcond.not, label %.preheader66, label %.peel.next, !llvm.loop !18

._crit_edge103:                                   ; preds = %._crit_edge99, %.preheader66.._crit_edge103_crit_edge
  %62 = phi i32 [ %36, %.preheader66.._crit_edge103_crit_edge ], [ %109, %._crit_edge99 ]
  %63 = phi i32 [ %.pre126, %.preheader66.._crit_edge103_crit_edge ], [ %110, %._crit_edge99 ]
  %64 = sext i32 %63 to i64
  %65 = sext i32 %62 to i64
  %66 = getelementptr inbounds [2 x [20001 x i32]], ptr @f, i64 0, i64 %64, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %67)
  ret i32 0

.lr.ph102:                                        ; preds = %.preheader66, %._crit_edge99
  %.054101 = phi i32 [ %111, %._crit_edge99 ], [ 1, %.preheader66 ]
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) @cur, ptr noundef nonnull align 4 dereferenceable(4) @pre) #8
  %69 = call noundef i32 @_Z7seg_idxii(i32 noundef 1, i32 noundef 1)
  %70 = load i32, ptr @n, align 4, !tbaa !5
  %71 = call noundef i32 @_Z7seg_idxii(i32 noundef %70, i32 noundef %70)
  %.not6083 = icmp sgt i32 %69, %71
  br i1 %.not6083, label %._crit_edge87, label %.lr.ph86.preheader

.lr.ph86.preheader:                               ; preds = %.lr.ph102
  %72 = sext i32 %69 to i64
  %73 = add i32 %71, 1
  br label %.lr.ph86

._crit_edge87:                                    ; preds = %.lr.ph86, %.lr.ph102
  %74 = load i32, ptr @n, align 4, !tbaa !5
  %75 = icmp sgt i32 %74, 0
  br i1 %75, label %.lr.ph90.preheader, label %._crit_edge94.thread

.lr.ph90.preheader:                               ; preds = %._crit_edge87
  %76 = zext nneg i32 %74 to i64
  br label %.lr.ph90

.lr.ph86:                                         ; preds = %.lr.ph86.preheader, %.lr.ph86
  %indvars.iv113 = phi i64 [ %72, %.lr.ph86.preheader ], [ %indvars.iv.next114, %.lr.ph86 ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %1) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %1, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #8
  %77 = getelementptr inbounds [40003 x %"class.std::vector"], ptr @sL, i64 0, i64 %indvars.iv113
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE4swapERS3_(ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %77) #8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %2, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #8
  %78 = getelementptr inbounds [40003 x %"class.std::vector"], ptr @sR, i64 0, i64 %indvars.iv113
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE4swapERS3_(ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(24) %78) #8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #8
  %indvars.iv.next114 = add nsw i64 %indvars.iv113, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next114 to i32
  %exitcond116.not = icmp eq i32 %73, %lftr.wideiv
  br i1 %exitcond116.not, label %._crit_edge87, label %.lr.ph86, !llvm.loop !19

.preheader:                                       ; preds = %.lr.ph90
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  %.not6191 = icmp slt i32 %.pre, 1
  br i1 %.not6191, label %._crit_edge94.thread, label %.lr.ph93

.lr.ph90:                                         ; preds = %.lr.ph90.preheader, %.lr.ph90
  %indvars.iv117 = phi i64 [ %76, %.lr.ph90.preheader ], [ %indvars.iv.next118, %.lr.ph90 ]
  %indvars.iv.next118 = add nsw i64 %indvars.iv117, -1
  %79 = load i32, ptr @n, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #8
  %80 = trunc i64 %indvars.iv117 to i32
  %81 = sub i32 1, %80
  store i32 %81, ptr %4, align 4, !tbaa !5
  %82 = load i32, ptr @pre, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [2 x [20001 x i32]], ptr @f, i64 0, i64 %83, i64 %indvars.iv.next118
  call void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %84)
  %85 = load i64, ptr %3, align 8
  %86 = trunc nuw nsw i64 %indvars.iv117 to i32
  call void @_Z7seg_updiiiSt4pairIiiE(i32 noundef 1, i32 noundef %79, i32 noundef %86, i64 %85)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #8
  %87 = icmp ugt i64 %indvars.iv117, 1
  br i1 %87, label %.lr.ph90, label %.preheader, !llvm.loop !20

._crit_edge94.thread:                             ; preds = %.preheader, %._crit_edge87
  %.ph = phi i32 [ %.pre, %.preheader ], [ %74, %._crit_edge87 ]
  %88 = load i32, ptr @cur, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [2 x [20001 x i32]], ptr @f, i64 0, i64 %89
  store i32 1061109567, ptr %90, align 4, !tbaa !5
  br label %._crit_edge99

._crit_edge94:                                    ; preds = %.lr.ph93
  %91 = load i32, ptr @cur, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [2 x [20001 x i32]], ptr @f, i64 0, i64 %92
  store i32 1061109567, ptr %93, align 4, !tbaa !5
  %.not6295 = icmp slt i32 %107, 1
  br i1 %.not6295, label %._crit_edge99, label %.lr.ph98

.lr.ph93:                                         ; preds = %.preheader, %.lr.ph93
  %indvars.iv120 = phi i64 [ %indvars.iv.next121, %.lr.ph93 ], [ 1, %.preheader ]
  %94 = phi i32 [ %107, %.lr.ph93 ], [ %.pre, %.preheader ]
  %95 = getelementptr inbounds [20001 x i32], ptr @ord, i64 0, i64 %indvars.iv120
  %96 = load i32, ptr %95, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #8
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [20001 x i32], ptr @pL, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = getelementptr inbounds [20003 x i32], ptr @a, i64 0, i64 %97
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = call noundef i32 @_Z7seg_queiiiii(i32 noundef 1, i32 noundef %94, i32 noundef %99, i32 noundef %96, i32 noundef %101)
  store i32 %102, ptr %5, align 4, !tbaa !5
  %103 = load i32, ptr @n, align 4, !tbaa !5
  %104 = getelementptr inbounds [20001 x i32], ptr @pR, i64 0, i64 %97
  %105 = load i32, ptr %104, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %6, ptr noundef nonnull align 4 dereferenceable(4) %100, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %106 = load i64, ptr %6, align 8
  call void @_Z7seg_updiiiiSt4pairIiiE(i32 noundef 1, i32 noundef %103, i32 noundef %96, i32 noundef %105, i64 %106)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  %indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1
  %107 = load i32, ptr @n, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %.not61.not = icmp slt i64 %indvars.iv120, %108
  br i1 %.not61.not, label %.lr.ph93, label %._crit_edge94, !llvm.loop !21

._crit_edge99:                                    ; preds = %.lr.ph98, %._crit_edge94.thread, %._crit_edge94
  %109 = phi i32 [ %107, %._crit_edge94 ], [ %.ph, %._crit_edge94.thread ], [ %119, %.lr.ph98 ]
  %110 = phi i32 [ %91, %._crit_edge94 ], [ %88, %._crit_edge94.thread ], [ %116, %.lr.ph98 ]
  %111 = add nuw nsw i32 %.054101, 1
  %112 = load i32, ptr @m, align 4, !tbaa !5
  %.not59.not = icmp slt i32 %.054101, %112
  br i1 %.not59.not, label %.lr.ph102, label %._crit_edge103, !llvm.loop !22

.lr.ph98:                                         ; preds = %._crit_edge94, %.lr.ph98
  %indvars.iv123 = phi i64 [ %indvars.iv.next124, %.lr.ph98 ], [ 1, %._crit_edge94 ]
  %113 = phi i32 [ %119, %.lr.ph98 ], [ %107, %._crit_edge94 ]
  %114 = trunc nuw nsw i64 %indvars.iv123 to i32
  %115 = call noundef i32 @_Z7seg_queiiii(i32 noundef 1, i32 noundef %113, i32 noundef %114, i32 noundef %114)
  %116 = load i32, ptr @cur, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [2 x [20001 x i32]], ptr @f, i64 0, i64 %117, i64 %indvars.iv123
  store i32 %115, ptr %118, align 4, !tbaa !5
  %indvars.iv.next124 = add nuw nsw i64 %indvars.iv123, 1
  %119 = load i32, ptr @n, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %.not62.not = icmp slt i64 %indvars.iv123, %120
  br i1 %.not62.not, label %.lr.ph98, label %._crit_edge99, !llvm.loop !23
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIPiZ4mainE3$_0EvT_S2_T0_"(ptr noundef, ptr noundef) local_unnamed_addr #6

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #0 align 2

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5

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 = { 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 #5 = { nofree nounwind "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 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { 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 = distinct !{!12, !10, !13, !14, !15}
!13 = !{!"llvm.loop.peeled.count", i32 1}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10, !13, !15, !14}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}


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