; LLVM IR from tangjz/acm-icpc :: lydsy/4406.ll (Z6appendiii)

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

@mod = external dso_local global i32, align 4
@f = external dso_local global [500001 x i64], align 16
@g = external dso_local global [500001 x i64], align 16
@_ZZ6appendiiiE3idx = external hidden global [1000003 x i32], align 16
@_ZZ6appendiiiE3que = external hidden global [1000003 x i32], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z6appendiii(i32 noundef %0, i32 noundef %1, i32 noundef %2) #0 {
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca i64, align 8
  store i32 %0, ptr %4, align 4, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !5
  %26 = load i32, ptr @mod, align 4, !tbaa !5
  %27 = load i32, ptr %4, align 4, !tbaa !5
  %28 = icmp ne i32 %26, %27
  br i1 %28, label %29, label %172

29:                                               ; preds = %3
  %30 = load i32, ptr @mod, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = mul i64 %31, 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 @g, ptr align 16 @f, i64 %32, i1 false)
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = mul i64 %34, 8
  call void @llvm.memset.p0.i64(ptr align 16 @f, i8 63, i64 %35, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %54, %29
  %37 = load i32, ptr %7, align 4, !tbaa !5
  %38 = load i32, ptr @mod, align 4, !tbaa !5
  %39 = icmp slt i32 %37, %38
  br i1 %39, label %41, label %40

40:                                               ; preds = %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %57

41:                                               ; preds = %36
  %42 = load i32, ptr %7, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [500001 x i64], ptr @g, i64 0, i64 %43
  %45 = load i64, ptr %44, align 8, !tbaa !9
  %46 = load i32, ptr %4, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = srem i64 %45, %47
  %49 = getelementptr inbounds [500001 x i64], ptr @f, i64 0, i64 %48
  %50 = load i32, ptr %7, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [500001 x i64], ptr @g, i64 0, i64 %51
  %53 = load i64, ptr %52, align 8, !tbaa !9
  call void @_Z3updRxx(ptr noundef nonnull align 8 dereferenceable(8) %49, i64 noundef %53)
  br label %54

54:                                               ; preds = %41
  %55 = load i32, ptr %7, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %7, align 4, !tbaa !5
  br label %36, !llvm.loop !11

57:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %58 = load i32, ptr %4, align 4, !tbaa !5
  %59 = load i32, ptr @mod, align 4, !tbaa !5
  %60 = call noundef i32 @_ZSt5__gcdIiET_S0_S0_(i32 noundef %58, i32 noundef %59)
  store i32 %60, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %61 = load i32, ptr @mod, align 4, !tbaa !5
  %62 = load i32, ptr %4, align 4, !tbaa !5
  %63 = srem i32 %61, %62
  store i32 %63, ptr %10, align 4, !tbaa !5
  br label %64

64:                                               ; preds = %167, %57
  %65 = load i32, ptr %8, align 4, !tbaa !5
  %66 = load i32, ptr %9, align 4, !tbaa !5
  %67 = icmp slt i32 %65, %66
  br i1 %67, label %69, label %68

68:                                               ; preds = %64
  store i32 5, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %170

69:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 0, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 0, ptr %13, align 4, !tbaa !5
  %70 = load i32, ptr %8, align 4, !tbaa !5
  %71 = load i32, ptr %12, align 4, !tbaa !5
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %12, align 4, !tbaa !5
  %73 = sext i32 %71 to i64
  %74 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3idx, i64 0, i64 %73
  store i32 %70, ptr %74, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %75 = load i32, ptr %8, align 4, !tbaa !5
  %76 = load i32, ptr %10, align 4, !tbaa !5
  %77 = add nsw i32 %75, %76
  %78 = load i32, ptr %4, align 4, !tbaa !5
  %79 = icmp slt i32 %77, %78
  br i1 %79, label %80, label %84

80:                                               ; preds = %69
  %81 = load i32, ptr %8, align 4, !tbaa !5
  %82 = load i32, ptr %10, align 4, !tbaa !5
  %83 = add nsw i32 %81, %82
  br label %90

84:                                               ; preds = %69
  %85 = load i32, ptr %8, align 4, !tbaa !5
  %86 = load i32, ptr %10, align 4, !tbaa !5
  %87 = add nsw i32 %85, %86
  %88 = load i32, ptr %4, align 4, !tbaa !5
  %89 = sub nsw i32 %87, %88
  br label %90

90:                                               ; preds = %84, %80
  %91 = phi i32 [ %83, %80 ], [ %89, %84 ]
  store i32 %91, ptr %14, align 4, !tbaa !5
  br label %92

92:                                               ; preds = %130, %90
  %93 = load i32, ptr %14, align 4, !tbaa !5
  %94 = load i32, ptr %8, align 4, !tbaa !5
  %95 = icmp ne i32 %93, %94
  br i1 %95, label %97, label %96

96:                                               ; preds = %92
  store i32 8, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %132

97:                                               ; preds = %92
  %98 = load i32, ptr %14, align 4, !tbaa !5
  %99 = load i32, ptr %12, align 4, !tbaa !5
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr %12, align 4, !tbaa !5
  %101 = sext i32 %99 to i64
  %102 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3idx, i64 0, i64 %101
  store i32 %98, ptr %102, align 4, !tbaa !5
  %103 = load i32, ptr %13, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3idx, i64 0, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [500001 x i64], ptr @f, i64 0, i64 %107
  %109 = load i64, ptr %108, align 8, !tbaa !9
  %110 = load i32, ptr %14, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [500001 x i64], ptr @f, i64 0, i64 %111
  %113 = load i64, ptr %112, align 8, !tbaa !9
  %114 = icmp sgt i64 %109, %113
  br i1 %114, label %115, label %118

115:                                              ; preds = %97
  %116 = load i32, ptr %12, align 4, !tbaa !5
  %117 = sub nsw i32 %116, 1
  store i32 %117, ptr %13, align 4, !tbaa !5
  br label %118

118:                                              ; preds = %115, %97
  br label %119

119:                                              ; preds = %118
  %120 = load i32, ptr %10, align 4, !tbaa !5
  %121 = load i32, ptr %14, align 4, !tbaa !5
  %122 = add nsw i32 %121, %120
  store i32 %122, ptr %14, align 4, !tbaa !5
  %123 = load i32, ptr %4, align 4, !tbaa !5
  %124 = icmp sge i32 %122, %123
  br i1 %124, label %125, label %130

125:                                              ; preds = %119
  %126 = load i32, ptr %4, align 4, !tbaa !5
  %127 = load i32, ptr %14, align 4, !tbaa !5
  %128 = sub nsw i32 %127, %126
  store i32 %128, ptr %14, align 4, !tbaa !5
  %129 = icmp ne i32 %128, 0
  br label %130

130:                                              ; preds = %125, %119
  %131 = phi i1 [ false, %119 ], [ %129, %125 ]
  br label %92, !llvm.loop !13

132:                                              ; preds = %96
  %133 = load i32, ptr %13, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds i32, ptr @_ZZ6appendiiiE3idx, i64 %134
  %136 = load i32, ptr %12, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds i32, ptr @_ZZ6appendiiiE3idx, i64 %137
  %139 = call noundef ptr @_ZNSt3_V26rotateIPiEET_S2_S2_S2_(ptr noundef @_ZZ6appendiiiE3idx, ptr noundef %135, ptr noundef %138)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  store i32 1, ptr %15, align 4, !tbaa !5
  br label %140

140:                                              ; preds = %163, %132
  %141 = load i32, ptr %15, align 4, !tbaa !5
  %142 = load i32, ptr %12, align 4, !tbaa !5
  %143 = icmp slt i32 %141, %142
  br i1 %143, label %145, label %144

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

145:                                              ; preds = %140
  %146 = load i32, ptr %15, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3idx, i64 0, i64 %147
  %149 = load i32, ptr %148, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [500001 x i64], ptr @f, i64 0, i64 %150
  %152 = load i32, ptr %15, align 4, !tbaa !5
  %153 = sub nsw i32 %152, 1
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3idx, i64 0, i64 %154
  %156 = load i32, ptr %155, align 4, !tbaa !5
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [500001 x i64], ptr @f, i64 0, i64 %157
  %159 = load i64, ptr %158, align 8, !tbaa !9
  %160 = load i32, ptr @mod, align 4, !tbaa !5
  %161 = sext i32 %160 to i64
  %162 = add nsw i64 %159, %161
  call void @_Z3updRxx(ptr noundef nonnull align 8 dereferenceable(8) %151, i64 noundef %162)
  br label %163

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

166:                                              ; preds = %144
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %167

167:                                              ; preds = %166
  %168 = load i32, ptr %8, align 4, !tbaa !5
  %169 = add nsw i32 %168, 1
  store i32 %169, ptr %8, align 4, !tbaa !5
  br label %64, !llvm.loop !15

170:                                              ; preds = %68
  %171 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %171, ptr @mod, align 4, !tbaa !5
  br label %172

172:                                              ; preds = %170, %3
  %173 = load i32, ptr %6, align 4, !tbaa !5
  %174 = icmp sgt i32 %173, 1
  br i1 %174, label %175, label %383

175:                                              ; preds = %172
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  store i32 0, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %176 = load i32, ptr %5, align 4, !tbaa !5
  %177 = load i32, ptr @mod, align 4, !tbaa !5
  %178 = call noundef i32 @_ZSt5__gcdIiET_S0_S0_(i32 noundef %176, i32 noundef %177)
  store i32 %178, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  %179 = load i32, ptr %5, align 4, !tbaa !5
  %180 = load i32, ptr @mod, align 4, !tbaa !5
  %181 = srem i32 %179, %180
  store i32 %181, ptr %18, align 4, !tbaa !5
  br label %182

182:                                              ; preds = %379, %175
  %183 = load i32, ptr %16, align 4, !tbaa !5
  %184 = load i32, ptr %17, align 4, !tbaa !5
  %185 = icmp slt i32 %183, %184
  br i1 %185, label %187, label %186

186:                                              ; preds = %182
  store i32 14, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %382

187:                                              ; preds = %182
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  store i32 0, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  store i32 0, ptr %20, align 4, !tbaa !5
  %188 = load i32, ptr %16, align 4, !tbaa !5
  %189 = load i32, ptr %19, align 4, !tbaa !5
  %190 = add nsw i32 %189, 1
  store i32 %190, ptr %19, align 4, !tbaa !5
  %191 = sext i32 %189 to i64
  %192 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3idx, i64 0, i64 %191
  store i32 %188, ptr %192, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  %193 = load i32, ptr %16, align 4, !tbaa !5
  %194 = load i32, ptr %18, align 4, !tbaa !5
  %195 = add nsw i32 %193, %194
  %196 = load i32, ptr @mod, align 4, !tbaa !5
  %197 = icmp slt i32 %195, %196
  br i1 %197, label %198, label %202

198:                                              ; preds = %187
  %199 = load i32, ptr %16, align 4, !tbaa !5
  %200 = load i32, ptr %18, align 4, !tbaa !5
  %201 = add nsw i32 %199, %200
  br label %208

202:                                              ; preds = %187
  %203 = load i32, ptr %16, align 4, !tbaa !5
  %204 = load i32, ptr %18, align 4, !tbaa !5
  %205 = add nsw i32 %203, %204
  %206 = load i32, ptr @mod, align 4, !tbaa !5
  %207 = sub nsw i32 %205, %206
  br label %208

208:                                              ; preds = %202, %198
  %209 = phi i32 [ %201, %198 ], [ %207, %202 ]
  store i32 %209, ptr %21, align 4, !tbaa !5
  br label %210

210:                                              ; preds = %248, %208
  %211 = load i32, ptr %21, align 4, !tbaa !5
  %212 = load i32, ptr %16, align 4, !tbaa !5
  %213 = icmp ne i32 %211, %212
  br i1 %213, label %215, label %214

214:                                              ; preds = %210
  store i32 17, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  br label %250

215:                                              ; preds = %210
  %216 = load i32, ptr %21, align 4, !tbaa !5
  %217 = load i32, ptr %19, align 4, !tbaa !5
  %218 = add nsw i32 %217, 1
  store i32 %218, ptr %19, align 4, !tbaa !5
  %219 = sext i32 %217 to i64
  %220 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3idx, i64 0, i64 %219
  store i32 %216, ptr %220, align 4, !tbaa !5
  %221 = load i32, ptr %20, align 4, !tbaa !5
  %222 = sext i32 %221 to i64
  %223 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3idx, i64 0, i64 %222
  %224 = load i32, ptr %223, align 4, !tbaa !5
  %225 = sext i32 %224 to i64
  %226 = getelementptr inbounds [500001 x i64], ptr @f, i64 0, i64 %225
  %227 = load i64, ptr %226, align 8, !tbaa !9
  %228 = load i32, ptr %21, align 4, !tbaa !5
  %229 = sext i32 %228 to i64
  %230 = getelementptr inbounds [500001 x i64], ptr @f, i64 0, i64 %229
  %231 = load i64, ptr %230, align 8, !tbaa !9
  %232 = icmp sgt i64 %227, %231
  br i1 %232, label %233, label %236

233:                                              ; preds = %215
  %234 = load i32, ptr %19, align 4, !tbaa !5
  %235 = sub nsw i32 %234, 1
  store i32 %235, ptr %20, align 4, !tbaa !5
  br label %236

236:                                              ; preds = %233, %215
  br label %237

237:                                              ; preds = %236
  %238 = load i32, ptr %18, align 4, !tbaa !5
  %239 = load i32, ptr %21, align 4, !tbaa !5
  %240 = add nsw i32 %239, %238
  store i32 %240, ptr %21, align 4, !tbaa !5
  %241 = load i32, ptr @mod, align 4, !tbaa !5
  %242 = icmp sge i32 %240, %241
  br i1 %242, label %243, label %248

243:                                              ; preds = %237
  %244 = load i32, ptr @mod, align 4, !tbaa !5
  %245 = load i32, ptr %21, align 4, !tbaa !5
  %246 = sub nsw i32 %245, %244
  store i32 %246, ptr %21, align 4, !tbaa !5
  %247 = icmp ne i32 %246, 0
  br label %248

248:                                              ; preds = %243, %237
  %249 = phi i1 [ false, %237 ], [ %247, %243 ]
  br label %210, !llvm.loop !16

250:                                              ; preds = %214
  %251 = load i32, ptr %20, align 4, !tbaa !5
  %252 = sext i32 %251 to i64
  %253 = getelementptr inbounds i32, ptr @_ZZ6appendiiiE3idx, i64 %252
  %254 = load i32, ptr %19, align 4, !tbaa !5
  %255 = sext i32 %254 to i64
  %256 = getelementptr inbounds i32, ptr @_ZZ6appendiiiE3idx, i64 %255
  %257 = call noundef ptr @_ZNSt3_V26rotateIPiEET_S2_S2_S2_(ptr noundef @_ZZ6appendiiiE3idx, ptr noundef %253, ptr noundef %256)
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  store i32 0, ptr %22, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #7
  store i32 0, ptr %23, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #7
  store i32 0, ptr %24, align 4, !tbaa !5
  br label %258

258:                                              ; preds = %375, %250
  %259 = load i32, ptr %24, align 4, !tbaa !5
  %260 = load i32, ptr %19, align 4, !tbaa !5
  %261 = icmp slt i32 %259, %260
  br i1 %261, label %263, label %262

262:                                              ; preds = %258
  store i32 20, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #7
  br label %378

263:                                              ; preds = %258
  br label %264

264:                                              ; preds = %280, %263
  %265 = load i32, ptr %22, align 4, !tbaa !5
  %266 = load i32, ptr %23, align 4, !tbaa !5
  %267 = icmp slt i32 %265, %266
  br i1 %267, label %268, label %277

268:                                              ; preds = %264
  %269 = load i32, ptr %24, align 4, !tbaa !5
  %270 = load i32, ptr %22, align 4, !tbaa !5
  %271 = sext i32 %270 to i64
  %272 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3que, i64 0, i64 %271
  %273 = load i32, ptr %272, align 4, !tbaa !5
  %274 = sub nsw i32 %269, %273
  %275 = load i32, ptr %6, align 4, !tbaa !5
  %276 = icmp sge i32 %274, %275
  br label %277

277:                                              ; preds = %268, %264
  %278 = phi i1 [ false, %264 ], [ %276, %268 ]
  br i1 %278, label %279, label %283

279:                                              ; preds = %277
  br label %280

280:                                              ; preds = %279
  %281 = load i32, ptr %22, align 4, !tbaa !5
  %282 = add nsw i32 %281, 1
  store i32 %282, ptr %22, align 4, !tbaa !5
  br label %264, !llvm.loop !17

283:                                              ; preds = %277
  br label %284

284:                                              ; preds = %323, %283
  %285 = load i32, ptr %22, align 4, !tbaa !5
  %286 = load i32, ptr %23, align 4, !tbaa !5
  %287 = icmp slt i32 %285, %286
  br i1 %287, label %288, label %320

288:                                              ; preds = %284
  %289 = load i32, ptr %23, align 4, !tbaa !5
  %290 = sub nsw i32 %289, 1
  %291 = sext i32 %290 to i64
  %292 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3que, i64 0, i64 %291
  %293 = load i32, ptr %292, align 4, !tbaa !5
  %294 = sext i32 %293 to i64
  %295 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3idx, i64 0, i64 %294
  %296 = load i32, ptr %295, align 4, !tbaa !5
  %297 = sext i32 %296 to i64
  %298 = getelementptr inbounds [500001 x i64], ptr @f, i64 0, i64 %297
  %299 = load i64, ptr %298, align 8, !tbaa !9
  %300 = load i32, ptr %24, align 4, !tbaa !5
  %301 = load i32, ptr %23, align 4, !tbaa !5
  %302 = sub nsw i32 %301, 1
  %303 = sext i32 %302 to i64
  %304 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3que, i64 0, i64 %303
  %305 = load i32, ptr %304, align 4, !tbaa !5
  %306 = sub nsw i32 %300, %305
  %307 = sext i32 %306 to i64
  %308 = load i32, ptr %5, align 4, !tbaa !5
  %309 = sext i32 %308 to i64
  %310 = mul nsw i64 %307, %309
  %311 = add nsw i64 %299, %310
  %312 = load i32, ptr %24, align 4, !tbaa !5
  %313 = sext i32 %312 to i64
  %314 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3idx, i64 0, i64 %313
  %315 = load i32, ptr %314, align 4, !tbaa !5
  %316 = sext i32 %315 to i64
  %317 = getelementptr inbounds [500001 x i64], ptr @f, i64 0, i64 %316
  %318 = load i64, ptr %317, align 8, !tbaa !9
  %319 = icmp sge i64 %311, %318
  br label %320

320:                                              ; preds = %288, %284
  %321 = phi i1 [ false, %284 ], [ %319, %288 ]
  br i1 %321, label %322, label %326

322:                                              ; preds = %320
  br label %323

323:                                              ; preds = %322
  %324 = load i32, ptr %23, align 4, !tbaa !5
  %325 = add nsw i32 %324, -1
  store i32 %325, ptr %23, align 4, !tbaa !5
  br label %284, !llvm.loop !18

326:                                              ; preds = %320
  %327 = load i32, ptr %22, align 4, !tbaa !5
  %328 = load i32, ptr %23, align 4, !tbaa !5
  %329 = icmp slt i32 %327, %328
  br i1 %329, label %330, label %369

330:                                              ; preds = %326
  %331 = load i32, ptr %24, align 4, !tbaa !5
  %332 = sext i32 %331 to i64
  %333 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3idx, i64 0, i64 %332
  %334 = load i32, ptr %333, align 4, !tbaa !5
  %335 = sext i32 %334 to i64
  %336 = getelementptr inbounds [500001 x i64], ptr @f, i64 0, i64 %335
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #7
  %337 = load i32, ptr %22, align 4, !tbaa !5
  %338 = sext i32 %337 to i64
  %339 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3que, i64 0, i64 %338
  %340 = load i32, ptr %339, align 4, !tbaa !5
  %341 = sext i32 %340 to i64
  %342 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3idx, i64 0, i64 %341
  %343 = load i32, ptr %342, align 4, !tbaa !5
  %344 = sext i32 %343 to i64
  %345 = getelementptr inbounds [500001 x i64], ptr @f, i64 0, i64 %344
  %346 = load i64, ptr %345, align 8, !tbaa !9
  %347 = load i32, ptr %4, align 4, !tbaa !5
  %348 = sext i32 %347 to i64
  %349 = add nsw i64 %346, %348
  %350 = load i32, ptr %24, align 4, !tbaa !5
  %351 = load i32, ptr %22, align 4, !tbaa !5
  %352 = sext i32 %351 to i64
  %353 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3que, i64 0, i64 %352
  %354 = load i32, ptr %353, align 4, !tbaa !5
  %355 = sub nsw i32 %350, %354
  %356 = sext i32 %355 to i64
  %357 = load i32, ptr %5, align 4, !tbaa !5
  %358 = sext i32 %357 to i64
  %359 = mul nsw i64 %356, %358
  %360 = add nsw i64 %349, %359
  store i64 %360, ptr %25, align 8, !tbaa !9
  %361 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %336, ptr noundef nonnull align 8 dereferenceable(8) %25)
  %362 = load i64, ptr %361, align 8, !tbaa !9
  %363 = load i32, ptr %24, align 4, !tbaa !5
  %364 = sext i32 %363 to i64
  %365 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3idx, i64 0, i64 %364
  %366 = load i32, ptr %365, align 4, !tbaa !5
  %367 = sext i32 %366 to i64
  %368 = getelementptr inbounds [500001 x i64], ptr @f, i64 0, i64 %367
  store i64 %362, ptr %368, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #7
  br label %369

369:                                              ; preds = %330, %326
  %370 = load i32, ptr %24, align 4, !tbaa !5
  %371 = load i32, ptr %23, align 4, !tbaa !5
  %372 = add nsw i32 %371, 1
  store i32 %372, ptr %23, align 4, !tbaa !5
  %373 = sext i32 %371 to i64
  %374 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3que, i64 0, i64 %373
  store i32 %370, ptr %374, align 4, !tbaa !5
  br label %375

375:                                              ; preds = %369
  %376 = load i32, ptr %24, align 4, !tbaa !5
  %377 = add nsw i32 %376, 1
  store i32 %377, ptr %24, align 4, !tbaa !5
  br label %258, !llvm.loop !19

378:                                              ; preds = %262
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %379

379:                                              ; preds = %378
  %380 = load i32, ptr %16, align 4, !tbaa !5
  %381 = add nsw i32 %380, 1
  store i32 %381, ptr %16, align 4, !tbaa !5
  br label %182, !llvm.loop !20

382:                                              ; preds = %186
  br label %383

383:                                              ; preds = %382, %172
  ret void
}

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZSt5__gcdIiET_S0_S0_(i32 noundef, i32 noundef) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZNSt3_V26rotateIPiEET_S2_S2_S2_(ptr noundef, ptr noundef, ptr noundef) #6

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

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

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

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

@mod = external dso_local local_unnamed_addr global i32, align 4
@f = external dso_local global [500001 x i64], align 16
@g = external dso_local local_unnamed_addr global [500001 x i64], align 16
@_ZZ6appendiiiE3idx = external hidden global [1000003 x i32], align 16
@_ZZ6appendiiiE3que = external hidden local_unnamed_addr global [1000003 x i32], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z6appendiii(i32 noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = alloca i64, align 8
  %5 = load i32, ptr @mod, align 4, !tbaa !5
  %.not = icmp eq i32 %5, %0
  br i1 %.not, label %61, label %6

6:                                                ; preds = %3
  %7 = sext i32 %5 to i64
  %8 = shl nsw i64 %7, 3
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 @g, ptr nonnull align 16 @f, i64 %8, i1 false)
  %9 = sext i32 %0 to i64
  %10 = shl nsw i64 %9, 3
  tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @f, i8 63, i64 %10, i1 false)
  %11 = icmp sgt i32 %5, 0
  br i1 %11, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %6
  %.lcssa141 = phi i32 [ %5, %6 ], [ %20, %.lr.ph ]
  %12 = tail call noundef i32 @_ZSt5__gcdIiET_S0_S0_(i32 noundef %0, i32 noundef %.lcssa141)
  %13 = load i32, ptr @mod, align 4, !tbaa !5
  %14 = srem i32 %13, %0
  %15 = icmp sgt i32 %12, 0
  br i1 %15, label %.lr.ph158, label %._crit_edge159

.lr.ph:                                           ; preds = %6, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %6 ]
  %16 = getelementptr inbounds [500001 x i64], ptr @g, i64 0, i64 %indvars.iv
  %17 = load i64, ptr %16, align 8, !tbaa !9
  %18 = srem i64 %17, %9
  %19 = getelementptr inbounds [500001 x i64], ptr @f, i64 0, i64 %18
  tail call void @_Z3updRxx(ptr noundef nonnull align 8 dereferenceable(8) %19, i64 noundef %17)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %20 = load i32, ptr @mod, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = icmp slt i64 %indvars.iv.next, %21
  br i1 %22, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge159:                                   ; preds = %._crit_edge155, %._crit_edge
  store i32 %0, ptr @mod, align 4, !tbaa !5
  br label %61

.lr.ph158:                                        ; preds = %._crit_edge, %._crit_edge155
  %.0107156 = phi i32 [ %47, %._crit_edge155 ], [ 0, %._crit_edge ]
  store i32 %.0107156, ptr @_ZZ6appendiiiE3idx, align 16, !tbaa !5
  %23 = add nsw i32 %.0107156, %14
  %24 = icmp slt i32 %23, %0
  %25 = select i1 %24, i32 0, i32 %0
  %26 = sub nsw i32 %23, %25
  %.not133143 = icmp eq i32 %26, %.0107156
  br i1 %.not133143, label %._crit_edge149.thread, label %.lr.ph148

._crit_edge149.thread:                            ; preds = %.lr.ph158
  %27 = tail call noundef ptr @_ZNSt3_V26rotateIPiEET_S2_S2_S2_(ptr noundef nonnull @_ZZ6appendiiiE3idx, ptr noundef nonnull @_ZZ6appendiiiE3idx, ptr noundef nonnull getelementptr inbounds (i8, ptr @_ZZ6appendiiiE3idx, i64 4))
  br label %._crit_edge155

._crit_edge149:                                   ; preds = %.lr.ph148
  %28 = sext i32 %spec.select to i64
  %29 = getelementptr inbounds i32, ptr @_ZZ6appendiiiE3idx, i64 %28
  %30 = and i64 %indvars.iv.next188, 4294967295
  %31 = getelementptr inbounds i32, ptr @_ZZ6appendiiiE3idx, i64 %30
  %32 = tail call noundef ptr @_ZNSt3_V26rotateIPiEET_S2_S2_S2_(ptr noundef nonnull @_ZZ6appendiiiE3idx, ptr noundef nonnull %29, ptr noundef nonnull %31)
  br label %.lr.ph154

.lr.ph148:                                        ; preds = %.lr.ph158, %.lr.ph148
  %indvars.iv187 = phi i64 [ %indvars.iv.next188, %.lr.ph148 ], [ 1, %.lr.ph158 ]
  %.0110146 = phi i32 [ %.1111, %.lr.ph148 ], [ %26, %.lr.ph158 ]
  %.0112145 = phi i32 [ %spec.select, %.lr.ph148 ], [ 0, %.lr.ph158 ]
  %indvars.iv.next188 = add nuw nsw i64 %indvars.iv187, 1
  %33 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3idx, i64 0, i64 %indvars.iv187
  store i32 %.0110146, ptr %33, align 4, !tbaa !5
  %34 = sext i32 %.0112145 to i64
  %35 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3idx, i64 0, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [500001 x i64], ptr @f, i64 0, i64 %37
  %39 = load i64, ptr %38, align 8, !tbaa !9
  %40 = sext i32 %.0110146 to i64
  %41 = getelementptr inbounds [500001 x i64], ptr @f, i64 0, i64 %40
  %42 = load i64, ptr %41, align 8, !tbaa !9
  %43 = icmp sgt i64 %39, %42
  %44 = trunc nuw nsw i64 %indvars.iv187 to i32
  %spec.select = select i1 %43, i32 %44, i32 %.0112145
  %45 = add nsw i32 %.0110146, %14
  %.not134 = icmp slt i32 %45, %0
  %46 = select i1 %.not134, i32 0, i32 %0
  %.1111 = sub nsw i32 %45, %46
  %.not133 = icmp eq i32 %.1111, %.0107156
  br i1 %.not133, label %._crit_edge149, label %.lr.ph148, !llvm.loop !13

._crit_edge155:                                   ; preds = %.lr.ph154, %._crit_edge149.thread
  %47 = add nuw nsw i32 %.0107156, 1
  %exitcond193.not = icmp eq i32 %47, %12
  br i1 %exitcond193.not, label %._crit_edge159, label %.lr.ph158, !llvm.loop !14

.lr.ph154:                                        ; preds = %._crit_edge149, %.lr.ph154
  %indvars.iv190 = phi i64 [ %indvars.iv.next191, %.lr.ph154 ], [ 1, %._crit_edge149 ]
  %48 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3idx, i64 0, i64 %indvars.iv190
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [500001 x i64], ptr @f, i64 0, i64 %50
  %52 = add nsw i64 %indvars.iv190, -1
  %53 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3idx, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [500001 x i64], ptr @f, i64 0, i64 %55
  %57 = load i64, ptr %56, align 8, !tbaa !9
  %58 = load i32, ptr @mod, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = add nsw i64 %57, %59
  tail call void @_Z3updRxx(ptr noundef nonnull align 8 dereferenceable(8) %51, i64 noundef %60)
  %indvars.iv.next191 = add nuw nsw i64 %indvars.iv190, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next191, %30
  br i1 %exitcond.not, label %._crit_edge155, label %.lr.ph154, !llvm.loop !15

61:                                               ; preds = %._crit_edge159, %3
  %62 = icmp sgt i32 %2, 1
  br i1 %62, label %63, label %.loopexit

63:                                               ; preds = %61
  %64 = tail call noundef i32 @_ZSt5__gcdIiET_S0_S0_(i32 noundef %1, i32 noundef %0)
  %65 = load i32, ptr @mod, align 4, !tbaa !5
  %66 = srem i32 %1, %65
  %67 = icmp sgt i32 %64, 0
  br i1 %67, label %.lr.ph180, label %.loopexit

.lr.ph180:                                        ; preds = %63
  %68 = sext i32 %1 to i64
  %69 = sext i32 %0 to i64
  br label %70

70:                                               ; preds = %.lr.ph180, %99
  %.0108178 = phi i32 [ 0, %.lr.ph180 ], [ %100, %99 ]
  store i32 %.0108178, ptr @_ZZ6appendiiiE3idx, align 16, !tbaa !5
  %71 = add nsw i32 %.0108178, %66
  %72 = load i32, ptr @mod, align 4, !tbaa !5
  %73 = icmp slt i32 %71, %72
  %74 = select i1 %73, i32 0, i32 %72
  %75 = sub nsw i32 %71, %74
  %.not129160 = icmp eq i32 %75, %.0108178
  br i1 %.not129160, label %._crit_edge166, label %.lr.ph165

._crit_edge166:                                   ; preds = %.lr.ph165, %70
  %.0105.lcssa = phi i64 [ 1, %70 ], [ %indvars.iv.next195, %.lr.ph165 ]
  %.0103.lcssa = phi i32 [ 0, %70 ], [ %spec.select135, %.lr.ph165 ]
  %76 = sext i32 %.0103.lcssa to i64
  %77 = getelementptr inbounds i32, ptr @_ZZ6appendiiiE3idx, i64 %76
  %78 = and i64 %.0105.lcssa, 4294967295
  %79 = getelementptr inbounds i32, ptr @_ZZ6appendiiiE3idx, i64 %78
  %80 = call noundef ptr @_ZNSt3_V26rotateIPiEET_S2_S2_S2_(ptr noundef nonnull @_ZZ6appendiiiE3idx, ptr noundef nonnull %77, ptr noundef nonnull %79)
  br label %.preheader

.lr.ph165:                                        ; preds = %70, %.lr.ph165
  %indvars.iv194 = phi i64 [ %indvars.iv.next195, %.lr.ph165 ], [ 1, %70 ]
  %.0101163 = phi i32 [ %.1102, %.lr.ph165 ], [ %75, %70 ]
  %.0103162 = phi i32 [ %spec.select135, %.lr.ph165 ], [ 0, %70 ]
  %indvars.iv.next195 = add nuw nsw i64 %indvars.iv194, 1
  %81 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3idx, i64 0, i64 %indvars.iv194
  store i32 %.0101163, ptr %81, align 4, !tbaa !5
  %82 = sext i32 %.0103162 to i64
  %83 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3idx, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [500001 x i64], ptr @f, i64 0, i64 %85
  %87 = load i64, ptr %86, align 8, !tbaa !9
  %88 = sext i32 %.0101163 to i64
  %89 = getelementptr inbounds [500001 x i64], ptr @f, i64 0, i64 %88
  %90 = load i64, ptr %89, align 8, !tbaa !9
  %91 = icmp sgt i64 %87, %90
  %92 = trunc nuw nsw i64 %indvars.iv194 to i32
  %spec.select135 = select i1 %91, i32 %92, i32 %.0103162
  %93 = add nsw i32 %.0101163, %66
  %.not132 = icmp slt i32 %93, %72
  %94 = select i1 %.not132, i32 0, i32 %72
  %.1102 = sub nsw i32 %93, %94
  %.not129 = icmp eq i32 %.1102, %.0108178
  br i1 %.not129, label %._crit_edge166, label %.lr.ph165, !llvm.loop !16

.preheader:                                       ; preds = %._crit_edge166, %.critedge136
  %indvars.iv204 = phi i64 [ 0, %._crit_edge166 ], [ %indvars.iv.next205, %.critedge136 ]
  %.098176 = phi i32 [ 0, %._crit_edge166 ], [ %147, %.critedge136 ]
  %.099175 = phi i32 [ 0, %._crit_edge166 ], [ %.1100.lcssa, %.critedge136 ]
  %95 = icmp slt i32 %.099175, %.098176
  br i1 %95, label %.lr.ph170.preheader, label %.preheader..critedge_crit_edge

.preheader..critedge_crit_edge:                   ; preds = %.preheader
  %.pre210 = sext i32 %.098176 to i64
  br label %.critedge

.lr.ph170.preheader:                              ; preds = %.preheader
  %96 = sext i32 %.099175 to i64
  %97 = sext i32 %.098176 to i64
  %98 = trunc nuw nsw i64 %indvars.iv204 to i32
  br label %.lr.ph170

99:                                               ; preds = %.critedge136
  %100 = add nuw nsw i32 %.0108178, 1
  %exitcond209.not = icmp eq i32 %100, %64
  br i1 %exitcond209.not, label %.loopexit, label %70, !llvm.loop !17

.lr.ph170:                                        ; preds = %.lr.ph170.preheader, %104
  %indvars.iv197 = phi i64 [ %96, %.lr.ph170.preheader ], [ %indvars.iv.next198, %104 ]
  %101 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3que, i64 0, i64 %indvars.iv197
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = sub nsw i32 %98, %102
  %.not130 = icmp slt i32 %103, %2
  br i1 %.not130, label %.critedge.loopexit.split.loop.exit218, label %104

104:                                              ; preds = %.lr.ph170
  %indvars.iv.next198 = add nsw i64 %indvars.iv197, 1
  %exitcond200.not = icmp eq i64 %indvars.iv.next198, %97
  br i1 %exitcond200.not, label %.critedge, label %.lr.ph170, !llvm.loop !18

.critedge.loopexit.split.loop.exit218:            ; preds = %.lr.ph170
  %105 = trunc nsw i64 %indvars.iv197 to i32
  br label %.critedge

.critedge:                                        ; preds = %104, %.critedge.loopexit.split.loop.exit218, %.preheader..critedge_crit_edge
  %.pre-phi211 = phi i64 [ %.pre210, %.preheader..critedge_crit_edge ], [ %97, %.critedge.loopexit.split.loop.exit218 ], [ %97, %104 ]
  %.1100.lcssa = phi i32 [ %.099175, %.preheader..critedge_crit_edge ], [ %105, %.critedge.loopexit.split.loop.exit218 ], [ %.098176, %104 ]
  %106 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3idx, i64 0, i64 %indvars.iv204
  %107 = sext i32 %.1100.lcssa to i64
  %108 = trunc nuw nsw i64 %indvars.iv204 to i32
  br label %109

109:                                              ; preds = %111, %.critedge
  %indvars.iv201 = phi i64 [ %indvars.iv.next202, %111 ], [ %.pre-phi211, %.critedge ]
  %110 = icmp sgt i64 %indvars.iv201, %107
  br i1 %110, label %111, label %.critedge136.loopexit

111:                                              ; preds = %109
  %indvars.iv.next202 = add nsw i64 %indvars.iv201, -1
  %112 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3que, i64 0, i64 %indvars.iv.next202
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3idx, i64 0, i64 %114
  %116 = load i32, ptr %115, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [500001 x i64], ptr @f, i64 0, i64 %117
  %119 = load i64, ptr %118, align 8, !tbaa !9
  %120 = sub nsw i32 %108, %113
  %121 = sext i32 %120 to i64
  %122 = mul nsw i64 %121, %68
  %123 = add nsw i64 %122, %119
  %124 = load i32, ptr %106, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [500001 x i64], ptr @f, i64 0, i64 %125
  %127 = load i64, ptr %126, align 8, !tbaa !9
  %.not131 = icmp slt i64 %123, %127
  br i1 %.not131, label %.critedge2, label %109, !llvm.loop !19

.critedge2:                                       ; preds = %111
  %128 = getelementptr inbounds [500001 x i64], ptr @f, i64 0, i64 %125
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %129 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3que, i64 0, i64 %107
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3idx, i64 0, i64 %131
  %133 = load i32, ptr %132, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [500001 x i64], ptr @f, i64 0, i64 %134
  %136 = load i64, ptr %135, align 8, !tbaa !9
  %137 = add nsw i64 %136, %69
  %138 = sub nsw i32 %108, %130
  %139 = sext i32 %138 to i64
  %140 = mul nsw i64 %139, %68
  %141 = add nsw i64 %137, %140
  store i64 %141, ptr %4, align 8, !tbaa !9
  %142 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %128, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %143 = load i64, ptr %142, align 8, !tbaa !9
  %144 = load i32, ptr %106, align 4, !tbaa !5
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [500001 x i64], ptr @f, i64 0, i64 %145
  store i64 %143, ptr %146, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  br label %.critedge136

.critedge136.loopexit:                            ; preds = %109
  %.pre = trunc nuw nsw i64 %indvars.iv204 to i32
  br label %.critedge136

.critedge136:                                     ; preds = %.critedge136.loopexit, %.critedge2
  %.pre-phi = phi i32 [ %.pre, %.critedge136.loopexit ], [ %108, %.critedge2 ]
  %.1182 = trunc i64 %indvars.iv201 to i32
  %147 = add nsw i32 %.1182, 1
  %sext = shl i64 %indvars.iv201, 32
  %148 = ashr exact i64 %sext, 32
  %149 = getelementptr inbounds [1000003 x i32], ptr @_ZZ6appendiiiE3que, i64 0, i64 %148
  store i32 %.pre-phi, ptr %149, align 4, !tbaa !5
  %indvars.iv.next205 = add nuw nsw i64 %indvars.iv204, 1
  %exitcond208.not = icmp eq i64 %indvars.iv.next205, %78
  br i1 %exitcond208.not, label %99, label %.preheader, !llvm.loop !20

.loopexit:                                        ; preds = %99, %63, %61
  ret void
}

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZSt5__gcdIiET_S0_S0_(i32 noundef, i32 noundef) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZNSt3_V26rotateIPiEET_S2_S2_S2_(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #6

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

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

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

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


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