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

; 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 { i64, i64 }
%"struct.std::pair.0" = type <{ i64, i32, [4 x i8] }>

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@L = external dso_local global i32, align 4
@R = external dso_local global i32, align 4
@tot = external dso_local global i32, align 4
@cnt = external dso_local global [1000009 x i32], align 16
@ord = external dso_local global [2 x [1000009 x i32]], align 16
@cur = external dso_local global i32, align 4
@pre = external dso_local global i32, align 4
@inv = external dso_local global [100001 x i64], align 16
@minv = external dso_local global i64, align 8
@maxv = external dso_local global i64, align 8
@dx = external dso_local global i64, align 8
@dy = external dso_local global i64, align 8
@dz = external dso_local global i64, align 8
@invdz = external dso_local global i64, align 8
@ans = external dso_local global i64, align 8
@val = external dso_local global [1000009 x i64], align 16
@tmp = external dso_local global [1000009 x i64], align 16
@que = external dso_local global [1000009 x %"struct.std::pair"], align 16
@seq = external dso_local global [1000009 x %"struct.std::pair"], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [13 x i8], align 1
@_ZL4lowx = external hidden constant i64, align 8
@_ZL4uppx = external hidden constant i64, align 8
@.str.2 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"struct.std::pair.0", align 8
  %4 = alloca i32, align 4
  %5 = alloca { i64, i32 }, align 8
  %6 = alloca %"struct.std::pair.0", align 8
  %7 = alloca i32, align 4
  %8 = alloca { i64, i32 }, align 8
  %9 = alloca i8, align 1
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i64, align 8
  %15 = alloca %"struct.std::pair", align 8
  %16 = alloca i64, align 8
  %17 = alloca %"struct.std::pair", align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca %"struct.std::pair", align 8
  %21 = alloca %"struct.std::pair", align 8
  %22 = alloca %"struct.std::pair", align 8
  %23 = alloca %"struct.std::pair", align 8
  %24 = alloca i32, align 4
  %25 = alloca i64, align 8
  %26 = alloca %"struct.std::pair", align 8
  %27 = alloca %"struct.std::pair", align 8
  %28 = alloca i64, align 8
  %29 = alloca i64, align 8
  %30 = alloca i64, align 8
  %31 = alloca %"struct.std::pair", align 8
  %32 = alloca %"struct.std::pair", align 8
  %33 = alloca %"struct.std::pair", align 8
  %34 = alloca %"struct.std::pair", align 8
  %35 = alloca %"struct.std::pair", align 8
  %36 = alloca i64, align 8
  %37 = alloca i32, align 4
  %38 = alloca i32, align 4
  %39 = alloca %"struct.std::pair", align 8
  %40 = alloca i64, align 8
  %41 = alloca %"struct.std::pair", align 8
  %42 = alloca i64, align 8
  %43 = alloca i32, align 4
  %44 = alloca i8, align 1
  %45 = alloca i32, align 4
  %46 = alloca i32, align 4
  %47 = alloca i32, align 4
  %48 = alloca i32, align 4
  %49 = alloca i32, align 4
  %50 = alloca i32, align 4
  %51 = alloca i64, align 8
  %52 = alloca %"struct.std::pair", align 8
  %53 = alloca %"struct.std::pair", align 8
  store i32 0, ptr %1, align 4
  store i64 1, ptr getelementptr inbounds ([100001 x i64], ptr @inv, i64 0, i64 1), align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  store i32 2, ptr %2, align 4, !tbaa !9
  br label %54

54:                                               ; preds = %72, %0
  %55 = load i32, ptr %2, align 4, !tbaa !9
  %56 = icmp slt i32 %55, 100001
  br i1 %56, label %58, label %57

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

58:                                               ; preds = %54
  %59 = load i32, ptr %2, align 4, !tbaa !9
  %60 = sext i32 %59 to i64
  %61 = sdiv i64 949848565645808449, %60
  %62 = load i32, ptr %2, align 4, !tbaa !9
  %63 = sext i32 %62 to i64
  %64 = srem i64 949848565645808449, %63
  %65 = getelementptr inbounds [100001 x i64], ptr @inv, i64 0, i64 %64
  %66 = load i64, ptr %65, align 8, !tbaa !5
  %67 = call noundef i64 @_Z7mod_mulxx(i64 noundef %61, i64 noundef %66)
  %68 = sub nsw i64 949848565645808449, %67
  %69 = load i32, ptr %2, align 4, !tbaa !9
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [100001 x i64], ptr @inv, i64 0, i64 %70
  store i64 %68, ptr %71, align 8, !tbaa !5
  br label %72

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

75:                                               ; preds = %57
  %76 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %77

77:                                               ; preds = %714, %75
  %78 = load i32, ptr @t, align 4, !tbaa !9
  %79 = add nsw i32 %78, -1
  store i32 %79, ptr @t, align 4, !tbaa !9
  %80 = icmp ne i32 %78, 0
  br i1 %80, label %81, label %717

81:                                               ; preds = %77
  %82 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n, ptr noundef @minv, ptr noundef @maxv)
  store i32 0, ptr @L, align 4, !tbaa !9
  store i32 -1, ptr @R, align 4, !tbaa !9
  store i64 1, ptr @dx, align 8, !tbaa !5
  store i64 0, ptr @dy, align 8, !tbaa !5
  store i64 1, ptr @dz, align 8, !tbaa !5
  store i64 1, ptr @invdz, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %3) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  store i32 0, ptr %4, align 4, !tbaa !9
  %83 = call { i64, i32 } @_ZSt9make_pairIRKxiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 8 dereferenceable(8) @_ZL4lowx, ptr noundef nonnull align 4 dereferenceable(4) %4)
  store { i64, i32 } %83, ptr %5, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %3, ptr align 8 %5, i64 12, i1 false)
  %84 = load i32, ptr @R, align 4, !tbaa !9
  %85 = call noundef i32 @_Z7pos_inci(i32 noundef %84)
  store i32 %85, ptr @R, align 4, !tbaa !9
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %86
  %88 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSIxiEENSt9enable_ifIXsr6__and_ISt13is_assignableIRxOT_ES3_IS4_OT0_EEE5valueERS0_E4typeEOS_IS5_S8_E(ptr noundef nonnull align 8 dereferenceable(16) %87, ptr noundef nonnull align 8 dereferenceable(12) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %3) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  store i32 0, ptr %7, align 4, !tbaa !9
  %89 = call { i64, i32 } @_ZSt9make_pairIRKxiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 8 dereferenceable(8) @_ZL4uppx, ptr noundef nonnull align 4 dereferenceable(4) %7)
  store { i64, i32 } %89, ptr %8, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %6, ptr align 8 %8, i64 12, i1 false)
  %90 = load i32, ptr @R, align 4, !tbaa !9
  %91 = call noundef i32 @_Z7pos_inci(i32 noundef %90)
  store i32 %91, ptr @R, align 4, !tbaa !9
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %92
  %94 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSIxiEENSt9enable_ifIXsr6__and_ISt13is_assignableIRxOT_ES3_IS4_OT0_EEE5valueERS0_E4typeEOS_IS5_S8_E(ptr noundef nonnull align 8 dereferenceable(16) %93, ptr noundef nonnull align 8 dereferenceable(12) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #8
  br label %95

95:                                               ; preds = %436, %81
  %96 = load i32, ptr @n, align 4, !tbaa !9
  %97 = add nsw i32 %96, -1
  store i32 %97, ptr @n, align 4, !tbaa !9
  %98 = icmp ne i32 %96, 0
  br i1 %98, label %99, label %437

99:                                               ; preds = %95
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  %100 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %9, ptr noundef %10)
  %101 = load i8, ptr %9, align 1, !tbaa !13
  %102 = sext i8 %101 to i32
  %103 = icmp eq i32 %102, 43
  br i1 %103, label %104, label %108

104:                                              ; preds = %99
  %105 = load i64, ptr @dy, align 8, !tbaa !5
  %106 = load i64, ptr %10, align 8, !tbaa !5
  %107 = call noundef i64 @_Z7mod_addxx(i64 noundef %105, i64 noundef %106)
  store i64 %107, ptr @dy, align 8, !tbaa !5
  br label %179

108:                                              ; preds = %99
  %109 = load i8, ptr %9, align 1, !tbaa !13
  %110 = sext i8 %109 to i32
  %111 = icmp eq i32 %110, 45
  br i1 %111, label %112, label %116

112:                                              ; preds = %108
  %113 = load i64, ptr @dy, align 8, !tbaa !5
  %114 = load i64, ptr %10, align 8, !tbaa !5
  %115 = call noundef i64 @_Z7mod_subxx(i64 noundef %113, i64 noundef %114)
  store i64 %115, ptr @dy, align 8, !tbaa !5
  br label %178

116:                                              ; preds = %108
  %117 = load i8, ptr %9, align 1, !tbaa !13
  %118 = sext i8 %117 to i32
  %119 = icmp eq i32 %118, 42
  br i1 %119, label %120, label %135

120:                                              ; preds = %116
  %121 = load i64, ptr @dx, align 8, !tbaa !5
  %122 = load i64, ptr %10, align 8, !tbaa !5
  %123 = call noundef i64 @_Z7mod_mulxx(i64 noundef %121, i64 noundef %122)
  store i64 %123, ptr @dx, align 8, !tbaa !5
  %124 = load i64, ptr @dy, align 8, !tbaa !5
  %125 = load i64, ptr %10, align 8, !tbaa !5
  %126 = call noundef i64 @_Z7mod_mulxx(i64 noundef %124, i64 noundef %125)
  store i64 %126, ptr @dy, align 8, !tbaa !5
  %127 = load i64, ptr @dz, align 8, !tbaa !5
  %128 = load i64, ptr %10, align 8, !tbaa !5
  %129 = call noundef i64 @_Z7mod_mulxx(i64 noundef %127, i64 noundef %128)
  store i64 %129, ptr @dz, align 8, !tbaa !5
  %130 = load i64, ptr @invdz, align 8, !tbaa !5
  %131 = load i64, ptr %10, align 8, !tbaa !5
  %132 = getelementptr inbounds [100001 x i64], ptr @inv, i64 0, i64 %131
  %133 = load i64, ptr %132, align 8, !tbaa !5
  %134 = call noundef i64 @_Z7mod_mulxx(i64 noundef %130, i64 noundef %133)
  store i64 %134, ptr @invdz, align 8, !tbaa !5
  br label %177

135:                                              ; preds = %116
  %136 = load i8, ptr %9, align 1, !tbaa !13
  %137 = sext i8 %136 to i32
  %138 = icmp eq i32 %137, 64
  br i1 %138, label %139, label %176

139:                                              ; preds = %135
  %140 = load i32, ptr @L, align 4, !tbaa !9
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %141
  %143 = getelementptr inbounds %"struct.std::pair", ptr %142, i32 0, i32 0
  %144 = load i64, ptr %143, align 16, !tbaa !14
  %145 = icmp slt i64 1, %144
  br i1 %145, label %146, label %155

146:                                              ; preds = %139
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  %147 = load i32, ptr @L, align 4, !tbaa !9
  store i32 %147, ptr %11, align 4, !tbaa !9
  %148 = call noundef i32 @_Z7pos_decRi(ptr noundef nonnull align 4 dereferenceable(4) @L)
  store i32 %148, ptr @L, align 4, !tbaa !9
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %149
  %151 = getelementptr inbounds %"struct.std::pair", ptr %150, i32 0, i32 0
  store i64 1, ptr %151, align 16, !tbaa !14
  %152 = load i32, ptr @L, align 4, !tbaa !9
  %153 = load i32, ptr %11, align 4, !tbaa !9
  %154 = call noundef i64 @_Z7val_geti(i32 noundef %153)
  call void @_Z7val_setix(i32 noundef %152, i64 noundef %154)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  br label %155

155:                                              ; preds = %146, %139
  %156 = load i32, ptr @R, align 4, !tbaa !9
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %157
  %159 = getelementptr inbounds %"struct.std::pair", ptr %158, i32 0, i32 0
  %160 = load i64, ptr %159, align 16, !tbaa !14
  %161 = icmp sgt i64 10000000000, %160
  br i1 %161, label %162, label %172

162:                                              ; preds = %155
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  %163 = load i32, ptr @R, align 4, !tbaa !9
  store i32 %163, ptr %12, align 4, !tbaa !9
  %164 = load i32, ptr @R, align 4, !tbaa !9
  %165 = call noundef i32 @_Z7pos_inci(i32 noundef %164)
  store i32 %165, ptr @R, align 4, !tbaa !9
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %166
  %168 = getelementptr inbounds %"struct.std::pair", ptr %167, i32 0, i32 0
  store i64 10000000000, ptr %168, align 16, !tbaa !14
  %169 = load i32, ptr @R, align 4, !tbaa !9
  %170 = load i32, ptr %12, align 4, !tbaa !9
  %171 = call noundef i64 @_Z7val_geti(i32 noundef %170)
  call void @_Z7val_setix(i32 noundef %169, i64 noundef %171)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %172

172:                                              ; preds = %162, %155
  %173 = load i64, ptr @dx, align 8, !tbaa !5
  %174 = load i64, ptr %10, align 8, !tbaa !5
  %175 = call noundef i64 @_Z7mod_addxx(i64 noundef %173, i64 noundef %174)
  store i64 %175, ptr @dx, align 8, !tbaa !5
  br label %176

176:                                              ; preds = %172, %135
  br label %177

177:                                              ; preds = %176, %120
  br label %178

178:                                              ; preds = %177, %112
  br label %179

179:                                              ; preds = %178, %104
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  store i32 -1, ptr %13, align 4, !tbaa !9
  br label %180

180:                                              ; preds = %191, %179
  %181 = load i32, ptr @L, align 4, !tbaa !9
  %182 = load i32, ptr @R, align 4, !tbaa !9
  %183 = icmp ne i32 %181, %182
  br i1 %183, label %184, label %189

184:                                              ; preds = %180
  %185 = load i32, ptr @L, align 4, !tbaa !9
  %186 = call noundef i64 @_Z7val_geti(i32 noundef %185)
  %187 = load i64, ptr @minv, align 8, !tbaa !5
  %188 = icmp slt i64 %186, %187
  br label %189

189:                                              ; preds = %184, %180
  %190 = phi i1 [ false, %180 ], [ %188, %184 ]
  br i1 %190, label %191, label %195

191:                                              ; preds = %189
  %192 = load i32, ptr @L, align 4, !tbaa !9
  store i32 %192, ptr %13, align 4, !tbaa !9
  %193 = load i32, ptr @L, align 4, !tbaa !9
  %194 = call noundef i32 @_Z7pos_inci(i32 noundef %193)
  store i32 %194, ptr @L, align 4, !tbaa !9
  br label %180, !llvm.loop !16

195:                                              ; preds = %189
  %196 = load i32, ptr %13, align 4, !tbaa !9
  %197 = icmp ne i32 %196, -1
  br i1 %197, label %198, label %300

198:                                              ; preds = %195
  %199 = load i32, ptr @L, align 4, !tbaa !9
  %200 = call noundef i64 @_Z7val_geti(i32 noundef %199)
  %201 = load i64, ptr @minv, align 8, !tbaa !5
  %202 = icmp sgt i64 %200, %201
  br i1 %202, label %203, label %300

203:                                              ; preds = %198
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #8
  %204 = load i32, ptr %13, align 4, !tbaa !9
  %205 = sext i32 %204 to i64
  %206 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %205
  %207 = getelementptr inbounds %"struct.std::pair", ptr %206, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  %208 = load i32, ptr %13, align 4, !tbaa !9
  %209 = call noundef i64 @_Z7val_geti(i32 noundef %208)
  store i64 %209, ptr %16, align 8, !tbaa !5
  %210 = call { i64, i64 } @_ZSt9make_pairIRxxESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %207, ptr noundef nonnull align 8 dereferenceable(8) %16)
  %211 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 0
  %212 = extractvalue { i64, i64 } %210, 0
  store i64 %212, ptr %211, align 8
  %213 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 1
  %214 = extractvalue { i64, i64 } %210, 1
  store i64 %214, ptr %213, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr %17) #8
  %215 = load i32, ptr @L, align 4, !tbaa !9
  %216 = sext i32 %215 to i64
  %217 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %216
  %218 = getelementptr inbounds %"struct.std::pair", ptr %217, i32 0, i32 0
  %219 = load i32, ptr @L, align 4, !tbaa !9
  %220 = call noundef i64 @_Z7val_geti(i32 noundef %219)
  store i64 %220, ptr %14, align 8, !tbaa !5
  %221 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %218, ptr noundef nonnull align 8 dereferenceable(8) %14)
  %222 = getelementptr inbounds { i64, i64 }, ptr %17, i32 0, i32 0
  %223 = extractvalue { i64, i64 } %221, 0
  store i64 %223, ptr %222, align 8
  %224 = getelementptr inbounds { i64, i64 }, ptr %17, i32 0, i32 1
  %225 = extractvalue { i64, i64 } %221, 1
  store i64 %225, ptr %224, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  %226 = getelementptr inbounds %"struct.std::pair", ptr %17, i32 0, i32 1
  %227 = load i64, ptr %226, align 8, !tbaa !17
  %228 = getelementptr inbounds %"struct.std::pair", ptr %15, i32 0, i32 1
  %229 = load i64, ptr %228, align 8, !tbaa !17
  %230 = sub nsw i64 %227, %229
  %231 = getelementptr inbounds %"struct.std::pair", ptr %17, i32 0, i32 0
  %232 = load i64, ptr %231, align 8, !tbaa !14
  %233 = getelementptr inbounds %"struct.std::pair", ptr %15, i32 0, i32 0
  %234 = load i64, ptr %233, align 8, !tbaa !14
  %235 = sub nsw i64 %232, %234
  %236 = sdiv i64 %230, %235
  store i64 %236, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  %237 = load i64, ptr @minv, align 8, !tbaa !5
  %238 = getelementptr inbounds %"struct.std::pair", ptr %15, i32 0, i32 1
  %239 = load i64, ptr %238, align 8, !tbaa !17
  %240 = sub nsw i64 %237, %239
  %241 = sub nsw i64 %240, 1
  %242 = load i64, ptr %18, align 8, !tbaa !5
  %243 = sdiv i64 %241, %242
  %244 = getelementptr inbounds %"struct.std::pair", ptr %15, i32 0, i32 0
  %245 = load i64, ptr %244, align 8, !tbaa !14
  %246 = add nsw i64 %243, %245
  %247 = add nsw i64 %246, 1
  store i64 %247, ptr %19, align 8, !tbaa !5
  %248 = load i64, ptr %19, align 8, !tbaa !5
  %249 = load i32, ptr @L, align 4, !tbaa !9
  %250 = sext i32 %249 to i64
  %251 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %250
  %252 = getelementptr inbounds %"struct.std::pair", ptr %251, i32 0, i32 0
  %253 = load i64, ptr %252, align 16, !tbaa !14
  %254 = icmp slt i64 %248, %253
  br i1 %254, label %255, label %273

255:                                              ; preds = %203
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %20, ptr align 8 %15, i64 16, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %21, ptr align 8 %17, i64 16, i1 false)
  %256 = load i64, ptr %19, align 8, !tbaa !5
  %257 = getelementptr inbounds { i64, i64 }, ptr %20, i32 0, i32 0
  %258 = load i64, ptr %257, align 8
  %259 = getelementptr inbounds { i64, i64 }, ptr %20, i32 0, i32 1
  %260 = load i64, ptr %259, align 8
  %261 = getelementptr inbounds { i64, i64 }, ptr %21, i32 0, i32 0
  %262 = load i64, ptr %261, align 8
  %263 = getelementptr inbounds { i64, i64 }, ptr %21, i32 0, i32 1
  %264 = load i64, ptr %263, align 8
  %265 = call noundef i64 @_Z12get_line_valSt4pairIxxES0_x(i64 %258, i64 %260, i64 %262, i64 %264, i64 noundef %256)
  store i64 %265, ptr %14, align 8, !tbaa !5
  %266 = load i64, ptr %19, align 8, !tbaa !5
  %267 = call noundef i32 @_Z7pos_decRi(ptr noundef nonnull align 4 dereferenceable(4) @L)
  store i32 %267, ptr @L, align 4, !tbaa !9
  %268 = sext i32 %267 to i64
  %269 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %268
  %270 = getelementptr inbounds %"struct.std::pair", ptr %269, i32 0, i32 0
  store i64 %266, ptr %270, align 16, !tbaa !14
  %271 = load i32, ptr @L, align 4, !tbaa !9
  %272 = load i64, ptr %14, align 8, !tbaa !5
  call void @_Z7val_setix(i32 noundef %271, i64 noundef %272)
  br label %273

273:                                              ; preds = %255, %203
  %274 = load i64, ptr %19, align 8, !tbaa !5
  %275 = icmp sgt i64 %274, 1
  br i1 %275, label %276, label %299

276:                                              ; preds = %273
  %277 = load i64, ptr %14, align 8, !tbaa !5
  %278 = load i64, ptr @minv, align 8, !tbaa !5
  %279 = icmp sgt i64 %277, %278
  br i1 %279, label %280, label %299

280:                                              ; preds = %276
  %281 = load i64, ptr %19, align 8, !tbaa !5
  %282 = sub nsw i64 %281, 1
  %283 = call noundef i32 @_Z7pos_decRi(ptr noundef nonnull align 4 dereferenceable(4) @L)
  store i32 %283, ptr @L, align 4, !tbaa !9
  %284 = sext i32 %283 to i64
  %285 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %284
  %286 = getelementptr inbounds %"struct.std::pair", ptr %285, i32 0, i32 0
  store i64 %282, ptr %286, align 16, !tbaa !14
  %287 = load i32, ptr @L, align 4, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %22, ptr align 8 %15, i64 16, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %23, ptr align 8 %17, i64 16, i1 false)
  %288 = load i64, ptr %19, align 8, !tbaa !5
  %289 = sub nsw i64 %288, 1
  %290 = getelementptr inbounds { i64, i64 }, ptr %22, i32 0, i32 0
  %291 = load i64, ptr %290, align 8
  %292 = getelementptr inbounds { i64, i64 }, ptr %22, i32 0, i32 1
  %293 = load i64, ptr %292, align 8
  %294 = getelementptr inbounds { i64, i64 }, ptr %23, i32 0, i32 0
  %295 = load i64, ptr %294, align 8
  %296 = getelementptr inbounds { i64, i64 }, ptr %23, i32 0, i32 1
  %297 = load i64, ptr %296, align 8
  %298 = call noundef i64 @_Z12get_line_valSt4pairIxxES0_x(i64 %291, i64 %293, i64 %295, i64 %297, i64 noundef %289)
  call void @_Z7val_setix(i32 noundef %287, i64 noundef %298)
  br label %299

299:                                              ; preds = %280, %276, %273
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  br label %300

300:                                              ; preds = %299, %198, %195
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #8
  store i32 -1, ptr %24, align 4, !tbaa !9
  br label %301

301:                                              ; preds = %312, %300
  %302 = load i32, ptr @L, align 4, !tbaa !9
  %303 = load i32, ptr @R, align 4, !tbaa !9
  %304 = icmp ne i32 %302, %303
  br i1 %304, label %305, label %310

305:                                              ; preds = %301
  %306 = load i32, ptr @R, align 4, !tbaa !9
  %307 = call noundef i64 @_Z7val_geti(i32 noundef %306)
  %308 = load i64, ptr @maxv, align 8, !tbaa !5
  %309 = icmp sgt i64 %307, %308
  br label %310

310:                                              ; preds = %305, %301
  %311 = phi i1 [ false, %301 ], [ %309, %305 ]
  br i1 %311, label %312, label %315

312:                                              ; preds = %310
  %313 = load i32, ptr @R, align 4, !tbaa !9
  store i32 %313, ptr %24, align 4, !tbaa !9
  %314 = call noundef i32 @_Z7pos_decRi(ptr noundef nonnull align 4 dereferenceable(4) @R)
  store i32 %314, ptr @R, align 4, !tbaa !9
  br label %301, !llvm.loop !18

315:                                              ; preds = %310
  %316 = load i32, ptr %24, align 4, !tbaa !9
  %317 = icmp ne i32 %316, -1
  br i1 %317, label %318, label %420

318:                                              ; preds = %315
  %319 = load i32, ptr @R, align 4, !tbaa !9
  %320 = call noundef i64 @_Z7val_geti(i32 noundef %319)
  %321 = load i64, ptr @maxv, align 8, !tbaa !5
  %322 = icmp slt i64 %320, %321
  br i1 %322, label %323, label %420

323:                                              ; preds = %318
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr %26) #8
  %324 = load i32, ptr @R, align 4, !tbaa !9
  %325 = sext i32 %324 to i64
  %326 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %325
  %327 = getelementptr inbounds %"struct.std::pair", ptr %326, i32 0, i32 0
  %328 = load i32, ptr @R, align 4, !tbaa !9
  %329 = call noundef i64 @_Z7val_geti(i32 noundef %328)
  store i64 %329, ptr %25, align 8, !tbaa !5
  %330 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %327, ptr noundef nonnull align 8 dereferenceable(8) %25)
  %331 = getelementptr inbounds { i64, i64 }, ptr %26, i32 0, i32 0
  %332 = extractvalue { i64, i64 } %330, 0
  store i64 %332, ptr %331, align 8
  %333 = getelementptr inbounds { i64, i64 }, ptr %26, i32 0, i32 1
  %334 = extractvalue { i64, i64 } %330, 1
  store i64 %334, ptr %333, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %27) #8
  %335 = load i32, ptr %24, align 4, !tbaa !9
  %336 = sext i32 %335 to i64
  %337 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %336
  %338 = getelementptr inbounds %"struct.std::pair", ptr %337, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #8
  %339 = load i32, ptr %24, align 4, !tbaa !9
  %340 = call noundef i64 @_Z7val_geti(i32 noundef %339)
  store i64 %340, ptr %28, align 8, !tbaa !5
  %341 = call { i64, i64 } @_ZSt9make_pairIRxxESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %338, ptr noundef nonnull align 8 dereferenceable(8) %28)
  %342 = getelementptr inbounds { i64, i64 }, ptr %27, i32 0, i32 0
  %343 = extractvalue { i64, i64 } %341, 0
  store i64 %343, ptr %342, align 8
  %344 = getelementptr inbounds { i64, i64 }, ptr %27, i32 0, i32 1
  %345 = extractvalue { i64, i64 } %341, 1
  store i64 %345, ptr %344, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #8
  %346 = getelementptr inbounds %"struct.std::pair", ptr %27, i32 0, i32 1
  %347 = load i64, ptr %346, align 8, !tbaa !17
  %348 = getelementptr inbounds %"struct.std::pair", ptr %26, i32 0, i32 1
  %349 = load i64, ptr %348, align 8, !tbaa !17
  %350 = sub nsw i64 %347, %349
  %351 = getelementptr inbounds %"struct.std::pair", ptr %27, i32 0, i32 0
  %352 = load i64, ptr %351, align 8, !tbaa !14
  %353 = getelementptr inbounds %"struct.std::pair", ptr %26, i32 0, i32 0
  %354 = load i64, ptr %353, align 8, !tbaa !14
  %355 = sub nsw i64 %352, %354
  %356 = sdiv i64 %350, %355
  store i64 %356, ptr %29, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #8
  %357 = load i64, ptr @maxv, align 8, !tbaa !5
  %358 = getelementptr inbounds %"struct.std::pair", ptr %26, i32 0, i32 1
  %359 = load i64, ptr %358, align 8, !tbaa !17
  %360 = sub nsw i64 %357, %359
  %361 = load i64, ptr %29, align 8, !tbaa !5
  %362 = sdiv i64 %360, %361
  %363 = getelementptr inbounds %"struct.std::pair", ptr %26, i32 0, i32 0
  %364 = load i64, ptr %363, align 8, !tbaa !14
  %365 = add nsw i64 %362, %364
  store i64 %365, ptr %30, align 8, !tbaa !5
  %366 = load i64, ptr %30, align 8, !tbaa !5
  %367 = load i32, ptr @R, align 4, !tbaa !9
  %368 = sext i32 %367 to i64
  %369 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %368
  %370 = getelementptr inbounds %"struct.std::pair", ptr %369, i32 0, i32 0
  %371 = load i64, ptr %370, align 16, !tbaa !14
  %372 = icmp sgt i64 %366, %371
  br i1 %372, label %373, label %392

373:                                              ; preds = %323
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %31, ptr align 8 %26, i64 16, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %32, ptr align 8 %27, i64 16, i1 false)
  %374 = load i64, ptr %30, align 8, !tbaa !5
  %375 = getelementptr inbounds { i64, i64 }, ptr %31, i32 0, i32 0
  %376 = load i64, ptr %375, align 8
  %377 = getelementptr inbounds { i64, i64 }, ptr %31, i32 0, i32 1
  %378 = load i64, ptr %377, align 8
  %379 = getelementptr inbounds { i64, i64 }, ptr %32, i32 0, i32 0
  %380 = load i64, ptr %379, align 8
  %381 = getelementptr inbounds { i64, i64 }, ptr %32, i32 0, i32 1
  %382 = load i64, ptr %381, align 8
  %383 = call noundef i64 @_Z12get_line_valSt4pairIxxES0_x(i64 %376, i64 %378, i64 %380, i64 %382, i64 noundef %374)
  store i64 %383, ptr %25, align 8, !tbaa !5
  %384 = load i64, ptr %30, align 8, !tbaa !5
  %385 = load i32, ptr @R, align 4, !tbaa !9
  %386 = call noundef i32 @_Z7pos_inci(i32 noundef %385)
  store i32 %386, ptr @R, align 4, !tbaa !9
  %387 = sext i32 %386 to i64
  %388 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %387
  %389 = getelementptr inbounds %"struct.std::pair", ptr %388, i32 0, i32 0
  store i64 %384, ptr %389, align 16, !tbaa !14
  %390 = load i32, ptr @R, align 4, !tbaa !9
  %391 = load i64, ptr %25, align 8, !tbaa !5
  call void @_Z7val_setix(i32 noundef %390, i64 noundef %391)
  br label %392

392:                                              ; preds = %373, %323
  %393 = load i64, ptr %30, align 8, !tbaa !5
  %394 = icmp slt i64 %393, 10000000000
  br i1 %394, label %395, label %419

395:                                              ; preds = %392
  %396 = load i64, ptr %25, align 8, !tbaa !5
  %397 = load i64, ptr @maxv, align 8, !tbaa !5
  %398 = icmp slt i64 %396, %397
  br i1 %398, label %399, label %419

399:                                              ; preds = %395
  %400 = load i64, ptr %30, align 8, !tbaa !5
  %401 = add nsw i64 %400, 1
  %402 = load i32, ptr @R, align 4, !tbaa !9
  %403 = call noundef i32 @_Z7pos_inci(i32 noundef %402)
  store i32 %403, ptr @R, align 4, !tbaa !9
  %404 = sext i32 %403 to i64
  %405 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %404
  %406 = getelementptr inbounds %"struct.std::pair", ptr %405, i32 0, i32 0
  store i64 %401, ptr %406, align 16, !tbaa !14
  %407 = load i32, ptr @R, align 4, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %33, ptr align 8 %26, i64 16, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %34, ptr align 8 %27, i64 16, i1 false)
  %408 = load i64, ptr %30, align 8, !tbaa !5
  %409 = add nsw i64 %408, 1
  %410 = getelementptr inbounds { i64, i64 }, ptr %33, i32 0, i32 0
  %411 = load i64, ptr %410, align 8
  %412 = getelementptr inbounds { i64, i64 }, ptr %33, i32 0, i32 1
  %413 = load i64, ptr %412, align 8
  %414 = getelementptr inbounds { i64, i64 }, ptr %34, i32 0, i32 0
  %415 = load i64, ptr %414, align 8
  %416 = getelementptr inbounds { i64, i64 }, ptr %34, i32 0, i32 1
  %417 = load i64, ptr %416, align 8
  %418 = call noundef i64 @_Z12get_line_valSt4pairIxxES0_x(i64 %411, i64 %413, i64 %415, i64 %417, i64 noundef %409)
  call void @_Z7val_setix(i32 noundef %407, i64 noundef %418)
  br label %419

419:                                              ; preds = %399, %395, %392
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %27) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %26) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #8
  br label %420

420:                                              ; preds = %419, %318, %315
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #8
  %421 = load i32, ptr @L, align 4, !tbaa !9
  %422 = call noundef i64 @_Z7val_geti(i32 noundef %421)
  %423 = load i64, ptr @minv, align 8, !tbaa !5
  %424 = icmp slt i64 %422, %423
  br i1 %424, label %425, label %428

425:                                              ; preds = %420
  %426 = load i32, ptr @L, align 4, !tbaa !9
  %427 = load i64, ptr @minv, align 8, !tbaa !5
  call void @_Z7val_setix(i32 noundef %426, i64 noundef %427)
  br label %428

428:                                              ; preds = %425, %420
  %429 = load i32, ptr @R, align 4, !tbaa !9
  %430 = call noundef i64 @_Z7val_geti(i32 noundef %429)
  %431 = load i64, ptr @maxv, align 8, !tbaa !5
  %432 = icmp sgt i64 %430, %431
  br i1 %432, label %433, label %436

433:                                              ; preds = %428
  %434 = load i32, ptr @R, align 4, !tbaa !9
  %435 = load i64, ptr @maxv, align 8, !tbaa !5
  call void @_Z7val_setix(i32 noundef %434, i64 noundef %435)
  br label %436

436:                                              ; preds = %433, %428
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #8
  br label %95, !llvm.loop !19

437:                                              ; preds = %95
  store i32 0, ptr @tot, align 4, !tbaa !9
  %438 = load i32, ptr @L, align 4, !tbaa !9
  %439 = sext i32 %438 to i64
  %440 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %439
  %441 = getelementptr inbounds %"struct.std::pair", ptr %440, i32 0, i32 0
  %442 = load i64, ptr %441, align 16, !tbaa !14
  %443 = icmp slt i64 1, %442
  br i1 %443, label %444, label %457

444:                                              ; preds = %437
  call void @llvm.lifetime.start.p0(i64 16, ptr %35) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %36) #8
  %445 = load i32, ptr @L, align 4, !tbaa !9
  %446 = call noundef i64 @_Z7val_geti(i32 noundef %445)
  store i64 %446, ptr %36, align 8, !tbaa !5
  %447 = call { i64, i64 } @_ZSt9make_pairIRKxxESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 8 dereferenceable(8) @_ZL4lowx, ptr noundef nonnull align 8 dereferenceable(8) %36)
  %448 = getelementptr inbounds { i64, i64 }, ptr %35, i32 0, i32 0
  %449 = extractvalue { i64, i64 } %447, 0
  store i64 %449, ptr %448, align 8
  %450 = getelementptr inbounds { i64, i64 }, ptr %35, i32 0, i32 1
  %451 = extractvalue { i64, i64 } %447, 1
  store i64 %451, ptr %450, align 8
  %452 = load i32, ptr @tot, align 4, !tbaa !9
  %453 = add nsw i32 %452, 1
  store i32 %453, ptr @tot, align 4, !tbaa !9
  %454 = sext i32 %452 to i64
  %455 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @seq, i64 0, i64 %454
  %456 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) %455, ptr noundef nonnull align 8 dereferenceable(16) %35) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %36) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %35) #8
  br label %457

457:                                              ; preds = %444, %437
  call void @llvm.lifetime.start.p0(i64 4, ptr %37) #8
  %458 = load i32, ptr @L, align 4, !tbaa !9
  store i32 %458, ptr %37, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %38) #8
  %459 = load i32, ptr @R, align 4, !tbaa !9
  %460 = call noundef i32 @_Z7pos_inci(i32 noundef %459)
  store i32 %460, ptr %38, align 4, !tbaa !9
  br label %461

461:                                              ; preds = %483, %457
  %462 = load i32, ptr %37, align 4, !tbaa !9
  %463 = load i32, ptr %38, align 4, !tbaa !9
  %464 = icmp ne i32 %462, %463
  br i1 %464, label %466, label %465

465:                                              ; preds = %461
  call void @llvm.lifetime.end.p0(i64 4, ptr %38) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %37) #8
  br label %486

466:                                              ; preds = %461
  call void @llvm.lifetime.start.p0(i64 16, ptr %39) #8
  %467 = load i32, ptr %37, align 4, !tbaa !9
  %468 = sext i32 %467 to i64
  %469 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %468
  %470 = getelementptr inbounds %"struct.std::pair", ptr %469, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 8, ptr %40) #8
  %471 = load i32, ptr %37, align 4, !tbaa !9
  %472 = call noundef i64 @_Z7val_geti(i32 noundef %471)
  store i64 %472, ptr %40, align 8, !tbaa !5
  %473 = call { i64, i64 } @_ZSt9make_pairIRxxESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %470, ptr noundef nonnull align 8 dereferenceable(8) %40)
  %474 = getelementptr inbounds { i64, i64 }, ptr %39, i32 0, i32 0
  %475 = extractvalue { i64, i64 } %473, 0
  store i64 %475, ptr %474, align 8
  %476 = getelementptr inbounds { i64, i64 }, ptr %39, i32 0, i32 1
  %477 = extractvalue { i64, i64 } %473, 1
  store i64 %477, ptr %476, align 8
  %478 = load i32, ptr @tot, align 4, !tbaa !9
  %479 = add nsw i32 %478, 1
  store i32 %479, ptr @tot, align 4, !tbaa !9
  %480 = sext i32 %478 to i64
  %481 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @seq, i64 0, i64 %480
  %482 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) %481, ptr noundef nonnull align 8 dereferenceable(16) %39) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %40) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %39) #8
  br label %483

483:                                              ; preds = %466
  %484 = load i32, ptr %37, align 4, !tbaa !9
  %485 = call noundef i32 @_Z7pos_inci(i32 noundef %484)
  store i32 %485, ptr %37, align 4, !tbaa !9
  br label %461, !llvm.loop !20

486:                                              ; preds = %465
  %487 = load i32, ptr @R, align 4, !tbaa !9
  %488 = sext i32 %487 to i64
  %489 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %488
  %490 = getelementptr inbounds %"struct.std::pair", ptr %489, i32 0, i32 0
  %491 = load i64, ptr %490, align 16, !tbaa !14
  %492 = icmp slt i64 %491, 10000000000
  br i1 %492, label %493, label %506

493:                                              ; preds = %486
  call void @llvm.lifetime.start.p0(i64 16, ptr %41) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %42) #8
  %494 = load i32, ptr @R, align 4, !tbaa !9
  %495 = call noundef i64 @_Z7val_geti(i32 noundef %494)
  store i64 %495, ptr %42, align 8, !tbaa !5
  %496 = call { i64, i64 } @_ZSt9make_pairIRKxxESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 8 dereferenceable(8) @_ZL4uppx, ptr noundef nonnull align 8 dereferenceable(8) %42)
  %497 = getelementptr inbounds { i64, i64 }, ptr %41, i32 0, i32 0
  %498 = extractvalue { i64, i64 } %496, 0
  store i64 %498, ptr %497, align 8
  %499 = getelementptr inbounds { i64, i64 }, ptr %41, i32 0, i32 1
  %500 = extractvalue { i64, i64 } %496, 1
  store i64 %500, ptr %499, align 8
  %501 = load i32, ptr @tot, align 4, !tbaa !9
  %502 = add nsw i32 %501, 1
  store i32 %502, ptr @tot, align 4, !tbaa !9
  %503 = sext i32 %501 to i64
  %504 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @seq, i64 0, i64 %503
  %505 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) %504, ptr noundef nonnull align 8 dereferenceable(16) %41) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %42) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %41) #8
  br label %506

506:                                              ; preds = %493, %486
  %507 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %43) #8
  store i32 0, ptr %43, align 4, !tbaa !9
  br label %508

508:                                              ; preds = %525, %506
  %509 = load i32, ptr %43, align 4, !tbaa !9
  %510 = load i32, ptr @n, align 4, !tbaa !9
  %511 = icmp slt i32 %509, %510
  br i1 %511, label %513, label %512

512:                                              ; preds = %508
  call void @llvm.lifetime.end.p0(i64 4, ptr %43) #8
  br label %528

513:                                              ; preds = %508
  %514 = load i32, ptr %43, align 4, !tbaa !9
  %515 = sext i32 %514 to i64
  %516 = getelementptr inbounds i64, ptr @val, i64 %515
  %517 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef %516)
  %518 = load i32, ptr %43, align 4, !tbaa !9
  %519 = load i32, ptr @cur, align 4, !tbaa !9
  %520 = sext i32 %519 to i64
  %521 = getelementptr inbounds [2 x [1000009 x i32]], ptr @ord, i64 0, i64 %520
  %522 = load i32, ptr %43, align 4, !tbaa !9
  %523 = sext i32 %522 to i64
  %524 = getelementptr inbounds [1000009 x i32], ptr %521, i64 0, i64 %523
  store i32 %518, ptr %524, align 4, !tbaa !9
  br label %525

525:                                              ; preds = %513
  %526 = load i32, ptr %43, align 4, !tbaa !9
  %527 = add nsw i32 %526, 1
  store i32 %527, ptr %43, align 4, !tbaa !9
  br label %508, !llvm.loop !21

528:                                              ; preds = %512
  %529 = load i32, ptr @n, align 4, !tbaa !9
  %530 = icmp sgt i32 %529, 1
  br i1 %530, label %531, label %646

531:                                              ; preds = %528
  %532 = load i32, ptr @n, align 4, !tbaa !9
  %533 = sext i32 %532 to i64
  %534 = mul i64 %533, 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 @tmp, ptr align 16 @val, i64 %534, i1 false)
  call void @llvm.lifetime.start.p0(i64 1, ptr %44) #8
  store i8 1, ptr %44, align 1, !tbaa !22
  br label %535

535:                                              ; preds = %644, %531
  %536 = load i8, ptr %44, align 1, !tbaa !22, !range !24, !noundef !25
  %537 = trunc i8 %536 to i1
  br i1 %537, label %539, label %538

538:                                              ; preds = %535
  store i32 19, ptr %45, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %44) #8
  br label %645

539:                                              ; preds = %535
  store i8 0, ptr %44, align 1, !tbaa !22
  %540 = load i32, ptr @pre, align 4, !tbaa !9
  %541 = xor i32 %540, 1
  store i32 %541, ptr @pre, align 4, !tbaa !9
  %542 = load i32, ptr @cur, align 4, !tbaa !9
  %543 = xor i32 %542, 1
  store i32 %543, ptr @cur, align 4, !tbaa !9
  %544 = load i32, ptr @n, align 4, !tbaa !9
  %545 = sext i32 %544 to i64
  %546 = mul i64 %545, 4
  call void @llvm.memset.p0.i64(ptr align 16 @cnt, i8 0, i64 %546, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %46) #8
  store i32 0, ptr %46, align 4, !tbaa !9
  br label %547

547:                                              ; preds = %563, %539
  %548 = load i32, ptr %46, align 4, !tbaa !9
  %549 = load i32, ptr @n, align 4, !tbaa !9
  %550 = icmp slt i32 %548, %549
  br i1 %550, label %552, label %551

551:                                              ; preds = %547
  store i32 21, ptr %45, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %46) #8
  br label %566

552:                                              ; preds = %547
  %553 = load i32, ptr %46, align 4, !tbaa !9
  %554 = sext i32 %553 to i64
  %555 = getelementptr inbounds [1000009 x i64], ptr @tmp, i64 0, i64 %554
  %556 = load i64, ptr %555, align 8, !tbaa !5
  %557 = load i32, ptr @n, align 4, !tbaa !9
  %558 = sext i32 %557 to i64
  %559 = srem i64 %556, %558
  %560 = getelementptr inbounds [1000009 x i32], ptr @cnt, i64 0, i64 %559
  %561 = load i32, ptr %560, align 4, !tbaa !9
  %562 = add nsw i32 %561, 1
  store i32 %562, ptr %560, align 4, !tbaa !9
  br label %563

563:                                              ; preds = %552
  %564 = load i32, ptr %46, align 4, !tbaa !9
  %565 = add nsw i32 %564, 1
  store i32 %565, ptr %46, align 4, !tbaa !9
  br label %547, !llvm.loop !26

566:                                              ; preds = %551
  call void @llvm.lifetime.start.p0(i64 4, ptr %47) #8
  store i32 1, ptr %47, align 4, !tbaa !9
  br label %567

567:                                              ; preds = %583, %566
  %568 = load i32, ptr %47, align 4, !tbaa !9
  %569 = load i32, ptr @n, align 4, !tbaa !9
  %570 = icmp slt i32 %568, %569
  br i1 %570, label %572, label %571

571:                                              ; preds = %567
  store i32 24, ptr %45, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %47) #8
  br label %586

572:                                              ; preds = %567
  %573 = load i32, ptr %47, align 4, !tbaa !9
  %574 = sub nsw i32 %573, 1
  %575 = sext i32 %574 to i64
  %576 = getelementptr inbounds [1000009 x i32], ptr @cnt, i64 0, i64 %575
  %577 = load i32, ptr %576, align 4, !tbaa !9
  %578 = load i32, ptr %47, align 4, !tbaa !9
  %579 = sext i32 %578 to i64
  %580 = getelementptr inbounds [1000009 x i32], ptr @cnt, i64 0, i64 %579
  %581 = load i32, ptr %580, align 4, !tbaa !9
  %582 = add nsw i32 %581, %577
  store i32 %582, ptr %580, align 4, !tbaa !9
  br label %583

583:                                              ; preds = %572
  %584 = load i32, ptr %47, align 4, !tbaa !9
  %585 = add nsw i32 %584, 1
  store i32 %585, ptr %47, align 4, !tbaa !9
  br label %567, !llvm.loop !27

586:                                              ; preds = %571
  call void @llvm.lifetime.start.p0(i64 4, ptr %48) #8
  %587 = load i32, ptr @n, align 4, !tbaa !9
  %588 = sub nsw i32 %587, 1
  store i32 %588, ptr %48, align 4, !tbaa !9
  br label %589

589:                                              ; preds = %641, %586
  %590 = load i32, ptr %48, align 4, !tbaa !9
  %591 = icmp sge i32 %590, 0
  br i1 %591, label %593, label %592

592:                                              ; preds = %589
  store i32 27, ptr %45, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %48) #8
  br label %644

593:                                              ; preds = %589
  %594 = load i32, ptr @pre, align 4, !tbaa !9
  %595 = sext i32 %594 to i64
  %596 = getelementptr inbounds [2 x [1000009 x i32]], ptr @ord, i64 0, i64 %595
  %597 = load i32, ptr %48, align 4, !tbaa !9
  %598 = sext i32 %597 to i64
  %599 = getelementptr inbounds [1000009 x i32], ptr %596, i64 0, i64 %598
  %600 = load i32, ptr %599, align 4, !tbaa !9
  %601 = load i32, ptr @cur, align 4, !tbaa !9
  %602 = sext i32 %601 to i64
  %603 = getelementptr inbounds [2 x [1000009 x i32]], ptr @ord, i64 0, i64 %602
  %604 = load i32, ptr @pre, align 4, !tbaa !9
  %605 = sext i32 %604 to i64
  %606 = getelementptr inbounds [2 x [1000009 x i32]], ptr @ord, i64 0, i64 %605
  %607 = load i32, ptr %48, align 4, !tbaa !9
  %608 = sext i32 %607 to i64
  %609 = getelementptr inbounds [1000009 x i32], ptr %606, i64 0, i64 %608
  %610 = load i32, ptr %609, align 4, !tbaa !9
  %611 = sext i32 %610 to i64
  %612 = getelementptr inbounds [1000009 x i64], ptr @tmp, i64 0, i64 %611
  %613 = load i64, ptr %612, align 8, !tbaa !5
  %614 = load i32, ptr @n, align 4, !tbaa !9
  %615 = sext i32 %614 to i64
  %616 = srem i64 %613, %615
  %617 = getelementptr inbounds [1000009 x i32], ptr @cnt, i64 0, i64 %616
  %618 = load i32, ptr %617, align 4, !tbaa !9
  %619 = add nsw i32 %618, -1
  store i32 %619, ptr %617, align 4, !tbaa !9
  %620 = sext i32 %619 to i64
  %621 = getelementptr inbounds [1000009 x i32], ptr %603, i64 0, i64 %620
  store i32 %600, ptr %621, align 4, !tbaa !9
  %622 = load i32, ptr @n, align 4, !tbaa !9
  %623 = sext i32 %622 to i64
  %624 = load i32, ptr @pre, align 4, !tbaa !9
  %625 = sext i32 %624 to i64
  %626 = getelementptr inbounds [2 x [1000009 x i32]], ptr @ord, i64 0, i64 %625
  %627 = load i32, ptr %48, align 4, !tbaa !9
  %628 = sext i32 %627 to i64
  %629 = getelementptr inbounds [1000009 x i32], ptr %626, i64 0, i64 %628
  %630 = load i32, ptr %629, align 4, !tbaa !9
  %631 = sext i32 %630 to i64
  %632 = getelementptr inbounds [1000009 x i64], ptr @tmp, i64 0, i64 %631
  %633 = load i64, ptr %632, align 8, !tbaa !5
  %634 = sdiv i64 %633, %623
  store i64 %634, ptr %632, align 8, !tbaa !5
  %635 = load i8, ptr %44, align 1, !tbaa !22, !range !24, !noundef !25
  %636 = trunc i8 %635 to i1
  %637 = zext i1 %636 to i64
  %638 = or i64 %637, %634
  %639 = icmp ne i64 %638, 0
  %640 = zext i1 %639 to i8
  store i8 %640, ptr %44, align 1, !tbaa !22
  br label %641

641:                                              ; preds = %593
  %642 = load i32, ptr %48, align 4, !tbaa !9
  %643 = add nsw i32 %642, -1
  store i32 %643, ptr %48, align 4, !tbaa !9
  br label %589, !llvm.loop !28

644:                                              ; preds = %592
  br label %535, !llvm.loop !29

645:                                              ; preds = %538
  br label %646

646:                                              ; preds = %645, %528
  store i64 0, ptr @ans, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %49) #8
  store i32 0, ptr %49, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %50) #8
  store i32 0, ptr %50, align 4, !tbaa !9
  br label %647

647:                                              ; preds = %711, %646
  %648 = load i32, ptr %49, align 4, !tbaa !9
  %649 = load i32, ptr @n, align 4, !tbaa !9
  %650 = icmp slt i32 %648, %649
  br i1 %650, label %652, label %651

651:                                              ; preds = %647
  store i32 30, ptr %45, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %50) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %49) #8
  br label %714

652:                                              ; preds = %647
  call void @llvm.lifetime.start.p0(i64 8, ptr %51) #8
  %653 = load i32, ptr @cur, align 4, !tbaa !9
  %654 = sext i32 %653 to i64
  %655 = getelementptr inbounds [2 x [1000009 x i32]], ptr @ord, i64 0, i64 %654
  %656 = load i32, ptr %49, align 4, !tbaa !9
  %657 = sext i32 %656 to i64
  %658 = getelementptr inbounds [1000009 x i32], ptr %655, i64 0, i64 %657
  %659 = load i32, ptr %658, align 4, !tbaa !9
  %660 = sext i32 %659 to i64
  %661 = getelementptr inbounds [1000009 x i64], ptr @val, i64 0, i64 %660
  %662 = load i64, ptr %661, align 8, !tbaa !5
  store i64 %662, ptr %51, align 8, !tbaa !5
  br label %663

663:                                              ; preds = %672, %652
  %664 = load i32, ptr %50, align 4, !tbaa !9
  %665 = sext i32 %664 to i64
  %666 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @seq, i64 0, i64 %665
  %667 = getelementptr inbounds %"struct.std::pair", ptr %666, i32 0, i32 0
  %668 = load i64, ptr %667, align 16, !tbaa !14
  %669 = load i64, ptr %51, align 8, !tbaa !5
  %670 = icmp slt i64 %668, %669
  br i1 %670, label %671, label %675

671:                                              ; preds = %663
  br label %672

672:                                              ; preds = %671
  %673 = load i32, ptr %50, align 4, !tbaa !9
  %674 = add nsw i32 %673, 1
  store i32 %674, ptr %50, align 4, !tbaa !9
  br label %663, !llvm.loop !30

675:                                              ; preds = %663
  %676 = load i32, ptr %50, align 4, !tbaa !9
  %677 = sext i32 %676 to i64
  %678 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @seq, i64 0, i64 %677
  %679 = getelementptr inbounds %"struct.std::pair", ptr %678, i32 0, i32 0
  %680 = load i64, ptr %679, align 16, !tbaa !14
  %681 = load i64, ptr %51, align 8, !tbaa !5
  %682 = icmp eq i64 %680, %681
  br i1 %682, label %683, label %689

683:                                              ; preds = %675
  %684 = load i32, ptr %50, align 4, !tbaa !9
  %685 = sext i32 %684 to i64
  %686 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @seq, i64 0, i64 %685
  %687 = getelementptr inbounds %"struct.std::pair", ptr %686, i32 0, i32 1
  %688 = load i64, ptr %687, align 8, !tbaa !17
  br label %707

689:                                              ; preds = %675
  %690 = load i32, ptr %50, align 4, !tbaa !9
  %691 = sub nsw i32 %690, 1
  %692 = sext i32 %691 to i64
  %693 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @seq, i64 0, i64 %692
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %52, ptr align 16 %693, i64 16, i1 false)
  %694 = load i32, ptr %50, align 4, !tbaa !9
  %695 = sext i32 %694 to i64
  %696 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @seq, i64 0, i64 %695
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %53, ptr align 16 %696, i64 16, i1 false)
  %697 = load i64, ptr %51, align 8, !tbaa !5
  %698 = getelementptr inbounds { i64, i64 }, ptr %52, i32 0, i32 0
  %699 = load i64, ptr %698, align 8
  %700 = getelementptr inbounds { i64, i64 }, ptr %52, i32 0, i32 1
  %701 = load i64, ptr %700, align 8
  %702 = getelementptr inbounds { i64, i64 }, ptr %53, i32 0, i32 0
  %703 = load i64, ptr %702, align 8
  %704 = getelementptr inbounds { i64, i64 }, ptr %53, i32 0, i32 1
  %705 = load i64, ptr %704, align 8
  %706 = call noundef i64 @_Z12get_line_valSt4pairIxxES0_x(i64 %699, i64 %701, i64 %703, i64 %705, i64 noundef %697)
  br label %707

707:                                              ; preds = %689, %683
  %708 = phi i64 [ %688, %683 ], [ %706, %689 ]
  %709 = load i64, ptr @ans, align 8, !tbaa !5
  %710 = add nsw i64 %709, %708
  store i64 %710, ptr @ans, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %51) #8
  br label %711

711:                                              ; preds = %707
  %712 = load i32, ptr %49, align 4, !tbaa !9
  %713 = add nsw i32 %712, 1
  store i32 %713, ptr %49, align 4, !tbaa !9
  br label %647, !llvm.loop !31

714:                                              ; preds = %651
  %715 = load i64, ptr @ans, align 8, !tbaa !5
  %716 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i64 noundef %715)
  br label %77, !llvm.loop !32

717:                                              ; preds = %77
  ret i32 0
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z7mod_mulxx(i64 noundef, i64 noundef) #2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i32 } @_ZSt9make_pairIRKxiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) #4

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7pos_inci(i32 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSIxiEENSt9enable_ifIXsr6__and_ISt13is_assignableIRxOT_ES3_IS4_OT0_EEE5valueERS0_E4typeEOS_IS5_S8_E(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(12)) #6 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z7mod_addxx(i64 noundef, i64 noundef) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z7mod_subxx(i64 noundef, i64 noundef) #2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z7val_geti(i32 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_ZSt9make_pairIRxxESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z12get_line_valSt4pairIxxES0_x(i64, i64, i64, i64, i64 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_ZSt9make_pairIRKxxESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #6 align 2

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !6, i64 0}
!15 = !{!"_ZTSSt4pairIxxE", !6, i64 0, !6, i64 8}
!16 = distinct !{!16, !12}
!17 = !{!15, !6, i64 8}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = !{!23, !23, i64 0}
!23 = !{!"bool", !7, i64 0}
!24 = !{i8 0, i8 2}
!25 = !{}
!26 = distinct !{!26, !12}
!27 = distinct !{!27, !12}
!28 = distinct !{!28, !12}
!29 = distinct !{!29, !12}
!30 = distinct !{!30, !12}
!31 = distinct !{!31, !12}
!32 = distinct !{!32, !12}


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

%"struct.std::pair" = type { i64, i64 }
%"struct.std::pair.0" = type <{ i64, i32, [4 x i8] }>

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@L = external dso_local global i32, align 4
@R = external dso_local global i32, align 4
@tot = external dso_local local_unnamed_addr global i32, align 4
@cnt = external dso_local local_unnamed_addr global [1000009 x i32], align 16
@ord = external dso_local local_unnamed_addr global [2 x [1000009 x i32]], align 16
@cur = external dso_local local_unnamed_addr global i32, align 4
@pre = external dso_local local_unnamed_addr global i32, align 4
@inv = external dso_local local_unnamed_addr global [100001 x i64], align 16
@minv = external dso_local global i64, align 8
@maxv = external dso_local global i64, align 8
@dx = external dso_local local_unnamed_addr global i64, align 8
@dy = external dso_local local_unnamed_addr global i64, align 8
@dz = external dso_local local_unnamed_addr global i64, align 8
@invdz = external dso_local local_unnamed_addr global i64, align 8
@ans = external dso_local local_unnamed_addr global i64, align 8
@val = external dso_local global [1000009 x i64], align 16
@tmp = external dso_local local_unnamed_addr global [1000009 x i64], align 16
@que = external dso_local global [1000009 x %"struct.std::pair"], align 16
@seq = external dso_local global [1000009 x %"struct.std::pair"], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [13 x i8], align 1
@_ZL4lowx = external hidden constant i64, align 8
@_ZL4uppx = external hidden constant i64, align 8
@.str.2 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca %"struct.std::pair.0", align 8
  %2 = alloca i32, align 4
  %3 = alloca %"struct.std::pair.0", align 8
  %4 = alloca i32, align 4
  %5 = alloca i8, align 1
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca %"struct.std::pair", align 8
  %12 = alloca i64, align 8
  %13 = alloca %"struct.std::pair", align 8
  %14 = alloca i64, align 8
  %15 = alloca %"struct.std::pair", align 8
  %16 = alloca i64, align 8
  store i64 1, ptr getelementptr inbounds (i8, ptr @inv, i64 8), align 8, !tbaa !5
  br label %24

17:                                               ; preds = %24
  %18 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %19 = load i32, ptr @t, align 4, !tbaa !9
  %20 = add nsw i32 %19, -1
  store i32 %20, ptr @t, align 4, !tbaa !9
  %.not188 = icmp eq i32 %19, 0
  br i1 %.not188, label %._crit_edge191, label %.lr.ph190

.lr.ph190:                                        ; preds = %17
  %.sroa.2109.0..sroa_idx = getelementptr inbounds i8, ptr %1, i64 8
  %.sroa.2105.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 8
  %21 = getelementptr inbounds i8, ptr %11, i64 8
  %22 = getelementptr inbounds i8, ptr %13, i64 8
  %23 = getelementptr inbounds i8, ptr %15, i64 8
  br label %32

24:                                               ; preds = %0, %24
  %indvars.iv = phi i64 [ 2, %0 ], [ %indvars.iv.next, %24 ]
  %25 = udiv i64 949848565645808449, %indvars.iv
  %26 = urem i64 949848565645808449, %indvars.iv
  %27 = getelementptr inbounds [100001 x i64], ptr @inv, i64 0, i64 %26
  %28 = load i64, ptr %27, align 8, !tbaa !5
  %29 = tail call noundef i64 @_Z7mod_mulxx(i64 noundef %25, i64 noundef %28)
  %30 = sub nsw i64 949848565645808449, %29
  %31 = getelementptr inbounds [100001 x i64], ptr @inv, i64 0, i64 %indvars.iv
  store i64 %30, ptr %31, align 8, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 100001
  br i1 %exitcond.not, label %17, label %24, !llvm.loop !11

32:                                               ; preds = %.lr.ph190, %._crit_edge187
  %33 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @minv, ptr noundef nonnull @maxv)
  store i32 0, ptr @L, align 4, !tbaa !9
  store i32 -1, ptr @R, align 4, !tbaa !9
  store i64 1, ptr @dx, align 8, !tbaa !5
  store i64 0, ptr @dy, align 8, !tbaa !5
  store i64 1, ptr @dz, align 8, !tbaa !5
  store i64 1, ptr @invdz, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  store i32 0, ptr %2, align 4, !tbaa !9
  %34 = call { i64, i32 } @_ZSt9make_pairIRKxiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 8 dereferenceable(8) @_ZL4lowx, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %.fca.0.extract106 = extractvalue { i64, i32 } %34, 0
  %.fca.1.extract107 = extractvalue { i64, i32 } %34, 1
  store i64 %.fca.0.extract106, ptr %1, align 8
  store i32 %.fca.1.extract107, ptr %.sroa.2109.0..sroa_idx, align 8
  %35 = load i32, ptr @R, align 4, !tbaa !9
  %36 = call noundef i32 @_Z7pos_inci(i32 noundef %35)
  store i32 %36, ptr @R, align 4, !tbaa !9
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %37
  %39 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSIxiEENSt9enable_ifIXsr6__and_ISt13is_assignableIRxOT_ES3_IS4_OT0_EEE5valueERS0_E4typeEOS_IS5_S8_E(ptr noundef nonnull align 8 dereferenceable(16) %38, ptr noundef nonnull align 8 dereferenceable(12) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #8
  store i32 0, ptr %4, align 4, !tbaa !9
  %40 = call { i64, i32 } @_ZSt9make_pairIRKxiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 8 dereferenceable(8) @_ZL4uppx, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %.fca.0.extract = extractvalue { i64, i32 } %40, 0
  %.fca.1.extract = extractvalue { i64, i32 } %40, 1
  store i64 %.fca.0.extract, ptr %3, align 8
  store i32 %.fca.1.extract, ptr %.sroa.2105.0..sroa_idx, align 8
  %41 = load i32, ptr @R, align 4, !tbaa !9
  %42 = call noundef i32 @_Z7pos_inci(i32 noundef %41)
  store i32 %42, ptr @R, align 4, !tbaa !9
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %43
  %45 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSIxiEENSt9enable_ifIXsr6__and_ISt13is_assignableIRxOT_ES3_IS4_OT0_EEE5valueERS0_E4typeEOS_IS5_S8_E(ptr noundef nonnull align 8 dereferenceable(16) %44, ptr noundef nonnull align 8 dereferenceable(12) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #8
  %46 = load i32, ptr @n, align 4, !tbaa !9
  %47 = add nsw i32 %46, -1
  store i32 %47, ptr @n, align 4, !tbaa !9
  %.not139160 = icmp eq i32 %46, 0
  br i1 %.not139160, label %._crit_edge, label %.lr.ph161

.lr.ph161:                                        ; preds = %32, %238
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #8
  %48 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %5, ptr noundef nonnull %6)
  %49 = load i8, ptr %5, align 1, !tbaa !13
  switch i8 %49, label %99 [
    i8 43, label %50
    i8 45, label %54
    i8 42, label %58
    i8 64, label %73
  ]

50:                                               ; preds = %.lr.ph161
  %51 = load i64, ptr @dy, align 8, !tbaa !5
  %52 = load i64, ptr %6, align 8, !tbaa !5
  %53 = call noundef i64 @_Z7mod_addxx(i64 noundef %51, i64 noundef %52)
  store i64 %53, ptr @dy, align 8, !tbaa !5
  br label %99

54:                                               ; preds = %.lr.ph161
  %55 = load i64, ptr @dy, align 8, !tbaa !5
  %56 = load i64, ptr %6, align 8, !tbaa !5
  %57 = call noundef i64 @_Z7mod_subxx(i64 noundef %55, i64 noundef %56)
  store i64 %57, ptr @dy, align 8, !tbaa !5
  br label %99

58:                                               ; preds = %.lr.ph161
  %59 = load i64, ptr @dx, align 8, !tbaa !5
  %60 = load i64, ptr %6, align 8, !tbaa !5
  %61 = call noundef i64 @_Z7mod_mulxx(i64 noundef %59, i64 noundef %60)
  store i64 %61, ptr @dx, align 8, !tbaa !5
  %62 = load i64, ptr @dy, align 8, !tbaa !5
  %63 = load i64, ptr %6, align 8, !tbaa !5
  %64 = call noundef i64 @_Z7mod_mulxx(i64 noundef %62, i64 noundef %63)
  store i64 %64, ptr @dy, align 8, !tbaa !5
  %65 = load i64, ptr @dz, align 8, !tbaa !5
  %66 = load i64, ptr %6, align 8, !tbaa !5
  %67 = call noundef i64 @_Z7mod_mulxx(i64 noundef %65, i64 noundef %66)
  store i64 %67, ptr @dz, align 8, !tbaa !5
  %68 = load i64, ptr @invdz, align 8, !tbaa !5
  %69 = load i64, ptr %6, align 8, !tbaa !5
  %70 = getelementptr inbounds [100001 x i64], ptr @inv, i64 0, i64 %69
  %71 = load i64, ptr %70, align 8, !tbaa !5
  %72 = call noundef i64 @_Z7mod_mulxx(i64 noundef %68, i64 noundef %71)
  store i64 %72, ptr @invdz, align 8, !tbaa !5
  br label %99

73:                                               ; preds = %.lr.ph161
  %74 = load i32, ptr @L, align 4, !tbaa !9
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %75
  %77 = load i64, ptr %76, align 16, !tbaa !14
  %78 = icmp sgt i64 %77, 1
  br i1 %78, label %79, label %84

79:                                               ; preds = %73
  %80 = call noundef i32 @_Z7pos_decRi(ptr noundef nonnull align 4 dereferenceable(4) @L)
  store i32 %80, ptr @L, align 4, !tbaa !9
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %81
  store i64 1, ptr %82, align 16, !tbaa !14
  %83 = call noundef i64 @_Z7val_geti(i32 noundef %74)
  call void @_Z7val_setix(i32 noundef %80, i64 noundef %83)
  br label %84

84:                                               ; preds = %79, %73
  %85 = load i32, ptr @R, align 4, !tbaa !9
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %86
  %88 = load i64, ptr %87, align 16, !tbaa !14
  %89 = icmp slt i64 %88, 10000000000
  br i1 %89, label %90, label %95

90:                                               ; preds = %84
  %91 = call noundef i32 @_Z7pos_inci(i32 noundef %85)
  store i32 %91, ptr @R, align 4, !tbaa !9
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %92
  store i64 10000000000, ptr %93, align 16, !tbaa !14
  %94 = call noundef i64 @_Z7val_geti(i32 noundef %85)
  call void @_Z7val_setix(i32 noundef %91, i64 noundef %94)
  br label %95

95:                                               ; preds = %90, %84
  %96 = load i64, ptr @dx, align 8, !tbaa !5
  %97 = load i64, ptr %6, align 8, !tbaa !5
  %98 = call noundef i64 @_Z7mod_addxx(i64 noundef %96, i64 noundef %97)
  store i64 %98, ptr @dx, align 8, !tbaa !5
  br label %99

99:                                               ; preds = %.lr.ph161, %54, %95, %58, %50
  %100 = load i32, ptr @L, align 4, !tbaa !9
  %101 = load i32, ptr @R, align 4, !tbaa !9
  %.not141150 = icmp eq i32 %100, %101
  br i1 %.not141150, label %.critedge.thread, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %99
  %102 = call noundef i64 @_Z7val_geti(i32 noundef %100)
  %103 = load i64, ptr @minv, align 8, !tbaa !5
  %104 = icmp slt i64 %102, %103
  br i1 %104, label %.lr.ph241, label %.critedge

.lr.ph:                                           ; preds = %.lr.ph241
  %105 = call noundef i64 @_Z7val_geti(i32 noundef %109)
  %106 = load i64, ptr @minv, align 8, !tbaa !5
  %107 = icmp slt i64 %105, %106
  br i1 %107, label %.lr.ph241, label %.critedge, !llvm.loop !16

.lr.ph241:                                        ; preds = %.lr.ph.preheader, %.lr.ph
  %108 = load i32, ptr @L, align 4, !tbaa !9
  %109 = call noundef i32 @_Z7pos_inci(i32 noundef %108)
  store i32 %109, ptr @L, align 4, !tbaa !9
  %110 = load i32, ptr @R, align 4, !tbaa !9
  %.not141 = icmp eq i32 %109, %110
  br i1 %.not141, label %.critedge, label %.lr.ph, !llvm.loop !16

.critedge:                                        ; preds = %.lr.ph241, %.lr.ph, %.lr.ph.preheader
  %.0115.lcssa = phi i32 [ -1, %.lr.ph.preheader ], [ %108, %.lr.ph ], [ %108, %.lr.ph241 ]
  %.not142 = icmp eq i32 %.0115.lcssa, -1
  br i1 %.not142, label %.critedge.thread, label %111

111:                                              ; preds = %.critedge
  %112 = load i32, ptr @L, align 4, !tbaa !9
  %113 = call noundef i64 @_Z7val_geti(i32 noundef %112)
  %114 = load i64, ptr @minv, align 8, !tbaa !5
  %115 = icmp sgt i64 %113, %114
  br i1 %115, label %116, label %.critedge.thread

116:                                              ; preds = %111
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  %117 = sext i32 %.0115.lcssa to i64
  %118 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %117
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  %119 = call noundef i64 @_Z7val_geti(i32 noundef %.0115.lcssa)
  store i64 %119, ptr %8, align 8, !tbaa !5
  %120 = call { i64, i64 } @_ZSt9make_pairIRxxESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %118, ptr noundef nonnull align 8 dereferenceable(8) %8)
  %121 = extractvalue { i64, i64 } %120, 0
  %122 = extractvalue { i64, i64 } %120, 1
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  %123 = load i32, ptr @L, align 4, !tbaa !9
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %124
  %126 = call noundef i64 @_Z7val_geti(i32 noundef %123)
  store i64 %126, ptr %7, align 8, !tbaa !5
  %127 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %125, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %128 = extractvalue { i64, i64 } %127, 0
  %129 = extractvalue { i64, i64 } %127, 1
  %130 = sub nsw i64 %129, %122
  %131 = sub nsw i64 %128, %121
  %132 = sdiv i64 %130, %131
  %133 = load i64, ptr @minv, align 8, !tbaa !5
  %134 = xor i64 %122, -1
  %135 = add i64 %133, %134
  %136 = sdiv i64 %135, %132
  %137 = add nsw i64 %136, %121
  %138 = add nsw i64 %137, 1
  %139 = load i32, ptr @L, align 4, !tbaa !9
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %140
  %142 = load i64, ptr %141, align 16, !tbaa !14
  %143 = icmp slt i64 %138, %142
  br i1 %143, label %144, label %150

144:                                              ; preds = %116
  %145 = call noundef i64 @_Z12get_line_valSt4pairIxxES0_x(i64 %121, i64 %122, i64 %128, i64 %129, i64 noundef %138)
  store i64 %145, ptr %7, align 8, !tbaa !5
  %146 = call noundef i32 @_Z7pos_decRi(ptr noundef nonnull align 4 dereferenceable(4) @L)
  store i32 %146, ptr @L, align 4, !tbaa !9
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %147
  store i64 %138, ptr %148, align 16, !tbaa !14
  %149 = load i64, ptr %7, align 8, !tbaa !5
  call void @_Z7val_setix(i32 noundef %146, i64 noundef %149)
  br label %150

150:                                              ; preds = %144, %116
  %151 = icmp sgt i64 %137, 0
  br i1 %151, label %152, label %161

152:                                              ; preds = %150
  %153 = load i64, ptr %7, align 8, !tbaa !5
  %154 = load i64, ptr @minv, align 8, !tbaa !5
  %155 = icmp sgt i64 %153, %154
  br i1 %155, label %156, label %161

156:                                              ; preds = %152
  %157 = call noundef i32 @_Z7pos_decRi(ptr noundef nonnull align 4 dereferenceable(4) @L)
  store i32 %157, ptr @L, align 4, !tbaa !9
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %158
  store i64 %137, ptr %159, align 16, !tbaa !14
  %160 = call noundef i64 @_Z12get_line_valSt4pairIxxES0_x(i64 %121, i64 %122, i64 %128, i64 %129, i64 noundef %137)
  call void @_Z7val_setix(i32 noundef %157, i64 noundef %160)
  br label %161

161:                                              ; preds = %156, %152, %150
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  br label %.critedge.thread

.critedge.thread:                                 ; preds = %99, %161, %111, %.critedge
  %162 = load i32, ptr @L, align 4, !tbaa !9
  %163 = load i32, ptr @R, align 4, !tbaa !9
  %.not143154 = icmp eq i32 %162, %163
  br i1 %.not143154, label %.critedge2.thread, label %.lr.ph156.preheader

.lr.ph156.preheader:                              ; preds = %.critedge.thread
  %164 = call noundef i64 @_Z7val_geti(i32 noundef %163)
  %165 = load i64, ptr @maxv, align 8, !tbaa !5
  %166 = icmp sgt i64 %164, %165
  br i1 %166, label %.lr.ph243, label %.critedge2

.lr.ph156:                                        ; preds = %.lr.ph243
  %167 = call noundef i64 @_Z7val_geti(i32 noundef %171)
  %168 = load i64, ptr @maxv, align 8, !tbaa !5
  %169 = icmp sgt i64 %167, %168
  br i1 %169, label %.lr.ph243, label %.critedge2, !llvm.loop !17

.lr.ph243:                                        ; preds = %.lr.ph156.preheader, %.lr.ph156
  %170 = load i32, ptr @R, align 4, !tbaa !9
  %171 = call noundef i32 @_Z7pos_decRi(ptr noundef nonnull align 4 dereferenceable(4) @R)
  store i32 %171, ptr @R, align 4, !tbaa !9
  %172 = load i32, ptr @L, align 4, !tbaa !9
  %.not143 = icmp eq i32 %172, %171
  br i1 %.not143, label %.critedge2, label %.lr.ph156, !llvm.loop !17

.critedge2:                                       ; preds = %.lr.ph243, %.lr.ph156, %.lr.ph156.preheader
  %.0116.lcssa = phi i32 [ -1, %.lr.ph156.preheader ], [ %170, %.lr.ph156 ], [ %170, %.lr.ph243 ]
  %.not144 = icmp eq i32 %.0116.lcssa, -1
  br i1 %.not144, label %.critedge2.thread, label %173

173:                                              ; preds = %.critedge2
  %174 = load i32, ptr @R, align 4, !tbaa !9
  %175 = call noundef i64 @_Z7val_geti(i32 noundef %174)
  %176 = load i64, ptr @maxv, align 8, !tbaa !5
  %177 = icmp slt i64 %175, %176
  br i1 %177, label %178, label %.critedge2.thread

178:                                              ; preds = %173
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #8
  %179 = load i32, ptr @R, align 4, !tbaa !9
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %180
  %182 = call noundef i64 @_Z7val_geti(i32 noundef %179)
  store i64 %182, ptr %9, align 8, !tbaa !5
  %183 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %181, ptr noundef nonnull align 8 dereferenceable(8) %9)
  %184 = extractvalue { i64, i64 } %183, 0
  %185 = extractvalue { i64, i64 } %183, 1
  %186 = sext i32 %.0116.lcssa to i64
  %187 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %186
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #8
  %188 = call noundef i64 @_Z7val_geti(i32 noundef %.0116.lcssa)
  store i64 %188, ptr %10, align 8, !tbaa !5
  %189 = call { i64, i64 } @_ZSt9make_pairIRxxESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %187, ptr noundef nonnull align 8 dereferenceable(8) %10)
  %190 = extractvalue { i64, i64 } %189, 0
  %191 = extractvalue { i64, i64 } %189, 1
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #8
  %192 = sub nsw i64 %191, %185
  %193 = sub nsw i64 %190, %184
  %194 = sdiv i64 %192, %193
  %195 = load i64, ptr @maxv, align 8, !tbaa !5
  %196 = sub nsw i64 %195, %185
  %197 = sdiv i64 %196, %194
  %198 = add nsw i64 %197, %184
  %199 = load i32, ptr @R, align 4, !tbaa !9
  %200 = sext i32 %199 to i64
  %201 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %200
  %202 = load i64, ptr %201, align 16, !tbaa !14
  %203 = icmp sgt i64 %198, %202
  br i1 %203, label %204, label %211

204:                                              ; preds = %178
  %205 = call noundef i64 @_Z12get_line_valSt4pairIxxES0_x(i64 %184, i64 %185, i64 %190, i64 %191, i64 noundef %198)
  store i64 %205, ptr %9, align 8, !tbaa !5
  %206 = load i32, ptr @R, align 4, !tbaa !9
  %207 = call noundef i32 @_Z7pos_inci(i32 noundef %206)
  store i32 %207, ptr @R, align 4, !tbaa !9
  %208 = sext i32 %207 to i64
  %209 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %208
  store i64 %198, ptr %209, align 16, !tbaa !14
  %210 = load i64, ptr %9, align 8, !tbaa !5
  call void @_Z7val_setix(i32 noundef %207, i64 noundef %210)
  br label %211

211:                                              ; preds = %204, %178
  %212 = icmp slt i64 %198, 10000000000
  br i1 %212, label %213, label %224

213:                                              ; preds = %211
  %214 = load i64, ptr %9, align 8, !tbaa !5
  %215 = load i64, ptr @maxv, align 8, !tbaa !5
  %216 = icmp slt i64 %214, %215
  br i1 %216, label %217, label %224

217:                                              ; preds = %213
  %218 = add nsw i64 %198, 1
  %219 = load i32, ptr @R, align 4, !tbaa !9
  %220 = call noundef i32 @_Z7pos_inci(i32 noundef %219)
  store i32 %220, ptr @R, align 4, !tbaa !9
  %221 = sext i32 %220 to i64
  %222 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %221
  store i64 %218, ptr %222, align 16, !tbaa !14
  %223 = call noundef i64 @_Z12get_line_valSt4pairIxxES0_x(i64 %184, i64 %185, i64 %190, i64 %191, i64 noundef %218)
  call void @_Z7val_setix(i32 noundef %220, i64 noundef %223)
  br label %224

224:                                              ; preds = %217, %213, %211
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #8
  br label %.critedge2.thread

.critedge2.thread:                                ; preds = %.critedge.thread, %224, %173, %.critedge2
  %225 = load i32, ptr @L, align 4, !tbaa !9
  %226 = call noundef i64 @_Z7val_geti(i32 noundef %225)
  %227 = load i64, ptr @minv, align 8, !tbaa !5
  %228 = icmp slt i64 %226, %227
  br i1 %228, label %229, label %231

229:                                              ; preds = %.critedge2.thread
  %230 = load i32, ptr @L, align 4, !tbaa !9
  call void @_Z7val_setix(i32 noundef %230, i64 noundef %227)
  br label %231

231:                                              ; preds = %229, %.critedge2.thread
  %232 = load i32, ptr @R, align 4, !tbaa !9
  %233 = call noundef i64 @_Z7val_geti(i32 noundef %232)
  %234 = load i64, ptr @maxv, align 8, !tbaa !5
  %235 = icmp sgt i64 %233, %234
  br i1 %235, label %236, label %238

236:                                              ; preds = %231
  %237 = load i32, ptr @R, align 4, !tbaa !9
  call void @_Z7val_setix(i32 noundef %237, i64 noundef %234)
  br label %238

238:                                              ; preds = %236, %231
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #8
  %239 = load i32, ptr @n, align 4, !tbaa !9
  %240 = add nsw i32 %239, -1
  store i32 %240, ptr @n, align 4, !tbaa !9
  %.not139 = icmp eq i32 %239, 0
  br i1 %.not139, label %._crit_edge, label %.lr.ph161, !llvm.loop !18

._crit_edge:                                      ; preds = %238, %32
  store i32 0, ptr @tot, align 4, !tbaa !9
  %241 = load i32, ptr @L, align 4, !tbaa !9
  %242 = sext i32 %241 to i64
  %243 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %242
  %244 = load i64, ptr %243, align 16, !tbaa !14
  %245 = icmp sgt i64 %244, 1
  br i1 %245, label %246, label %256

246:                                              ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %11) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #8
  %247 = call noundef i64 @_Z7val_geti(i32 noundef %241)
  store i64 %247, ptr %12, align 8, !tbaa !5
  %248 = call { i64, i64 } @_ZSt9make_pairIRKxxESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 8 dereferenceable(8) @_ZL4lowx, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %249 = extractvalue { i64, i64 } %248, 0
  store i64 %249, ptr %11, align 8
  %250 = extractvalue { i64, i64 } %248, 1
  store i64 %250, ptr %21, align 8
  %251 = load i32, ptr @tot, align 4, !tbaa !9
  %252 = add nsw i32 %251, 1
  store i32 %252, ptr @tot, align 4, !tbaa !9
  %253 = sext i32 %251 to i64
  %254 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @seq, i64 0, i64 %253
  %255 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) %254, ptr noundef nonnull align 8 dereferenceable(16) %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %11) #8
  %.pre = load i32, ptr @L, align 4, !tbaa !9
  br label %256

256:                                              ; preds = %246, %._crit_edge
  %257 = phi i32 [ %.pre, %246 ], [ %241, %._crit_edge ]
  %258 = load i32, ptr @R, align 4, !tbaa !9
  %259 = call noundef i32 @_Z7pos_inci(i32 noundef %258)
  %.not140162 = icmp eq i32 %257, %259
  br i1 %.not140162, label %._crit_edge166, label %.lr.ph165

._crit_edge166:                                   ; preds = %.lr.ph165, %256
  %260 = load i32, ptr @R, align 4, !tbaa !9
  %261 = sext i32 %260 to i64
  %262 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %261
  %263 = load i64, ptr %262, align 16, !tbaa !14
  %264 = icmp slt i64 %263, 10000000000
  br i1 %264, label %277, label %287

.lr.ph165:                                        ; preds = %256, %.lr.ph165
  %.0117163 = phi i32 [ %276, %.lr.ph165 ], [ %257, %256 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %13) #8
  %265 = sext i32 %.0117163 to i64
  %266 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @que, i64 0, i64 %265
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %14) #8
  %267 = call noundef i64 @_Z7val_geti(i32 noundef %.0117163)
  store i64 %267, ptr %14, align 8, !tbaa !5
  %268 = call { i64, i64 } @_ZSt9make_pairIRxxESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %266, ptr noundef nonnull align 8 dereferenceable(8) %14)
  %269 = extractvalue { i64, i64 } %268, 0
  store i64 %269, ptr %13, align 8
  %270 = extractvalue { i64, i64 } %268, 1
  store i64 %270, ptr %22, align 8
  %271 = load i32, ptr @tot, align 4, !tbaa !9
  %272 = add nsw i32 %271, 1
  store i32 %272, ptr @tot, align 4, !tbaa !9
  %273 = sext i32 %271 to i64
  %274 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @seq, i64 0, i64 %273
  %275 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) %274, ptr noundef nonnull align 8 dereferenceable(16) %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %13) #8
  %276 = call noundef i32 @_Z7pos_inci(i32 noundef %.0117163)
  %.not140 = icmp eq i32 %276, %259
  br i1 %.not140, label %._crit_edge166, label %.lr.ph165, !llvm.loop !19

277:                                              ; preds = %._crit_edge166
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %15) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %16) #8
  %278 = call noundef i64 @_Z7val_geti(i32 noundef %260)
  store i64 %278, ptr %16, align 8, !tbaa !5
  %279 = call { i64, i64 } @_ZSt9make_pairIRKxxESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 8 dereferenceable(8) @_ZL4uppx, ptr noundef nonnull align 8 dereferenceable(8) %16)
  %280 = extractvalue { i64, i64 } %279, 0
  store i64 %280, ptr %15, align 8
  %281 = extractvalue { i64, i64 } %279, 1
  store i64 %281, ptr %23, align 8
  %282 = load i32, ptr @tot, align 4, !tbaa !9
  %283 = add nsw i32 %282, 1
  store i32 %283, ptr @tot, align 4, !tbaa !9
  %284 = sext i32 %282 to i64
  %285 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @seq, i64 0, i64 %284
  %286 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) %285, ptr noundef nonnull align 8 dereferenceable(16) %15) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %15) #8
  br label %287

287:                                              ; preds = %277, %._crit_edge166
  %288 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %289 = load i32, ptr @n, align 4, !tbaa !9
  %290 = icmp sgt i32 %289, 0
  br i1 %290, label %.lr.ph169, label %.thread

.thread:                                          ; preds = %287
  store i64 0, ptr @ans, align 8, !tbaa !5
  br label %._crit_edge187

._crit_edge170:                                   ; preds = %.lr.ph169
  %291 = icmp sgt i32 %298, 1
  br i1 %291, label %301, label %367

.lr.ph169:                                        ; preds = %287, %.lr.ph169
  %indvars.iv199 = phi i64 [ %indvars.iv.next200, %.lr.ph169 ], [ 0, %287 ]
  %292 = getelementptr inbounds i64, ptr @val, i64 %indvars.iv199
  %293 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %292)
  %294 = load i32, ptr @cur, align 4, !tbaa !9
  %295 = sext i32 %294 to i64
  %296 = getelementptr inbounds [2 x [1000009 x i32]], ptr @ord, i64 0, i64 %295, i64 %indvars.iv199
  %297 = trunc nuw nsw i64 %indvars.iv199 to i32
  store i32 %297, ptr %296, align 4, !tbaa !9
  %indvars.iv.next200 = add nuw nsw i64 %indvars.iv199, 1
  %298 = load i32, ptr @n, align 4, !tbaa !9
  %299 = sext i32 %298 to i64
  %300 = icmp slt i64 %indvars.iv.next200, %299
  br i1 %300, label %.lr.ph169, label %._crit_edge170, !llvm.loop !20

301:                                              ; preds = %._crit_edge170
  %302 = zext nneg i32 %298 to i64
  %303 = shl nuw nsw i64 %302, 3
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 @tmp, ptr nonnull align 16 @val, i64 %303, i1 false)
  %pre.promoted = load i32, ptr @pre, align 4, !tbaa !9
  %cur.promoted = load i32, ptr @cur, align 4, !tbaa !9
  %304 = shl nuw nsw i64 %302, 2
  %305 = add nsw i64 %302, -1
  %306 = add nsw i64 %302, -2
  %xtraiter = and i64 %302, 1
  %307 = icmp eq i64 %305, 0
  %unroll_iter = and i64 %302, 2147483646
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  %xtraiter254 = and i64 %305, 3
  %308 = icmp ult i64 %306, 3
  %unroll_iter256 = and i64 %305, -4
  %lcmp.mod255.not = icmp eq i64 %xtraiter254, 0
  br label %.lr.ph174

.loopexit:                                        ; preds = %350
  br i1 %364, label %.lr.ph174, label %.loopexit146, !llvm.loop !21

.lr.ph174:                                        ; preds = %301, %.loopexit
  %309 = phi i32 [ %pre.promoted, %301 ], [ %311, %.loopexit ]
  %310 = phi i32 [ %cur.promoted, %301 ], [ %334, %.loopexit ]
  %311 = xor i32 %309, 1
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @cnt, i8 0, i64 %304, i1 false)
  br i1 %307, label %.lr.ph176.preheader.unr-lcssa, label %.lr.ph174.new

.lr.ph174.new:                                    ; preds = %.lr.ph174, %.lr.ph174.new
  %indvars.iv202 = phi i64 [ %indvars.iv.next203.1, %.lr.ph174.new ], [ 0, %.lr.ph174 ]
  %niter = phi i64 [ %niter.next.1, %.lr.ph174.new ], [ 0, %.lr.ph174 ]
  %312 = getelementptr inbounds [1000009 x i64], ptr @tmp, i64 0, i64 %indvars.iv202
  %313 = load i64, ptr %312, align 16, !tbaa !5
  %314 = srem i64 %313, %302
  %315 = getelementptr inbounds [1000009 x i32], ptr @cnt, i64 0, i64 %314
  %316 = load i32, ptr %315, align 4, !tbaa !9
  %317 = add nsw i32 %316, 1
  store i32 %317, ptr %315, align 4, !tbaa !9
  %indvars.iv.next203 = or disjoint i64 %indvars.iv202, 1
  %318 = getelementptr inbounds [1000009 x i64], ptr @tmp, i64 0, i64 %indvars.iv.next203
  %319 = load i64, ptr %318, align 8, !tbaa !5
  %320 = srem i64 %319, %302
  %321 = getelementptr inbounds [1000009 x i32], ptr @cnt, i64 0, i64 %320
  %322 = load i32, ptr %321, align 4, !tbaa !9
  %323 = add nsw i32 %322, 1
  store i32 %323, ptr %321, align 4, !tbaa !9
  %indvars.iv.next203.1 = add nuw nsw i64 %indvars.iv202, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %.lr.ph176.preheader.unr-lcssa, label %.lr.ph174.new, !llvm.loop !22

.lr.ph176.preheader.unr-lcssa:                    ; preds = %.lr.ph174.new, %.lr.ph174
  %indvars.iv202.unr = phi i64 [ 0, %.lr.ph174 ], [ %indvars.iv.next203.1, %.lr.ph174.new ]
  br i1 %lcmp.mod.not, label %.lr.ph176.preheader, label %.lr.ph176.preheader.epilog-lcssa

.lr.ph176.preheader.epilog-lcssa:                 ; preds = %.lr.ph176.preheader.unr-lcssa
  %324 = getelementptr inbounds [1000009 x i64], ptr @tmp, i64 0, i64 %indvars.iv202.unr
  %325 = load i64, ptr %324, align 8, !tbaa !5
  %326 = srem i64 %325, %302
  %327 = getelementptr inbounds [1000009 x i32], ptr @cnt, i64 0, i64 %326
  %328 = load i32, ptr %327, align 4, !tbaa !9
  %329 = add nsw i32 %328, 1
  store i32 %329, ptr %327, align 4, !tbaa !9
  br label %.lr.ph176.preheader

.lr.ph176.preheader:                              ; preds = %.lr.ph176.preheader.unr-lcssa, %.lr.ph176.preheader.epilog-lcssa
  %.pre219 = load i32, ptr @cnt, align 16, !tbaa !9
  br i1 %308, label %.lr.ph179.unr-lcssa, label %.lr.ph176

.lr.ph179.unr-lcssa:                              ; preds = %.lr.ph176, %.lr.ph176.preheader
  %.unr = phi i32 [ %.pre219, %.lr.ph176.preheader ], [ %349, %.lr.ph176 ]
  %indvars.iv206.unr = phi i64 [ 1, %.lr.ph176.preheader ], [ %indvars.iv.next207.3, %.lr.ph176 ]
  br i1 %lcmp.mod255.not, label %.lr.ph179, label %.lr.ph176.epil

.lr.ph176.epil:                                   ; preds = %.lr.ph179.unr-lcssa, %.lr.ph176.epil
  %330 = phi i32 [ %333, %.lr.ph176.epil ], [ %.unr, %.lr.ph179.unr-lcssa ]
  %indvars.iv206.epil = phi i64 [ %indvars.iv.next207.epil, %.lr.ph176.epil ], [ %indvars.iv206.unr, %.lr.ph179.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph176.epil ], [ 0, %.lr.ph179.unr-lcssa ]
  %331 = getelementptr inbounds [1000009 x i32], ptr @cnt, i64 0, i64 %indvars.iv206.epil
  %332 = load i32, ptr %331, align 4, !tbaa !9
  %333 = add nsw i32 %332, %330
  store i32 %333, ptr %331, align 4, !tbaa !9
  %indvars.iv.next207.epil = add nuw nsw i64 %indvars.iv206.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter254
  br i1 %epil.iter.cmp.not, label %.lr.ph179, label %.lr.ph176.epil, !llvm.loop !23

.lr.ph179:                                        ; preds = %.lr.ph176.epil, %.lr.ph179.unr-lcssa
  %334 = xor i32 %310, 1
  %335 = sext i32 %311 to i64
  %336 = sext i32 %334 to i64
  br label %350

.lr.ph176:                                        ; preds = %.lr.ph176.preheader, %.lr.ph176
  %337 = phi i32 [ %349, %.lr.ph176 ], [ %.pre219, %.lr.ph176.preheader ]
  %indvars.iv206 = phi i64 [ %indvars.iv.next207.3, %.lr.ph176 ], [ 1, %.lr.ph176.preheader ]
  %niter257 = phi i64 [ %niter257.next.3, %.lr.ph176 ], [ 0, %.lr.ph176.preheader ]
  %338 = getelementptr inbounds [1000009 x i32], ptr @cnt, i64 0, i64 %indvars.iv206
  %339 = load i32, ptr %338, align 4, !tbaa !9
  %340 = add nsw i32 %339, %337
  store i32 %340, ptr %338, align 4, !tbaa !9
  %indvars.iv.next207 = add nuw nsw i64 %indvars.iv206, 1
  %341 = getelementptr inbounds [1000009 x i32], ptr @cnt, i64 0, i64 %indvars.iv.next207
  %342 = load i32, ptr %341, align 4, !tbaa !9
  %343 = add nsw i32 %342, %340
  store i32 %343, ptr %341, align 4, !tbaa !9
  %indvars.iv.next207.1 = add nuw nsw i64 %indvars.iv206, 2
  %344 = getelementptr inbounds [1000009 x i32], ptr @cnt, i64 0, i64 %indvars.iv.next207.1
  %345 = load i32, ptr %344, align 4, !tbaa !9
  %346 = add nsw i32 %345, %343
  store i32 %346, ptr %344, align 4, !tbaa !9
  %indvars.iv.next207.2 = add nuw nsw i64 %indvars.iv206, 3
  %347 = getelementptr inbounds [1000009 x i32], ptr @cnt, i64 0, i64 %indvars.iv.next207.2
  %348 = load i32, ptr %347, align 4, !tbaa !9
  %349 = add nsw i32 %348, %346
  store i32 %349, ptr %347, align 4, !tbaa !9
  %indvars.iv.next207.3 = add nuw nsw i64 %indvars.iv206, 4
  %niter257.next.3 = add i64 %niter257, 4
  %niter257.ncmp.3 = icmp eq i64 %niter257.next.3, %unroll_iter256
  br i1 %niter257.ncmp.3, label %.lr.ph179.unr-lcssa, label %.lr.ph176, !llvm.loop !25

350:                                              ; preds = %.lr.ph179, %350
  %indvars.iv211 = phi i64 [ %302, %.lr.ph179 ], [ %indvars.iv.next212, %350 ]
  %.1125177 = phi i64 [ 0, %.lr.ph179 ], [ %365, %350 ]
  %indvars.iv.next212 = add nsw i64 %indvars.iv211, -1
  %351 = getelementptr inbounds [2 x [1000009 x i32]], ptr @ord, i64 0, i64 %335, i64 %indvars.iv.next212
  %352 = load i32, ptr %351, align 4, !tbaa !9
  %353 = sext i32 %352 to i64
  %354 = getelementptr inbounds [1000009 x i64], ptr @tmp, i64 0, i64 %353
  %355 = load i64, ptr %354, align 8, !tbaa !5
  %356 = srem i64 %355, %302
  %357 = getelementptr inbounds [1000009 x i32], ptr @cnt, i64 0, i64 %356
  %358 = load i32, ptr %357, align 4, !tbaa !9
  %359 = add nsw i32 %358, -1
  store i32 %359, ptr %357, align 4, !tbaa !9
  %360 = sext i32 %359 to i64
  %361 = getelementptr inbounds [2 x [1000009 x i32]], ptr @ord, i64 0, i64 %336, i64 %360
  store i32 %352, ptr %361, align 4, !tbaa !9
  %362 = sdiv i64 %355, %302
  store i64 %362, ptr %354, align 8, !tbaa !5
  %363 = or i64 %362, %.1125177
  %364 = icmp ne i64 %363, 0
  %365 = zext i1 %364 to i64
  %366 = icmp sgt i64 %indvars.iv211, 1
  br i1 %366, label %350, label %.loopexit, !llvm.loop !26

.loopexit146:                                     ; preds = %.loopexit
  store i32 %311, ptr @pre, align 4, !tbaa !9
  store i32 %334, ptr @cur, align 4, !tbaa !9
  br label %367

367:                                              ; preds = %.loopexit146, %._crit_edge170
  store i64 0, ptr @ans, align 8, !tbaa !5
  %368 = icmp sgt i32 %298, 0
  br i1 %368, label %.lr.ph186.preheader, label %._crit_edge187

.lr.ph186.preheader:                              ; preds = %367
  %.pre221 = load i32, ptr @cur, align 4, !tbaa !9
  br label %.lr.ph186

._crit_edge187:                                   ; preds = %397, %.thread, %367
  %369 = phi i64 [ 0, %367 ], [ 0, %.thread ], [ %402, %397 ]
  %370 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i64 noundef %369)
  %371 = load i32, ptr @t, align 4, !tbaa !9
  %372 = add nsw i32 %371, -1
  store i32 %372, ptr @t, align 4, !tbaa !9
  %.not = icmp eq i32 %371, 0
  br i1 %.not, label %._crit_edge191, label %32, !llvm.loop !27

.lr.ph186:                                        ; preds = %.lr.ph186.preheader, %397
  %373 = phi i32 [ %298, %.lr.ph186.preheader ], [ %398, %397 ]
  %374 = phi i64 [ 0, %.lr.ph186.preheader ], [ %402, %397 ]
  %375 = phi i32 [ %.pre221, %.lr.ph186.preheader ], [ %400, %397 ]
  %indvars.iv216 = phi i64 [ 0, %.lr.ph186.preheader ], [ %indvars.iv.next217, %397 ]
  %.0119184 = phi i64 [ 0, %.lr.ph186.preheader ], [ %indvars.iv213, %397 ]
  %376 = sext i32 %375 to i64
  %377 = getelementptr inbounds [2 x [1000009 x i32]], ptr @ord, i64 0, i64 %376, i64 %indvars.iv216
  %378 = load i32, ptr %377, align 4, !tbaa !9
  %379 = sext i32 %378 to i64
  %380 = getelementptr inbounds [1000009 x i64], ptr @val, i64 0, i64 %379
  %381 = load i64, ptr %380, align 8, !tbaa !5
  %sext = shl i64 %.0119184, 32
  %382 = ashr exact i64 %sext, 32
  br label %383

383:                                              ; preds = %383, %.lr.ph186
  %indvars.iv213 = phi i64 [ %indvars.iv.next214, %383 ], [ %382, %.lr.ph186 ]
  %384 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @seq, i64 0, i64 %indvars.iv213
  %385 = load i64, ptr %384, align 16
  %386 = icmp slt i64 %385, %381
  %indvars.iv.next214 = add nsw i64 %indvars.iv213, 1
  br i1 %386, label %383, label %387, !llvm.loop !28

387:                                              ; preds = %383
  %388 = icmp eq i64 %385, %381
  br i1 %388, label %389, label %392

389:                                              ; preds = %387
  %390 = getelementptr inbounds i8, ptr %384, i64 8
  %391 = load i64, ptr %390, align 8, !tbaa !29
  br label %397

392:                                              ; preds = %387
  %393 = shl i64 %indvars.iv213, 32
  %sext224 = add i64 %393, -4294967296
  %394 = ashr exact i64 %sext224, 32
  %395 = getelementptr inbounds [1000009 x %"struct.std::pair"], ptr @seq, i64 0, i64 %394
  %.sroa.03.0.copyload = load i64, ptr %395, align 16
  %.sroa.24.0..sroa_idx = getelementptr inbounds i8, ptr %395, i64 8
  %.sroa.24.0.copyload = load i64, ptr %.sroa.24.0..sroa_idx, align 8
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %384, i64 8
  %.sroa.2.0.copyload = load i64, ptr %.sroa.2.0..sroa_idx, align 8
  %396 = call noundef i64 @_Z12get_line_valSt4pairIxxES0_x(i64 %.sroa.03.0.copyload, i64 %.sroa.24.0.copyload, i64 %385, i64 %.sroa.2.0.copyload, i64 noundef %381)
  %.pre220 = load i32, ptr @cur, align 4, !tbaa !9
  %.pre222 = load i64, ptr @ans, align 8, !tbaa !5
  %.pre223 = load i32, ptr @n, align 4, !tbaa !9
  br label %397

397:                                              ; preds = %392, %389
  %398 = phi i32 [ %373, %389 ], [ %.pre223, %392 ]
  %399 = phi i64 [ %374, %389 ], [ %.pre222, %392 ]
  %400 = phi i32 [ %375, %389 ], [ %.pre220, %392 ]
  %401 = phi i64 [ %391, %389 ], [ %396, %392 ]
  %402 = add nsw i64 %399, %401
  store i64 %402, ptr @ans, align 8, !tbaa !5
  %indvars.iv.next217 = add nuw nsw i64 %indvars.iv216, 1
  %403 = sext i32 %398 to i64
  %404 = icmp slt i64 %indvars.iv.next217, %403
  br i1 %404, label %.lr.ph186, label %._crit_edge187, !llvm.loop !30

._crit_edge191:                                   ; preds = %._crit_edge187, %17
  ret i32 0
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z7mod_mulxx(i64 noundef, i64 noundef) local_unnamed_addr #2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i32 } @_ZSt9make_pairIRKxiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7pos_inci(i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSIxiEENSt9enable_ifIXsr6__and_ISt13is_assignableIRxOT_ES3_IS4_OT0_EEE5valueERS0_E4typeEOS_IS5_S8_E(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(12)) local_unnamed_addr #6 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z7mod_addxx(i64 noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z7mod_subxx(i64 noundef, i64 noundef) local_unnamed_addr #2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z7val_geti(i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_ZSt9make_pairIRxxESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z12get_line_valSt4pairIxxES0_x(i64, i64, i64, i64, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_ZSt9make_pairIRKxxESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIxxEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #6 align 2

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

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

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

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

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


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