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

; 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
@pw = external dso_local global [121 x i32], align 16
@c = external dso_local global [11 x [11 x i32]], align 16
@f = external dso_local global [11 x [11 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 i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %10

10:                                               ; preds = %70, %0
  %11 = load i32, ptr %2, align 4, !tbaa !5
  %12 = icmp slt i32 %11, 11
  br i1 %12, label %14, label %13

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

14:                                               ; preds = %10
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [11 x [11 x i32]], ptr @c, i64 0, i64 %16
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [11 x i32], ptr %17, i64 0, i64 %19
  store i32 1, ptr %20, align 4, !tbaa !5
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [11 x [11 x i32]], ptr @c, i64 0, i64 %22
  %24 = getelementptr inbounds [11 x i32], ptr %23, i64 0, i64 0
  store i32 1, ptr %24, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %25

25:                                               ; preds = %66, %14
  %26 = load i32, ptr %4, align 4, !tbaa !5
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = icmp slt i32 %26, %27
  br i1 %28, label %30, label %29

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

30:                                               ; preds = %25
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = sub nsw i32 %31, 1
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [11 x [11 x i32]], ptr @c, i64 0, i64 %33
  %35 = load i32, ptr %4, align 4, !tbaa !5
  %36 = sub nsw i32 %35, 1
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [11 x i32], ptr %34, i64 0, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = load i32, ptr %2, align 4, !tbaa !5
  %41 = sub nsw i32 %40, 1
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [11 x [11 x i32]], ptr @c, i64 0, i64 %42
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [11 x i32], ptr %43, i64 0, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = add nsw i32 %39, %47
  %49 = load i32, ptr %2, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [11 x [11 x i32]], ptr @c, i64 0, i64 %50
  %52 = load i32, ptr %4, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [11 x i32], ptr %51, i64 0, i64 %53
  store i32 %48, ptr %54, align 4, !tbaa !5
  %55 = icmp sge i32 %48, 1000000007
  br i1 %55, label %56, label %65

56:                                               ; preds = %30
  %57 = load i32, ptr %2, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [11 x [11 x i32]], ptr @c, i64 0, i64 %58
  %60 = load i32, ptr %4, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [11 x i32], ptr %59, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = sub nsw i32 %63, 1000000007
  store i32 %64, ptr %62, align 4, !tbaa !5
  br label %65

65:                                               ; preds = %56, %30
  br label %66

66:                                               ; preds = %65
  %67 = load i32, ptr %4, align 4, !tbaa !5
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %4, align 4, !tbaa !5
  br label %25, !llvm.loop !9

69:                                               ; preds = %29
  br label %70

70:                                               ; preds = %69
  %71 = load i32, ptr %2, align 4, !tbaa !5
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %2, align 4, !tbaa !5
  br label %10, !llvm.loop !11

73:                                               ; preds = %13
  store i32 1, ptr @pw, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %74

74:                                               ; preds = %91, %73
  %75 = load i32, ptr %5, align 4, !tbaa !5
  %76 = icmp slt i32 %75, 121
  br i1 %76, label %78, label %77

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

78:                                               ; preds = %74
  %79 = load i32, ptr %5, align 4, !tbaa !5
  %80 = sub nsw i32 %79, 1
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [121 x i32], ptr @pw, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = mul nsw i64 3, %84
  %86 = srem i64 %85, 1000000007
  %87 = trunc i64 %86 to i32
  %88 = load i32, ptr %5, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [121 x i32], ptr @pw, i64 0, i64 %89
  store i32 %87, ptr %90, align 4, !tbaa !5
  br label %91

91:                                               ; preds = %78
  %92 = load i32, ptr %5, align 4, !tbaa !5
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %5, align 4, !tbaa !5
  br label %74, !llvm.loop !12

94:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %95

95:                                               ; preds = %227, %94
  %96 = load i32, ptr %6, align 4, !tbaa !5
  %97 = icmp slt i32 %96, 11
  br i1 %97, label %99, label %98

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

99:                                               ; preds = %95
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %100

100:                                              ; preds = %223, %99
  %101 = load i32, ptr %7, align 4, !tbaa !5
  %102 = icmp slt i32 %101, 11
  br i1 %102, label %104, label %103

103:                                              ; preds = %100
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  br label %226

104:                                              ; preds = %100
  %105 = load i32, ptr %6, align 4, !tbaa !5
  %106 = load i32, ptr %7, align 4, !tbaa !5
  %107 = mul nsw i32 %105, %106
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [121 x i32], ptr @pw, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = load i32, ptr %6, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [11 x [11 x i32]], ptr @f, i64 0, i64 %112
  %114 = load i32, ptr %7, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [11 x i32], ptr %113, i64 0, i64 %115
  store i32 %110, ptr %116, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %117

117:                                              ; preds = %201, %104
  %118 = load i32, ptr %8, align 4, !tbaa !5
  %119 = load i32, ptr %6, align 4, !tbaa !5
  %120 = icmp sle i32 %118, %119
  br i1 %120, label %122, label %121

121:                                              ; preds = %117
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  br label %204

122:                                              ; preds = %117
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %123

123:                                              ; preds = %197, %122
  %124 = load i32, ptr %9, align 4, !tbaa !5
  %125 = load i32, ptr %7, align 4, !tbaa !5
  %126 = icmp sle i32 %124, %125
  br i1 %126, label %128, label %127

127:                                              ; preds = %123
  store i32 20, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  br label %200

128:                                              ; preds = %123
  %129 = load i32, ptr %8, align 4, !tbaa !5
  %130 = load i32, ptr %6, align 4, !tbaa !5
  %131 = icmp slt i32 %129, %130
  br i1 %131, label %136, label %132

132:                                              ; preds = %128
  %133 = load i32, ptr %9, align 4, !tbaa !5
  %134 = load i32, ptr %7, align 4, !tbaa !5
  %135 = icmp slt i32 %133, %134
  br i1 %135, label %136, label %196

136:                                              ; preds = %132, %128
  %137 = load i32, ptr %6, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [11 x [11 x i32]], ptr @f, i64 0, i64 %138
  %140 = load i32, ptr %7, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [11 x i32], ptr %139, i64 0, i64 %141
  %143 = load i32, ptr %142, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = load i32, ptr %6, align 4, !tbaa !5
  %146 = sub nsw i32 %145, 1
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [11 x [11 x i32]], ptr @c, i64 0, i64 %147
  %149 = load i32, ptr %8, align 4, !tbaa !5
  %150 = sub nsw i32 %149, 1
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [11 x i32], ptr %148, i64 0, i64 %151
  %153 = load i32, ptr %152, align 4, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = load i32, ptr %7, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [11 x [11 x i32]], ptr @c, i64 0, i64 %156
  %158 = load i32, ptr %9, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [11 x i32], ptr %157, i64 0, i64 %159
  %161 = load i32, ptr %160, align 4, !tbaa !5
  %162 = sext i32 %161 to i64
  %163 = mul nsw i64 %154, %162
  %164 = srem i64 %163, 1000000007
  %165 = load i32, ptr %6, align 4, !tbaa !5
  %166 = load i32, ptr %8, align 4, !tbaa !5
  %167 = sub nsw i32 %165, %166
  %168 = load i32, ptr %7, align 4, !tbaa !5
  %169 = load i32, ptr %9, align 4, !tbaa !5
  %170 = sub nsw i32 %168, %169
  %171 = mul nsw i32 %167, %170
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [121 x i32], ptr @pw, i64 0, i64 %172
  %174 = load i32, ptr %173, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = mul nsw i64 %164, %175
  %177 = srem i64 %176, 1000000007
  %178 = load i32, ptr %8, align 4, !tbaa !5
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [11 x [11 x i32]], ptr @f, i64 0, i64 %179
  %181 = load i32, ptr %9, align 4, !tbaa !5
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [11 x i32], ptr %180, i64 0, i64 %182
  %184 = load i32, ptr %183, align 4, !tbaa !5
  %185 = sext i32 %184 to i64
  %186 = mul nsw i64 %177, %185
  %187 = sub nsw i64 %144, %186
  %188 = srem i64 %187, 1000000007
  %189 = trunc i64 %188 to i32
  %190 = load i32, ptr %6, align 4, !tbaa !5
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [11 x [11 x i32]], ptr @f, i64 0, i64 %191
  %193 = load i32, ptr %7, align 4, !tbaa !5
  %194 = sext i32 %193 to i64
  %195 = getelementptr inbounds [11 x i32], ptr %192, i64 0, i64 %194
  store i32 %189, ptr %195, align 4, !tbaa !5
  br label %196

196:                                              ; preds = %136, %132
  br label %197

197:                                              ; preds = %196
  %198 = load i32, ptr %9, align 4, !tbaa !5
  %199 = add nsw i32 %198, 1
  store i32 %199, ptr %9, align 4, !tbaa !5
  br label %123, !llvm.loop !13

200:                                              ; preds = %127
  br label %201

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

204:                                              ; preds = %121
  %205 = load i32, ptr %6, align 4, !tbaa !5
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds [11 x [11 x i32]], ptr @f, i64 0, i64 %206
  %208 = load i32, ptr %7, align 4, !tbaa !5
  %209 = sext i32 %208 to i64
  %210 = getelementptr inbounds [11 x i32], ptr %207, i64 0, i64 %209
  %211 = load i32, ptr %210, align 4, !tbaa !5
  %212 = icmp slt i32 %211, 0
  br i1 %212, label %213, label %222

213:                                              ; preds = %204
  %214 = load i32, ptr %6, align 4, !tbaa !5
  %215 = sext i32 %214 to i64
  %216 = getelementptr inbounds [11 x [11 x i32]], ptr @f, i64 0, i64 %215
  %217 = load i32, ptr %7, align 4, !tbaa !5
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds [11 x i32], ptr %216, i64 0, i64 %218
  %220 = load i32, ptr %219, align 4, !tbaa !5
  %221 = add nsw i32 %220, 1000000007
  store i32 %221, ptr %219, align 4, !tbaa !5
  br label %222

222:                                              ; preds = %213, %204
  br label %223

223:                                              ; preds = %222
  %224 = load i32, ptr %7, align 4, !tbaa !5
  %225 = add nsw i32 %224, 1
  store i32 %225, ptr %7, align 4, !tbaa !5
  br label %100, !llvm.loop !15

226:                                              ; preds = %103
  br label %227

227:                                              ; preds = %226
  %228 = load i32, ptr %6, align 4, !tbaa !5
  %229 = add nsw i32 %228, 1
  store i32 %229, ptr %6, align 4, !tbaa !5
  br label %95, !llvm.loop !16

230:                                              ; preds = %98
  br label %231

231:                                              ; preds = %234, %230
  %232 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  %233 = icmp eq i32 %232, 2
  br i1 %233, label %234, label %243

234:                                              ; preds = %231
  %235 = load i32, ptr @n, align 4, !tbaa !5
  %236 = sext i32 %235 to i64
  %237 = getelementptr inbounds [11 x [11 x i32]], ptr @f, i64 0, i64 %236
  %238 = load i32, ptr @m, align 4, !tbaa !5
  %239 = sext i32 %238 to i64
  %240 = getelementptr inbounds [11 x i32], ptr %237, i64 0, i64 %239
  %241 = load i32, ptr %240, align 4, !tbaa !5
  %242 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %241)
  br label %231, !llvm.loop !17

243:                                              ; preds = %231
  ret i32 0
}

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

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

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

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

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@pw = external dso_local local_unnamed_addr global [121 x i32], align 16
@c = external dso_local local_unnamed_addr global [11 x [11 x i32]], align 16
@f = external dso_local local_unnamed_addr global [11 x [11 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 nofree norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
._crit_edge.10:
  store i32 1, ptr @c, align 16, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @c, i64 48), align 16, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @c, i64 44), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @c, i64 96), align 16, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @c, i64 88), align 8, !tbaa !5
  store i32 2, ptr getelementptr inbounds (i8, ptr @c, i64 92), align 4, !tbaa !5
  store <4 x i32> <i32 1, i32 3, i32 3, i32 1>, ptr getelementptr inbounds (i8, ptr @c, i64 132), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @c, i64 192), align 16, !tbaa !5
  store <4 x i32> <i32 1, i32 4, i32 6, i32 4>, ptr getelementptr inbounds (i8, ptr @c, i64 176), align 16, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @c, i64 240), align 16, !tbaa !5
  store <4 x i32> <i32 1, i32 5, i32 10, i32 10>, ptr getelementptr inbounds (i8, ptr @c, i64 220), align 4, !tbaa !5
  store i32 5, ptr getelementptr inbounds (i8, ptr @c, i64 236), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @c, i64 288), align 16, !tbaa !5
  store <4 x i32> <i32 1, i32 6, i32 15, i32 20>, ptr getelementptr inbounds (i8, ptr @c, i64 264), align 8, !tbaa !5
  store i32 15, ptr getelementptr inbounds (i8, ptr @c, i64 280), align 8, !tbaa !5
  store i32 6, ptr getelementptr inbounds (i8, ptr @c, i64 284), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @c, i64 336), align 16, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @c, i64 308), align 4, !tbaa !5
  %0 = load i32, ptr getelementptr inbounds (i8, ptr @c, i64 268), align 4, !tbaa !5
  %1 = icmp sgt i32 %0, 1000000005
  %spec.select.7.v = select i1 %1, i32 -1000000006, i32 1
  %spec.select.7 = add nsw i32 %0, %spec.select.7.v
  store i32 %spec.select.7, ptr getelementptr inbounds (i8, ptr @c, i64 312), align 8, !tbaa !5
  %2 = load <4 x i32>, ptr getelementptr inbounds (i8, ptr @c, i64 272), align 16, !tbaa !5
  %3 = insertelement <4 x i32> poison, i32 %0, i64 0
  %4 = shufflevector <4 x i32> %3, <4 x i32> %2, <4 x i32> <i32 0, i32 4, i32 5, i32 6>
  %5 = add nsw <4 x i32> %2, %4
  %6 = icmp sgt <4 x i32> %5, <i32 1000000006, i32 1000000006, i32 1000000006, i32 1000000006>
  %7 = add nsw <4 x i32> %5, <i32 -1000000007, i32 -1000000007, i32 -1000000007, i32 -1000000007>
  %8 = select <4 x i1> %6, <4 x i32> %7, <4 x i32> %5
  store <4 x i32> %8, ptr getelementptr inbounds (i8, ptr @c, i64 316), align 4, !tbaa !5
  %9 = extractelement <4 x i32> %2, i64 3
  %10 = icmp sgt i32 %9, 1000000005
  %spec.select.7.5.v = select i1 %10, i32 -1000000006, i32 1
  %spec.select.7.5 = add nsw i32 %9, %spec.select.7.5.v
  store i32 %spec.select.7.5, ptr getelementptr inbounds (i8, ptr @c, i64 332), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @c, i64 384), align 16, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @c, i64 352), align 16, !tbaa !5
  %11 = load i32, ptr getelementptr inbounds (i8, ptr @c, i64 312), align 8, !tbaa !5
  %12 = icmp sgt i32 %11, 1000000005
  %spec.select.8.v = select i1 %12, i32 -1000000006, i32 1
  %spec.select.8 = add nsw i32 %11, %spec.select.8.v
  store i32 %spec.select.8, ptr getelementptr inbounds (i8, ptr @c, i64 356), align 4, !tbaa !5
  %13 = load <4 x i32>, ptr getelementptr inbounds (i8, ptr @c, i64 316), align 4, !tbaa !5
  %14 = insertelement <4 x i32> poison, i32 %11, i64 0
  %15 = shufflevector <4 x i32> %14, <4 x i32> %13, <4 x i32> <i32 0, i32 4, i32 5, i32 6>
  %16 = add nsw <4 x i32> %13, %15
  %17 = icmp sgt <4 x i32> %16, <i32 1000000006, i32 1000000006, i32 1000000006, i32 1000000006>
  %18 = add nsw <4 x i32> %16, <i32 -1000000007, i32 -1000000007, i32 -1000000007, i32 -1000000007>
  %19 = select <4 x i1> %17, <4 x i32> %18, <4 x i32> %16
  store <4 x i32> %19, ptr getelementptr inbounds (i8, ptr @c, i64 360), align 8, !tbaa !5
  %20 = load i32, ptr getelementptr inbounds (i8, ptr @c, i64 332), align 4, !tbaa !5
  %21 = extractelement <4 x i32> %13, i64 3
  %22 = add nsw i32 %20, %21
  %23 = icmp sgt i32 %22, 1000000006
  %24 = add nsw i32 %22, -1000000007
  %spec.select.8.5 = select i1 %23, i32 %24, i32 %22
  store i32 %spec.select.8.5, ptr getelementptr inbounds (i8, ptr @c, i64 376), align 8, !tbaa !5
  %25 = icmp sgt i32 %20, 1000000005
  %spec.select.8.6.v = select i1 %25, i32 -1000000006, i32 1
  %spec.select.8.6 = add nsw i32 %20, %spec.select.8.6.v
  store i32 %spec.select.8.6, ptr getelementptr inbounds (i8, ptr @c, i64 380), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @c, i64 432), align 16, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @c, i64 396), align 4, !tbaa !5
  %26 = load i32, ptr getelementptr inbounds (i8, ptr @c, i64 356), align 4, !tbaa !5
  %27 = icmp sgt i32 %26, 1000000005
  %spec.select.9.v = select i1 %27, i32 -1000000006, i32 1
  %spec.select.9 = add nsw i32 %26, %spec.select.9.v
  store i32 %spec.select.9, ptr getelementptr inbounds (i8, ptr @c, i64 400), align 16, !tbaa !5
  %28 = load <4 x i32>, ptr getelementptr inbounds (i8, ptr @c, i64 360), align 8, !tbaa !5
  %29 = insertelement <4 x i32> poison, i32 %26, i64 0
  %30 = shufflevector <4 x i32> %29, <4 x i32> %28, <4 x i32> <i32 0, i32 4, i32 5, i32 6>
  %31 = add nsw <4 x i32> %28, %30
  %32 = icmp sgt <4 x i32> %31, <i32 1000000006, i32 1000000006, i32 1000000006, i32 1000000006>
  %33 = add nsw <4 x i32> %31, <i32 -1000000007, i32 -1000000007, i32 -1000000007, i32 -1000000007>
  %34 = select <4 x i1> %32, <4 x i32> %33, <4 x i32> %31
  store <4 x i32> %34, ptr getelementptr inbounds (i8, ptr @c, i64 404), align 4, !tbaa !5
  %35 = load <2 x i32>, ptr getelementptr inbounds (i8, ptr @c, i64 376), align 8, !tbaa !5
  %36 = shufflevector <4 x i32> %28, <4 x i32> poison, <2 x i32> <i32 3, i32 poison>
  %37 = shufflevector <2 x i32> %36, <2 x i32> %35, <2 x i32> <i32 0, i32 2>
  %38 = add nsw <2 x i32> %35, %37
  %39 = icmp sgt <2 x i32> %38, <i32 1000000006, i32 1000000006>
  %40 = add nsw <2 x i32> %38, <i32 -1000000007, i32 -1000000007>
  %41 = select <2 x i1> %39, <2 x i32> %40, <2 x i32> %38
  store <2 x i32> %41, ptr getelementptr inbounds (i8, ptr @c, i64 420), align 4, !tbaa !5
  %42 = extractelement <2 x i32> %35, i64 1
  %43 = icmp sgt i32 %42, 1000000005
  %spec.select.9.7.v = select i1 %43, i32 -1000000006, i32 1
  %spec.select.9.7 = add nsw i32 %42, %spec.select.9.7.v
  store i32 %spec.select.9.7, ptr getelementptr inbounds (i8, ptr @c, i64 428), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @c, i64 480), align 16, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @c, i64 440), align 8, !tbaa !5
  %44 = load i32, ptr getelementptr inbounds (i8, ptr @c, i64 400), align 16, !tbaa !5
  %45 = icmp sgt i32 %44, 1000000005
  %spec.select.10.v = select i1 %45, i32 -1000000006, i32 1
  %spec.select.10 = add nsw i32 %44, %spec.select.10.v
  store i32 %spec.select.10, ptr getelementptr inbounds (i8, ptr @c, i64 444), align 4, !tbaa !5
  %46 = load <4 x i32>, ptr getelementptr inbounds (i8, ptr @c, i64 404), align 4, !tbaa !5
  %47 = insertelement <4 x i32> poison, i32 %44, i64 0
  %48 = shufflevector <4 x i32> %47, <4 x i32> %46, <4 x i32> <i32 0, i32 4, i32 5, i32 6>
  %49 = add nsw <4 x i32> %46, %48
  %50 = icmp sgt <4 x i32> %49, <i32 1000000006, i32 1000000006, i32 1000000006, i32 1000000006>
  %51 = add nsw <4 x i32> %49, <i32 -1000000007, i32 -1000000007, i32 -1000000007, i32 -1000000007>
  %52 = select <4 x i1> %50, <4 x i32> %51, <4 x i32> %49
  store <4 x i32> %52, ptr getelementptr inbounds (i8, ptr @c, i64 448), align 16, !tbaa !5
  %53 = load <2 x i32>, ptr getelementptr inbounds (i8, ptr @c, i64 420), align 4, !tbaa !5
  %54 = shufflevector <4 x i32> %46, <4 x i32> poison, <2 x i32> <i32 3, i32 poison>
  %55 = shufflevector <2 x i32> %54, <2 x i32> %53, <2 x i32> <i32 0, i32 2>
  %56 = add nsw <2 x i32> %53, %55
  %57 = icmp sgt <2 x i32> %56, <i32 1000000006, i32 1000000006>
  %58 = add nsw <2 x i32> %56, <i32 -1000000007, i32 -1000000007>
  %59 = select <2 x i1> %57, <2 x i32> %58, <2 x i32> %56
  store <2 x i32> %59, ptr getelementptr inbounds (i8, ptr @c, i64 464), align 16, !tbaa !5
  %60 = load i32, ptr getelementptr inbounds (i8, ptr @c, i64 428), align 4, !tbaa !5
  %61 = extractelement <2 x i32> %53, i64 1
  %62 = add nsw i32 %60, %61
  %63 = icmp sgt i32 %62, 1000000006
  %64 = add nsw i32 %62, -1000000007
  %spec.select.10.7 = select i1 %63, i32 %64, i32 %62
  store i32 %spec.select.10.7, ptr getelementptr inbounds (i8, ptr @c, i64 472), align 8, !tbaa !5
  %65 = icmp sgt i32 %60, 1000000005
  %spec.select.10.8.v = select i1 %65, i32 -1000000006, i32 1
  %spec.select.10.8 = add nsw i32 %60, %spec.select.10.8.v
  store i32 %spec.select.10.8, ptr getelementptr inbounds (i8, ptr @c, i64 476), align 4, !tbaa !5
  store i32 1, ptr @pw, align 16, !tbaa !5
  br label %66

66:                                               ; preds = %66, %._crit_edge.10
  %67 = phi i64 [ 1, %._crit_edge.10 ], [ %77, %66 ]
  %indvars.iv = phi i64 [ 1, %._crit_edge.10 ], [ %indvars.iv.next.2, %66 ]
  %68 = mul nsw i64 %67, 3
  %69 = srem i64 %68, 1000000007
  %70 = trunc nsw i64 %69 to i32
  %71 = getelementptr inbounds [121 x i32], ptr @pw, i64 0, i64 %indvars.iv
  store i32 %70, ptr %71, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %72 = mul nsw i64 %69, 3
  %73 = srem i64 %72, 1000000007
  %74 = trunc nsw i64 %73 to i32
  %75 = getelementptr inbounds [121 x i32], ptr @pw, i64 0, i64 %indvars.iv.next
  store i32 %74, ptr %75, align 4, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %76 = mul nsw i64 %73, 3
  %77 = srem i64 %76, 1000000007
  %78 = trunc nsw i64 %77 to i32
  %79 = getelementptr inbounds [121 x i32], ptr @pw, i64 0, i64 %indvars.iv.next.1
  store i32 %78, ptr %79, align 4, !tbaa !5
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
  %exitcond.not.2 = icmp eq i64 %indvars.iv.next.2, 121
  br i1 %exitcond.not.2, label %.preheader66, label %66, !llvm.loop !9

.preheader66:                                     ; preds = %66, %83
  %indvars.iv112 = phi i64 [ %indvars.iv.next113, %83 ], [ 1, %66 ]
  %indvars.iv110 = phi i64 [ %indvars.iv.next111, %83 ], [ 2, %66 ]
  %80 = add nsw i64 %indvars.iv112, -1
  br label %84

.preheader:                                       ; preds = %83
  %81 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %82 = icmp eq i32 %81, 2
  br i1 %82, label %.lr.ph75, label %._crit_edge76

83:                                               ; preds = %149
  %indvars.iv.next113 = add nuw nsw i64 %indvars.iv112, 1
  %indvars.iv.next111 = add nuw nsw i64 %indvars.iv110, 1
  %exitcond117.not = icmp eq i64 %indvars.iv.next113, 11
  br i1 %exitcond117.not, label %.preheader, label %.preheader66, !llvm.loop !11

84:                                               ; preds = %.preheader66, %149
  %indvars.iv104 = phi i64 [ 0, %.preheader66 ], [ %indvars.iv.next105, %149 ]
  %indvars.iv102 = phi i64 [ 1, %.preheader66 ], [ %indvars.iv.next103, %149 ]
  %85 = mul nuw nsw i64 %indvars.iv104, %indvars.iv112
  %86 = getelementptr inbounds [121 x i32], ptr @pw, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = getelementptr inbounds [11 x [11 x i32]], ptr @f, i64 0, i64 %indvars.iv112, i64 %indvars.iv104
  store i32 %87, ptr %88, align 4, !tbaa !5
  br label %.preheader65

.preheader65:                                     ; preds = %84, %.split.us
  %.promoted = phi i32 [ %87, %84 ], [ %119, %.split.us ]
  %indvars.iv95 = phi i64 [ 1, %84 ], [ %indvars.iv.next96, %.split.us ]
  %89 = icmp ult i64 %indvars.iv95, %indvars.iv112
  %90 = add nsw i64 %indvars.iv95, -1
  %91 = getelementptr inbounds [11 x [11 x i32]], ptr @c, i64 0, i64 %80, i64 %90
  %92 = sub nsw i64 %indvars.iv112, %indvars.iv95
  %.fr = freeze i1 %89
  br i1 %.fr, label %.preheader65.split.us, label %.preheader65.split

.preheader65.split.us:                            ; preds = %.preheader65
  %93 = load i32, ptr %91, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  br label %95

95:                                               ; preds = %95, %.preheader65.split.us
  %indvars.iv90 = phi i64 [ %indvars.iv.next91, %95 ], [ 0, %.preheader65.split.us ]
  %96 = phi i32 [ %116, %95 ], [ %.promoted, %.preheader65.split.us ]
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [11 x [11 x i32]], ptr @c, i64 0, i64 %indvars.iv104, i64 %indvars.iv90
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = mul nsw i64 %100, %94
  %102 = srem i64 %101, 1000000007
  %103 = sub nsw i64 %indvars.iv104, %indvars.iv90
  %104 = mul nsw i64 %103, %92
  %105 = getelementptr inbounds [121 x i32], ptr @pw, i64 0, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = mul nsw i64 %102, %107
  %109 = srem i64 %108, 1000000007
  %110 = getelementptr inbounds [11 x [11 x i32]], ptr @f, i64 0, i64 %indvars.iv95, i64 %indvars.iv90
  %111 = load i32, ptr %110, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = mul nsw i64 %109, %112
  %114 = sub nsw i64 %97, %113
  %115 = srem i64 %114, 1000000007
  %116 = trunc nsw i64 %115 to i32
  store i32 %116, ptr %88, align 4, !tbaa !5
  %indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
  %exitcond94.not = icmp eq i64 %indvars.iv.next91, %indvars.iv102
  br i1 %exitcond94.not, label %.split.us, label %95, !llvm.loop !12

117:                                              ; preds = %.split.us
  %118 = icmp slt i32 %119, 0
  br i1 %118, label %147, label %149

.split.us:                                        ; preds = %145, %95
  %119 = phi i32 [ %116, %95 ], [ %146, %145 ]
  %indvars.iv.next96 = add nuw nsw i64 %indvars.iv95, 1
  %exitcond101.not = icmp eq i64 %indvars.iv.next96, %indvars.iv110
  br i1 %exitcond101.not, label %117, label %.preheader65, !llvm.loop !13

.preheader65.split:                               ; preds = %.preheader65, %145
  %120 = phi i32 [ %146, %145 ], [ %.promoted, %.preheader65 ]
  %indvars.iv84 = phi i64 [ %indvars.iv.next85, %145 ], [ 0, %.preheader65 ]
  %121 = icmp ult i64 %indvars.iv84, %indvars.iv104
  br i1 %121, label %122, label %145

122:                                              ; preds = %.preheader65.split
  %123 = sext i32 %120 to i64
  %124 = load i32, ptr %91, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [11 x [11 x i32]], ptr @c, i64 0, i64 %indvars.iv104, i64 %indvars.iv84
  %127 = load i32, ptr %126, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = mul nsw i64 %128, %125
  %130 = srem i64 %129, 1000000007
  %131 = sub nsw i64 %indvars.iv104, %indvars.iv84
  %132 = mul nsw i64 %131, %92
  %133 = getelementptr inbounds [121 x i32], ptr @pw, i64 0, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = mul nsw i64 %130, %135
  %137 = srem i64 %136, 1000000007
  %138 = getelementptr inbounds [11 x [11 x i32]], ptr @f, i64 0, i64 %indvars.iv95, i64 %indvars.iv84
  %139 = load i32, ptr %138, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = mul nsw i64 %137, %140
  %142 = sub nsw i64 %123, %141
  %143 = srem i64 %142, 1000000007
  %144 = trunc nsw i64 %143 to i32
  store i32 %144, ptr %88, align 4, !tbaa !5
  br label %145

145:                                              ; preds = %.preheader65.split, %122
  %146 = phi i32 [ %120, %.preheader65.split ], [ %144, %122 ]
  %indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
  %exitcond89.not = icmp eq i64 %indvars.iv.next85, %indvars.iv102
  br i1 %exitcond89.not, label %.split.us, label %.preheader65.split, !llvm.loop !12

147:                                              ; preds = %117
  %148 = add nsw i32 %119, 1000000007
  store i32 %148, ptr %88, align 4, !tbaa !5
  br label %149

149:                                              ; preds = %117, %147
  %indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
  %indvars.iv.next103 = add nuw nsw i64 %indvars.iv102, 1
  %exitcond109.not = icmp eq i64 %indvars.iv.next105, 11
  br i1 %exitcond109.not, label %83, label %84, !llvm.loop !14

.lr.ph75:                                         ; preds = %.preheader, %.lr.ph75
  %150 = load i32, ptr @n, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %152 = load i32, ptr @m, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [11 x [11 x i32]], ptr @f, i64 0, i64 %151, i64 %153
  %155 = load i32, ptr %154, align 4, !tbaa !5
  %156 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %155)
  %157 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %158 = icmp eq i32 %157, 2
  br i1 %158, label %.lr.ph75, label %._crit_edge76, !llvm.loop !15

._crit_edge76:                                    ; preds = %.lr.ph75, %.preheader
  ret i32 0
}

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

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

attributes #0 = { mustprogress nofree 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 #1 = { 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" }

!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 = distinct !{!14, !10}
!15 = distinct !{!15, !10}


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