; LLVM IR from eyangch/competitive-programming :: Codeforces/1738 (b)

; 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
@K = external dso_local global i64, align 8
@S = external dso_local global [100000 x i64], align 16
@A = external dso_local global [100000 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 [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i8, align 1
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %12 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %13 = getelementptr i8, ptr %12, i64 -24
  %14 = load i64, ptr %13, align 8
  %15 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %14
  %16 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %15, ptr noundef null)
  %17 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %18 = 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 %19

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

23:                                               ; preds = %19
  %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) @N)
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %24, ptr noundef nonnull align 8 dereferenceable(8) @K)
  call void @llvm.lifetime.start.p0(i64 1, ptr %2) #7
  store i8 1, ptr %2, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  store i64 0, ptr %3, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  store i64 -1000000000000000, ptr %4, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  store i64 0, ptr %5, align 8, !tbaa !8
  %26 = load i64, ptr @N, align 8, !tbaa !8
  %27 = getelementptr inbounds i64, ptr @A, i64 %26
  %28 = getelementptr inbounds i64, ptr %27, i64 1
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 0, ptr %6, align 4, !tbaa !13
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef @A, ptr noundef %28, ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  store i64 0, ptr %7, align 8, !tbaa !8
  br label %29

29:                                               ; preds = %57, %23
  %30 = load i64, ptr %7, align 8, !tbaa !8
  %31 = load i64, ptr @K, align 8, !tbaa !8
  %32 = icmp slt i64 %30, %31
  br i1 %32, label %34, label %33

33:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  br label %60

34:                                               ; preds = %29
  %35 = load i64, ptr %7, align 8, !tbaa !8
  %36 = getelementptr inbounds [100000 x i64], ptr @S, i64 0, i64 %35
  %37 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %36)
  %38 = load i64, ptr %7, align 8, !tbaa !8
  %39 = icmp ne i64 %38, 0
  br i1 %39, label %40, label %56

40:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %41 = load i64, ptr %7, align 8, !tbaa !8
  %42 = getelementptr inbounds [100000 x i64], ptr @S, i64 0, i64 %41
  %43 = load i64, ptr %42, align 8, !tbaa !8
  %44 = load i64, ptr %7, align 8, !tbaa !8
  %45 = sub nsw i64 %44, 1
  %46 = getelementptr inbounds [100000 x i64], ptr @S, i64 0, i64 %45
  %47 = load i64, ptr %46, align 8, !tbaa !8
  %48 = sub nsw i64 %43, %47
  store i64 %48, ptr %8, align 8, !tbaa !8
  %49 = load i64, ptr %8, align 8, !tbaa !8
  %50 = load i64, ptr %7, align 8, !tbaa !8
  %51 = load i64, ptr @N, align 8, !tbaa !8
  %52 = add nsw i64 %50, %51
  %53 = load i64, ptr @K, align 8, !tbaa !8
  %54 = sub nsw i64 %52, %53
  %55 = getelementptr inbounds [100000 x i64], ptr @A, i64 0, i64 %54
  store i64 %49, ptr %55, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %56

56:                                               ; preds = %40, %34
  br label %57

57:                                               ; preds = %56
  %58 = load i64, ptr %7, align 8, !tbaa !8
  %59 = add nsw i64 %58, 1
  store i64 %59, ptr %7, align 8, !tbaa !8
  br label %29, !llvm.loop !15

60:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %61 = load i64, ptr @N, align 8, !tbaa !8
  %62 = load i64, ptr @K, align 8, !tbaa !8
  %63 = sub nsw i64 %61, %62
  store i64 %63, ptr %9, align 8, !tbaa !8
  br label %64

64:                                               ; preds = %75, %60
  %65 = load i64, ptr %9, align 8, !tbaa !8
  %66 = icmp sge i64 %65, 0
  br i1 %66, label %68, label %67

67:                                               ; preds = %64
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  br label %78

68:                                               ; preds = %64
  %69 = load i64, ptr %9, align 8, !tbaa !8
  %70 = add nsw i64 %69, 1
  %71 = getelementptr inbounds [100000 x i64], ptr @A, i64 0, i64 %70
  %72 = load i64, ptr %71, align 8, !tbaa !8
  %73 = load i64, ptr %9, align 8, !tbaa !8
  %74 = getelementptr inbounds [100000 x i64], ptr @A, i64 0, i64 %73
  store i64 %72, ptr %74, align 8, !tbaa !8
  br label %75

75:                                               ; preds = %68
  %76 = load i64, ptr %9, align 8, !tbaa !8
  %77 = add nsw i64 %76, -1
  store i64 %77, ptr %9, align 8, !tbaa !8
  br label %64, !llvm.loop !17

78:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %79 = load i64, ptr @N, align 8, !tbaa !8
  %80 = getelementptr inbounds i64, ptr @A, i64 %79
  %81 = load i64, ptr @K, align 8, !tbaa !8
  %82 = sub i64 0, %81
  %83 = getelementptr inbounds i64, ptr %80, i64 %82
  %84 = getelementptr inbounds i64, ptr %83, i64 1
  %85 = call noundef i64 @_ZSt10accumulateIPxxET0_T_S2_S1_(ptr noundef @A, ptr noundef %84, i64 noundef 0)
  store i64 %85, ptr %10, align 8, !tbaa !8
  %86 = load i64, ptr %10, align 8, !tbaa !8
  %87 = load i64, ptr @S, align 16, !tbaa !8
  %88 = icmp slt i64 %86, %87
  br i1 %88, label %89, label %90

89:                                               ; preds = %78
  store i8 0, ptr %2, align 1, !tbaa !11
  br label %90

90:                                               ; preds = %89, %78
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  store i64 1, ptr %11, align 8, !tbaa !8
  br label %91

91:                                               ; preds = %107, %90
  %92 = load i64, ptr %11, align 8, !tbaa !8
  %93 = load i64, ptr @N, align 8, !tbaa !8
  %94 = icmp slt i64 %92, %93
  br i1 %94, label %96, label %95

95:                                               ; preds = %91
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br label %110

96:                                               ; preds = %91
  %97 = load i64, ptr %11, align 8, !tbaa !8
  %98 = getelementptr inbounds [100000 x i64], ptr @A, i64 0, i64 %97
  %99 = load i64, ptr %98, align 8, !tbaa !8
  %100 = load i64, ptr %11, align 8, !tbaa !8
  %101 = sub nsw i64 %100, 1
  %102 = getelementptr inbounds [100000 x i64], ptr @A, i64 0, i64 %101
  %103 = load i64, ptr %102, align 8, !tbaa !8
  %104 = icmp slt i64 %99, %103
  br i1 %104, label %105, label %106

105:                                              ; preds = %96
  store i8 0, ptr %2, align 1, !tbaa !11
  br label %106

106:                                              ; preds = %105, %96
  br label %107

107:                                              ; preds = %106
  %108 = load i64, ptr %11, align 8, !tbaa !8
  %109 = add nsw i64 %108, 1
  store i64 %109, ptr %11, align 8, !tbaa !8
  br label %91, !llvm.loop !18

110:                                              ; preds = %95
  %111 = load i64, ptr @K, align 8, !tbaa !8
  %112 = icmp eq i64 %111, 1
  br i1 %112, label %113, label %114

113:                                              ; preds = %110
  store i8 1, ptr %2, align 1, !tbaa !11
  br label %114

114:                                              ; preds = %113, %110
  %115 = load i8, ptr %2, align 1, !tbaa !11, !range !19, !noundef !20
  %116 = trunc i8 %115 to i1
  %117 = zext i1 %116 to i64
  %118 = select i1 %116, ptr @.str, ptr @.str.1
  %119 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef %118)
  %120 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %119, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %2) #7
  br label %19, !llvm.loop !21

121:                                              ; preds = %19
  %122 = load i32, ptr %1, align 4
  ret i32 %122
}

; 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: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) #5

; 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 nounwind uwtable
declare dso_local noundef i64 @_ZSt10accumulateIPxxET0_T_S2_S1_(ptr noundef, ptr noundef, i64 noundef) #6

; 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: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #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 = { 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 = !{!14, !14, i64 0}
!14 = !{!"int", !10, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = distinct !{!21, !16}


; 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
@K = external dso_local global i64, align 8
@S = external dso_local global [100000 x i64], align 16
@A = external dso_local global [100000 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 [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %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 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %8 = 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)
  %9 = load i64, ptr @T, align 8, !tbaa !8
  %10 = add nsw i64 %9, -1
  store i64 %10, ptr @T, align 8, !tbaa !8
  %.not37 = icmp eq i64 %9, 0
  br i1 %.not37, label %._crit_edge40, label %.lr.ph39

.lr.ph39:                                         ; preds = %0, %._crit_edge35
  %11 = 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)
  %12 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef nonnull align 8 dereferenceable(8) @K)
  %13 = load i64, ptr @N, align 8, !tbaa !8
  %gep = getelementptr i64, ptr getelementptr inbounds (i8, ptr @A, i64 8), i64 %13
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  store i32 0, ptr %1, align 4, !tbaa !11
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull @A, ptr noundef nonnull %gep, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  %14 = load i64, ptr @K, align 8, !tbaa !8
  %15 = icmp sgt i64 %14, 0
  br i1 %15, label %16, label %._crit_edge

16:                                               ; preds = %.lr.ph39
  %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) @S)
  %.pre = load i64, ptr @K, align 8, !tbaa !8
  %18 = icmp sgt i64 %.pre, 1
  br i1 %18, label %.lr.ph.peel.next, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph.peel.next, %16, %.lr.ph39
  %.lcssa = phi i64 [ %14, %.lr.ph39 ], [ %.pre, %16 ], [ %38, %.lr.ph.peel.next ]
  %19 = load i64, ptr @N, align 8, !tbaa !8
  %20 = sub nsw i64 %19, %.lcssa
  %21 = icmp sgt i64 %20, -1
  br i1 %21, label %.lr.ph29.preheader, label %._crit_edge30

.lr.ph29.preheader:                               ; preds = %._crit_edge
  %22 = sub i64 %19, %.lcssa
  %23 = shl i64 %22, 3
  %scevgep = getelementptr i8, ptr getelementptr inbounds (i8, ptr @A, i64 8), i64 %23
  %load_initial = load i64, ptr %scevgep, align 8
  %24 = add i64 %19, 1
  %25 = sub i64 %24, %.lcssa
  %xtraiter = and i64 %25, 7
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph29.prol.loopexit, label %.lr.ph29.prol

.lr.ph29.prol:                                    ; preds = %.lr.ph29.preheader, %.lr.ph29.prol
  %.02027.prol = phi i64 [ %27, %.lr.ph29.prol ], [ %20, %.lr.ph29.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %.lr.ph29.prol ], [ 0, %.lr.ph29.preheader ]
  %26 = getelementptr inbounds [100000 x i64], ptr @A, i64 0, i64 %.02027.prol
  store i64 %load_initial, ptr %26, align 8, !tbaa !8
  %27 = add nsw i64 %.02027.prol, -1
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %.lr.ph29.prol.loopexit, label %.lr.ph29.prol, !llvm.loop !13

.lr.ph29.prol.loopexit:                           ; preds = %.lr.ph29.prol, %.lr.ph29.preheader
  %.02027.unr = phi i64 [ %20, %.lr.ph29.preheader ], [ %27, %.lr.ph29.prol ]
  %28 = icmp ult i64 %20, 7
  br i1 %28, label %._crit_edge30, label %.lr.ph29

.lr.ph.peel.next:                                 ; preds = %16, %.lr.ph.peel.next
  %.02126 = phi i64 [ %41, %.lr.ph.peel.next ], [ 1, %16 ]
  %29 = getelementptr inbounds [100000 x i64], ptr @S, i64 0, i64 %.02126
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %29)
  %31 = load i64, ptr %29, align 8, !tbaa !8
  %32 = add nsw i64 %.02126, -1
  %33 = getelementptr inbounds [100000 x i64], ptr @S, i64 0, i64 %32
  %34 = load i64, ptr %33, align 8, !tbaa !8
  %35 = sub nsw i64 %31, %34
  %36 = load i64, ptr @N, align 8, !tbaa !8
  %37 = add nsw i64 %36, %.02126
  %38 = load i64, ptr @K, align 8, !tbaa !8
  %39 = sub i64 %37, %38
  %40 = getelementptr inbounds [100000 x i64], ptr @A, i64 0, i64 %39
  store i64 %35, ptr %40, align 8, !tbaa !8
  %41 = add nuw nsw i64 %.02126, 1
  %42 = icmp slt i64 %41, %38
  br i1 %42, label %.lr.ph.peel.next, label %._crit_edge, !llvm.loop !15

._crit_edge30:                                    ; preds = %.lr.ph29.prol.loopexit, %.lr.ph29, %._crit_edge
  %43 = getelementptr inbounds i64, ptr @A, i64 %19
  %44 = sub i64 0, %.lcssa
  %45 = getelementptr inbounds i64, ptr %43, i64 %44
  %46 = getelementptr inbounds i8, ptr %45, i64 8
  %47 = call noundef i64 @_ZSt10accumulateIPxxET0_T_S2_S1_(ptr noundef nonnull @A, ptr noundef nonnull %46, i64 noundef 0)
  %48 = load i64, ptr @S, align 16, !tbaa !8
  %49 = icmp sge i64 %47, %48
  %50 = load i64, ptr @N, align 8, !tbaa !8
  %51 = icmp sgt i64 %50, 1
  br i1 %51, label %.lr.ph34.preheader, label %._crit_edge35

.lr.ph34.preheader:                               ; preds = %._crit_edge30
  %.pre44 = load i64, ptr @A, align 16, !tbaa !8
  %52 = add nsw i64 %50, -1
  %53 = add nsw i64 %50, -2
  %xtraiter49 = and i64 %52, 3
  %54 = icmp ult i64 %53, 3
  br i1 %54, label %._crit_edge35.loopexit.unr-lcssa, label %.lr.ph34.preheader.new

.lr.ph34.preheader.new:                           ; preds = %.lr.ph34.preheader
  %unroll_iter = and i64 %52, -4
  br label %.lr.ph34

.lr.ph29:                                         ; preds = %.lr.ph29.prol.loopexit, %.lr.ph29
  %.02027 = phi i64 [ %70, %.lr.ph29 ], [ %.02027.unr, %.lr.ph29.prol.loopexit ]
  %55 = getelementptr inbounds [100000 x i64], ptr @A, i64 0, i64 %.02027
  store i64 %load_initial, ptr %55, align 8, !tbaa !8
  %56 = add nsw i64 %.02027, -1
  %57 = getelementptr inbounds [100000 x i64], ptr @A, i64 0, i64 %56
  store i64 %load_initial, ptr %57, align 8, !tbaa !8
  %58 = add nsw i64 %.02027, -2
  %59 = getelementptr inbounds [100000 x i64], ptr @A, i64 0, i64 %58
  store i64 %load_initial, ptr %59, align 8, !tbaa !8
  %60 = add nsw i64 %.02027, -3
  %61 = getelementptr inbounds [100000 x i64], ptr @A, i64 0, i64 %60
  store i64 %load_initial, ptr %61, align 8, !tbaa !8
  %62 = add nsw i64 %.02027, -4
  %63 = getelementptr inbounds [100000 x i64], ptr @A, i64 0, i64 %62
  store i64 %load_initial, ptr %63, align 8, !tbaa !8
  %64 = add nsw i64 %.02027, -5
  %65 = getelementptr inbounds [100000 x i64], ptr @A, i64 0, i64 %64
  store i64 %load_initial, ptr %65, align 8, !tbaa !8
  %66 = add nsw i64 %.02027, -6
  %67 = getelementptr inbounds [100000 x i64], ptr @A, i64 0, i64 %66
  store i64 %load_initial, ptr %67, align 8, !tbaa !8
  %68 = add nsw i64 %.02027, -7
  %69 = getelementptr inbounds [100000 x i64], ptr @A, i64 0, i64 %68
  store i64 %load_initial, ptr %69, align 8, !tbaa !8
  %70 = add nsw i64 %.02027, -8
  %.not46.7 = icmp eq i64 %68, 0
  br i1 %.not46.7, label %._crit_edge30, label %.lr.ph29, !llvm.loop !18

._crit_edge35.loopexit.unr-lcssa:                 ; preds = %.lr.ph34, %.lr.ph34.preheader
  %spec.select25.lcssa.ph = phi i1 [ poison, %.lr.ph34.preheader ], [ %spec.select25.3, %.lr.ph34 ]
  %.unr = phi i64 [ %.pre44, %.lr.ph34.preheader ], [ %98, %.lr.ph34 ]
  %.032.unr = phi i64 [ 1, %.lr.ph34.preheader ], [ %103, %.lr.ph34 ]
  %.131.unr = phi i1 [ %49, %.lr.ph34.preheader ], [ %spec.select25.3, %.lr.ph34 ]
  %lcmp.mod50.not = icmp eq i64 %xtraiter49, 0
  br i1 %lcmp.mod50.not, label %._crit_edge35, label %.lr.ph34.epil

.lr.ph34.epil:                                    ; preds = %._crit_edge35.loopexit.unr-lcssa, %.lr.ph34.epil
  %71 = phi i64 [ %73, %.lr.ph34.epil ], [ %.unr, %._crit_edge35.loopexit.unr-lcssa ]
  %.032.epil = phi i64 [ %75, %.lr.ph34.epil ], [ %.032.unr, %._crit_edge35.loopexit.unr-lcssa ]
  %.131.epil = phi i1 [ %spec.select25.epil, %.lr.ph34.epil ], [ %.131.unr, %._crit_edge35.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph34.epil ], [ 0, %._crit_edge35.loopexit.unr-lcssa ]
  %72 = getelementptr inbounds [100000 x i64], ptr @A, i64 0, i64 %.032.epil
  %73 = load i64, ptr %72, align 8, !tbaa !8
  %74 = icmp sge i64 %73, %71
  %spec.select25.epil = select i1 %74, i1 %.131.epil, i1 false
  %75 = add nuw nsw i64 %.032.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter49
  br i1 %epil.iter.cmp.not, label %._crit_edge35, label %.lr.ph34.epil, !llvm.loop !19

._crit_edge35:                                    ; preds = %._crit_edge35.loopexit.unr-lcssa, %.lr.ph34.epil, %._crit_edge30
  %.1.lcssa = phi i1 [ %49, %._crit_edge30 ], [ %spec.select25.lcssa.ph, %._crit_edge35.loopexit.unr-lcssa ], [ %spec.select25.epil, %.lr.ph34.epil ]
  %76 = load i64, ptr @K, align 8, !tbaa !8
  %77 = icmp eq i64 %76, 1
  %78 = select i1 %77, i1 true, i1 %.1.lcssa
  %79 = select i1 %78, ptr @.str, ptr @.str.1
  %80 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull %79)
  %81 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %80, i8 noundef signext 10)
  %82 = load i64, ptr @T, align 8, !tbaa !8
  %83 = add nsw i64 %82, -1
  store i64 %83, ptr @T, align 8, !tbaa !8
  %.not = icmp eq i64 %82, 0
  br i1 %.not, label %._crit_edge40, label %.lr.ph39, !llvm.loop !20

.lr.ph34:                                         ; preds = %.lr.ph34, %.lr.ph34.preheader.new
  %84 = phi i64 [ %.pre44, %.lr.ph34.preheader.new ], [ %98, %.lr.ph34 ]
  %.032 = phi i64 [ 1, %.lr.ph34.preheader.new ], [ %103, %.lr.ph34 ]
  %.131 = phi i1 [ %49, %.lr.ph34.preheader.new ], [ %spec.select25.3, %.lr.ph34 ]
  %niter = phi i64 [ 0, %.lr.ph34.preheader.new ], [ %niter.next.3, %.lr.ph34 ]
  %85 = getelementptr inbounds [100000 x i64], ptr @A, i64 0, i64 %.032
  %86 = load i64, ptr %85, align 8, !tbaa !8
  %87 = icmp sge i64 %86, %84
  %88 = add nuw nsw i64 %.032, 1
  %89 = getelementptr inbounds [100000 x i64], ptr @A, i64 0, i64 %88
  %90 = load i64, ptr %89, align 8, !tbaa !8
  %91 = icmp sge i64 %90, %86
  %92 = add nuw nsw i64 %.032, 2
  %93 = getelementptr inbounds [100000 x i64], ptr @A, i64 0, i64 %92
  %94 = load i64, ptr %93, align 8, !tbaa !8
  %95 = icmp sge i64 %94, %90
  %96 = add nuw nsw i64 %.032, 3
  %97 = getelementptr inbounds [100000 x i64], ptr @A, i64 0, i64 %96
  %98 = load i64, ptr %97, align 8, !tbaa !8
  %99 = icmp sge i64 %98, %94
  %100 = select i1 %99, i1 %95, i1 false
  %101 = select i1 %100, i1 %91, i1 false
  %102 = select i1 %101, i1 %87, i1 false
  %spec.select25.3 = select i1 %102, i1 %.131, i1 false
  %103 = add nuw nsw i64 %.032, 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_edge35.loopexit.unr-lcssa, label %.lr.ph34, !llvm.loop !21

._crit_edge40:                                    ; preds = %._crit_edge35, %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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #4

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZSt10accumulateIPxxET0_T_S2_S1_(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #6

; 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 #5

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #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 = { mustprogress 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 = !{!"int", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !16, !17}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!"llvm.loop.peeled.count", i32 1}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !16}
!21 = distinct !{!21, !16}


; Effective O3 passes: AggressiveInstCombinePass,BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopFullUnrollPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass