; LLVM IR from ritikbanger/Hacktoberfest2022-DSA :: 22. Segment Tree (Forest_Queries)

; 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" }

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

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

30:                                               ; preds = %168, %0
  %31 = load i64, ptr %2, align 8, !tbaa !8
  %32 = add nsw i64 %31, -1
  store i64 %32, ptr %2, align 8, !tbaa !8
  %33 = icmp ne i64 %31, 0
  br i1 %33, label %34, label %170

34:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #8
  %35 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %35, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %37 = load i64, ptr %3, align 8, !tbaa !8
  %38 = add nsw i64 %37, 1
  %39 = load i64, ptr %3, align 8, !tbaa !8
  %40 = add nsw i64 %39, 1
  %41 = call ptr @llvm.stacksave.p0()
  store ptr %41, ptr %5, align 8
  %42 = mul nuw i64 %38, %40
  %43 = alloca i64, i64 %42, align 16
  store i64 %38, ptr %6, align 8
  store i64 %40, ptr %7, align 8
  %44 = mul nuw i64 %38, %40
  %45 = mul nuw i64 8, %44
  call void @llvm.memset.p0.i64(ptr align 16 %43, i8 0, i64 %45, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  store i64 1, ptr %8, align 8, !tbaa !8
  br label %46

46:                                               ; preds = %87, %34
  %47 = load i64, ptr %8, align 8, !tbaa !8
  %48 = load i64, ptr %3, align 8, !tbaa !8
  %49 = icmp sle i64 %47, %48
  br i1 %49, label %51, label %50

50:                                               ; preds = %46
  store i32 4, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  br label %90

51:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  store i64 1, ptr %10, align 8, !tbaa !8
  br label %52

52:                                               ; preds = %83, %51
  %53 = load i64, ptr %10, align 8, !tbaa !8
  %54 = load i64, ptr %3, align 8, !tbaa !8
  %55 = icmp sle i64 %53, %54
  br i1 %55, label %57, label %56

56:                                               ; preds = %52
  store i32 7, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  br label %86

57:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #8
  %58 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 1 dereferenceable(1) %11)
  %59 = load i8, ptr %11, align 1, !tbaa !11
  %60 = sext i8 %59 to i32
  %61 = icmp eq i32 %60, 42
  br i1 %61, label %62, label %68

62:                                               ; preds = %57
  %63 = load i64, ptr %8, align 8, !tbaa !8
  %64 = mul nsw i64 %63, %40
  %65 = getelementptr inbounds i64, ptr %43, i64 %64
  %66 = load i64, ptr %10, align 8, !tbaa !8
  %67 = getelementptr inbounds i64, ptr %65, i64 %66
  store i64 1, ptr %67, align 8, !tbaa !8
  br label %68

68:                                               ; preds = %62, %57
  %69 = load i64, ptr %8, align 8, !tbaa !8
  %70 = mul nsw i64 %69, %40
  %71 = getelementptr inbounds i64, ptr %43, i64 %70
  %72 = load i64, ptr %10, align 8, !tbaa !8
  %73 = sub nsw i64 %72, 1
  %74 = getelementptr inbounds i64, ptr %71, i64 %73
  %75 = load i64, ptr %74, align 8, !tbaa !8
  %76 = load i64, ptr %8, align 8, !tbaa !8
  %77 = mul nsw i64 %76, %40
  %78 = getelementptr inbounds i64, ptr %43, i64 %77
  %79 = load i64, ptr %10, align 8, !tbaa !8
  %80 = getelementptr inbounds i64, ptr %78, i64 %79
  %81 = load i64, ptr %80, align 8, !tbaa !8
  %82 = add nsw i64 %81, %75
  store i64 %82, ptr %80, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #8
  br label %83

83:                                               ; preds = %68
  %84 = load i64, ptr %10, align 8, !tbaa !8
  %85 = add nsw i64 %84, 1
  store i64 %85, ptr %10, align 8, !tbaa !8
  br label %52, !llvm.loop !12

86:                                               ; preds = %56
  br label %87

87:                                               ; preds = %86
  %88 = load i64, ptr %8, align 8, !tbaa !8
  %89 = add nsw i64 %88, 1
  store i64 %89, ptr %8, align 8, !tbaa !8
  br label %46, !llvm.loop !14

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

91:                                               ; preds = %121, %90
  %92 = load i64, ptr %12, align 8, !tbaa !8
  %93 = load i64, ptr %3, align 8, !tbaa !8
  %94 = icmp sle i64 %92, %93
  br i1 %94, label %96, label %95

95:                                               ; preds = %91
  store i32 10, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  br label %124

96:                                               ; preds = %91
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  store i64 1, ptr %13, align 8, !tbaa !8
  br label %97

97:                                               ; preds = %117, %96
  %98 = load i64, ptr %13, align 8, !tbaa !8
  %99 = load i64, ptr %3, align 8, !tbaa !8
  %100 = icmp sle i64 %98, %99
  br i1 %100, label %102, label %101

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

102:                                              ; preds = %97
  %103 = load i64, ptr %13, align 8, !tbaa !8
  %104 = sub nsw i64 %103, 1
  %105 = mul nsw i64 %104, %40
  %106 = getelementptr inbounds i64, ptr %43, i64 %105
  %107 = load i64, ptr %12, align 8, !tbaa !8
  %108 = getelementptr inbounds i64, ptr %106, i64 %107
  %109 = load i64, ptr %108, align 8, !tbaa !8
  %110 = load i64, ptr %13, align 8, !tbaa !8
  %111 = mul nsw i64 %110, %40
  %112 = getelementptr inbounds i64, ptr %43, i64 %111
  %113 = load i64, ptr %12, align 8, !tbaa !8
  %114 = getelementptr inbounds i64, ptr %112, i64 %113
  %115 = load i64, ptr %114, align 8, !tbaa !8
  %116 = add nsw i64 %115, %109
  store i64 %116, ptr %114, align 8, !tbaa !8
  br label %117

117:                                              ; preds = %102
  %118 = load i64, ptr %13, align 8, !tbaa !8
  %119 = add nsw i64 %118, 1
  store i64 %119, ptr %13, align 8, !tbaa !8
  br label %97, !llvm.loop !15

120:                                              ; preds = %101
  br label %121

121:                                              ; preds = %120
  %122 = load i64, ptr %12, align 8, !tbaa !8
  %123 = add nsw i64 %122, 1
  store i64 %123, ptr %12, align 8, !tbaa !8
  br label %91, !llvm.loop !16

124:                                              ; preds = %95
  br label %125

125:                                              ; preds = %129, %124
  %126 = load i64, ptr %4, align 8, !tbaa !8
  %127 = add nsw i64 %126, -1
  store i64 %127, ptr %4, align 8, !tbaa !8
  %128 = icmp ne i64 %126, 0
  br i1 %128, label %129, label %168

129:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  %130 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %14)
  %131 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %130, ptr noundef nonnull align 8 dereferenceable(8) %16)
  %132 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %131, ptr noundef nonnull align 8 dereferenceable(8) %15)
  %133 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %132, ptr noundef nonnull align 8 dereferenceable(8) %17)
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  %134 = load i64, ptr %15, align 8, !tbaa !8
  %135 = mul nsw i64 %134, %40
  %136 = getelementptr inbounds i64, ptr %43, i64 %135
  %137 = load i64, ptr %17, align 8, !tbaa !8
  %138 = getelementptr inbounds i64, ptr %136, i64 %137
  %139 = load i64, ptr %138, align 8, !tbaa !8
  %140 = load i64, ptr %14, align 8, !tbaa !8
  %141 = sub nsw i64 %140, 1
  %142 = mul nsw i64 %141, %40
  %143 = getelementptr inbounds i64, ptr %43, i64 %142
  %144 = load i64, ptr %17, align 8, !tbaa !8
  %145 = getelementptr inbounds i64, ptr %143, i64 %144
  %146 = load i64, ptr %145, align 8, !tbaa !8
  %147 = sub nsw i64 %139, %146
  %148 = load i64, ptr %15, align 8, !tbaa !8
  %149 = mul nsw i64 %148, %40
  %150 = getelementptr inbounds i64, ptr %43, i64 %149
  %151 = load i64, ptr %16, align 8, !tbaa !8
  %152 = sub nsw i64 %151, 1
  %153 = getelementptr inbounds i64, ptr %150, i64 %152
  %154 = load i64, ptr %153, align 8, !tbaa !8
  %155 = sub nsw i64 %147, %154
  %156 = load i64, ptr %14, align 8, !tbaa !8
  %157 = sub nsw i64 %156, 1
  %158 = mul nsw i64 %157, %40
  %159 = getelementptr inbounds i64, ptr %43, i64 %158
  %160 = load i64, ptr %16, align 8, !tbaa !8
  %161 = sub nsw i64 %160, 1
  %162 = getelementptr inbounds i64, ptr %159, i64 %161
  %163 = load i64, ptr %162, align 8, !tbaa !8
  %164 = add nsw i64 %155, %163
  store i64 %164, ptr %18, align 8, !tbaa !8
  %165 = load i64, ptr %18, align 8, !tbaa !8
  %166 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %165)
  %167 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %166, ptr noundef @.str)
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  br label %125, !llvm.loop !17

168:                                              ; preds = %125
  %169 = load ptr, ptr %5, align 8
  call void @llvm.stackrestore.p0(ptr %169)
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #8
  br label %30, !llvm.loop !18

170:                                              ; preds = %30
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #8
  %171 = load i32, ptr %1, align 4
  ret i32 %171
}

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #3 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)) #4 align 2

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(1)) #2

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

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

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

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


; 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" }

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

; 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: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i8, align 1
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %9 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %10 = getelementptr i8, ptr %9, i64 -24
  %11 = load i64, ptr %10, align 8
  %12 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %11
  %13 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %12, ptr noundef null)
  %14 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %15 = getelementptr i8, ptr %14, i64 -24
  %16 = load i64, ptr %15, align 8
  %17 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %16
  %18 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %17, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #8
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %21 = load i64, ptr %1, align 8, !tbaa !8
  %22 = add nsw i64 %21, 1
  %23 = call ptr @llvm.stacksave.p0()
  %24 = mul nuw i64 %22, %22
  %25 = alloca i64, i64 %24, align 16
  %26 = shl nuw i64 %24, 3
  call void @llvm.memset.p0.i64(ptr nonnull align 16 %25, i8 0, i64 %26, i1 false)
  %27 = load i64, ptr %1, align 8, !tbaa !8
  %.not2537 = icmp slt i64 %27, 1
  br i1 %.not2537, label %.preheader33, label %.preheader32

.preheader34:                                     ; preds = %._crit_edge
  %.not2645 = icmp slt i64 %32, 1
  br i1 %.not2645, label %.preheader33, label %.preheader.preheader

.preheader.preheader:                             ; preds = %.preheader34
  %xtraiter = and i64 %32, 1
  %28 = icmp eq i64 %32, 1
  %unroll_iter = and i64 %32, 9223372036854775806
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader

.preheader32:                                     ; preds = %0, %._crit_edge
  %29 = phi i64 [ %32, %._crit_edge ], [ %27, %0 ]
  %.02438 = phi i64 [ %33, %._crit_edge ], [ 1, %0 ]
  %.not2935 = icmp slt i64 %29, 1
  br i1 %.not2935, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader32
  %30 = mul nsw i64 %.02438, %22
  %31 = getelementptr inbounds i64, ptr %25, i64 %30
  br label %34

._crit_edge:                                      ; preds = %38, %.preheader32
  %32 = phi i64 [ %29, %.preheader32 ], [ %45, %38 ]
  %33 = add nuw nsw i64 %.02438, 1
  %.not25.not = icmp slt i64 %.02438, %32
  br i1 %.not25.not, label %.preheader32, label %.preheader34, !llvm.loop !11

34:                                               ; preds = %.lr.ph, %38
  %.02336 = phi i64 [ 1, %.lr.ph ], [ %44, %38 ]
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %3) #8
  %35 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 1 dereferenceable(1) %3)
  %36 = load i8, ptr %3, align 1, !tbaa !14
  %37 = icmp eq i8 %36, 42
  br i1 %37, label %38, label %._crit_edge53

._crit_edge53:                                    ; preds = %34
  %.phi.trans.insert = getelementptr i64, ptr %31, i64 %.02336
  %.pre = load i64, ptr %.phi.trans.insert, align 8, !tbaa !8
  br label %38

38:                                               ; preds = %34, %._crit_edge53
  %39 = phi i64 [ %.pre, %._crit_edge53 ], [ 1, %34 ]
  %40 = getelementptr i64, ptr %31, i64 %.02336
  %41 = getelementptr i8, ptr %40, i64 -8
  %42 = load i64, ptr %41, align 8, !tbaa !8
  %43 = add nsw i64 %39, %42
  store i64 %43, ptr %40, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #8
  %44 = add nuw nsw i64 %.02336, 1
  %45 = load i64, ptr %1, align 8, !tbaa !8
  %.not29.not = icmp slt i64 %.02336, %45
  br i1 %.not29.not, label %34, label %._crit_edge, !llvm.loop !15

.preheader33:                                     ; preds = %._crit_edge44, %0, %.preheader34
  %46 = load i64, ptr %2, align 8, !tbaa !8
  %47 = add nsw i64 %46, -1
  store i64 %47, ptr %2, align 8, !tbaa !8
  %.not2747 = icmp eq i64 %46, 0
  br i1 %.not2747, label %._crit_edge49, label %.lr.ph48

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge44
  %.02246 = phi i64 [ %54, %._crit_edge44 ], [ 1, %.preheader.preheader ]
  %invariant.gep = getelementptr i64, ptr %25, i64 %.02246
  br i1 %28, label %._crit_edge44.unr-lcssa, label %.preheader.new

._crit_edge44.unr-lcssa:                          ; preds = %.preheader.new, %.preheader
  %.02142.unr = phi i64 [ 1, %.preheader ], [ %67, %.preheader.new ]
  br i1 %lcmp.mod.not, label %._crit_edge44, label %._crit_edge44.epilog-lcssa

._crit_edge44.epilog-lcssa:                       ; preds = %._crit_edge44.unr-lcssa
  %48 = add nsw i64 %.02142.unr, -1
  %49 = mul nsw i64 %48, %22
  %gep.epil = getelementptr i64, ptr %invariant.gep, i64 %49
  %50 = load i64, ptr %gep.epil, align 8, !tbaa !8
  %51 = mul nsw i64 %.02142.unr, %22
  %gep40.epil = getelementptr i64, ptr %invariant.gep, i64 %51
  %52 = load i64, ptr %gep40.epil, align 8, !tbaa !8
  %53 = add nsw i64 %52, %50
  store i64 %53, ptr %gep40.epil, align 8, !tbaa !8
  br label %._crit_edge44

._crit_edge44:                                    ; preds = %._crit_edge44.unr-lcssa, %._crit_edge44.epilog-lcssa
  %54 = add nuw i64 %.02246, 1
  %exitcond52.not = icmp eq i64 %.02246, %32
  br i1 %exitcond52.not, label %.preheader33, label %.preheader, !llvm.loop !16

.preheader.new:                                   ; preds = %.preheader, %.preheader.new
  %.02142 = phi i64 [ %67, %.preheader.new ], [ 1, %.preheader ]
  %niter = phi i64 [ %niter.next.1, %.preheader.new ], [ 0, %.preheader ]
  %55 = add nsw i64 %.02142, -1
  %56 = mul nsw i64 %55, %22
  %gep = getelementptr i64, ptr %invariant.gep, i64 %56
  %57 = load i64, ptr %gep, align 8, !tbaa !8
  %58 = mul nsw i64 %.02142, %22
  %gep40 = getelementptr i64, ptr %invariant.gep, i64 %58
  %59 = load i64, ptr %gep40, align 8, !tbaa !8
  %60 = add nsw i64 %59, %57
  store i64 %60, ptr %gep40, align 8, !tbaa !8
  %61 = add nuw i64 %.02142, 1
  %62 = mul nsw i64 %.02142, %22
  %gep.1 = getelementptr i64, ptr %invariant.gep, i64 %62
  %63 = load i64, ptr %gep.1, align 8, !tbaa !8
  %64 = mul nsw i64 %61, %22
  %gep40.1 = getelementptr i64, ptr %invariant.gep, i64 %64
  %65 = load i64, ptr %gep40.1, align 8, !tbaa !8
  %66 = add nsw i64 %65, %63
  store i64 %66, ptr %gep40.1, align 8, !tbaa !8
  %67 = add nuw i64 %.02142, 2
  %niter.next.1 = add nuw i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge44.unr-lcssa, label %.preheader.new, !llvm.loop !17

.lr.ph48:                                         ; preds = %.preheader33, %.lr.ph48
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  %68 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %69 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %68, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %70 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %69, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %71 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %70, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %72 = load i64, ptr %5, align 8, !tbaa !8
  %73 = mul nsw i64 %72, %22
  %74 = getelementptr inbounds i64, ptr %25, i64 %73
  %75 = load i64, ptr %7, align 8, !tbaa !8
  %76 = getelementptr inbounds i64, ptr %74, i64 %75
  %77 = load i64, ptr %76, align 8, !tbaa !8
  %78 = load i64, ptr %4, align 8, !tbaa !8
  %79 = add nsw i64 %78, -1
  %80 = mul nsw i64 %79, %22
  %81 = getelementptr inbounds i64, ptr %25, i64 %80
  %82 = getelementptr inbounds i64, ptr %81, i64 %75
  %83 = load i64, ptr %82, align 8, !tbaa !8
  %84 = load i64, ptr %6, align 8, !tbaa !8
  %85 = add nsw i64 %84, -1
  %86 = getelementptr inbounds i64, ptr %74, i64 %85
  %87 = load i64, ptr %86, align 8, !tbaa !8
  %88 = getelementptr inbounds i64, ptr %81, i64 %85
  %89 = load i64, ptr %88, align 8, !tbaa !8
  %90 = add i64 %83, %87
  %91 = sub i64 %77, %90
  %92 = add nsw i64 %91, %89
  %93 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %92)
  %94 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %93, ptr noundef nonnull @.str)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  %95 = load i64, ptr %2, align 8, !tbaa !8
  %96 = add nsw i64 %95, -1
  store i64 %96, ptr %2, align 8, !tbaa !8
  %.not27 = icmp eq i64 %95, 0
  br i1 %.not27, label %._crit_edge49, label %.lr.ph48, !llvm.loop !18

._crit_edge49:                                    ; preds = %.lr.ph48, %.preheader33
  call void @llvm.stackrestore.p0(ptr %23)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #8
  ret i32 0
}

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #3 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 #4 align 2

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #2

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

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

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

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


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