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

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@msk = external dso_local global [2 x [8001 x i32]], align 16
@val = external dso_local global [8001 x i32], align 16
@in = external dso_local global [8001 x i32], align 16
@out = external dso_local global i32, align 4
@ONE = external dso_local global i32, align 4
@ONE2 = external dso_local global i32, align 4
@ZERO = external dso_local global i32, align 4
@not_in = external dso_local global [8001 x i32], align 16
@seq = external dso_local global [2 x [8001 x i32]], align 16
@cur = external dso_local global i32, align 4
@pre = external dso_local global i32, align 4
@res = external dso_local global [8001 x i32], align 16
@tot = external dso_local global i32, align 4
@op = external dso_local global [8001 x [3 x i32]], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@_ZZ4mainE3str = external hidden global [8001 x i8], align 16
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [10 x i8], align 1

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %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 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  br label %17

17:                                               ; preds = %321, %0
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  %19 = icmp eq i32 %18, 1
  br i1 %19, label %20, label %322

20:                                               ; preds = %17
  store i32 0, ptr getelementptr inbounds ([2 x [8001 x i32]], ptr @msk, i64 0, i64 1), align 4, !tbaa !5
  store i32 0, ptr @msk, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %62, %20
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = load i32, ptr @n, align 4, !tbaa !5
  %24 = shl i32 1, %23
  %25 = icmp slt i32 %22, %24
  br i1 %25, label %27, label %26

26:                                               ; preds = %21
  store i32 4, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %65

27:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %28 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @_ZZ4mainE3str)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %45, %27
  %30 = load i32, ptr %6, align 4, !tbaa !5
  %31 = load i32, ptr @n, align 4, !tbaa !5
  %32 = icmp slt i32 %30, %31
  br i1 %32, label %34, label %33

33:                                               ; preds = %29
  store i32 7, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %48

34:                                               ; preds = %29
  %35 = load i32, ptr %4, align 4, !tbaa !5
  %36 = shl i32 %35, 1
  %37 = load i32, ptr %6, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [8001 x i8], ptr @_ZZ4mainE3str, i64 0, i64 %38
  %40 = load i8, ptr %39, align 1, !tbaa !9
  %41 = sext i8 %40 to i32
  %42 = icmp eq i32 %41, 49
  %43 = zext i1 %42 to i32
  %44 = or i32 %36, %43
  store i32 %44, ptr %4, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %34
  %46 = load i32, ptr %6, align 4, !tbaa !5
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %6, align 4, !tbaa !5
  br label %29, !llvm.loop !10

48:                                               ; preds = %33
  %49 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %5)
  %50 = load i32, ptr %4, align 4, !tbaa !5
  %51 = load i32, ptr %5, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [2 x [8001 x i32]], ptr @msk, i64 0, i64 %52
  %54 = load i32, ptr %5, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [2 x [8001 x i32]], ptr @msk, i64 0, i64 %55
  %57 = getelementptr inbounds [8001 x i32], ptr %56, i64 0, i64 0
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %57, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [8001 x i32], ptr %53, i64 0, i64 %60
  store i32 %50, ptr %61, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %62

62:                                               ; preds = %48
  %63 = load i32, ptr %2, align 4, !tbaa !5
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %2, align 4, !tbaa !5
  br label %21, !llvm.loop !12

65:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %66 = load i32, ptr @msk, align 16, !tbaa !5
  %67 = load i32, ptr getelementptr inbounds ([2 x [8001 x i32]], ptr @msk, i64 0, i64 1), align 4, !tbaa !5
  %68 = icmp slt i32 %66, %67
  %69 = zext i1 %68 to i64
  %70 = select i1 %68, i32 0, i32 1
  store i32 %70, ptr %7, align 4, !tbaa !5
  store i32 0, ptr @tot, align 4, !tbaa !5
  store i32 0, ptr @m, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %71

71:                                               ; preds = %82, %65
  %72 = load i32, ptr %8, align 4, !tbaa !5
  %73 = load i32, ptr @n, align 4, !tbaa !5
  %74 = icmp sle i32 %72, %73
  br i1 %74, label %76, label %75

75:                                               ; preds = %71
  store i32 10, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %85

76:                                               ; preds = %71
  %77 = load i32, ptr @m, align 4, !tbaa !5
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr @m, align 4, !tbaa !5
  %79 = load i32, ptr %8, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [8001 x i32], ptr @in, i64 0, i64 %80
  store i32 %78, ptr %81, align 4, !tbaa !5
  br label %82

82:                                               ; preds = %76
  %83 = load i32, ptr %8, align 4, !tbaa !5
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %8, align 4, !tbaa !5
  br label %71, !llvm.loop !13

85:                                               ; preds = %75
  %86 = load i32, ptr @m, align 4, !tbaa !5
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr @m, align 4, !tbaa !5
  store i32 %87, ptr @out, align 4, !tbaa !5
  %88 = load i32, ptr %7, align 4, !tbaa !5
  %89 = load i32, ptr @m, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [8001 x i32], ptr @val, i64 0, i64 %90
  store i32 %88, ptr %91, align 4, !tbaa !5
  %92 = load i32, ptr @m, align 4, !tbaa !5
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr @m, align 4, !tbaa !5
  store i32 %93, ptr @ONE, align 4, !tbaa !5
  %94 = load i32, ptr @m, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [8001 x i32], ptr @val, i64 0, i64 %95
  store i32 1, ptr %96, align 4, !tbaa !5
  %97 = load i32, ptr @m, align 4, !tbaa !5
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr @m, align 4, !tbaa !5
  store i32 %98, ptr @ONE2, align 4, !tbaa !5
  %99 = load i32, ptr @m, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [8001 x i32], ptr @val, i64 0, i64 %100
  store i32 1, ptr %101, align 4, !tbaa !5
  %102 = load i32, ptr @m, align 4, !tbaa !5
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr @m, align 4, !tbaa !5
  store i32 %103, ptr @ZERO, align 4, !tbaa !5
  %104 = load i32, ptr @m, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [8001 x i32], ptr @val, i64 0, i64 %105
  store i32 0, ptr %106, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %107

107:                                              ; preds = %130, %85
  %108 = load i32, ptr %9, align 4, !tbaa !5
  %109 = load i32, ptr @n, align 4, !tbaa !5
  %110 = icmp sle i32 %108, %109
  br i1 %110, label %112, label %111

111:                                              ; preds = %107
  store i32 13, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %133

112:                                              ; preds = %107
  %113 = load i32, ptr @m, align 4, !tbaa !5
  %114 = add nsw i32 %113, 1
  store i32 %114, ptr @m, align 4, !tbaa !5
  %115 = load i32, ptr %9, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [8001 x i32], ptr @not_in, i64 0, i64 %116
  store i32 %114, ptr %117, align 4, !tbaa !5
  %118 = load i32, ptr @m, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [8001 x i32], ptr @val, i64 0, i64 %119
  store i32 1, ptr %120, align 4, !tbaa !5
  %121 = load i32, ptr %9, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [8001 x i32], ptr @in, i64 0, i64 %122
  %124 = load i32, ptr %123, align 4, !tbaa !5
  %125 = load i32, ptr @ONE, align 4, !tbaa !5
  %126 = load i32, ptr %9, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [8001 x i32], ptr @not_in, i64 0, i64 %127
  %129 = load i32, ptr %128, align 4, !tbaa !5
  call void @_Z5addOpiii(i32 noundef %124, i32 noundef %125, i32 noundef %129)
  br label %130

130:                                              ; preds = %112
  %131 = load i32, ptr %9, align 4, !tbaa !5
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %9, align 4, !tbaa !5
  br label %107, !llvm.loop !14

133:                                              ; preds = %111
  %134 = load i32, ptr @ONE, align 4, !tbaa !5
  %135 = load i32, ptr @cur, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [2 x [8001 x i32]], ptr @seq, i64 0, i64 %136
  %138 = getelementptr inbounds [8001 x i32], ptr %137, i64 0, i64 0
  store i32 %134, ptr %138, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %139

139:                                              ; preds = %201, %133
  %140 = load i32, ptr %10, align 4, !tbaa !5
  %141 = load i32, ptr @n, align 4, !tbaa !5
  %142 = icmp sle i32 %140, %141
  br i1 %142, label %144, label %143

143:                                              ; preds = %139
  store i32 16, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %204

144:                                              ; preds = %139
  %145 = load i32, ptr @pre, align 4, !tbaa !5
  %146 = xor i32 %145, 1
  store i32 %146, ptr @pre, align 4, !tbaa !5
  %147 = load i32, ptr @cur, align 4, !tbaa !5
  %148 = xor i32 %147, 1
  store i32 %148, ptr @cur, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %149

149:                                              ; preds = %197, %144
  %150 = load i32, ptr %11, align 4, !tbaa !5
  %151 = load i32, ptr %10, align 4, !tbaa !5
  %152 = shl i32 1, %151
  %153 = icmp slt i32 %150, %152
  br i1 %153, label %155, label %154

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

155:                                              ; preds = %149
  %156 = load i32, ptr @m, align 4, !tbaa !5
  %157 = add nsw i32 %156, 1
  store i32 %157, ptr @m, align 4, !tbaa !5
  %158 = load i32, ptr @cur, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [2 x [8001 x i32]], ptr @seq, i64 0, i64 %159
  %161 = load i32, ptr %11, align 4, !tbaa !5
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [8001 x i32], ptr %160, i64 0, i64 %162
  store i32 %157, ptr %163, align 4, !tbaa !5
  %164 = load i32, ptr @m, align 4, !tbaa !5
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [8001 x i32], ptr @val, i64 0, i64 %165
  store i32 0, ptr %166, align 4, !tbaa !5
  %167 = load i32, ptr @pre, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [2 x [8001 x i32]], ptr @seq, i64 0, i64 %168
  %170 = load i32, ptr %11, align 4, !tbaa !5
  %171 = ashr i32 %170, 1
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [8001 x i32], ptr %169, i64 0, i64 %172
  %174 = load i32, ptr %173, align 4, !tbaa !5
  %175 = load i32, ptr %11, align 4, !tbaa !5
  %176 = and i32 %175, 1
  %177 = icmp ne i32 %176, 0
  br i1 %177, label %178, label %183

178:                                              ; preds = %155
  %179 = load i32, ptr %10, align 4, !tbaa !5
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [8001 x i32], ptr @in, i64 0, i64 %180
  %182 = load i32, ptr %181, align 4, !tbaa !5
  br label %188

183:                                              ; preds = %155
  %184 = load i32, ptr %10, align 4, !tbaa !5
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [8001 x i32], ptr @not_in, i64 0, i64 %185
  %187 = load i32, ptr %186, align 4, !tbaa !5
  br label %188

188:                                              ; preds = %183, %178
  %189 = phi i32 [ %182, %178 ], [ %187, %183 ]
  %190 = load i32, ptr @cur, align 4, !tbaa !5
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [2 x [8001 x i32]], ptr @seq, i64 0, i64 %191
  %193 = load i32, ptr %11, align 4, !tbaa !5
  %194 = sext i32 %193 to i64
  %195 = getelementptr inbounds [8001 x i32], ptr %192, i64 0, i64 %194
  %196 = load i32, ptr %195, align 4, !tbaa !5
  call void @_Z5addOpiii(i32 noundef %174, i32 noundef %189, i32 noundef %196)
  br label %197

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

200:                                              ; preds = %154
  br label %201

201:                                              ; preds = %200
  %202 = load i32, ptr %10, align 4, !tbaa !5
  %203 = add nsw i32 %202, 1
  store i32 %203, ptr %10, align 4, !tbaa !5
  br label %139, !llvm.loop !16

204:                                              ; preds = %143
  %205 = load i32, ptr @ONE, align 4, !tbaa !5
  store i32 %205, ptr @res, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %206 = load i32, ptr %7, align 4, !tbaa !5
  %207 = sext i32 %206 to i64
  %208 = getelementptr inbounds [2 x [8001 x i32]], ptr @msk, i64 0, i64 %207
  %209 = getelementptr inbounds [8001 x i32], ptr %208, i64 0, i64 0
  %210 = load i32, ptr %209, align 4, !tbaa !5
  store i32 %210, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 1, ptr %13, align 4, !tbaa !5
  br label %211

211:                                              ; preds = %257, %204
  %212 = load i32, ptr %13, align 4, !tbaa !5
  %213 = load i32, ptr %12, align 4, !tbaa !5
  %214 = icmp sle i32 %212, %213
  br i1 %214, label %216, label %215

215:                                              ; preds = %211
  store i32 22, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %260

216:                                              ; preds = %211
  %217 = load i32, ptr @m, align 4, !tbaa !5
  %218 = add nsw i32 %217, 1
  store i32 %218, ptr @m, align 4, !tbaa !5
  %219 = load i32, ptr %13, align 4, !tbaa !5
  %220 = sext i32 %219 to i64
  %221 = getelementptr inbounds [8001 x i32], ptr @res, i64 0, i64 %220
  store i32 %218, ptr %221, align 4, !tbaa !5
  %222 = load i32, ptr @m, align 4, !tbaa !5
  %223 = sext i32 %222 to i64
  %224 = getelementptr inbounds [8001 x i32], ptr @val, i64 0, i64 %223
  store i32 0, ptr %224, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %225 = load i32, ptr %7, align 4, !tbaa !5
  %226 = sext i32 %225 to i64
  %227 = getelementptr inbounds [2 x [8001 x i32]], ptr @msk, i64 0, i64 %226
  %228 = load i32, ptr %13, align 4, !tbaa !5
  %229 = sext i32 %228 to i64
  %230 = getelementptr inbounds [8001 x i32], ptr %227, i64 0, i64 %229
  %231 = load i32, ptr %230, align 4, !tbaa !5
  store i32 %231, ptr %14, align 4, !tbaa !5
  %232 = load i32, ptr @ONE, align 4, !tbaa !5
  %233 = load i32, ptr @ONE2, align 4, !tbaa !5
  %234 = load i32, ptr @cur, align 4, !tbaa !5
  %235 = sext i32 %234 to i64
  %236 = getelementptr inbounds [2 x [8001 x i32]], ptr @seq, i64 0, i64 %235
  %237 = load i32, ptr %14, align 4, !tbaa !5
  %238 = sext i32 %237 to i64
  %239 = getelementptr inbounds [8001 x i32], ptr %236, i64 0, i64 %238
  %240 = load i32, ptr %239, align 4, !tbaa !5
  call void @_Z5addOpiii(i32 noundef %232, i32 noundef %233, i32 noundef %240)
  %241 = load i32, ptr %13, align 4, !tbaa !5
  %242 = sub nsw i32 %241, 1
  %243 = sext i32 %242 to i64
  %244 = getelementptr inbounds [8001 x i32], ptr @res, i64 0, i64 %243
  %245 = load i32, ptr %244, align 4, !tbaa !5
  %246 = load i32, ptr @cur, align 4, !tbaa !5
  %247 = sext i32 %246 to i64
  %248 = getelementptr inbounds [2 x [8001 x i32]], ptr @seq, i64 0, i64 %247
  %249 = load i32, ptr %14, align 4, !tbaa !5
  %250 = sext i32 %249 to i64
  %251 = getelementptr inbounds [8001 x i32], ptr %248, i64 0, i64 %250
  %252 = load i32, ptr %251, align 4, !tbaa !5
  %253 = load i32, ptr %13, align 4, !tbaa !5
  %254 = sext i32 %253 to i64
  %255 = getelementptr inbounds [8001 x i32], ptr @res, i64 0, i64 %254
  %256 = load i32, ptr %255, align 4, !tbaa !5
  call void @_Z5addOpiii(i32 noundef %245, i32 noundef %252, i32 noundef %256)
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  br label %257

257:                                              ; preds = %216
  %258 = load i32, ptr %13, align 4, !tbaa !5
  %259 = add nsw i32 %258, 1
  store i32 %259, ptr %13, align 4, !tbaa !5
  br label %211, !llvm.loop !17

260:                                              ; preds = %215
  %261 = load i32, ptr %12, align 4, !tbaa !5
  %262 = sext i32 %261 to i64
  %263 = getelementptr inbounds [8001 x i32], ptr @res, i64 0, i64 %262
  %264 = load i32, ptr %263, align 4, !tbaa !5
  %265 = load i32, ptr @ONE2, align 4, !tbaa !5
  %266 = load i32, ptr @out, align 4, !tbaa !5
  call void @_Z5addOpiii(i32 noundef %264, i32 noundef %265, i32 noundef %266)
  %267 = load i32, ptr @out, align 4, !tbaa !5
  %268 = sext i32 %267 to i64
  %269 = getelementptr inbounds [8001 x i32], ptr @val, i64 0, i64 %268
  %270 = load i32, ptr %269, align 4, !tbaa !5
  %271 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %270)
  %272 = load i32, ptr @m, align 4, !tbaa !5
  %273 = load i32, ptr @n, align 4, !tbaa !5
  %274 = sub nsw i32 %272, %273
  %275 = sub nsw i32 %274, 1
  %276 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %275)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %277 = load i32, ptr @n, align 4, !tbaa !5
  %278 = add nsw i32 %277, 2
  store i32 %278, ptr %15, align 4, !tbaa !5
  br label %279

279:                                              ; preds = %290, %260
  %280 = load i32, ptr %15, align 4, !tbaa !5
  %281 = load i32, ptr @m, align 4, !tbaa !5
  %282 = icmp sle i32 %280, %281
  br i1 %282, label %284, label %283

283:                                              ; preds = %279
  store i32 25, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  br label %293

284:                                              ; preds = %279
  %285 = load i32, ptr %15, align 4, !tbaa !5
  %286 = sext i32 %285 to i64
  %287 = getelementptr inbounds [8001 x i32], ptr @val, i64 0, i64 %286
  %288 = load i32, ptr %287, align 4, !tbaa !5
  %289 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %288)
  br label %290

290:                                              ; preds = %284
  %291 = load i32, ptr %15, align 4, !tbaa !5
  %292 = add nsw i32 %291, 1
  store i32 %292, ptr %15, align 4, !tbaa !5
  br label %279, !llvm.loop !18

293:                                              ; preds = %283
  %294 = load i32, ptr @tot, align 4, !tbaa !5
  %295 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %294)
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  store i32 1, ptr %16, align 4, !tbaa !5
  br label %296

296:                                              ; preds = %318, %293
  %297 = load i32, ptr %16, align 4, !tbaa !5
  %298 = load i32, ptr @tot, align 4, !tbaa !5
  %299 = icmp sle i32 %297, %298
  br i1 %299, label %301, label %300

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

301:                                              ; preds = %296
  %302 = load i32, ptr %16, align 4, !tbaa !5
  %303 = sext i32 %302 to i64
  %304 = getelementptr inbounds [8001 x [3 x i32]], ptr @op, i64 0, i64 %303
  %305 = getelementptr inbounds [3 x i32], ptr %304, i64 0, i64 0
  %306 = load i32, ptr %305, align 4, !tbaa !5
  %307 = load i32, ptr %16, align 4, !tbaa !5
  %308 = sext i32 %307 to i64
  %309 = getelementptr inbounds [8001 x [3 x i32]], ptr @op, i64 0, i64 %308
  %310 = getelementptr inbounds [3 x i32], ptr %309, i64 0, i64 1
  %311 = load i32, ptr %310, align 4, !tbaa !5
  %312 = load i32, ptr %16, align 4, !tbaa !5
  %313 = sext i32 %312 to i64
  %314 = getelementptr inbounds [8001 x [3 x i32]], ptr @op, i64 0, i64 %313
  %315 = getelementptr inbounds [3 x i32], ptr %314, i64 0, i64 2
  %316 = load i32, ptr %315, align 4, !tbaa !5
  %317 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %306, i32 noundef %311, i32 noundef %316)
  br label %318

318:                                              ; preds = %301
  %319 = load i32, ptr %16, align 4, !tbaa !5
  %320 = add nsw i32 %319, 1
  store i32 %320, ptr %16, align 4, !tbaa !5
  br label %296, !llvm.loop !19

321:                                              ; preds = %300
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %17, !llvm.loop !20

322:                                              ; preds = %17
  ret i32 0
}

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

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

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

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

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !11}
!18 = distinct !{!18, !11}
!19 = distinct !{!19, !11}
!20 = distinct !{!20, !11}


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

@n = external dso_local global i32, align 4
@m = external dso_local local_unnamed_addr global i32, align 4
@msk = external dso_local local_unnamed_addr global [2 x [8001 x i32]], align 16
@val = external dso_local local_unnamed_addr global [8001 x i32], align 16
@in = external dso_local local_unnamed_addr global [8001 x i32], align 16
@out = external dso_local local_unnamed_addr global i32, align 4
@ONE = external dso_local local_unnamed_addr global i32, align 4
@ONE2 = external dso_local local_unnamed_addr global i32, align 4
@ZERO = external dso_local local_unnamed_addr global i32, align 4
@not_in = external dso_local local_unnamed_addr global [8001 x i32], align 16
@seq = external dso_local local_unnamed_addr global [2 x [8001 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
@res = external dso_local local_unnamed_addr global [8001 x i32], align 16
@tot = external dso_local local_unnamed_addr global i32, align 4
@op = external dso_local local_unnamed_addr global [8001 x [3 x i32]], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@_ZZ4mainE3str = external hidden global [8001 x i8], align 16
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [10 x i8], align 1

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

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca i32, align 4
  %2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %3 = icmp eq i32 %2, 1
  br i1 %3, label %.lr.ph105, label %._crit_edge106

.loopexit:                                        ; preds = %.lr.ph103, %._crit_edge99
  %4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %5 = icmp eq i32 %4, 1
  br i1 %5, label %.lr.ph105, label %._crit_edge106, !llvm.loop !5

.lr.ph105:                                        ; preds = %0, %.loopexit
  store i32 0, ptr getelementptr inbounds (i8, ptr @msk, i64 32004), align 4, !tbaa !7
  store i32 0, ptr @msk, align 16, !tbaa !7
  %6 = load i32, ptr @n, align 4, !tbaa !7
  %.not107 = icmp eq i32 %6, 31
  br i1 %.not107, label %._crit_edge68.thread, label %.lr.ph67

._crit_edge68.thread:                             ; preds = %.lr.ph105
  store i32 0, ptr @tot, align 4, !tbaa !7
  br label %.lr.ph73.preheader

._crit_edge68:                                    ; preds = %._crit_edge
  %.pre = load i32, ptr @msk, align 16, !tbaa !7
  %.pre138 = load i32, ptr getelementptr inbounds (i8, ptr @msk, i64 32004), align 4, !tbaa !7
  %7 = icmp sge i32 %.pre, %.pre138
  %8 = zext i1 %7 to i32
  store i32 0, ptr @tot, align 4, !tbaa !7
  %.not70 = icmp slt i32 %37, 1
  br i1 %.not70, label %._crit_edge74, label %.lr.ph73.preheader

.lr.ph73.preheader:                               ; preds = %._crit_edge68.thread, %._crit_edge68
  %9 = phi i32 [ 1, %._crit_edge68.thread ], [ %8, %._crit_edge68 ]
  %10 = phi i1 [ true, %._crit_edge68.thread ], [ %7, %._crit_edge68 ]
  %11 = phi i32 [ 31, %._crit_edge68.thread ], [ %37, %._crit_edge68 ]
  %12 = zext nneg i32 %11 to i64
  %min.iters.check = icmp ult i32 %11, 8
  br i1 %min.iters.check, label %.lr.ph73.preheader152, label %vector.ph

.lr.ph73.preheader152:                            ; preds = %middle.block, %.lr.ph73.preheader
  %indvars.iv112.ph = phi i64 [ 1, %.lr.ph73.preheader ], [ %ind.end, %middle.block ]
  %.ph = phi i32 [ 0, %.lr.ph73.preheader ], [ %ind.end149, %middle.block ]
  br label %.lr.ph73

vector.ph:                                        ; preds = %.lr.ph73.preheader
  %n.vec = and i64 %12, 2147483640
  %ind.end = or disjoint i64 %n.vec, 1
  %ind.end149 = trunc nuw nsw i64 %n.vec to i32
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %13 = add nuw nsw <4 x i32> %vec.ind, <i32 1, i32 1, i32 1, i32 1>
  %14 = add <4 x i32> %vec.ind, <i32 5, i32 5, i32 5, i32 5>
  %15 = getelementptr inbounds [8001 x i32], ptr @in, i64 0, i64 %offset.idx
  %16 = getelementptr inbounds i8, ptr %15, i64 16
  store <4 x i32> %13, ptr %15, align 4, !tbaa !7
  store <4 x i32> %14, ptr %16, align 4, !tbaa !7
  %index.next = add nuw i64 %index, 8
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
  %17 = icmp eq i64 %index.next, %n.vec
  br i1 %17, label %middle.block, label %vector.body, !llvm.loop !11

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %12
  br i1 %cmp.n, label %._crit_edge74, label %.lr.ph73.preheader152

.lr.ph67:                                         ; preds = %.lr.ph105, %._crit_edge
  %.04865 = phi i32 [ %36, %._crit_edge ], [ 0, %.lr.ph105 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @_ZZ4mainE3str)
  %19 = load i32, ptr @n, align 4, !tbaa !7
  %20 = icmp sgt i32 %19, 0
  br i1 %20, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.lr.ph67
  %wide.trip.count = zext nneg i32 %19 to i64
  %xtraiter = and i64 %wide.trip.count, 3
  %21 = icmp ult i32 %19, 4
  br i1 %21, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.preheader.new

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

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph, %.lr.ph.preheader
  %.lcssa.ph = phi i32 [ poison, %.lr.ph.preheader ], [ %61, %.lr.ph ]
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next.3, %.lr.ph ]
  %.05464.unr = phi i32 [ 0, %.lr.ph.preheader ], [ %61, %.lr.ph ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph.epil
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.lr.ph.epil ], [ %indvars.iv.unr, %._crit_edge.loopexit.unr-lcssa ]
  %.05464.epil = phi i32 [ %27, %.lr.ph.epil ], [ %.05464.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph.epil ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %22 = shl i32 %.05464.epil, 1
  %23 = getelementptr inbounds [8001 x i8], ptr @_ZZ4mainE3str, i64 0, i64 %indvars.iv.epil
  %24 = load i8, ptr %23, align 1, !tbaa !14
  %25 = icmp eq i8 %24, 49
  %26 = zext i1 %25 to i32
  %27 = or disjoint i32 %22, %26
  %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.lr.ph.epil, !llvm.loop !15

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph.epil, %.lr.ph67
  %.054.lcssa = phi i32 [ 0, %.lr.ph67 ], [ %.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %27, %.lr.ph.epil ]
  %28 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %29 = load i32, ptr %1, align 4, !tbaa !7
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [2 x [8001 x i32]], ptr @msk, i64 0, i64 %30
  %32 = load i32, ptr %31, align 4, !tbaa !7
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr %31, align 4, !tbaa !7
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [2 x [8001 x i32]], ptr @msk, i64 0, i64 %30, i64 %34
  store i32 %.054.lcssa, ptr %35, align 4, !tbaa !7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  %36 = add nuw nsw i32 %.04865, 1
  %37 = load i32, ptr @n, align 4, !tbaa !7
  %38 = shl nuw i32 1, %37
  %39 = icmp slt i32 %36, %38
  br i1 %39, label %.lr.ph67, label %._crit_edge68, !llvm.loop !17

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader.new ], [ %indvars.iv.next.3, %.lr.ph ]
  %.05464 = phi i32 [ 0, %.lr.ph.preheader.new ], [ %61, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.3, %.lr.ph ]
  %40 = getelementptr inbounds [8001 x i8], ptr @_ZZ4mainE3str, i64 0, i64 %indvars.iv
  %41 = load i8, ptr %40, align 4, !tbaa !14
  %42 = icmp eq i8 %41, 49
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %43 = shl i32 %.05464, 2
  %44 = select i1 %42, i32 2, i32 0
  %45 = or disjoint i32 %43, %44
  %46 = getelementptr inbounds [8001 x i8], ptr @_ZZ4mainE3str, i64 0, i64 %indvars.iv.next
  %47 = load i8, ptr %46, align 1, !tbaa !14
  %48 = icmp eq i8 %47, 49
  %49 = zext i1 %48 to i32
  %50 = or disjoint i32 %45, %49
  %indvars.iv.next.1 = or disjoint i64 %indvars.iv, 2
  %51 = getelementptr inbounds [8001 x i8], ptr @_ZZ4mainE3str, i64 0, i64 %indvars.iv.next.1
  %52 = load i8, ptr %51, align 2, !tbaa !14
  %53 = icmp eq i8 %52, 49
  %indvars.iv.next.2 = or disjoint i64 %indvars.iv, 3
  %54 = shl i32 %50, 2
  %55 = select i1 %53, i32 2, i32 0
  %56 = or disjoint i32 %54, %55
  %57 = getelementptr inbounds [8001 x i8], ptr @_ZZ4mainE3str, i64 0, i64 %indvars.iv.next.2
  %58 = load i8, ptr %57, align 1, !tbaa !14
  %59 = icmp eq i8 %58, 49
  %60 = zext i1 %59 to i32
  %61 = or disjoint i32 %56, %60
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph, !llvm.loop !18

._crit_edge74:                                    ; preds = %.lr.ph73, %middle.block, %._crit_edge68
  %.not70144 = phi i1 [ true, %._crit_edge68 ], [ false, %middle.block ], [ false, %.lr.ph73 ]
  %62 = phi i32 [ %8, %._crit_edge68 ], [ %9, %middle.block ], [ %9, %.lr.ph73 ]
  %63 = phi i1 [ %7, %._crit_edge68 ], [ %10, %middle.block ], [ %10, %.lr.ph73 ]
  %64 = phi i32 [ %37, %._crit_edge68 ], [ %11, %middle.block ], [ %11, %.lr.ph73 ]
  %65 = phi i32 [ 0, %._crit_edge68 ], [ %11, %middle.block ], [ %11, %.lr.ph73 ]
  %66 = add nuw nsw i32 %65, 1
  store i32 %66, ptr @out, align 4, !tbaa !7
  %67 = zext nneg i32 %66 to i64
  %68 = getelementptr inbounds [8001 x i32], ptr @val, i64 0, i64 %67
  store i32 %62, ptr %68, align 4, !tbaa !7
  %69 = add nuw nsw i32 %65, 2
  store i32 %69, ptr @ONE, align 4, !tbaa !7
  %70 = zext nneg i32 %69 to i64
  %71 = getelementptr inbounds [8001 x i32], ptr @val, i64 0, i64 %70
  store i32 1, ptr %71, align 4, !tbaa !7
  %72 = add nuw nsw i32 %65, 3
  store i32 %72, ptr @ONE2, align 4, !tbaa !7
  %73 = zext nneg i32 %72 to i64
  %74 = getelementptr inbounds [8001 x i32], ptr @val, i64 0, i64 %73
  store i32 1, ptr %74, align 4, !tbaa !7
  %75 = add nuw nsw i32 %65, 4
  store i32 %75, ptr @m, align 4, !tbaa !7
  store i32 %75, ptr @ZERO, align 4, !tbaa !7
  %76 = zext nneg i32 %75 to i64
  %77 = getelementptr inbounds [8001 x i32], ptr @val, i64 0, i64 %76
  store i32 0, ptr %77, align 4, !tbaa !7
  br i1 %.not70144, label %._crit_edge80, label %.lr.ph79

.lr.ph73:                                         ; preds = %.lr.ph73.preheader152, %.lr.ph73
  %indvars.iv112 = phi i64 [ %indvars.iv.next113, %.lr.ph73 ], [ %indvars.iv112.ph, %.lr.ph73.preheader152 ]
  %78 = phi i32 [ %79, %.lr.ph73 ], [ %.ph, %.lr.ph73.preheader152 ]
  %79 = add nuw nsw i32 %78, 1
  %80 = getelementptr inbounds [8001 x i32], ptr @in, i64 0, i64 %indvars.iv112
  store i32 %79, ptr %80, align 4, !tbaa !7
  %indvars.iv.next113 = add nuw nsw i64 %indvars.iv112, 1
  %exitcond115.not = icmp eq i32 %79, %11
  br i1 %exitcond115.not, label %._crit_edge74, label %.lr.ph73, !llvm.loop !19

._crit_edge80.loopexit:                           ; preds = %.lr.ph79
  %.pre139 = load i32, ptr @ONE, align 4, !tbaa !7
  br label %._crit_edge80

._crit_edge80:                                    ; preds = %._crit_edge80.loopexit, %._crit_edge74
  %81 = phi i32 [ %94, %._crit_edge80.loopexit ], [ %64, %._crit_edge74 ]
  %82 = phi i32 [ %.pre139, %._crit_edge80.loopexit ], [ %69, %._crit_edge74 ]
  %83 = load i32, ptr @cur, align 4, !tbaa !7
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [2 x [8001 x i32]], ptr @seq, i64 0, i64 %84
  store i32 %82, ptr %85, align 4, !tbaa !7
  %.not5885 = icmp slt i32 %81, 1
  br i1 %.not5885, label %._crit_edge89, label %.lr.ph88

.lr.ph79:                                         ; preds = %._crit_edge74, %.lr.ph79
  %indvars.iv116 = phi i64 [ %indvars.iv.next117, %.lr.ph79 ], [ 1, %._crit_edge74 ]
  %86 = load i32, ptr @m, align 4, !tbaa !7
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr @m, align 4, !tbaa !7
  %88 = getelementptr inbounds [8001 x i32], ptr @not_in, i64 0, i64 %indvars.iv116
  store i32 %87, ptr %88, align 4, !tbaa !7
  %89 = sext i32 %87 to i64
  %90 = getelementptr inbounds [8001 x i32], ptr @val, i64 0, i64 %89
  store i32 1, ptr %90, align 4, !tbaa !7
  %91 = getelementptr inbounds [8001 x i32], ptr @in, i64 0, i64 %indvars.iv116
  %92 = load i32, ptr %91, align 4, !tbaa !7
  %93 = load i32, ptr @ONE, align 4, !tbaa !7
  call void @_Z5addOpiii(i32 noundef %92, i32 noundef %93, i32 noundef %87)
  %indvars.iv.next117 = add nuw nsw i64 %indvars.iv116, 1
  %94 = load i32, ptr @n, align 4, !tbaa !7
  %95 = sext i32 %94 to i64
  %.not57.not = icmp slt i64 %indvars.iv116, %95
  br i1 %.not57.not, label %.lr.ph79, label %._crit_edge80.loopexit, !llvm.loop !20

._crit_edge89.loopexit:                           ; preds = %._crit_edge84
  %.pre141 = load i32, ptr @ONE, align 4, !tbaa !7
  br label %._crit_edge89

._crit_edge89:                                    ; preds = %._crit_edge89.loopexit, %._crit_edge80
  %96 = phi i32 [ %.pre141, %._crit_edge89.loopexit ], [ %82, %._crit_edge80 ]
  store i32 %96, ptr @res, align 16, !tbaa !7
  %97 = zext i1 %63 to i64
  %98 = getelementptr inbounds [2 x [8001 x i32]], ptr @msk, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !7
  %.not5990 = icmp slt i32 %99, 1
  br i1 %.not5990, label %._crit_edge94, label %.lr.ph93.preheader

.lr.ph93.preheader:                               ; preds = %._crit_edge89
  %100 = add nuw i32 %99, 1
  %wide.trip.count130 = zext i32 %100 to i64
  br label %.lr.ph93

.lr.ph88:                                         ; preds = %._crit_edge80, %._crit_edge84
  %101 = phi i32 [ %110, %._crit_edge84 ], [ %81, %._crit_edge80 ]
  %indvars.iv124 = phi i64 [ %indvars.iv.next125, %._crit_edge84 ], [ 1, %._crit_edge80 ]
  %102 = load i32, ptr @pre, align 4, !tbaa !7
  %103 = xor i32 %102, 1
  store i32 %103, ptr @pre, align 4, !tbaa !7
  %104 = load i32, ptr @cur, align 4, !tbaa !7
  %105 = xor i32 %104, 1
  store i32 %105, ptr @cur, align 4, !tbaa !7
  %.not = icmp eq i64 %indvars.iv124, 31
  br i1 %.not, label %._crit_edge84, label %.lr.ph83

.lr.ph83:                                         ; preds = %.lr.ph88
  %106 = trunc nuw nsw i64 %indvars.iv124 to i32
  %107 = shl nuw i32 1, %106
  %108 = getelementptr inbounds [8001 x i32], ptr @in, i64 0, i64 %indvars.iv124
  %109 = getelementptr inbounds [8001 x i32], ptr @not_in, i64 0, i64 %indvars.iv124
  %smax = call i32 @llvm.smax.i32(i32 %107, i32 1)
  %wide.trip.count122 = zext nneg i32 %smax to i64
  br label %112

._crit_edge84.loopexit:                           ; preds = %112
  %.pre140 = load i32, ptr @n, align 4, !tbaa !7
  br label %._crit_edge84

._crit_edge84:                                    ; preds = %._crit_edge84.loopexit, %.lr.ph88
  %110 = phi i32 [ %.pre140, %._crit_edge84.loopexit ], [ %101, %.lr.ph88 ]
  %indvars.iv.next125 = add nuw nsw i64 %indvars.iv124, 1
  %111 = sext i32 %110 to i64
  %.not58.not = icmp slt i64 %indvars.iv124, %111
  br i1 %.not58.not, label %.lr.ph88, label %._crit_edge89.loopexit, !llvm.loop !21

112:                                              ; preds = %.lr.ph83, %112
  %indvars.iv119 = phi i64 [ 0, %.lr.ph83 ], [ %indvars.iv.next120, %112 ]
  %113 = load i32, ptr @m, align 4, !tbaa !7
  %114 = add nsw i32 %113, 1
  store i32 %114, ptr @m, align 4, !tbaa !7
  %115 = load i32, ptr @cur, align 4, !tbaa !7
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [2 x [8001 x i32]], ptr @seq, i64 0, i64 %116, i64 %indvars.iv119
  store i32 %114, ptr %117, align 4, !tbaa !7
  %118 = sext i32 %114 to i64
  %119 = getelementptr inbounds [8001 x i32], ptr @val, i64 0, i64 %118
  store i32 0, ptr %119, align 4, !tbaa !7
  %120 = load i32, ptr @pre, align 4, !tbaa !7
  %121 = sext i32 %120 to i64
  %122 = lshr i64 %indvars.iv119, 1
  %123 = and i64 %122, 2147483647
  %124 = getelementptr inbounds [2 x [8001 x i32]], ptr @seq, i64 0, i64 %121, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !7
  %126 = and i64 %indvars.iv119, 1
  %.not62 = icmp eq i64 %126, 0
  %.in = select i1 %.not62, ptr %109, ptr %108
  %127 = load i32, ptr %.in, align 4, !tbaa !7
  call void @_Z5addOpiii(i32 noundef %125, i32 noundef %127, i32 noundef %114)
  %indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1
  %exitcond123.not = icmp eq i64 %indvars.iv.next120, %wide.trip.count122
  br i1 %exitcond123.not, label %._crit_edge84.loopexit, label %112, !llvm.loop !22

._crit_edge94:                                    ; preds = %.lr.ph93, %._crit_edge89
  %128 = sext i32 %99 to i64
  %129 = getelementptr inbounds [8001 x i32], ptr @res, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !7
  %131 = load i32, ptr @ONE2, align 4, !tbaa !7
  %132 = load i32, ptr @out, align 4, !tbaa !7
  call void @_Z5addOpiii(i32 noundef %130, i32 noundef %131, i32 noundef %132)
  %133 = load i32, ptr @out, align 4, !tbaa !7
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [8001 x i32], ptr @val, i64 0, i64 %134
  %136 = load i32, ptr %135, align 4, !tbaa !7
  %137 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %136)
  %138 = load i32, ptr @m, align 4, !tbaa !7
  %139 = load i32, ptr @n, align 4, !tbaa !7
  %140 = xor i32 %139, -1
  %141 = add i32 %138, %140
  %142 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %141)
  %143 = load i32, ptr @n, align 4, !tbaa !7
  %144 = add nsw i32 %143, 2
  %145 = load i32, ptr @m, align 4, !tbaa !7
  %.not6095 = icmp sgt i32 %144, %145
  br i1 %.not6095, label %._crit_edge99, label %.lr.ph98.preheader

.lr.ph98.preheader:                               ; preds = %._crit_edge94
  %146 = sext i32 %143 to i64
  %147 = add nsw i64 %146, 2
  br label %.lr.ph98

.lr.ph93:                                         ; preds = %.lr.ph93.preheader, %.lr.ph93
  %indvars.iv127 = phi i64 [ 1, %.lr.ph93.preheader ], [ %indvars.iv.next128, %.lr.ph93 ]
  %148 = load i32, ptr @m, align 4, !tbaa !7
  %149 = add nsw i32 %148, 1
  store i32 %149, ptr @m, align 4, !tbaa !7
  %150 = getelementptr inbounds [8001 x i32], ptr @res, i64 0, i64 %indvars.iv127
  store i32 %149, ptr %150, align 4, !tbaa !7
  %151 = sext i32 %149 to i64
  %152 = getelementptr inbounds [8001 x i32], ptr @val, i64 0, i64 %151
  store i32 0, ptr %152, align 4, !tbaa !7
  %153 = getelementptr inbounds [2 x [8001 x i32]], ptr @msk, i64 0, i64 %97, i64 %indvars.iv127
  %154 = load i32, ptr %153, align 4, !tbaa !7
  %155 = load i32, ptr @ONE, align 4, !tbaa !7
  %156 = load i32, ptr @ONE2, align 4, !tbaa !7
  %157 = load i32, ptr @cur, align 4, !tbaa !7
  %158 = sext i32 %157 to i64
  %159 = sext i32 %154 to i64
  %160 = getelementptr inbounds [2 x [8001 x i32]], ptr @seq, i64 0, i64 %158, i64 %159
  %161 = load i32, ptr %160, align 4, !tbaa !7
  call void @_Z5addOpiii(i32 noundef %155, i32 noundef %156, i32 noundef %161)
  %162 = add nsw i64 %indvars.iv127, -1
  %163 = getelementptr inbounds [8001 x i32], ptr @res, i64 0, i64 %162
  %164 = load i32, ptr %163, align 4, !tbaa !7
  %165 = load i32, ptr @cur, align 4, !tbaa !7
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [2 x [8001 x i32]], ptr @seq, i64 0, i64 %166, i64 %159
  %168 = load i32, ptr %167, align 4, !tbaa !7
  %169 = load i32, ptr %150, align 4, !tbaa !7
  call void @_Z5addOpiii(i32 noundef %164, i32 noundef %168, i32 noundef %169)
  %indvars.iv.next128 = add nuw nsw i64 %indvars.iv127, 1
  %exitcond131.not = icmp eq i64 %indvars.iv.next128, %wide.trip.count130
  br i1 %exitcond131.not, label %._crit_edge94, label %.lr.ph93, !llvm.loop !23

._crit_edge99:                                    ; preds = %.lr.ph98, %._crit_edge94
  %170 = load i32, ptr @tot, align 4, !tbaa !7
  %171 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %170)
  %172 = load i32, ptr @tot, align 4, !tbaa !7
  %.not61100 = icmp slt i32 %172, 1
  br i1 %.not61100, label %.loopexit, label %.lr.ph103

.lr.ph98:                                         ; preds = %.lr.ph98.preheader, %.lr.ph98
  %indvars.iv132 = phi i64 [ %147, %.lr.ph98.preheader ], [ %indvars.iv.next133, %.lr.ph98 ]
  %173 = getelementptr inbounds [8001 x i32], ptr @val, i64 0, i64 %indvars.iv132
  %174 = load i32, ptr %173, align 4, !tbaa !7
  %175 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %174)
  %indvars.iv.next133 = add nsw i64 %indvars.iv132, 1
  %176 = load i32, ptr @m, align 4, !tbaa !7
  %177 = sext i32 %176 to i64
  %.not60.not = icmp slt i64 %indvars.iv132, %177
  br i1 %.not60.not, label %.lr.ph98, label %._crit_edge99, !llvm.loop !24

.lr.ph103:                                        ; preds = %._crit_edge99, %.lr.ph103
  %indvars.iv135 = phi i64 [ %indvars.iv.next136, %.lr.ph103 ], [ 1, %._crit_edge99 ]
  %178 = getelementptr inbounds [8001 x [3 x i32]], ptr @op, i64 0, i64 %indvars.iv135
  %179 = load i32, ptr %178, align 4, !tbaa !7
  %180 = getelementptr inbounds i8, ptr %178, i64 4
  %181 = load i32, ptr %180, align 4, !tbaa !7
  %182 = getelementptr inbounds i8, ptr %178, i64 8
  %183 = load i32, ptr %182, align 4, !tbaa !7
  %184 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %179, i32 noundef %181, i32 noundef %183)
  %indvars.iv.next136 = add nuw nsw i64 %indvars.iv135, 1
  %185 = load i32, ptr @tot, align 4, !tbaa !7
  %186 = sext i32 %185 to i64
  %.not61.not = icmp slt i64 %indvars.iv135, %186
  br i1 %.not61.not, label %.lr.ph103, label %.loopexit, !llvm.loop !25

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

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3

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

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

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress norecurse 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 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = distinct !{!11, !6, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = !{!9, !9, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.unroll.disable"}
!17 = distinct !{!17, !6}
!18 = distinct !{!18, !6}
!19 = distinct !{!19, !6, !13, !12}
!20 = distinct !{!20, !6}
!21 = distinct !{!21, !6}
!22 = distinct !{!22, !6}
!23 = distinct !{!23, !6}
!24 = distinct !{!24, !6}
!25 = distinct !{!25, !6}


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