; LLVM IR from abhisheknaiidu/dsa :: DSA/Strings (next-permutation)

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z14abhisheknaiiduv() #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr noundef %1) #1 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i64, align 8
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @_Z14abhisheknaiiduv()
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  %17 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %6)
  br label %18

18:                                               ; preds = %114, %2
  %19 = load i32, ptr %6, align 4, !tbaa !5
  %20 = add nsw i32 %19, -1
  store i32 %20, ptr %6, align 4, !tbaa !5
  %21 = icmp ne i32 %19, 0
  br i1 %21, label %22, label %116

22:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %24 = load i64, ptr %7, align 8, !tbaa !11
  %25 = call ptr @llvm.stacksave.p0()
  store ptr %25, ptr %8, align 8
  %26 = alloca i64, i64 %24, align 16
  store i64 %24, ptr %9, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  store i64 0, ptr %10, align 8, !tbaa !11
  br label %27

27:                                               ; preds = %36, %22
  %28 = load i64, ptr %10, align 8, !tbaa !11
  %29 = load i64, ptr %7, align 8, !tbaa !11
  %30 = icmp slt i64 %28, %29
  br i1 %30, label %32, label %31

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

32:                                               ; preds = %27
  %33 = load i64, ptr %10, align 8, !tbaa !11
  %34 = getelementptr inbounds i64, ptr %26, i64 %33
  %35 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %34)
  br label %36

36:                                               ; preds = %32
  %37 = load i64, ptr %10, align 8, !tbaa !11
  %38 = add nsw i64 %37, 1
  store i64 %38, ptr %10, align 8, !tbaa !11
  br label %27, !llvm.loop !13

39:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %40 = load i64, ptr %7, align 8, !tbaa !11
  %41 = sub nsw i64 %40, 2
  store i64 %41, ptr %11, align 8, !tbaa !11
  br label %42

42:                                               ; preds = %56, %39
  %43 = load i64, ptr %11, align 8, !tbaa !11
  %44 = icmp sge i64 %43, 0
  br i1 %44, label %45, label %59

45:                                               ; preds = %42
  %46 = load i64, ptr %11, align 8, !tbaa !11
  %47 = getelementptr inbounds i64, ptr %26, i64 %46
  %48 = load i64, ptr %47, align 8, !tbaa !11
  %49 = load i64, ptr %11, align 8, !tbaa !11
  %50 = add nsw i64 %49, 1
  %51 = getelementptr inbounds i64, ptr %26, i64 %50
  %52 = load i64, ptr %51, align 8, !tbaa !11
  %53 = icmp slt i64 %48, %52
  br i1 %53, label %54, label %55

54:                                               ; preds = %45
  br label %59

55:                                               ; preds = %45
  br label %56

56:                                               ; preds = %55
  %57 = load i64, ptr %11, align 8, !tbaa !11
  %58 = add nsw i64 %57, -1
  store i64 %58, ptr %11, align 8, !tbaa !11
  br label %42, !llvm.loop !15

59:                                               ; preds = %54, %42
  %60 = load i64, ptr %11, align 8, !tbaa !11
  %61 = icmp eq i64 %60, -1
  br i1 %61, label %62, label %65

62:                                               ; preds = %59
  %63 = load i64, ptr %7, align 8, !tbaa !11
  %64 = getelementptr inbounds i64, ptr %26, i64 %63
  call void @_ZSt7reverseIPlEvT_S1_(ptr noundef %26, ptr noundef %64)
  br label %94

65:                                               ; preds = %59
  %66 = load i64, ptr %7, align 8, !tbaa !11
  %67 = sub nsw i64 %66, 1
  store i64 %67, ptr %12, align 8, !tbaa !11
  br label %68

68:                                               ; preds = %81, %65
  %69 = load i64, ptr %12, align 8, !tbaa !11
  %70 = icmp sge i64 %69, 0
  br i1 %70, label %71, label %84

71:                                               ; preds = %68
  %72 = load i64, ptr %12, align 8, !tbaa !11
  %73 = getelementptr inbounds i64, ptr %26, i64 %72
  %74 = load i64, ptr %73, align 8, !tbaa !11
  %75 = load i64, ptr %11, align 8, !tbaa !11
  %76 = getelementptr inbounds i64, ptr %26, i64 %75
  %77 = load i64, ptr %76, align 8, !tbaa !11
  %78 = icmp sgt i64 %74, %77
  br i1 %78, label %79, label %80

79:                                               ; preds = %71
  br label %84

80:                                               ; preds = %71
  br label %81

81:                                               ; preds = %80
  %82 = load i64, ptr %12, align 8, !tbaa !11
  %83 = add nsw i64 %82, -1
  store i64 %83, ptr %12, align 8, !tbaa !11
  br label %68, !llvm.loop !16

84:                                               ; preds = %79, %68
  %85 = load i64, ptr %11, align 8, !tbaa !11
  %86 = getelementptr inbounds i64, ptr %26, i64 %85
  %87 = load i64, ptr %12, align 8, !tbaa !11
  %88 = getelementptr inbounds i64, ptr %26, i64 %87
  call void @_ZSt4swapIlENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %86, ptr noundef nonnull align 8 dereferenceable(8) %88) #7
  %89 = load i64, ptr %11, align 8, !tbaa !11
  %90 = getelementptr inbounds i64, ptr %26, i64 %89
  %91 = getelementptr inbounds i64, ptr %90, i64 1
  %92 = load i64, ptr %7, align 8, !tbaa !11
  %93 = getelementptr inbounds i64, ptr %26, i64 %92
  call void @_ZSt7reverseIPlEvT_S1_(ptr noundef %91, ptr noundef %93)
  br label %94

94:                                               ; preds = %84, %62
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  store ptr %26, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %95 = load ptr, ptr %13, align 8, !tbaa !9
  store ptr %95, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %96 = load ptr, ptr %13, align 8, !tbaa !9
  %97 = mul nuw i64 8, %24
  %98 = udiv i64 %97, 8
  %99 = getelementptr inbounds i64, ptr %96, i64 %98
  store ptr %99, ptr %15, align 8, !tbaa !9
  br label %100

100:                                              ; preds = %111, %94
  %101 = load ptr, ptr %14, align 8, !tbaa !9
  %102 = load ptr, ptr %15, align 8, !tbaa !9
  %103 = icmp ne ptr %101, %102
  br i1 %103, label %105, label %104

104:                                              ; preds = %100
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %114

105:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %106 = load ptr, ptr %14, align 8, !tbaa !9
  %107 = load i64, ptr %106, align 8, !tbaa !11
  store i64 %107, ptr %16, align 8, !tbaa !11
  %108 = load i64, ptr %16, align 8, !tbaa !11
  %109 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %108)
  %110 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %109, ptr noundef @.str.4)
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  br label %111

111:                                              ; preds = %105
  %112 = load ptr, ptr %14, align 8, !tbaa !9
  %113 = getelementptr inbounds i64, ptr %112, i32 1
  store ptr %113, ptr %14, align 8, !tbaa !9
  br label %100

114:                                              ; preds = %104
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  %115 = load ptr, ptr %8, align 8
  call void @llvm.stackrestore.p0(ptr %115)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  br label %18, !llvm.loop !17

116:                                              ; preds = %18
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  ret i32 0
}

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #0 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt7reverseIPlEvT_S1_(ptr noundef, ptr noundef) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIlENSt9enable_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 uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #5

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

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

attributes #0 = { 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 #1 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 = { 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 = { 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 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !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
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z14abhisheknaiiduv() local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #1 {
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  tail call void @_Z14abhisheknaiiduv()
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  %5 = 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)
  %6 = load i32, ptr %3, align 4, !tbaa !5
  %7 = add nsw i32 %6, -1
  store i32 %7, ptr %3, align 4, !tbaa !5
  %.not40 = icmp eq i32 %6, 0
  br i1 %.not40, label %._crit_edge43, label %.lr.ph42

.lr.ph42:                                         ; preds = %2, %._crit_edge39
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  %8 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %9 = load i64, ptr %4, align 8, !tbaa !9
  %10 = call ptr @llvm.stacksave.p0()
  %11 = alloca i64, i64 %9, align 16
  %12 = load i64, ptr %4, align 8, !tbaa !9
  %13 = icmp sgt i64 %12, 0
  br i1 %13, label %.lr.ph, label %._crit_edge33.thread53

._crit_edge33.thread53:                           ; preds = %.lr.ph42
  %14 = add nsw i64 %12, -2
  br label %.thread

._crit_edge:                                      ; preds = %.lr.ph
  %15 = add nsw i64 %20, -2
  %16 = icmp sgt i64 %20, 1
  br i1 %16, label %.lr.ph32, label %._crit_edge33

.lr.ph:                                           ; preds = %.lr.ph42, %.lr.ph
  %.029 = phi i64 [ %19, %.lr.ph ], [ 0, %.lr.ph42 ]
  %17 = getelementptr inbounds i64, ptr %11, i64 %.029
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %17)
  %19 = add nuw nsw i64 %.029, 1
  %20 = load i64, ptr %4, align 8, !tbaa !9
  %21 = icmp slt i64 %19, %20
  br i1 %21, label %.lr.ph, label %._crit_edge, !llvm.loop !11

.lr.ph32:                                         ; preds = %._crit_edge, %27
  %.02230 = phi i64 [ %28, %27 ], [ %15, %._crit_edge ]
  %22 = getelementptr inbounds i64, ptr %11, i64 %.02230
  %23 = load i64, ptr %22, align 8, !tbaa !9
  %24 = getelementptr inbounds i8, ptr %22, i64 8
  %25 = load i64, ptr %24, align 8, !tbaa !9
  %26 = icmp slt i64 %23, %25
  br i1 %26, label %.thread, label %27

27:                                               ; preds = %.lr.ph32
  %28 = add nsw i64 %.02230, -1
  %29 = icmp sgt i64 %.02230, 0
  br i1 %29, label %.lr.ph32, label %._crit_edge33.thread, !llvm.loop !13

._crit_edge33:                                    ; preds = %._crit_edge
  %30 = icmp eq i64 %15, -1
  br i1 %30, label %._crit_edge33.thread, label %.thread

.thread:                                          ; preds = %.lr.ph32, %._crit_edge33.thread53, %._crit_edge33
  %.lcssa48 = phi i64 [ %20, %._crit_edge33 ], [ %12, %._crit_edge33.thread53 ], [ %20, %.lr.ph32 ]
  %.02228 = phi i64 [ %15, %._crit_edge33 ], [ %14, %._crit_edge33.thread53 ], [ %.02230, %.lr.ph32 ]
  %31 = getelementptr inbounds i64, ptr %11, i64 %.02228
  %smin = call i64 @llvm.smin.i64(i64 %.lcssa48, i64 0)
  %32 = add i64 %smin, -1
  br label %33

33:                                               ; preds = %35, %.thread
  %.024.in = phi i64 [ %.lcssa48, %.thread ], [ %.024, %35 ]
  %34 = icmp sgt i64 %.024.in, 0
  br i1 %34, label %35, label %40

35:                                               ; preds = %33
  %.024 = add nsw i64 %.024.in, -1
  %36 = getelementptr inbounds i64, ptr %11, i64 %.024
  %37 = load i64, ptr %36, align 8, !tbaa !9
  %38 = load i64, ptr %31, align 8, !tbaa !9
  %39 = icmp sgt i64 %37, %38
  br i1 %39, label %40, label %33, !llvm.loop !14

40:                                               ; preds = %35, %33
  %.024.lcssa = phi i64 [ %.024, %35 ], [ %32, %33 ]
  %41 = getelementptr inbounds i64, ptr %11, i64 %.024.lcssa
  call void @_ZSt4swapIlENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %31, ptr noundef nonnull align 8 dereferenceable(8) %41) #8
  %42 = getelementptr inbounds i8, ptr %31, i64 8
  %43 = load i64, ptr %4, align 8, !tbaa !9
  br label %._crit_edge33.thread

._crit_edge33.thread:                             ; preds = %27, %._crit_edge33, %40
  %.sink58 = phi i64 [ %43, %40 ], [ %20, %._crit_edge33 ], [ %20, %27 ]
  %.sink = phi ptr [ %42, %40 ], [ %11, %._crit_edge33 ], [ %11, %27 ]
  %44 = getelementptr inbounds i64, ptr %11, i64 %.sink58
  call void @_ZSt7reverseIPlEvT_S1_(ptr noundef nonnull %.sink, ptr noundef nonnull %44)
  %45 = getelementptr inbounds i64, ptr %11, i64 %9
  %.not2635 = icmp eq i64 %9, 0
  br i1 %.not2635, label %._crit_edge39, label %.lr.ph38

._crit_edge39:                                    ; preds = %.lr.ph38, %._crit_edge33.thread
  call void @llvm.stackrestore.p0(ptr %10)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  %46 = load i32, ptr %3, align 4, !tbaa !5
  %47 = add nsw i32 %46, -1
  store i32 %47, ptr %3, align 4, !tbaa !5
  %.not = icmp eq i32 %46, 0
  br i1 %.not, label %._crit_edge43, label %.lr.ph42, !llvm.loop !15

.lr.ph38:                                         ; preds = %._crit_edge33.thread, %.lr.ph38
  %.02336 = phi ptr [ %51, %.lr.ph38 ], [ %11, %._crit_edge33.thread ]
  %48 = load i64, ptr %.02336, align 8, !tbaa !9
  %49 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %48)
  %50 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %49, ptr noundef nonnull @.str.4)
  %51 = getelementptr inbounds i8, ptr %.02336, i64 8
  %.not26 = icmp eq ptr %51, %45
  br i1 %.not26, label %._crit_edge39, label %.lr.ph38

._crit_edge43:                                    ; preds = %._crit_edge39, %2
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  ret i32 0
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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 #3

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt7reverseIPlEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIlENSt9enable_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 uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #5

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #7

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


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