; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/264 Division 2/Problem C (C)

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

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@n = external dso_local global i32, align 4
@a = external dso_local global [2000 x [2000 x i32]], align 16
@s1 = external dso_local global [4000 x i64], align 16
@s2 = external dso_local global [4000 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [13 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %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
  store i32 0, ptr %1, align 4
  %13 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %14 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %15 = getelementptr i8, ptr %14, i64 -24
  %16 = load i64, ptr %15, align 8
  %17 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %16
  %18 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %17, ptr noundef null)
  %19 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %20 = getelementptr i8, ptr %19, i64 -24
  %21 = load i64, ptr %20, align 8
  %22 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %21
  %23 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %22, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  store i64 -1, ptr %2, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  store i64 -1, ptr %3, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 -1, ptr %4, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 -1, ptr %5, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 -1, ptr %6, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 -1, ptr %7, align 4, !tbaa !11
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !11
  br label %25

25:                                               ; preds = %81, %0
  %26 = load i32, ptr %8, align 4, !tbaa !11
  %27 = load i32, ptr @n, align 4, !tbaa !11
  %28 = icmp slt i32 %26, %27
  br i1 %28, label %30, label %29

29:                                               ; preds = %25
  store i32 2, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %84

30:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !11
  br label %31

31:                                               ; preds = %77, %30
  %32 = load i32, ptr %10, align 4, !tbaa !11
  %33 = load i32, ptr @n, align 4, !tbaa !11
  %34 = icmp slt i32 %32, %33
  br i1 %34, label %36, label %35

35:                                               ; preds = %31
  store i32 5, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %80

36:                                               ; preds = %31
  %37 = load i32, ptr %8, align 4, !tbaa !11
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [2000 x [2000 x i32]], ptr @a, i64 0, i64 %38
  %40 = load i32, ptr %10, align 4, !tbaa !11
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [2000 x i32], ptr %39, i64 0, i64 %41
  %43 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %42)
  %44 = load i32, ptr %8, align 4, !tbaa !11
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [2000 x [2000 x i32]], ptr @a, i64 0, i64 %45
  %47 = load i32, ptr %10, align 4, !tbaa !11
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [2000 x i32], ptr %46, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !11
  %51 = sext i32 %50 to i64
  %52 = load i32, ptr %8, align 4, !tbaa !11
  %53 = load i32, ptr %10, align 4, !tbaa !11
  %54 = add nsw i32 %52, %53
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [4000 x i64], ptr @s1, i64 0, i64 %55
  %57 = load i64, ptr %56, align 8, !tbaa !8
  %58 = add nsw i64 %57, %51
  store i64 %58, ptr %56, align 8, !tbaa !8
  %59 = load i32, ptr %8, align 4, !tbaa !11
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [2000 x [2000 x i32]], ptr @a, i64 0, i64 %60
  %62 = load i32, ptr %10, align 4, !tbaa !11
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [2000 x i32], ptr %61, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !11
  %66 = sext i32 %65 to i64
  %67 = load i32, ptr %8, align 4, !tbaa !11
  %68 = load i32, ptr %10, align 4, !tbaa !11
  %69 = sub nsw i32 %67, %68
  %70 = load i32, ptr @n, align 4, !tbaa !11
  %71 = add nsw i32 %69, %70
  %72 = sub nsw i32 %71, 1
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [4000 x i64], ptr @s2, i64 0, i64 %73
  %75 = load i64, ptr %74, align 8, !tbaa !8
  %76 = add nsw i64 %75, %66
  store i64 %76, ptr %74, align 8, !tbaa !8
  br label %77

77:                                               ; preds = %36
  %78 = load i32, ptr %10, align 4, !tbaa !11
  %79 = add nsw i32 %78, 1
  store i32 %79, ptr %10, align 4, !tbaa !11
  br label %31, !llvm.loop !13

80:                                               ; preds = %35
  br label %81

81:                                               ; preds = %80
  %82 = load i32, ptr %8, align 4, !tbaa !11
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %8, align 4, !tbaa !11
  br label %25, !llvm.loop !15

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

85:                                               ; preds = %221, %84
  %86 = load i32, ptr %11, align 4, !tbaa !11
  %87 = load i32, ptr @n, align 4, !tbaa !11
  %88 = icmp slt i32 %86, %87
  br i1 %88, label %90, label %89

89:                                               ; preds = %85
  store i32 8, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %224

90:                                               ; preds = %85
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 0, ptr %12, align 4, !tbaa !11
  br label %91

91:                                               ; preds = %217, %90
  %92 = load i32, ptr %12, align 4, !tbaa !11
  %93 = load i32, ptr @n, align 4, !tbaa !11
  %94 = icmp slt i32 %92, %93
  br i1 %94, label %96, label %95

95:                                               ; preds = %91
  store i32 11, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %220

96:                                               ; preds = %91
  %97 = load i32, ptr %11, align 4, !tbaa !11
  %98 = load i32, ptr %12, align 4, !tbaa !11
  %99 = add nsw i32 %97, %98
  %100 = srem i32 %99, 2
  %101 = icmp eq i32 %100, 0
  br i1 %101, label %102, label %159

102:                                              ; preds = %96
  %103 = load i32, ptr %11, align 4, !tbaa !11
  %104 = load i32, ptr %12, align 4, !tbaa !11
  %105 = add nsw i32 %103, %104
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [4000 x i64], ptr @s1, i64 0, i64 %106
  %108 = load i64, ptr %107, align 8, !tbaa !8
  %109 = load i32, ptr %11, align 4, !tbaa !11
  %110 = load i32, ptr %12, align 4, !tbaa !11
  %111 = sub nsw i32 %109, %110
  %112 = load i32, ptr @n, align 4, !tbaa !11
  %113 = add nsw i32 %111, %112
  %114 = sub nsw i32 %113, 1
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [4000 x i64], ptr @s2, i64 0, i64 %115
  %117 = load i64, ptr %116, align 8, !tbaa !8
  %118 = add nsw i64 %108, %117
  %119 = load i32, ptr %11, align 4, !tbaa !11
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [2000 x [2000 x i32]], ptr @a, i64 0, i64 %120
  %122 = load i32, ptr %12, align 4, !tbaa !11
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [2000 x i32], ptr %121, i64 0, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !11
  %126 = sext i32 %125 to i64
  %127 = sub nsw i64 %118, %126
  %128 = load i64, ptr %2, align 8, !tbaa !8
  %129 = icmp sgt i64 %127, %128
  br i1 %129, label %130, label %158

130:                                              ; preds = %102
  %131 = load i32, ptr %11, align 4, !tbaa !11
  %132 = load i32, ptr %12, align 4, !tbaa !11
  %133 = add nsw i32 %131, %132
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [4000 x i64], ptr @s1, i64 0, i64 %134
  %136 = load i64, ptr %135, align 8, !tbaa !8
  %137 = load i32, ptr %11, align 4, !tbaa !11
  %138 = load i32, ptr %12, align 4, !tbaa !11
  %139 = sub nsw i32 %137, %138
  %140 = load i32, ptr @n, align 4, !tbaa !11
  %141 = add nsw i32 %139, %140
  %142 = sub nsw i32 %141, 1
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [4000 x i64], ptr @s2, i64 0, i64 %143
  %145 = load i64, ptr %144, align 8, !tbaa !8
  %146 = add nsw i64 %136, %145
  %147 = load i32, ptr %11, align 4, !tbaa !11
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [2000 x [2000 x i32]], ptr @a, i64 0, i64 %148
  %150 = load i32, ptr %12, align 4, !tbaa !11
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [2000 x i32], ptr %149, i64 0, i64 %151
  %153 = load i32, ptr %152, align 4, !tbaa !11
  %154 = sext i32 %153 to i64
  %155 = sub nsw i64 %146, %154
  store i64 %155, ptr %2, align 8, !tbaa !8
  %156 = load i32, ptr %11, align 4, !tbaa !11
  store i32 %156, ptr %4, align 4, !tbaa !11
  %157 = load i32, ptr %12, align 4, !tbaa !11
  store i32 %157, ptr %6, align 4, !tbaa !11
  br label %158

158:                                              ; preds = %130, %102
  br label %216

159:                                              ; preds = %96
  %160 = load i32, ptr %11, align 4, !tbaa !11
  %161 = load i32, ptr %12, align 4, !tbaa !11
  %162 = add nsw i32 %160, %161
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [4000 x i64], ptr @s1, i64 0, i64 %163
  %165 = load i64, ptr %164, align 8, !tbaa !8
  %166 = load i32, ptr %11, align 4, !tbaa !11
  %167 = load i32, ptr %12, align 4, !tbaa !11
  %168 = sub nsw i32 %166, %167
  %169 = load i32, ptr @n, align 4, !tbaa !11
  %170 = add nsw i32 %168, %169
  %171 = sub nsw i32 %170, 1
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [4000 x i64], ptr @s2, i64 0, i64 %172
  %174 = load i64, ptr %173, align 8, !tbaa !8
  %175 = add nsw i64 %165, %174
  %176 = load i32, ptr %11, align 4, !tbaa !11
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds [2000 x [2000 x i32]], ptr @a, i64 0, i64 %177
  %179 = load i32, ptr %12, align 4, !tbaa !11
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [2000 x i32], ptr %178, i64 0, i64 %180
  %182 = load i32, ptr %181, align 4, !tbaa !11
  %183 = sext i32 %182 to i64
  %184 = sub nsw i64 %175, %183
  %185 = load i64, ptr %3, align 8, !tbaa !8
  %186 = icmp sgt i64 %184, %185
  br i1 %186, label %187, label %215

187:                                              ; preds = %159
  %188 = load i32, ptr %11, align 4, !tbaa !11
  %189 = load i32, ptr %12, align 4, !tbaa !11
  %190 = add nsw i32 %188, %189
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [4000 x i64], ptr @s1, i64 0, i64 %191
  %193 = load i64, ptr %192, align 8, !tbaa !8
  %194 = load i32, ptr %11, align 4, !tbaa !11
  %195 = load i32, ptr %12, align 4, !tbaa !11
  %196 = sub nsw i32 %194, %195
  %197 = load i32, ptr @n, align 4, !tbaa !11
  %198 = add nsw i32 %196, %197
  %199 = sub nsw i32 %198, 1
  %200 = sext i32 %199 to i64
  %201 = getelementptr inbounds [4000 x i64], ptr @s2, i64 0, i64 %200
  %202 = load i64, ptr %201, align 8, !tbaa !8
  %203 = add nsw i64 %193, %202
  %204 = load i32, ptr %11, align 4, !tbaa !11
  %205 = sext i32 %204 to i64
  %206 = getelementptr inbounds [2000 x [2000 x i32]], ptr @a, i64 0, i64 %205
  %207 = load i32, ptr %12, align 4, !tbaa !11
  %208 = sext i32 %207 to i64
  %209 = getelementptr inbounds [2000 x i32], ptr %206, i64 0, i64 %208
  %210 = load i32, ptr %209, align 4, !tbaa !11
  %211 = sext i32 %210 to i64
  %212 = sub nsw i64 %203, %211
  store i64 %212, ptr %3, align 8, !tbaa !8
  %213 = load i32, ptr %11, align 4, !tbaa !11
  store i32 %213, ptr %5, align 4, !tbaa !11
  %214 = load i32, ptr %12, align 4, !tbaa !11
  store i32 %214, ptr %7, align 4, !tbaa !11
  br label %215

215:                                              ; preds = %187, %159
  br label %216

216:                                              ; preds = %215, %158
  br label %217

217:                                              ; preds = %216
  %218 = load i32, ptr %12, align 4, !tbaa !11
  %219 = add nsw i32 %218, 1
  store i32 %219, ptr %12, align 4, !tbaa !11
  br label %91, !llvm.loop !16

220:                                              ; preds = %95
  br label %221

221:                                              ; preds = %220
  %222 = load i32, ptr %11, align 4, !tbaa !11
  %223 = add nsw i32 %222, 1
  store i32 %223, ptr %11, align 4, !tbaa !11
  br label %85, !llvm.loop !17

224:                                              ; preds = %89
  %225 = load i64, ptr %2, align 8, !tbaa !8
  %226 = load i64, ptr %3, align 8, !tbaa !8
  %227 = add nsw i64 %225, %226
  %228 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %227)
  %229 = load i32, ptr %4, align 4, !tbaa !11
  %230 = add nsw i32 %229, 1
  %231 = load i32, ptr %6, align 4, !tbaa !11
  %232 = add nsw i32 %231, 1
  %233 = load i32, ptr %5, align 4, !tbaa !11
  %234 = add nsw i32 %233, 1
  %235 = load i32, ptr %7, align 4, !tbaa !11
  %236 = add nsw i32 %235, 1
  %237 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %230, i32 noundef %232, i32 noundef %234, i32 noundef %236)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  %238 = load i32, ptr %1, align 4
  ret i32 %238
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #1

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #2 align 2

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

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

; 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, ...) #1

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}


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

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@n = external dso_local global i32, align 4
@a = external dso_local global [2000 x [2000 x i32]], align 16
@s1 = external dso_local local_unnamed_addr global [4000 x i64], align 16
@s2 = external dso_local local_unnamed_addr global [4000 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [13 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %2 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %3 = getelementptr i8, ptr %2, i64 -24
  %4 = load i64, ptr %3, align 8
  %5 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %4
  %6 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %5, ptr noundef null)
  %7 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %8 = getelementptr i8, ptr %7, i64 -24
  %9 = load i64, ptr %8, align 8
  %10 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %9
  %11 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %10, ptr noundef null)
  %12 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %13 = load i32, ptr @n, align 4, !tbaa !8
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.preheader81, label %._crit_edge107

.preheader81:                                     ; preds = %0, %._crit_edge
  %15 = phi i32 [ %47, %._crit_edge ], [ %13, %0 ]
  %indvars.iv123 = phi i64 [ %indvars.iv.next124, %._crit_edge ], [ 0, %0 ]
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %.lr.ph, label %.preheader81.._crit_edge_crit_edge

.preheader81.._crit_edge_crit_edge:               ; preds = %.preheader81
  %.pre = sext i32 %15 to i64
  br label %._crit_edge

.lr.ph:                                           ; preds = %.preheader81
  %17 = trunc nuw nsw i64 %indvars.iv123 to i32
  br label %49

.preheader80:                                     ; preds = %._crit_edge
  %18 = icmp sgt i32 %47, 0
  br i1 %18, label %.preheader.lr.ph, label %._crit_edge107

.preheader.lr.ph:                                 ; preds = %.preheader80
  %19 = add nsw i32 %47, -1
  %wide.trip.count137 = zext nneg i32 %47 to i64
  br label %.preheader.us

.preheader.us:                                    ; preds = %._crit_edge93.us, %.preheader.lr.ph
  %indvars.iv134 = phi i64 [ %indvars.iv.next135, %._crit_edge93.us ], [ 0, %.preheader.lr.ph ]
  %.060105.us = phi i32 [ %.2.us, %._crit_edge93.us ], [ -1, %.preheader.lr.ph ]
  %.061104.us = phi i32 [ %.263.us, %._crit_edge93.us ], [ -1, %.preheader.lr.ph ]
  %.064103.us = phi i32 [ %.266.us, %._crit_edge93.us ], [ -1, %.preheader.lr.ph ]
  %.067102.us = phi i32 [ %.269.us, %._crit_edge93.us ], [ -1, %.preheader.lr.ph ]
  %.070101.us = phi i64 [ %.272.us, %._crit_edge93.us ], [ -1, %.preheader.lr.ph ]
  %.073100.us = phi i64 [ %.275.us, %._crit_edge93.us ], [ -1, %.preheader.lr.ph ]
  %20 = trunc nuw nsw i64 %indvars.iv134 to i32
  %21 = add i32 %19, %20
  br label %22

22:                                               ; preds = %.preheader.us, %46
  %indvars.iv128 = phi i64 [ 0, %.preheader.us ], [ %indvars.iv.next129, %46 ]
  %indvars.iv126 = phi i64 [ 0, %.preheader.us ], [ %indvars.iv.next127, %46 ]
  %.189.us = phi i32 [ %.060105.us, %.preheader.us ], [ %.2.us, %46 ]
  %.16288.us = phi i32 [ %.061104.us, %.preheader.us ], [ %.263.us, %46 ]
  %.16587.us = phi i32 [ %.064103.us, %.preheader.us ], [ %.266.us, %46 ]
  %.16886.us = phi i32 [ %.067102.us, %.preheader.us ], [ %.269.us, %46 ]
  %.17185.us = phi i64 [ %.070101.us, %.preheader.us ], [ %.272.us, %46 ]
  %.17484.us = phi i64 [ %.073100.us, %.preheader.us ], [ %.275.us, %46 ]
  %23 = add nuw nsw i64 %indvars.iv128, %indvars.iv134
  %24 = and i64 %23, 1
  %25 = icmp eq i64 %24, 0
  %26 = getelementptr inbounds [4000 x i64], ptr @s1, i64 0, i64 %23
  %27 = load i64, ptr %26, align 8, !tbaa !11
  %28 = trunc nsw i64 %indvars.iv126 to i32
  %29 = add i32 %21, %28
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [4000 x i64], ptr @s2, i64 0, i64 %30
  %32 = load i64, ptr %31, align 8, !tbaa !11
  %33 = add nsw i64 %32, %27
  %34 = getelementptr inbounds [2000 x [2000 x i32]], ptr @a, i64 0, i64 %indvars.iv134, i64 %indvars.iv128
  %35 = load i32, ptr %34, align 4, !tbaa !8
  %36 = sext i32 %35 to i64
  %37 = sub i64 %33, %36
  br i1 %25, label %42, label %38

38:                                               ; preds = %22
  %39 = icmp sgt i64 %37, %.17185.us
  br i1 %39, label %40, label %46

40:                                               ; preds = %38
  %41 = trunc nuw nsw i64 %indvars.iv128 to i32
  br label %46

42:                                               ; preds = %22
  %43 = icmp sgt i64 %37, %.17484.us
  br i1 %43, label %44, label %46

44:                                               ; preds = %42
  %45 = trunc nuw nsw i64 %indvars.iv128 to i32
  br label %46

46:                                               ; preds = %44, %42, %40, %38
  %.275.us = phi i64 [ %37, %44 ], [ %.17484.us, %42 ], [ %.17484.us, %40 ], [ %.17484.us, %38 ]
  %.272.us = phi i64 [ %.17185.us, %44 ], [ %.17185.us, %42 ], [ %37, %40 ], [ %.17185.us, %38 ]
  %.269.us = phi i32 [ %20, %44 ], [ %.16886.us, %42 ], [ %.16886.us, %40 ], [ %.16886.us, %38 ]
  %.266.us = phi i32 [ %.16587.us, %44 ], [ %.16587.us, %42 ], [ %20, %40 ], [ %.16587.us, %38 ]
  %.263.us = phi i32 [ %45, %44 ], [ %.16288.us, %42 ], [ %.16288.us, %40 ], [ %.16288.us, %38 ]
  %.2.us = phi i32 [ %.189.us, %44 ], [ %.189.us, %42 ], [ %41, %40 ], [ %.189.us, %38 ]
  %indvars.iv.next129 = add nuw nsw i64 %indvars.iv128, 1
  %indvars.iv.next127 = add nsw i64 %indvars.iv126, -1
  %exitcond.not = icmp eq i64 %indvars.iv.next129, %wide.trip.count137
  br i1 %exitcond.not, label %._crit_edge93.us, label %22, !llvm.loop !13

._crit_edge93.us:                                 ; preds = %46
  %indvars.iv.next135 = add nuw nsw i64 %indvars.iv134, 1
  %exitcond138.not = icmp eq i64 %indvars.iv.next135, %wide.trip.count137
  br i1 %exitcond138.not, label %._crit_edge107.loopexit, label %.preheader.us, !llvm.loop !15

._crit_edge:                                      ; preds = %49, %.preheader81.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.preheader81.._crit_edge_crit_edge ], [ %67, %49 ]
  %47 = phi i32 [ %15, %.preheader81.._crit_edge_crit_edge ], [ %58, %49 ]
  %indvars.iv.next124 = add nuw nsw i64 %indvars.iv123, 1
  %48 = icmp slt i64 %indvars.iv.next124, %.pre-phi
  br i1 %48, label %.preheader81, label %.preheader80, !llvm.loop !16

49:                                               ; preds = %.lr.ph, %49
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %49 ]
  %50 = getelementptr inbounds [2000 x [2000 x i32]], ptr @a, i64 0, i64 %indvars.iv123, i64 %indvars.iv
  %51 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %50)
  %52 = load i32, ptr %50, align 4, !tbaa !8
  %53 = sext i32 %52 to i64
  %54 = add nuw nsw i64 %indvars.iv, %indvars.iv123
  %55 = getelementptr inbounds [4000 x i64], ptr @s1, i64 0, i64 %54
  %56 = load i64, ptr %55, align 8, !tbaa !11
  %57 = add nsw i64 %56, %53
  store i64 %57, ptr %55, align 8, !tbaa !11
  %58 = load i32, ptr @n, align 4, !tbaa !8
  %59 = trunc nuw nsw i64 %indvars.iv to i32
  %60 = xor i32 %59, -1
  %61 = add nsw i32 %17, %60
  %62 = add i32 %61, %58
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [4000 x i64], ptr @s2, i64 0, i64 %63
  %65 = load i64, ptr %64, align 8, !tbaa !11
  %66 = add nsw i64 %65, %53
  store i64 %66, ptr %64, align 8, !tbaa !11
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %67 = sext i32 %58 to i64
  %68 = icmp slt i64 %indvars.iv.next, %67
  br i1 %68, label %49, label %._crit_edge, !llvm.loop !18

._crit_edge107.loopexit:                          ; preds = %._crit_edge93.us
  %69 = add nsw i64 %.272.us, %.275.us
  %70 = add nsw i32 %.269.us, 1
  %71 = add nsw i32 %.263.us, 1
  %72 = add nsw i32 %.266.us, 1
  %73 = add nsw i32 %.2.us, 1
  br label %._crit_edge107

._crit_edge107:                                   ; preds = %0, %._crit_edge107.loopexit, %.preheader80
  %.067.lcssa = phi i32 [ 0, %.preheader80 ], [ %70, %._crit_edge107.loopexit ], [ 0, %0 ]
  %.064.lcssa = phi i32 [ 0, %.preheader80 ], [ %72, %._crit_edge107.loopexit ], [ 0, %0 ]
  %.061.lcssa = phi i32 [ 0, %.preheader80 ], [ %71, %._crit_edge107.loopexit ], [ 0, %0 ]
  %.060.lcssa = phi i32 [ 0, %.preheader80 ], [ %73, %._crit_edge107.loopexit ], [ 0, %0 ]
  %74 = phi i64 [ -2, %.preheader80 ], [ %69, %._crit_edge107.loopexit ], [ -2, %0 ]
  %75 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %74)
  %76 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.067.lcssa, i32 noundef %.061.lcssa, i32 noundef %.064.lcssa, i32 noundef %.060.lcssa)
  ret i32 0
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #2 align 2

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

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

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

!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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14, !17}
!17 = !{!"llvm.loop.unswitch.partial.disable"}
!18 = distinct !{!18, !14}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass