; LLVM IR from tangjz/acm-icpc :: hdu (6711)

; 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.Query = type { i32, i32 }
%class.anon = type { i8 }

@tot = external dso_local global i32, align 4
@pr = external dso_local global [1250001 x i32], align 16
@d = external dso_local global [10000001 x i32], align 16
@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@sq = external dso_local global i32, align 4
@a = external dso_local global [100001 x i32], align 16
@b = external dso_local global [100001 x i32], align 16
@pos = external dso_local global [100001 x i32], align 16
@ord = external dso_local global [100001 x i32], align 16
@ans = external dso_local global [100001 x i32], align 16
@que = external dso_local global [100001 x %struct.Query], align 16
@ptot = external dso_local global i32, align 4
@p = external dso_local global [9 x i32], align 16
@tail = external dso_local global [100001 x i32], align 16
@sum0 = external dso_local global i32, align 4
@sum1 = external dso_local global i32, align 4

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsii(i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z6mo_updii(i32 noundef, i32 noundef) #1

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %class.anon, align 1
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  store i32 1, ptr getelementptr inbounds ([10000001 x i32], ptr @d, i64 0, i64 1), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 2, ptr %2, align 4, !tbaa !5
  br label %20

20:                                               ; preds = %73, %0
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = icmp slt i32 %21, 10000001
  br i1 %22, label %24, label %23

23:                                               ; preds = %20
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %76

24:                                               ; preds = %20
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [10000001 x i32], ptr @d, i64 0, i64 %26
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %39, label %30

30:                                               ; preds = %24
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [10000001 x i32], ptr @d, i64 0, i64 %33
  store i32 %31, ptr %34, align 4, !tbaa !5
  %35 = load i32, ptr @tot, align 4, !tbaa !5
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr @tot, align 4, !tbaa !5
  %37 = sext i32 %35 to i64
  %38 = getelementptr inbounds [1250001 x i32], ptr @pr, i64 0, i64 %37
  store i32 %31, ptr %38, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %30, %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  br label %40

40:                                               ; preds = %68, %39
  %41 = load i32, ptr %2, align 4, !tbaa !5
  %42 = load i32, ptr %4, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [1250001 x i32], ptr @pr, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = mul nsw i32 %41, %45
  store i32 %46, ptr %5, align 4, !tbaa !5
  %47 = icmp slt i32 %46, 10000001
  br i1 %47, label %49, label %48

48:                                               ; preds = %40
  store i32 5, ptr %3, align 4
  br label %71

49:                                               ; preds = %40
  %50 = load i32, ptr %4, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [1250001 x i32], ptr @pr, i64 0, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = load i32, ptr %5, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [10000001 x i32], ptr @d, i64 0, i64 %55
  store i32 %53, ptr %56, align 4, !tbaa !5
  %57 = load i32, ptr %2, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [10000001 x i32], ptr @d, i64 0, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = load i32, ptr %4, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [1250001 x i32], ptr @pr, i64 0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = icmp eq i32 %60, %64
  br i1 %65, label %66, label %67

66:                                               ; preds = %49
  store i32 5, ptr %3, align 4
  br label %71

67:                                               ; preds = %49
  br label %68

68:                                               ; preds = %67
  %69 = load i32, ptr %4, align 4, !tbaa !5
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %4, align 4, !tbaa !5
  br label %40, !llvm.loop !9

71:                                               ; preds = %66, %48
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %72

72:                                               ; preds = %71
  br label %73

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

76:                                               ; preds = %23
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) @t)
  br label %77

77:                                               ; preds = %320, %76
  %78 = load i32, ptr @t, align 4, !tbaa !5
  %79 = add nsw i32 %78, -1
  store i32 %79, ptr @t, align 4, !tbaa !5
  %80 = icmp ne i32 %78, 0
  br i1 %80, label %81, label %321

81:                                               ; preds = %77
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) @n)
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) @m)
  store i32 1, ptr @sq, align 4, !tbaa !5
  br label %82

82:                                               ; preds = %89, %81
  %83 = load i32, ptr @sq, align 4, !tbaa !5
  %84 = load i32, ptr @sq, align 4, !tbaa !5
  %85 = mul nsw i32 %83, %84
  %86 = load i32, ptr @m, align 4, !tbaa !5
  %87 = icmp sle i32 %85, %86
  br i1 %87, label %88, label %92

88:                                               ; preds = %82
  br label %89

89:                                               ; preds = %88
  %90 = load i32, ptr @sq, align 4, !tbaa !5
  %91 = add nsw i32 %90, 1
  store i32 %91, ptr @sq, align 4, !tbaa !5
  br label %82, !llvm.loop !12

92:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  %93 = load i32, ptr @n, align 4, !tbaa !5
  %94 = sitofp i32 %93 to double
  %95 = load i32, ptr @sq, align 4, !tbaa !5
  %96 = sitofp i32 %95 to double
  %97 = fsub double %96, 1.000000e+00
  %98 = fdiv double %94, %97
  %99 = call double @llvm.ceil.f64(double %98)
  %100 = fptosi double %99 to i32
  store i32 %100, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 1, ptr %7, align 4, !tbaa !5
  %101 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %102 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %101, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %103 = load i32, ptr %102, align 4, !tbaa !5
  store i32 %103, ptr @sq, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  store i32 0, ptr @tail, align 16, !tbaa !5
  store i32 0, ptr @tot, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %104

104:                                              ; preds = %181, %92
  %105 = load i32, ptr %8, align 4, !tbaa !5
  %106 = load i32, ptr @n, align 4, !tbaa !5
  %107 = icmp sle i32 %105, %106
  br i1 %107, label %109, label %108

108:                                              ; preds = %104
  store i32 13, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %184

109:                                              ; preds = %104
  %110 = load i32, ptr %8, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %111
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) %112)
  %113 = load i32, ptr %8, align 4, !tbaa !5
  %114 = load i32, ptr @sq, align 4, !tbaa !5
  %115 = icmp sle i32 %113, %114
  br i1 %115, label %116, label %117

116:                                              ; preds = %109
  br label %125

117:                                              ; preds = %109
  %118 = load i32, ptr %8, align 4, !tbaa !5
  %119 = load i32, ptr @sq, align 4, !tbaa !5
  %120 = sub nsw i32 %118, %119
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [100001 x i32], ptr @pos, i64 0, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !5
  %124 = add nsw i32 %123, 1
  br label %125

125:                                              ; preds = %117, %116
  %126 = phi i32 [ 1, %116 ], [ %124, %117 ]
  %127 = load i32, ptr %8, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [100001 x i32], ptr @pos, i64 0, i64 %128
  store i32 %126, ptr %129, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %130 = load i32, ptr %8, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %131
  %133 = load i32, ptr %132, align 4, !tbaa !5
  store i32 %133, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %134 = load i32, ptr %9, align 4, !tbaa !5
  %135 = load i32, ptr %8, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [100001 x i32], ptr @b, i64 0, i64 %136
  store i32 %134, ptr %137, align 4, !tbaa !5
  store ptr %137, ptr %10, align 8, !tbaa !13
  store i32 0, ptr @ptot, align 4, !tbaa !5
  br label %138

138:                                              ; preds = %173, %125
  %139 = load i32, ptr %9, align 4, !tbaa !5
  %140 = icmp sgt i32 %139, 1
  br i1 %140, label %141, label %176

141:                                              ; preds = %138
  %142 = load ptr, ptr %10, align 8, !tbaa !13
  %143 = load i32, ptr %142, align 4, !tbaa !5
  %144 = load i32, ptr %9, align 4, !tbaa !5
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [10000001 x i32], ptr @d, i64 0, i64 %145
  %147 = load i32, ptr %146, align 4, !tbaa !5
  %148 = sdiv i32 %143, %147
  %149 = load ptr, ptr %10, align 8, !tbaa !13
  %150 = load i32, ptr %149, align 4, !tbaa !5
  %151 = sub nsw i32 %150, %148
  store i32 %151, ptr %149, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %152 = load i32, ptr %9, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [10000001 x i32], ptr @d, i64 0, i64 %153
  %155 = load i32, ptr %154, align 4, !tbaa !5
  %156 = load i32, ptr @ptot, align 4, !tbaa !5
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [9 x i32], ptr @p, i64 0, i64 %157
  store i32 %155, ptr %158, align 4, !tbaa !5
  store i32 %155, ptr %11, align 4, !tbaa !5
  br label %159

159:                                              ; preds = %168, %141
  %160 = load i32, ptr %9, align 4, !tbaa !5
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [10000001 x i32], ptr @d, i64 0, i64 %161
  %163 = load i32, ptr %162, align 4, !tbaa !5
  %164 = load i32, ptr %11, align 4, !tbaa !5
  %165 = icmp eq i32 %163, %164
  br i1 %165, label %167, label %166

166:                                              ; preds = %159
  store i32 19, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %172

167:                                              ; preds = %159
  br label %168

168:                                              ; preds = %167
  %169 = load i32, ptr %11, align 4, !tbaa !5
  %170 = load i32, ptr %9, align 4, !tbaa !5
  %171 = sdiv i32 %170, %169
  store i32 %171, ptr %9, align 4, !tbaa !5
  br label %159, !llvm.loop !15

172:                                              ; preds = %166
  br label %173

173:                                              ; preds = %172
  %174 = load i32, ptr @ptot, align 4, !tbaa !5
  %175 = add nsw i32 %174, 1
  store i32 %175, ptr @ptot, align 4, !tbaa !5
  br label %138, !llvm.loop !16

176:                                              ; preds = %138
  call void @_Z3dfsii(i32 noundef 0, i32 noundef 1)
  %177 = load i32, ptr @tot, align 4, !tbaa !5
  %178 = load i32, ptr %8, align 4, !tbaa !5
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [100001 x i32], ptr @tail, i64 0, i64 %179
  store i32 %177, ptr %180, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %181

181:                                              ; preds = %176
  %182 = load i32, ptr %8, align 4, !tbaa !5
  %183 = add nsw i32 %182, 1
  store i32 %183, ptr %8, align 4, !tbaa !5
  br label %104, !llvm.loop !17

184:                                              ; preds = %108
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %185

185:                                              ; preds = %203, %184
  %186 = load i32, ptr %12, align 4, !tbaa !5
  %187 = load i32, ptr @m, align 4, !tbaa !5
  %188 = icmp sle i32 %186, %187
  br i1 %188, label %190, label %189

189:                                              ; preds = %185
  store i32 22, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %206

190:                                              ; preds = %185
  %191 = load i32, ptr %12, align 4, !tbaa !5
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds [100001 x %struct.Query], ptr @que, i64 0, i64 %192
  %194 = getelementptr inbounds %struct.Query, ptr %193, i32 0, i32 0
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) %194)
  %195 = load i32, ptr %12, align 4, !tbaa !5
  %196 = sext i32 %195 to i64
  %197 = getelementptr inbounds [100001 x %struct.Query], ptr @que, i64 0, i64 %196
  %198 = getelementptr inbounds %struct.Query, ptr %197, i32 0, i32 1
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) %198)
  %199 = load i32, ptr %12, align 4, !tbaa !5
  %200 = load i32, ptr %12, align 4, !tbaa !5
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %201
  store i32 %199, ptr %202, align 4, !tbaa !5
  br label %203

203:                                              ; preds = %190
  %204 = load i32, ptr %12, align 4, !tbaa !5
  %205 = add nsw i32 %204, 1
  store i32 %205, ptr %12, align 4, !tbaa !5
  br label %185, !llvm.loop !18

206:                                              ; preds = %189
  %207 = load i32, ptr @m, align 4, !tbaa !5
  %208 = sext i32 %207 to i64
  %209 = getelementptr inbounds i32, ptr @ord, i64 %208
  %210 = getelementptr inbounds i32, ptr %209, i64 1
  call void @"_ZSt4sortIPiZ4mainE3$_0EvT_S2_T0_"(ptr noundef getelementptr inbounds (i32, ptr @ord, i64 1), ptr noundef %210)
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %211 = load i32, ptr getelementptr inbounds ([100001 x i32], ptr @ord, i64 0, i64 1), align 4, !tbaa !5
  %212 = sext i32 %211 to i64
  %213 = getelementptr inbounds [100001 x %struct.Query], ptr @que, i64 0, i64 %212
  %214 = getelementptr inbounds %struct.Query, ptr %213, i32 0, i32 0
  %215 = load i32, ptr %214, align 8, !tbaa !19
  store i32 %215, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %216 = load i32, ptr %14, align 4, !tbaa !5
  %217 = sub nsw i32 %216, 1
  store i32 %217, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  store i32 1, ptr %16, align 4, !tbaa !5
  br label %218

218:                                              ; preds = %293, %206
  %219 = load i32, ptr %16, align 4, !tbaa !5
  %220 = load i32, ptr @m, align 4, !tbaa !5
  %221 = icmp sle i32 %219, %220
  br i1 %221, label %223, label %222

222:                                              ; preds = %218
  store i32 25, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %296

223:                                              ; preds = %218
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %224 = load i32, ptr %16, align 4, !tbaa !5
  %225 = sext i32 %224 to i64
  %226 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %225
  %227 = load i32, ptr %226, align 4, !tbaa !5
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds [100001 x %struct.Query], ptr @que, i64 0, i64 %228
  %230 = getelementptr inbounds %struct.Query, ptr %229, i32 0, i32 0
  %231 = load i32, ptr %230, align 8, !tbaa !19
  store i32 %231, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  %232 = load i32, ptr %16, align 4, !tbaa !5
  %233 = sext i32 %232 to i64
  %234 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %233
  %235 = load i32, ptr %234, align 4, !tbaa !5
  %236 = sext i32 %235 to i64
  %237 = getelementptr inbounds [100001 x %struct.Query], ptr @que, i64 0, i64 %236
  %238 = getelementptr inbounds %struct.Query, ptr %237, i32 0, i32 1
  %239 = load i32, ptr %238, align 4, !tbaa !21
  store i32 %239, ptr %18, align 4, !tbaa !5
  br label %240

240:                                              ; preds = %247, %223
  %241 = load i32, ptr %15, align 4, !tbaa !5
  %242 = load i32, ptr %18, align 4, !tbaa !5
  %243 = icmp slt i32 %241, %242
  br i1 %243, label %244, label %250

244:                                              ; preds = %240
  %245 = load i32, ptr %15, align 4, !tbaa !5
  %246 = add nsw i32 %245, 1
  call void @_Z6mo_updii(i32 noundef %246, i32 noundef 1)
  br label %247

247:                                              ; preds = %244
  %248 = load i32, ptr %15, align 4, !tbaa !5
  %249 = add nsw i32 %248, 1
  store i32 %249, ptr %15, align 4, !tbaa !5
  br label %240, !llvm.loop !22

250:                                              ; preds = %240
  br label %251

251:                                              ; preds = %258, %250
  %252 = load i32, ptr %14, align 4, !tbaa !5
  %253 = load i32, ptr %17, align 4, !tbaa !5
  %254 = icmp sgt i32 %252, %253
  br i1 %254, label %255, label %261

255:                                              ; preds = %251
  %256 = load i32, ptr %14, align 4, !tbaa !5
  %257 = sub nsw i32 %256, 1
  call void @_Z6mo_updii(i32 noundef %257, i32 noundef 1)
  br label %258

258:                                              ; preds = %255
  %259 = load i32, ptr %14, align 4, !tbaa !5
  %260 = add nsw i32 %259, -1
  store i32 %260, ptr %14, align 4, !tbaa !5
  br label %251, !llvm.loop !23

261:                                              ; preds = %251
  br label %262

262:                                              ; preds = %268, %261
  %263 = load i32, ptr %14, align 4, !tbaa !5
  %264 = load i32, ptr %17, align 4, !tbaa !5
  %265 = icmp slt i32 %263, %264
  br i1 %265, label %266, label %271

266:                                              ; preds = %262
  %267 = load i32, ptr %14, align 4, !tbaa !5
  call void @_Z6mo_updii(i32 noundef %267, i32 noundef -1)
  br label %268

268:                                              ; preds = %266
  %269 = load i32, ptr %14, align 4, !tbaa !5
  %270 = add nsw i32 %269, 1
  store i32 %270, ptr %14, align 4, !tbaa !5
  br label %262, !llvm.loop !24

271:                                              ; preds = %262
  br label %272

272:                                              ; preds = %278, %271
  %273 = load i32, ptr %15, align 4, !tbaa !5
  %274 = load i32, ptr %18, align 4, !tbaa !5
  %275 = icmp sgt i32 %273, %274
  br i1 %275, label %276, label %281

276:                                              ; preds = %272
  %277 = load i32, ptr %15, align 4, !tbaa !5
  call void @_Z6mo_updii(i32 noundef %277, i32 noundef -1)
  br label %278

278:                                              ; preds = %276
  %279 = load i32, ptr %15, align 4, !tbaa !5
  %280 = add nsw i32 %279, -1
  store i32 %280, ptr %15, align 4, !tbaa !5
  br label %272, !llvm.loop !25

281:                                              ; preds = %272
  %282 = load i32, ptr @sum0, align 4, !tbaa !5
  %283 = load i32, ptr @sum1, align 4, !tbaa !5
  %284 = add nsw i32 %282, %283
  %285 = load i32, ptr @sum1, align 4, !tbaa !5
  %286 = add nsw i32 %284, %285
  %287 = load i32, ptr %16, align 4, !tbaa !5
  %288 = sext i32 %287 to i64
  %289 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %288
  %290 = load i32, ptr %289, align 4, !tbaa !5
  %291 = sext i32 %290 to i64
  %292 = getelementptr inbounds [100001 x i32], ptr @ans, i64 0, i64 %291
  store i32 %286, ptr %292, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %293

293:                                              ; preds = %281
  %294 = load i32, ptr %16, align 4, !tbaa !5
  %295 = add nsw i32 %294, 1
  store i32 %295, ptr %16, align 4, !tbaa !5
  br label %218, !llvm.loop !26

296:                                              ; preds = %222
  br label %297

297:                                              ; preds = %303, %296
  %298 = load i32, ptr %14, align 4, !tbaa !5
  %299 = load i32, ptr %15, align 4, !tbaa !5
  %300 = icmp sle i32 %298, %299
  br i1 %300, label %301, label %306

301:                                              ; preds = %297
  %302 = load i32, ptr %14, align 4, !tbaa !5
  call void @_Z6mo_updii(i32 noundef %302, i32 noundef -1)
  br label %303

303:                                              ; preds = %301
  %304 = load i32, ptr %14, align 4, !tbaa !5
  %305 = add nsw i32 %304, 1
  store i32 %305, ptr %14, align 4, !tbaa !5
  br label %297, !llvm.loop !27

306:                                              ; preds = %297
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  store i32 1, ptr %19, align 4, !tbaa !5
  br label %307

307:                                              ; preds = %317, %306
  %308 = load i32, ptr %19, align 4, !tbaa !5
  %309 = load i32, ptr @m, align 4, !tbaa !5
  %310 = icmp sle i32 %308, %309
  br i1 %310, label %312, label %311

311:                                              ; preds = %307
  store i32 43, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %320

312:                                              ; preds = %307
  %313 = load i32, ptr %19, align 4, !tbaa !5
  %314 = sext i32 %313 to i64
  %315 = getelementptr inbounds [100001 x i32], ptr @ans, i64 0, i64 %314
  %316 = load i32, ptr %315, align 4, !tbaa !5
  call void @_ZN6fastIO7printlnEj(i32 noundef %316)
  br label %317

317:                                              ; preds = %312
  %318 = load i32, ptr %19, align 4, !tbaa !5
  %319 = add nsw i32 %318, 1
  store i32 %319, ptr %19, align 4, !tbaa !5
  br label %307, !llvm.loop !28

320:                                              ; preds = %311
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %77, !llvm.loop !29

321:                                              ; preds = %77
  ret i32 0
}

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6fastIO7printlnEj(i32 noundef) #4

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = !{!20, !6, i64 0}
!20 = !{!"_ZTS5Query", !6, i64 0, !6, i64 4}
!21 = !{!20, !6, i64 4}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10}
!27 = distinct !{!27, !10}
!28 = distinct !{!28, !10}
!29 = distinct !{!29, !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"

%struct.Query = type { i32, i32 }

@tot = external dso_local local_unnamed_addr global i32, align 4
@pr = external dso_local local_unnamed_addr global [1250001 x i32], align 16
@d = external dso_local local_unnamed_addr global [10000001 x i32], align 16
@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@sq = external dso_local local_unnamed_addr global i32, align 4
@a = external dso_local global [100001 x i32], align 16
@b = 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
@ord = external dso_local global [100001 x i32], align 16
@ans = external dso_local local_unnamed_addr global [100001 x i32], align 16
@que = external dso_local global [100001 x %struct.Query], align 16
@ptot = external dso_local local_unnamed_addr global i32, align 4
@p = external dso_local local_unnamed_addr global [9 x i32], align 16
@tail = external dso_local local_unnamed_addr global [100001 x i32], align 16
@sum0 = external dso_local local_unnamed_addr global i32, align 4
@sum1 = external dso_local local_unnamed_addr global i32, align 4

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsii(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z6mo_updii(i32 noundef, i32 noundef) local_unnamed_addr #1

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  store i32 1, ptr getelementptr inbounds (i8, ptr @d, i64 4), align 4, !tbaa !5
  %tot.promoted = load i32, ptr @tot, align 4, !tbaa !5
  br label %6

3:                                                ; preds = %._crit_edge
  tail call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) @t)
  %4 = load i32, ptr @t, align 4, !tbaa !5
  %5 = add nsw i32 %4, -1
  store i32 %5, ptr @t, align 4, !tbaa !5
  %.not146 = icmp eq i32 %4, 0
  br i1 %.not146, label %._crit_edge149, label %.lr.ph148

6:                                                ; preds = %0, %._crit_edge
  %indvars.iv159 = phi i64 [ 2, %0 ], [ %indvars.iv.next160, %._crit_edge ]
  %7 = phi i32 [ %tot.promoted, %0 ], [ %15, %._crit_edge ]
  %8 = getelementptr inbounds [10000001 x i32], ptr @d, i64 0, i64 %indvars.iv159
  %9 = load i32, ptr %8, align 4, !tbaa !5
  %.not88 = icmp eq i32 %9, 0
  %10 = trunc nuw nsw i64 %indvars.iv159 to i32
  br i1 %.not88, label %11, label %._crit_edge180

11:                                               ; preds = %6
  store i32 %10, ptr %8, align 4, !tbaa !5
  %12 = add nsw i32 %7, 1
  store i32 %12, ptr @tot, align 4, !tbaa !5
  %13 = sext i32 %7 to i64
  %14 = getelementptr inbounds [1250001 x i32], ptr @pr, i64 0, i64 %13
  store i32 %10, ptr %14, align 4, !tbaa !5
  br label %._crit_edge180

._crit_edge180:                                   ; preds = %6, %11
  %15 = phi i32 [ %12, %11 ], [ %7, %6 ]
  %16 = load i32, ptr @pr, align 16, !tbaa !5
  %17 = mul nsw i32 %16, %10
  %18 = icmp slt i32 %17, 10000001
  br i1 %18, label %.lr.ph, label %._crit_edge

19:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %20 = getelementptr inbounds [1250001 x i32], ptr @pr, i64 0, i64 %indvars.iv.next
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = mul nsw i32 %21, %10
  %23 = icmp slt i32 %22, 10000001
  br i1 %23, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.lr.ph:                                           ; preds = %._crit_edge180, %19
  %indvars.iv = phi i64 [ %indvars.iv.next, %19 ], [ 0, %._crit_edge180 ]
  %24 = phi i32 [ %22, %19 ], [ %17, %._crit_edge180 ]
  %25 = phi i32 [ %21, %19 ], [ %16, %._crit_edge180 ]
  %26 = sext i32 %24 to i64
  %27 = getelementptr inbounds [10000001 x i32], ptr @d, i64 0, i64 %26
  store i32 %25, ptr %27, align 4, !tbaa !5
  %28 = load i32, ptr %8, align 4, !tbaa !5
  %29 = icmp eq i32 %28, %25
  br i1 %29, label %._crit_edge, label %19

._crit_edge:                                      ; preds = %19, %.lr.ph, %._crit_edge180
  %indvars.iv.next160 = add nuw nsw i64 %indvars.iv159, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next160, 10000001
  br i1 %exitcond.not, label %3, label %6, !llvm.loop !11

.loopexit:                                        ; preds = %.lr.ph145, %._crit_edge116, %.preheader91
  %30 = load i32, ptr @t, align 4, !tbaa !5
  %31 = add nsw i32 %30, -1
  store i32 %31, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %30, 0
  br i1 %.not, label %._crit_edge149, label %.lr.ph148, !llvm.loop !12

.lr.ph148:                                        ; preds = %3, %.loopexit
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) @n)
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) @m)
  %32 = load i32, ptr @m, align 4, !tbaa !5
  br label %33

33:                                               ; preds = %33, %.lr.ph148
  %storemerge = phi i32 [ 1, %.lr.ph148 ], [ %35, %33 ]
  %34 = mul nuw nsw i32 %storemerge, %storemerge
  %.not80 = icmp sgt i32 %34, %32
  %35 = add nuw nsw i32 %storemerge, 1
  br i1 %.not80, label %36, label %33, !llvm.loop !13

36:                                               ; preds = %33
  store i32 %storemerge, ptr @sq, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %37 = load i32, ptr @n, align 4, !tbaa !5
  %38 = sitofp i32 %37 to double
  %39 = add nsw i32 %storemerge, -1
  %40 = sitofp i32 %39 to double
  %41 = fdiv double %38, %40
  %42 = call double @llvm.ceil.f64(double %41)
  %43 = fptosi double %42 to i32
  store i32 %43, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  store i32 1, ptr %2, align 4, !tbaa !5
  %44 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %45 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %44, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %46 = load i32, ptr %45, align 4, !tbaa !5
  store i32 %46, ptr @sq, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  store i32 0, ptr @tail, align 16, !tbaa !5
  store i32 0, ptr @tot, align 4, !tbaa !5
  %47 = load i32, ptr @n, align 4, !tbaa !5
  %.not81109 = icmp slt i32 %47, 1
  br i1 %.not81109, label %.preheader93, label %.lr.ph112

.preheader93:                                     ; preds = %79, %36
  %48 = load i32, ptr @m, align 4, !tbaa !5
  %.not82113 = icmp slt i32 %48, 1
  br i1 %.not82113, label %.preheader93.._crit_edge116_crit_edge, label %.lr.ph115

.preheader93.._crit_edge116_crit_edge:            ; preds = %.preheader93
  %.pre182 = sext i32 %48 to i64
  br label %._crit_edge116

.lr.ph112:                                        ; preds = %36, %79
  %indvars.iv165 = phi i64 [ %indvars.iv.next166, %79 ], [ 1, %36 ]
  %49 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %indvars.iv165
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) %49)
  %50 = load i32, ptr @sq, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %.not86 = icmp sgt i64 %indvars.iv165, %51
  br i1 %.not86, label %52, label %59

52:                                               ; preds = %.lr.ph112
  %53 = trunc nuw nsw i64 %indvars.iv165 to i32
  %54 = sub nsw i32 %53, %50
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [100001 x i32], ptr @pos, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = add nsw i32 %57, 1
  br label %59

59:                                               ; preds = %.lr.ph112, %52
  %60 = phi i32 [ %58, %52 ], [ 1, %.lr.ph112 ]
  %61 = getelementptr inbounds [100001 x i32], ptr @pos, i64 0, i64 %indvars.iv165
  store i32 %60, ptr %61, align 4, !tbaa !5
  %62 = load i32, ptr %49, align 4, !tbaa !5
  %63 = getelementptr inbounds [100001 x i32], ptr @b, i64 0, i64 %indvars.iv165
  store i32 %62, ptr %63, align 4, !tbaa !5
  %64 = icmp sgt i32 %62, 1
  br i1 %64, label %.lr.ph100.preheader, label %79

.lr.ph100.preheader:                              ; preds = %59, %._crit_edge101
  %indvars.iv162 = phi i64 [ %indvars.iv.next163, %._crit_edge101 ], [ 0, %59 ]
  %65 = phi i32 [ %70, %._crit_edge101 ], [ %62, %59 ]
  %.074103 = phi i32 [ %73, %._crit_edge101 ], [ %62, %59 ]
  %66 = zext nneg i32 %.074103 to i64
  %67 = getelementptr inbounds [10000001 x i32], ptr @d, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = sdiv i32 %65, %68
  %70 = sub nsw i32 %65, %69
  %71 = getelementptr inbounds [9 x i32], ptr @p, i64 0, i64 %indvars.iv162
  store i32 %68, ptr %71, align 4, !tbaa !5
  br label %.lr.ph100

._crit_edge101:                                   ; preds = %.lr.ph100
  %indvars.iv.next163 = add nuw nsw i64 %indvars.iv162, 1
  %72 = icmp sgt i32 %73, 1
  br i1 %72, label %.lr.ph100.preheader, label %._crit_edge106, !llvm.loop !14

.lr.ph100:                                        ; preds = %.lr.ph100.preheader, %.lr.ph100
  %.17598 = phi i32 [ %73, %.lr.ph100 ], [ %.074103, %.lr.ph100.preheader ]
  %73 = sdiv i32 %.17598, %68
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [10000001 x i32], ptr @d, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = icmp eq i32 %76, %68
  br i1 %77, label %.lr.ph100, label %._crit_edge101, !llvm.loop !15

._crit_edge106:                                   ; preds = %._crit_edge101
  %78 = trunc nuw i64 %indvars.iv.next163 to i32
  store i32 %70, ptr %63, align 4, !tbaa !5
  br label %79

79:                                               ; preds = %._crit_edge106, %59
  %storemerge87.lcssa = phi i32 [ %78, %._crit_edge106 ], [ 0, %59 ]
  store i32 %storemerge87.lcssa, ptr @ptot, align 4, !tbaa !5
  call void @_Z3dfsii(i32 noundef 0, i32 noundef 1)
  %80 = load i32, ptr @tot, align 4, !tbaa !5
  %81 = getelementptr inbounds [100001 x i32], ptr @tail, i64 0, i64 %indvars.iv165
  store i32 %80, ptr %81, align 4, !tbaa !5
  %indvars.iv.next166 = add nuw nsw i64 %indvars.iv165, 1
  %82 = load i32, ptr @n, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %.not81.not = icmp slt i64 %indvars.iv165, %83
  br i1 %.not81.not, label %.lr.ph112, label %.preheader93, !llvm.loop !16

._crit_edge116:                                   ; preds = %.lr.ph115, %.preheader93.._crit_edge116_crit_edge
  %.pre-phi183 = phi i64 [ %.pre182, %.preheader93.._crit_edge116_crit_edge ], [ %95, %.lr.ph115 ]
  %gep = getelementptr i32, ptr getelementptr inbounds (i8, ptr @ord, i64 4), i64 %.pre-phi183
  call void @"_ZSt4sortIPiZ4mainE3$_0EvT_S2_T0_"(ptr noundef nonnull getelementptr inbounds (i8, ptr @ord, i64 4), ptr noundef nonnull %gep)
  %84 = load i32, ptr @m, align 4, !tbaa !5
  %.not83132 = icmp slt i32 %84, 1
  br i1 %.not83132, label %.loopexit, label %.lr.ph137.preheader

.lr.ph137.preheader:                              ; preds = %._crit_edge116
  %85 = load i32, ptr getelementptr inbounds (i8, ptr @ord, i64 4), align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [100001 x %struct.Query], ptr @que, i64 0, i64 %86
  %88 = load i32, ptr %87, align 8, !tbaa !17
  %89 = add nsw i32 %88, -1
  br label %.lr.ph137

.lr.ph115:                                        ; preds = %.preheader93, %.lr.ph115
  %indvars.iv168 = phi i64 [ %indvars.iv.next169, %.lr.ph115 ], [ 1, %.preheader93 ]
  %90 = getelementptr inbounds [100001 x %struct.Query], ptr @que, i64 0, i64 %indvars.iv168
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) %90)
  %91 = getelementptr inbounds i8, ptr %90, i64 4
  call void @_ZN6fastIO4readERi(ptr noundef nonnull align 4 dereferenceable(4) %91)
  %92 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %indvars.iv168
  %93 = trunc nuw nsw i64 %indvars.iv168 to i32
  store i32 %93, ptr %92, align 4, !tbaa !5
  %indvars.iv.next169 = add nuw nsw i64 %indvars.iv168, 1
  %94 = load i32, ptr @m, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %.not82.not = icmp slt i64 %indvars.iv168, %95
  br i1 %.not82.not, label %.lr.ph115, label %._crit_edge116, !llvm.loop !19

.preheader92:                                     ; preds = %._crit_edge130
  %.not84140 = icmp sgt i32 %.270.lcssa, %.2.lcssa
  br i1 %.not84140, label %.preheader91, label %.lr.ph142

.lr.ph137:                                        ; preds = %.lr.ph137.preheader, %._crit_edge130
  %indvars.iv173 = phi i64 [ %indvars.iv.next174, %._crit_edge130 ], [ 1, %.lr.ph137.preheader ]
  %.067134 = phi i32 [ %.2.lcssa, %._crit_edge130 ], [ %89, %.lr.ph137.preheader ]
  %.068133 = phi i32 [ %.270.lcssa, %._crit_edge130 ], [ %88, %.lr.ph137.preheader ]
  %96 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %indvars.iv173
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [100001 x %struct.Query], ptr @que, i64 0, i64 %98
  %100 = load i32, ptr %99, align 8, !tbaa !17
  %101 = getelementptr inbounds i8, ptr %99, i64 4
  %102 = load i32, ptr %101, align 4, !tbaa !20
  %103 = icmp slt i32 %.067134, %102
  br i1 %103, label %.lr.ph120, label %.preheader90

.preheader90:                                     ; preds = %.lr.ph120, %.lr.ph137
  %.1.lcssa = phi i32 [ %.067134, %.lr.ph137 ], [ %102, %.lr.ph120 ]
  %104 = icmp sgt i32 %.068133, %100
  br i1 %104, label %.lr.ph123, label %.preheader89

.lr.ph120:                                        ; preds = %.lr.ph137, %.lr.ph120
  %.1118 = phi i32 [ %105, %.lr.ph120 ], [ %.067134, %.lr.ph137 ]
  %105 = add nsw i32 %.1118, 1
  call void @_Z6mo_updii(i32 noundef %105, i32 noundef 1)
  %exitcond171.not = icmp eq i32 %105, %102
  br i1 %exitcond171.not, label %.preheader90, label %.lr.ph120, !llvm.loop !21

.preheader89:                                     ; preds = %.preheader90
  %106 = icmp slt i32 %.068133, %100
  br i1 %106, label %.lr.ph126, label %.preheader

.lr.ph123:                                        ; preds = %.preheader90, %.lr.ph123
  %.169122 = phi i32 [ %107, %.lr.ph123 ], [ %.068133, %.preheader90 ]
  %107 = add nsw i32 %.169122, -1
  call void @_Z6mo_updii(i32 noundef %107, i32 noundef 1)
  %108 = icmp sgt i32 %107, %100
  br i1 %108, label %.lr.ph123, label %.preheader, !llvm.loop !22

.preheader:                                       ; preds = %.lr.ph126, %.lr.ph123, %.preheader89
  %.270.lcssa = phi i32 [ %.068133, %.preheader89 ], [ %100, %.lr.ph123 ], [ %100, %.lr.ph126 ]
  %109 = icmp sgt i32 %.1.lcssa, %102
  br i1 %109, label %.lr.ph129, label %._crit_edge130

.lr.ph126:                                        ; preds = %.preheader89, %.lr.ph126
  %.270125 = phi i32 [ %110, %.lr.ph126 ], [ %.068133, %.preheader89 ]
  call void @_Z6mo_updii(i32 noundef %.270125, i32 noundef -1)
  %110 = add nsw i32 %.270125, 1
  %exitcond172.not = icmp eq i32 %110, %100
  br i1 %exitcond172.not, label %.preheader, label %.lr.ph126, !llvm.loop !23

.lr.ph129:                                        ; preds = %.preheader, %.lr.ph129
  %.2128 = phi i32 [ %111, %.lr.ph129 ], [ %.1.lcssa, %.preheader ]
  call void @_Z6mo_updii(i32 noundef %.2128, i32 noundef -1)
  %111 = add nsw i32 %.2128, -1
  %112 = icmp sgt i32 %111, %102
  br i1 %112, label %.lr.ph129, label %._crit_edge130, !llvm.loop !24

._crit_edge130:                                   ; preds = %.lr.ph129, %.preheader
  %.2.lcssa = phi i32 [ %.1.lcssa, %.preheader ], [ %102, %.lr.ph129 ]
  %113 = load i32, ptr @sum0, align 4, !tbaa !5
  %114 = load i32, ptr @sum1, align 4, !tbaa !5
  %reass.add = shl i32 %114, 1
  %115 = add i32 %reass.add, %113
  %116 = load i32, ptr %96, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [100001 x i32], ptr @ans, i64 0, i64 %117
  store i32 %115, ptr %118, align 4, !tbaa !5
  %indvars.iv.next174 = add nuw nsw i64 %indvars.iv173, 1
  %119 = load i32, ptr @m, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %.not83.not = icmp slt i64 %indvars.iv173, %120
  br i1 %.not83.not, label %.lr.ph137, label %.preheader92, !llvm.loop !25

.preheader91.loopexit:                            ; preds = %.lr.ph142
  %.pre = load i32, ptr @m, align 4, !tbaa !5
  br label %.preheader91

.preheader91:                                     ; preds = %.preheader91.loopexit, %.preheader92
  %121 = phi i32 [ %.pre, %.preheader91.loopexit ], [ %119, %.preheader92 ]
  %.not85143 = icmp slt i32 %121, 1
  br i1 %.not85143, label %.loopexit, label %.lr.ph145

.lr.ph142:                                        ; preds = %.preheader92, %.lr.ph142
  %.3141 = phi i32 [ %122, %.lr.ph142 ], [ %.270.lcssa, %.preheader92 ]
  call void @_Z6mo_updii(i32 noundef %.3141, i32 noundef -1)
  %122 = add i32 %.3141, 1
  %exitcond176.not = icmp eq i32 %.3141, %.2.lcssa
  br i1 %exitcond176.not, label %.preheader91.loopexit, label %.lr.ph142, !llvm.loop !26

.lr.ph145:                                        ; preds = %.preheader91, %.lr.ph145
  %indvars.iv177 = phi i64 [ %indvars.iv.next178, %.lr.ph145 ], [ 1, %.preheader91 ]
  %123 = getelementptr inbounds [100001 x i32], ptr @ans, i64 0, i64 %indvars.iv177
  %124 = load i32, ptr %123, align 4, !tbaa !5
  call void @_ZN6fastIO7printlnEj(i32 noundef %124)
  %indvars.iv.next178 = add nuw nsw i64 %indvars.iv177, 1
  %125 = load i32, ptr @m, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %.not85.not = icmp slt i64 %indvars.iv177, %126
  br i1 %.not85.not, label %.lr.ph145, label %.loopexit, !llvm.loop !27

._crit_edge149:                                   ; preds = %.loopexit, %3
  ret i32 0
}

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6fastIO7printlnEj(i32 noundef) local_unnamed_addr #4

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 = !{!18, !6, i64 0}
!18 = !{!"_ZTS5Query", !6, i64 0, !6, i64 4}
!19 = distinct !{!19, !10}
!20 = !{!18, !6, i64 4}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10}
!27 = distinct !{!27, !10}


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