; LLVM IR from tangjz/acm-icpc :: codeforces/complete (933A)

; 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
@a = external dso_local global [2003 x i32], align 16
@pre = external dso_local global [2003 x [2 x i32]], align 16
@suf = external dso_local global [2003 x [2 x i32]], align 16
@f = external dso_local global [2 x [2 x i32]], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %65, %0
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = load i32, ptr @n, align 4, !tbaa !5
  %21 = icmp sle i32 %19, %20
  br i1 %21, label %23, label %22

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

23:                                               ; preds = %18
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds i32, ptr @a, i64 %25
  %27 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %26)
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [2003 x i32], ptr @a, i64 0, i64 %29
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = add nsw i32 %31, -1
  store i32 %32, ptr %30, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %33

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

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

37:                                               ; preds = %33
  %38 = load i32, ptr %2, align 4, !tbaa !5
  %39 = sub nsw i32 %38, 1
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [2003 x [2 x i32]], ptr @pre, i64 0, i64 %40
  %42 = load i32, ptr %4, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [2 x i32], ptr %41, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = load i32, ptr %4, align 4, !tbaa !5
  %47 = load i32, ptr %2, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [2003 x i32], ptr @a, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = icmp eq i32 %46, %50
  %52 = zext i1 %51 to i32
  %53 = add nsw i32 %45, %52
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %5, i32 noundef %53)
  %54 = load i32, ptr %5, align 4, !tbaa !5
  %55 = load i32, ptr %2, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [2003 x [2 x i32]], ptr @pre, i64 0, i64 %56
  %58 = load i32, ptr %4, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [2 x i32], ptr %57, i64 0, i64 %59
  store i32 %54, ptr %60, align 4, !tbaa !5
  br label %61

61:                                               ; preds = %37
  %62 = load i32, ptr %4, align 4, !tbaa !5
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr %4, align 4, !tbaa !5
  br label %33, !llvm.loop !9

64:                                               ; preds = %36
  br label %65

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

68:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %69 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %69, ptr %6, align 4, !tbaa !5
  br label %70

70:                                               ; preds = %107, %68
  %71 = load i32, ptr %6, align 4, !tbaa !5
  %72 = icmp sge i32 %71, 1
  br i1 %72, label %74, label %73

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

74:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 1, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %75

75:                                               ; preds = %103, %74
  %76 = load i32, ptr %7, align 4, !tbaa !5
  %77 = icmp sge i32 %76, 0
  br i1 %77, label %79, label %78

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

79:                                               ; preds = %75
  %80 = load i32, ptr %6, align 4, !tbaa !5
  %81 = add nsw i32 %80, 1
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [2003 x [2 x i32]], ptr @suf, i64 0, i64 %82
  %84 = load i32, ptr %7, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [2 x i32], ptr %83, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = load i32, ptr %7, align 4, !tbaa !5
  %89 = load i32, ptr %6, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [2003 x i32], ptr @a, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = icmp eq i32 %88, %92
  %94 = zext i1 %93 to i32
  %95 = add nsw i32 %87, %94
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %8, i32 noundef %95)
  %96 = load i32, ptr %8, align 4, !tbaa !5
  %97 = load i32, ptr %6, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [2003 x [2 x i32]], ptr @suf, i64 0, i64 %98
  %100 = load i32, ptr %7, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [2 x i32], ptr %99, i64 0, i64 %101
  store i32 %96, ptr %102, align 4, !tbaa !5
  br label %103

103:                                              ; preds = %79
  %104 = load i32, ptr %7, align 4, !tbaa !5
  %105 = add nsw i32 %104, -1
  store i32 %105, ptr %7, align 4, !tbaa !5
  br label %75, !llvm.loop !12

106:                                              ; preds = %78
  br label %107

107:                                              ; preds = %106
  %108 = load i32, ptr %6, align 4, !tbaa !5
  %109 = add nsw i32 %108, -1
  store i32 %109, ptr %6, align 4, !tbaa !5
  br label %70, !llvm.loop !13

110:                                              ; preds = %73
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %111 = load i32, ptr @n, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [2003 x [2 x i32]], ptr @pre, i64 0, i64 %112
  %114 = getelementptr inbounds [2 x i32], ptr %113, i64 0, i64 1
  %115 = load i32, ptr %114, align 4, !tbaa !5
  store i32 %115, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %116

116:                                              ; preds = %218, %110
  %117 = load i32, ptr %10, align 4, !tbaa !5
  %118 = load i32, ptr @n, align 4, !tbaa !5
  %119 = icmp sle i32 %117, %118
  br i1 %119, label %121, label %120

120:                                              ; preds = %116
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %221

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

122:                                              ; preds = %143, %121
  %123 = load i32, ptr %11, align 4, !tbaa !5
  %124 = icmp slt i32 %123, 2
  br i1 %124, label %126, label %125

125:                                              ; preds = %122
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %146

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

127:                                              ; preds = %139, %126
  %128 = load i32, ptr %12, align 4, !tbaa !5
  %129 = load i32, ptr %11, align 4, !tbaa !5
  %130 = icmp sle i32 %128, %129
  br i1 %130, label %132, label %131

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

132:                                              ; preds = %127
  %133 = load i32, ptr %11, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [2 x [2 x i32]], ptr @f, i64 0, i64 %134
  %136 = load i32, ptr %12, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [2 x i32], ptr %135, i64 0, i64 %137
  store i32 0, ptr %138, align 4, !tbaa !5
  br label %139

139:                                              ; preds = %132
  %140 = load i32, ptr %12, align 4, !tbaa !5
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr %12, align 4, !tbaa !5
  br label %127, !llvm.loop !14

142:                                              ; preds = %131
  br label %143

143:                                              ; preds = %142
  %144 = load i32, ptr %11, align 4, !tbaa !5
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %11, align 4, !tbaa !5
  br label %122, !llvm.loop !15

146:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %147 = load i32, ptr %10, align 4, !tbaa !5
  store i32 %147, ptr %13, align 4, !tbaa !5
  br label %148

148:                                              ; preds = %214, %146
  %149 = load i32, ptr %13, align 4, !tbaa !5
  %150 = load i32, ptr @n, align 4, !tbaa !5
  %151 = icmp sle i32 %149, %150
  br i1 %151, label %153, label %152

152:                                              ; preds = %148
  store i32 23, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %217

153:                                              ; preds = %148
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %154

154:                                              ; preds = %210, %153
  %155 = load i32, ptr %14, align 4, !tbaa !5
  %156 = icmp slt i32 %155, 2
  br i1 %156, label %158, label %157

157:                                              ; preds = %154
  store i32 26, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  br label %213

158:                                              ; preds = %154
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %159 = load i32, ptr %14, align 4, !tbaa !5
  store i32 %159, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %160

160:                                              ; preds = %206, %158
  %161 = load i32, ptr %15, align 4, !tbaa !5
  %162 = icmp sge i32 %161, 0
  br i1 %162, label %164, label %163

163:                                              ; preds = %160
  store i32 29, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  br label %209

164:                                              ; preds = %160
  %165 = load i32, ptr %14, align 4, !tbaa !5
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [2 x [2 x i32]], ptr @f, i64 0, i64 %166
  %168 = load i32, ptr %15, align 4, !tbaa !5
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [2 x i32], ptr %167, i64 0, i64 %169
  %171 = load i32, ptr %170, align 4, !tbaa !5
  %172 = load i32, ptr %15, align 4, !tbaa !5
  %173 = load i32, ptr %13, align 4, !tbaa !5
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [2003 x i32], ptr @a, i64 0, i64 %174
  %176 = load i32, ptr %175, align 4, !tbaa !5
  %177 = icmp eq i32 %172, %176
  %178 = zext i1 %177 to i32
  %179 = add nsw i32 %171, %178
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %16, i32 noundef %179)
  %180 = load i32, ptr %16, align 4, !tbaa !5
  %181 = load i32, ptr %14, align 4, !tbaa !5
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [2 x [2 x i32]], ptr @f, i64 0, i64 %182
  %184 = load i32, ptr %15, align 4, !tbaa !5
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [2 x i32], ptr %183, i64 0, i64 %185
  store i32 %180, ptr %186, align 4, !tbaa !5
  %187 = load i32, ptr %10, align 4, !tbaa !5
  %188 = sub nsw i32 %187, 1
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [2003 x [2 x i32]], ptr @pre, i64 0, i64 %189
  %191 = load i32, ptr %15, align 4, !tbaa !5
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds [2 x i32], ptr %190, i64 0, i64 %192
  %194 = load i32, ptr %193, align 4, !tbaa !5
  %195 = load i32, ptr %16, align 4, !tbaa !5
  %196 = add nsw i32 %194, %195
  %197 = load i32, ptr %13, align 4, !tbaa !5
  %198 = add nsw i32 %197, 1
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [2003 x [2 x i32]], ptr @suf, i64 0, i64 %199
  %201 = load i32, ptr %14, align 4, !tbaa !5
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds [2 x i32], ptr %200, i64 0, i64 %202
  %204 = load i32, ptr %203, align 4, !tbaa !5
  %205 = add nsw i32 %196, %204
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %9, i32 noundef %205)
  br label %206

206:                                              ; preds = %164
  %207 = load i32, ptr %15, align 4, !tbaa !5
  %208 = add nsw i32 %207, -1
  store i32 %208, ptr %15, align 4, !tbaa !5
  br label %160, !llvm.loop !16

209:                                              ; preds = %163
  br label %210

210:                                              ; preds = %209
  %211 = load i32, ptr %14, align 4, !tbaa !5
  %212 = add nsw i32 %211, 1
  store i32 %212, ptr %14, align 4, !tbaa !5
  br label %154, !llvm.loop !17

213:                                              ; preds = %157
  br label %214

214:                                              ; preds = %213
  %215 = load i32, ptr %13, align 4, !tbaa !5
  %216 = add nsw i32 %215, 1
  store i32 %216, ptr %13, align 4, !tbaa !5
  br label %148, !llvm.loop !18

217:                                              ; preds = %152
  br label %218

218:                                              ; preds = %217
  %219 = load i32, ptr %10, align 4, !tbaa !5
  %220 = add nsw i32 %219, 1
  store i32 %220, ptr %10, align 4, !tbaa !5
  br label %116, !llvm.loop !19

221:                                              ; preds = %120
  %222 = load i32, ptr %9, align 4, !tbaa !5
  %223 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %222)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  %224 = load i32, ptr %1, align 4
  ret i32 %224
}

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

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

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = 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}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !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
@a = external dso_local global [2003 x i32], align 16
@pre = external dso_local local_unnamed_addr global [2003 x [2 x i32]], align 16
@suf = external dso_local local_unnamed_addr global [2003 x [2 x i32]], align 16
@f = external dso_local local_unnamed_addr global [2 x [2 x i32]], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %.not68 = icmp slt i32 %6, 1
  br i1 %.not68, label %._crit_edge.thread, label %.lr.ph

.preheader66:                                     ; preds = %.lr.ph
  %7 = icmp sgt i32 %29, 0
  br i1 %7, label %.lr.ph72.preheader, label %._crit_edge.thread

.lr.ph72.preheader:                               ; preds = %.preheader66
  %8 = zext nneg i32 %29 to i64
  br label %.lr.ph72

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %9 = getelementptr inbounds i32, ptr @a, i64 %indvars.iv
  %10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %9)
  %11 = load i32, ptr %9, align 4, !tbaa !5
  %12 = add nsw i32 %11, -1
  store i32 %12, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  store i32 0, ptr %1, align 4, !tbaa !5
  %13 = add nsw i64 %indvars.iv, -1
  %14 = getelementptr inbounds [2003 x [2 x i32]], ptr @pre, i64 0, i64 %13, i64 0
  %15 = load i32, ptr %14, align 8, !tbaa !5
  %16 = icmp eq i32 %12, 0
  %17 = zext i1 %16 to i32
  %18 = add nsw i32 %15, %17
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %1, i32 noundef %18)
  %19 = load i32, ptr %1, align 4, !tbaa !5
  %20 = getelementptr inbounds [2003 x [2 x i32]], ptr @pre, i64 0, i64 %indvars.iv, i64 0
  store i32 %19, ptr %20, align 8, !tbaa !5
  %21 = getelementptr inbounds [2003 x [2 x i32]], ptr @pre, i64 0, i64 %13, i64 1
  %22 = load i32, ptr %21, align 4, !tbaa !5
  %23 = load i32, ptr %9, align 4, !tbaa !5
  %24 = icmp eq i32 %23, 1
  %25 = zext i1 %24 to i32
  %26 = add nsw i32 %22, %25
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %1, i32 noundef %26)
  %27 = load i32, ptr %1, align 4, !tbaa !5
  %28 = getelementptr inbounds [2003 x [2 x i32]], ptr @pre, i64 0, i64 %indvars.iv, i64 1
  store i32 %27, ptr %28, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %29 = load i32, ptr @n, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %.not.not = icmp slt i64 %indvars.iv, %30
  br i1 %.not.not, label %.lr.ph, label %.preheader66, !llvm.loop !9

._crit_edge.thread:                               ; preds = %.preheader66, %0
  %.ph = phi i32 [ %29, %.preheader66 ], [ %6, %0 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %31 = sext i32 %.ph to i64
  %32 = getelementptr inbounds [2003 x [2 x i32]], ptr @pre, i64 0, i64 %31, i64 1
  %33 = load i32, ptr %32, align 4, !tbaa !5
  store i32 %33, ptr %3, align 4, !tbaa !5
  br label %._crit_edge82

._crit_edge:                                      ; preds = %.lr.ph72
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %34 = sext i32 %.pre to i64
  %35 = getelementptr inbounds [2003 x [2 x i32]], ptr @pre, i64 0, i64 %34, i64 1
  %36 = load i32, ptr %35, align 4, !tbaa !5
  store i32 %36, ptr %3, align 4, !tbaa !5
  %.not6080 = icmp slt i32 %.pre, 1
  br i1 %.not6080, label %._crit_edge82, label %.preheader65

.lr.ph72:                                         ; preds = %.lr.ph72.preheader, %.lr.ph72
  %indvars.iv89 = phi i64 [ %8, %.lr.ph72.preheader ], [ %indvars.iv.next90, %.lr.ph72 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  store i32 0, ptr %2, align 4, !tbaa !5
  %37 = add nuw nsw i64 %indvars.iv89, 1
  %38 = getelementptr inbounds [2003 x i32], ptr @a, i64 0, i64 %indvars.iv89
  %39 = getelementptr inbounds [2003 x [2 x i32]], ptr @suf, i64 0, i64 %37, i64 1
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = load i32, ptr %38, align 4, !tbaa !5
  %42 = icmp eq i32 %41, 1
  %43 = zext i1 %42 to i32
  %44 = add nsw i32 %40, %43
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %2, i32 noundef %44)
  %45 = load i32, ptr %2, align 4, !tbaa !5
  %46 = getelementptr inbounds [2003 x [2 x i32]], ptr @suf, i64 0, i64 %indvars.iv89, i64 1
  store i32 %45, ptr %46, align 4, !tbaa !5
  %47 = getelementptr inbounds [2003 x [2 x i32]], ptr @suf, i64 0, i64 %37, i64 0
  %48 = load i32, ptr %47, align 8, !tbaa !5
  %49 = load i32, ptr %38, align 4, !tbaa !5
  %50 = icmp eq i32 %49, 0
  %51 = zext i1 %50 to i32
  %52 = add nsw i32 %48, %51
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %2, i32 noundef %52)
  %53 = load i32, ptr %2, align 4, !tbaa !5
  %54 = getelementptr inbounds [2003 x [2 x i32]], ptr @suf, i64 0, i64 %indvars.iv89, i64 0
  store i32 %53, ptr %54, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  %indvars.iv.next90 = add nsw i64 %indvars.iv89, -1
  %55 = icmp ugt i64 %indvars.iv89, 1
  br i1 %55, label %.lr.ph72, label %._crit_edge, !llvm.loop !11

.preheader65:                                     ; preds = %._crit_edge, %._crit_edge79
  %56 = phi i32 [ %98, %._crit_edge79 ], [ %.pre, %._crit_edge ]
  %indvars.iv102 = phi i64 [ %indvars.iv.next103, %._crit_edge79 ], [ 1, %._crit_edge ]
  store i32 0, ptr @f, align 16
  store i64 0, ptr getelementptr inbounds (i8, ptr @f, i64 8), align 8
  %57 = sext i32 %56 to i64
  %.not6177 = icmp sgt i64 %indvars.iv102, %57
  br i1 %.not6177, label %._crit_edge79, label %.preheader.lr.ph

._crit_edge82.loopexit:                           ; preds = %._crit_edge79
  %.pre108 = load i32, ptr %3, align 4, !tbaa !5
  br label %._crit_edge82

._crit_edge82:                                    ; preds = %._crit_edge.thread, %._crit_edge82.loopexit, %._crit_edge
  %58 = phi i32 [ %.pre108, %._crit_edge82.loopexit ], [ %36, %._crit_edge ], [ %33, %._crit_edge.thread ]
  %59 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %58)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  ret i32 0

.preheader.lr.ph:                                 ; preds = %.preheader65
  %60 = add nsw i64 %indvars.iv102, -1
  %61 = getelementptr inbounds [2003 x [2 x i32]], ptr @pre, i64 0, i64 %60, i64 0
  %62 = getelementptr inbounds [2003 x [2 x i32]], ptr @pre, i64 0, i64 %60, i64 1
  br label %.preheader

.preheader:                                       ; preds = %.preheader.lr.ph, %.preheader
  %indvars.iv104 = phi i64 [ %indvars.iv102, %.preheader.lr.ph ], [ %indvars.iv.next105, %.preheader ]
  %63 = getelementptr inbounds [2003 x i32], ptr @a, i64 0, i64 %indvars.iv104
  %indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  store i32 0, ptr %4, align 4, !tbaa !5
  %64 = getelementptr inbounds [2003 x [2 x i32]], ptr @suf, i64 0, i64 %indvars.iv.next105, i64 0
  %65 = load i32, ptr @f, align 16, !tbaa !5
  %66 = load i32, ptr %63, align 4, !tbaa !5
  %67 = icmp eq i32 %66, 0
  %68 = zext i1 %67 to i32
  %69 = add nsw i32 %65, %68
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %4, i32 noundef %69)
  %70 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %70, ptr @f, align 16, !tbaa !5
  %71 = load i32, ptr %61, align 8, !tbaa !5
  %72 = add nsw i32 %71, %70
  %73 = load i32, ptr %64, align 8, !tbaa !5
  %74 = add nsw i32 %72, %73
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %3, i32 noundef %74)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  store i32 0, ptr %4, align 4, !tbaa !5
  %75 = getelementptr inbounds [2003 x [2 x i32]], ptr @suf, i64 0, i64 %indvars.iv.next105, i64 1
  %76 = load i32, ptr getelementptr inbounds (i8, ptr @f, i64 12), align 4, !tbaa !5
  %77 = load i32, ptr %63, align 4, !tbaa !5
  %78 = icmp eq i32 %77, 1
  %79 = zext i1 %78 to i32
  %80 = add nsw i32 %76, %79
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %4, i32 noundef %80)
  %81 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %81, ptr getelementptr inbounds (i8, ptr @f, i64 12), align 4, !tbaa !5
  %82 = load i32, ptr %62, align 4, !tbaa !5
  %83 = add nsw i32 %82, %81
  %84 = load i32, ptr %75, align 4, !tbaa !5
  %85 = add nsw i32 %83, %84
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %3, i32 noundef %85)
  %86 = load i32, ptr getelementptr inbounds (i8, ptr @f, i64 8), align 8, !tbaa !5
  %87 = load i32, ptr %63, align 4, !tbaa !5
  %88 = icmp eq i32 %87, 0
  %89 = zext i1 %88 to i32
  %90 = add nsw i32 %86, %89
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %4, i32 noundef %90)
  %91 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %91, ptr getelementptr inbounds (i8, ptr @f, i64 8), align 8, !tbaa !5
  %92 = load i32, ptr %61, align 8, !tbaa !5
  %93 = add nsw i32 %92, %91
  %94 = load i32, ptr %75, align 4, !tbaa !5
  %95 = add nsw i32 %93, %94
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %3, i32 noundef %95)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  %96 = load i32, ptr @n, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %.not61.not = icmp slt i64 %indvars.iv104, %97
  br i1 %.not61.not, label %.preheader, label %._crit_edge79, !llvm.loop !12

._crit_edge79:                                    ; preds = %.preheader, %.preheader65
  %.pre-phi = phi i64 [ %57, %.preheader65 ], [ %97, %.preheader ]
  %98 = phi i32 [ %56, %.preheader65 ], [ %96, %.preheader ]
  %indvars.iv.next103 = add nuw nsw i64 %indvars.iv102, 1
  %.not60.not = icmp slt i64 %indvars.iv102, %.pre-phi
  br i1 %.not60.not, label %.preheader65, label %._crit_edge82.loopexit, !llvm.loop !13
}

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

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

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

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

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


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