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

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

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

@_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 i32, align 4
  %5 = alloca ptr, 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 i64, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  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)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  br label %26

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

30:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  %31 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %31, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %33 = load i32, ptr %3, align 4, !tbaa !8
  %34 = zext i32 %33 to i64
  %35 = load i32, ptr %4, align 4, !tbaa !8
  %36 = zext i32 %35 to i64
  %37 = call ptr @llvm.stacksave.p0()
  store ptr %37, ptr %5, align 8
  %38 = mul nuw i64 %34, %36
  %39 = alloca i32, i64 %38, align 16
  store i64 %34, ptr %6, align 8
  store i64 %36, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  store i32 0, ptr %8, align 4, !tbaa !8
  br label %40

40:                                               ; preds = %64, %30
  %41 = load i32, ptr %8, align 4, !tbaa !8
  %42 = load i32, ptr %3, align 4, !tbaa !8
  %43 = icmp slt i32 %41, %42
  br i1 %43, label %45, label %44

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

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

46:                                               ; preds = %60, %45
  %47 = load i32, ptr %10, align 4, !tbaa !8
  %48 = load i32, ptr %4, align 4, !tbaa !8
  %49 = icmp slt i32 %47, %48
  br i1 %49, label %51, label %50

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

51:                                               ; preds = %46
  %52 = load i32, ptr %8, align 4, !tbaa !8
  %53 = sext i32 %52 to i64
  %54 = mul nsw i64 %53, %36
  %55 = getelementptr inbounds i32, ptr %39, i64 %54
  %56 = load i32, ptr %10, align 4, !tbaa !8
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds i32, ptr %55, i64 %57
  %59 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %58)
  br label %60

60:                                               ; preds = %51
  %61 = load i32, ptr %10, align 4, !tbaa !8
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %10, align 4, !tbaa !8
  br label %46, !llvm.loop !11

63:                                               ; preds = %50
  br label %64

64:                                               ; preds = %63
  %65 = load i32, ptr %8, align 4, !tbaa !8
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %8, align 4, !tbaa !8
  br label %40, !llvm.loop !13

67:                                               ; preds = %44
  %68 = load i32, ptr %3, align 4, !tbaa !8
  %69 = load i32, ptr %4, align 4, !tbaa !8
  %70 = add nsw i32 %68, %69
  %71 = sub nsw i32 %70, 1
  %72 = zext i32 %71 to i64
  %73 = alloca [2 x i32], i64 %72, align 16
  store i64 %72, ptr %11, align 8
  %74 = getelementptr inbounds [2 x i32], ptr %73, i64 0
  %75 = getelementptr inbounds [2 x i32], ptr %74, i64 0, i64 0
  %76 = load i32, ptr %3, align 4, !tbaa !8
  %77 = load i32, ptr %4, align 4, !tbaa !8
  %78 = add nsw i32 %76, %77
  %79 = sub nsw i32 %78, 2
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [2 x i32], ptr %73, i64 %80
  %82 = getelementptr inbounds [2 x i32], ptr %81, i64 0, i64 0
  %83 = getelementptr inbounds i32, ptr %82, i64 2
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  store i32 0, ptr %12, align 4, !tbaa !8
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef %75, ptr noundef %83, ptr noundef nonnull align 4 dereferenceable(4) %12)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  store i32 0, ptr %13, align 4, !tbaa !8
  br label %84

84:                                               ; preds = %117, %67
  %85 = load i32, ptr %13, align 4, !tbaa !8
  %86 = load i32, ptr %3, align 4, !tbaa !8
  %87 = icmp slt i32 %85, %86
  br i1 %87, label %89, label %88

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

89:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  store i32 0, ptr %14, align 4, !tbaa !8
  br label %90

90:                                               ; preds = %113, %89
  %91 = load i32, ptr %14, align 4, !tbaa !8
  %92 = load i32, ptr %4, align 4, !tbaa !8
  %93 = icmp slt i32 %91, %92
  br i1 %93, label %95, label %94

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

95:                                               ; preds = %90
  %96 = load i32, ptr %13, align 4, !tbaa !8
  %97 = load i32, ptr %14, align 4, !tbaa !8
  %98 = add nsw i32 %96, %97
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [2 x i32], ptr %73, i64 %99
  %101 = load i32, ptr %13, align 4, !tbaa !8
  %102 = sext i32 %101 to i64
  %103 = mul nsw i64 %102, %36
  %104 = getelementptr inbounds i32, ptr %39, i64 %103
  %105 = load i32, ptr %14, align 4, !tbaa !8
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds i32, ptr %104, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !8
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [2 x i32], ptr %100, i64 0, i64 %109
  %111 = load i32, ptr %110, align 4, !tbaa !8
  %112 = add nsw i32 %111, 1
  store i32 %112, ptr %110, align 4, !tbaa !8
  br label %113

113:                                              ; preds = %95
  %114 = load i32, ptr %14, align 4, !tbaa !8
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %14, align 4, !tbaa !8
  br label %90, !llvm.loop !14

116:                                              ; preds = %94
  br label %117

117:                                              ; preds = %116
  %118 = load i32, ptr %13, align 4, !tbaa !8
  %119 = add nsw i32 %118, 1
  store i32 %119, ptr %13, align 4, !tbaa !8
  br label %84, !llvm.loop !15

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

121:                                              ; preds = %167, %120
  %122 = load i32, ptr %16, align 4, !tbaa !8
  %123 = load i32, ptr %3, align 4, !tbaa !8
  %124 = load i32, ptr %4, align 4, !tbaa !8
  %125 = add nsw i32 %123, %124
  %126 = sub nsw i32 %125, 1
  %127 = sdiv i32 %126, 2
  %128 = icmp slt i32 %122, %127
  br i1 %128, label %130, label %129

129:                                              ; preds = %121
  store i32 16, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  br label %170

130:                                              ; preds = %121
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  %131 = load i32, ptr %16, align 4, !tbaa !8
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [2 x i32], ptr %73, i64 %132
  %134 = getelementptr inbounds [2 x i32], ptr %133, i64 0, i64 0
  %135 = load i32, ptr %134, align 8, !tbaa !8
  %136 = load i32, ptr %3, align 4, !tbaa !8
  %137 = load i32, ptr %4, align 4, !tbaa !8
  %138 = add nsw i32 %136, %137
  %139 = sub nsw i32 %138, 2
  %140 = load i32, ptr %16, align 4, !tbaa !8
  %141 = sub nsw i32 %139, %140
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [2 x i32], ptr %73, i64 %142
  %144 = getelementptr inbounds [2 x i32], ptr %143, i64 0, i64 0
  %145 = load i32, ptr %144, align 8, !tbaa !8
  %146 = add nsw i32 %135, %145
  store i32 %146, ptr %17, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  %147 = load i32, ptr %16, align 4, !tbaa !8
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [2 x i32], ptr %73, i64 %148
  %150 = getelementptr inbounds [2 x i32], ptr %149, i64 0, i64 1
  %151 = load i32, ptr %150, align 4, !tbaa !8
  %152 = load i32, ptr %3, align 4, !tbaa !8
  %153 = load i32, ptr %4, align 4, !tbaa !8
  %154 = add nsw i32 %152, %153
  %155 = sub nsw i32 %154, 2
  %156 = load i32, ptr %16, align 4, !tbaa !8
  %157 = sub nsw i32 %155, %156
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [2 x i32], ptr %73, i64 %158
  %160 = getelementptr inbounds [2 x i32], ptr %159, i64 0, i64 1
  %161 = load i32, ptr %160, align 4, !tbaa !8
  %162 = add nsw i32 %151, %161
  store i32 %162, ptr %18, align 4, !tbaa !8
  %163 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %17, ptr noundef nonnull align 4 dereferenceable(4) %18)
  %164 = load i32, ptr %163, align 4, !tbaa !8
  %165 = load i32, ptr %15, align 4, !tbaa !8
  %166 = add nsw i32 %165, %164
  store i32 %166, ptr %15, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  br label %167

167:                                              ; preds = %130
  %168 = load i32, ptr %16, align 4, !tbaa !8
  %169 = add nsw i32 %168, 1
  store i32 %169, ptr %16, align 4, !tbaa !8
  br label %121, !llvm.loop !16

170:                                              ; preds = %129
  %171 = load i32, ptr %15, align 4, !tbaa !8
  %172 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %171)
  %173 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %172, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  %174 = load ptr, ptr %5, align 8
  call void @llvm.stackrestore.p0(ptr %174)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  br label %26, !llvm.loop !17

175:                                              ; preds = %26
  store i32 0, ptr %1, align 4
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  %176 = load i32, ptr %1, align 4
  ret i32 %176
}

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

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) #5

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #1

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

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

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

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


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

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

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

.lr.ph45:                                         ; preds = %0, %._crit_edge41
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  %16 = 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)
  %17 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %18 = load i32, ptr %2, align 4, !tbaa !8
  %19 = zext i32 %18 to i64
  %20 = load i32, ptr %3, align 4, !tbaa !8
  %21 = zext i32 %20 to i64
  %22 = call ptr @llvm.stacksave.p0()
  %23 = mul nuw i64 %21, %19
  %24 = alloca i32, i64 %23, align 16
  %25 = load i32, ptr %2, align 4, !tbaa !8
  %26 = icmp sgt i32 %25, 0
  %.pre66 = load i32, ptr %3, align 4, !tbaa !8
  %27 = icmp sgt i32 %.pre66, 0
  %or.cond = select i1 %26, i1 %27, i1 false
  br i1 %or.cond, label %.preheader29, label %._crit_edge33

.preheader29:                                     ; preds = %.lr.ph45, %._crit_edge
  %28 = phi i32 [ %68, %._crit_edge ], [ %25, %.lr.ph45 ]
  %29 = phi i32 [ %69, %._crit_edge ], [ %.pre66, %.lr.ph45 ]
  %indvars.iv52 = phi i64 [ %indvars.iv.next53, %._crit_edge ], [ 0, %.lr.ph45 ]
  %30 = icmp sgt i32 %29, 0
  br i1 %30, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader29
  %31 = mul nuw nsw i64 %indvars.iv52, %21
  %32 = getelementptr inbounds i32, ptr %24, i64 %31
  br label %72

._crit_edge33:                                    ; preds = %._crit_edge, %.lr.ph45
  %33 = phi i32 [ %.pre66, %.lr.ph45 ], [ %69, %._crit_edge ]
  %.lcssa = phi i32 [ %25, %.lr.ph45 ], [ %68, %._crit_edge ]
  %34 = add nsw i32 %33, %.lcssa
  %35 = add nsw i32 %34, -1
  %36 = zext i32 %35 to i64
  %37 = alloca [2 x i32], i64 %36, align 16
  %38 = sext i32 %34 to i64
  %39 = getelementptr [2 x i32], ptr %37, i64 %38
  %40 = getelementptr i8, ptr %39, i64 -8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #8
  store i32 0, ptr %4, align 4, !tbaa !8
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef nonnull %37, ptr noundef %40, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #8
  %41 = load i32, ptr %2, align 4, !tbaa !8
  %42 = icmp sgt i32 %41, 0
  %.pre67 = load i32, ptr %3, align 4, !tbaa !8
  %43 = icmp sgt i32 %.pre67, 0
  %or.cond72 = select i1 %42, i1 %43, i1 false
  br i1 %or.cond72, label %.preheader.us.preheader, label %.preheader30

.preheader.us.preheader:                          ; preds = %._crit_edge33
  %wide.trip.count61 = zext nneg i32 %41 to i64
  %wide.trip.count = zext nneg i32 %.pre67 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %44 = icmp eq i32 %.pre67, 1
  %unroll_iter = and i64 %wide.trip.count, 2147483646
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %._crit_edge36.us
  %indvars.iv58 = phi i64 [ 0, %.preheader.us.preheader ], [ %indvars.iv.next59, %._crit_edge36.us ]
  %45 = mul nuw nsw i64 %indvars.iv58, %21
  %46 = getelementptr inbounds i32, ptr %24, i64 %45
  br i1 %44, label %._crit_edge36.us.unr-lcssa, label %.preheader.us.new

.preheader.us.new:                                ; preds = %.preheader.us, %.preheader.us.new
  %indvars.iv55 = phi i64 [ %indvars.iv.next56.1, %.preheader.us.new ], [ 0, %.preheader.us ]
  %niter = phi i64 [ %niter.next.1, %.preheader.us.new ], [ 0, %.preheader.us ]
  %47 = add nuw nsw i64 %indvars.iv55, %indvars.iv58
  %48 = getelementptr inbounds i32, ptr %46, i64 %indvars.iv55
  %49 = load i32, ptr %48, align 4, !tbaa !8
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [2 x i32], ptr %37, i64 %47, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !8
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %51, align 4, !tbaa !8
  %indvars.iv.next56 = or disjoint i64 %indvars.iv55, 1
  %54 = add nuw nsw i64 %indvars.iv.next56, %indvars.iv58
  %55 = getelementptr inbounds i32, ptr %46, i64 %indvars.iv.next56
  %56 = load i32, ptr %55, align 4, !tbaa !8
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [2 x i32], ptr %37, i64 %54, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !8
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %58, align 4, !tbaa !8
  %indvars.iv.next56.1 = add nuw nsw i64 %indvars.iv55, 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_edge36.us.unr-lcssa, label %.preheader.us.new, !llvm.loop !11

._crit_edge36.us.unr-lcssa:                       ; preds = %.preheader.us.new, %.preheader.us
  %indvars.iv55.unr = phi i64 [ 0, %.preheader.us ], [ %indvars.iv.next56.1, %.preheader.us.new ]
  br i1 %lcmp.mod.not, label %._crit_edge36.us, label %._crit_edge36.us.epilog-lcssa

._crit_edge36.us.epilog-lcssa:                    ; preds = %._crit_edge36.us.unr-lcssa
  %61 = add nuw nsw i64 %indvars.iv55.unr, %indvars.iv58
  %62 = getelementptr inbounds i32, ptr %46, i64 %indvars.iv55.unr
  %63 = load i32, ptr %62, align 4, !tbaa !8
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [2 x i32], ptr %37, i64 %61, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !8
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %65, align 4, !tbaa !8
  br label %._crit_edge36.us

._crit_edge36.us:                                 ; preds = %._crit_edge36.us.unr-lcssa, %._crit_edge36.us.epilog-lcssa
  %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
  %exitcond62.not = icmp eq i64 %indvars.iv.next59, %wide.trip.count61
  br i1 %exitcond62.not, label %.preheader30, label %.preheader.us, !llvm.loop !13

._crit_edge.loopexit:                             ; preds = %72
  %.pre = load i32, ptr %2, align 4, !tbaa !8
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader29
  %68 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %28, %.preheader29 ]
  %69 = phi i32 [ %75, %._crit_edge.loopexit ], [ %29, %.preheader29 ]
  %indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
  %70 = sext i32 %68 to i64
  %71 = icmp slt i64 %indvars.iv.next53, %70
  br i1 %71, label %.preheader29, label %._crit_edge33, !llvm.loop !14

72:                                               ; preds = %.lr.ph, %72
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %72 ]
  %73 = getelementptr inbounds i32, ptr %32, i64 %indvars.iv
  %74 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %73)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %75 = load i32, ptr %3, align 4, !tbaa !8
  %76 = sext i32 %75 to i64
  %77 = icmp slt i64 %indvars.iv.next, %76
  br i1 %77, label %72, label %._crit_edge.loopexit, !llvm.loop !16

.preheader30:                                     ; preds = %._crit_edge36.us, %._crit_edge33
  %78 = add nsw i32 %.pre67, %41
  %79 = icmp sgt i32 %78, 2
  br i1 %79, label %.lr.ph40, label %._crit_edge41

._crit_edge41:                                    ; preds = %.lr.ph40, %.preheader30
  %.023.lcssa = phi i32 [ 0, %.preheader30 ], [ %100, %.lr.ph40 ]
  %80 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.023.lcssa)
  %81 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %80, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.stackrestore.p0(ptr %22)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  %82 = load i32, ptr %1, align 4, !tbaa !8
  %83 = add nsw i32 %82, -1
  store i32 %83, ptr %1, align 4, !tbaa !8
  %.not = icmp eq i32 %82, 0
  br i1 %.not, label %._crit_edge46, label %.lr.ph45, !llvm.loop !17

.lr.ph40:                                         ; preds = %.preheader30, %.lr.ph40
  %indvars.iv63 = phi i64 [ %indvars.iv.next64, %.lr.ph40 ], [ 0, %.preheader30 ]
  %84 = phi i32 [ %103, %.lr.ph40 ], [ %78, %.preheader30 ]
  %.02338 = phi i32 [ %100, %.lr.ph40 ], [ 0, %.preheader30 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #8
  %85 = getelementptr inbounds [2 x i32], ptr %37, i64 %indvars.iv63
  %86 = load i32, ptr %85, align 8, !tbaa !8
  %87 = trunc nuw nsw i64 %indvars.iv63 to i32
  %reass.sub = sub i32 %84, %87
  %88 = add i32 %reass.sub, -2
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [2 x i32], ptr %37, i64 %89
  %91 = load i32, ptr %90, align 8, !tbaa !8
  %92 = add nsw i32 %91, %86
  store i32 %92, ptr %5, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #8
  %93 = getelementptr inbounds i8, ptr %85, i64 4
  %94 = load i32, ptr %93, align 4, !tbaa !8
  %95 = getelementptr inbounds [2 x i32], ptr %37, i64 %89, i64 1
  %96 = load i32, ptr %95, align 4, !tbaa !8
  %97 = add nsw i32 %96, %94
  store i32 %97, ptr %6, align 4, !tbaa !8
  %98 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %99 = load i32, ptr %98, align 4, !tbaa !8
  %100 = add nsw i32 %99, %.02338
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
  %101 = load i32, ptr %2, align 4, !tbaa !8
  %102 = load i32, ptr %3, align 4, !tbaa !8
  %103 = add nsw i32 %102, %101
  %104 = add nsw i32 %103, -1
  %105 = sdiv i32 %104, 2
  %106 = sext i32 %105 to i64
  %107 = icmp slt i64 %indvars.iv.next64, %106
  br i1 %107, label %.lr.ph40, label %._crit_edge41, !llvm.loop !18

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

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

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #5

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #1

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

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

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

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


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