; LLVM IR from eyangch/competitive-programming :: Codeforces/1334 (c)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

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

@_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 i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  %15 = alloca i64, align 8
  %16 = alloca i32, align 4
  %17 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %18 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %19 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %20 = getelementptr i8, ptr %19, i64 -24
  %21 = load i64, ptr %20, align 8
  %22 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %21
  %23 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %22, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  br label %25

25:                                               ; preds = %144, %0
  %26 = load i32, ptr %2, align 4, !tbaa !8
  %27 = add nsw i32 %26, -1
  store i32 %27, ptr %2, align 4, !tbaa !8
  %28 = icmp ne i32 %26, 0
  br i1 %28, label %29, label %151

29:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %31 = load i32, ptr %3, align 4, !tbaa !8
  %32 = zext i32 %31 to i64
  %33 = call ptr @llvm.stacksave.p0()
  store ptr %33, ptr %4, align 8
  %34 = alloca %"struct.std::pair", i64 %32, align 16
  store i64 %32, ptr %5, align 8
  %35 = icmp eq i64 %32, 0
  br i1 %35, label %42, label %36

36:                                               ; preds = %29
  %37 = getelementptr inbounds %"struct.std::pair", ptr %34, i64 %32
  br label %38

38:                                               ; preds = %38, %36
  %39 = phi ptr [ %34, %36 ], [ %40, %38 ]
  call void @_ZNSt4pairIxxEC2IxxTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 8 dereferenceable(16) %39)
  %40 = getelementptr inbounds %"struct.std::pair", ptr %39, i64 1
  %41 = icmp eq ptr %40, %37
  br i1 %41, label %42, label %38

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

43:                                               ; preds = %59, %42
  %44 = load i32, ptr %6, align 4, !tbaa !8
  %45 = load i32, ptr %3, align 4, !tbaa !8
  %46 = icmp slt i32 %44, %45
  br i1 %46, label %48, label %47

47:                                               ; preds = %43
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  br label %62

48:                                               ; preds = %43
  %49 = load i32, ptr %6, align 4, !tbaa !8
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds %"struct.std::pair", ptr %34, i64 %50
  %52 = getelementptr inbounds %"struct.std::pair", ptr %51, i32 0, i32 0
  %53 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %52)
  %54 = load i32, ptr %6, align 4, !tbaa !8
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds %"struct.std::pair", ptr %34, i64 %55
  %57 = getelementptr inbounds %"struct.std::pair", ptr %56, i32 0, i32 1
  %58 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %53, ptr noundef nonnull align 8 dereferenceable(8) %57)
  br label %59

59:                                               ; preds = %48
  %60 = load i32, ptr %6, align 4, !tbaa !8
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %6, align 4, !tbaa !8
  br label %43, !llvm.loop !11

62:                                               ; preds = %47
  %63 = load i32, ptr %3, align 4, !tbaa !8
  %64 = zext i32 %63 to i64
  %65 = alloca i64, i64 %64, align 16
  store i64 %64, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  store i64 0, ptr %8, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  store i32 1, ptr %9, align 4, !tbaa !8
  br label %66

66:                                               ; preds = %89, %62
  %67 = load i32, ptr %9, align 4, !tbaa !8
  %68 = load i32, ptr %3, align 4, !tbaa !8
  %69 = icmp slt i32 %67, %68
  br i1 %69, label %71, label %70

70:                                               ; preds = %66
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %92

71:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  store i64 0, ptr %10, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  %72 = load i32, ptr %9, align 4, !tbaa !8
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds %"struct.std::pair", ptr %34, i64 %73
  %75 = getelementptr inbounds %"struct.std::pair", ptr %74, i32 0, i32 0
  %76 = load i64, ptr %75, align 16, !tbaa !15
  %77 = load i32, ptr %9, align 4, !tbaa !8
  %78 = sub nsw i32 %77, 1
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds %"struct.std::pair", ptr %34, i64 %79
  %81 = getelementptr inbounds %"struct.std::pair", ptr %80, i32 0, i32 1
  %82 = load i64, ptr %81, align 8, !tbaa !17
  %83 = sub nsw i64 %76, %82
  store i64 %83, ptr %11, align 8, !tbaa !13
  %84 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11)
  %85 = load i64, ptr %84, align 8, !tbaa !13
  %86 = load i32, ptr %9, align 4, !tbaa !8
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds i64, ptr %65, i64 %87
  store i64 %85, ptr %88, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  br label %89

89:                                               ; preds = %71
  %90 = load i32, ptr %9, align 4, !tbaa !8
  %91 = add nsw i32 %90, 1
  store i32 %91, ptr %9, align 4, !tbaa !8
  br label %66, !llvm.loop !18

92:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  store i64 0, ptr %12, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  %93 = getelementptr inbounds %"struct.std::pair", ptr %34, i64 0
  %94 = getelementptr inbounds %"struct.std::pair", ptr %93, i32 0, i32 0
  %95 = load i64, ptr %94, align 16, !tbaa !15
  %96 = load i32, ptr %3, align 4, !tbaa !8
  %97 = sub nsw i32 %96, 1
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds %"struct.std::pair", ptr %34, i64 %98
  %100 = getelementptr inbounds %"struct.std::pair", ptr %99, i32 0, i32 1
  %101 = load i64, ptr %100, align 8, !tbaa !17
  %102 = sub nsw i64 %95, %101
  store i64 %102, ptr %13, align 8, !tbaa !13
  %103 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(8) %13)
  %104 = load i64, ptr %103, align 8, !tbaa !13
  %105 = getelementptr inbounds i64, ptr %65, i64 0
  store i64 %104, ptr %105, align 16, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  store i32 0, ptr %14, align 4, !tbaa !8
  br label %106

106:                                              ; preds = %118, %92
  %107 = load i32, ptr %14, align 4, !tbaa !8
  %108 = load i32, ptr %3, align 4, !tbaa !8
  %109 = icmp slt i32 %107, %108
  br i1 %109, label %111, label %110

110:                                              ; preds = %106
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  br label %121

111:                                              ; preds = %106
  %112 = load i32, ptr %14, align 4, !tbaa !8
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds i64, ptr %65, i64 %113
  %115 = load i64, ptr %114, align 8, !tbaa !13
  %116 = load i64, ptr %8, align 8, !tbaa !13
  %117 = add nsw i64 %116, %115
  store i64 %117, ptr %8, align 8, !tbaa !13
  br label %118

118:                                              ; preds = %111
  %119 = load i32, ptr %14, align 4, !tbaa !8
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %14, align 4, !tbaa !8
  br label %106, !llvm.loop !19

121:                                              ; preds = %110
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  store i64 -9223372036854775808, ptr %15, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  store i32 0, ptr %16, align 4, !tbaa !8
  br label %122

122:                                              ; preds = %141, %121
  %123 = load i32, ptr %16, align 4, !tbaa !8
  %124 = load i32, ptr %3, align 4, !tbaa !8
  %125 = icmp slt i32 %123, %124
  br i1 %125, label %127, label %126

126:                                              ; preds = %122
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  br label %144

127:                                              ; preds = %122
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  %128 = load i32, ptr %16, align 4, !tbaa !8
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds %"struct.std::pair", ptr %34, i64 %129
  %131 = getelementptr inbounds %"struct.std::pair", ptr %130, i32 0, i32 0
  %132 = load i64, ptr %131, align 16, !tbaa !15
  %133 = sub nsw i64 0, %132
  %134 = load i32, ptr %16, align 4, !tbaa !8
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds i64, ptr %65, i64 %135
  %137 = load i64, ptr %136, align 8, !tbaa !13
  %138 = add nsw i64 %133, %137
  store i64 %138, ptr %17, align 8, !tbaa !13
  %139 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef nonnull align 8 dereferenceable(8) %17)
  %140 = load i64, ptr %139, align 8, !tbaa !13
  store i64 %140, ptr %15, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  br label %141

141:                                              ; preds = %127
  %142 = load i32, ptr %16, align 4, !tbaa !8
  %143 = add nsw i32 %142, 1
  store i32 %143, ptr %16, align 4, !tbaa !8
  br label %122, !llvm.loop !20

144:                                              ; preds = %126
  %145 = load i64, ptr %8, align 8, !tbaa !13
  %146 = load i64, ptr %15, align 8, !tbaa !13
  %147 = sub nsw i64 %145, %146
  %148 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %147)
  %149 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %148, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  %150 = load ptr, ptr %4, align 8
  call void @llvm.stackrestore.p0(ptr %150)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  br label %25, !llvm.loop !21

151:                                              ; preds = %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  ret i32 0
}

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

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIxxEC2IxxTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 align 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)) #5 align 2

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

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #7

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nosync nounwind willreturn }
attributes #5 = { 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 = { 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 #8 = { 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 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"long long", !10, i64 0}
!15 = !{!16, !14, i64 0}
!16 = !{!"_ZTSSt4pairIxxE", !14, i64 0, !14, i64 8}
!17 = !{!16, !14, i64 8}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !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" }
%"struct.std::pair" = type { i64, i64 }

@_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 i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %10 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %11 = getelementptr i8, ptr %10, i64 -24
  %12 = load i64, ptr %11, align 8
  %13 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %12
  %14 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %13, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #9
  %15 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %16 = load i32, ptr %1, align 4, !tbaa !8
  %17 = add nsw i32 %16, -1
  store i32 %17, ptr %1, align 4, !tbaa !8
  %.not41 = icmp eq i32 %16, 0
  br i1 %.not41, label %._crit_edge44, label %.lr.ph43

.lr.ph43:                                         ; preds = %0, %._crit_edge40
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #9
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %19 = load i32, ptr %2, align 4, !tbaa !8
  %20 = zext i32 %19 to i64
  %21 = call ptr @llvm.stacksave.p0()
  %22 = alloca %"struct.std::pair", i64 %20, align 16
  %23 = icmp eq i32 %19, 0
  br i1 %23, label %.loopexit, label %24

24:                                               ; preds = %.lr.ph43
  %25 = getelementptr inbounds %"struct.std::pair", ptr %22, i64 %20
  br label %26

26:                                               ; preds = %26, %24
  %27 = phi ptr [ %22, %24 ], [ %28, %26 ]
  call void @_ZNSt4pairIxxEC2IxxTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 8 dereferenceable(16) %27)
  %28 = getelementptr inbounds i8, ptr %27, i64 16
  %29 = icmp eq ptr %28, %25
  br i1 %29, label %.loopexit, label %26

.loopexit:                                        ; preds = %26, %.lr.ph43
  %30 = load i32, ptr %2, align 4, !tbaa !8
  %31 = icmp sgt i32 %30, 0
  br i1 %31, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %.loopexit
  %32 = zext i32 %30 to i64
  %33 = alloca i64, i64 %32, align 16
  br label %._crit_edge.._crit_edge29_crit_edge

._crit_edge:                                      ; preds = %.lr.ph
  %34 = zext i32 %43 to i64
  %35 = alloca i64, i64 %34, align 16
  %36 = icmp sgt i32 %43, 1
  br i1 %36, label %.lr.ph28, label %._crit_edge.._crit_edge29_crit_edge

._crit_edge.._crit_edge29_crit_edge:              ; preds = %._crit_edge.thread, %._crit_edge
  %37 = phi ptr [ %33, %._crit_edge.thread ], [ %35, %._crit_edge ]
  %38 = phi i32 [ %30, %._crit_edge.thread ], [ %43, %._crit_edge ]
  %.pre = sext i32 %38 to i64
  br label %._crit_edge29

.lr.ph:                                           ; preds = %.loopexit, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.loopexit ]
  %39 = getelementptr inbounds %"struct.std::pair", ptr %22, i64 %indvars.iv
  %40 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %39)
  %41 = getelementptr inbounds i8, ptr %39, i64 8
  %42 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %40, ptr noundef nonnull align 8 dereferenceable(8) %41)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %43 = load i32, ptr %2, align 4, !tbaa !8
  %44 = sext i32 %43 to i64
  %45 = icmp slt i64 %indvars.iv.next, %44
  br i1 %45, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge29:                                    ; preds = %.lr.ph28, %._crit_edge.._crit_edge29_crit_edge
  %46 = phi ptr [ %37, %._crit_edge.._crit_edge29_crit_edge ], [ %35, %.lr.ph28 ]
  %.pre-phi = phi i64 [ %.pre, %._crit_edge.._crit_edge29_crit_edge ], [ %71, %.lr.ph28 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #9
  store i64 0, ptr %5, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #9
  %47 = load i64, ptr %22, align 16, !tbaa !15
  %48 = getelementptr %"struct.std::pair", ptr %22, i64 %.pre-phi
  %49 = getelementptr i8, ptr %48, i64 -8
  %50 = load i64, ptr %49, align 8, !tbaa !17
  %51 = sub nsw i64 %47, %50
  store i64 %51, ptr %6, align 8, !tbaa !13
  %52 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %53 = load i64, ptr %52, align 8, !tbaa !13
  store i64 %53, ptr %46, align 16, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #9
  %54 = load i32, ptr %2, align 4, !tbaa !8
  %55 = icmp sgt i32 %54, 0
  br i1 %55, label %.lr.ph34.preheader, label %._crit_edge35.thread

._crit_edge35.thread:                             ; preds = %._crit_edge29
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #9
  store i64 -9223372036854775808, ptr %7, align 8, !tbaa !13
  br label %._crit_edge40

.lr.ph34.preheader:                               ; preds = %._crit_edge29
  %wide.trip.count = zext nneg i32 %54 to i64
  %min.iters.check = icmp ult i32 %54, 4
  br i1 %min.iters.check, label %.lr.ph34.preheader68, label %vector.ph

.lr.ph34.preheader68:                             ; preds = %middle.block, %.lr.ph34.preheader
  %indvars.iv52.ph = phi i64 [ 0, %.lr.ph34.preheader ], [ %n.vec, %middle.block ]
  %.02031.ph = phi i64 [ 0, %.lr.ph34.preheader ], [ %61, %middle.block ]
  br label %.lr.ph34

vector.ph:                                        ; preds = %.lr.ph34.preheader
  %n.vec = and i64 %wide.trip.count, 2147483644
  br label %vector.body

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

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <2 x i64> %59, %58
  %61 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge35, label %.lr.ph34.preheader68

.lr.ph28:                                         ; preds = %._crit_edge, %.lr.ph28
  %indvars.iv49 = phi i64 [ %indvars.iv.next50, %.lr.ph28 ], [ 1, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #9
  store i64 0, ptr %3, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #9
  %62 = getelementptr inbounds %"struct.std::pair", ptr %22, i64 %indvars.iv49
  %63 = load i64, ptr %62, align 16, !tbaa !15
  %64 = getelementptr i8, ptr %62, i64 -8
  %65 = load i64, ptr %64, align 8, !tbaa !17
  %66 = sub nsw i64 %63, %65
  store i64 %66, ptr %4, align 8, !tbaa !13
  %67 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %68 = load i64, ptr %67, align 8, !tbaa !13
  %69 = getelementptr inbounds i64, ptr %35, i64 %indvars.iv49
  store i64 %68, ptr %69, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #9
  %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
  %70 = load i32, ptr %2, align 4, !tbaa !8
  %71 = sext i32 %70 to i64
  %72 = icmp slt i64 %indvars.iv.next50, %71
  br i1 %72, label %.lr.ph28, label %._crit_edge29, !llvm.loop !21

._crit_edge35:                                    ; preds = %.lr.ph34, %middle.block
  %.lcssa64 = phi i64 [ %61, %middle.block ], [ %75, %.lr.ph34 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #9
  store i64 -9223372036854775808, ptr %7, align 8, !tbaa !13
  br i1 %55, label %.lr.ph39, label %._crit_edge40

.lr.ph34:                                         ; preds = %.lr.ph34.preheader68, %.lr.ph34
  %indvars.iv52 = phi i64 [ %indvars.iv.next53, %.lr.ph34 ], [ %indvars.iv52.ph, %.lr.ph34.preheader68 ]
  %.02031 = phi i64 [ %75, %.lr.ph34 ], [ %.02031.ph, %.lr.ph34.preheader68 ]
  %73 = getelementptr inbounds i64, ptr %46, i64 %indvars.iv52
  %74 = load i64, ptr %73, align 8, !tbaa !13
  %75 = add nsw i64 %74, %.02031
  %indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next53, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge35, label %.lr.ph34, !llvm.loop !22

._crit_edge40:                                    ; preds = %.lr.ph39, %._crit_edge35.thread, %._crit_edge35
  %.020.lcssa59 = phi i64 [ %.lcssa64, %._crit_edge35 ], [ 0, %._crit_edge35.thread ], [ %.lcssa64, %.lr.ph39 ]
  %76 = phi i64 [ -9223372036854775808, %._crit_edge35 ], [ -9223372036854775808, %._crit_edge35.thread ], [ %88, %.lr.ph39 ]
  %77 = sub nsw i64 %.020.lcssa59, %76
  %78 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %77)
  %79 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %78, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #9
  call void @llvm.stackrestore.p0(ptr %21)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #9
  %80 = load i32, ptr %1, align 4, !tbaa !8
  %81 = add nsw i32 %80, -1
  store i32 %81, ptr %1, align 4, !tbaa !8
  %.not = icmp eq i32 %80, 0
  br i1 %.not, label %._crit_edge44, label %.lr.ph43, !llvm.loop !23

.lr.ph39:                                         ; preds = %._crit_edge35, %.lr.ph39
  %indvars.iv55 = phi i64 [ %indvars.iv.next56, %.lr.ph39 ], [ 0, %._crit_edge35 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #9
  %82 = getelementptr inbounds %"struct.std::pair", ptr %22, i64 %indvars.iv55
  %83 = load i64, ptr %82, align 16, !tbaa !15
  %84 = getelementptr inbounds i64, ptr %46, i64 %indvars.iv55
  %85 = load i64, ptr %84, align 8, !tbaa !13
  %86 = sub i64 %85, %83
  store i64 %86, ptr %8, align 8, !tbaa !13
  %87 = 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) %8)
  %88 = load i64, ptr %87, align 8, !tbaa !13
  store i64 %88, ptr %7, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #9
  %indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
  %89 = load i32, ptr %2, align 4, !tbaa !8
  %90 = sext i32 %89 to i64
  %91 = icmp slt i64 %indvars.iv.next56, %90
  br i1 %91, label %.lr.ph39, label %._crit_edge40, !llvm.loop !24

._crit_edge44:                                    ; preds = %._crit_edge40, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #9
  ret i32 0
}

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

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIxxEC2IxxTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 align 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 #5 align 2

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #7

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { 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 = { 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 #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 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"long long", !10, i64 0}
!15 = !{!16, !14, i64 0}
!16 = !{!"_ZTSSt4pairIxxE", !14, i64 0, !14, i64 8}
!17 = !{!16, !14, i64 8}
!18 = distinct !{!18, !12, !19, !20}
!19 = !{!"llvm.loop.isvectorized", i32 1}
!20 = !{!"llvm.loop.unroll.runtime.disable"}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12, !20, !19}
!23 = distinct !{!23, !12}
!24 = distinct !{!24, !12}


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