; LLVM IR from AdarshGaur/Competitive-Programming :: Codeforces/Educational Codeforces Round 126 (Rated for Div. 2)/C. Water the Trees.l_c5047c8e (Z5solvev)

; 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" }
%"class.std::initializer_list" = type { ptr, i64 }

@.str = external hidden unnamed_addr constant [2 x i8], align 1
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #2 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca %"class.std::initializer_list", align 8
  %12 = alloca [2 x i64], align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  %23 = alloca i64, align 8
  %24 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  store i64 0, ptr %2, align 8, !tbaa !5
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %26 = load i64, ptr %1, align 8, !tbaa !5
  %27 = call ptr @llvm.stacksave.p0()
  store ptr %27, ptr %3, align 8
  %28 = alloca i64, i64 %26, align 16
  store i64 %26, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  store ptr %28, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %29 = load ptr, ptr %5, align 8, !tbaa !9
  store ptr %29, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %30 = load ptr, ptr %5, align 8, !tbaa !9
  %31 = mul nuw i64 8, %26
  %32 = udiv i64 %31, 8
  %33 = getelementptr inbounds i64, ptr %30, i64 %32
  store ptr %33, ptr %7, align 8, !tbaa !9
  br label %34

34:                                               ; preds = %46, %0
  %35 = load ptr, ptr %6, align 8, !tbaa !9
  %36 = load ptr, ptr %7, align 8, !tbaa !9
  %37 = icmp ne ptr %35, %36
  br i1 %37, label %39, label %38

38:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  br label %49

39:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %40 = load ptr, ptr %6, align 8, !tbaa !9
  store ptr %40, ptr %8, align 8, !tbaa !9
  %41 = load ptr, ptr %8, align 8, !tbaa !9
  %42 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %41)
  %43 = load ptr, ptr %8, align 8, !tbaa !9
  %44 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIlERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %43)
  %45 = load i64, ptr %44, align 8, !tbaa !5
  store i64 %45, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %46

46:                                               ; preds = %39
  %47 = load ptr, ptr %6, align 8, !tbaa !9
  %48 = getelementptr inbounds i64, ptr %47, i32 1
  store ptr %48, ptr %6, align 8, !tbaa !9
  br label %34

49:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  store i64 2000000000000000000, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #6
  %50 = load i64, ptr %2, align 8, !tbaa !5
  store i64 %50, ptr %12, align 8, !tbaa !5
  %51 = getelementptr inbounds i64, ptr %12, i64 1
  %52 = load i64, ptr %2, align 8, !tbaa !5
  %53 = add nsw i64 %52, 1
  store i64 %53, ptr %51, align 8, !tbaa !5
  %54 = getelementptr inbounds %"class.std::initializer_list", ptr %11, i32 0, i32 0
  store ptr %12, ptr %54, align 8, !tbaa !11
  %55 = getelementptr inbounds %"class.std::initializer_list", ptr %11, i32 0, i32 1
  store i64 2, ptr %55, align 8, !tbaa !13
  store ptr %11, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %56 = load ptr, ptr %10, align 8, !tbaa !9
  %57 = call noundef ptr @_ZNKSt16initializer_listIlE5beginEv(ptr noundef nonnull align 8 dereferenceable(16) %56) #6
  store ptr %57, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %58 = load ptr, ptr %10, align 8, !tbaa !9
  %59 = call noundef ptr @_ZNKSt16initializer_listIlE3endEv(ptr noundef nonnull align 8 dereferenceable(16) %58) #6
  store ptr %59, ptr %14, align 8, !tbaa !9
  br label %60

60:                                               ; preds = %135, %49
  %61 = load ptr, ptr %13, align 8, !tbaa !9
  %62 = load ptr, ptr %14, align 8, !tbaa !9
  %63 = icmp ne ptr %61, %62
  br i1 %63, label %65, label %64

64:                                               ; preds = %60
  store i32 4, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %138

65:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %66 = load ptr, ptr %13, align 8, !tbaa !9
  %67 = load i64, ptr %66, align 8, !tbaa !5
  store i64 %67, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  store i64 0, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  store i64 0, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  store i64 0, ptr %19, align 8, !tbaa !5
  br label %68

68:                                               ; preds = %93, %65
  %69 = load i64, ptr %19, align 8, !tbaa !5
  %70 = load i64, ptr %1, align 8, !tbaa !5
  %71 = icmp slt i64 %69, %70
  br i1 %71, label %73, label %72

72:                                               ; preds = %68
  store i32 6, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  br label %96

73:                                               ; preds = %68
  %74 = load i64, ptr %16, align 8, !tbaa !5
  %75 = load i64, ptr %19, align 8, !tbaa !5
  %76 = getelementptr inbounds i64, ptr %28, i64 %75
  %77 = load i64, ptr %76, align 8, !tbaa !5
  %78 = xor i64 %74, %77
  %79 = and i64 %78, 1
  %80 = icmp ne i64 %79, 0
  br i1 %80, label %81, label %84

81:                                               ; preds = %73
  %82 = load i64, ptr %17, align 8, !tbaa !5
  %83 = add nsw i64 %82, 1
  store i64 %83, ptr %17, align 8, !tbaa !5
  br label %84

84:                                               ; preds = %81, %73
  %85 = load i64, ptr %16, align 8, !tbaa !5
  %86 = load i64, ptr %19, align 8, !tbaa !5
  %87 = getelementptr inbounds i64, ptr %28, i64 %86
  %88 = load i64, ptr %87, align 8, !tbaa !5
  %89 = sub nsw i64 %85, %88
  %90 = sdiv i64 %89, 2
  %91 = load i64, ptr %18, align 8, !tbaa !5
  %92 = add nsw i64 %91, %90
  store i64 %92, ptr %18, align 8, !tbaa !5
  br label %93

93:                                               ; preds = %84
  %94 = load i64, ptr %19, align 8, !tbaa !5
  %95 = add nsw i64 %94, 1
  store i64 %95, ptr %19, align 8, !tbaa !5
  br label %68, !llvm.loop !14

96:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  store i64 0, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  store i64 2000000000000000000, ptr %21, align 8, !tbaa !5
  br label %97

97:                                               ; preds = %131, %96
  %98 = load i64, ptr %20, align 8, !tbaa !5
  %99 = load i64, ptr %21, align 8, !tbaa !5
  %100 = icmp slt i64 %98, %99
  br i1 %100, label %101, label %132

101:                                              ; preds = %97
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #6
  %102 = load i64, ptr %20, align 8, !tbaa !5
  %103 = load i64, ptr %21, align 8, !tbaa !5
  %104 = load i64, ptr %20, align 8, !tbaa !5
  %105 = sub nsw i64 %103, %104
  %106 = sdiv i64 %105, 2
  %107 = add nsw i64 %102, %106
  store i64 %107, ptr %22, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #6
  %108 = load i64, ptr %22, align 8, !tbaa !5
  %109 = add nsw i64 %108, 1
  %110 = sdiv i64 %109, 2
  store i64 %110, ptr %23, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #6
  %111 = load i64, ptr %22, align 8, !tbaa !5
  %112 = load i64, ptr %23, align 8, !tbaa !5
  %113 = sub nsw i64 %111, %112
  store i64 %113, ptr %24, align 8, !tbaa !5
  %114 = load i64, ptr %17, align 8, !tbaa !5
  %115 = load i64, ptr %23, align 8, !tbaa !5
  %116 = icmp sle i64 %114, %115
  br i1 %116, label %117, label %128

117:                                              ; preds = %101
  %118 = load i64, ptr %18, align 8, !tbaa !5
  %119 = load i64, ptr %24, align 8, !tbaa !5
  %120 = load i64, ptr %23, align 8, !tbaa !5
  %121 = load i64, ptr %17, align 8, !tbaa !5
  %122 = sub nsw i64 %120, %121
  %123 = sdiv i64 %122, 2
  %124 = add nsw i64 %119, %123
  %125 = icmp sle i64 %118, %124
  br i1 %125, label %126, label %128

126:                                              ; preds = %117
  %127 = load i64, ptr %22, align 8, !tbaa !5
  store i64 %127, ptr %21, align 8, !tbaa !5
  br label %131

128:                                              ; preds = %117, %101
  %129 = load i64, ptr %22, align 8, !tbaa !5
  %130 = add nsw i64 %129, 1
  store i64 %130, ptr %20, align 8, !tbaa !5
  br label %131

131:                                              ; preds = %128, %126
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #6
  br label %97, !llvm.loop !16

132:                                              ; preds = %97
  %133 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIlERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %20)
  %134 = load i64, ptr %133, align 8, !tbaa !5
  store i64 %134, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  br label %135

135:                                              ; preds = %132
  %136 = load ptr, ptr %13, align 8, !tbaa !9
  %137 = getelementptr inbounds i64, ptr %136, i32 1
  store ptr %137, ptr %13, align 8, !tbaa !9
  br label %60

138:                                              ; preds = %64
  %139 = load i64, ptr %9, align 8, !tbaa !5
  %140 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %139)
  %141 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %140, ptr noundef @.str)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  %142 = load ptr, ptr %3, align 8
  call void @llvm.stackrestore.p0(ptr %142)
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #6
  ret void
}

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt16initializer_listIlE5beginEv(ptr noundef nonnull align 8 dereferenceable(16)) #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt16initializer_listIlE3endEv(ptr noundef nonnull align 8 dereferenceable(16)) #5 align 2

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

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_ZTSSt16initializer_listIlE", !10, i64 0, !6, i64 8}
!13 = !{!12, !6, i64 8}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}


; 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" }
%"class.std::initializer_list" = type { ptr, i64 }

@.str = external hidden unnamed_addr constant [2 x i8], align 1
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #2 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca %"class.std::initializer_list", align 8
  %5 = alloca [2 x i64], align 8
  %6 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  store i64 0, ptr %2, align 8, !tbaa !5
  %7 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %8 = load i64, ptr %1, align 8, !tbaa !5
  %9 = call ptr @llvm.stacksave.p0()
  %10 = alloca i64, i64 %8, align 16
  %11 = getelementptr inbounds i64, ptr %10, i64 %8
  %.not47 = icmp eq i64 %8, 0
  br i1 %.not47, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %0
  %12 = phi i64 [ 0, %0 ], [ %20, %.lr.ph ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  store i64 2000000000000000000, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #7
  store i64 %12, ptr %5, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %5, i64 8
  %14 = add nsw i64 %12, 1
  store i64 %14, ptr %13, align 8, !tbaa !5
  store ptr %5, ptr %4, align 8, !tbaa !9
  %15 = getelementptr inbounds i8, ptr %4, i64 8
  store i64 2, ptr %15, align 8, !tbaa !12
  %16 = call noundef ptr @_ZNKSt16initializer_listIlE5beginEv(ptr noundef nonnull align 8 dereferenceable(16) %4) #7
  %17 = call noundef ptr @_ZNKSt16initializer_listIlE3endEv(ptr noundef nonnull align 8 dereferenceable(16) %4) #7
  %.not4360 = icmp eq ptr %16, %17
  br i1 %.not4360, label %._crit_edge64, label %.lr.ph63

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.048 = phi ptr [ %21, %.lr.ph ], [ %10, %0 ]
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %.048)
  %19 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIlERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %.048)
  %20 = load i64, ptr %19, align 8, !tbaa !5
  store i64 %20, ptr %2, align 8, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %.048, i64 8
  %.not = icmp eq ptr %21, %11
  br i1 %.not, label %._crit_edge, label %.lr.ph

._crit_edge64:                                    ; preds = %._crit_edge59, %._crit_edge
  %22 = phi i64 [ 2000000000000000000, %._crit_edge ], [ %69, %._crit_edge59 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #7
  %23 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %22)
  %24 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %23, ptr noundef nonnull @.str)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  call void @llvm.stackrestore.p0(ptr %9)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  ret void

.lr.ph63:                                         ; preds = %._crit_edge, %._crit_edge59
  %.03561 = phi ptr [ %70, %._crit_edge59 ], [ %16, %._crit_edge ]
  %25 = load i64, ptr %.03561, align 8, !tbaa !5
  %26 = load i64, ptr %1, align 8, !tbaa !5
  %27 = icmp sgt i64 %26, 0
  br i1 %27, label %.lr.ph53.preheader, label %.lr.ph58.preheader

.lr.ph53.preheader:                               ; preds = %.lr.ph63
  %min.iters.check = icmp ult i64 %26, 4
  br i1 %min.iters.check, label %.lr.ph53.preheader75, label %vector.ph

.lr.ph53.preheader75:                             ; preds = %middle.block, %.lr.ph53.preheader
  %.03751.ph = phi i64 [ 0, %.lr.ph53.preheader ], [ %n.vec, %middle.block ]
  %.03850.ph = phi i64 [ 0, %.lr.ph53.preheader ], [ %43, %middle.block ]
  %.03949.ph = phi i64 [ 0, %.lr.ph53.preheader ], [ %44, %middle.block ]
  br label %.lr.ph53

vector.ph:                                        ; preds = %.lr.ph53.preheader
  %n.vec = and i64 %26, 9223372036854775804
  %broadcast.splatinsert = insertelement <2 x i64> poison, i64 %25, 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.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %40, %vector.body ]
  %vec.phi69 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %41, %vector.body ]
  %vec.phi70 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %34, %vector.body ]
  %vec.phi71 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %35, %vector.body ]
  %28 = getelementptr inbounds i64, ptr %10, i64 %index
  %29 = getelementptr inbounds i8, ptr %28, i64 16
  %wide.load = load <2 x i64>, ptr %28, align 16, !tbaa !5
  %wide.load72 = load <2 x i64>, ptr %29, align 16, !tbaa !5
  %30 = xor <2 x i64> %wide.load, %broadcast.splat
  %31 = xor <2 x i64> %wide.load72, %broadcast.splat
  %32 = and <2 x i64> %30, <i64 1, i64 1>
  %33 = and <2 x i64> %31, <i64 1, i64 1>
  %34 = add <2 x i64> %32, %vec.phi70
  %35 = add <2 x i64> %33, %vec.phi71
  %36 = sub nsw <2 x i64> %broadcast.splat, %wide.load
  %37 = sub nsw <2 x i64> %broadcast.splat, %wide.load72
  %38 = sdiv <2 x i64> %36, <i64 2, i64 2>
  %39 = sdiv <2 x i64> %37, <i64 2, i64 2>
  %40 = add <2 x i64> %38, %vec.phi
  %41 = add <2 x i64> %39, %vec.phi69
  %index.next = add nuw i64 %index, 4
  %42 = icmp eq i64 %index.next, %n.vec
  br i1 %42, label %middle.block, label %vector.body, !llvm.loop !13

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <2 x i64> %41, %40
  %43 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  %bin.rdx73 = add <2 x i64> %35, %34
  %44 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx73)
  %cmp.n = icmp eq i64 %26, %n.vec
  br i1 %cmp.n, label %.lr.ph58.preheader, label %.lr.ph53.preheader75

.lr.ph58.preheader:                               ; preds = %.lr.ph53, %middle.block, %.lr.ph63
  %.039.lcssa = phi i64 [ 0, %.lr.ph63 ], [ %44, %middle.block ], [ %spec.select, %.lr.ph53 ]
  %.038.lcssa = phi i64 [ 0, %.lr.ph63 ], [ %43, %middle.block ], [ %51, %.lr.ph53 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  store i64 0, ptr %6, align 8, !tbaa !5
  br label %.lr.ph58

.lr.ph53:                                         ; preds = %.lr.ph53.preheader75, %.lr.ph53
  %.03751 = phi i64 [ %52, %.lr.ph53 ], [ %.03751.ph, %.lr.ph53.preheader75 ]
  %.03850 = phi i64 [ %51, %.lr.ph53 ], [ %.03850.ph, %.lr.ph53.preheader75 ]
  %.03949 = phi i64 [ %spec.select, %.lr.ph53 ], [ %.03949.ph, %.lr.ph53.preheader75 ]
  %45 = getelementptr inbounds i64, ptr %10, i64 %.03751
  %46 = load i64, ptr %45, align 8, !tbaa !5
  %47 = xor i64 %46, %25
  %48 = and i64 %47, 1
  %spec.select = add i64 %48, %.03949
  %49 = sub nsw i64 %25, %46
  %50 = sdiv i64 %49, 2
  %51 = add nsw i64 %50, %.03850
  %52 = add nuw nsw i64 %.03751, 1
  %exitcond.not = icmp eq i64 %52, %26
  br i1 %exitcond.not, label %.lr.ph58.preheader, label %.lr.ph53, !llvm.loop !17

.lr.ph58:                                         ; preds = %.lr.ph58.preheader, %65
  %.03656 = phi i64 [ %.1, %65 ], [ 2000000000000000000, %.lr.ph58.preheader ]
  %53 = phi i64 [ %66, %65 ], [ 0, %.lr.ph58.preheader ]
  %54 = sub nsw i64 %.03656, %53
  %55 = sdiv i64 %54, 2
  %56 = add nsw i64 %55, %53
  %57 = add nsw i64 %56, 1
  %58 = sdiv i64 %57, 2
  %.not44 = icmp sgt i64 %.039.lcssa, %58
  br i1 %.not44, label %64, label %59

59:                                               ; preds = %.lr.ph58
  %60 = sub i64 %56, %58
  %61 = sub nsw i64 %58, %.039.lcssa
  %62 = sdiv i64 %61, 2
  %63 = add nsw i64 %60, %62
  %.not45 = icmp sgt i64 %.038.lcssa, %63
  br i1 %.not45, label %64, label %65

64:                                               ; preds = %59, %.lr.ph58
  store i64 %57, ptr %6, align 8, !tbaa !5
  br label %65

65:                                               ; preds = %59, %64
  %66 = phi i64 [ %57, %64 ], [ %53, %59 ]
  %.1 = phi i64 [ %.03656, %64 ], [ %56, %59 ]
  %67 = icmp slt i64 %66, %.1
  br i1 %67, label %.lr.ph58, label %._crit_edge59, !llvm.loop !18

._crit_edge59:                                    ; preds = %65
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIlERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %69 = load i64, ptr %68, align 8, !tbaa !5
  store i64 %69, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  %70 = getelementptr inbounds i8, ptr %.03561, i64 8
  %.not43 = icmp eq ptr %70, %17
  br i1 %.not43, label %._crit_edge64, label %.lr.ph63
}

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt16initializer_listIlE5beginEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt16initializer_listIlE3endEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #5 align 2

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

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

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { 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 #5 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"_ZTSSt16initializer_listIlE", !11, i64 0, !6, i64 8}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!10, !6, i64 8}
!13 = distinct !{!13, !14, !15, !16}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !14, !16, !15}
!18 = distinct !{!18, !14}


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