; LLVM IR from eyangch/competitive-programming :: Codeforces/1770 (a)

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

@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@A = external dso_local global [1000 x i64], align 16
@B = external dso_local global [1000 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; 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 i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %11 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %12 = getelementptr i8, ptr %11, i64 -24
  %13 = load i64, ptr %12, align 8
  %14 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %13
  %15 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %14, ptr noundef null)
  %16 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %17 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @T)
  br label %18

18:                                               ; preds = %101, %0
  %19 = load i64, ptr @T, align 8, !tbaa !8
  %20 = add nsw i64 %19, -1
  store i64 %20, ptr @T, align 8, !tbaa !8
  %21 = icmp ne i64 %19, 0
  br i1 %21, label %22, label %105

22:                                               ; preds = %18
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef nonnull align 8 dereferenceable(8) @M)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  store i64 0, ptr %2, align 8, !tbaa !8
  br label %25

25:                                               ; preds = %34, %22
  %26 = load i64, ptr %2, align 8, !tbaa !8
  %27 = load i64, ptr @N, align 8, !tbaa !8
  %28 = icmp slt i64 %26, %27
  br i1 %28, label %30, label %29

29:                                               ; preds = %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  br label %37

30:                                               ; preds = %25
  %31 = load i64, ptr %2, align 8, !tbaa !8
  %32 = getelementptr inbounds [1000 x i64], ptr @A, i64 0, i64 %31
  %33 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %32)
  br label %34

34:                                               ; preds = %30
  %35 = load i64, ptr %2, align 8, !tbaa !8
  %36 = add nsw i64 %35, 1
  store i64 %36, ptr %2, align 8, !tbaa !8
  br label %25, !llvm.loop !11

37:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  store i64 0, ptr %3, align 8, !tbaa !8
  br label %38

38:                                               ; preds = %47, %37
  %39 = load i64, ptr %3, align 8, !tbaa !8
  %40 = load i64, ptr @M, align 8, !tbaa !8
  %41 = icmp slt i64 %39, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  br label %50

43:                                               ; preds = %38
  %44 = load i64, ptr %3, align 8, !tbaa !8
  %45 = getelementptr inbounds [1000 x i64], ptr @B, i64 0, i64 %44
  %46 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %45)
  br label %47

47:                                               ; preds = %43
  %48 = load i64, ptr %3, align 8, !tbaa !8
  %49 = add nsw i64 %48, 1
  store i64 %49, ptr %3, align 8, !tbaa !8
  br label %38, !llvm.loop !13

50:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  store i64 0, ptr %4, align 8, !tbaa !8
  br label %51

51:                                               ; preds = %83, %50
  %52 = load i64, ptr %4, align 8, !tbaa !8
  %53 = load i64, ptr @M, align 8, !tbaa !8
  %54 = icmp slt i64 %52, %53
  br i1 %54, label %56, label %55

55:                                               ; preds = %51
  store i32 10, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  br label %86

56:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  store i64 1000000000000000, ptr %6, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  store i64 0, ptr %7, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store i64 0, ptr %8, align 8, !tbaa !8
  br label %57

57:                                               ; preds = %74, %56
  %58 = load i64, ptr %8, align 8, !tbaa !8
  %59 = load i64, ptr @N, align 8, !tbaa !8
  %60 = icmp slt i64 %58, %59
  br i1 %60, label %62, label %61

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

62:                                               ; preds = %57
  %63 = load i64, ptr %8, align 8, !tbaa !8
  %64 = getelementptr inbounds [1000 x i64], ptr @A, i64 0, i64 %63
  %65 = load i64, ptr %64, align 8, !tbaa !8
  %66 = load i64, ptr %6, align 8, !tbaa !8
  %67 = icmp slt i64 %65, %66
  br i1 %67, label %68, label %73

68:                                               ; preds = %62
  %69 = load i64, ptr %8, align 8, !tbaa !8
  %70 = getelementptr inbounds [1000 x i64], ptr @A, i64 0, i64 %69
  %71 = load i64, ptr %70, align 8, !tbaa !8
  store i64 %71, ptr %6, align 8, !tbaa !8
  %72 = load i64, ptr %8, align 8, !tbaa !8
  store i64 %72, ptr %7, align 8, !tbaa !8
  br label %73

73:                                               ; preds = %68, %62
  br label %74

74:                                               ; preds = %73
  %75 = load i64, ptr %8, align 8, !tbaa !8
  %76 = add nsw i64 %75, 1
  store i64 %76, ptr %8, align 8, !tbaa !8
  br label %57, !llvm.loop !14

77:                                               ; preds = %61
  %78 = load i64, ptr %4, align 8, !tbaa !8
  %79 = getelementptr inbounds [1000 x i64], ptr @B, i64 0, i64 %78
  %80 = load i64, ptr %79, align 8, !tbaa !8
  %81 = load i64, ptr %7, align 8, !tbaa !8
  %82 = getelementptr inbounds [1000 x i64], ptr @A, i64 0, i64 %81
  store i64 %80, ptr %82, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %83

83:                                               ; preds = %77
  %84 = load i64, ptr %4, align 8, !tbaa !8
  %85 = add nsw i64 %84, 1
  store i64 %85, ptr %4, align 8, !tbaa !8
  br label %51, !llvm.loop !15

86:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  store i64 0, ptr %9, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store i64 0, ptr %10, align 8, !tbaa !8
  br label %87

87:                                               ; preds = %98, %86
  %88 = load i64, ptr %10, align 8, !tbaa !8
  %89 = load i64, ptr @N, align 8, !tbaa !8
  %90 = icmp slt i64 %88, %89
  br i1 %90, label %92, label %91

91:                                               ; preds = %87
  store i32 16, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %101

92:                                               ; preds = %87
  %93 = load i64, ptr %10, align 8, !tbaa !8
  %94 = getelementptr inbounds [1000 x i64], ptr @A, i64 0, i64 %93
  %95 = load i64, ptr %94, align 8, !tbaa !8
  %96 = load i64, ptr %9, align 8, !tbaa !8
  %97 = add nsw i64 %96, %95
  store i64 %97, ptr %9, align 8, !tbaa !8
  br label %98

98:                                               ; preds = %92
  %99 = load i64, ptr %10, align 8, !tbaa !8
  %100 = add nsw i64 %99, 1
  store i64 %100, ptr %10, align 8, !tbaa !8
  br label %87, !llvm.loop !16

101:                                              ; preds = %91
  %102 = load i64, ptr %9, align 8, !tbaa !8
  %103 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %102)
  %104 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %103, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %18, !llvm.loop !17

105:                                              ; preds = %18
  %106 = load i32, ptr %1, align 4
  ret i32 %106
}

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #3 align 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 = { 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 #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 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}


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

@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@A = external dso_local global [1000 x i64], align 16
@B = external dso_local global [1000 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %2 = getelementptr i8, ptr %1, i64 -24
  %3 = load i64, ptr %2, align 8
  %4 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %3
  %5 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %4, ptr noundef null)
  %6 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %7 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @T)
  %8 = load i64, ptr @T, align 8, !tbaa !8
  %9 = add nsw i64 %8, -1
  store i64 %9, ptr @T, align 8, !tbaa !8
  %.not50 = icmp eq i64 %8, 0
  br i1 %.not50, label %._crit_edge53, label %.lr.ph52

.lr.ph52:                                         ; preds = %0, %._crit_edge
  %10 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %11 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 8 dereferenceable(8) @M)
  %12 = load i64, ptr @N, align 8, !tbaa !8
  %13 = icmp sgt i64 %12, 0
  br i1 %13, label %.lr.ph, label %.preheader34

.preheader34:                                     ; preds = %.lr.ph, %.lr.ph52
  %.pre59 = phi i64 [ %12, %.lr.ph52 ], [ %19, %.lr.ph ]
  %14 = load i64, ptr @M, align 8, !tbaa !8
  %15 = icmp sgt i64 %14, 0
  br i1 %15, label %.lr.ph37, label %.preheader32

.lr.ph:                                           ; preds = %.lr.ph52, %.lr.ph
  %.02935 = phi i64 [ %18, %.lr.ph ], [ 0, %.lr.ph52 ]
  %16 = getelementptr inbounds [1000 x i64], ptr @A, i64 0, i64 %.02935
  %17 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %16)
  %18 = add nuw nsw i64 %.02935, 1
  %19 = load i64, ptr @N, align 8, !tbaa !8
  %20 = icmp slt i64 %18, %19
  br i1 %20, label %.lr.ph, label %.preheader34, !llvm.loop !11

.preheader33:                                     ; preds = %.lr.ph37
  %.pre.pre = load i64, ptr @N, align 8, !tbaa !8
  %21 = icmp sgt i64 %54, 0
  br i1 %21, label %.preheader.lr.ph, label %.preheader32

.preheader.lr.ph:                                 ; preds = %.preheader33
  %22 = icmp sgt i64 %.pre.pre, 0
  br i1 %22, label %.preheader.us.preheader, label %.preheader32.thread

.preheader.us.preheader:                          ; preds = %.preheader.lr.ph
  %xtraiter = and i64 %.pre.pre, 3
  %23 = icmp ult i64 %.pre.pre, 4
  %unroll_iter = and i64 %.pre.pre, 9223372036854775804
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader.us

.preheader32.thread:                              ; preds = %.preheader.lr.ph
  %24 = add nsw i64 %54, -1
  %25 = getelementptr inbounds [1000 x i64], ptr @B, i64 0, i64 %24
  %26 = load i64, ptr %25, align 8, !tbaa !8
  store i64 %26, ptr @A, align 16, !tbaa !8
  br label %._crit_edge

.preheader.us:                                    ; preds = %.preheader.us.preheader, %._crit_edge.us
  %.02743.us = phi i64 [ %50, %._crit_edge.us ], [ 0, %.preheader.us.preheader ]
  br i1 %23, label %._crit_edge.us.unr-lcssa, label %.preheader.us.new

.preheader.us.new:                                ; preds = %.preheader.us, %.preheader.us.new
  %.02340.us = phi i64 [ %42, %.preheader.us.new ], [ 0, %.preheader.us ]
  %.02439.us = phi i64 [ %spec.select31.us.3, %.preheader.us.new ], [ 0, %.preheader.us ]
  %.02538.us = phi i64 [ %spec.select.us.3, %.preheader.us.new ], [ 1000000000000000, %.preheader.us ]
  %niter = phi i64 [ %niter.next.3, %.preheader.us.new ], [ 0, %.preheader.us ]
  %27 = getelementptr inbounds [1000 x i64], ptr @A, i64 0, i64 %.02340.us
  %28 = load i64, ptr %27, align 16, !tbaa !8
  %29 = icmp slt i64 %28, %.02538.us
  %spec.select.us = tail call i64 @llvm.smin.i64(i64 %28, i64 %.02538.us)
  %spec.select31.us = select i1 %29, i64 %.02340.us, i64 %.02439.us
  %30 = or disjoint i64 %.02340.us, 1
  %31 = getelementptr inbounds [1000 x i64], ptr @A, i64 0, i64 %30
  %32 = load i64, ptr %31, align 8, !tbaa !8
  %33 = icmp slt i64 %32, %spec.select.us
  %spec.select.us.1 = tail call i64 @llvm.smin.i64(i64 %32, i64 %spec.select.us)
  %spec.select31.us.1 = select i1 %33, i64 %30, i64 %spec.select31.us
  %34 = or disjoint i64 %.02340.us, 2
  %35 = getelementptr inbounds [1000 x i64], ptr @A, i64 0, i64 %34
  %36 = load i64, ptr %35, align 16, !tbaa !8
  %37 = icmp slt i64 %36, %spec.select.us.1
  %spec.select.us.2 = tail call i64 @llvm.smin.i64(i64 %36, i64 %spec.select.us.1)
  %spec.select31.us.2 = select i1 %37, i64 %34, i64 %spec.select31.us.1
  %38 = or disjoint i64 %.02340.us, 3
  %39 = getelementptr inbounds [1000 x i64], ptr @A, i64 0, i64 %38
  %40 = load i64, ptr %39, align 8, !tbaa !8
  %41 = icmp slt i64 %40, %spec.select.us.2
  %spec.select.us.3 = tail call i64 @llvm.smin.i64(i64 %40, i64 %spec.select.us.2)
  %spec.select31.us.3 = select i1 %41, i64 %38, i64 %spec.select31.us.2
  %42 = add nuw nsw i64 %.02340.us, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.us.unr-lcssa, label %.preheader.us.new, !llvm.loop !13

._crit_edge.us.unr-lcssa:                         ; preds = %.preheader.us.new, %.preheader.us
  %spec.select31.us.lcssa.ph = phi i64 [ poison, %.preheader.us ], [ %spec.select31.us.3, %.preheader.us.new ]
  %.02340.us.unr = phi i64 [ 0, %.preheader.us ], [ %42, %.preheader.us.new ]
  %.02439.us.unr = phi i64 [ 0, %.preheader.us ], [ %spec.select31.us.3, %.preheader.us.new ]
  %.02538.us.unr = phi i64 [ 1000000000000000, %.preheader.us ], [ %spec.select.us.3, %.preheader.us.new ]
  br i1 %lcmp.mod.not, label %._crit_edge.us, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge.us.unr-lcssa, %.epil.preheader
  %.02340.us.epil = phi i64 [ %46, %.epil.preheader ], [ %.02340.us.unr, %._crit_edge.us.unr-lcssa ]
  %.02439.us.epil = phi i64 [ %spec.select31.us.epil, %.epil.preheader ], [ %.02439.us.unr, %._crit_edge.us.unr-lcssa ]
  %.02538.us.epil = phi i64 [ %spec.select.us.epil, %.epil.preheader ], [ %.02538.us.unr, %._crit_edge.us.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %._crit_edge.us.unr-lcssa ]
  %43 = getelementptr inbounds [1000 x i64], ptr @A, i64 0, i64 %.02340.us.epil
  %44 = load i64, ptr %43, align 8, !tbaa !8
  %45 = icmp slt i64 %44, %.02538.us.epil
  %spec.select.us.epil = tail call i64 @llvm.smin.i64(i64 %44, i64 %.02538.us.epil)
  %spec.select31.us.epil = select i1 %45, i64 %.02340.us.epil, i64 %.02439.us.epil
  %46 = add nuw nsw i64 %.02340.us.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge.us, label %.epil.preheader, !llvm.loop !14

._crit_edge.us:                                   ; preds = %.epil.preheader, %._crit_edge.us.unr-lcssa
  %spec.select31.us.lcssa = phi i64 [ %spec.select31.us.lcssa.ph, %._crit_edge.us.unr-lcssa ], [ %spec.select31.us.epil, %.epil.preheader ]
  %47 = getelementptr inbounds [1000 x i64], ptr @B, i64 0, i64 %.02743.us
  %48 = load i64, ptr %47, align 8, !tbaa !8
  %49 = getelementptr inbounds [1000 x i64], ptr @A, i64 0, i64 %spec.select31.us.lcssa
  store i64 %48, ptr %49, align 8, !tbaa !8
  %50 = add nuw nsw i64 %.02743.us, 1
  %exitcond56.not = icmp eq i64 %50, %54
  br i1 %exitcond56.not, label %.preheader32, label %.preheader.us, !llvm.loop !16

.lr.ph37:                                         ; preds = %.preheader34, %.lr.ph37
  %.02836 = phi i64 [ %53, %.lr.ph37 ], [ 0, %.preheader34 ]
  %51 = getelementptr inbounds [1000 x i64], ptr @B, i64 0, i64 %.02836
  %52 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %51)
  %53 = add nuw nsw i64 %.02836, 1
  %54 = load i64, ptr @M, align 8, !tbaa !8
  %55 = icmp slt i64 %53, %54
  br i1 %55, label %.lr.ph37, label %.preheader33, !llvm.loop !17

.preheader32:                                     ; preds = %._crit_edge.us, %.preheader34, %.preheader33
  %.pre62 = phi i64 [ %.pre.pre, %.preheader33 ], [ %.pre59, %.preheader34 ], [ %.pre.pre, %._crit_edge.us ]
  %56 = icmp sgt i64 %.pre62, 0
  br i1 %56, label %.lr.ph48.preheader, label %._crit_edge

.lr.ph48.preheader:                               ; preds = %.preheader32
  %min.iters.check = icmp ult i64 %.pre62, 4
  br i1 %min.iters.check, label %.lr.ph48.preheader70, label %vector.ph

.lr.ph48.preheader70:                             ; preds = %middle.block, %.lr.ph48.preheader
  %.047.ph = phi i64 [ 0, %.lr.ph48.preheader ], [ %n.vec, %middle.block ]
  %.02246.ph = phi i64 [ 0, %.lr.ph48.preheader ], [ %62, %middle.block ]
  br label %.lr.ph48

vector.ph:                                        ; preds = %.lr.ph48.preheader
  %n.vec = and i64 %.pre62, 9223372036854775804
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %59, %vector.body ]
  %vec.phi68 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %60, %vector.body ]
  %57 = getelementptr inbounds [1000 x i64], ptr @A, i64 0, i64 %index
  %58 = getelementptr inbounds i8, ptr %57, i64 16
  %wide.load = load <2 x i64>, ptr %57, align 16, !tbaa !8
  %wide.load69 = load <2 x i64>, ptr %58, align 16, !tbaa !8
  %59 = add <2 x i64> %wide.load, %vec.phi
  %60 = add <2 x i64> %wide.load69, %vec.phi68
  %index.next = add nuw i64 %index, 4
  %61 = icmp eq i64 %index.next, %n.vec
  br i1 %61, label %middle.block, label %vector.body, !llvm.loop !18

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <2 x i64> %60, %59
  %62 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  %cmp.n = icmp eq i64 %.pre62, %n.vec
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph48.preheader70

._crit_edge:                                      ; preds = %.lr.ph48, %middle.block, %.preheader32.thread, %.preheader32
  %.022.lcssa = phi i64 [ 0, %.preheader32 ], [ 0, %.preheader32.thread ], [ %62, %middle.block ], [ %69, %.lr.ph48 ]
  %63 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.022.lcssa)
  %64 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %63, i8 noundef signext 10)
  %65 = load i64, ptr @T, align 8, !tbaa !8
  %66 = add nsw i64 %65, -1
  store i64 %66, ptr @T, align 8, !tbaa !8
  %.not = icmp eq i64 %65, 0
  br i1 %.not, label %._crit_edge53, label %.lr.ph52, !llvm.loop !21

.lr.ph48:                                         ; preds = %.lr.ph48.preheader70, %.lr.ph48
  %.047 = phi i64 [ %70, %.lr.ph48 ], [ %.047.ph, %.lr.ph48.preheader70 ]
  %.02246 = phi i64 [ %69, %.lr.ph48 ], [ %.02246.ph, %.lr.ph48.preheader70 ]
  %67 = getelementptr inbounds [1000 x i64], ptr @A, i64 0, i64 %.047
  %68 = load i64, ptr %67, align 8, !tbaa !8
  %69 = add nsw i64 %68, %.02246
  %70 = add nuw nsw i64 %.047, 1
  %exitcond57.not = icmp eq i64 %70, %.pre62
  br i1 %exitcond57.not, label %._crit_edge, label %.lr.ph48, !llvm.loop !22

._crit_edge53:                                    ; preds = %._crit_edge, %0
  ret i32 0
}

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #3 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #5

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #5

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

!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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12, !19, !20}
!19 = !{!"llvm.loop.isvectorized", i32 1}
!20 = !{!"llvm.loop.unroll.runtime.disable"}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12, !20, !19}


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