; LLVM IR from tangjz/acm-icpc :: 51nod (1324)

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

@idx = external dso_local global [65 x i32], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@f = external dso_local global [101 x [15361 x i32]], align 16
@ans = external dso_local global i32, align 4
@g = external dso_local global [7 x [7 x i32]], align 16
@val = external dso_local global [7 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca [7 x i32], align 16
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca [7 x i8], align 1
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca [7 x i32], align 16
  %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
  store i32 0, ptr %1, align 4
  call void @llvm.memset.p0.i64(ptr align 16 @idx, i8 -1, i64 260, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %72, %0
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = icmp slt i32 %25, 4
  br i1 %26, label %28, label %27

27:                                               ; preds = %24
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %75

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

29:                                               ; preds = %68, %28
  %30 = load i32, ptr %4, align 4, !tbaa !5
  %31 = icmp slt i32 %30, 4
  br i1 %31, label %33, label %32

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

33:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %34

34:                                               ; preds = %64, %33
  %35 = load i32, ptr %5, align 4, !tbaa !5
  %36 = icmp slt i32 %35, 4
  br i1 %36, label %38, label %37

37:                                               ; preds = %34
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %67

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

39:                                               ; preds = %60, %38
  %40 = load i32, ptr %6, align 4, !tbaa !5
  %41 = icmp slt i32 %40, 4
  br i1 %41, label %43, label %42

42:                                               ; preds = %39
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %63

43:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 28, ptr %7) #6
  %44 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %44, ptr %7, align 4, !tbaa !5
  %45 = getelementptr inbounds i32, ptr %7, i64 1
  %46 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %46, ptr %45, align 4, !tbaa !5
  %47 = getelementptr inbounds i32, ptr %7, i64 2
  %48 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %48, ptr %47, align 4, !tbaa !5
  %49 = getelementptr inbounds i32, ptr %7, i64 3
  %50 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %50, ptr %49, align 4, !tbaa !5
  %51 = getelementptr inbounds i32, ptr %7, i64 4
  %52 = getelementptr inbounds i32, ptr %7, i64 7
  br label %53

53:                                               ; preds = %53, %43
  %54 = phi ptr [ %51, %43 ], [ %55, %53 ]
  store i32 0, ptr %54, align 4, !tbaa !5
  %55 = getelementptr inbounds i32, ptr %54, i64 1
  %56 = icmp eq ptr %55, %52
  br i1 %56, label %57, label %53

57:                                               ; preds = %53
  %58 = getelementptr inbounds [7 x i32], ptr %7, i64 0, i64 0
  %59 = call noundef i32 @_Z14state_to_indexPi(ptr noundef %58)
  call void @llvm.lifetime.end.p0(i64 28, ptr %7) #6
  br label %60

60:                                               ; preds = %57
  %61 = load i32, ptr %6, align 4, !tbaa !5
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %6, align 4, !tbaa !5
  br label %39, !llvm.loop !9

63:                                               ; preds = %42
  br label %64

64:                                               ; preds = %63
  %65 = load i32, ptr %5, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %5, align 4, !tbaa !5
  br label %34, !llvm.loop !11

67:                                               ; preds = %37
  br label %68

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

71:                                               ; preds = %32
  br label %72

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

75:                                               ; preds = %27
  %76 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  store i32 1, ptr getelementptr inbounds ([15361 x i32], ptr @f, i64 0, i64 3), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %77

77:                                               ; preds = %427, %75
  %78 = load i32, ptr %8, align 4, !tbaa !5
  %79 = load i32, ptr @n, align 4, !tbaa !5
  %80 = icmp slt i32 %78, %79
  br i1 %80, label %82, label %81

81:                                               ; preds = %77
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %430

82:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %83

83:                                               ; preds = %423, %82
  %84 = load i32, ptr %9, align 4, !tbaa !5
  %85 = icmp slt i32 %84, 15361
  br i1 %85, label %87, label %86

86:                                               ; preds = %83
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %426

87:                                               ; preds = %83
  %88 = load i32, ptr %8, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [101 x [15361 x i32]], ptr @f, i64 0, i64 %89
  %91 = load i32, ptr %9, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [15361 x i32], ptr %90, i64 0, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = icmp ne i32 %94, 0
  br i1 %95, label %97, label %96

96:                                               ; preds = %87
  br label %423

97:                                               ; preds = %87
  %98 = load i32, ptr %9, align 4, !tbaa !5
  call void @_Z9get_statei(i32 noundef %98)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 7, ptr %12) #6
  call void @llvm.memset.p0.i64(ptr align 1 %12, i8 0, i64 7, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %99

99:                                               ; preds = %142, %97
  %100 = load i32, ptr %13, align 4, !tbaa !5
  %101 = icmp slt i32 %100, 4
  br i1 %101, label %103, label %102

102:                                              ; preds = %99
  store i32 20, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %145

103:                                              ; preds = %99
  %104 = load i32, ptr %8, align 4, !tbaa !5
  %105 = load i32, ptr %13, align 4, !tbaa !5
  %106 = ashr i32 %105, 1
  %107 = icmp ne i32 %106, 0
  %108 = xor i1 %107, true
  %109 = zext i1 %108 to i32
  %110 = icmp sle i32 %104, %109
  br i1 %110, label %111, label %129

111:                                              ; preds = %103
  %112 = load i32, ptr %13, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [7 x i32], ptr @val, i64 0, i64 %113
  %115 = load i32, ptr %114, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [7 x i8], ptr %12, i64 0, i64 %116
  %118 = load i8, ptr %117, align 1, !tbaa !14, !range !16, !noundef !17
  %119 = trunc i8 %118 to i1
  br i1 %119, label %129, label %120

120:                                              ; preds = %111
  %121 = load i32, ptr %13, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [7 x i32], ptr @val, i64 0, i64 %122
  %124 = load i32, ptr %123, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [7 x i8], ptr %12, i64 0, i64 %125
  store i8 1, ptr %126, align 1, !tbaa !14
  %127 = load i32, ptr %11, align 4, !tbaa !5
  %128 = add nsw i32 %127, 1
  store i32 %128, ptr %11, align 4, !tbaa !5
  br label %129

129:                                              ; preds = %120, %111, %103
  br label %130

130:                                              ; preds = %138, %129
  %131 = load i32, ptr %10, align 4, !tbaa !5
  %132 = load i32, ptr %13, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [7 x i32], ptr @val, i64 0, i64 %133
  %135 = load i32, ptr %134, align 4, !tbaa !5
  %136 = icmp sle i32 %131, %135
  br i1 %136, label %137, label %141

137:                                              ; preds = %130
  br label %138

138:                                              ; preds = %137
  %139 = load i32, ptr %10, align 4, !tbaa !5
  %140 = add nsw i32 %139, 1
  store i32 %140, ptr %10, align 4, !tbaa !5
  br label %130, !llvm.loop !18

141:                                              ; preds = %130
  br label %142

142:                                              ; preds = %141
  %143 = load i32, ptr %13, align 4, !tbaa !5
  %144 = add nsw i32 %143, 1
  store i32 %144, ptr %13, align 4, !tbaa !5
  br label %99, !llvm.loop !19

145:                                              ; preds = %102
  store i32 0, ptr getelementptr inbounds ([7 x i32], ptr @val, i64 0, i64 4), align 16, !tbaa !5
  br label %146

146:                                              ; preds = %419, %145
  %147 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @val, i64 0, i64 4), align 16, !tbaa !5
  %148 = load i32, ptr %10, align 4, !tbaa !5
  %149 = icmp sle i32 %147, %148
  br i1 %149, label %150, label %156

150:                                              ; preds = %146
  %151 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @val, i64 0, i64 4), align 16, !tbaa !5
  %152 = load i32, ptr @m, align 4, !tbaa !5
  %153 = load i32, ptr %11, align 4, !tbaa !5
  %154 = add nsw i32 %152, %153
  %155 = icmp slt i32 %151, %154
  br label %156

156:                                              ; preds = %150, %146
  %157 = phi i1 [ false, %146 ], [ %155, %150 ]
  br i1 %157, label %158, label %422

158:                                              ; preds = %156
  %159 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @val, i64 0, i64 4), align 16, !tbaa !5
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [7 x i8], ptr %12, i64 0, i64 %160
  %162 = load i8, ptr %161, align 1, !tbaa !14, !range !16, !noundef !17
  %163 = trunc i8 %162 to i1
  br i1 %163, label %164, label %165

164:                                              ; preds = %158
  br label %419

165:                                              ; preds = %158
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %166 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @val, i64 0, i64 4), align 16, !tbaa !5
  %167 = load i32, ptr %10, align 4, !tbaa !5
  %168 = icmp eq i32 %166, %167
  %169 = zext i1 %168 to i32
  store i32 %169, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %170 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @val, i64 0, i64 4), align 16, !tbaa !5
  %171 = load i32, ptr %10, align 4, !tbaa !5
  %172 = icmp slt i32 %170, %171
  br i1 %172, label %173, label %182

173:                                              ; preds = %165
  %174 = load i32, ptr %8, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [101 x [15361 x i32]], ptr @f, i64 0, i64 %175
  %177 = load i32, ptr %9, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [15361 x i32], ptr %176, i64 0, i64 %178
  %180 = load i32, ptr %179, align 4, !tbaa !5
  %181 = sext i32 %180 to i64
  br label %199

182:                                              ; preds = %165
  %183 = load i32, ptr %8, align 4, !tbaa !5
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [101 x [15361 x i32]], ptr @f, i64 0, i64 %184
  %186 = load i32, ptr %9, align 4, !tbaa !5
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [15361 x i32], ptr %185, i64 0, i64 %187
  %189 = load i32, ptr %188, align 4, !tbaa !5
  %190 = sext i32 %189 to i64
  %191 = load i32, ptr @m, align 4, !tbaa !5
  %192 = load i32, ptr %11, align 4, !tbaa !5
  %193 = add nsw i32 %191, %192
  %194 = load i32, ptr %10, align 4, !tbaa !5
  %195 = sub nsw i32 %193, %194
  %196 = sext i32 %195 to i64
  %197 = mul nsw i64 %190, %196
  %198 = srem i64 %197, 1000000009
  br label %199

199:                                              ; preds = %182, %173
  %200 = phi i64 [ %181, %173 ], [ %198, %182 ]
  %201 = trunc i64 %200 to i32
  store i32 %201, ptr %15, align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds ([7 x i32], ptr @val, i64 0, i64 5), align 4, !tbaa !5
  br label %202

202:                                              ; preds = %415, %199
  %203 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @val, i64 0, i64 5), align 4, !tbaa !5
  %204 = load i32, ptr %10, align 4, !tbaa !5
  %205 = load i32, ptr %14, align 4, !tbaa !5
  %206 = add nsw i32 %204, %205
  %207 = icmp sle i32 %203, %206
  br i1 %207, label %208, label %214

208:                                              ; preds = %202
  %209 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @val, i64 0, i64 5), align 4, !tbaa !5
  %210 = load i32, ptr @m, align 4, !tbaa !5
  %211 = load i32, ptr %11, align 4, !tbaa !5
  %212 = add nsw i32 %210, %211
  %213 = icmp slt i32 %209, %212
  br label %214

214:                                              ; preds = %208, %202
  %215 = phi i1 [ false, %202 ], [ %213, %208 ]
  br i1 %215, label %216, label %418

216:                                              ; preds = %214
  %217 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @val, i64 0, i64 5), align 4, !tbaa !5
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds [7 x i8], ptr %12, i64 0, i64 %218
  %220 = load i8, ptr %219, align 1, !tbaa !14, !range !16, !noundef !17
  %221 = trunc i8 %220 to i1
  br i1 %221, label %222, label %223

222:                                              ; preds = %216
  br label %415

223:                                              ; preds = %216
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  %224 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @val, i64 0, i64 5), align 4, !tbaa !5
  %225 = load i32, ptr %10, align 4, !tbaa !5
  %226 = load i32, ptr %14, align 4, !tbaa !5
  %227 = add nsw i32 %225, %226
  %228 = icmp slt i32 %224, %227
  br i1 %228, label %229, label %232

229:                                              ; preds = %223
  %230 = load i32, ptr %15, align 4, !tbaa !5
  %231 = sext i32 %230 to i64
  br label %245

232:                                              ; preds = %223
  %233 = load i32, ptr %15, align 4, !tbaa !5
  %234 = sext i32 %233 to i64
  %235 = load i32, ptr @m, align 4, !tbaa !5
  %236 = load i32, ptr %11, align 4, !tbaa !5
  %237 = add nsw i32 %235, %236
  %238 = load i32, ptr %10, align 4, !tbaa !5
  %239 = sub nsw i32 %237, %238
  %240 = load i32, ptr %14, align 4, !tbaa !5
  %241 = sub nsw i32 %239, %240
  %242 = sext i32 %241 to i64
  %243 = mul nsw i64 %234, %242
  %244 = srem i64 %243, 1000000009
  br label %245

245:                                              ; preds = %232, %229
  %246 = phi i64 [ %231, %229 ], [ %244, %232 ]
  %247 = trunc i64 %246 to i32
  store i32 %247, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 28, ptr %17) #6
  %248 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @val, i64 0, i64 2), align 8, !tbaa !5
  store i32 %248, ptr %17, align 4, !tbaa !5
  %249 = getelementptr inbounds i32, ptr %17, i64 1
  %250 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @val, i64 0, i64 3), align 4, !tbaa !5
  store i32 %250, ptr %249, align 4, !tbaa !5
  %251 = getelementptr inbounds i32, ptr %17, i64 2
  %252 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @val, i64 0, i64 4), align 16, !tbaa !5
  store i32 %252, ptr %251, align 4, !tbaa !5
  %253 = getelementptr inbounds i32, ptr %17, i64 3
  %254 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @val, i64 0, i64 5), align 4, !tbaa !5
  store i32 %254, ptr %253, align 4, !tbaa !5
  %255 = getelementptr inbounds i32, ptr %17, i64 4
  %256 = getelementptr inbounds i32, ptr %17, i64 7
  br label %257

257:                                              ; preds = %257, %245
  %258 = phi ptr [ %255, %245 ], [ %259, %257 ]
  store i32 0, ptr %258, align 4, !tbaa !5
  %259 = getelementptr inbounds i32, ptr %258, i64 1
  %260 = icmp eq ptr %259, %256
  br i1 %260, label %261, label %257

261:                                              ; preds = %257
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %262 = getelementptr inbounds [7 x i32], ptr %17, i64 0, i64 0
  %263 = call noundef i32 @_Z14state_to_indexPi(ptr noundef %262)
  store i32 %263, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  store i32 1, ptr %19, align 4, !tbaa !5
  br label %264

264:                                              ; preds = %327, %261
  %265 = load i32, ptr %19, align 4, !tbaa !5
  %266 = icmp slt i32 %265, 3
  br i1 %266, label %268, label %267

267:                                              ; preds = %264
  store i32 32, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %330

268:                                              ; preds = %264
  %269 = load i32, ptr %19, align 4, !tbaa !5
  %270 = sext i32 %269 to i64
  %271 = getelementptr inbounds [7 x [7 x i32]], ptr @g, i64 0, i64 %270
  %272 = getelementptr inbounds [7 x i32], ptr %271, i64 0, i64 3
  store i32 0, ptr %272, align 4, !tbaa !5
  %273 = load i32, ptr %19, align 4, !tbaa !5
  %274 = sub nsw i32 %273, 1
  %275 = shl i32 %274, 1
  %276 = sext i32 %275 to i64
  %277 = getelementptr inbounds [7 x i32], ptr @val, i64 0, i64 %276
  %278 = load i32, ptr %277, align 4, !tbaa !5
  %279 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @val, i64 0, i64 5), align 4, !tbaa !5
  %280 = icmp eq i32 %278, %279
  br i1 %280, label %281, label %292

281:                                              ; preds = %268
  %282 = load i32, ptr %19, align 4, !tbaa !5
  %283 = sub nsw i32 %282, 1
  %284 = sext i32 %283 to i64
  %285 = getelementptr inbounds [7 x [7 x i32]], ptr @g, i64 0, i64 %284
  %286 = getelementptr inbounds [7 x i32], ptr %285, i64 0, i64 2
  %287 = load i32, ptr %286, align 4, !tbaa !5
  %288 = load i32, ptr %19, align 4, !tbaa !5
  %289 = sext i32 %288 to i64
  %290 = getelementptr inbounds [7 x [7 x i32]], ptr @g, i64 0, i64 %289
  %291 = getelementptr inbounds [7 x i32], ptr %290, i64 0, i64 3
  store i32 %287, ptr %291, align 4, !tbaa !5
  br label %318

292:                                              ; preds = %268
  %293 = load i32, ptr %19, align 4, !tbaa !5
  %294 = sext i32 %293 to i64
  %295 = getelementptr inbounds [7 x [7 x i32]], ptr @g, i64 0, i64 %294
  %296 = getelementptr inbounds [7 x i32], ptr %295, i64 0, i64 3
  %297 = load i32, ptr %19, align 4, !tbaa !5
  %298 = sub nsw i32 %297, 1
  %299 = sext i32 %298 to i64
  %300 = getelementptr inbounds [7 x [7 x i32]], ptr @g, i64 0, i64 %299
  %301 = getelementptr inbounds [7 x i32], ptr %300, i64 0, i64 3
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  %302 = load i32, ptr %19, align 4, !tbaa !5
  %303 = sext i32 %302 to i64
  %304 = getelementptr inbounds [7 x [7 x i32]], ptr @g, i64 0, i64 %303
  %305 = getelementptr inbounds [7 x i32], ptr %304, i64 0, i64 2
  %306 = load i32, ptr %305, align 4, !tbaa !5
  %307 = load i32, ptr %19, align 4, !tbaa !5
  %308 = icmp slt i32 %307, 3
  %309 = zext i1 %308 to i32
  %310 = sub nsw i32 %306, %309
  store i32 %310, ptr %20, align 4, !tbaa !5
  %311 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %301, ptr noundef nonnull align 4 dereferenceable(4) %20)
  %312 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %296, ptr noundef nonnull align 4 dereferenceable(4) %311)
  %313 = load i32, ptr %312, align 4, !tbaa !5
  %314 = load i32, ptr %19, align 4, !tbaa !5
  %315 = sext i32 %314 to i64
  %316 = getelementptr inbounds [7 x [7 x i32]], ptr @g, i64 0, i64 %315
  %317 = getelementptr inbounds [7 x i32], ptr %316, i64 0, i64 3
  store i32 %313, ptr %317, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  br label %318

318:                                              ; preds = %292, %281
  %319 = load i32, ptr %18, align 4, !tbaa !5
  %320 = shl i32 %319, 2
  %321 = load i32, ptr %19, align 4, !tbaa !5
  %322 = sext i32 %321 to i64
  %323 = getelementptr inbounds [7 x [7 x i32]], ptr @g, i64 0, i64 %322
  %324 = getelementptr inbounds [7 x i32], ptr %323, i64 0, i64 3
  %325 = load i32, ptr %324, align 4, !tbaa !5
  %326 = or i32 %320, %325
  store i32 %326, ptr %18, align 4, !tbaa !5
  br label %327

327:                                              ; preds = %318
  %328 = load i32, ptr %19, align 4, !tbaa !5
  %329 = add nsw i32 %328, 1
  store i32 %329, ptr %19, align 4, !tbaa !5
  br label %264, !llvm.loop !20

330:                                              ; preds = %267
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  store i32 1, ptr %21, align 4, !tbaa !5
  br label %331

331:                                              ; preds = %386, %330
  %332 = load i32, ptr %21, align 4, !tbaa !5
  %333 = icmp sle i32 %332, 3
  br i1 %333, label %335, label %334

334:                                              ; preds = %331
  store i32 35, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %389

335:                                              ; preds = %331
  %336 = load i32, ptr %21, align 4, !tbaa !5
  %337 = sext i32 %336 to i64
  %338 = getelementptr inbounds [7 x i32], ptr getelementptr inbounds ([7 x [7 x i32]], ptr @g, i64 0, i64 3), i64 0, i64 %337
  store i32 0, ptr %338, align 4, !tbaa !5
  %339 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @val, i64 0, i64 4), align 16, !tbaa !5
  %340 = load i32, ptr %21, align 4, !tbaa !5
  %341 = shl i32 %340, 1
  %342 = sub nsw i32 %341, 1
  %343 = sext i32 %342 to i64
  %344 = getelementptr inbounds [7 x i32], ptr @val, i64 0, i64 %343
  %345 = load i32, ptr %344, align 4, !tbaa !5
  %346 = icmp eq i32 %339, %345
  br i1 %346, label %347, label %356

347:                                              ; preds = %335
  %348 = load i32, ptr %21, align 4, !tbaa !5
  %349 = sub nsw i32 %348, 1
  %350 = sext i32 %349 to i64
  %351 = getelementptr inbounds [7 x i32], ptr getelementptr inbounds ([7 x [7 x i32]], ptr @g, i64 0, i64 2), i64 0, i64 %350
  %352 = load i32, ptr %351, align 4, !tbaa !5
  %353 = load i32, ptr %21, align 4, !tbaa !5
  %354 = sext i32 %353 to i64
  %355 = getelementptr inbounds [7 x i32], ptr getelementptr inbounds ([7 x [7 x i32]], ptr @g, i64 0, i64 3), i64 0, i64 %354
  store i32 %352, ptr %355, align 4, !tbaa !5
  br label %378

356:                                              ; preds = %335
  %357 = load i32, ptr %21, align 4, !tbaa !5
  %358 = sext i32 %357 to i64
  %359 = getelementptr inbounds [7 x i32], ptr getelementptr inbounds ([7 x [7 x i32]], ptr @g, i64 0, i64 3), i64 0, i64 %358
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  %360 = load i32, ptr %21, align 4, !tbaa !5
  %361 = sext i32 %360 to i64
  %362 = getelementptr inbounds [7 x i32], ptr getelementptr inbounds ([7 x [7 x i32]], ptr @g, i64 0, i64 2), i64 0, i64 %361
  %363 = load i32, ptr %362, align 4, !tbaa !5
  %364 = load i32, ptr %21, align 4, !tbaa !5
  %365 = icmp slt i32 %364, 3
  %366 = zext i1 %365 to i32
  %367 = sub nsw i32 %363, %366
  store i32 %367, ptr %22, align 4, !tbaa !5
  %368 = load i32, ptr %21, align 4, !tbaa !5
  %369 = sub nsw i32 %368, 1
  %370 = sext i32 %369 to i64
  %371 = getelementptr inbounds [7 x i32], ptr getelementptr inbounds ([7 x [7 x i32]], ptr @g, i64 0, i64 3), i64 0, i64 %370
  %372 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %22, ptr noundef nonnull align 4 dereferenceable(4) %371)
  %373 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %359, ptr noundef nonnull align 4 dereferenceable(4) %372)
  %374 = load i32, ptr %373, align 4, !tbaa !5
  %375 = load i32, ptr %21, align 4, !tbaa !5
  %376 = sext i32 %375 to i64
  %377 = getelementptr inbounds [7 x i32], ptr getelementptr inbounds ([7 x [7 x i32]], ptr @g, i64 0, i64 3), i64 0, i64 %376
  store i32 %374, ptr %377, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  br label %378

378:                                              ; preds = %356, %347
  %379 = load i32, ptr %18, align 4, !tbaa !5
  %380 = shl i32 %379, 2
  %381 = load i32, ptr %21, align 4, !tbaa !5
  %382 = sext i32 %381 to i64
  %383 = getelementptr inbounds [7 x i32], ptr getelementptr inbounds ([7 x [7 x i32]], ptr @g, i64 0, i64 3), i64 0, i64 %382
  %384 = load i32, ptr %383, align 4, !tbaa !5
  %385 = or i32 %380, %384
  store i32 %385, ptr %18, align 4, !tbaa !5
  br label %386

386:                                              ; preds = %378
  %387 = load i32, ptr %21, align 4, !tbaa !5
  %388 = add nsw i32 %387, 1
  store i32 %388, ptr %21, align 4, !tbaa !5
  br label %331, !llvm.loop !21

389:                                              ; preds = %334
  %390 = load i32, ptr getelementptr inbounds ([7 x i32], ptr getelementptr inbounds ([7 x [7 x i32]], ptr @g, i64 0, i64 3), i64 0, i64 3), align 4, !tbaa !5
  %391 = icmp ne i32 %390, 0
  br i1 %391, label %392, label %414

392:                                              ; preds = %389
  %393 = load i32, ptr %16, align 4, !tbaa !5
  %394 = load i32, ptr %8, align 4, !tbaa !5
  %395 = add nsw i32 %394, 1
  %396 = sext i32 %395 to i64
  %397 = getelementptr inbounds [101 x [15361 x i32]], ptr @f, i64 0, i64 %396
  %398 = load i32, ptr %18, align 4, !tbaa !5
  %399 = sext i32 %398 to i64
  %400 = getelementptr inbounds [15361 x i32], ptr %397, i64 0, i64 %399
  %401 = load i32, ptr %400, align 4, !tbaa !5
  %402 = add nsw i32 %401, %393
  store i32 %402, ptr %400, align 4, !tbaa !5
  %403 = icmp sge i32 %402, 1000000009
  br i1 %403, label %404, label %414

404:                                              ; preds = %392
  %405 = load i32, ptr %8, align 4, !tbaa !5
  %406 = add nsw i32 %405, 1
  %407 = sext i32 %406 to i64
  %408 = getelementptr inbounds [101 x [15361 x i32]], ptr @f, i64 0, i64 %407
  %409 = load i32, ptr %18, align 4, !tbaa !5
  %410 = sext i32 %409 to i64
  %411 = getelementptr inbounds [15361 x i32], ptr %408, i64 0, i64 %410
  %412 = load i32, ptr %411, align 4, !tbaa !5
  %413 = sub nsw i32 %412, 1000000009
  store i32 %413, ptr %411, align 4, !tbaa !5
  br label %414

414:                                              ; preds = %404, %392, %389
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 28, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %415

415:                                              ; preds = %414, %222
  %416 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @val, i64 0, i64 5), align 4, !tbaa !5
  %417 = add nsw i32 %416, 1
  store i32 %417, ptr getelementptr inbounds ([7 x i32], ptr @val, i64 0, i64 5), align 4, !tbaa !5
  br label %202, !llvm.loop !22

418:                                              ; preds = %214
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %419

419:                                              ; preds = %418, %164
  %420 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @val, i64 0, i64 4), align 16, !tbaa !5
  %421 = add nsw i32 %420, 1
  store i32 %421, ptr getelementptr inbounds ([7 x i32], ptr @val, i64 0, i64 4), align 16, !tbaa !5
  br label %146, !llvm.loop !23

422:                                              ; preds = %156
  call void @llvm.lifetime.end.p0(i64 7, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %423

423:                                              ; preds = %422, %96
  %424 = load i32, ptr %9, align 4, !tbaa !5
  %425 = add nsw i32 %424, 1
  store i32 %425, ptr %9, align 4, !tbaa !5
  br label %83, !llvm.loop !24

426:                                              ; preds = %86
  br label %427

427:                                              ; preds = %426
  %428 = load i32, ptr %8, align 4, !tbaa !5
  %429 = add nsw i32 %428, 1
  store i32 %429, ptr %8, align 4, !tbaa !5
  br label %77, !llvm.loop !25

430:                                              ; preds = %81
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #6
  store i32 0, ptr %23, align 4, !tbaa !5
  br label %431

431:                                              ; preds = %459, %430
  %432 = load i32, ptr %23, align 4, !tbaa !5
  %433 = icmp slt i32 %432, 15361
  br i1 %433, label %435, label %434

434:                                              ; preds = %431
  store i32 38, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  br label %462

435:                                              ; preds = %431
  %436 = load i32, ptr @n, align 4, !tbaa !5
  %437 = sext i32 %436 to i64
  %438 = getelementptr inbounds [101 x [15361 x i32]], ptr @f, i64 0, i64 %437
  %439 = load i32, ptr %23, align 4, !tbaa !5
  %440 = sext i32 %439 to i64
  %441 = getelementptr inbounds [15361 x i32], ptr %438, i64 0, i64 %440
  %442 = load i32, ptr %441, align 4, !tbaa !5
  %443 = icmp ne i32 %442, 0
  br i1 %443, label %444, label %458

444:                                              ; preds = %435
  %445 = load i32, ptr @n, align 4, !tbaa !5
  %446 = sext i32 %445 to i64
  %447 = getelementptr inbounds [101 x [15361 x i32]], ptr @f, i64 0, i64 %446
  %448 = load i32, ptr %23, align 4, !tbaa !5
  %449 = sext i32 %448 to i64
  %450 = getelementptr inbounds [15361 x i32], ptr %447, i64 0, i64 %449
  %451 = load i32, ptr %450, align 4, !tbaa !5
  %452 = load i32, ptr @ans, align 4, !tbaa !5
  %453 = add nsw i32 %452, %451
  store i32 %453, ptr @ans, align 4, !tbaa !5
  %454 = icmp sge i32 %453, 1000000009
  br i1 %454, label %455, label %458

455:                                              ; preds = %444
  %456 = load i32, ptr @ans, align 4, !tbaa !5
  %457 = sub nsw i32 %456, 1000000009
  store i32 %457, ptr @ans, align 4, !tbaa !5
  br label %458

458:                                              ; preds = %455, %444, %435
  br label %459

459:                                              ; preds = %458
  %460 = load i32, ptr %23, align 4, !tbaa !5
  %461 = add nsw i32 %460, 1
  store i32 %461, ptr %23, align 4, !tbaa !5
  br label %431, !llvm.loop !26

462:                                              ; preds = %434
  %463 = load i32, ptr @ans, align 4, !tbaa !5
  %464 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %463)
  ret i32 0
}

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z14state_to_indexPi(ptr noundef) #3

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

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

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

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

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

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

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

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

@idx = external dso_local local_unnamed_addr global [65 x i32], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@f = external dso_local local_unnamed_addr global [101 x [15361 x i32]], align 16
@ans = external dso_local local_unnamed_addr global i32, align 4
@g = external dso_local global [7 x [7 x i32]], align 16
@val = external dso_local local_unnamed_addr global [7 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca [7 x i32], align 16
  %2 = alloca [7 x i8], align 1
  %3 = alloca [7 x i32], align 16
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(260) @idx, i8 -1, i64 260, i1 false)
  %6 = getelementptr inbounds i8, ptr %1, i64 4
  %7 = getelementptr inbounds i8, ptr %1, i64 8
  %8 = getelementptr inbounds i8, ptr %1, i64 12
  %scevgep = getelementptr inbounds i8, ptr %1, i64 16
  br label %.preheader128

.preheader128:                                    ; preds = %0, %32
  %.089132 = phi i32 [ 0, %0 ], [ %33, %32 ]
  br label %.preheader127

9:                                                ; preds = %32
  %10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  store i32 1, ptr getelementptr inbounds (i8, ptr @f, i64 12), align 4, !tbaa !5
  %11 = load i32, ptr @n, align 4, !tbaa !5
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.preheader125.lr.ph, label %..preheader_crit_edge

..preheader_crit_edge:                            ; preds = %9
  %.pre182 = sext i32 %11 to i64
  br label %.preheader

.preheader125.lr.ph:                              ; preds = %9
  %13 = getelementptr inbounds i8, ptr %3, i64 8
  %14 = getelementptr inbounds i8, ptr %3, i64 12
  %scevgep156 = getelementptr inbounds i8, ptr %3, i64 16
  br label %.preheader125

.preheader127:                                    ; preds = %.preheader128, %.preheader127
  %.090131 = phi i32 [ 0, %.preheader128 ], [ %31, %.preheader127 ]
  call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %1) #7
  store i32 %.089132, ptr %1, align 16, !tbaa !5
  store i32 %.090131, ptr %6, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(20) %7, i8 0, i64 20, i1 false)
  %15 = call noundef i32 @_Z14state_to_indexPi(ptr noundef nonnull %1)
  call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %1) #7
  store i32 %.089132, ptr %1, align 16, !tbaa !5
  store i32 %.090131, ptr %6, align 4, !tbaa !5
  store i32 0, ptr %7, align 8, !tbaa !5
  store i32 1, ptr %8, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(12) %scevgep, i8 0, i64 12, i1 false), !tbaa !5
  %16 = call noundef i32 @_Z14state_to_indexPi(ptr noundef nonnull %1)
  call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %1) #7
  store i32 %.089132, ptr %1, align 16, !tbaa !5
  store i32 %.090131, ptr %6, align 4, !tbaa !5
  store i32 0, ptr %7, align 8, !tbaa !5
  store i32 2, ptr %8, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(12) %scevgep, i8 0, i64 12, i1 false), !tbaa !5
  %17 = call noundef i32 @_Z14state_to_indexPi(ptr noundef nonnull %1)
  call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %1) #7
  store i32 %.089132, ptr %1, align 16, !tbaa !5
  store i32 %.090131, ptr %6, align 4, !tbaa !5
  store i32 0, ptr %7, align 8, !tbaa !5
  store i32 3, ptr %8, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(12) %scevgep, i8 0, i64 12, i1 false), !tbaa !5
  %18 = call noundef i32 @_Z14state_to_indexPi(ptr noundef nonnull %1)
  call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %1) #7
  store i32 %.089132, ptr %1, align 16, !tbaa !5
  store i32 %.090131, ptr %6, align 4, !tbaa !5
  store i32 1, ptr %7, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %8, i8 0, i64 16, i1 false)
  %19 = call noundef i32 @_Z14state_to_indexPi(ptr noundef nonnull %1)
  call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %1) #7
  store i32 %.089132, ptr %1, align 16, !tbaa !5
  store i32 %.090131, ptr %6, align 4, !tbaa !5
  store i32 1, ptr %7, align 8, !tbaa !5
  store i32 1, ptr %8, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(12) %scevgep, i8 0, i64 12, i1 false), !tbaa !5
  %20 = call noundef i32 @_Z14state_to_indexPi(ptr noundef nonnull %1)
  call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %1) #7
  store i32 %.089132, ptr %1, align 16, !tbaa !5
  store i32 %.090131, ptr %6, align 4, !tbaa !5
  store i32 1, ptr %7, align 8, !tbaa !5
  store i32 2, ptr %8, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(12) %scevgep, i8 0, i64 12, i1 false), !tbaa !5
  %21 = call noundef i32 @_Z14state_to_indexPi(ptr noundef nonnull %1)
  call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %1) #7
  store i32 %.089132, ptr %1, align 16, !tbaa !5
  store i32 %.090131, ptr %6, align 4, !tbaa !5
  store i32 1, ptr %7, align 8, !tbaa !5
  store i32 3, ptr %8, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(12) %scevgep, i8 0, i64 12, i1 false), !tbaa !5
  %22 = call noundef i32 @_Z14state_to_indexPi(ptr noundef nonnull %1)
  call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %1) #7
  store i32 %.089132, ptr %1, align 16, !tbaa !5
  store i32 %.090131, ptr %6, align 4, !tbaa !5
  store i32 2, ptr %7, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %8, i8 0, i64 16, i1 false)
  %23 = call noundef i32 @_Z14state_to_indexPi(ptr noundef nonnull %1)
  call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %1) #7
  store i32 %.089132, ptr %1, align 16, !tbaa !5
  store i32 %.090131, ptr %6, align 4, !tbaa !5
  store i32 2, ptr %7, align 8, !tbaa !5
  store i32 1, ptr %8, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(12) %scevgep, i8 0, i64 12, i1 false), !tbaa !5
  %24 = call noundef i32 @_Z14state_to_indexPi(ptr noundef nonnull %1)
  call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %1) #7
  store i32 %.089132, ptr %1, align 16, !tbaa !5
  store i32 %.090131, ptr %6, align 4, !tbaa !5
  store i32 2, ptr %7, align 8, !tbaa !5
  store i32 2, ptr %8, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(12) %scevgep, i8 0, i64 12, i1 false), !tbaa !5
  %25 = call noundef i32 @_Z14state_to_indexPi(ptr noundef nonnull %1)
  call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %1) #7
  store i32 %.089132, ptr %1, align 16, !tbaa !5
  store i32 %.090131, ptr %6, align 4, !tbaa !5
  store i32 2, ptr %7, align 8, !tbaa !5
  store i32 3, ptr %8, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(12) %scevgep, i8 0, i64 12, i1 false), !tbaa !5
  %26 = call noundef i32 @_Z14state_to_indexPi(ptr noundef nonnull %1)
  call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %1) #7
  store i32 %.089132, ptr %1, align 16, !tbaa !5
  store i32 %.090131, ptr %6, align 4, !tbaa !5
  store i32 3, ptr %7, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %8, i8 0, i64 16, i1 false)
  %27 = call noundef i32 @_Z14state_to_indexPi(ptr noundef nonnull %1)
  call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %1) #7
  store i32 %.089132, ptr %1, align 16, !tbaa !5
  store i32 %.090131, ptr %6, align 4, !tbaa !5
  store i32 3, ptr %7, align 8, !tbaa !5
  store i32 1, ptr %8, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(12) %scevgep, i8 0, i64 12, i1 false), !tbaa !5
  %28 = call noundef i32 @_Z14state_to_indexPi(ptr noundef nonnull %1)
  call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %1) #7
  store i32 %.089132, ptr %1, align 16, !tbaa !5
  store i32 %.090131, ptr %6, align 4, !tbaa !5
  store i32 3, ptr %7, align 8, !tbaa !5
  store i32 2, ptr %8, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(12) %scevgep, i8 0, i64 12, i1 false), !tbaa !5
  %29 = call noundef i32 @_Z14state_to_indexPi(ptr noundef nonnull %1)
  call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %1) #7
  store i32 %.089132, ptr %1, align 16, !tbaa !5
  store i32 %.090131, ptr %6, align 4, !tbaa !5
  store i32 3, ptr %7, align 8, !tbaa !5
  store i32 3, ptr %8, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(12) %scevgep, i8 0, i64 12, i1 false), !tbaa !5
  %30 = call noundef i32 @_Z14state_to_indexPi(ptr noundef nonnull %1)
  call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %1) #7
  %31 = add nuw nsw i32 %.090131, 1
  %exitcond.not = icmp eq i32 %31, 4
  br i1 %exitcond.not, label %32, label %.preheader127, !llvm.loop !9

32:                                               ; preds = %.preheader127
  %33 = add nuw nsw i32 %.089132, 1
  %exitcond153.not = icmp eq i32 %33, 4
  br i1 %exitcond153.not, label %9, label %.preheader128, !llvm.loop !11

.preheader125:                                    ; preds = %.preheader125.lr.ph, %34
  %indvars.iv163 = phi i64 [ 0, %.preheader125.lr.ph ], [ %indvars.iv.next164, %34 ]
  %indvars.iv.next164 = add nuw nsw i64 %indvars.iv163, 1
  %.not116 = icmp ugt i64 %indvars.iv163, 1
  %.not116.2.not = icmp eq i64 %indvars.iv163, 0
  br label %38

.preheader:                                       ; preds = %34, %..preheader_crit_edge
  %.pre-phi = phi i64 [ %.pre182, %..preheader_crit_edge ], [ %36, %34 ]
  %ans.promoted = load i32, ptr @ans, align 4, !tbaa !5
  br label %203

34:                                               ; preds = %200
  %35 = load i32, ptr @n, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = icmp slt i64 %indvars.iv.next164, %36
  br i1 %37, label %.preheader125, label %.preheader, !llvm.loop !12

38:                                               ; preds = %.preheader125, %200
  %indvars.iv = phi i64 [ 0, %.preheader125 ], [ %indvars.iv.next, %200 ]
  %39 = getelementptr inbounds [101 x [15361 x i32]], ptr @f, i64 0, i64 %indvars.iv163, i64 %indvars.iv
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %.not108 = icmp eq i32 %40, 0
  br i1 %.not108, label %200, label %41

41:                                               ; preds = %38
  %42 = trunc nuw nsw i64 %indvars.iv to i32
  call void @_Z9get_statei(i32 noundef %42)
  call void @llvm.lifetime.start.p0(i64 7, ptr nonnull %2) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(7) %2, i8 0, i64 7, i1 false)
  %.pre = load i32, ptr @val, align 16, !tbaa !5
  br i1 %.not116, label %66, label %44

.lr.ph145.preheader:                              ; preds = %66, %.thread210, %70, %76
  %.pre176209 = phi i32 [ %.pre176204, %70 ], [ %.pre176204, %76 ], [ %.pre176, %66 ], [ %.pre176216, %.thread210 ]
  %smax.1206 = phi i32 [ %smax.1203, %70 ], [ %smax.1203, %76 ], [ %smax.1, %66 ], [ %smax.1215, %.thread210 ]
  %.193.3 = phi i32 [ %.193.2.ph, %70 ], [ %77, %76 ], [ 0, %66 ], [ %.193.1, %.thread210 ]
  %43 = add i32 %.pre176209, 1
  %smax.2 = call i32 @llvm.smax.i32(i32 %smax.1206, i32 %43)
  %smax.3 = call i32 @llvm.smax.i32(i32 %smax.2, i32 0)
  store i32 0, ptr getelementptr inbounds (i8, ptr @val, i64 16), align 16, !tbaa !5
  br label %.lr.ph145

44:                                               ; preds = %41
  %45 = sext i32 %.pre to i64
  %46 = getelementptr inbounds [7 x i8], ptr %2, i64 0, i64 %45
  %47 = load i8, ptr %46, align 1, !tbaa !13, !range !15, !noundef !16
  %48 = trunc nuw i8 %47 to i1
  %spec.store.select = select i1 %48, i8 %47, i8 1
  store i8 %spec.store.select, ptr %46, align 1
  %not. = xor i1 %48, true
  %spec.select = zext i1 %not. to i32
  %49 = add i32 %.pre, 1
  %.pre174184 = load i32, ptr getelementptr inbounds (i8, ptr @val, i64 4), align 4, !tbaa !5
  %50 = sext i32 %.pre174184 to i64
  %51 = getelementptr inbounds [7 x i8], ptr %2, i64 0, i64 %50
  %52 = load i8, ptr %51, align 1, !tbaa !13, !range !15, !noundef !16
  %53 = trunc nuw i8 %52 to i1
  br i1 %53, label %56, label %54

54:                                               ; preds = %44
  store i8 1, ptr %51, align 1, !tbaa !13
  %55 = select i1 %48, i32 1, i32 2
  br label %56

56:                                               ; preds = %54, %44
  %.193.1 = phi i32 [ %spec.select, %44 ], [ %55, %54 ]
  %57 = add i32 %.pre174184, 1
  %smax = call i32 @llvm.smax.i32(i32 %49, i32 %57)
  %.pre175 = load i32, ptr getelementptr inbounds (i8, ptr @val, i64 8), align 8, !tbaa !5
  br i1 %.not116.2.not, label %59, label %.thread210

.thread210:                                       ; preds = %56
  %58 = add i32 %.pre175, 1
  %smax.1215 = call i32 @llvm.smax.i32(i32 %smax, i32 %58)
  %.pre176216 = load i32, ptr getelementptr inbounds (i8, ptr @val, i64 12), align 4, !tbaa !5
  br label %.lr.ph145.preheader

59:                                               ; preds = %56
  %60 = sext i32 %.pre175 to i64
  %61 = getelementptr inbounds [7 x i8], ptr %2, i64 0, i64 %60
  %62 = load i8, ptr %61, align 1, !tbaa !13, !range !15, !noundef !16
  %63 = trunc nuw i8 %62 to i1
  br i1 %63, label %70, label %64

64:                                               ; preds = %59
  store i8 1, ptr %61, align 1, !tbaa !13
  %65 = add nuw nsw i32 %.193.1, 1
  br label %70

66:                                               ; preds = %41
  %67 = add i32 %.pre, 1
  %.pre174 = load i32, ptr getelementptr inbounds (i8, ptr @val, i64 4), align 4, !tbaa !5
  %68 = add i32 %.pre174, 1
  %smax191 = call i32 @llvm.smax.i32(i32 %67, i32 %68)
  %.pre175193 = load i32, ptr getelementptr inbounds (i8, ptr @val, i64 8), align 8, !tbaa !5
  %69 = add i32 %.pre175193, 1
  %smax.1 = call i32 @llvm.smax.i32(i32 %smax191, i32 %69)
  %.pre176 = load i32, ptr getelementptr inbounds (i8, ptr @val, i64 12), align 4, !tbaa !5
  br label %.lr.ph145.preheader

70:                                               ; preds = %59, %64
  %.193.2.ph = phi i32 [ %65, %64 ], [ %.193.1, %59 ]
  %71 = add i32 %.pre175, 1
  %smax.1203 = call i32 @llvm.smax.i32(i32 %smax, i32 %71)
  %.pre176204 = load i32, ptr getelementptr inbounds (i8, ptr @val, i64 12), align 4, !tbaa !5
  %72 = sext i32 %.pre176204 to i64
  %73 = getelementptr inbounds [7 x i8], ptr %2, i64 0, i64 %72
  %74 = load i8, ptr %73, align 1, !tbaa !13, !range !15, !noundef !16
  %75 = trunc nuw i8 %74 to i1
  br i1 %75, label %.lr.ph145.preheader, label %76

76:                                               ; preds = %70
  store i8 1, ptr %73, align 1, !tbaa !13
  %77 = add nuw nsw i32 %.193.2.ph, 1
  br label %.lr.ph145.preheader

.lr.ph145:                                        ; preds = %.lr.ph145.preheader, %.critedge2
  %storemerge144 = phi i32 [ %199, %.critedge2 ], [ 0, %.lr.ph145.preheader ]
  %78 = load i32, ptr @m, align 4, !tbaa !5
  %79 = add nsw i32 %78, %.193.3
  %80 = icmp slt i32 %storemerge144, %79
  br i1 %80, label %81, label %.critedge

81:                                               ; preds = %.lr.ph145
  %82 = sext i32 %storemerge144 to i64
  %83 = getelementptr inbounds [7 x i8], ptr %2, i64 0, i64 %82
  %84 = load i8, ptr %83, align 1, !tbaa !13, !range !15, !noundef !16
  %85 = trunc nuw i8 %84 to i1
  br i1 %85, label %.critedge2, label %86

86:                                               ; preds = %81
  %87 = icmp eq i32 %storemerge144, %smax.3
  %88 = zext i1 %87 to i32
  %89 = icmp slt i32 %storemerge144, %smax.3
  %90 = load i32, ptr %39, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  br i1 %89, label %.lr.ph.preheader, label %92

92:                                               ; preds = %86
  %93 = sub nsw i32 %79, %smax.3
  %94 = sext i32 %93 to i64
  %95 = mul nsw i64 %91, %94
  %96 = srem i64 %95, 1000000009
  br label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %86, %92
  %97 = phi i64 [ %96, %92 ], [ %91, %86 ]
  %98 = add nuw nsw i32 %smax.3, %88
  store i32 0, ptr getelementptr inbounds (i8, ptr @val, i64 20), align 4, !tbaa !5
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %195
  %storemerge110141 = phi i32 [ %197, %195 ], [ 0, %.lr.ph.preheader ]
  %99 = load i32, ptr @m, align 4, !tbaa !5
  %100 = add nsw i32 %99, %.193.3
  %101 = icmp slt i32 %storemerge110141, %100
  br i1 %101, label %102, label %.critedge2.loopexit

102:                                              ; preds = %.lr.ph
  %103 = sext i32 %storemerge110141 to i64
  %104 = getelementptr inbounds [7 x i8], ptr %2, i64 0, i64 %103
  %105 = load i8, ptr %104, align 1, !tbaa !13, !range !15, !noundef !16
  %106 = trunc nuw i8 %105 to i1
  br i1 %106, label %195, label %107

107:                                              ; preds = %102
  %108 = icmp slt i32 %storemerge110141, %98
  br i1 %108, label %114, label %109

109:                                              ; preds = %107
  %110 = sub i32 %100, %98
  %111 = sext i32 %110 to i64
  %112 = mul nsw i64 %97, %111
  %113 = srem i64 %112, 1000000009
  br label %114

114:                                              ; preds = %107, %109
  %115 = phi i64 [ %113, %109 ], [ %97, %107 ]
  call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %3) #7
  %116 = load <2 x i32>, ptr getelementptr inbounds (i8, ptr @val, i64 8), align 8, !tbaa !5
  store <2 x i32> %116, ptr %3, align 16, !tbaa !5
  %117 = load i32, ptr getelementptr inbounds (i8, ptr @val, i64 16), align 16, !tbaa !5
  store i32 %117, ptr %13, align 8, !tbaa !5
  store i32 %storemerge110141, ptr %14, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(12) %scevgep156, i8 0, i64 12, i1 false), !tbaa !5
  %118 = call noundef i32 @_Z14state_to_indexPi(ptr noundef nonnull %3)
  store i32 0, ptr getelementptr inbounds (i8, ptr @g, i64 40), align 8, !tbaa !5
  %119 = load i32, ptr @val, align 16, !tbaa !5
  %120 = load i32, ptr getelementptr inbounds (i8, ptr @val, i64 20), align 4, !tbaa !5
  %121 = icmp eq i32 %119, %120
  br i1 %121, label %122, label %124

122:                                              ; preds = %114
  %123 = load i32, ptr getelementptr inbounds (i8, ptr @g, i64 8), align 8, !tbaa !5
  br label %130

124:                                              ; preds = %114
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  %125 = load i32, ptr getelementptr inbounds (i8, ptr @g, i64 36), align 4, !tbaa !5
  %126 = add nsw i32 %125, -1
  store i32 %126, ptr %4, align 4, !tbaa !5
  %127 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @g, i64 12), ptr noundef nonnull align 4 dereferenceable(4) %4)
  %128 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @g, i64 40), ptr noundef nonnull align 4 dereferenceable(4) %127)
  %129 = load i32, ptr %128, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  %.pre177 = load i32, ptr getelementptr inbounds (i8, ptr @val, i64 20), align 4, !tbaa !5
  br label %130

130:                                              ; preds = %124, %122
  %131 = phi i32 [ %119, %122 ], [ %.pre177, %124 ]
  %.sink = phi i32 [ %123, %122 ], [ %129, %124 ]
  store i32 %.sink, ptr getelementptr inbounds (i8, ptr @g, i64 40), align 8
  store i32 0, ptr getelementptr inbounds (i8, ptr @g, i64 68), align 4, !tbaa !5
  %132 = load i32, ptr getelementptr inbounds (i8, ptr @val, i64 8), align 8, !tbaa !5
  %133 = icmp eq i32 %132, %131
  br i1 %133, label %140, label %134

134:                                              ; preds = %130
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  %135 = load i32, ptr getelementptr inbounds (i8, ptr @g, i64 64), align 16, !tbaa !5
  %136 = add nsw i32 %135, -1
  store i32 %136, ptr %4, align 4, !tbaa !5
  %137 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @g, i64 40), ptr noundef nonnull align 4 dereferenceable(4) %4)
  %138 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @g, i64 68), ptr noundef nonnull align 4 dereferenceable(4) %137)
  %139 = load i32, ptr %138, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  br label %.preheader123.preheader

140:                                              ; preds = %130
  %141 = load i32, ptr getelementptr inbounds (i8, ptr @g, i64 36), align 4, !tbaa !5
  br label %.preheader123.preheader

.preheader123.preheader:                          ; preds = %140, %134
  %.sink170 = phi i32 [ %141, %140 ], [ %139, %134 ]
  store i32 %.sink170, ptr getelementptr inbounds (i8, ptr @g, i64 68), align 4
  %142 = shl i32 %118, 4
  %143 = shl i32 %.sink, 2
  %144 = or i32 %142, %143
  %145 = or i32 %.sink170, %144
  store i32 0, ptr getelementptr inbounds (i8, ptr @g, i64 88), align 8, !tbaa !5
  %146 = load i32, ptr getelementptr inbounds (i8, ptr @val, i64 16), align 16, !tbaa !5
  %147 = load i32, ptr getelementptr inbounds (i8, ptr @val, i64 4), align 4, !tbaa !5
  %148 = icmp eq i32 %146, %147
  br i1 %148, label %149, label %151

149:                                              ; preds = %.preheader123.preheader
  %150 = load i32, ptr getelementptr inbounds (i8, ptr @g, i64 56), align 8, !tbaa !5
  br label %.preheader123.1

151:                                              ; preds = %.preheader123.preheader
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  %152 = load i32, ptr getelementptr inbounds (i8, ptr @g, i64 60), align 4, !tbaa !5
  %153 = add i32 %152, -1
  store i32 %153, ptr %5, align 4, !tbaa !5
  %154 = 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) getelementptr inbounds (i8, ptr @g, i64 84))
  %155 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @g, i64 88), ptr noundef nonnull align 4 dereferenceable(4) %154)
  %156 = load i32, ptr %155, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  %.pre178 = load i32, ptr getelementptr inbounds (i8, ptr @val, i64 16), align 16, !tbaa !5
  br label %.preheader123.1

.preheader123.1:                                  ; preds = %151, %149
  %157 = phi i32 [ %146, %149 ], [ %.pre178, %151 ]
  %.sink171 = phi i32 [ %150, %149 ], [ %156, %151 ]
  store i32 %.sink171, ptr getelementptr inbounds (i8, ptr @g, i64 88), align 8
  store i32 0, ptr getelementptr inbounds (i8, ptr @g, i64 92), align 4, !tbaa !5
  %158 = load i32, ptr getelementptr inbounds (i8, ptr @val, i64 12), align 4, !tbaa !5
  %159 = icmp eq i32 %157, %158
  br i1 %159, label %166, label %160

160:                                              ; preds = %.preheader123.1
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  %161 = load i32, ptr getelementptr inbounds (i8, ptr @g, i64 64), align 16, !tbaa !5
  %162 = add i32 %161, -1
  store i32 %162, ptr %5, align 4, !tbaa !5
  %163 = 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) getelementptr inbounds (i8, ptr @g, i64 88))
  %164 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @g, i64 92), ptr noundef nonnull align 4 dereferenceable(4) %163)
  %165 = load i32, ptr %164, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  %.pre179 = load i32, ptr getelementptr inbounds (i8, ptr @val, i64 16), align 16, !tbaa !5
  br label %.preheader123.2

166:                                              ; preds = %.preheader123.1
  %167 = load i32, ptr getelementptr inbounds (i8, ptr @g, i64 60), align 4, !tbaa !5
  br label %.preheader123.2

.preheader123.2:                                  ; preds = %166, %160
  %168 = phi i32 [ %157, %166 ], [ %.pre179, %160 ]
  %.sink172 = phi i32 [ %167, %166 ], [ %165, %160 ]
  store i32 %.sink172, ptr getelementptr inbounds (i8, ptr @g, i64 92), align 4
  %169 = shl i32 %145, 4
  %170 = shl i32 %.sink171, 2
  %171 = or i32 %169, %170
  %172 = or i32 %.sink172, %171
  store i32 0, ptr getelementptr inbounds (i8, ptr @g, i64 96), align 16, !tbaa !5
  %173 = load i32, ptr getelementptr inbounds (i8, ptr @val, i64 20), align 4, !tbaa !5
  %174 = icmp eq i32 %168, %173
  br i1 %174, label %180, label %175

175:                                              ; preds = %.preheader123.2
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  %176 = load i32, ptr getelementptr inbounds (i8, ptr @g, i64 68), align 4, !tbaa !5
  store i32 %176, ptr %5, align 4, !tbaa !5
  %177 = 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) getelementptr inbounds (i8, ptr @g, i64 92))
  %178 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @g, i64 96), ptr noundef nonnull align 4 dereferenceable(4) %177)
  %179 = load i32, ptr %178, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  br label %182

180:                                              ; preds = %.preheader123.2
  %181 = load i32, ptr getelementptr inbounds (i8, ptr @g, i64 64), align 16, !tbaa !5
  br label %182

182:                                              ; preds = %180, %175
  %.sink173 = phi i32 [ %181, %180 ], [ %179, %175 ]
  store i32 %.sink173, ptr getelementptr inbounds (i8, ptr @g, i64 96), align 16
  %.not114 = icmp eq i32 %.sink173, 0
  br i1 %.not114, label %194, label %183

183:                                              ; preds = %182
  %184 = trunc nsw i64 %115 to i32
  %185 = shl i32 %172, 2
  %186 = or i32 %.sink173, %185
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [101 x [15361 x i32]], ptr @f, i64 0, i64 %indvars.iv.next164, i64 %187
  %189 = load i32, ptr %188, align 4, !tbaa !5
  %190 = add nsw i32 %189, %184
  store i32 %190, ptr %188, align 4, !tbaa !5
  %191 = icmp sgt i32 %190, 1000000008
  br i1 %191, label %192, label %194

192:                                              ; preds = %183
  %193 = add nsw i32 %190, -1000000009
  store i32 %193, ptr %188, align 4, !tbaa !5
  br label %194

194:                                              ; preds = %192, %183, %182
  call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %3) #7
  %.pre180 = load i32, ptr getelementptr inbounds (i8, ptr @val, i64 20), align 4, !tbaa !5
  br label %195

195:                                              ; preds = %102, %194
  %196 = phi i32 [ %storemerge110141, %102 ], [ %.pre180, %194 ]
  %197 = add nsw i32 %196, 1
  store i32 %197, ptr getelementptr inbounds (i8, ptr @val, i64 20), align 4, !tbaa !5
  %.not111.not = icmp slt i32 %196, %98
  br i1 %.not111.not, label %.lr.ph, label %.critedge2.loopexit, !llvm.loop !17

.critedge2.loopexit:                              ; preds = %.lr.ph, %195
  %.pre181 = load i32, ptr getelementptr inbounds (i8, ptr @val, i64 16), align 16, !tbaa !5
  br label %.critedge2

.critedge2:                                       ; preds = %.critedge2.loopexit, %81
  %198 = phi i32 [ %.pre181, %.critedge2.loopexit ], [ %storemerge144, %81 ]
  %199 = add nsw i32 %198, 1
  store i32 %199, ptr getelementptr inbounds (i8, ptr @val, i64 16), align 16, !tbaa !5
  %.not109.not = icmp slt i32 %198, %smax.3
  br i1 %.not109.not, label %.lr.ph145, label %.critedge, !llvm.loop !18

.critedge:                                        ; preds = %.lr.ph145, %.critedge2
  call void @llvm.lifetime.end.p0(i64 7, ptr nonnull %2) #7
  br label %200

200:                                              ; preds = %38, %.critedge
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond162.not = icmp eq i64 %indvars.iv.next, 15361
  br i1 %exitcond162.not, label %34, label %38, !llvm.loop !19

201:                                              ; preds = %212
  %202 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %213)
  ret i32 0

203:                                              ; preds = %222, %.preheader
  %indvars.iv166 = phi i64 [ 0, %.preheader ], [ %indvars.iv.next167.1, %222 ]
  %204 = phi i32 [ %ans.promoted, %.preheader ], [ %223, %222 ]
  %205 = getelementptr inbounds [101 x [15361 x i32]], ptr @f, i64 0, i64 %.pre-phi, i64 %indvars.iv166
  %206 = load i32, ptr %205, align 4, !tbaa !5
  %.not = icmp eq i32 %206, 0
  br i1 %.not, label %212, label %207

207:                                              ; preds = %203
  %208 = add nsw i32 %204, %206
  store i32 %208, ptr @ans, align 4, !tbaa !5
  %209 = icmp sgt i32 %208, 1000000008
  br i1 %209, label %210, label %212

210:                                              ; preds = %207
  %211 = add nsw i32 %208, -1000000009
  store i32 %211, ptr @ans, align 4, !tbaa !5
  br label %212

212:                                              ; preds = %203, %207, %210
  %213 = phi i32 [ %204, %203 ], [ %208, %207 ], [ %211, %210 ]
  %exitcond169.not = icmp eq i64 %indvars.iv166, 15360
  br i1 %exitcond169.not, label %201, label %214, !llvm.loop !20

214:                                              ; preds = %212
  %indvars.iv.next167 = or disjoint i64 %indvars.iv166, 1
  %215 = getelementptr inbounds [101 x [15361 x i32]], ptr @f, i64 0, i64 %.pre-phi, i64 %indvars.iv.next167
  %216 = load i32, ptr %215, align 4, !tbaa !5
  %.not.1 = icmp eq i32 %216, 0
  br i1 %.not.1, label %222, label %217

217:                                              ; preds = %214
  %218 = add nsw i32 %213, %216
  store i32 %218, ptr @ans, align 4, !tbaa !5
  %219 = icmp sgt i32 %218, 1000000008
  br i1 %219, label %220, label %222

220:                                              ; preds = %217
  %221 = add nsw i32 %218, -1000000009
  store i32 %221, ptr @ans, align 4, !tbaa !5
  br label %222

222:                                              ; preds = %220, %217, %214
  %223 = phi i32 [ %213, %214 ], [ %218, %217 ], [ %221, %220 ]
  %indvars.iv.next167.1 = add nuw nsw i64 %indvars.iv166, 2
  br label %203
}

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z14state_to_indexPi(ptr noundef) local_unnamed_addr #3

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

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

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

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

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

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

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

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

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


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