; LLVM IR from tangjz/acm-icpc :: openjudge/poj (C15J)

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

%"struct.std::pair" = type { i32, i32 }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::_Select1st<std::pair<const std::pair<int, int>, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::_Select1st<std::pair<const std::pair<int, int>, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }

@n = external dso_local global i32, align 4
@sz = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@fir = external dso_local global [100001 x i32], align 16
@ord = external dso_local global [100001 x i32], align 16
@idx = external dso_local global [100001 x i32], align 16
@pos = external dso_local global [100001 x i32], align 16
@a = external dso_local global [100001 x %"struct.std::pair"], align 16
@Hash = external dso_local global %"class.std::map", align 8
@vis = external dso_local global [100001 x i8], align 16
@ans = external dso_local global i64, align 8
@_ZN6fastIO7IOerrorE = external dso_local global i8, align 1
@.str = external hidden unnamed_addr constant [6 x i8], align 1

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

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

; 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 norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::map", align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %"struct.std::pair", align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  br label %16

16:                                               ; preds = %289, %0
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) @n)
  %17 = load i8, ptr @_ZN6fastIO7IOerrorE, align 1, !tbaa !5, !range !9, !noundef !10
  %18 = trunc i8 %17 to i1
  %19 = xor i1 %18, true
  br i1 %19, label %20, label %292

20:                                               ; preds = %16
  %21 = load i32, ptr @n, align 4, !tbaa !11
  %22 = sitofp i32 %21 to double
  %23 = fmul double %22, 1.000000e-01
  %24 = call double @sqrt(double noundef %23) #9
  %25 = call double @llvm.ceil.f64(double %24)
  %26 = fptosi double %25 to i32
  store i32 %26, ptr @sz, align 4, !tbaa !11
  store i32 0, ptr @m, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 48, ptr %2) #9
  call void @llvm.memset.p0.i64(ptr align 8 %2, i8 0, i64 48, i1 false)
  call void @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #9
  call void @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEE4swapERS7_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(48) @Hash) #9
  call void @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr %2) #9
  store i64 0, ptr @ans, align 8, !tbaa !13
  %27 = load i32, ptr @n, align 4, !tbaa !11
  %28 = sext i32 %27 to i64
  %29 = mul i64 %28, 1
  call void @llvm.memset.p0.i64(ptr align 16 @vis, i8 0, i64 %29, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #9
  store i32 0, ptr %3, align 4, !tbaa !11
  br label %30

30:                                               ; preds = %48, %20
  %31 = load i32, ptr %3, align 4, !tbaa !11
  %32 = load i32, ptr @n, align 4, !tbaa !11
  %33 = icmp slt i32 %31, %32
  br i1 %33, label %35, label %34

34:                                               ; preds = %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #9
  br label %51

35:                                               ; preds = %30
  %36 = load i32, ptr %3, align 4, !tbaa !11
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %37
  %39 = getelementptr inbounds %"struct.std::pair", ptr %38, i32 0, i32 0
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) %39)
  %40 = load i32, ptr %3, align 4, !tbaa !11
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %41
  %43 = getelementptr inbounds %"struct.std::pair", ptr %42, i32 0, i32 1
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) %43)
  %44 = load i32, ptr %3, align 4, !tbaa !11
  %45 = load i32, ptr %3, align 4, !tbaa !11
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %46
  store i32 %44, ptr %47, align 4, !tbaa !11
  br label %48

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

51:                                               ; preds = %34
  %52 = load i32, ptr @n, align 4, !tbaa !11
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %53
  %55 = getelementptr inbounds %"struct.std::pair", ptr %54, i32 0, i32 1
  store i32 2147483647, ptr %55, align 4, !tbaa !17
  %56 = load i32, ptr @n, align 4, !tbaa !11
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %57
  %59 = getelementptr inbounds %"struct.std::pair", ptr %58, i32 0, i32 0
  store i32 2147483647, ptr %59, align 8, !tbaa !19
  %60 = load i32, ptr @n, align 4, !tbaa !11
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds %"struct.std::pair", ptr @a, i64 %61
  call void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef @a, ptr noundef %62)
  %63 = load i32, ptr @n, align 4, !tbaa !11
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds i32, ptr @ord, i64 %64
  call void @_ZSt4sortIPiPFbRKiS2_EEvT_S5_T0_(ptr noundef @ord, ptr noundef %65, ptr noundef @_Z3cmpRKiS0_)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #9
  store i32 0, ptr %4, align 4, !tbaa !11
  br label %66

66:                                               ; preds = %99, %51
  %67 = load i32, ptr %4, align 4, !tbaa !11
  %68 = load i32, ptr @n, align 4, !tbaa !11
  %69 = icmp slt i32 %67, %68
  br i1 %69, label %71, label %70

70:                                               ; preds = %66
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #9
  br label %102

71:                                               ; preds = %66
  %72 = load i32, ptr %4, align 4, !tbaa !11
  %73 = icmp ne i32 %72, 0
  br i1 %73, label %74, label %87

74:                                               ; preds = %71
  %75 = load i32, ptr %4, align 4, !tbaa !11
  %76 = sub nsw i32 %75, 1
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %77
  %79 = getelementptr inbounds %"struct.std::pair", ptr %78, i32 0, i32 0
  %80 = load i32, ptr %79, align 8, !tbaa !19
  %81 = load i32, ptr %4, align 4, !tbaa !11
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %82
  %84 = getelementptr inbounds %"struct.std::pair", ptr %83, i32 0, i32 0
  %85 = load i32, ptr %84, align 8, !tbaa !19
  %86 = icmp ne i32 %80, %85
  br i1 %86, label %87, label %93

87:                                               ; preds = %74, %71
  %88 = load i32, ptr %4, align 4, !tbaa !11
  %89 = load i32, ptr @m, align 4, !tbaa !11
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr @m, align 4, !tbaa !11
  %91 = sext i32 %89 to i64
  %92 = getelementptr inbounds [100001 x i32], ptr @fir, i64 0, i64 %91
  store i32 %88, ptr %92, align 4, !tbaa !11
  br label %93

93:                                               ; preds = %87, %74
  %94 = load i32, ptr @m, align 4, !tbaa !11
  %95 = sub nsw i32 %94, 1
  %96 = load i32, ptr %4, align 4, !tbaa !11
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [100001 x i32], ptr @pos, i64 0, i64 %97
  store i32 %95, ptr %98, align 4, !tbaa !11
  br label %99

99:                                               ; preds = %93
  %100 = load i32, ptr %4, align 4, !tbaa !11
  %101 = add nsw i32 %100, 1
  store i32 %101, ptr %4, align 4, !tbaa !11
  br label %66, !llvm.loop !20

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

103:                                              ; preds = %119, %102
  %104 = load i32, ptr %5, align 4, !tbaa !11
  %105 = load i32, ptr @n, align 4, !tbaa !11
  %106 = icmp slt i32 %104, %105
  br i1 %106, label %108, label %107

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

108:                                              ; preds = %103
  %109 = load i32, ptr %5, align 4, !tbaa !11
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !11
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [100001 x i32], ptr @pos, i64 0, i64 %113
  %115 = load i32, ptr %114, align 4, !tbaa !11
  %116 = load i32, ptr %5, align 4, !tbaa !11
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [100001 x i32], ptr @idx, i64 0, i64 %117
  store i32 %115, ptr %118, align 4, !tbaa !11
  br label %119

119:                                              ; preds = %108
  %120 = load i32, ptr %5, align 4, !tbaa !11
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr %5, align 4, !tbaa !11
  br label %103, !llvm.loop !21

122:                                              ; preds = %107
  %123 = load i32, ptr @n, align 4, !tbaa !11
  %124 = load i32, ptr @m, align 4, !tbaa !11
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [100001 x i32], ptr @fir, i64 0, i64 %125
  store i32 %123, ptr %126, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #9
  store i32 0, ptr %6, align 4, !tbaa !11
  br label %127

127:                                              ; preds = %286, %122
  %128 = load i32, ptr %6, align 4, !tbaa !11
  %129 = load i32, ptr @m, align 4, !tbaa !11
  %130 = icmp slt i32 %128, %129
  br i1 %130, label %132, label %131

131:                                              ; preds = %127
  store i32 13, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #9
  br label %289

132:                                              ; preds = %127
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #9
  %133 = load i32, ptr %6, align 4, !tbaa !11
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [100001 x i32], ptr @fir, i64 0, i64 %134
  %136 = load i32, ptr %135, align 4, !tbaa !11
  store i32 %136, ptr %8, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #9
  %137 = load i32, ptr %6, align 4, !tbaa !11
  %138 = add nsw i32 %137, 1
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [100001 x i32], ptr @fir, i64 0, i64 %139
  %141 = load i32, ptr %140, align 4, !tbaa !11
  store i32 %141, ptr %9, align 4, !tbaa !11
  %142 = load i32, ptr %9, align 4, !tbaa !11
  %143 = load i32, ptr %8, align 4, !tbaa !11
  %144 = sub nsw i32 %142, %143
  %145 = load i32, ptr @sz, align 4, !tbaa !11
  %146 = icmp sle i32 %144, %145
  br i1 %146, label %147, label %186

147:                                              ; preds = %132
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #9
  %148 = load i32, ptr %8, align 4, !tbaa !11
  store i32 %148, ptr %10, align 4, !tbaa !11
  br label %149

149:                                              ; preds = %182, %147
  %150 = load i32, ptr %10, align 4, !tbaa !11
  %151 = load i32, ptr %9, align 4, !tbaa !11
  %152 = icmp slt i32 %150, %151
  br i1 %152, label %154, label %153

153:                                              ; preds = %149
  store i32 16, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #9
  br label %185

154:                                              ; preds = %149
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #9
  %155 = load i32, ptr %10, align 4, !tbaa !11
  %156 = add nsw i32 %155, 1
  store i32 %156, ptr %11, align 4, !tbaa !11
  br label %157

157:                                              ; preds = %178, %154
  %158 = load i32, ptr %11, align 4, !tbaa !11
  %159 = load i32, ptr %9, align 4, !tbaa !11
  %160 = icmp slt i32 %158, %159
  br i1 %160, label %162, label %161

161:                                              ; preds = %157
  store i32 19, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  br label %181

162:                                              ; preds = %157
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #9
  %163 = load i32, ptr %10, align 4, !tbaa !11
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %164
  %166 = getelementptr inbounds %"struct.std::pair", ptr %165, i32 0, i32 1
  %167 = load i32, ptr %11, align 4, !tbaa !11
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %168
  %170 = getelementptr inbounds %"struct.std::pair", ptr %169, i32 0, i32 1
  %171 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %166, ptr noundef nonnull align 4 dereferenceable(4) %170)
  store i64 %171, ptr %12, align 4
  %172 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(8) %12)
  %173 = load i32, ptr %172, align 4, !tbaa !11
  %174 = add nsw i32 %173, 1
  store i32 %174, ptr %172, align 4, !tbaa !11
  %175 = sext i32 %173 to i64
  %176 = load i64, ptr @ans, align 8, !tbaa !13
  %177 = add nsw i64 %176, %175
  store i64 %177, ptr @ans, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #9
  br label %178

178:                                              ; preds = %162
  %179 = load i32, ptr %11, align 4, !tbaa !11
  %180 = add nsw i32 %179, 1
  store i32 %180, ptr %11, align 4, !tbaa !11
  br label %157, !llvm.loop !22

181:                                              ; preds = %161
  br label %182

182:                                              ; preds = %181
  %183 = load i32, ptr %10, align 4, !tbaa !11
  %184 = add nsw i32 %183, 1
  store i32 %184, ptr %10, align 4, !tbaa !11
  br label %149, !llvm.loop !23

185:                                              ; preds = %153
  store i32 15, ptr %7, align 4
  br label %283

186:                                              ; preds = %132
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #9
  %187 = load i32, ptr %8, align 4, !tbaa !11
  store i32 %187, ptr %13, align 4, !tbaa !11
  br label %188

188:                                              ; preds = %197, %186
  %189 = load i32, ptr %13, align 4, !tbaa !11
  %190 = load i32, ptr %9, align 4, !tbaa !11
  %191 = icmp slt i32 %189, %190
  br i1 %191, label %193, label %192

192:                                              ; preds = %188
  store i32 22, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #9
  br label %200

193:                                              ; preds = %188
  %194 = load i32, ptr %13, align 4, !tbaa !11
  %195 = sext i32 %194 to i64
  %196 = getelementptr inbounds [100001 x i8], ptr @vis, i64 0, i64 %195
  store i8 1, ptr %196, align 1, !tbaa !5
  br label %197

197:                                              ; preds = %193
  %198 = load i32, ptr %13, align 4, !tbaa !11
  %199 = add nsw i32 %198, 1
  store i32 %199, ptr %13, align 4, !tbaa !11
  br label %188, !llvm.loop !24

200:                                              ; preds = %192
  %201 = load i32, ptr @m, align 4, !tbaa !11
  %202 = sext i32 %201 to i64
  %203 = mul i64 %202, 4
  call void @llvm.memset.p0.i64(ptr align 16 @pos, i8 0, i64 %203, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #9
  store i32 0, ptr %14, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #9
  %204 = load i32, ptr %8, align 4, !tbaa !11
  store i32 %204, ptr %15, align 4, !tbaa !11
  br label %205

205:                                              ; preds = %279, %200
  %206 = load i32, ptr %14, align 4, !tbaa !11
  %207 = load i32, ptr @n, align 4, !tbaa !11
  %208 = icmp slt i32 %206, %207
  br i1 %208, label %209, label %213

209:                                              ; preds = %205
  %210 = load i32, ptr %15, align 4, !tbaa !11
  %211 = load i32, ptr %9, align 4, !tbaa !11
  %212 = icmp slt i32 %210, %211
  br label %213

213:                                              ; preds = %209, %205
  %214 = phi i1 [ false, %205 ], [ %212, %209 ]
  br i1 %214, label %216, label %215

215:                                              ; preds = %213
  store i32 25, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #9
  br label %282

216:                                              ; preds = %213
  br label %217

217:                                              ; preds = %239, %216
  %218 = load i32, ptr %15, align 4, !tbaa !11
  %219 = load i32, ptr %9, align 4, !tbaa !11
  %220 = icmp slt i32 %218, %219
  br i1 %220, label %221, label %236

221:                                              ; preds = %217
  %222 = load i32, ptr %15, align 4, !tbaa !11
  %223 = sext i32 %222 to i64
  %224 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %223
  %225 = getelementptr inbounds %"struct.std::pair", ptr %224, i32 0, i32 1
  %226 = load i32, ptr %225, align 4, !tbaa !17
  %227 = load i32, ptr %14, align 4, !tbaa !11
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %228
  %230 = load i32, ptr %229, align 4, !tbaa !11
  %231 = sext i32 %230 to i64
  %232 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %231
  %233 = getelementptr inbounds %"struct.std::pair", ptr %232, i32 0, i32 1
  %234 = load i32, ptr %233, align 4, !tbaa !17
  %235 = icmp slt i32 %226, %234
  br label %236

236:                                              ; preds = %221, %217
  %237 = phi i1 [ false, %217 ], [ %235, %221 ]
  br i1 %237, label %238, label %242

238:                                              ; preds = %236
  br label %239

239:                                              ; preds = %238
  %240 = load i32, ptr %15, align 4, !tbaa !11
  %241 = add nsw i32 %240, 1
  store i32 %241, ptr %15, align 4, !tbaa !11
  br label %217, !llvm.loop !25

242:                                              ; preds = %236
  %243 = load i32, ptr %14, align 4, !tbaa !11
  %244 = sext i32 %243 to i64
  %245 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %244
  %246 = load i32, ptr %245, align 4, !tbaa !11
  %247 = sext i32 %246 to i64
  %248 = getelementptr inbounds [100001 x i8], ptr @vis, i64 0, i64 %247
  %249 = load i8, ptr %248, align 1, !tbaa !5, !range !9, !noundef !10
  %250 = trunc i8 %249 to i1
  br i1 %250, label %278, label %251

251:                                              ; preds = %242
  %252 = load i32, ptr %14, align 4, !tbaa !11
  %253 = sext i32 %252 to i64
  %254 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %253
  %255 = load i32, ptr %254, align 4, !tbaa !11
  %256 = sext i32 %255 to i64
  %257 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %256
  %258 = getelementptr inbounds %"struct.std::pair", ptr %257, i32 0, i32 1
  %259 = load i32, ptr %258, align 4, !tbaa !17
  %260 = load i32, ptr %15, align 4, !tbaa !11
  %261 = sext i32 %260 to i64
  %262 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %261
  %263 = getelementptr inbounds %"struct.std::pair", ptr %262, i32 0, i32 1
  %264 = load i32, ptr %263, align 4, !tbaa !17
  %265 = icmp eq i32 %259, %264
  br i1 %265, label %266, label %278

266:                                              ; preds = %251
  %267 = load i32, ptr %14, align 4, !tbaa !11
  %268 = sext i32 %267 to i64
  %269 = getelementptr inbounds [100001 x i32], ptr @idx, i64 0, i64 %268
  %270 = load i32, ptr %269, align 4, !tbaa !11
  %271 = sext i32 %270 to i64
  %272 = getelementptr inbounds [100001 x i32], ptr @pos, i64 0, i64 %271
  %273 = load i32, ptr %272, align 4, !tbaa !11
  %274 = add nsw i32 %273, 1
  store i32 %274, ptr %272, align 4, !tbaa !11
  %275 = sext i32 %273 to i64
  %276 = load i64, ptr @ans, align 8, !tbaa !13
  %277 = add nsw i64 %276, %275
  store i64 %277, ptr @ans, align 8, !tbaa !13
  br label %278

278:                                              ; preds = %266, %251, %242
  br label %279

279:                                              ; preds = %278
  %280 = load i32, ptr %14, align 4, !tbaa !11
  %281 = add nsw i32 %280, 1
  store i32 %281, ptr %14, align 4, !tbaa !11
  br label %205, !llvm.loop !26

282:                                              ; preds = %215
  store i32 0, ptr %7, align 4
  br label %283

283:                                              ; preds = %282, %185
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #9
  %284 = load i32, ptr %7, align 4
  switch i32 %284, label %293 [
    i32 0, label %285
    i32 15, label %286
  ]

285:                                              ; preds = %283
  br label %286

286:                                              ; preds = %285, %283
  %287 = load i32, ptr %6, align 4, !tbaa !11
  %288 = add nsw i32 %287, 1
  store i32 %288, ptr %6, align 4, !tbaa !11
  br label %127, !llvm.loop !27

289:                                              ; preds = %131
  %290 = load i64, ptr @ans, align 8, !tbaa !13
  %291 = call i32 (ptr, ...) @printf(ptr noundef @.str, i64 noundef %290)
  br label %16, !llvm.loop !28

292:                                              ; preds = %16
  ret i32 0

293:                                              ; preds = %283
  unreachable
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4)) #2

; Function Attrs: nounwind
declare double @sqrt(double noundef) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.ceil.f64(double) #4

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef, ptr noundef) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiPFbRKiS2_EEvT_S5_T0_(ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(8)) #7 align 2

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #7

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

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 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 #2 = { 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 #3 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { 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 #8 = { "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 #9 = { 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 = !{!"bool", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{i8 0, i8 2}
!10 = !{}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"long long", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!18, !12, i64 4}
!18 = !{!"_ZTSSt4pairIiiE", !12, i64 0, !12, i64 4}
!19 = !{!18, !12, i64 0}
!20 = distinct !{!20, !16}
!21 = distinct !{!21, !16}
!22 = distinct !{!22, !16}
!23 = distinct !{!23, !16}
!24 = distinct !{!24, !16}
!25 = distinct !{!25, !16}
!26 = distinct !{!26, !16}
!27 = distinct !{!27, !16}
!28 = distinct !{!28, !16}


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

%"struct.std::pair" = type { i32, i32 }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::_Select1st<std::pair<const std::pair<int, int>, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::_Select1st<std::pair<const std::pair<int, int>, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }

@n = external dso_local global i32, align 4
@sz = external dso_local local_unnamed_addr global i32, align 4
@m = external dso_local local_unnamed_addr global i32, align 4
@fir = external dso_local local_unnamed_addr global [100001 x i32], align 16
@ord = external dso_local global [100001 x i32], align 16
@idx = external dso_local local_unnamed_addr global [100001 x i32], align 16
@pos = external dso_local local_unnamed_addr global [100001 x i32], align 16
@a = external dso_local global [100001 x %"struct.std::pair"], align 16
@Hash = external dso_local global %"class.std::map", align 8
@vis = external dso_local local_unnamed_addr global [100001 x i8], align 16
@ans = external dso_local local_unnamed_addr global i64, align 8
@_ZN6fastIO7IOerrorE = external dso_local local_unnamed_addr global i8, align 1
@.str = external hidden unnamed_addr constant [6 x i8], align 1

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

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

; 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 norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca %"class.std::map", align 8
  %2 = alloca %"struct.std::pair", align 8
  tail call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) @n)
  %3 = load i8, ptr @_ZN6fastIO7IOerrorE, align 1, !tbaa !5, !range !9, !noundef !10
  %4 = trunc nuw i8 %3 to i1
  br i1 %4, label %._crit_edge97, label %.lr.ph96

.lr.ph96:                                         ; preds = %0, %._crit_edge94
  %5 = load i32, ptr @n, align 4, !tbaa !11
  %6 = sitofp i32 %5 to double
  %7 = fmul double %6, 1.000000e-01
  %8 = call double @sqrt(double noundef %7) #10
  %9 = call double @llvm.ceil.f64(double %8)
  %10 = fptosi double %9 to i32
  store i32 %10, ptr @sz, align 4, !tbaa !11
  store i32 0, ptr @m, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %1) #10
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %1, i8 0, i64 48, i1 false)
  call void @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #10
  call void @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEE4swapERS7_(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(48) @Hash) #10
  call void @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #10
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %1) #10
  store i64 0, ptr @ans, align 8, !tbaa !13
  %11 = load i32, ptr @n, align 4, !tbaa !11
  %12 = sext i32 %11 to i64
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @vis, i8 0, i64 %12, i1 false)
  %13 = icmp sgt i32 %11, 0
  br i1 %13, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph96
  %.pre-phi = phi i64 [ %12, %.lr.ph96 ], [ %30, %.lr.ph ]
  %14 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %.pre-phi, i32 1
  store i32 2147483647, ptr %14, align 4, !tbaa !15
  %15 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %.pre-phi
  store i32 2147483647, ptr %15, align 8, !tbaa !17
  call void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef nonnull @a, ptr noundef nonnull %15)
  %16 = load i32, ptr @n, align 4, !tbaa !11
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds i32, ptr @ord, i64 %17
  call void @_ZSt4sortIPiPFbRKiS2_EEvT_S5_T0_(ptr noundef nonnull @ord, ptr noundef nonnull %18, ptr noundef nonnull @_Z3cmpRKiS0_)
  %19 = load i32, ptr @n, align 4, !tbaa !11
  %m.promoted = load i32, ptr @m, align 4, !tbaa !11
  %20 = icmp sgt i32 %19, 0
  br i1 %20, label %21, label %._crit_edge79

21:                                               ; preds = %._crit_edge
  %wide.trip.count = zext nneg i32 %19 to i64
  %22 = add nsw i32 %m.promoted, 1
  store i32 %22, ptr @m, align 4, !tbaa !11
  %23 = sext i32 %m.promoted to i64
  %24 = getelementptr inbounds [100001 x i32], ptr @fir, i64 0, i64 %23
  store i32 0, ptr %24, align 4, !tbaa !11
  store i32 %m.promoted, ptr @pos, align 16, !tbaa !11
  %exitcond.peel.not = icmp eq i32 %19, 1
  br i1 %exitcond.peel.not, label %.lr.ph78.preheader, label %.lr.ph75.peel.next

.lr.ph:                                           ; preds = %.lr.ph96, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph96 ]
  %25 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %indvars.iv
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) %25)
  %26 = getelementptr inbounds i8, ptr %25, i64 4
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) %26)
  %27 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %indvars.iv
  %28 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %28, ptr %27, align 4, !tbaa !11
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %29 = load i32, ptr @n, align 4, !tbaa !11
  %30 = sext i32 %29 to i64
  %31 = icmp slt i64 %indvars.iv.next, %30
  br i1 %31, label %.lr.ph, label %._crit_edge, !llvm.loop !18

.preheader70:                                     ; preds = %46
  br i1 %20, label %.lr.ph78.preheader, label %._crit_edge79

.lr.ph78.preheader:                               ; preds = %21, %.preheader70
  %32 = phi i32 [ %47, %.preheader70 ], [ %22, %21 ]
  %xtraiter = and i64 %wide.trip.count, 3
  %33 = icmp ult i32 %19, 4
  br i1 %33, label %._crit_edge79.loopexit.unr-lcssa, label %.lr.ph78.preheader.new

.lr.ph78.preheader.new:                           ; preds = %.lr.ph78.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483644
  br label %.lr.ph78

.lr.ph75.peel.next:                               ; preds = %21, %46
  %34 = phi i32 [ %47, %46 ], [ %22, %21 ]
  %indvars.iv101 = phi i64 [ %indvars.iv.next102, %46 ], [ 1, %21 ]
  %35 = phi i32 [ %48, %46 ], [ %22, %21 ]
  %36 = add nsw i64 %indvars.iv101, -1
  %37 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %36
  %38 = load i32, ptr %37, align 8, !tbaa !17
  %39 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %indvars.iv101
  %40 = load i32, ptr %39, align 8, !tbaa !17
  %.not65 = icmp eq i32 %38, %40
  br i1 %.not65, label %46, label %41

41:                                               ; preds = %.lr.ph75.peel.next
  %42 = add nsw i32 %35, 1
  store i32 %42, ptr @m, align 4, !tbaa !11
  %43 = sext i32 %35 to i64
  %44 = getelementptr inbounds [100001 x i32], ptr @fir, i64 0, i64 %43
  %45 = trunc nuw nsw i64 %indvars.iv101 to i32
  store i32 %45, ptr %44, align 4, !tbaa !11
  br label %46

46:                                               ; preds = %41, %.lr.ph75.peel.next
  %47 = phi i32 [ %42, %41 ], [ %34, %.lr.ph75.peel.next ]
  %48 = phi i32 [ %42, %41 ], [ %35, %.lr.ph75.peel.next ]
  %49 = add nsw i32 %48, -1
  %50 = getelementptr inbounds [100001 x i32], ptr @pos, i64 0, i64 %indvars.iv101
  store i32 %49, ptr %50, align 4, !tbaa !11
  %indvars.iv.next102 = add nuw nsw i64 %indvars.iv101, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next102, %wide.trip.count
  br i1 %exitcond.not, label %.preheader70, label %.lr.ph75.peel.next, !llvm.loop !20

._crit_edge79.loopexit.unr-lcssa:                 ; preds = %.lr.ph78, %.lr.ph78.preheader
  %indvars.iv105.unr = phi i64 [ 0, %.lr.ph78.preheader ], [ %indvars.iv.next106.3, %.lr.ph78 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge79, label %.lr.ph78.epil

.lr.ph78.epil:                                    ; preds = %._crit_edge79.loopexit.unr-lcssa, %.lr.ph78.epil
  %indvars.iv105.epil = phi i64 [ %indvars.iv.next106.epil, %.lr.ph78.epil ], [ %indvars.iv105.unr, %._crit_edge79.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph78.epil ], [ 0, %._crit_edge79.loopexit.unr-lcssa ]
  %51 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %indvars.iv105.epil
  %52 = load i32, ptr %51, align 4, !tbaa !11
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [100001 x i32], ptr @pos, i64 0, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !11
  %56 = getelementptr inbounds [100001 x i32], ptr @idx, i64 0, i64 %indvars.iv105.epil
  store i32 %55, ptr %56, align 4, !tbaa !11
  %indvars.iv.next106.epil = add nuw nsw i64 %indvars.iv105.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge79, label %.lr.ph78.epil, !llvm.loop !22

._crit_edge79:                                    ; preds = %._crit_edge79.loopexit.unr-lcssa, %.lr.ph78.epil, %._crit_edge, %.preheader70
  %57 = phi i32 [ %47, %.preheader70 ], [ %m.promoted, %._crit_edge ], [ %32, %.lr.ph78.epil ], [ %32, %._crit_edge79.loopexit.unr-lcssa ]
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [100001 x i32], ptr @fir, i64 0, i64 %58
  store i32 %19, ptr %59, align 4, !tbaa !11
  %60 = icmp sgt i32 %57, 0
  br i1 %60, label %.lr.ph93, label %._crit_edge94

.lr.ph78:                                         ; preds = %.lr.ph78, %.lr.ph78.preheader.new
  %indvars.iv105 = phi i64 [ 0, %.lr.ph78.preheader.new ], [ %indvars.iv.next106.3, %.lr.ph78 ]
  %niter = phi i64 [ 0, %.lr.ph78.preheader.new ], [ %niter.next.3, %.lr.ph78 ]
  %61 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %indvars.iv105
  %62 = load i32, ptr %61, align 16, !tbaa !11
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [100001 x i32], ptr @pos, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !11
  %66 = getelementptr inbounds [100001 x i32], ptr @idx, i64 0, i64 %indvars.iv105
  store i32 %65, ptr %66, align 16, !tbaa !11
  %indvars.iv.next106 = or disjoint i64 %indvars.iv105, 1
  %67 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %indvars.iv.next106
  %68 = load i32, ptr %67, align 4, !tbaa !11
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [100001 x i32], ptr @pos, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !11
  %72 = getelementptr inbounds [100001 x i32], ptr @idx, i64 0, i64 %indvars.iv.next106
  store i32 %71, ptr %72, align 4, !tbaa !11
  %indvars.iv.next106.1 = or disjoint i64 %indvars.iv105, 2
  %73 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %indvars.iv.next106.1
  %74 = load i32, ptr %73, align 8, !tbaa !11
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [100001 x i32], ptr @pos, i64 0, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !11
  %78 = getelementptr inbounds [100001 x i32], ptr @idx, i64 0, i64 %indvars.iv.next106.1
  store i32 %77, ptr %78, align 8, !tbaa !11
  %indvars.iv.next106.2 = or disjoint i64 %indvars.iv105, 3
  %79 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %indvars.iv.next106.2
  %80 = load i32, ptr %79, align 4, !tbaa !11
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [100001 x i32], ptr @pos, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !11
  %84 = getelementptr inbounds [100001 x i32], ptr @idx, i64 0, i64 %indvars.iv.next106.2
  store i32 %83, ptr %84, align 4, !tbaa !11
  %indvars.iv.next106.3 = add nuw nsw i64 %indvars.iv105, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge79.loopexit.unr-lcssa, label %.lr.ph78, !llvm.loop !24

._crit_edge94:                                    ; preds = %.loopexit66, %._crit_edge79
  %85 = load i64, ptr @ans, align 8, !tbaa !13
  %86 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %85)
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) @n)
  %87 = load i8, ptr @_ZN6fastIO7IOerrorE, align 1, !tbaa !5, !range !9, !noundef !10
  %88 = trunc nuw i8 %87 to i1
  br i1 %88, label %._crit_edge97, label %.lr.ph96, !llvm.loop !25

.lr.ph93:                                         ; preds = %._crit_edge79, %.loopexit66
  %89 = phi i32 [ %160, %.loopexit66 ], [ %57, %._crit_edge79 ]
  %indvars.iv129 = phi i64 [ %indvars.iv.next130, %.loopexit66 ], [ 0, %._crit_edge79 ]
  %90 = getelementptr inbounds [100001 x i32], ptr @fir, i64 0, i64 %indvars.iv129
  %91 = load i32, ptr %90, align 4, !tbaa !11
  %indvars.iv.next130 = add nuw nsw i64 %indvars.iv129, 1
  %92 = getelementptr inbounds [100001 x i32], ptr @fir, i64 0, i64 %indvars.iv.next130
  %93 = load i32, ptr %92, align 4, !tbaa !11
  %94 = sub nsw i32 %93, %91
  %95 = load i32, ptr @sz, align 4, !tbaa !11
  %.not = icmp sgt i32 %94, %95
  %96 = icmp slt i32 %91, %93
  br i1 %.not, label %.preheader67, label %.preheader68

.preheader68:                                     ; preds = %.lr.ph93
  br i1 %96, label %.lr.ph84.preheader, label %.loopexit66

.lr.ph84.preheader:                               ; preds = %.preheader68
  %97 = sext i32 %91 to i64
  %98 = sext i32 %93 to i64
  br label %.lr.ph84

.preheader67:                                     ; preds = %.lr.ph93
  br i1 %96, label %.lr.ph86.preheader, label %._crit_edge87

.lr.ph86.preheader:                               ; preds = %.preheader67
  %99 = sext i32 %91 to i64
  %scevgep = getelementptr i8, ptr @vis, i64 %99
  %100 = xor i32 %91, -1
  %101 = add i32 %93, %100
  %102 = zext i32 %101 to i64
  %103 = add nuw nsw i64 %102, 1
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(1) %scevgep, i8 1, i64 %103, i1 false), !tbaa !5
  br label %._crit_edge87

.loopexit:                                        ; preds = %106, %.lr.ph84
  %exitcond119.not = icmp eq i64 %indvars.iv.next116, %98
  br i1 %exitcond119.not, label %.loopexit66.loopexit98, label %.lr.ph84, !llvm.loop !26

.lr.ph84:                                         ; preds = %.lr.ph84.preheader, %.loopexit
  %indvars.iv115 = phi i64 [ %97, %.lr.ph84.preheader ], [ %indvars.iv.next116, %.loopexit ]
  %indvars.iv110.in = phi i64 [ %97, %.lr.ph84.preheader ], [ %indvars.iv110, %.loopexit ]
  %indvars.iv110 = add nsw i64 %indvars.iv110.in, 1
  %indvars.iv.next116 = add nsw i64 %indvars.iv115, 1
  %104 = icmp slt i64 %indvars.iv.next116, %98
  br i1 %104, label %.lr.ph82, label %.loopexit

.lr.ph82:                                         ; preds = %.lr.ph84
  %105 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %indvars.iv115, i32 1
  br label %106

106:                                              ; preds = %.lr.ph82, %106
  %indvars.iv112 = phi i64 [ %indvars.iv110, %.lr.ph82 ], [ %indvars.iv.next113, %106 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #10
  %107 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %indvars.iv112, i32 1
  %108 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %105, ptr noundef nonnull align 4 dereferenceable(4) %107)
  store i64 %108, ptr %2, align 8
  %109 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(8) %2)
  %110 = load i32, ptr %109, align 4, !tbaa !11
  %111 = add nsw i32 %110, 1
  store i32 %111, ptr %109, align 4, !tbaa !11
  %112 = sext i32 %110 to i64
  %113 = load i64, ptr @ans, align 8, !tbaa !13
  %114 = add nsw i64 %113, %112
  store i64 %114, ptr @ans, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #10
  %indvars.iv.next113 = add nsw i64 %indvars.iv112, 1
  %115 = icmp slt i64 %indvars.iv.next113, %98
  br i1 %115, label %106, label %.loopexit, !llvm.loop !27

._crit_edge87:                                    ; preds = %.lr.ph86.preheader, %.preheader67
  %116 = sext i32 %89 to i64
  %117 = shl nsw i64 %116, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @pos, i8 0, i64 %117, i1 false)
  %118 = load i32, ptr @n, align 4, !tbaa !11
  %119 = icmp sgt i32 %118, 0
  %120 = and i1 %96, %119
  br i1 %120, label %.preheader.preheader, label %.loopexit66

.preheader.preheader:                             ; preds = %._crit_edge87
  %ans.promoted = load i64, ptr @ans, align 8, !tbaa !13
  %121 = sext i32 %93 to i64
  %122 = zext nneg i32 %118 to i64
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %155
  %indvars.iv126 = phi i64 [ 0, %.preheader.preheader ], [ %indvars.iv.next127, %155 ]
  %.090 = phi i32 [ %91, %.preheader.preheader ], [ %.1.lcssa, %155 ]
  %123 = phi i64 [ %ans.promoted, %.preheader.preheader ], [ %156, %155 ]
  %124 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %indvars.iv126
  %125 = load i32, ptr %124, align 4, !tbaa !11
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %126, i32 1
  %128 = load i32, ptr %127, align 4, !tbaa !15
  %129 = sext i32 %.090 to i64
  %130 = add nsw i32 %.090, 1
  %smax = call i32 @llvm.smax.i32(i32 %93, i32 %130)
  br label %131

131:                                              ; preds = %.preheader, %135
  %indvars.iv123 = phi i64 [ %129, %.preheader ], [ %indvars.iv.next124, %135 ]
  %132 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %indvars.iv123, i32 1
  %133 = load i32, ptr %132, align 4, !tbaa !15
  %134 = icmp slt i32 %133, %128
  br i1 %134, label %135, label %.critedge.split.loop.exit136

135:                                              ; preds = %131
  %indvars.iv.next124 = add nsw i64 %indvars.iv123, 1
  %136 = icmp slt i64 %indvars.iv.next124, %121
  br i1 %136, label %131, label %.critedge, !llvm.loop !28

.critedge.split.loop.exit136:                     ; preds = %131
  %137 = trunc nsw i64 %indvars.iv123 to i32
  br label %.critedge

.critedge:                                        ; preds = %135, %.critedge.split.loop.exit136
  %.1.lcssa = phi i32 [ %137, %.critedge.split.loop.exit136 ], [ %smax, %135 ]
  %138 = getelementptr inbounds [100001 x i8], ptr @vis, i64 0, i64 %126
  %139 = load i8, ptr %138, align 1, !tbaa !5, !range !9, !noundef !10
  %140 = trunc nuw i8 %139 to i1
  br i1 %140, label %155, label %141

141:                                              ; preds = %.critedge
  %142 = sext i32 %.1.lcssa to i64
  %143 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %142, i32 1
  %144 = load i32, ptr %143, align 4, !tbaa !15
  %145 = icmp eq i32 %128, %144
  br i1 %145, label %146, label %155

146:                                              ; preds = %141
  %147 = getelementptr inbounds [100001 x i32], ptr @idx, i64 0, i64 %indvars.iv126
  %148 = load i32, ptr %147, align 4, !tbaa !11
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [100001 x i32], ptr @pos, i64 0, i64 %149
  %151 = load i32, ptr %150, align 4, !tbaa !11
  %152 = add nsw i32 %151, 1
  store i32 %152, ptr %150, align 4, !tbaa !11
  %153 = sext i32 %151 to i64
  %154 = add nsw i64 %123, %153
  store i64 %154, ptr @ans, align 8, !tbaa !13
  br label %155

155:                                              ; preds = %.critedge, %141, %146
  %156 = phi i64 [ %123, %.critedge ], [ %123, %141 ], [ %154, %146 ]
  %indvars.iv.next127 = add nuw nsw i64 %indvars.iv126, 1
  %157 = icmp ult i64 %indvars.iv.next127, %122
  %158 = icmp slt i32 %.1.lcssa, %93
  %159 = and i1 %158, %157
  br i1 %159, label %.preheader, label %.loopexit66, !llvm.loop !29

.loopexit66.loopexit98:                           ; preds = %.loopexit
  %.pre = load i32, ptr @m, align 4, !tbaa !11
  br label %.loopexit66

.loopexit66:                                      ; preds = %155, %.loopexit66.loopexit98, %.preheader68, %._crit_edge87
  %160 = phi i32 [ %.pre, %.loopexit66.loopexit98 ], [ %89, %.preheader68 ], [ %89, %._crit_edge87 ], [ %89, %155 ]
  %161 = sext i32 %160 to i64
  %162 = icmp slt i64 %indvars.iv.next130, %161
  br i1 %162, label %.lr.ph93, label %._crit_edge94, !llvm.loop !30

._crit_edge97:                                    ; preds = %._crit_edge94, %0
  ret i32 0
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.ceil.f64(double) #4

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiPFbRKiS2_EEvT_S5_T0_(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #7 align 2

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #7

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #9

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 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 #2 = { 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 #3 = { mustprogress nofree nounwind willreturn memory(write) "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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { 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 #8 = { 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 #9 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #10 = { 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 = !{!"bool", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{i8 0, i8 2}
!10 = !{}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"long long", !7, i64 0}
!15 = !{!16, !12, i64 4}
!16 = !{!"_ZTSSt4pairIiiE", !12, i64 0, !12, i64 4}
!17 = !{!16, !12, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19, !21}
!21 = !{!"llvm.loop.peeled.count", i32 1}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.unroll.disable"}
!24 = distinct !{!24, !19}
!25 = distinct !{!25, !19}
!26 = distinct !{!26, !19}
!27 = distinct !{!27, !19}
!28 = distinct !{!28, !19}
!29 = distinct !{!29, !19}
!30 = distinct !{!30, !19}


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