; LLVM IR from eyangch/competitive-programming :: DMOJ/DMOPC22nov (2)

; 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 i64, align 8
@A = external dso_local global [3000 x i64], align 16
@V = external dso_local global [3000 x i8], 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 i8, align 1
  %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
  store i32 0, ptr %1, align 4
  %9 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %10 = getelementptr i8, ptr %9, i64 -24
  %11 = load i64, ptr %10, align 8
  %12 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %11
  %13 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %12, ptr noundef null)
  %14 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %15 = 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)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  store i64 0, ptr %2, align 8, !tbaa !8
  br label %16

16:                                               ; preds = %33, %0
  %17 = load i64, ptr %2, align 8, !tbaa !8
  %18 = load i64, ptr @N, align 8, !tbaa !8
  %19 = icmp slt i64 %17, %18
  br i1 %19, label %21, label %20

20:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  br label %36

21:                                               ; preds = %16
  %22 = load i64, ptr %2, align 8, !tbaa !8
  %23 = getelementptr inbounds [3000 x i64], ptr @A, i64 0, i64 %22
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %23)
  %25 = load i64, ptr %2, align 8, !tbaa !8
  %26 = getelementptr inbounds [3000 x i64], ptr @A, i64 0, i64 %25
  %27 = load i64, ptr %26, align 8, !tbaa !8
  %28 = add nsw i64 %27, -1
  store i64 %28, ptr %26, align 8, !tbaa !8
  %29 = load i64, ptr %2, align 8, !tbaa !8
  %30 = getelementptr inbounds [3000 x i64], ptr @A, i64 0, i64 %29
  %31 = load i64, ptr %30, align 8, !tbaa !8
  %32 = getelementptr inbounds [3000 x i8], ptr @V, i64 0, i64 %31
  store i8 1, ptr %32, align 1, !tbaa !11
  br label %33

33:                                               ; preds = %21
  %34 = load i64, ptr %2, align 8, !tbaa !8
  %35 = add nsw i64 %34, 1
  store i64 %35, ptr %2, align 8, !tbaa !8
  br label %16, !llvm.loop !13

36:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #7
  store i8 1, ptr %3, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  store i64 0, ptr %4, align 8, !tbaa !8
  br label %37

37:                                               ; preds = %49, %36
  %38 = load i64, ptr %4, align 8, !tbaa !8
  %39 = load i64, ptr @N, align 8, !tbaa !8
  %40 = icmp slt i64 %38, %39
  br i1 %40, label %42, label %41

41:                                               ; preds = %37
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  br label %52

42:                                               ; preds = %37
  %43 = load i64, ptr %4, align 8, !tbaa !8
  %44 = getelementptr inbounds [3000 x i8], ptr @V, i64 0, i64 %43
  %45 = load i8, ptr %44, align 1, !tbaa !11, !range !15, !noundef !16
  %46 = trunc i8 %45 to i1
  br i1 %46, label %48, label %47

47:                                               ; preds = %42
  store i8 0, ptr %3, align 1, !tbaa !11
  br label %48

48:                                               ; preds = %47, %42
  br label %49

49:                                               ; preds = %48
  %50 = load i64, ptr %4, align 8, !tbaa !8
  %51 = add nsw i64 %50, 1
  store i64 %51, ptr %4, align 8, !tbaa !8
  br label %37, !llvm.loop !17

52:                                               ; preds = %41
  %53 = load i8, ptr %3, align 1, !tbaa !11, !range !15, !noundef !16
  %54 = trunc i8 %53 to i1
  br i1 %54, label %58, label %55

55:                                               ; preds = %52
  %56 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef -1)
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %56, i8 noundef signext 10)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %5, align 4
  br label %100

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

59:                                               ; preds = %93, %58
  %60 = load i64, ptr %7, align 8, !tbaa !8
  %61 = load i64, ptr @N, align 8, !tbaa !8
  %62 = icmp slt i64 %60, %61
  br i1 %62, label %64, label %63

63:                                               ; preds = %59
  store i32 8, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  br label %96

64:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  store i64 0, ptr %8, align 8, !tbaa !8
  br label %65

65:                                               ; preds = %89, %64
  %66 = load i64, ptr %8, align 8, !tbaa !8
  %67 = load i64, ptr @N, align 8, !tbaa !8
  %68 = sub nsw i64 %67, 1
  %69 = icmp slt i64 %66, %68
  br i1 %69, label %71, label %70

70:                                               ; preds = %65
  store i32 11, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %92

71:                                               ; preds = %65
  %72 = load i64, ptr %8, align 8, !tbaa !8
  %73 = getelementptr inbounds [3000 x i64], ptr @A, i64 0, i64 %72
  %74 = load i64, ptr %73, align 8, !tbaa !8
  %75 = load i64, ptr %8, align 8, !tbaa !8
  %76 = add nsw i64 %75, 1
  %77 = getelementptr inbounds [3000 x i64], ptr @A, i64 0, i64 %76
  %78 = load i64, ptr %77, align 8, !tbaa !8
  %79 = icmp sgt i64 %74, %78
  br i1 %79, label %80, label %88

80:                                               ; preds = %71
  %81 = load i64, ptr %8, align 8, !tbaa !8
  %82 = getelementptr inbounds [3000 x i64], ptr @A, i64 0, i64 %81
  %83 = load i64, ptr %8, align 8, !tbaa !8
  %84 = add nsw i64 %83, 1
  %85 = getelementptr inbounds [3000 x i64], ptr @A, i64 0, i64 %84
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %82, ptr noundef nonnull align 8 dereferenceable(8) %85) #7
  %86 = load i64, ptr %6, align 8, !tbaa !8
  %87 = add nsw i64 %86, 1
  store i64 %87, ptr %6, align 8, !tbaa !8
  br label %88

88:                                               ; preds = %80, %71
  br label %89

89:                                               ; preds = %88
  %90 = load i64, ptr %8, align 8, !tbaa !8
  %91 = add nsw i64 %90, 1
  store i64 %91, ptr %8, align 8, !tbaa !8
  br label %65, !llvm.loop !18

92:                                               ; preds = %70
  br label %93

93:                                               ; preds = %92
  %94 = load i64, ptr %7, align 8, !tbaa !8
  %95 = add nsw i64 %94, 1
  store i64 %95, ptr %7, align 8, !tbaa !8
  br label %59, !llvm.loop !19

96:                                               ; preds = %63
  %97 = load i64, ptr %6, align 8, !tbaa !8
  %98 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %97)
  %99 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %98, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  store i32 0, ptr %5, align 4
  br label %100

100:                                              ; preds = %96, %55
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #7
  %101 = load i32, ptr %5, align 4
  switch i32 %101, label %104 [
    i32 0, label %102
    i32 1, label %102
  ]

102:                                              ; preds = %100, %100
  %103 = load i32, ptr %1, align 4
  ret i32 %103

104:                                              ; preds = %100
  unreachable
}

; 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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #6

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 = !{!"bool", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !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 i64, align 8
@A = external dso_local global [3000 x i64], align 16
@V = external dso_local local_unnamed_addr global [3000 x i8], 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) @N)
  %8 = load i64, ptr @N, align 8, !tbaa !8
  %9 = icmp sgt i64 %8, 0
  br i1 %9, label %.lr.ph, label %._crit_edge41

.preheader28:                                     ; preds = %.lr.ph
  %10 = icmp slt i64 %18, 1
  br i1 %10, label %._crit_edge41, label %.lr.ph32.preheader

.lr.ph32.preheader:                               ; preds = %.preheader28
  %xtraiter = and i64 %18, 7
  %11 = icmp ult i64 %18, 8
  br i1 %11, label %._crit_edge.unr-lcssa, label %.lr.ph32.preheader.new

.lr.ph32.preheader.new:                           ; preds = %.lr.ph32.preheader
  %unroll_iter = and i64 %18, 9223372036854775800
  br label %.lr.ph32

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.02529 = phi i64 [ %17, %.lr.ph ], [ 0, %0 ]
  %12 = getelementptr inbounds [3000 x i64], ptr @A, i64 0, i64 %.02529
  %13 = 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) %12)
  %14 = load i64, ptr %12, align 8, !tbaa !8
  %15 = add nsw i64 %14, -1
  store i64 %15, ptr %12, align 8, !tbaa !8
  %16 = getelementptr inbounds [3000 x i8], ptr @V, i64 0, i64 %15
  store i8 1, ptr %16, align 1, !tbaa !11
  %17 = add nuw nsw i64 %.02529, 1
  %18 = load i64, ptr @N, align 8, !tbaa !8
  %19 = icmp slt i64 %17, %18
  br i1 %19, label %.lr.ph, label %.preheader28, !llvm.loop !13

._crit_edge.unr-lcssa:                            ; preds = %.lr.ph32, %.lr.ph32.preheader
  %spec.select.lcssa.ph = phi i1 [ poison, %.lr.ph32.preheader ], [ %spec.select.7, %.lr.ph32 ]
  %.02231.unr = phi i64 [ 0, %.lr.ph32.preheader ], [ %62, %.lr.ph32 ]
  %.02330.unr = phi i1 [ true, %.lr.ph32.preheader ], [ %spec.select.7, %.lr.ph32 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph32.epil

.lr.ph32.epil:                                    ; preds = %._crit_edge.unr-lcssa, %.lr.ph32.epil
  %.02231.epil = phi i64 [ %23, %.lr.ph32.epil ], [ %.02231.unr, %._crit_edge.unr-lcssa ]
  %.02330.epil = phi i1 [ %spec.select.epil, %.lr.ph32.epil ], [ %.02330.unr, %._crit_edge.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph32.epil ], [ 0, %._crit_edge.unr-lcssa ]
  %20 = getelementptr inbounds [3000 x i8], ptr @V, i64 0, i64 %.02231.epil
  %21 = load i8, ptr %20, align 1, !tbaa !11, !range !15, !noundef !16
  %22 = trunc nuw i8 %21 to i1
  %spec.select.epil = select i1 %22, i1 %.02330.epil, i1 false
  %23 = add nuw nsw i64 %.02231.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, label %.lr.ph32.epil, !llvm.loop !17

._crit_edge:                                      ; preds = %.lr.ph32.epil, %._crit_edge.unr-lcssa
  %spec.select.lcssa = phi i1 [ %spec.select.lcssa.ph, %._crit_edge.unr-lcssa ], [ %spec.select.epil, %.lr.ph32.epil ]
  br i1 %spec.select.lcssa, label %.preheader27, label %63

.preheader27:                                     ; preds = %._crit_edge
  %or.cond = icmp eq i64 %18, 1
  br i1 %or.cond, label %._crit_edge41, label %.preheader

.lr.ph32:                                         ; preds = %.lr.ph32, %.lr.ph32.preheader.new
  %.02231 = phi i64 [ 0, %.lr.ph32.preheader.new ], [ %62, %.lr.ph32 ]
  %.02330 = phi i1 [ true, %.lr.ph32.preheader.new ], [ %spec.select.7, %.lr.ph32 ]
  %niter = phi i64 [ 0, %.lr.ph32.preheader.new ], [ %niter.next.7, %.lr.ph32 ]
  %24 = getelementptr inbounds [3000 x i8], ptr @V, i64 0, i64 %.02231
  %25 = load i8, ptr %24, align 8, !tbaa !11, !range !15, !noundef !16
  %26 = trunc nuw i8 %25 to i1
  %27 = or disjoint i64 %.02231, 1
  %28 = getelementptr inbounds [3000 x i8], ptr @V, i64 0, i64 %27
  %29 = load i8, ptr %28, align 1, !tbaa !11, !range !15, !noundef !16
  %30 = trunc nuw i8 %29 to i1
  %31 = or disjoint i64 %.02231, 2
  %32 = getelementptr inbounds [3000 x i8], ptr @V, i64 0, i64 %31
  %33 = load i8, ptr %32, align 2, !tbaa !11, !range !15, !noundef !16
  %34 = trunc nuw i8 %33 to i1
  %35 = or disjoint i64 %.02231, 3
  %36 = getelementptr inbounds [3000 x i8], ptr @V, i64 0, i64 %35
  %37 = load i8, ptr %36, align 1, !tbaa !11, !range !15, !noundef !16
  %38 = trunc nuw i8 %37 to i1
  %39 = or disjoint i64 %.02231, 4
  %40 = getelementptr inbounds [3000 x i8], ptr @V, i64 0, i64 %39
  %41 = load i8, ptr %40, align 4, !tbaa !11, !range !15, !noundef !16
  %42 = trunc nuw i8 %41 to i1
  %43 = or disjoint i64 %.02231, 5
  %44 = getelementptr inbounds [3000 x i8], ptr @V, i64 0, i64 %43
  %45 = load i8, ptr %44, align 1, !tbaa !11, !range !15, !noundef !16
  %46 = trunc nuw i8 %45 to i1
  %47 = or disjoint i64 %.02231, 6
  %48 = getelementptr inbounds [3000 x i8], ptr @V, i64 0, i64 %47
  %49 = load i8, ptr %48, align 2, !tbaa !11, !range !15, !noundef !16
  %50 = trunc nuw i8 %49 to i1
  %51 = or disjoint i64 %.02231, 7
  %52 = getelementptr inbounds [3000 x i8], ptr @V, i64 0, i64 %51
  %53 = load i8, ptr %52, align 1, !tbaa !11, !range !15, !noundef !16
  %54 = trunc nuw i8 %53 to i1
  %55 = select i1 %54, i1 %50, i1 false
  %56 = select i1 %55, i1 %46, i1 false
  %57 = select i1 %56, i1 %42, i1 false
  %58 = select i1 %57, i1 %38, i1 false
  %59 = select i1 %58, i1 %34, i1 false
  %60 = select i1 %59, i1 %30, i1 false
  %61 = select i1 %60, i1 %26, i1 false
  %spec.select.7 = select i1 %61, i1 %.02330, i1 false
  %62 = add nuw nsw i64 %.02231, 8
  %niter.next.7 = add i64 %niter, 8
  %niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
  br i1 %niter.ncmp.7, label %._crit_edge.unr-lcssa, label %.lr.ph32, !llvm.loop !19

63:                                               ; preds = %._crit_edge
  %64 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef -1)
  br label %86

.preheader:                                       ; preds = %.preheader27, %._crit_edge37
  %65 = phi i64 [ %68, %._crit_edge37 ], [ %18, %.preheader27 ]
  %.02040 = phi i64 [ %69, %._crit_edge37 ], [ 0, %.preheader27 ]
  %.02139 = phi i64 [ %.1.lcssa, %._crit_edge37 ], [ 0, %.preheader27 ]
  %66 = icmp sgt i64 %65, 1
  br i1 %66, label %.lr.ph36, label %._crit_edge37

._crit_edge41:                                    ; preds = %._crit_edge37, %0, %.preheader28, %.preheader27
  %.021.lcssa = phi i64 [ 0, %.preheader27 ], [ 0, %.preheader28 ], [ 0, %0 ], [ %.1.lcssa, %._crit_edge37 ]
  %67 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.021.lcssa)
  br label %86

._crit_edge37:                                    ; preds = %81, %.preheader
  %68 = phi i64 [ %65, %.preheader ], [ %82, %81 ]
  %.1.lcssa = phi i64 [ %.02139, %.preheader ], [ %.2, %81 ]
  %69 = add nuw nsw i64 %.02040, 1
  %70 = icmp slt i64 %69, %68
  br i1 %70, label %.preheader, label %._crit_edge41, !llvm.loop !20

.lr.ph36:                                         ; preds = %.preheader, %81
  %71 = phi i64 [ %82, %81 ], [ %65, %.preheader ]
  %72 = phi i64 [ %83, %81 ], [ %65, %.preheader ]
  %.035 = phi i64 [ %75, %81 ], [ 0, %.preheader ]
  %.134 = phi i64 [ %.2, %81 ], [ %.02139, %.preheader ]
  %73 = getelementptr inbounds [3000 x i64], ptr @A, i64 0, i64 %.035
  %74 = load i64, ptr %73, align 8, !tbaa !8
  %75 = add nuw nsw i64 %.035, 1
  %76 = getelementptr inbounds [3000 x i64], ptr @A, i64 0, i64 %75
  %77 = load i64, ptr %76, align 8, !tbaa !8
  %78 = icmp sgt i64 %74, %77
  br i1 %78, label %79, label %81

79:                                               ; preds = %.lr.ph36
  tail call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %73, ptr noundef nonnull align 8 dereferenceable(8) %76) #6
  %80 = add nsw i64 %.134, 1
  %.pre = load i64, ptr @N, align 8, !tbaa !8
  br label %81

81:                                               ; preds = %.lr.ph36, %79
  %82 = phi i64 [ %.pre, %79 ], [ %71, %.lr.ph36 ]
  %83 = phi i64 [ %.pre, %79 ], [ %72, %.lr.ph36 ]
  %.2 = phi i64 [ %80, %79 ], [ %.134, %.lr.ph36 ]
  %84 = add nsw i64 %83, -1
  %85 = icmp slt i64 %75, %84
  br i1 %85, label %.lr.ph36, label %._crit_edge37, !llvm.loop !22

86:                                               ; preds = %._crit_edge41, %63
  %.sink = phi ptr [ %67, %._crit_edge41 ], [ %64, %63 ]
  %87 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %.sink, i8 noundef signext 10)
  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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

; 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

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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = !{!12, !12, i64 0}
!12 = !{!"bool", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.unroll.disable"}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14, !21}
!21 = !{!"llvm.loop.unswitch.partial.disable"}
!22 = distinct !{!22, !14}


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