; LLVM IR from ravireddy07/cpp-book :: src/Interview-Problems (MarioAndPrincess)

; 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 ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  %12 = 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 %13

13:                                               ; preds = %110, %0
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = add nsw i32 %14, -1
  store i32 %15, ptr %2, align 4, !tbaa !5
  %16 = icmp ne i32 %14, 0
  br i1 %16, label %17, label %115

17:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  %18 = 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)
  %19 = load i32, ptr %3, align 4, !tbaa !5
  %20 = zext i32 %19 to i64
  %21 = call ptr @llvm.stacksave.p0()
  store ptr %21, ptr %4, align 8
  %22 = alloca i32, i64 %20, align 16
  store i64 %20, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %23

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

27:                                               ; preds = %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %36

28:                                               ; preds = %23
  %29 = load i32, ptr %6, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds i32, ptr %22, i64 %30
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %31)
  br label %33

33:                                               ; preds = %28
  %34 = load i32, ptr %6, align 4, !tbaa !5
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %6, align 4, !tbaa !5
  br label %23, !llvm.loop !9

36:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 1, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 1, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %37

37:                                               ; preds = %64, %36
  %38 = load i32, ptr %10, align 4, !tbaa !5
  %39 = load i32, ptr %3, align 4, !tbaa !5
  %40 = icmp slt i32 %38, %39
  br i1 %40, label %42, label %41

41:                                               ; preds = %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %67

42:                                               ; preds = %37
  %43 = load i32, ptr %10, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds i32, ptr %22, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %47 = load i32, ptr %10, align 4, !tbaa !5
  %48 = sub nsw i32 %47, 1
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds i32, ptr %22, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = icmp sge i32 %46, %51
  br i1 %52, label %53, label %56

53:                                               ; preds = %42
  %54 = load i32, ptr %8, align 4, !tbaa !5
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr %8, align 4, !tbaa !5
  br label %63

56:                                               ; preds = %42
  %57 = load i32, ptr %8, align 4, !tbaa !5
  %58 = load i32, ptr %7, align 4, !tbaa !5
  %59 = icmp sgt i32 %57, %58
  br i1 %59, label %60, label %62

60:                                               ; preds = %56
  %61 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %61, ptr %7, align 4, !tbaa !5
  br label %62

62:                                               ; preds = %60, %56
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %63

63:                                               ; preds = %62, %53
  br label %64

64:                                               ; preds = %63
  %65 = load i32, ptr %10, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %10, align 4, !tbaa !5
  br label %37, !llvm.loop !11

67:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %68

68:                                               ; preds = %95, %67
  %69 = load i32, ptr %11, align 4, !tbaa !5
  %70 = load i32, ptr %3, align 4, !tbaa !5
  %71 = icmp slt i32 %69, %70
  br i1 %71, label %73, label %72

72:                                               ; preds = %68
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %98

73:                                               ; preds = %68
  %74 = load i32, ptr %11, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds i32, ptr %22, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = load i32, ptr %11, align 4, !tbaa !5
  %79 = sub nsw i32 %78, 1
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds i32, ptr %22, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = icmp sle i32 %77, %82
  br i1 %83, label %84, label %87

84:                                               ; preds = %73
  %85 = load i32, ptr %9, align 4, !tbaa !5
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %9, align 4, !tbaa !5
  br label %94

87:                                               ; preds = %73
  %88 = load i32, ptr %9, align 4, !tbaa !5
  %89 = load i32, ptr %7, align 4, !tbaa !5
  %90 = icmp sgt i32 %88, %89
  br i1 %90, label %91, label %93

91:                                               ; preds = %87
  %92 = load i32, ptr %9, align 4, !tbaa !5
  store i32 %92, ptr %7, align 4, !tbaa !5
  br label %93

93:                                               ; preds = %91, %87
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %94

94:                                               ; preds = %93, %84
  br label %95

95:                                               ; preds = %94
  %96 = load i32, ptr %11, align 4, !tbaa !5
  %97 = add nsw i32 %96, 1
  store i32 %97, ptr %11, align 4, !tbaa !5
  br label %68, !llvm.loop !12

98:                                               ; preds = %72
  %99 = load i32, ptr %9, align 4, !tbaa !5
  %100 = load i32, ptr %7, align 4, !tbaa !5
  %101 = icmp sgt i32 %99, %100
  br i1 %101, label %102, label %104

102:                                              ; preds = %98
  %103 = load i32, ptr %9, align 4, !tbaa !5
  store i32 %103, ptr %7, align 4, !tbaa !5
  br label %104

104:                                              ; preds = %102, %98
  %105 = load i32, ptr %8, align 4, !tbaa !5
  %106 = load i32, ptr %7, align 4, !tbaa !5
  %107 = icmp sgt i32 %105, %106
  br i1 %107, label %108, label %110

108:                                              ; preds = %104
  %109 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %109, ptr %7, align 4, !tbaa !5
  br label %110

110:                                              ; preds = %108, %104
  %111 = load i32, ptr %7, align 4, !tbaa !5
  %112 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %111)
  %113 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %112, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  %114 = load ptr, ptr %4, align 8
  call void @llvm.stackrestore.p0(ptr %114)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %13, !llvm.loop !13

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

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

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

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

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #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)) #5

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

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

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

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


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

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

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

.lr.ph53:                                         ; preds = %0, %._crit_edge
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  %6 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %7 = load i32, ptr %2, align 4, !tbaa !5
  %8 = zext i32 %7 to i64
  %9 = call ptr @llvm.stacksave.p0()
  %10 = alloca i32, i64 %8, align 16
  %11 = load i32, ptr %2, align 4, !tbaa !5
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.lr.ph, label %._crit_edge

.preheader37:                                     ; preds = %.lr.ph
  %13 = icmp sgt i32 %19, 1
  br i1 %13, label %.lr.ph42.preheader, label %._crit_edge

.lr.ph42.preheader:                               ; preds = %.preheader37
  %wide.trip.count = zext nneg i32 %19 to i64
  %14 = add nsw i64 %wide.trip.count, -1
  %15 = add nsw i64 %wide.trip.count, -2
  %xtraiter = and i64 %14, 1
  %16 = icmp eq i64 %15, 0
  br i1 %16, label %.preheader.unr-lcssa, label %.lr.ph42.preheader.new

.lr.ph42.preheader.new:                           ; preds = %.lr.ph42.preheader
  %unroll_iter = and i64 %14, -2
  %invariant.gep = getelementptr inbounds i8, ptr %10, i64 4
  br label %.lr.ph42

.lr.ph:                                           ; preds = %.lr.ph53, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph53 ]
  %17 = getelementptr inbounds i32, ptr %10, i64 %indvars.iv
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %17)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = icmp slt i64 %indvars.iv.next, %20
  br i1 %21, label %.lr.ph, label %.preheader37, !llvm.loop !9

.preheader.unr-lcssa:                             ; preds = %.lr.ph42, %.lr.ph42.preheader
  %.2.lcssa.ph = phi i32 [ poison, %.lr.ph42.preheader ], [ %.2.1, %.lr.ph42 ]
  %.129.lcssa.ph = phi i32 [ poison, %.lr.ph42.preheader ], [ %.129.1, %.lr.ph42 ]
  %indvars.iv57.unr = phi i64 [ 1, %.lr.ph42.preheader ], [ %indvars.iv.next58.1, %.lr.ph42 ]
  %.02840.unr = phi i32 [ 1, %.lr.ph42.preheader ], [ %.129.1, %.lr.ph42 ]
  %.03039.unr = phi i32 [ 0, %.lr.ph42.preheader ], [ %.2.1, %.lr.ph42 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader, label %.lr.ph42.epil

.lr.ph42.epil:                                    ; preds = %.preheader.unr-lcssa
  %22 = getelementptr inbounds i32, ptr %10, i64 %indvars.iv57.unr
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = getelementptr i8, ptr %22, i64 -4
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %.not34.epil = icmp slt i32 %23, %25
  %26 = add nsw i32 %.02840.unr, 1
  %spec.select.epil = call i32 @llvm.smax.i32(i32 %.02840.unr, i32 %.03039.unr)
  %.2.epil = select i1 %.not34.epil, i32 %spec.select.epil, i32 %.03039.unr
  %.129.epil = select i1 %.not34.epil, i32 1, i32 %26
  br label %.preheader

.preheader:                                       ; preds = %.preheader.unr-lcssa, %.lr.ph42.epil
  %.2.lcssa = phi i32 [ %.2.lcssa.ph, %.preheader.unr-lcssa ], [ %.2.epil, %.lr.ph42.epil ]
  %.129.lcssa = phi i32 [ %.129.lcssa.ph, %.preheader.unr-lcssa ], [ %.129.epil, %.lr.ph42.epil ]
  br i1 %13, label %.lr.ph48.preheader, label %._crit_edge

.lr.ph48.preheader:                               ; preds = %.preheader
  %xtraiter73 = and i64 %14, 1
  %27 = icmp eq i64 %15, 0
  br i1 %27, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph48.preheader.new

.lr.ph48.preheader.new:                           ; preds = %.lr.ph48.preheader
  %unroll_iter77 = and i64 %14, -2
  %invariant.gep79 = getelementptr inbounds i8, ptr %10, i64 4
  br label %.lr.ph48

.lr.ph42:                                         ; preds = %.lr.ph42, %.lr.ph42.preheader.new
  %indvars.iv57 = phi i64 [ 1, %.lr.ph42.preheader.new ], [ %indvars.iv.next58.1, %.lr.ph42 ]
  %.02840 = phi i32 [ 1, %.lr.ph42.preheader.new ], [ %.129.1, %.lr.ph42 ]
  %.03039 = phi i32 [ 0, %.lr.ph42.preheader.new ], [ %.2.1, %.lr.ph42 ]
  %niter = phi i64 [ 0, %.lr.ph42.preheader.new ], [ %niter.next.1, %.lr.ph42 ]
  %28 = getelementptr inbounds i32, ptr %10, i64 %indvars.iv57
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = getelementptr i8, ptr %28, i64 -4
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %.not34 = icmp slt i32 %29, %31
  %32 = add nsw i32 %.02840, 1
  %spec.select = call i32 @llvm.smax.i32(i32 %.02840, i32 %.03039)
  %.2 = select i1 %.not34, i32 %spec.select, i32 %.03039
  %.129 = select i1 %.not34, i32 1, i32 %32
  %gep = getelementptr inbounds i32, ptr %invariant.gep, i64 %indvars.iv57
  %33 = load i32, ptr %gep, align 4, !tbaa !5
  %.not34.1 = icmp slt i32 %33, %29
  %34 = add nsw i32 %.129, 1
  %spec.select.1 = call i32 @llvm.smax.i32(i32 %.129, i32 %.2)
  %.2.1 = select i1 %.not34.1, i32 %spec.select.1, i32 %.2
  %.129.1 = select i1 %.not34.1, i32 1, i32 %34
  %indvars.iv.next58.1 = add nuw nsw i64 %indvars.iv57, 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 %.preheader.unr-lcssa, label %.lr.ph42, !llvm.loop !11

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph48, %.lr.ph48.preheader
  %.5.lcssa.ph = phi i32 [ poison, %.lr.ph48.preheader ], [ %.5.1, %.lr.ph48 ]
  %.1.lcssa.ph = phi i32 [ poison, %.lr.ph48.preheader ], [ %.1.1, %.lr.ph48 ]
  %indvars.iv60.unr = phi i64 [ 1, %.lr.ph48.preheader ], [ %indvars.iv.next61.1, %.lr.ph48 ]
  %.02746.unr = phi i32 [ 1, %.lr.ph48.preheader ], [ %.1.1, %.lr.ph48 ]
  %.345.unr = phi i32 [ %.2.lcssa, %.lr.ph48.preheader ], [ %.5.1, %.lr.ph48 ]
  %lcmp.mod74.not = icmp eq i64 %xtraiter73, 0
  br i1 %lcmp.mod74.not, label %._crit_edge, label %.lr.ph48.epil

.lr.ph48.epil:                                    ; preds = %._crit_edge.loopexit.unr-lcssa
  %35 = getelementptr inbounds i32, ptr %10, i64 %indvars.iv60.unr
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = getelementptr i8, ptr %35, i64 -4
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %.not33.epil = icmp sgt i32 %36, %38
  %39 = add nsw i32 %.02746.unr, 1
  %spec.select36.epil = call i32 @llvm.smax.i32(i32 %.02746.unr, i32 %.345.unr)
  %.5.epil = select i1 %.not33.epil, i32 %spec.select36.epil, i32 %.345.unr
  %.1.epil = select i1 %.not33.epil, i32 1, i32 %39
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph48.epil, %._crit_edge.loopexit.unr-lcssa, %.lr.ph53, %.preheader37, %.preheader
  %.028.lcssa70 = phi i32 [ %.129.lcssa, %.preheader ], [ 1, %.preheader37 ], [ 1, %.lr.ph53 ], [ %.129.lcssa, %._crit_edge.loopexit.unr-lcssa ], [ %.129.lcssa, %.lr.ph48.epil ]
  %.3.lcssa = phi i32 [ %.2.lcssa, %.preheader ], [ 0, %.preheader37 ], [ 0, %.lr.ph53 ], [ %.5.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %.5.epil, %.lr.ph48.epil ]
  %.027.lcssa = phi i32 [ 1, %.preheader ], [ 1, %.preheader37 ], [ 1, %.lr.ph53 ], [ %.1.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %.1.epil, %.lr.ph48.epil ]
  %spec.select35 = call i32 @llvm.smax.i32(i32 %.027.lcssa, i32 %.3.lcssa)
  %.7 = call i32 @llvm.smax.i32(i32 %.028.lcssa70, i32 %spec.select35)
  %40 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.7)
  %41 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %40, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.stackrestore.p0(ptr %9)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  %42 = load i32, ptr %1, align 4, !tbaa !5
  %43 = add nsw i32 %42, -1
  store i32 %43, ptr %1, align 4, !tbaa !5
  %.not = icmp eq i32 %42, 0
  br i1 %.not, label %._crit_edge54, label %.lr.ph53, !llvm.loop !12

.lr.ph48:                                         ; preds = %.lr.ph48, %.lr.ph48.preheader.new
  %indvars.iv60 = phi i64 [ 1, %.lr.ph48.preheader.new ], [ %indvars.iv.next61.1, %.lr.ph48 ]
  %.02746 = phi i32 [ 1, %.lr.ph48.preheader.new ], [ %.1.1, %.lr.ph48 ]
  %.345 = phi i32 [ %.2.lcssa, %.lr.ph48.preheader.new ], [ %.5.1, %.lr.ph48 ]
  %niter78 = phi i64 [ 0, %.lr.ph48.preheader.new ], [ %niter78.next.1, %.lr.ph48 ]
  %44 = getelementptr inbounds i32, ptr %10, i64 %indvars.iv60
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = getelementptr i8, ptr %44, i64 -4
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %.not33 = icmp sgt i32 %45, %47
  %48 = add nsw i32 %.02746, 1
  %spec.select36 = call i32 @llvm.smax.i32(i32 %.02746, i32 %.345)
  %.5 = select i1 %.not33, i32 %spec.select36, i32 %.345
  %.1 = select i1 %.not33, i32 1, i32 %48
  %gep80 = getelementptr inbounds i32, ptr %invariant.gep79, i64 %indvars.iv60
  %49 = load i32, ptr %gep80, align 4, !tbaa !5
  %.not33.1 = icmp sgt i32 %49, %45
  %50 = add nsw i32 %.1, 1
  %spec.select36.1 = call i32 @llvm.smax.i32(i32 %.1, i32 %.5)
  %.5.1 = select i1 %.not33.1, i32 %spec.select36.1, i32 %.5
  %.1.1 = select i1 %.not33.1, i32 1, i32 %50
  %indvars.iv.next61.1 = add nuw nsw i64 %indvars.iv60, 2
  %niter78.next.1 = add i64 %niter78, 2
  %niter78.ncmp.1 = icmp eq i64 %niter78.next.1, %unroll_iter77
  br i1 %niter78.ncmp.1, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph48, !llvm.loop !13

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

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

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

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

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

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #6

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

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

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


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