; LLVM IR from UtkarshPathrabe/Competitive-Coding :: HackerRank Solutions/Algorithms/Implementation (Sherlock And 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: 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 i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  %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) %2)
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = zext i32 %17 to i64
  %19 = call ptr @llvm.stacksave.p0()
  store ptr %19, ptr %4, align 8
  %20 = alloca i64, i64 %18, align 16
  store i64 %18, ptr %5, align 8
  %21 = load i32, ptr %3, align 4, !tbaa !5
  %22 = zext i32 %21 to i64
  %23 = alloca i64, i64 %22, align 16
  store i64 %22, ptr %6, align 8
  %24 = load i32, ptr %3, align 4, !tbaa !5
  %25 = zext i32 %24 to i64
  %26 = alloca i64, i64 %25, align 16
  store i64 %25, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %27

27:                                               ; preds = %37, %0
  %28 = load i32, ptr %8, align 4, !tbaa !5
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = icmp slt i32 %28, %29
  br i1 %30, label %32, label %31

31:                                               ; preds = %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %40

32:                                               ; preds = %27
  %33 = load i32, ptr %8, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds i64, ptr %20, i64 %34
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %35)
  br label %37

37:                                               ; preds = %32
  %38 = load i32, ptr %8, align 4, !tbaa !5
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr %8, align 4, !tbaa !5
  br label %27, !llvm.loop !9

40:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %41

41:                                               ; preds = %51, %40
  %42 = load i32, ptr %9, align 4, !tbaa !5
  %43 = load i32, ptr %3, align 4, !tbaa !5
  %44 = icmp slt i32 %42, %43
  br i1 %44, label %46, label %45

45:                                               ; preds = %41
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %54

46:                                               ; preds = %41
  %47 = load i32, ptr %9, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds i64, ptr %23, i64 %48
  %50 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %49)
  br label %51

51:                                               ; preds = %46
  %52 = load i32, ptr %9, align 4, !tbaa !5
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %9, align 4, !tbaa !5
  br label %41, !llvm.loop !11

54:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %55

55:                                               ; preds = %65, %54
  %56 = load i32, ptr %10, align 4, !tbaa !5
  %57 = load i32, ptr %3, align 4, !tbaa !5
  %58 = icmp slt i32 %56, %57
  br i1 %58, label %60, label %59

59:                                               ; preds = %55
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %68

60:                                               ; preds = %55
  %61 = load i32, ptr %10, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds i64, ptr %26, i64 %62
  %64 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %63)
  br label %65

65:                                               ; preds = %60
  %66 = load i32, ptr %10, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %10, align 4, !tbaa !5
  br label %55, !llvm.loop !12

68:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %69

69:                                               ; preds = %111, %68
  %70 = load i32, ptr %11, align 4, !tbaa !5
  %71 = load i32, ptr %3, align 4, !tbaa !5
  %72 = icmp sle i32 %70, %71
  br i1 %72, label %74, label %73

73:                                               ; preds = %69
  store i32 11, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %114

74:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 1, ptr %13, align 4, !tbaa !5
  br label %75

75:                                               ; preds = %107, %74
  %76 = load i32, ptr %13, align 4, !tbaa !5
  %77 = load i32, ptr %2, align 4, !tbaa !5
  %78 = icmp sle i32 %76, %77
  br i1 %78, label %80, label %79

79:                                               ; preds = %75
  store i32 14, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %110

80:                                               ; preds = %75
  %81 = load i32, ptr %13, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = load i32, ptr %11, align 4, !tbaa !5
  %84 = sub nsw i32 %83, 1
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds i64, ptr %23, i64 %85
  %87 = load i64, ptr %86, align 8, !tbaa !13
  %88 = srem i64 %82, %87
  %89 = icmp eq i64 %88, 0
  br i1 %89, label %90, label %106

90:                                               ; preds = %80
  %91 = load i32, ptr %13, align 4, !tbaa !5
  %92 = sub nsw i32 %91, 1
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds i64, ptr %20, i64 %93
  %95 = load i64, ptr %94, align 8, !tbaa !13
  %96 = load i32, ptr %11, align 4, !tbaa !5
  %97 = sub nsw i32 %96, 1
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds i64, ptr %26, i64 %98
  %100 = load i64, ptr %99, align 8, !tbaa !13
  %101 = mul nsw i64 %95, %100
  %102 = load i32, ptr %13, align 4, !tbaa !5
  %103 = sub nsw i32 %102, 1
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds i64, ptr %20, i64 %104
  store i64 %101, ptr %105, align 8, !tbaa !13
  br label %106

106:                                              ; preds = %90, %80
  br label %107

107:                                              ; preds = %106
  %108 = load i32, ptr %13, align 4, !tbaa !5
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr %13, align 4, !tbaa !5
  br label %75, !llvm.loop !15

110:                                              ; preds = %79
  br label %111

111:                                              ; preds = %110
  %112 = load i32, ptr %11, align 4, !tbaa !5
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %11, align 4, !tbaa !5
  br label %69, !llvm.loop !16

114:                                              ; preds = %73
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %115

115:                                              ; preds = %131, %114
  %116 = load i32, ptr %14, align 4, !tbaa !5
  %117 = load i32, ptr %2, align 4, !tbaa !5
  %118 = icmp slt i32 %116, %117
  br i1 %118, label %120, label %119

119:                                              ; preds = %115
  store i32 17, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %134

120:                                              ; preds = %115
  %121 = load i32, ptr %14, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds i64, ptr %20, i64 %122
  %124 = load i64, ptr %123, align 8, !tbaa !13
  %125 = call noundef double @_ZSt3powIiiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef 10, i32 noundef 9)
  %126 = fptosi double %125 to i64
  %127 = add nsw i64 %126, 7
  %128 = srem i64 %124, %127
  %129 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %128)
  %130 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %129, ptr noundef @.str)
  br label %131

131:                                              ; preds = %120
  %132 = load i32, ptr %14, align 4, !tbaa !5
  %133 = add nsw i32 %132, 1
  store i32 %133, ptr %14, align 4, !tbaa !5
  br label %115, !llvm.loop !17

134:                                              ; preds = %119
  %135 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %12, align 4
  %136 = load ptr, ptr %4, align 8
  call void @llvm.stackrestore.p0(ptr %136)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  %137 = load i32, ptr %1, align 4
  ret i32 %137
}

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

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

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

; 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 memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt3powIiiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef, i32 noundef) #6

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #4 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)) #5

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

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

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

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


; 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 norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  %3 = 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)
  %4 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %5 = load i32, ptr %1, align 4, !tbaa !5
  %6 = zext i32 %5 to i64
  %7 = call ptr @llvm.stacksave.p0()
  %8 = alloca i64, i64 %6, align 16
  %9 = load i32, ptr %2, align 4, !tbaa !5
  %10 = zext i32 %9 to i64
  %11 = alloca i64, i64 %10, align 16
  %12 = alloca i64, i64 %10, align 16
  %13 = load i32, ptr %1, align 4, !tbaa !5
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.lr.ph, label %.preheader31

.preheader31.loopexit:                            ; preds = %.lr.ph
  %.pre = load i32, ptr %2, align 4, !tbaa !5
  br label %.preheader31

.preheader31:                                     ; preds = %.preheader31.loopexit, %0
  %15 = phi i32 [ %.pre, %.preheader31.loopexit ], [ %9, %0 ]
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %.lr.ph34, label %.preheader29.thread

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %17 = getelementptr inbounds i64, ptr %8, i64 %indvars.iv
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %17)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %19 = load i32, ptr %1, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = icmp slt i64 %indvars.iv.next, %20
  br i1 %21, label %.lr.ph, label %.preheader31.loopexit, !llvm.loop !9

.preheader30:                                     ; preds = %.lr.ph34
  %22 = icmp sgt i32 %25, 0
  br i1 %22, label %.lr.ph36, label %.preheader29.thread

.lr.ph34:                                         ; preds = %.preheader31, %.lr.ph34
  %indvars.iv48 = phi i64 [ %indvars.iv.next49, %.lr.ph34 ], [ 0, %.preheader31 ]
  %23 = getelementptr inbounds i64, ptr %11, i64 %indvars.iv48
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %23)
  %indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = icmp slt i64 %indvars.iv.next49, %26
  br i1 %27, label %.lr.ph34, label %.preheader30, !llvm.loop !11

.preheader29.thread:                              ; preds = %.preheader30, %.preheader31
  %.pre6568 = load i32, ptr %1, align 4, !tbaa !5
  br label %.preheader

.preheader29:                                     ; preds = %.lr.ph36
  %.not40 = icmp slt i32 %33, 1
  %.pre65 = load i32, ptr %1, align 4, !tbaa !5
  br i1 %.not40, label %.preheader, label %.preheader28.lr.ph

.preheader28.lr.ph:                               ; preds = %.preheader29
  %invariant.gep = getelementptr i8, ptr %8, i64 -8
  %.not2737 = icmp slt i32 %.pre65, 1
  br i1 %.not2737, label %._crit_edge44, label %.preheader28.preheader

.preheader28.preheader:                           ; preds = %.preheader28.lr.ph
  %28 = add nuw i32 %33, 1
  %wide.trip.count60 = zext i32 %28 to i64
  %29 = zext nneg i32 %.pre65 to i64
  %xtraiter = and i64 %29, 1
  %30 = icmp eq i32 %.pre65, 1
  %unroll_iter = and i64 %29, 2147483646
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader28

.lr.ph36:                                         ; preds = %.preheader30, %.lr.ph36
  %indvars.iv51 = phi i64 [ %indvars.iv.next52, %.lr.ph36 ], [ 0, %.preheader30 ]
  %31 = getelementptr inbounds i64, ptr %12, i64 %indvars.iv51
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %31)
  %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = icmp slt i64 %indvars.iv.next52, %34
  br i1 %35, label %.lr.ph36, label %.preheader29, !llvm.loop !12

.preheader28:                                     ; preds = %.preheader28.preheader, %._crit_edge
  %indvars.iv57 = phi i64 [ 1, %.preheader28.preheader ], [ %indvars.iv.next58, %._crit_edge ]
  %36 = add nsw i64 %indvars.iv57, -1
  %37 = getelementptr inbounds i64, ptr %11, i64 %36
  %38 = load i64, ptr %37, align 8, !tbaa !13
  %39 = getelementptr inbounds i64, ptr %12, i64 %36
  br i1 %30, label %._crit_edge.unr-lcssa, label %.preheader28.new

.preheader:                                       ; preds = %._crit_edge, %.preheader29.thread, %.preheader29
  %.pre6569 = phi i32 [ %.pre6568, %.preheader29.thread ], [ %.pre65, %.preheader29 ], [ %.pre65, %._crit_edge ]
  %40 = icmp sgt i32 %.pre6569, 0
  br i1 %40, label %.lr.ph43, label %._crit_edge44

._crit_edge.unr-lcssa:                            ; preds = %60, %.preheader28
  %indvars.iv54.unr = phi i64 [ 1, %.preheader28 ], [ %indvars.iv.next55.1, %60 ]
  br i1 %lcmp.mod.not, label %._crit_edge, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge.unr-lcssa
  %41 = srem i64 %indvars.iv54.unr, %38
  %42 = icmp eq i64 %41, 0
  br i1 %42, label %43, label %._crit_edge

43:                                               ; preds = %.epil.preheader
  %gep.epil = getelementptr i64, ptr %invariant.gep, i64 %indvars.iv54.unr
  %44 = load i64, ptr %gep.epil, align 8, !tbaa !13
  %45 = load i64, ptr %39, align 8, !tbaa !13
  %46 = mul nsw i64 %45, %44
  store i64 %46, ptr %gep.epil, align 8, !tbaa !13
  br label %._crit_edge

._crit_edge:                                      ; preds = %.epil.preheader, %43, %._crit_edge.unr-lcssa
  %indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
  %exitcond61.not = icmp eq i64 %indvars.iv.next58, %wide.trip.count60
  br i1 %exitcond61.not, label %.preheader, label %.preheader28, !llvm.loop !15

.preheader28.new:                                 ; preds = %.preheader28, %60
  %indvars.iv54 = phi i64 [ %indvars.iv.next55.1, %60 ], [ 1, %.preheader28 ]
  %niter = phi i64 [ %niter.next.1, %60 ], [ 0, %.preheader28 ]
  %47 = srem i64 %indvars.iv54, %38
  %48 = icmp eq i64 %47, 0
  br i1 %48, label %49, label %53

49:                                               ; preds = %.preheader28.new
  %gep = getelementptr i64, ptr %invariant.gep, i64 %indvars.iv54
  %50 = load i64, ptr %gep, align 8, !tbaa !13
  %51 = load i64, ptr %39, align 8, !tbaa !13
  %52 = mul nsw i64 %51, %50
  store i64 %52, ptr %gep, align 8, !tbaa !13
  br label %53

53:                                               ; preds = %.preheader28.new, %49
  %indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
  %54 = srem i64 %indvars.iv.next55, %38
  %55 = icmp eq i64 %54, 0
  br i1 %55, label %56, label %60

56:                                               ; preds = %53
  %gep.1 = getelementptr i64, ptr %8, i64 %indvars.iv54
  %57 = load i64, ptr %gep.1, align 8, !tbaa !13
  %58 = load i64, ptr %39, align 8, !tbaa !13
  %59 = mul nsw i64 %58, %57
  store i64 %59, ptr %gep.1, align 8, !tbaa !13
  br label %60

60:                                               ; preds = %56, %53
  %indvars.iv.next55.1 = add nuw nsw i64 %indvars.iv54, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.unr-lcssa, label %.preheader28.new, !llvm.loop !16

._crit_edge44:                                    ; preds = %.lr.ph43, %.preheader28.lr.ph, %.preheader
  %61 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.stackrestore.p0(ptr %7)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret i32 0

.lr.ph43:                                         ; preds = %.preheader, %.lr.ph43
  %indvars.iv62 = phi i64 [ %indvars.iv.next63, %.lr.ph43 ], [ 0, %.preheader ]
  %62 = getelementptr inbounds i64, ptr %8, i64 %indvars.iv62
  %63 = load i64, ptr %62, align 8, !tbaa !13
  %64 = call noundef double @_ZSt3powIiiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef 10, i32 noundef 9)
  %65 = fptosi double %64 to i64
  %66 = add nsw i64 %65, 7
  %67 = srem i64 %63, %66
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %67)
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %68, ptr noundef nonnull @.str)
  %indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
  %70 = load i32, ptr %1, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = icmp slt i64 %indvars.iv.next63, %71
  br i1 %72, label %.lr.ph43, label %._crit_edge44, !llvm.loop !17
}

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

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

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

; 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 memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt3powIiiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef, i32 noundef) local_unnamed_addr #6

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

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

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

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

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


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