; LLVM IR from Leet-Us-Code/DSA-A-Z-Practice :: Sid's Levels/Level - 1/DynamicProgramming (BuyandSellStocks2Trans)

; 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 [100000 x i32], align 16
  %4 = alloca i32, align 4
  %5 = alloca [100000 x i32], align 16
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca [100000 x i32], align 16
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  %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) %2)
  call void @llvm.lifetime.start.p0(i64 400000, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %28, %0
  %19 = load i32, ptr %4, align 4, !tbaa !5
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = icmp slt i32 %19, %20
  br i1 %21, label %23, label %22

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

23:                                               ; preds = %18
  %24 = load i32, ptr %4, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [100000 x i32], ptr %3, i64 0, i64 %25
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %26)
  br label %28

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

31:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 400000, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 -2147483648, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 2147483647, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %66, %31
  %33 = load i32, ptr %8, align 4, !tbaa !5
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = icmp slt i32 %33, %34
  br i1 %35, label %37, label %36

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

37:                                               ; preds = %32
  %38 = load i32, ptr %7, align 4, !tbaa !5
  %39 = load i32, ptr %8, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [100000 x i32], ptr %3, i64 0, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = icmp sgt i32 %38, %42
  br i1 %43, label %44, label %49

44:                                               ; preds = %37
  %45 = load i32, ptr %8, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [100000 x i32], ptr %3, i64 0, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !5
  store i32 %48, ptr %7, align 4, !tbaa !5
  br label %49

49:                                               ; preds = %44, %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %50 = load i32, ptr %8, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [100000 x i32], ptr %3, i64 0, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = load i32, ptr %7, align 4, !tbaa !5
  %55 = sub nsw i32 %53, %54
  store i32 %55, ptr %9, align 4, !tbaa !5
  %56 = load i32, ptr %6, align 4, !tbaa !5
  %57 = load i32, ptr %9, align 4, !tbaa !5
  %58 = icmp slt i32 %56, %57
  br i1 %58, label %59, label %61

59:                                               ; preds = %49
  %60 = load i32, ptr %9, align 4, !tbaa !5
  store i32 %60, ptr %6, align 4, !tbaa !5
  br label %61

61:                                               ; preds = %59, %49
  %62 = load i32, ptr %6, align 4, !tbaa !5
  %63 = load i32, ptr %8, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [100000 x i32], ptr %5, i64 0, i64 %64
  store i32 %62, ptr %65, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %66

66:                                               ; preds = %61
  %67 = load i32, ptr %8, align 4, !tbaa !5
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %8, align 4, !tbaa !5
  br label %32, !llvm.loop !11

69:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 400000, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 -2147483648, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 -2147483648, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %70 = load i32, ptr %2, align 4, !tbaa !5
  %71 = sub nsw i32 %70, 1
  store i32 %71, ptr %13, align 4, !tbaa !5
  br label %72

72:                                               ; preds = %105, %69
  %73 = load i32, ptr %13, align 4, !tbaa !5
  %74 = icmp sge i32 %73, 0
  br i1 %74, label %76, label %75

75:                                               ; preds = %72
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %108

76:                                               ; preds = %72
  %77 = load i32, ptr %12, align 4, !tbaa !5
  %78 = load i32, ptr %13, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [100000 x i32], ptr %3, i64 0, i64 %79
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %82 = icmp slt i32 %77, %81
  br i1 %82, label %83, label %88

83:                                               ; preds = %76
  %84 = load i32, ptr %13, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [100000 x i32], ptr %3, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  store i32 %87, ptr %12, align 4, !tbaa !5
  br label %88

88:                                               ; preds = %83, %76
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %89 = load i32, ptr %12, align 4, !tbaa !5
  %90 = load i32, ptr %13, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [100000 x i32], ptr %3, i64 0, i64 %91
  %93 = load i32, ptr %92, align 4, !tbaa !5
  %94 = sub nsw i32 %89, %93
  store i32 %94, ptr %14, align 4, !tbaa !5
  %95 = load i32, ptr %11, align 4, !tbaa !5
  %96 = load i32, ptr %14, align 4, !tbaa !5
  %97 = icmp slt i32 %95, %96
  br i1 %97, label %98, label %100

98:                                               ; preds = %88
  %99 = load i32, ptr %14, align 4, !tbaa !5
  store i32 %99, ptr %11, align 4, !tbaa !5
  br label %100

100:                                              ; preds = %98, %88
  %101 = load i32, ptr %11, align 4, !tbaa !5
  %102 = load i32, ptr %13, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [100000 x i32], ptr %10, i64 0, i64 %103
  store i32 %101, ptr %104, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %105

105:                                              ; preds = %100
  %106 = load i32, ptr %13, align 4, !tbaa !5
  %107 = add nsw i32 %106, -1
  store i32 %107, ptr %13, align 4, !tbaa !5
  br label %72, !llvm.loop !12

108:                                              ; preds = %75
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 -2147483648, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %109

109:                                              ; preds = %137, %108
  %110 = load i32, ptr %16, align 4, !tbaa !5
  %111 = load i32, ptr %2, align 4, !tbaa !5
  %112 = icmp slt i32 %110, %111
  br i1 %112, label %114, label %113

113:                                              ; preds = %109
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %140

114:                                              ; preds = %109
  %115 = load i32, ptr %16, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [100000 x i32], ptr %10, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = load i32, ptr %16, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [100000 x i32], ptr %5, i64 0, i64 %120
  %122 = load i32, ptr %121, align 4, !tbaa !5
  %123 = add nsw i32 %118, %122
  %124 = load i32, ptr %15, align 4, !tbaa !5
  %125 = icmp sgt i32 %123, %124
  br i1 %125, label %126, label %136

126:                                              ; preds = %114
  %127 = load i32, ptr %16, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [100000 x i32], ptr %10, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = load i32, ptr %16, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [100000 x i32], ptr %5, i64 0, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = add nsw i32 %130, %134
  store i32 %135, ptr %15, align 4, !tbaa !5
  br label %136

136:                                              ; preds = %126, %114
  br label %137

137:                                              ; preds = %136
  %138 = load i32, ptr %16, align 4, !tbaa !5
  %139 = add nsw i32 %138, 1
  store i32 %139, ptr %16, align 4, !tbaa !5
  br label %109, !llvm.loop !13

140:                                              ; preds = %113
  %141 = load i32, ptr %15, align 4, !tbaa !5
  %142 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %141)
  %143 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %142, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 400000, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 400000, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 400000, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  %144 = load i32, ptr %1, align 4
  ret i32 %144
}

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 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 = !{!"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 [100000 x i32], align 16
  %3 = alloca [100000 x i32], align 16
  %4 = alloca [100000 x i32], align 16
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %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) %1)
  call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %2) #6
  %6 = load i32, ptr %1, align 4, !tbaa !5
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %0
  call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %3) #6
  br label %._crit_edge61.thread

._crit_edge:                                      ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %3) #6
  %8 = icmp sgt i32 %13, 0
  br i1 %8, label %.lr.ph60.preheader, label %._crit_edge61.thread

.lr.ph60.preheader:                               ; preds = %._crit_edge
  %wide.trip.count = zext nneg i32 %13 to i64
  %9 = add nsw i64 %wide.trip.count, -1
  %xtraiter = and i64 %wide.trip.count, 1
  %10 = icmp eq i64 %9, 0
  br i1 %10, label %._crit_edge61.unr-lcssa, label %.lr.ph60.preheader.new

.lr.ph60.preheader.new:                           ; preds = %.lr.ph60.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483646
  br label %.lr.ph60

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %11 = getelementptr inbounds [100000 x i32], ptr %2, i64 0, i64 %indvars.iv
  %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) %11)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %13 = load i32, ptr %1, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = icmp slt i64 %indvars.iv.next, %14
  br i1 %15, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge61.thread:                             ; preds = %._crit_edge.thread, %._crit_edge
  call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %4) #6
  br label %._crit_edge70

._crit_edge61.unr-lcssa:                          ; preds = %.lr.ph60, %.lr.ph60.preheader
  %indvars.iv74.unr = phi i64 [ 0, %.lr.ph60.preheader ], [ %indvars.iv.next75.1, %.lr.ph60 ]
  %.04358.unr = phi i32 [ -2147483648, %.lr.ph60.preheader ], [ %.144.1, %.lr.ph60 ]
  %.04656.unr = phi i32 [ 2147483647, %.lr.ph60.preheader ], [ %spec.select.1, %.lr.ph60 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge61, label %.lr.ph60.epil

.lr.ph60.epil:                                    ; preds = %._crit_edge61.unr-lcssa
  %16 = getelementptr inbounds [100000 x i32], ptr %2, i64 0, i64 %indvars.iv74.unr
  %17 = load i32, ptr %16, align 4, !tbaa !5
  %spec.select.epil = call i32 @llvm.smin.i32(i32 %.04656.unr, i32 %17)
  %18 = sub nsw i32 %17, %spec.select.epil
  %.144.epil = call i32 @llvm.smax.i32(i32 %.04358.unr, i32 %18)
  %19 = getelementptr inbounds [100000 x i32], ptr %3, i64 0, i64 %indvars.iv74.unr
  store i32 %.144.epil, ptr %19, align 4, !tbaa !5
  br label %._crit_edge61

._crit_edge61:                                    ; preds = %._crit_edge61.unr-lcssa, %.lr.ph60.epil
  call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %4) #6
  br i1 %8, label %.lr.ph66.preheader, label %._crit_edge70

.lr.ph66.preheader:                               ; preds = %._crit_edge61
  %20 = zext nneg i32 %13 to i64
  %xtraiter98 = and i64 %wide.trip.count, 1
  %21 = icmp eq i64 %9, 0
  br i1 %21, label %.preheader.unr-lcssa, label %.lr.ph66.preheader.new

.lr.ph66.preheader.new:                           ; preds = %.lr.ph66.preheader
  %unroll_iter100 = and i64 %wide.trip.count, 2147483646
  br label %.lr.ph66

.lr.ph60:                                         ; preds = %.lr.ph60, %.lr.ph60.preheader.new
  %indvars.iv74 = phi i64 [ 0, %.lr.ph60.preheader.new ], [ %indvars.iv.next75.1, %.lr.ph60 ]
  %.04358 = phi i32 [ -2147483648, %.lr.ph60.preheader.new ], [ %.144.1, %.lr.ph60 ]
  %.04656 = phi i32 [ 2147483647, %.lr.ph60.preheader.new ], [ %spec.select.1, %.lr.ph60 ]
  %niter = phi i64 [ 0, %.lr.ph60.preheader.new ], [ %niter.next.1, %.lr.ph60 ]
  %22 = getelementptr inbounds [100000 x i32], ptr %2, i64 0, i64 %indvars.iv74
  %23 = load i32, ptr %22, align 8, !tbaa !5
  %spec.select = call i32 @llvm.smin.i32(i32 %.04656, i32 %23)
  %24 = sub nsw i32 %23, %spec.select
  %.144 = call i32 @llvm.smax.i32(i32 %.04358, i32 %24)
  %25 = getelementptr inbounds [100000 x i32], ptr %3, i64 0, i64 %indvars.iv74
  store i32 %.144, ptr %25, align 8, !tbaa !5
  %indvars.iv.next75 = or disjoint i64 %indvars.iv74, 1
  %26 = getelementptr inbounds [100000 x i32], ptr %2, i64 0, i64 %indvars.iv.next75
  %27 = load i32, ptr %26, align 4, !tbaa !5
  %spec.select.1 = call i32 @llvm.smin.i32(i32 %spec.select, i32 %27)
  %28 = sub nsw i32 %27, %spec.select.1
  %.144.1 = call i32 @llvm.smax.i32(i32 %.144, i32 %28)
  %29 = getelementptr inbounds [100000 x i32], ptr %3, i64 0, i64 %indvars.iv.next75
  store i32 %.144.1, ptr %29, align 4, !tbaa !5
  %indvars.iv.next75.1 = add nuw nsw i64 %indvars.iv74, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge61.unr-lcssa, label %.lr.ph60, !llvm.loop !11

.preheader.unr-lcssa:                             ; preds = %.lr.ph66, %.lr.ph66.preheader
  %indvars.iv77.unr = phi i64 [ %20, %.lr.ph66.preheader ], [ %indvars.iv.next78.1, %.lr.ph66 ]
  %.03963.unr = phi i32 [ -2147483648, %.lr.ph66.preheader ], [ %spec.select53.1, %.lr.ph66 ]
  %.04162.unr = phi i32 [ -2147483648, %.lr.ph66.preheader ], [ %.142.1, %.lr.ph66 ]
  %lcmp.mod99.not = icmp eq i64 %xtraiter98, 0
  br i1 %lcmp.mod99.not, label %.preheader, label %.lr.ph66.epil

.lr.ph66.epil:                                    ; preds = %.preheader.unr-lcssa
  %indvars.iv.next78.epil = add nsw i64 %indvars.iv77.unr, -1
  %30 = getelementptr inbounds [100000 x i32], ptr %2, i64 0, i64 %indvars.iv.next78.epil
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %spec.select53.epil = call i32 @llvm.smax.i32(i32 %.03963.unr, i32 %31)
  %32 = sub nsw i32 %spec.select53.epil, %31
  %.142.epil = call i32 @llvm.smax.i32(i32 %.04162.unr, i32 %32)
  %33 = getelementptr inbounds [100000 x i32], ptr %4, i64 0, i64 %indvars.iv.next78.epil
  store i32 %.142.epil, ptr %33, align 4, !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %.preheader.unr-lcssa, %.lr.ph66.epil
  br i1 %8, label %.lr.ph69.preheader, label %._crit_edge70

.lr.ph69.preheader:                               ; preds = %.preheader
  %wide.trip.count83 = zext nneg i32 %13 to i64
  %min.iters.check = icmp ult i32 %13, 8
  br i1 %min.iters.check, label %.lr.ph69.preheader95, label %vector.ph

.lr.ph69.preheader95:                             ; preds = %middle.block, %.lr.ph69.preheader
  %indvars.iv80.ph = phi i64 [ 0, %.lr.ph69.preheader ], [ %n.vec, %middle.block ]
  %.03667.ph = phi i32 [ -2147483648, %.lr.ph69.preheader ], [ %43, %middle.block ]
  br label %.lr.ph69

vector.ph:                                        ; preds = %.lr.ph69.preheader
  %n.vec = and i64 %wide.trip.count, 2147483640
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ <i32 -2147483648, i32 -2147483648, i32 -2147483648, i32 -2147483648>, %vector.ph ], [ %40, %vector.body ]
  %vec.phi91 = phi <4 x i32> [ <i32 -2147483648, i32 -2147483648, i32 -2147483648, i32 -2147483648>, %vector.ph ], [ %41, %vector.body ]
  %34 = getelementptr inbounds [100000 x i32], ptr %4, i64 0, i64 %index
  %35 = getelementptr inbounds i8, ptr %34, i64 16
  %wide.load = load <4 x i32>, ptr %34, align 16, !tbaa !5
  %wide.load92 = load <4 x i32>, ptr %35, align 16, !tbaa !5
  %36 = getelementptr inbounds [100000 x i32], ptr %3, i64 0, i64 %index
  %37 = getelementptr inbounds i8, ptr %36, i64 16
  %wide.load93 = load <4 x i32>, ptr %36, align 16, !tbaa !5
  %wide.load94 = load <4 x i32>, ptr %37, align 16, !tbaa !5
  %38 = add nsw <4 x i32> %wide.load93, %wide.load
  %39 = add nsw <4 x i32> %wide.load94, %wide.load92
  %40 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %38, <4 x i32> %vec.phi)
  %41 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %39, <4 x i32> %vec.phi91)
  %index.next = add nuw i64 %index, 8
  %42 = icmp eq i64 %index.next, %n.vec
  br i1 %42, label %middle.block, label %vector.body, !llvm.loop !12

middle.block:                                     ; preds = %vector.body
  %rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %40, <4 x i32> %41)
  %43 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax)
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge70, label %.lr.ph69.preheader95

.lr.ph66:                                         ; preds = %.lr.ph66, %.lr.ph66.preheader.new
  %indvars.iv77 = phi i64 [ %20, %.lr.ph66.preheader.new ], [ %indvars.iv.next78.1, %.lr.ph66 ]
  %.03963 = phi i32 [ -2147483648, %.lr.ph66.preheader.new ], [ %spec.select53.1, %.lr.ph66 ]
  %.04162 = phi i32 [ -2147483648, %.lr.ph66.preheader.new ], [ %.142.1, %.lr.ph66 ]
  %niter101 = phi i64 [ 0, %.lr.ph66.preheader.new ], [ %niter101.next.1, %.lr.ph66 ]
  %indvars.iv.next78 = add nsw i64 %indvars.iv77, -1
  %44 = getelementptr inbounds [100000 x i32], ptr %2, i64 0, i64 %indvars.iv.next78
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %spec.select53 = call i32 @llvm.smax.i32(i32 %.03963, i32 %45)
  %46 = sub nsw i32 %spec.select53, %45
  %.142 = call i32 @llvm.smax.i32(i32 %.04162, i32 %46)
  %47 = getelementptr inbounds [100000 x i32], ptr %4, i64 0, i64 %indvars.iv.next78
  store i32 %.142, ptr %47, align 4, !tbaa !5
  %indvars.iv.next78.1 = add nsw i64 %indvars.iv77, -2
  %48 = getelementptr inbounds [100000 x i32], ptr %2, i64 0, i64 %indvars.iv.next78.1
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %spec.select53.1 = call i32 @llvm.smax.i32(i32 %spec.select53, i32 %49)
  %50 = sub nsw i32 %spec.select53.1, %49
  %.142.1 = call i32 @llvm.smax.i32(i32 %.142, i32 %50)
  %51 = getelementptr inbounds [100000 x i32], ptr %4, i64 0, i64 %indvars.iv.next78.1
  store i32 %.142.1, ptr %51, align 4, !tbaa !5
  %niter101.next.1 = add i64 %niter101, 2
  %niter101.ncmp.1.not = icmp eq i64 %niter101.next.1, %unroll_iter100
  br i1 %niter101.ncmp.1.not, label %.preheader.unr-lcssa, label %.lr.ph66, !llvm.loop !15

._crit_edge70:                                    ; preds = %.lr.ph69, %middle.block, %._crit_edge61, %._crit_edge61.thread, %.preheader
  %.036.lcssa = phi i32 [ -2147483648, %.preheader ], [ -2147483648, %._crit_edge61.thread ], [ -2147483648, %._crit_edge61 ], [ %43, %middle.block ], [ %spec.select54, %.lr.ph69 ]
  %52 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.036.lcssa)
  %53 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %52, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret i32 0

.lr.ph69:                                         ; preds = %.lr.ph69.preheader95, %.lr.ph69
  %indvars.iv80 = phi i64 [ %indvars.iv.next81, %.lr.ph69 ], [ %indvars.iv80.ph, %.lr.ph69.preheader95 ]
  %.03667 = phi i32 [ %spec.select54, %.lr.ph69 ], [ %.03667.ph, %.lr.ph69.preheader95 ]
  %54 = getelementptr inbounds [100000 x i32], ptr %4, i64 0, i64 %indvars.iv80
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = getelementptr inbounds [100000 x i32], ptr %3, i64 0, i64 %indvars.iv80
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = add nsw i32 %57, %55
  %spec.select54 = call i32 @llvm.smax.i32(i32 %58, i32 %.03667)
  %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
  %exitcond84.not = icmp eq i64 %indvars.iv.next81, %wide.trip.count83
  br i1 %exitcond84.not, label %._crit_edge70, label %.lr.ph69, !llvm.loop !16
}

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) #5

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) #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 = { 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 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 = !{!"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, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !14, !13}


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