; LLVM IR from brpapa/algorithms :: solutions/codeforces (844-B)

; 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

; 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 [50 x [50 x i32]], align 16
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca [2 x i32], align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca [2 x 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)
  call void @llvm.lifetime.start.p0(i64 10000, ptr %4) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %40, %0
  %18 = load i32, ptr %5, align 4, !tbaa !5
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = icmp slt i32 %18, %19
  br i1 %20, label %22, label %21

21:                                               ; preds = %17
  store i32 2, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %43

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

23:                                               ; preds = %36, %22
  %24 = load i32, ptr %7, align 4, !tbaa !5
  %25 = load i32, ptr %3, align 4, !tbaa !5
  %26 = icmp slt i32 %24, %25
  br i1 %26, label %28, label %27

27:                                               ; preds = %23
  store i32 5, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %39

28:                                               ; preds = %23
  %29 = load i32, ptr %5, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [50 x [50 x i32]], ptr %4, i64 0, i64 %30
  %32 = load i32, ptr %7, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [50 x i32], ptr %31, i64 0, i64 %33
  %35 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %34)
  br label %36

36:                                               ; preds = %28
  %37 = load i32, ptr %7, align 4, !tbaa !5
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %7, align 4, !tbaa !5
  br label %23, !llvm.loop !9

39:                                               ; preds = %27
  br label %40

40:                                               ; preds = %39
  %41 = load i32, ptr %5, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %5, align 4, !tbaa !5
  br label %17, !llvm.loop !11

43:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  store i64 0, ptr %8, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %85, %43
  %45 = load i32, ptr %9, align 4, !tbaa !5
  %46 = load i32, ptr %2, align 4, !tbaa !5
  %47 = icmp slt i32 %45, %46
  br i1 %47, label %49, label %48

48:                                               ; preds = %44
  store i32 8, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %88

49:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  call void @llvm.memset.p0.i64(ptr align 4 %10, i8 0, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %67, %49
  %51 = load i32, ptr %11, align 4, !tbaa !5
  %52 = load i32, ptr %3, align 4, !tbaa !5
  %53 = icmp slt i32 %51, %52
  br i1 %53, label %55, label %54

54:                                               ; preds = %50
  store i32 11, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %70

55:                                               ; preds = %50
  %56 = load i32, ptr %9, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [50 x [50 x i32]], ptr %4, i64 0, i64 %57
  %59 = load i32, ptr %11, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [50 x i32], ptr %58, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [2 x i32], ptr %10, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %64, align 4, !tbaa !5
  br label %67

67:                                               ; preds = %55
  %68 = load i32, ptr %11, align 4, !tbaa !5
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %11, align 4, !tbaa !5
  br label %50, !llvm.loop !14

70:                                               ; preds = %54
  %71 = getelementptr inbounds [2 x i32], ptr %10, i64 0, i64 0
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = 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 2, i32 noundef %72)
  %74 = fptosi double %73 to i64
  %75 = sub nsw i64 %74, 1
  %76 = load i64, ptr %8, align 8, !tbaa !12
  %77 = add nsw i64 %76, %75
  store i64 %77, ptr %8, align 8, !tbaa !12
  %78 = getelementptr inbounds [2 x i32], ptr %10, i64 0, i64 1
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = 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 2, i32 noundef %79)
  %81 = fptosi double %80 to i64
  %82 = sub nsw i64 %81, 1
  %83 = load i64, ptr %8, align 8, !tbaa !12
  %84 = add nsw i64 %83, %82
  store i64 %84, ptr %8, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %85

85:                                               ; preds = %70
  %86 = load i32, ptr %9, align 4, !tbaa !5
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr %9, align 4, !tbaa !5
  br label %44, !llvm.loop !15

88:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %89

89:                                               ; preds = %130, %88
  %90 = load i32, ptr %12, align 4, !tbaa !5
  %91 = load i32, ptr %3, align 4, !tbaa !5
  %92 = icmp slt i32 %90, %91
  br i1 %92, label %94, label %93

93:                                               ; preds = %89
  store i32 14, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %133

94:                                               ; preds = %89
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  call void @llvm.memset.p0.i64(ptr align 4 %13, i8 0, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %95

95:                                               ; preds = %112, %94
  %96 = load i32, ptr %14, align 4, !tbaa !5
  %97 = load i32, ptr %2, align 4, !tbaa !5
  %98 = icmp slt i32 %96, %97
  br i1 %98, label %100, label %99

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

100:                                              ; preds = %95
  %101 = load i32, ptr %14, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [50 x [50 x i32]], ptr %4, i64 0, i64 %102
  %104 = load i32, ptr %12, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [50 x i32], ptr %103, i64 0, i64 %105
  %107 = load i32, ptr %106, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [2 x i32], ptr %13, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = add nsw i32 %110, 1
  store i32 %111, ptr %109, align 4, !tbaa !5
  br label %112

112:                                              ; preds = %100
  %113 = load i32, ptr %14, align 4, !tbaa !5
  %114 = add nsw i32 %113, 1
  store i32 %114, ptr %14, align 4, !tbaa !5
  br label %95, !llvm.loop !16

115:                                              ; preds = %99
  %116 = getelementptr inbounds [2 x i32], ptr %13, i64 0, i64 0
  %117 = load i32, ptr %116, align 4, !tbaa !5
  %118 = 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 2, i32 noundef %117)
  %119 = fptosi double %118 to i64
  %120 = sub nsw i64 %119, 1
  %121 = load i64, ptr %8, align 8, !tbaa !12
  %122 = add nsw i64 %121, %120
  store i64 %122, ptr %8, align 8, !tbaa !12
  %123 = getelementptr inbounds [2 x i32], ptr %13, i64 0, i64 1
  %124 = load i32, ptr %123, align 4, !tbaa !5
  %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 2, i32 noundef %124)
  %126 = fptosi double %125 to i64
  %127 = sub nsw i64 %126, 1
  %128 = load i64, ptr %8, align 8, !tbaa !12
  %129 = add nsw i64 %128, %127
  store i64 %129, ptr %8, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %130

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

133:                                              ; preds = %93
  %134 = load i32, ptr %2, align 4, !tbaa !5
  %135 = load i32, ptr %3, align 4, !tbaa !5
  %136 = mul nsw i32 %134, %135
  %137 = sext i32 %136 to i64
  %138 = load i64, ptr %8, align 8, !tbaa !12
  %139 = sub nsw i64 %138, %137
  store i64 %139, ptr %8, align 8, !tbaa !12
  %140 = load i64, ptr %8, align 8, !tbaa !12
  %141 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %140)
  %142 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %141, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 10000, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  %143 = load i32, ptr %1, align 4
  ret i32 %143
}

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

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

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

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

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = distinct !{!14, !10}
!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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca [50 x [50 x i32]], align 16
  %4 = alloca [2 x i32], align 8
  %5 = alloca [2 x i32], align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %6 = 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)
  %7 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.start.p0(i64 10000, ptr nonnull %3) #6
  %8 = load i32, ptr %1, align 4, !tbaa !5
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.preheader33.lr.ph, label %.preheader

.preheader33.lr.ph:                               ; preds = %0
  %10 = load i32, ptr %2, align 4, !tbaa !5
  %11 = icmp sgt i32 %10, 0
  br i1 %11, label %.preheader33, label %.lr.ph42

.preheader33:                                     ; preds = %.preheader33.lr.ph, %._crit_edge
  %12 = phi i32 [ %17, %._crit_edge ], [ %8, %.preheader33.lr.ph ]
  %13 = phi i32 [ %18, %._crit_edge ], [ %10, %.preheader33.lr.ph ]
  %indvars.iv58 = phi i64 [ %indvars.iv.next59, %._crit_edge ], [ 0, %.preheader33.lr.ph ]
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.lr.ph, label %._crit_edge

.preheader32:                                     ; preds = %._crit_edge
  %15 = icmp sgt i32 %17, 0
  br i1 %15, label %.lr.ph42, label %.preheader

.lr.ph42:                                         ; preds = %.preheader33.lr.ph, %.preheader32
  %16 = getelementptr inbounds i8, ptr %4, i64 4
  br label %30

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

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader33
  %17 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %12, %.preheader33 ]
  %18 = phi i32 [ %23, %._crit_edge.loopexit ], [ %13, %.preheader33 ]
  %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
  %19 = sext i32 %17 to i64
  %20 = icmp slt i64 %indvars.iv.next59, %19
  br i1 %20, label %.preheader33, label %.preheader32, !llvm.loop !9

.lr.ph:                                           ; preds = %.preheader33, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.preheader33 ]
  %21 = getelementptr inbounds [50 x [50 x i32]], ptr %3, i64 0, i64 %indvars.iv58, i64 %indvars.iv
  %22 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %21)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = icmp slt i64 %indvars.iv.next, %24
  br i1 %25, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !12

.preheader:                                       ; preds = %._crit_edge39, %0, %.preheader32
  %26 = phi i32 [ %17, %.preheader32 ], [ %8, %0 ], [ %49, %._crit_edge39 ]
  %.028.lcssa = phi i64 [ 0, %.preheader32 ], [ 0, %0 ], [ %48, %._crit_edge39 ]
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = icmp sgt i32 %27, 0
  br i1 %28, label %.lr.ph49, label %._crit_edge50

.lr.ph49:                                         ; preds = %.preheader
  %29 = getelementptr inbounds i8, ptr %5, i64 4
  br label %71

30:                                               ; preds = %.lr.ph42, %._crit_edge39
  %indvars.iv64 = phi i64 [ 0, %.lr.ph42 ], [ %indvars.iv.next65, %._crit_edge39 ]
  %.02840 = phi i64 [ 0, %.lr.ph42 ], [ %48, %._crit_edge39 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  store i64 0, ptr %4, align 8
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = icmp sgt i32 %31, 0
  br i1 %32, label %.lr.ph38, label %._crit_edge39

.lr.ph38:                                         ; preds = %30
  %wide.trip.count = zext nneg i32 %31 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %33 = icmp eq i32 %31, 1
  br i1 %33, label %._crit_edge39.loopexit.unr-lcssa, label %.lr.ph38.new

.lr.ph38.new:                                     ; preds = %.lr.ph38
  %unroll_iter = and i64 %wide.trip.count, 2147483646
  br label %52

._crit_edge39.loopexit.unr-lcssa:                 ; preds = %52, %.lr.ph38
  %indvars.iv61.unr = phi i64 [ 0, %.lr.ph38 ], [ %indvars.iv.next62.1, %52 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge39.loopexit, label %._crit_edge39.loopexit.epilog-lcssa

._crit_edge39.loopexit.epilog-lcssa:              ; preds = %._crit_edge39.loopexit.unr-lcssa
  %34 = getelementptr inbounds [50 x [50 x i32]], ptr %3, i64 0, i64 %indvars.iv64, i64 %indvars.iv61.unr
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [2 x i32], ptr %4, i64 0, i64 %36
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr %37, align 4, !tbaa !5
  br label %._crit_edge39.loopexit

._crit_edge39.loopexit:                           ; preds = %._crit_edge39.loopexit.unr-lcssa, %._crit_edge39.loopexit.epilog-lcssa
  %.pre75 = load i32, ptr %4, align 8, !tbaa !5
  %.pre76 = load i32, ptr %16, align 4, !tbaa !5
  br label %._crit_edge39

._crit_edge39:                                    ; preds = %._crit_edge39.loopexit, %30
  %40 = phi i32 [ %.pre76, %._crit_edge39.loopexit ], [ 0, %30 ]
  %41 = phi i32 [ %.pre75, %._crit_edge39.loopexit ], [ 0, %30 ]
  %42 = 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 2, i32 noundef %41)
  %43 = fptosi double %42 to i64
  %44 = 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 2, i32 noundef %40)
  %45 = fptosi double %44 to i64
  %46 = add i64 %.02840, -2
  %47 = add i64 %46, %43
  %48 = add i64 %47, %45
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  %indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
  %49 = load i32, ptr %1, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = icmp slt i64 %indvars.iv.next65, %50
  br i1 %51, label %30, label %.preheader, !llvm.loop !13

52:                                               ; preds = %52, %.lr.ph38.new
  %indvars.iv61 = phi i64 [ 0, %.lr.ph38.new ], [ %indvars.iv.next62.1, %52 ]
  %niter = phi i64 [ 0, %.lr.ph38.new ], [ %niter.next.1, %52 ]
  %53 = getelementptr inbounds [50 x [50 x i32]], ptr %3, i64 0, i64 %indvars.iv64, i64 %indvars.iv61
  %54 = load i32, ptr %53, align 8, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [2 x i32], ptr %4, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %56, align 4, !tbaa !5
  %indvars.iv.next62 = or disjoint i64 %indvars.iv61, 1
  %59 = getelementptr inbounds [50 x [50 x i32]], ptr %3, i64 0, i64 %indvars.iv64, i64 %indvars.iv.next62
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [2 x i32], ptr %4, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %62, align 4, !tbaa !5
  %indvars.iv.next62.1 = add nuw nsw i64 %indvars.iv61, 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_edge39.loopexit.unr-lcssa, label %52, !llvm.loop !14

._crit_edge50.loopexit:                           ; preds = %._crit_edge46
  %.pre79 = load i32, ptr %1, align 4, !tbaa !5
  br label %._crit_edge50

._crit_edge50:                                    ; preds = %._crit_edge50.loopexit, %.preheader
  %65 = phi i32 [ %26, %.preheader ], [ %.pre79, %._crit_edge50.loopexit ]
  %.1.lcssa = phi i64 [ %.028.lcssa, %.preheader ], [ %89, %._crit_edge50.loopexit ]
  %.lcssa = phi i32 [ %27, %.preheader ], [ %90, %._crit_edge50.loopexit ]
  %66 = mul nsw i32 %65, %.lcssa
  %67 = sext i32 %66 to i64
  %68 = sub nsw i64 %.1.lcssa, %67
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %68)
  %70 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %69, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 10000, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret i32 0

71:                                               ; preds = %.lr.ph49, %._crit_edge46
  %indvars.iv72 = phi i64 [ 0, %.lr.ph49 ], [ %indvars.iv.next73, %._crit_edge46 ]
  %.147 = phi i64 [ %.028.lcssa, %.lr.ph49 ], [ %89, %._crit_edge46 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  store i64 0, ptr %5, align 8
  %72 = load i32, ptr %1, align 4, !tbaa !5
  %73 = icmp sgt i32 %72, 0
  br i1 %73, label %.lr.ph45, label %._crit_edge46

.lr.ph45:                                         ; preds = %71
  %wide.trip.count70 = zext nneg i32 %72 to i64
  %xtraiter100 = and i64 %wide.trip.count70, 1
  %74 = icmp eq i32 %72, 1
  br i1 %74, label %._crit_edge46.loopexit.unr-lcssa, label %.lr.ph45.new

.lr.ph45.new:                                     ; preds = %.lr.ph45
  %unroll_iter102 = and i64 %wide.trip.count70, 2147483646
  br label %93

._crit_edge46.loopexit.unr-lcssa:                 ; preds = %93, %.lr.ph45
  %indvars.iv67.unr = phi i64 [ 0, %.lr.ph45 ], [ %indvars.iv.next68.1, %93 ]
  %lcmp.mod101.not = icmp eq i64 %xtraiter100, 0
  br i1 %lcmp.mod101.not, label %._crit_edge46.loopexit, label %._crit_edge46.loopexit.epilog-lcssa

._crit_edge46.loopexit.epilog-lcssa:              ; preds = %._crit_edge46.loopexit.unr-lcssa
  %75 = getelementptr inbounds [50 x [50 x i32]], ptr %3, i64 0, i64 %indvars.iv67.unr, i64 %indvars.iv72
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [2 x i32], ptr %5, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %78, align 4, !tbaa !5
  br label %._crit_edge46.loopexit

._crit_edge46.loopexit:                           ; preds = %._crit_edge46.loopexit.unr-lcssa, %._crit_edge46.loopexit.epilog-lcssa
  %.pre77 = load i32, ptr %5, align 8, !tbaa !5
  %.pre78 = load i32, ptr %29, align 4, !tbaa !5
  br label %._crit_edge46

._crit_edge46:                                    ; preds = %._crit_edge46.loopexit, %71
  %81 = phi i32 [ %.pre78, %._crit_edge46.loopexit ], [ 0, %71 ]
  %82 = phi i32 [ %.pre77, %._crit_edge46.loopexit ], [ 0, %71 ]
  %83 = 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 2, i32 noundef %82)
  %84 = fptosi double %83 to i64
  %85 = 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 2, i32 noundef %81)
  %86 = fptosi double %85 to i64
  %87 = add i64 %.147, -2
  %88 = add i64 %87, %84
  %89 = add i64 %88, %86
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  %indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
  %90 = load i32, ptr %2, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = icmp slt i64 %indvars.iv.next73, %91
  br i1 %92, label %71, label %._crit_edge50.loopexit, !llvm.loop !15

93:                                               ; preds = %93, %.lr.ph45.new
  %indvars.iv67 = phi i64 [ 0, %.lr.ph45.new ], [ %indvars.iv.next68.1, %93 ]
  %niter103 = phi i64 [ 0, %.lr.ph45.new ], [ %niter103.next.1, %93 ]
  %94 = getelementptr inbounds [50 x [50 x i32]], ptr %3, i64 0, i64 %indvars.iv67, i64 %indvars.iv72
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [2 x i32], ptr %5, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = add nsw i32 %98, 1
  store i32 %99, ptr %97, align 4, !tbaa !5
  %indvars.iv.next68 = or disjoint i64 %indvars.iv67, 1
  %100 = getelementptr inbounds [50 x [50 x i32]], ptr %3, i64 0, i64 %indvars.iv.next68, i64 %indvars.iv72
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [2 x i32], ptr %5, i64 0, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = add nsw i32 %104, 1
  store i32 %105, ptr %103, align 4, !tbaa !5
  %indvars.iv.next68.1 = add nuw nsw i64 %indvars.iv67, 2
  %niter103.next.1 = add i64 %niter103, 2
  %niter103.ncmp.1 = icmp eq i64 %niter103.next.1, %unroll_iter102
  br i1 %niter103.ncmp.1, label %._crit_edge46.loopexit.unr-lcssa, label %93, !llvm.loop !16
}

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

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

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

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 = { 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 #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 = { 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, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.unswitch.partial.disable"}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}


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