; LLVM IR from eyangch/competitive-programming :: Codeforces/1703 (g)

; 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
@A = external dso_local global [100000 x i64], align 16
@pfx = external dso_local global [100001 x i64], align 16
@add = 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

; 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 i64, align 8
  %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
  %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 = %161, %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 %165

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 8, ptr %2) #7
  store i64 0, ptr %2, align 8, !tbaa !8
  br label %26

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

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

31:                                               ; preds = %26
  %32 = load i64, ptr %2, align 8, !tbaa !8
  %33 = getelementptr inbounds [100000 x i64], ptr @add, i64 0, i64 %32
  store i64 0, ptr %33, align 8, !tbaa !8
  br label %34

34:                                               ; preds = %31
  %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 %26, !llvm.loop !11

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

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

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

43:                                               ; preds = %38
  %44 = load i64, ptr %3, align 8, !tbaa !8
  %45 = getelementptr inbounds [100000 x i64], ptr @A, 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)
  %47 = load i64, ptr %3, align 8, !tbaa !8
  %48 = getelementptr inbounds [100000 x i64], ptr @A, i64 0, i64 %47
  %49 = load i64, ptr %48, align 8, !tbaa !8
  %50 = load i64, ptr %3, align 8, !tbaa !8
  %51 = getelementptr inbounds [100001 x i64], ptr @pfx, i64 0, i64 %50
  %52 = load i64, ptr %51, align 8, !tbaa !8
  %53 = add nsw i64 %52, %49
  store i64 %53, ptr %51, align 8, !tbaa !8
  %54 = load i64, ptr %3, align 8, !tbaa !8
  %55 = getelementptr inbounds [100001 x i64], ptr @pfx, i64 0, i64 %54
  %56 = load i64, ptr %55, align 8, !tbaa !8
  %57 = load i64, ptr %3, align 8, !tbaa !8
  %58 = add nsw i64 %57, 1
  %59 = getelementptr inbounds [100001 x i64], ptr @pfx, i64 0, i64 %58
  store i64 %56, ptr %59, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  store i64 0, ptr %5, align 8, !tbaa !8
  br label %60

60:                                               ; preds = %84, %43
  %61 = load i64, ptr %5, align 8, !tbaa !8
  %62 = icmp slt i64 %61, 61
  br i1 %62, label %64, label %63

63:                                               ; preds = %60
  store i32 10, ptr %4, align 4
  br label %87

64:                                               ; preds = %60
  %65 = load i64, ptr %3, align 8, !tbaa !8
  %66 = load i64, ptr %5, align 8, !tbaa !8
  %67 = sub nsw i64 %65, %66
  %68 = icmp slt i64 %67, 0
  br i1 %68, label %69, label %70

69:                                               ; preds = %64
  store i32 10, ptr %4, align 4
  br label %87

70:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %71 = load i64, ptr %3, align 8, !tbaa !8
  %72 = getelementptr inbounds [100000 x i64], ptr @A, i64 0, i64 %71
  %73 = load i64, ptr %72, align 8, !tbaa !8
  %74 = load i64, ptr %5, align 8, !tbaa !8
  %75 = ashr i64 %73, %74
  %76 = and i64 %75, 1
  store i64 %76, ptr %6, align 8, !tbaa !8
  %77 = load i64, ptr %6, align 8, !tbaa !8
  %78 = load i64, ptr %3, align 8, !tbaa !8
  %79 = load i64, ptr %5, align 8, !tbaa !8
  %80 = sub nsw i64 %78, %79
  %81 = getelementptr inbounds [100000 x i64], ptr @add, i64 0, i64 %80
  %82 = load i64, ptr %81, align 8, !tbaa !8
  %83 = add nsw i64 %82, %77
  store i64 %83, ptr %81, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %84

84:                                               ; preds = %70
  %85 = load i64, ptr %5, align 8, !tbaa !8
  %86 = add nsw i64 %85, 1
  store i64 %86, ptr %5, align 8, !tbaa !8
  br label %60, !llvm.loop !13

87:                                               ; preds = %69, %63
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  br label %88

88:                                               ; preds = %87
  br label %89

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

92:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %93 = load i64, ptr @N, align 8, !tbaa !8
  %94 = sub nsw i64 %93, 1
  %95 = getelementptr inbounds [100001 x i64], ptr @pfx, i64 0, i64 %94
  %96 = load i64, ptr %95, align 8, !tbaa !8
  %97 = load i64, ptr @N, align 8, !tbaa !8
  %98 = load i64, ptr @K, align 8, !tbaa !8
  %99 = mul nsw i64 %97, %98
  %100 = sub nsw i64 %96, %99
  store i64 %100, ptr %7, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  store i64 0, ptr %8, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  store i64 0, ptr %9, align 8, !tbaa !8
  br label %101

101:                                              ; preds = %119, %92
  %102 = load i64, ptr %9, align 8, !tbaa !8
  %103 = load i64, ptr @N, align 8, !tbaa !8
  %104 = icmp slt i64 %102, %103
  br i1 %104, label %106, label %105

105:                                              ; preds = %101
  store i32 13, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  br label %122

106:                                              ; preds = %101
  %107 = load i64, ptr %9, align 8, !tbaa !8
  %108 = icmp sgt i64 %107, 60
  br i1 %108, label %109, label %110

109:                                              ; preds = %106
  br label %119

110:                                              ; preds = %106
  %111 = load i64, ptr %9, align 8, !tbaa !8
  %112 = getelementptr inbounds [100000 x i64], ptr @A, i64 0, i64 %111
  %113 = load i64, ptr %112, align 8, !tbaa !8
  %114 = load i64, ptr %9, align 8, !tbaa !8
  %115 = add nsw i64 %114, 1
  %116 = ashr i64 %113, %115
  %117 = load i64, ptr %8, align 8, !tbaa !8
  %118 = add nsw i64 %117, %116
  store i64 %118, ptr %8, align 8, !tbaa !8
  br label %119

119:                                              ; preds = %110, %109
  %120 = load i64, ptr %9, align 8, !tbaa !8
  %121 = add nsw i64 %120, 1
  store i64 %121, ptr %9, align 8, !tbaa !8
  br label %101, !llvm.loop !15

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

123:                                              ; preds = %158, %122
  %124 = load i64, ptr %10, align 8, !tbaa !8
  %125 = load i64, ptr @N, align 8, !tbaa !8
  %126 = icmp slt i64 %124, %125
  br i1 %126, label %128, label %127

127:                                              ; preds = %123
  store i32 16, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %161

128:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %129 = load i64, ptr %8, align 8, !tbaa !8
  store i64 %129, ptr %11, align 8, !tbaa !8
  %130 = load i64, ptr %10, align 8, !tbaa !8
  %131 = icmp sgt i64 %130, 0
  br i1 %131, label %132, label %143

132:                                              ; preds = %128
  %133 = load i64, ptr %10, align 8, !tbaa !8
  %134 = sub nsw i64 %133, 1
  %135 = getelementptr inbounds [100001 x i64], ptr @pfx, i64 0, i64 %134
  %136 = load i64, ptr %135, align 8, !tbaa !8
  %137 = load i64, ptr %10, align 8, !tbaa !8
  %138 = load i64, ptr @K, align 8, !tbaa !8
  %139 = mul nsw i64 %137, %138
  %140 = sub nsw i64 %136, %139
  %141 = load i64, ptr %11, align 8, !tbaa !8
  %142 = add nsw i64 %141, %140
  store i64 %142, ptr %11, align 8, !tbaa !8
  br label %143

143:                                              ; preds = %132, %128
  %144 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %11)
  %145 = load i64, ptr %144, align 8, !tbaa !8
  store i64 %145, ptr %7, align 8, !tbaa !8
  %146 = load i64, ptr %8, align 8, !tbaa !8
  %147 = mul nsw i64 %146, 2
  store i64 %147, ptr %8, align 8, !tbaa !8
  %148 = load i64, ptr %10, align 8, !tbaa !8
  %149 = getelementptr inbounds [100000 x i64], ptr @add, i64 0, i64 %148
  %150 = load i64, ptr %149, align 8, !tbaa !8
  %151 = load i64, ptr %8, align 8, !tbaa !8
  %152 = add nsw i64 %151, %150
  store i64 %152, ptr %8, align 8, !tbaa !8
  %153 = load i64, ptr %10, align 8, !tbaa !8
  %154 = getelementptr inbounds [100000 x i64], ptr @A, i64 0, i64 %153
  %155 = load i64, ptr %154, align 8, !tbaa !8
  %156 = load i64, ptr %8, align 8, !tbaa !8
  %157 = sub nsw i64 %156, %155
  store i64 %157, ptr %8, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br label %158

158:                                              ; preds = %143
  %159 = load i64, ptr %10, align 8, !tbaa !8
  %160 = add nsw i64 %159, 1
  store i64 %160, ptr %10, align 8, !tbaa !8
  br label %123, !llvm.loop !16

161:                                              ; preds = %127
  %162 = load i64, ptr %7, align 8, !tbaa !8
  %163 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %162)
  %164 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %163, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  br label %19, !llvm.loop !17

165:                                              ; preds = %19
  %166 = load i32, ptr %1, align 4
  ret i32 %166
}

; 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 nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #5

; 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) #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 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 = { 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 #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 = 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
@K = external dso_local global i64, align 8
@A = external dso_local global [100000 x i64], align 16
@pfx = external dso_local local_unnamed_addr global [100001 x i64], align 16
@add = external dso_local local_unnamed_addr global [100000 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 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %4 = getelementptr i8, ptr %3, i64 -24
  %5 = load i64, ptr %4, align 8
  %6 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %5
  %7 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %6, ptr noundef null)
  %8 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %9 = 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)
  %10 = load i64, ptr @T, align 8, !tbaa !8
  %11 = add nsw i64 %10, -1
  store i64 %11, ptr @T, align 8, !tbaa !8
  %.not60 = icmp eq i64 %10, 0
  br i1 %.not60, label %._crit_edge63, label %.lr.ph62

.lr.ph62:                                         ; preds = %0, %._crit_edge59
  %12 = 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)
  %13 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(8) @K)
  %14 = load i64, ptr @N, align 8, !tbaa !8
  %15 = icmp sgt i64 %14, 0
  br i1 %15, label %.lr.ph49.preheader, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph62
  store i64 0, ptr @pfx, align 16, !tbaa !8
  br label %._crit_edge50

.lr.ph49.preheader:                               ; preds = %.lr.ph62
  %16 = shl nuw i64 %14, 3
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @add, i8 0, i64 %16, i1 false), !tbaa !8
  store i64 0, ptr @pfx, align 16, !tbaa !8
  br label %.lr.ph49

._crit_edge50:                                    ; preds = %55, %._crit_edge
  %17 = phi i64 [ %14, %._crit_edge ], [ %56, %55 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #9
  %18 = add nsw i64 %17, -1
  %19 = getelementptr inbounds [100001 x i64], ptr @pfx, i64 0, i64 %18
  %20 = load i64, ptr %19, align 8, !tbaa !8
  %21 = load i64, ptr @K, align 8, !tbaa !8
  %22 = mul nsw i64 %21, %17
  %23 = sub nsw i64 %20, %22
  store i64 %23, ptr %1, align 8, !tbaa !8
  %24 = icmp sgt i64 %17, 0
  br i1 %24, label %.lr.ph54, label %._crit_edge59

.lr.ph49:                                         ; preds = %.lr.ph49.preheader, %55
  %indvars.iv = phi i64 [ 1, %.lr.ph49.preheader ], [ %indvars.iv.next, %55 ]
  %.04147 = phi i64 [ 0, %.lr.ph49.preheader ], [ %31, %55 ]
  %25 = getelementptr inbounds [100000 x i64], ptr @A, i64 0, i64 %.04147
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %25)
  %27 = load i64, ptr %25, align 8, !tbaa !8
  %28 = getelementptr inbounds [100001 x i64], ptr @pfx, i64 0, i64 %.04147
  %29 = load i64, ptr %28, align 8, !tbaa !8
  %30 = add nsw i64 %29, %27
  store i64 %30, ptr %28, align 8, !tbaa !8
  %31 = add nuw nsw i64 %.04147, 1
  %32 = getelementptr inbounds [100001 x i64], ptr @pfx, i64 0, i64 %31
  store i64 %30, ptr %32, align 8, !tbaa !8
  %min.iters.check = icmp ult i64 %indvars.iv, 4
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph49
  %umin = call i64 @llvm.umin.i64(i64 %indvars.iv, i64 60)
  %33 = add nuw nsw i64 %umin, 1
  %n.mod.vf = and i64 %33, 3
  %34 = icmp eq i64 %n.mod.vf, 0
  %35 = select i1 %34, i64 4, i64 %n.mod.vf
  %n.vec = sub nsw i64 %33, %35
  %broadcast.splatinsert = insertelement <2 x i64> poison, i64 %27, i64 0
  %broadcast.splat = shufflevector <2 x i64> %broadcast.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <2 x i64> [ <i64 0, i64 1>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %step.add = add <2 x i64> %vec.ind, <i64 2, i64 2>
  %36 = sub nsw i64 %.04147, %index
  %37 = lshr <2 x i64> %broadcast.splat, %vec.ind
  %38 = lshr <2 x i64> %broadcast.splat, %step.add
  %39 = and <2 x i64> %37, <i64 1, i64 1>
  %40 = and <2 x i64> %38, <i64 1, i64 1>
  %41 = getelementptr inbounds [100000 x i64], ptr @add, i64 0, i64 %36
  %42 = getelementptr inbounds i8, ptr %41, i64 -8
  %43 = getelementptr inbounds i8, ptr %41, i64 -24
  %wide.load = load <2 x i64>, ptr %42, align 8, !tbaa !8
  %reverse = shufflevector <2 x i64> %wide.load, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
  %wide.load72 = load <2 x i64>, ptr %43, align 8, !tbaa !8
  %reverse73 = shufflevector <2 x i64> %wide.load72, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
  %44 = add nsw <2 x i64> %reverse, %39
  %45 = add nsw <2 x i64> %reverse73, %40
  %reverse74 = shufflevector <2 x i64> %44, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
  store <2 x i64> %reverse74, ptr %42, align 8, !tbaa !8
  %reverse75 = shufflevector <2 x i64> %45, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
  store <2 x i64> %reverse75, ptr %43, align 8, !tbaa !8
  %index.next = add nuw i64 %index, 4
  %vec.ind.next = add <2 x i64> %vec.ind, <i64 4, i64 4>
  %46 = icmp eq i64 %index.next, %n.vec
  br i1 %46, label %scalar.ph.preheader, label %vector.body, !llvm.loop !11

scalar.ph.preheader:                              ; preds = %vector.body, %.lr.ph49
  %.04046.ph = phi i64 [ 0, %.lr.ph49 ], [ %n.vec, %vector.body ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %47
  %.04046 = phi i64 [ %54, %47 ], [ %.04046.ph, %scalar.ph.preheader ]
  %exitcond = icmp eq i64 %.04046, %indvars.iv
  br i1 %exitcond, label %55, label %47

47:                                               ; preds = %scalar.ph
  %48 = sub nsw i64 %.04147, %.04046
  %49 = lshr i64 %27, %.04046
  %50 = and i64 %49, 1
  %51 = getelementptr inbounds [100000 x i64], ptr @add, i64 0, i64 %48
  %52 = load i64, ptr %51, align 8, !tbaa !8
  %53 = add nsw i64 %52, %50
  store i64 %53, ptr %51, align 8, !tbaa !8
  %54 = add nuw nsw i64 %.04046, 1
  %exitcond65.not = icmp eq i64 %54, 61
  br i1 %exitcond65.not, label %55, label %scalar.ph, !llvm.loop !15

55:                                               ; preds = %scalar.ph, %47
  %56 = load i64, ptr @N, align 8, !tbaa !8
  %57 = icmp slt i64 %31, %56
  %indvars.iv.next = add nuw i64 %indvars.iv, 1
  br i1 %57, label %.lr.ph49, label %._crit_edge50, !llvm.loop !16

.preheader:                                       ; preds = %75
  br i1 %24, label %58, label %._crit_edge59

58:                                               ; preds = %.preheader
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #9
  store i64 %.1, ptr %2, align 8, !tbaa !8
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %60 = load i64, ptr %59, align 8, !tbaa !8
  store i64 %60, ptr %1, align 8, !tbaa !8
  %61 = load i64, ptr @add, align 16, !tbaa !8
  %62 = load i64, ptr @A, align 16, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #9
  %63 = load i64, ptr @N, align 8, !tbaa !8
  %64 = icmp sgt i64 %63, 1
  br i1 %64, label %.lr.ph58.peel.next, label %._crit_edge59

.lr.ph58.peel.next:                               ; preds = %58
  %65 = shl nsw i64 %.1, 1
  %66 = add nsw i64 %61, %65
  %67 = sub i64 %66, %62
  br label %81

.lr.ph54:                                         ; preds = %._crit_edge50, %75
  %.03752 = phi i64 [ %.pre-phi, %75 ], [ 0, %._crit_edge50 ]
  %.03851 = phi i64 [ %.1, %75 ], [ 0, %._crit_edge50 ]
  %68 = icmp ugt i64 %.03752, 60
  br i1 %68, label %.lr.ph54._crit_edge, label %69

.lr.ph54._crit_edge:                              ; preds = %.lr.ph54
  %.pre = add nuw nsw i64 %.03752, 1
  br label %75

69:                                               ; preds = %.lr.ph54
  %70 = getelementptr inbounds [100000 x i64], ptr @A, i64 0, i64 %.03752
  %71 = load i64, ptr %70, align 8, !tbaa !8
  %72 = add nuw nsw i64 %.03752, 1
  %73 = ashr i64 %71, %72
  %74 = add nsw i64 %73, %.03851
  br label %75

75:                                               ; preds = %.lr.ph54._crit_edge, %69
  %.pre-phi = phi i64 [ %.pre, %.lr.ph54._crit_edge ], [ %72, %69 ]
  %.1 = phi i64 [ %.03851, %.lr.ph54._crit_edge ], [ %74, %69 ]
  %exitcond66.not = icmp eq i64 %.pre-phi, %17
  br i1 %exitcond66.not, label %.preheader, label %.lr.ph54, !llvm.loop !17

._crit_edge59:                                    ; preds = %81, %._crit_edge50, %58, %.preheader
  %76 = phi i64 [ %23, %.preheader ], [ %60, %58 ], [ %23, %._crit_edge50 ], [ %90, %81 ]
  %77 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %76)
  %78 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %77, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #9
  %79 = load i64, ptr @T, align 8, !tbaa !8
  %80 = add nsw i64 %79, -1
  store i64 %80, ptr @T, align 8, !tbaa !8
  %.not = icmp eq i64 %79, 0
  br i1 %.not, label %._crit_edge63, label %.lr.ph62, !llvm.loop !18

81:                                               ; preds = %.lr.ph58.peel.next, %81
  %.057 = phi i64 [ %98, %81 ], [ 1, %.lr.ph58.peel.next ]
  %.256 = phi i64 [ %97, %81 ], [ %67, %.lr.ph58.peel.next ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #9
  %82 = add nsw i64 %.057, -1
  %83 = getelementptr inbounds [100001 x i64], ptr @pfx, i64 0, i64 %82
  %84 = load i64, ptr %83, align 8, !tbaa !8
  %85 = load i64, ptr @K, align 8, !tbaa !8
  %86 = mul nsw i64 %85, %.057
  %87 = add i64 %84, %.256
  %88 = sub i64 %87, %86
  store i64 %88, ptr %2, align 8, !tbaa !8
  %89 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %90 = load i64, ptr %89, align 8, !tbaa !8
  store i64 %90, ptr %1, align 8, !tbaa !8
  %91 = shl nsw i64 %.256, 1
  %92 = getelementptr inbounds [100000 x i64], ptr @add, i64 0, i64 %.057
  %93 = load i64, ptr %92, align 8, !tbaa !8
  %94 = add nsw i64 %93, %91
  %95 = getelementptr inbounds [100000 x i64], ptr @A, i64 0, i64 %.057
  %96 = load i64, ptr %95, align 8, !tbaa !8
  %97 = sub i64 %94, %96
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #9
  %98 = add nuw nsw i64 %.057, 1
  %99 = load i64, ptr @N, align 8, !tbaa !8
  %100 = icmp slt i64 %98, %99
  br i1 %100, label %81, label %._crit_edge59, !llvm.loop !19

._crit_edge63:                                    ; preds = %._crit_edge59, %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: 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 nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

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

; 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7

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

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 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 = { 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 #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { 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, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !12, !14, !13}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12, !20}
!20 = !{!"llvm.loop.peeled.count", i32 1}


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