; LLVM IR from tangjz/acm-icpc :: codeforces/complete/936D.ll (Z5printv)

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

@m = external dso_local global i32, align 4
@dt = external dso_local global i32, align 4
@que = external dso_local global [1000001 x i32], align 16
@msk = external dso_local global [1000001 x i32], align 16
@f = external dso_local global [2 x [1000001 x i32]], align 16
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZZ5printvE2p1 = external hidden global [2000003 x i32], align 16
@_ZZ5printvE2p2 = external hidden global [1000001 x i32], align 16
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [7 x i8], align 1

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5printv() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = load i32, ptr @m, align 4, !tbaa !5
  %15 = sub nsw i32 %14, 1
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %16
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %19 = icmp eq i32 %18, 1061109567
  br i1 %19, label %20, label %29

20:                                               ; preds = %0
  %21 = load i32, ptr @m, align 4, !tbaa !5
  %22 = sub nsw i32 %21, 1
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [1000001 x i32], ptr getelementptr inbounds ([2 x [1000001 x i32]], ptr @f, i64 0, i64 1), i64 0, i64 %23
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = icmp eq i32 %25, 1061109567
  br i1 %26, label %27, label %29

27:                                               ; preds = %20
  %28 = call i32 @puts(ptr noundef @.str.2)
  br label %254

29:                                               ; preds = %20, %0
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  store i32 0, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  %30 = load i32, ptr @m, align 4, !tbaa !5
  %31 = sub nsw i32 %30, 1
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = icmp eq i32 %34, 1061109567
  %36 = zext i1 %35 to i32
  store i32 %36, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %37 = load i32, ptr @m, align 4, !tbaa !5
  %38 = sub nsw i32 %37, 1
  store i32 %38, ptr %4, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %200, %29
  %40 = load i32, ptr %4, align 4, !tbaa !5
  %41 = icmp sgt i32 %40, 0
  br i1 %41, label %43, label %42

42:                                               ; preds = %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %203

43:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = sub nsw i32 %44, 1
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !5
  store i32 %48, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %49 = load i32, ptr %4, align 4, !tbaa !5
  %50 = sub nsw i32 %49, 1
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [1000001 x i32], ptr getelementptr inbounds ([2 x [1000001 x i32]], ptr @f, i64 0, i64 1), i64 0, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !5
  store i32 %53, ptr %6, align 4, !tbaa !5
  %54 = load i32, ptr %4, align 4, !tbaa !5
  %55 = sub nsw i32 %54, 1
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [1000001 x i32], ptr @que, i64 0, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = add nsw i32 %58, 1
  %60 = load i32, ptr %4, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [1000001 x i32], ptr @que, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = icmp slt i32 %59, %63
  br i1 %64, label %65, label %82

65:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %66 = load i32, ptr %4, align 4, !tbaa !5
  %67 = sub nsw i32 %66, 1
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [1000001 x i32], ptr @que, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = add nsw i32 %70, 1
  %72 = load i32, ptr @dt, align 4, !tbaa !5
  %73 = sub nsw i32 %71, %72
  store i32 %73, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %74 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %75 = load i32, ptr %74, align 4, !tbaa !5
  store i32 %75, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %76 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %77 = load i32, ptr %76, align 4, !tbaa !5
  store i32 %77, ptr %9, align 4, !tbaa !5
  %78 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %79 = load i32, ptr %78, align 4, !tbaa !5
  store i32 %79, ptr %5, align 4, !tbaa !5
  %80 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %81 = load i32, ptr %80, align 4, !tbaa !5
  store i32 %81, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %82

82:                                               ; preds = %65, %43
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %83 = load i32, ptr %3, align 4, !tbaa !5
  %84 = icmp ne i32 %83, 0
  br i1 %84, label %87, label %85

85:                                               ; preds = %82
  %86 = load i32, ptr %5, align 4, !tbaa !5
  br label %89

87:                                               ; preds = %82
  %88 = load i32, ptr %6, align 4, !tbaa !5
  br label %89

89:                                               ; preds = %87, %85
  %90 = phi i32 [ %86, %85 ], [ %88, %87 ]
  store i32 %90, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %91 = load i32, ptr %4, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [1000001 x i32], ptr @msk, i64 0, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = load i32, ptr %3, align 4, !tbaa !5
  %96 = shl i32 1, %95
  %97 = and i32 %94, %96
  %98 = icmp ne i32 %97, 0
  br i1 %98, label %99, label %115

99:                                               ; preds = %89
  %100 = load i32, ptr %10, align 4, !tbaa !5
  %101 = load i32, ptr @dt, align 4, !tbaa !5
  %102 = add nsw i32 %100, %101
  %103 = load i32, ptr %4, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [1000001 x i32], ptr @que, i64 0, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = icmp slt i32 %102, %106
  br i1 %107, label %108, label %112

108:                                              ; preds = %99
  %109 = load i32, ptr %10, align 4, !tbaa !5
  %110 = load i32, ptr @dt, align 4, !tbaa !5
  %111 = add nsw i32 %109, %110
  br label %113

112:                                              ; preds = %99
  br label %113

113:                                              ; preds = %112, %108
  %114 = phi i32 [ %111, %108 ], [ 1061109567, %112 ]
  br label %117

115:                                              ; preds = %89
  %116 = load i32, ptr %10, align 4, !tbaa !5
  br label %117

117:                                              ; preds = %115, %113
  %118 = phi i32 [ %114, %113 ], [ %116, %115 ]
  store i32 %118, ptr %11, align 4, !tbaa !5
  %119 = load i32, ptr %3, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [2 x [1000001 x i32]], ptr @f, i64 0, i64 %120
  %122 = load i32, ptr %4, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [1000001 x i32], ptr %121, i64 0, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !5
  %126 = load i32, ptr %11, align 4, !tbaa !5
  %127 = icmp ne i32 %125, %126
  br i1 %127, label %128, label %149

128:                                              ; preds = %117
  %129 = load i32, ptr %4, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [1000001 x i32], ptr @que, i64 0, i64 %130
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = load i32, ptr %1, align 4, !tbaa !5
  %134 = add nsw i32 %133, 1
  store i32 %134, ptr %1, align 4, !tbaa !5
  %135 = sext i32 %133 to i64
  %136 = getelementptr inbounds [2000003 x i32], ptr @_ZZ5printvE2p1, i64 0, i64 %135
  store i32 %132, ptr %136, align 4, !tbaa !5
  %137 = load i32, ptr %3, align 4, !tbaa !5
  %138 = icmp ne i32 %137, 0
  %139 = xor i1 %138, true
  %140 = zext i1 %139 to i32
  store i32 %140, ptr %3, align 4, !tbaa !5
  %141 = load i32, ptr %3, align 4, !tbaa !5
  %142 = icmp ne i32 %141, 0
  br i1 %142, label %145, label %143

143:                                              ; preds = %128
  %144 = load i32, ptr %5, align 4, !tbaa !5
  br label %147

145:                                              ; preds = %128
  %146 = load i32, ptr %6, align 4, !tbaa !5
  br label %147

147:                                              ; preds = %145, %143
  %148 = phi i32 [ %144, %143 ], [ %146, %145 ]
  store i32 %148, ptr %10, align 4, !tbaa !5
  br label %149

149:                                              ; preds = %147, %117
  %150 = load i32, ptr %4, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [1000001 x i32], ptr @msk, i64 0, i64 %151
  %153 = load i32, ptr %152, align 4, !tbaa !5
  %154 = load i32, ptr %3, align 4, !tbaa !5
  %155 = shl i32 1, %154
  %156 = and i32 %153, %155
  %157 = icmp ne i32 %156, 0
  br i1 %157, label %158, label %173

158:                                              ; preds = %149
  %159 = load i32, ptr %3, align 4, !tbaa !5
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [2 x [1000001 x i32]], ptr @f, i64 0, i64 %160
  %162 = load i32, ptr %4, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [1000001 x i32], ptr %161, i64 0, i64 %163
  %165 = load i32, ptr %164, align 4, !tbaa !5
  %166 = shl i32 %165, 1
  %167 = load i32, ptr %3, align 4, !tbaa !5
  %168 = or i32 %166, %167
  %169 = load i32, ptr %2, align 4, !tbaa !5
  %170 = add nsw i32 %169, 1
  store i32 %170, ptr %2, align 4, !tbaa !5
  %171 = sext i32 %169 to i64
  %172 = getelementptr inbounds [1000001 x i32], ptr @_ZZ5printvE2p2, i64 0, i64 %171
  store i32 %168, ptr %172, align 4, !tbaa !5
  br label %173

173:                                              ; preds = %158, %149
  %174 = load i32, ptr %3, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [2 x [1000001 x i32]], ptr @f, i64 0, i64 %175
  %177 = load i32, ptr %4, align 4, !tbaa !5
  %178 = sub nsw i32 %177, 1
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [1000001 x i32], ptr %176, i64 0, i64 %179
  %181 = load i32, ptr %180, align 4, !tbaa !5
  %182 = load i32, ptr %10, align 4, !tbaa !5
  %183 = icmp ne i32 %181, %182
  br i1 %183, label %184, label %199

184:                                              ; preds = %173
  %185 = load i32, ptr %4, align 4, !tbaa !5
  %186 = sub nsw i32 %185, 1
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [1000001 x i32], ptr @que, i64 0, i64 %187
  %189 = load i32, ptr %188, align 4, !tbaa !5
  %190 = add nsw i32 %189, 1
  %191 = load i32, ptr %1, align 4, !tbaa !5
  %192 = add nsw i32 %191, 1
  store i32 %192, ptr %1, align 4, !tbaa !5
  %193 = sext i32 %191 to i64
  %194 = getelementptr inbounds [2000003 x i32], ptr @_ZZ5printvE2p1, i64 0, i64 %193
  store i32 %190, ptr %194, align 4, !tbaa !5
  %195 = load i32, ptr %3, align 4, !tbaa !5
  %196 = icmp ne i32 %195, 0
  %197 = xor i1 %196, true
  %198 = zext i1 %197 to i32
  store i32 %198, ptr %3, align 4, !tbaa !5
  br label %199

199:                                              ; preds = %184, %173
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %200

200:                                              ; preds = %199
  %201 = load i32, ptr %4, align 4, !tbaa !5
  %202 = add nsw i32 %201, -1
  store i32 %202, ptr %4, align 4, !tbaa !5
  br label %39, !llvm.loop !9

203:                                              ; preds = %42
  %204 = call i32 @puts(ptr noundef @.str.3)
  %205 = load i32, ptr %1, align 4, !tbaa !5
  %206 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %205)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %207 = load i32, ptr %1, align 4, !tbaa !5
  %208 = sub nsw i32 %207, 1
  store i32 %208, ptr %12, align 4, !tbaa !5
  br label %209

209:                                              ; preds = %225, %203
  %210 = load i32, ptr %12, align 4, !tbaa !5
  %211 = icmp sge i32 %210, 0
  br i1 %211, label %213, label %212

212:                                              ; preds = %209
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %228

213:                                              ; preds = %209
  %214 = load i32, ptr %12, align 4, !tbaa !5
  %215 = sext i32 %214 to i64
  %216 = getelementptr inbounds [2000003 x i32], ptr @_ZZ5printvE2p1, i64 0, i64 %215
  %217 = load i32, ptr %216, align 4, !tbaa !5
  %218 = load i32, ptr %12, align 4, !tbaa !5
  %219 = icmp eq i32 %218, 0
  %220 = zext i1 %219 to i64
  %221 = getelementptr inbounds [3 x i8], ptr @.str.6, i64 0, i64 %220
  %222 = load i8, ptr %221, align 1, !tbaa !11
  %223 = sext i8 %222 to i32
  %224 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %217, i32 noundef %223)
  br label %225

225:                                              ; preds = %213
  %226 = load i32, ptr %12, align 4, !tbaa !5
  %227 = add nsw i32 %226, -1
  store i32 %227, ptr %12, align 4, !tbaa !5
  br label %209, !llvm.loop !12

228:                                              ; preds = %212
  %229 = load i32, ptr %2, align 4, !tbaa !5
  %230 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %229)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %231 = load i32, ptr %2, align 4, !tbaa !5
  %232 = sub nsw i32 %231, 1
  store i32 %232, ptr %13, align 4, !tbaa !5
  br label %233

233:                                              ; preds = %250, %228
  %234 = load i32, ptr %13, align 4, !tbaa !5
  %235 = icmp sge i32 %234, 0
  br i1 %235, label %237, label %236

236:                                              ; preds = %233
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %253

237:                                              ; preds = %233
  %238 = load i32, ptr %13, align 4, !tbaa !5
  %239 = sext i32 %238 to i64
  %240 = getelementptr inbounds [1000001 x i32], ptr @_ZZ5printvE2p2, i64 0, i64 %239
  %241 = load i32, ptr %240, align 4, !tbaa !5
  %242 = ashr i32 %241, 1
  %243 = load i32, ptr %13, align 4, !tbaa !5
  %244 = sext i32 %243 to i64
  %245 = getelementptr inbounds [1000001 x i32], ptr @_ZZ5printvE2p2, i64 0, i64 %244
  %246 = load i32, ptr %245, align 4, !tbaa !5
  %247 = and i32 %246, 1
  %248 = add nsw i32 %247, 1
  %249 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i32 noundef %242, i32 noundef %248)
  br label %250

250:                                              ; preds = %237
  %251 = load i32, ptr %13, align 4, !tbaa !5
  %252 = add nsw i32 %251, -1
  store i32 %252, ptr %13, align 4, !tbaa !5
  br label %233, !llvm.loop !13

253:                                              ; preds = %236
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #4
  br label %254

254:                                              ; preds = %253, %27
  ret void
}

declare i32 @puts(ptr noundef) #3

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

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

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

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


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

@m = external dso_local local_unnamed_addr global i32, align 4
@dt = external dso_local local_unnamed_addr global i32, align 4
@que = external dso_local local_unnamed_addr global [1000001 x i32], align 16
@msk = external dso_local local_unnamed_addr global [1000001 x i32], align 16
@f = external dso_local local_unnamed_addr global [2 x [1000001 x i32]], align 16
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZZ5printvE2p1 = external hidden local_unnamed_addr global [2000003 x i32], align 16
@_ZZ5printvE2p2 = external hidden local_unnamed_addr global [1000001 x i32], align 16
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [7 x i8], align 1

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z5printv() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = load i32, ptr @m, align 4, !tbaa !5
  %7 = add nsw i32 %6, -1
  %8 = sext i32 %7 to i64
  %9 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %8
  %10 = load i32, ptr %9, align 4, !tbaa !5
  %11 = icmp eq i32 %10, 1061109567
  br i1 %11, label %12, label %18

12:                                               ; preds = %0
  %13 = getelementptr inbounds [1000001 x i32], ptr getelementptr inbounds (i8, ptr @f, i64 4000004), i64 0, i64 %8
  %14 = load i32, ptr %13, align 4, !tbaa !5
  %15 = icmp eq i32 %14, 1061109567
  br i1 %15, label %16, label %18

16:                                               ; preds = %12
  %17 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %.loopexit

18:                                               ; preds = %12, %0
  %19 = icmp sgt i32 %6, 1
  br i1 %19, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %18
  %20 = zext i1 %11 to i32
  %21 = zext nneg i32 %7 to i64
  br label %.lr.ph

._crit_edge:                                      ; preds = %91, %18
  %.052.lcssa = phi i32 [ 0, %18 ], [ %.153, %91 ]
  %.046.lcssa = phi i32 [ 0, %18 ], [ %.2, %91 ]
  %22 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.3)
  %23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %.046.lcssa)
  %24 = icmp sgt i32 %.046.lcssa, 0
  br i1 %24, label %.lr.ph66.preheader, label %._crit_edge67

.lr.ph66.preheader:                               ; preds = %._crit_edge
  %25 = zext nneg i32 %.046.lcssa to i64
  br label %.lr.ph66

.lr.ph:                                           ; preds = %.lr.ph.preheader, %91
  %indvars.iv = phi i64 [ %21, %.lr.ph.preheader ], [ %indvars.iv.next, %91 ]
  %.04662 = phi i32 [ 0, %.lr.ph.preheader ], [ %.2, %91 ]
  %.04960 = phi i32 [ %20, %.lr.ph.preheader ], [ %.251, %91 ]
  %.05259 = phi i32 [ 0, %.lr.ph.preheader ], [ %.153, %91 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  %indvars.iv.next = add nsw i64 %indvars.iv, -1
  %26 = getelementptr inbounds [1000001 x i32], ptr @f, i64 0, i64 %indvars.iv.next
  %27 = load i32, ptr %26, align 4, !tbaa !5
  store i32 %27, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  %28 = getelementptr inbounds [1000001 x i32], ptr getelementptr inbounds (i8, ptr @f, i64 4000004), i64 0, i64 %indvars.iv.next
  %29 = load i32, ptr %28, align 4, !tbaa !5
  store i32 %29, ptr %2, align 4, !tbaa !5
  %30 = getelementptr inbounds [1000001 x i32], ptr @que, i64 0, i64 %indvars.iv.next
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = add nsw i32 %31, 1
  %33 = getelementptr inbounds [1000001 x i32], ptr @que, i64 0, i64 %indvars.iv
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = icmp slt i32 %32, %34
  br i1 %35, label %36, label %47

36:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %37 = load i32, ptr @dt, align 4, !tbaa !5
  %38 = sub nsw i32 %32, %37
  store i32 %38, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  %39 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %40 = load i32, ptr %39, align 4, !tbaa !5
  store i32 %40, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #4
  %41 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %42 = load i32, ptr %41, align 4, !tbaa !5
  store i32 %42, ptr %5, align 4, !tbaa !5
  %43 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %44 = load i32, ptr %43, align 4, !tbaa !5
  store i32 %44, ptr %1, align 4, !tbaa !5
  %45 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %46 = load i32, ptr %45, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  %.pre = load i32, ptr %1, align 4
  br label %47

47:                                               ; preds = %36, %.lr.ph
  %48 = phi i32 [ %46, %36 ], [ %29, %.lr.ph ]
  %49 = phi i32 [ %.pre, %36 ], [ %27, %.lr.ph ]
  %.not = icmp eq i32 %.04960, 0
  %50 = select i1 %.not, i32 %49, i32 %48
  %51 = getelementptr inbounds [1000001 x i32], ptr @msk, i64 0, i64 %indvars.iv
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = shl nuw nsw i32 1, %.04960
  %54 = and i32 %52, %53
  %.not54 = icmp eq i32 %54, 0
  br i1 %.not54, label %61, label %55

55:                                               ; preds = %47
  %56 = load i32, ptr @dt, align 4
  %57 = add nsw i32 %56, %50
  %58 = load i32, ptr %33, align 4, !tbaa !5
  %59 = icmp slt i32 %57, %58
  %60 = select i1 %59, i32 %57, i32 1061109567
  br label %61

61:                                               ; preds = %47, %55
  %62 = phi i32 [ %60, %55 ], [ %50, %47 ]
  %63 = zext nneg i32 %.04960 to i64
  %64 = getelementptr inbounds [2 x [1000001 x i32]], ptr @f, i64 0, i64 %63, i64 %indvars.iv
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %.not55 = icmp eq i32 %65, %62
  br i1 %.not55, label %73, label %66

66:                                               ; preds = %61
  %67 = load i32, ptr %33, align 4, !tbaa !5
  %68 = add nsw i32 %.04662, 1
  %69 = sext i32 %.04662 to i64
  %70 = getelementptr inbounds [2000003 x i32], ptr @_ZZ5printvE2p1, i64 0, i64 %69
  store i32 %67, ptr %70, align 4, !tbaa !5
  %71 = zext i1 %.not to i32
  %72 = select i1 %.not, i32 %48, i32 %49
  %.pre78 = shl nuw nsw i32 1, %71
  %.pre79 = and i32 %.pre78, %52
  br label %73

73:                                               ; preds = %66, %61
  %.pre-phi80 = phi i32 [ %.pre79, %66 ], [ %54, %61 ]
  %.150 = phi i32 [ %71, %66 ], [ %.04960, %61 ]
  %.047 = phi i32 [ %72, %66 ], [ %50, %61 ]
  %.1 = phi i32 [ %68, %66 ], [ %.04662, %61 ]
  %.not56 = icmp eq i32 %.pre-phi80, 0
  %.pre82 = zext nneg i32 %.150 to i64
  br i1 %.not56, label %._crit_edge81, label %74

74:                                               ; preds = %73
  %75 = getelementptr inbounds [2 x [1000001 x i32]], ptr @f, i64 0, i64 %.pre82, i64 %indvars.iv
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = shl i32 %76, 1
  %78 = or i32 %77, %.150
  %79 = add nsw i32 %.05259, 1
  %80 = sext i32 %.05259 to i64
  %81 = getelementptr inbounds [1000001 x i32], ptr @_ZZ5printvE2p2, i64 0, i64 %80
  store i32 %78, ptr %81, align 4, !tbaa !5
  br label %._crit_edge81

._crit_edge81:                                    ; preds = %73, %74
  %.153 = phi i32 [ %79, %74 ], [ %.05259, %73 ]
  %82 = getelementptr inbounds [2 x [1000001 x i32]], ptr @f, i64 0, i64 %.pre82, i64 %indvars.iv.next
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %.not57 = icmp eq i32 %83, %.047
  br i1 %.not57, label %91, label %84

84:                                               ; preds = %._crit_edge81
  %85 = load i32, ptr %30, align 4, !tbaa !5
  %86 = add nsw i32 %85, 1
  %87 = add nsw i32 %.1, 1
  %88 = sext i32 %.1 to i64
  %89 = getelementptr inbounds [2000003 x i32], ptr @_ZZ5printvE2p1, i64 0, i64 %88
  store i32 %86, ptr %89, align 4, !tbaa !5
  %.not58 = icmp eq i32 %.150, 0
  %90 = zext i1 %.not58 to i32
  br label %91

91:                                               ; preds = %84, %._crit_edge81
  %.251 = phi i32 [ %90, %84 ], [ %.150, %._crit_edge81 ]
  %.2 = phi i32 [ %87, %84 ], [ %.1, %._crit_edge81 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  %92 = icmp ugt i64 %indvars.iv, 1
  br i1 %92, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge67:                                    ; preds = %.lr.ph66, %._crit_edge
  %93 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %.052.lcssa)
  %94 = icmp sgt i32 %.052.lcssa, 0
  br i1 %94, label %.lr.ph70.preheader, label %.loopexit

.lr.ph70.preheader:                               ; preds = %._crit_edge67
  %95 = zext nneg i32 %.052.lcssa to i64
  br label %.lr.ph70

.lr.ph66:                                         ; preds = %.lr.ph66.preheader, %.lr.ph66
  %indvars.iv72 = phi i64 [ %25, %.lr.ph66.preheader ], [ %indvars.iv.next73, %.lr.ph66 ]
  %indvars.iv.next73 = add nsw i64 %indvars.iv72, -1
  %96 = getelementptr inbounds [2000003 x i32], ptr @_ZZ5printvE2p1, i64 0, i64 %indvars.iv.next73
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = icmp eq i64 %indvars.iv.next73, 0
  %99 = zext i1 %98 to i64
  %100 = getelementptr inbounds [3 x i8], ptr @.str.6, i64 0, i64 %99
  %101 = load i8, ptr %100, align 1, !tbaa !11
  %102 = sext i8 %101 to i32
  %103 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %97, i32 noundef %102)
  %104 = icmp ugt i64 %indvars.iv72, 1
  br i1 %104, label %.lr.ph66, label %._crit_edge67, !llvm.loop !12

.lr.ph70:                                         ; preds = %.lr.ph70.preheader, %.lr.ph70
  %indvars.iv75 = phi i64 [ %95, %.lr.ph70.preheader ], [ %indvars.iv.next76, %.lr.ph70 ]
  %indvars.iv.next76 = add nsw i64 %indvars.iv75, -1
  %105 = getelementptr inbounds [1000001 x i32], ptr @_ZZ5printvE2p2, i64 0, i64 %indvars.iv.next76
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = ashr i32 %106, 1
  %108 = and i32 %106, 1
  %109 = add nuw nsw i32 %108, 1
  %110 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %107, i32 noundef %109)
  %111 = icmp ugt i64 %indvars.iv75, 1
  br i1 %111, label %.lr.ph70, label %.loopexit, !llvm.loop !13

.loopexit:                                        ; preds = %.lr.ph70, %._crit_edge67, %16
  ret void
}

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 = { nounwind }

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

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


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