; LLVM IR from ritikbanger/Hacktoberfest2022-DSA :: 29. Codeforces Problems (1631A-MinMaxSwaps)

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

25:                                               ; preds = %116, %0
  %26 = load i64, ptr %2, align 8, !tbaa !8
  %27 = add nsw i64 %26, -1
  store i64 %27, ptr %2, align 8, !tbaa !8
  %28 = icmp ne i64 %26, 0
  br i1 %28, label %29, label %123

29:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  %30 = 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)
  %31 = load i32, ptr %3, align 4, !tbaa !11
  %32 = zext i32 %31 to i64
  %33 = call ptr @llvm.stacksave.p0()
  store ptr %33, ptr %4, align 8
  %34 = alloca i64, i64 %32, align 16
  store i64 %32, ptr %5, align 8
  %35 = load i32, ptr %3, align 4, !tbaa !11
  %36 = zext i32 %35 to i64
  %37 = alloca i64, i64 %36, align 16
  store i64 %36, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  store i32 0, ptr %7, align 4, !tbaa !11
  br label %38

38:                                               ; preds = %48, %29
  %39 = load i32, ptr %7, align 4, !tbaa !11
  %40 = load i32, ptr %3, align 4, !tbaa !11
  %41 = icmp slt i32 %39, %40
  br i1 %41, label %43, label %42

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

43:                                               ; preds = %38
  %44 = load i32, ptr %7, align 4, !tbaa !11
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds i64, ptr %34, i64 %45
  %47 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %46)
  br label %48

48:                                               ; preds = %43
  %49 = load i32, ptr %7, align 4, !tbaa !11
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %7, align 4, !tbaa !11
  br label %38, !llvm.loop !13

51:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  store i32 0, ptr %8, align 4, !tbaa !11
  br label %52

52:                                               ; preds = %62, %51
  %53 = load i32, ptr %8, align 4, !tbaa !11
  %54 = load i32, ptr %3, align 4, !tbaa !11
  %55 = icmp slt i32 %53, %54
  br i1 %55, label %57, label %56

56:                                               ; preds = %52
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  br label %65

57:                                               ; preds = %52
  %58 = load i32, ptr %8, align 4, !tbaa !11
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds i64, ptr %37, i64 %59
  %61 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %60)
  br label %62

62:                                               ; preds = %57
  %63 = load i32, ptr %8, align 4, !tbaa !11
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %8, align 4, !tbaa !11
  br label %52, !llvm.loop !15

65:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  store i32 0, ptr %9, align 4, !tbaa !11
  br label %66

66:                                               ; preds = %89, %65
  %67 = load i32, ptr %9, align 4, !tbaa !11
  %68 = load i32, ptr %3, align 4, !tbaa !11
  %69 = icmp slt i32 %67, %68
  br i1 %69, label %71, label %70

70:                                               ; preds = %66
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %92

71:                                               ; preds = %66
  %72 = load i32, ptr %9, align 4, !tbaa !11
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds i64, ptr %34, i64 %73
  %75 = load i64, ptr %74, align 8, !tbaa !8
  %76 = load i32, ptr %9, align 4, !tbaa !11
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds i64, ptr %37, i64 %77
  %79 = load i64, ptr %78, align 8, !tbaa !8
  %80 = icmp slt i64 %75, %79
  br i1 %80, label %81, label %88

81:                                               ; preds = %71
  %82 = load i32, ptr %9, align 4, !tbaa !11
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds i64, ptr %34, i64 %83
  %85 = load i32, ptr %9, align 4, !tbaa !11
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds i64, ptr %37, i64 %86
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %84, ptr noundef nonnull align 8 dereferenceable(8) %87) #8
  br label %88

88:                                               ; preds = %81, %71
  br label %89

89:                                               ; preds = %88
  %90 = load i32, ptr %9, align 4, !tbaa !11
  %91 = add nsw i32 %90, 1
  store i32 %91, ptr %9, align 4, !tbaa !11
  br label %66, !llvm.loop !16

92:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  %93 = getelementptr inbounds i64, ptr %34, i64 0
  %94 = load i64, ptr %93, align 16, !tbaa !8
  store i64 %94, ptr %10, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  %95 = getelementptr inbounds i64, ptr %37, i64 0
  %96 = load i64, ptr %95, align 16, !tbaa !8
  store i64 %96, ptr %11, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  store i32 0, ptr %12, align 4, !tbaa !11
  br label %97

97:                                               ; preds = %113, %92
  %98 = load i32, ptr %12, align 4, !tbaa !11
  %99 = load i32, ptr %3, align 4, !tbaa !11
  %100 = icmp slt i32 %98, %99
  br i1 %100, label %102, label %101

101:                                              ; preds = %97
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %116

102:                                              ; preds = %97
  %103 = load i32, ptr %12, align 4, !tbaa !11
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds i64, ptr %34, i64 %104
  %106 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %105)
  %107 = load i64, ptr %106, align 8, !tbaa !8
  store i64 %107, ptr %10, align 8, !tbaa !8
  %108 = load i32, ptr %12, align 4, !tbaa !11
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds i64, ptr %37, i64 %109
  %111 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %110)
  %112 = load i64, ptr %111, align 8, !tbaa !8
  store i64 %112, ptr %11, align 8, !tbaa !8
  br label %113

113:                                              ; preds = %102
  %114 = load i32, ptr %12, align 4, !tbaa !11
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %12, align 4, !tbaa !11
  br label %97, !llvm.loop !17

116:                                              ; preds = %101
  %117 = load i64, ptr %10, align 8, !tbaa !8
  %118 = load i64, ptr %11, align 8, !tbaa !8
  %119 = mul nsw i64 %117, %118
  %120 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %119)
  %121 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %120, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  %122 = load ptr, ptr %4, align 8
  call void @llvm.stackrestore.p0(ptr %122)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  br label %25, !llvm.loop !18

123:                                              ; preds = %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #8
  ret i32 0
}

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

; 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

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() #5

; 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 nounwind uwtable
declare dso_local void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #6

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #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 = { "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 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind willreturn }
attributes #6 = { 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 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nounwind }

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

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


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

.lr.ph31:                                         ; preds = %0, %._crit_edge28
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  %19 = 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)
  %20 = load i32, ptr %2, align 4, !tbaa !11
  %21 = zext i32 %20 to i64
  %22 = call ptr @llvm.stacksave.p0()
  %23 = alloca i64, i64 %21, align 16
  %24 = load i32, ptr %2, align 4, !tbaa !11
  %25 = zext i32 %24 to i64
  %26 = alloca i64, i64 %25, align 16
  %27 = icmp sgt i32 %24, 0
  br i1 %27, label %.lr.ph, label %._crit_edge.thread

.preheader19:                                     ; preds = %.lr.ph
  %28 = icmp sgt i32 %31, 0
  br i1 %28, label %.lr.ph22, label %._crit_edge.thread

.lr.ph:                                           ; preds = %.lr.ph31, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph31 ]
  %29 = getelementptr inbounds i64, ptr %23, i64 %indvars.iv
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %29)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %31 = load i32, ptr %2, align 4, !tbaa !11
  %32 = sext i32 %31 to i64
  %33 = icmp slt i64 %indvars.iv.next, %32
  br i1 %33, label %.lr.ph, label %.preheader19, !llvm.loop !13

.preheader:                                       ; preds = %.lr.ph22
  %34 = icmp sgt i32 %37, 0
  br i1 %34, label %.lr.ph24, label %._crit_edge.thread

.lr.ph22:                                         ; preds = %.preheader19, %.lr.ph22
  %indvars.iv34 = phi i64 [ %indvars.iv.next35, %.lr.ph22 ], [ 0, %.preheader19 ]
  %35 = getelementptr inbounds i64, ptr %26, i64 %indvars.iv34
  %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)
  %indvars.iv.next35 = add nuw nsw i64 %indvars.iv34, 1
  %37 = load i32, ptr %2, align 4, !tbaa !11
  %38 = sext i32 %37 to i64
  %39 = icmp slt i64 %indvars.iv.next35, %38
  br i1 %39, label %.lr.ph22, label %.preheader, !llvm.loop !15

._crit_edge.thread:                               ; preds = %.preheader, %.preheader19, %.lr.ph31
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  %40 = load i64, ptr %23, align 16, !tbaa !8
  store i64 %40, ptr %3, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  %41 = load i64, ptr %26, align 16, !tbaa !8
  store i64 %41, ptr %4, align 8, !tbaa !8
  br label %._crit_edge28

._crit_edge:                                      ; preds = %52
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  %42 = load i64, ptr %23, align 16, !tbaa !8
  store i64 %42, ptr %3, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  %43 = load i64, ptr %26, align 16, !tbaa !8
  store i64 %43, ptr %4, align 8, !tbaa !8
  %44 = icmp sgt i32 %53, 0
  br i1 %44, label %.lr.ph27, label %._crit_edge28

.lr.ph24:                                         ; preds = %.preheader, %52
  %45 = phi i32 [ %53, %52 ], [ %37, %.preheader ]
  %indvars.iv37 = phi i64 [ %indvars.iv.next38, %52 ], [ 0, %.preheader ]
  %46 = getelementptr inbounds i64, ptr %23, i64 %indvars.iv37
  %47 = load i64, ptr %46, align 8, !tbaa !8
  %48 = getelementptr inbounds i64, ptr %26, i64 %indvars.iv37
  %49 = load i64, ptr %48, align 8, !tbaa !8
  %50 = icmp slt i64 %47, %49
  br i1 %50, label %51, label %52

51:                                               ; preds = %.lr.ph24
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %46, ptr noundef nonnull align 8 dereferenceable(8) %48) #8
  %.pre = load i32, ptr %2, align 4, !tbaa !11
  br label %52

52:                                               ; preds = %.lr.ph24, %51
  %53 = phi i32 [ %45, %.lr.ph24 ], [ %.pre, %51 ]
  %indvars.iv.next38 = add nuw nsw i64 %indvars.iv37, 1
  %54 = sext i32 %53 to i64
  %55 = icmp slt i64 %indvars.iv.next38, %54
  br i1 %55, label %.lr.ph24, label %._crit_edge, !llvm.loop !16

._crit_edge28.loopexit:                           ; preds = %.lr.ph27
  %.pre43 = load i64, ptr %3, align 8, !tbaa !8
  br label %._crit_edge28

._crit_edge28:                                    ; preds = %._crit_edge.thread, %._crit_edge28.loopexit, %._crit_edge
  %56 = phi i64 [ %68, %._crit_edge28.loopexit ], [ %43, %._crit_edge ], [ %41, %._crit_edge.thread ]
  %57 = phi i64 [ %.pre43, %._crit_edge28.loopexit ], [ %42, %._crit_edge ], [ %40, %._crit_edge.thread ]
  %58 = mul nsw i64 %56, %57
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %58)
  %60 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %59, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  call void @llvm.stackrestore.p0(ptr %22)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  %61 = load i64, ptr %1, align 8, !tbaa !8
  %62 = add nsw i64 %61, -1
  store i64 %62, ptr %1, align 8, !tbaa !8
  %.not = icmp eq i64 %61, 0
  br i1 %.not, label %._crit_edge32, label %.lr.ph31, !llvm.loop !17

.lr.ph27:                                         ; preds = %._crit_edge, %.lr.ph27
  %indvars.iv40 = phi i64 [ %indvars.iv.next41, %.lr.ph27 ], [ 0, %._crit_edge ]
  %63 = getelementptr inbounds i64, ptr %23, i64 %indvars.iv40
  %64 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %63)
  %65 = load i64, ptr %64, align 8, !tbaa !8
  store i64 %65, ptr %3, align 8, !tbaa !8
  %66 = getelementptr inbounds i64, ptr %26, i64 %indvars.iv40
  %67 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %66)
  %68 = load i64, ptr %67, align 8, !tbaa !8
  store i64 %68, ptr %4, align 8, !tbaa !8
  %indvars.iv.next41 = add nuw nsw i64 %indvars.iv40, 1
  %69 = load i32, ptr %2, align 4, !tbaa !11
  %70 = sext i32 %69 to i64
  %71 = icmp slt i64 %indvars.iv.next41, %70
  br i1 %71, label %.lr.ph27, label %._crit_edge28.loopexit, !llvm.loop !18

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

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #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

; 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

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() #5

; 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 nounwind uwtable
declare dso_local void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #6

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #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 = { "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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #6 = { 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 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nounwind }

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

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


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