; LLVM IR from AdarshGaur/Competitive-Programming :: Codeforces/Codeforces Round #598 (Div. 3)/B. Minimize the Permutation.ll (Z5solvev)

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

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

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

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

18:                                               ; preds = %27, %0
  %19 = load i64, ptr %4, align 8, !tbaa !5
  %20 = load i64, ptr %1, align 8, !tbaa !5
  %21 = icmp slt i64 %19, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  br label %30

23:                                               ; preds = %18
  %24 = load i64, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds i64, ptr %17, i64 %24
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %25)
  br label %27

27:                                               ; preds = %23
  %28 = load i64, ptr %4, align 8, !tbaa !5
  %29 = add nsw i64 %28, 1
  store i64 %29, ptr %4, align 8, !tbaa !5
  br label %18, !llvm.loop !9

30:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  store i64 0, ptr %6, align 8, !tbaa !5
  br label %31

31:                                               ; preds = %82, %30
  %32 = load i64, ptr %6, align 8, !tbaa !5
  %33 = load i64, ptr %1, align 8, !tbaa !5
  %34 = icmp slt i64 %32, %33
  br i1 %34, label %36, label %35

35:                                               ; preds = %31
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %85

36:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %37 = load i64, ptr %6, align 8, !tbaa !5
  %38 = add nsw i64 %37, 1
  store i64 %38, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  store i64 -1, ptr %8, align 8, !tbaa !5
  %39 = load i64, ptr %6, align 8, !tbaa !5
  %40 = getelementptr inbounds i64, ptr %17, i64 %39
  %41 = load i64, ptr %40, align 8, !tbaa !5
  store i64 %41, ptr %5, align 8, !tbaa !5
  br label %42

42:                                               ; preds = %57, %36
  %43 = load i64, ptr %7, align 8, !tbaa !5
  %44 = load i64, ptr %1, align 8, !tbaa !5
  %45 = icmp slt i64 %43, %44
  br i1 %45, label %46, label %60

46:                                               ; preds = %42
  %47 = load i64, ptr %5, align 8, !tbaa !5
  %48 = load i64, ptr %7, align 8, !tbaa !5
  %49 = getelementptr inbounds i64, ptr %17, i64 %48
  %50 = load i64, ptr %49, align 8, !tbaa !5
  %51 = icmp sgt i64 %47, %50
  br i1 %51, label %52, label %57

52:                                               ; preds = %46
  %53 = load i64, ptr %7, align 8, !tbaa !5
  store i64 %53, ptr %8, align 8, !tbaa !5
  %54 = load i64, ptr %7, align 8, !tbaa !5
  %55 = getelementptr inbounds i64, ptr %17, i64 %54
  %56 = load i64, ptr %55, align 8, !tbaa !5
  store i64 %56, ptr %5, align 8, !tbaa !5
  br label %57

57:                                               ; preds = %52, %46
  %58 = load i64, ptr %7, align 8, !tbaa !5
  %59 = add nsw i64 %58, 1
  store i64 %59, ptr %7, align 8, !tbaa !5
  br label %42, !llvm.loop !11

60:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %61 = load i64, ptr %8, align 8, !tbaa !5
  %62 = sub nsw i64 %61, 1
  store i64 %62, ptr %9, align 8, !tbaa !5
  br label %63

63:                                               ; preds = %67, %60
  %64 = load i64, ptr %9, align 8, !tbaa !5
  %65 = load i64, ptr %6, align 8, !tbaa !5
  %66 = icmp sge i64 %64, %65
  br i1 %66, label %67, label %75

67:                                               ; preds = %63
  %68 = load i64, ptr %9, align 8, !tbaa !5
  %69 = getelementptr inbounds i64, ptr %17, i64 %68
  %70 = load i64, ptr %9, align 8, !tbaa !5
  %71 = add nsw i64 %70, 1
  %72 = getelementptr inbounds i64, ptr %17, i64 %71
  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) %69, ptr noundef nonnull align 8 dereferenceable(8) %72) #5
  %73 = load i64, ptr %9, align 8, !tbaa !5
  %74 = add nsw i64 %73, -1
  store i64 %74, ptr %9, align 8, !tbaa !5
  br label %63, !llvm.loop !12

75:                                               ; preds = %63
  %76 = load i64, ptr %8, align 8, !tbaa !5
  %77 = icmp ne i64 %76, -1
  br i1 %77, label %78, label %81

78:                                               ; preds = %75
  %79 = load i64, ptr %8, align 8, !tbaa !5
  %80 = sub nsw i64 %79, 1
  store i64 %80, ptr %6, align 8, !tbaa !5
  br label %81

81:                                               ; preds = %78, %75
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %82

82:                                               ; preds = %81
  %83 = load i64, ptr %6, align 8, !tbaa !5
  %84 = add nsw i64 %83, 1
  store i64 %84, ptr %6, align 8, !tbaa !5
  br label %31, !llvm.loop !13

85:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  store ptr %17, ptr %10, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %86 = load ptr, ptr %10, align 8, !tbaa !14
  store ptr %86, ptr %11, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %87 = load ptr, ptr %10, align 8, !tbaa !14
  %88 = mul nuw i64 8, %15
  %89 = udiv i64 %88, 8
  %90 = getelementptr inbounds i64, ptr %87, i64 %89
  store ptr %90, ptr %12, align 8, !tbaa !14
  br label %91

91:                                               ; preds = %102, %85
  %92 = load ptr, ptr %11, align 8, !tbaa !14
  %93 = load ptr, ptr %12, align 8, !tbaa !14
  %94 = icmp ne ptr %92, %93
  br i1 %94, label %96, label %95

95:                                               ; preds = %91
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %105

96:                                               ; preds = %91
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %97 = load ptr, ptr %11, align 8, !tbaa !14
  %98 = load i64, ptr %97, align 8, !tbaa !5
  store i64 %98, ptr %13, align 8, !tbaa !5
  %99 = load i64, ptr %13, align 8, !tbaa !5
  %100 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %99)
  %101 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %100, ptr noundef @.str)
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %102

102:                                              ; preds = %96
  %103 = load ptr, ptr %11, align 8, !tbaa !14
  %104 = getelementptr inbounds i64, ptr %103, i32 1
  store ptr %104, ptr %11, align 8, !tbaa !14
  br label %91

105:                                              ; preds = %95
  %106 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.1)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  %107 = load ptr, ptr %2, align 8
  call void @llvm.stackrestore.p0(ptr %107)
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #5
  ret void
}

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

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

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

; Function Attrs: inlinehint mustprogress 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)) #3

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

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind willreturn }
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 = { 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 #5 = { 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = !{!15, !15, i64 0}
!15 = !{!"any pointer", !7, i64 0}


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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #0 {
  %1 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  %2 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %3 = load i64, ptr %1, align 8, !tbaa !5
  %4 = call ptr @llvm.stacksave.p0()
  %5 = alloca i64, i64 %3, align 16
  %6 = load i64, ptr %1, align 8, !tbaa !5
  %7 = icmp sgt i64 %6, 0
  br i1 %7, label %.lr.ph, label %._crit_edge54

.preheader:                                       ; preds = %.lr.ph
  %8 = icmp sgt i64 %12, 0
  br i1 %8, label %.lr.ph53, label %._crit_edge54

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.041 = phi i64 [ %11, %.lr.ph ], [ 0, %0 ]
  %9 = getelementptr inbounds i64, ptr %5, i64 %.041
  %10 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %9)
  %11 = add nuw nsw i64 %.041, 1
  %12 = load i64, ptr %1, align 8, !tbaa !5
  %13 = icmp slt i64 %11, %12
  br i1 %13, label %.lr.ph, label %.preheader, !llvm.loop !9

._crit_edge54:                                    ; preds = %._crit_edge51, %0, %.preheader
  %14 = getelementptr inbounds i64, ptr %5, i64 %3
  %.not55 = icmp eq i64 %3, 0
  br i1 %.not55, label %._crit_edge59, label %.lr.ph58

.lr.ph53:                                         ; preds = %.preheader, %._crit_edge51
  %15 = phi i64 [ %43, %._crit_edge51 ], [ %12, %.preheader ]
  %.03052 = phi i64 [ %44, %._crit_edge51 ], [ 0, %.preheader ]
  %.03542 = add nsw i64 %.03052, 1
  %16 = icmp slt i64 %.03542, %15
  br i1 %16, label %.lr.ph46.preheader, label %._crit_edge

.lr.ph46.preheader:                               ; preds = %.lr.ph53
  %17 = getelementptr inbounds i64, ptr %5, i64 %.03052
  %18 = load i64, ptr %17, align 8, !tbaa !5
  %19 = xor i64 %.03052, -1
  %20 = add i64 %15, %19
  %21 = add i64 %15, -2
  %22 = sub i64 %21, %.03052
  %xtraiter = and i64 %20, 3
  %23 = icmp ult i64 %22, 3
  br i1 %23, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph46.preheader.new

.lr.ph46.preheader.new:                           ; preds = %.lr.ph46.preheader
  %unroll_iter = and i64 %20, -4
  br label %.lr.ph46

.lr.ph46:                                         ; preds = %.lr.ph46, %.lr.ph46.preheader.new
  %.03545 = phi i64 [ %.03542, %.lr.ph46.preheader.new ], [ %.035.3, %.lr.ph46 ]
  %.02844 = phi i64 [ %18, %.lr.ph46.preheader.new ], [ %spec.select39.3, %.lr.ph46 ]
  %.03343 = phi i64 [ -1, %.lr.ph46.preheader.new ], [ %spec.select.3, %.lr.ph46 ]
  %niter = phi i64 [ 0, %.lr.ph46.preheader.new ], [ %niter.next.3, %.lr.ph46 ]
  %24 = getelementptr inbounds i64, ptr %5, i64 %.03545
  %25 = load i64, ptr %24, align 8, !tbaa !5
  %26 = icmp sgt i64 %.02844, %25
  %spec.select = select i1 %26, i64 %.03545, i64 %.03343
  %spec.select39 = call i64 @llvm.smin.i64(i64 %.02844, i64 %25)
  %.035 = add nsw i64 %.03545, 1
  %27 = getelementptr inbounds i64, ptr %5, i64 %.035
  %28 = load i64, ptr %27, align 8, !tbaa !5
  %29 = icmp sgt i64 %spec.select39, %28
  %spec.select.1 = select i1 %29, i64 %.035, i64 %spec.select
  %spec.select39.1 = call i64 @llvm.smin.i64(i64 %spec.select39, i64 %28)
  %.035.1 = add nsw i64 %.03545, 2
  %30 = getelementptr inbounds i64, ptr %5, i64 %.035.1
  %31 = load i64, ptr %30, align 8, !tbaa !5
  %32 = icmp sgt i64 %spec.select39.1, %31
  %spec.select.2 = select i1 %32, i64 %.035.1, i64 %spec.select.1
  %spec.select39.2 = call i64 @llvm.smin.i64(i64 %spec.select39.1, i64 %31)
  %.035.2 = add nsw i64 %.03545, 3
  %33 = getelementptr inbounds i64, ptr %5, i64 %.035.2
  %34 = load i64, ptr %33, align 8, !tbaa !5
  %35 = icmp sgt i64 %spec.select39.2, %34
  %spec.select.3 = select i1 %35, i64 %.035.2, i64 %spec.select.2
  %spec.select39.3 = call i64 @llvm.smin.i64(i64 %spec.select39.2, i64 %34)
  %.035.3 = add nsw i64 %.03545, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph46, !llvm.loop !11

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph46, %.lr.ph46.preheader
  %spec.select.lcssa.ph = phi i64 [ poison, %.lr.ph46.preheader ], [ %spec.select.3, %.lr.ph46 ]
  %.03545.unr = phi i64 [ %.03542, %.lr.ph46.preheader ], [ %.035.3, %.lr.ph46 ]
  %.02844.unr = phi i64 [ %18, %.lr.ph46.preheader ], [ %spec.select39.3, %.lr.ph46 ]
  %.03343.unr = phi i64 [ -1, %.lr.ph46.preheader ], [ %spec.select.3, %.lr.ph46 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph46.epil

.lr.ph46.epil:                                    ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph46.epil
  %.03545.epil = phi i64 [ %.035.epil, %.lr.ph46.epil ], [ %.03545.unr, %._crit_edge.loopexit.unr-lcssa ]
  %.02844.epil = phi i64 [ %spec.select39.epil, %.lr.ph46.epil ], [ %.02844.unr, %._crit_edge.loopexit.unr-lcssa ]
  %.03343.epil = phi i64 [ %spec.select.epil, %.lr.ph46.epil ], [ %.03343.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph46.epil ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %36 = getelementptr inbounds i64, ptr %5, i64 %.03545.epil
  %37 = load i64, ptr %36, align 8, !tbaa !5
  %38 = icmp sgt i64 %.02844.epil, %37
  %spec.select.epil = select i1 %38, i64 %.03545.epil, i64 %.03343.epil
  %spec.select39.epil = call i64 @llvm.smin.i64(i64 %.02844.epil, i64 %37)
  %.035.epil = add nsw i64 %.03545.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.lr.ph46.epil, !llvm.loop !12

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph46.epil, %.lr.ph53
  %.033.lcssa = phi i64 [ -1, %.lr.ph53 ], [ %spec.select.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %spec.select.epil, %.lr.ph46.epil ]
  %39 = add nsw i64 %.033.lcssa, -1
  %.not3747.not = icmp sgt i64 %.033.lcssa, %.03052
  br i1 %.not3747.not, label %.lr.ph50, label %._crit_edge51

.lr.ph50:                                         ; preds = %._crit_edge, %.lr.ph50
  %.03248 = phi i64 [ %42, %.lr.ph50 ], [ %39, %._crit_edge ]
  %40 = getelementptr inbounds i64, ptr %5, i64 %.03248
  %41 = getelementptr i8, ptr %40, i64 8
  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) %40, ptr noundef nonnull align 8 dereferenceable(8) %41) #6
  %42 = add nsw i64 %.03248, -1
  %.not37.not = icmp sgt i64 %.03248, %.03052
  br i1 %.not37.not, label %.lr.ph50, label %._crit_edge51.loopexit, !llvm.loop !14

._crit_edge51.loopexit:                           ; preds = %.lr.ph50
  %.pre = load i64, ptr %1, align 8, !tbaa !5
  br label %._crit_edge51

._crit_edge51:                                    ; preds = %._crit_edge51.loopexit, %._crit_edge
  %43 = phi i64 [ %.pre, %._crit_edge51.loopexit ], [ %15, %._crit_edge ]
  %.not38 = icmp eq i64 %.033.lcssa, -1
  %spec.select40 = select i1 %.not38, i64 %.03052, i64 %39
  %44 = add nsw i64 %spec.select40, 1
  %45 = icmp slt i64 %44, %43
  br i1 %45, label %.lr.ph53, label %._crit_edge54, !llvm.loop !15

._crit_edge59:                                    ; preds = %.lr.ph58, %._crit_edge54
  %46 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.1)
  call void @llvm.stackrestore.p0(ptr %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  ret void

.lr.ph58:                                         ; preds = %._crit_edge54, %.lr.ph58
  %.02956 = phi ptr [ %50, %.lr.ph58 ], [ %5, %._crit_edge54 ]
  %47 = load i64, ptr %.02956, align 8, !tbaa !5
  %48 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %47)
  %49 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %48, ptr noundef nonnull @.str)
  %50 = getelementptr inbounds i8, ptr %.02956, i64 8
  %.not = icmp eq ptr %50, %14
  br i1 %.not, label %._crit_edge59, label %.lr.ph58
}

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

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

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

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

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

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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn }
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 = { 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.unroll.disable"}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}


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