; LLVM IR from Shah-Shishir/Codeforces-Solutions :: 911A. Nearest Minimums (main)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca [100001 x i32], align 16
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %"class.std::vector", align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 400004, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  br label %12

12:                                               ; preds = %107, %0
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %3)
  %14 = icmp ne i32 %13, -1
  br i1 %14, label %15, label %108

15:                                               ; preds = %12
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %16

16:                                               ; preds = %25, %15
  %17 = load i32, ptr %4, align 4, !tbaa !5
  %18 = load i32, ptr %3, align 4, !tbaa !5
  %19 = icmp slt i32 %17, %18
  br i1 %19, label %20, label %28

20:                                               ; preds = %16
  %21 = load i32, ptr %4, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [100001 x i32], ptr %2, i64 0, i64 %22
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %23)
  br label %25

25:                                               ; preds = %20
  %26 = load i32, ptr %4, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr %4, align 4, !tbaa !5
  br label %16, !llvm.loop !9

28:                                               ; preds = %16
  %29 = getelementptr inbounds [100001 x i32], ptr %2, i64 0, i64 0
  %30 = load i32, ptr %29, align 16, !tbaa !5
  store i32 %30, ptr %6, align 4, !tbaa !5
  store i32 0, ptr %5, align 4, !tbaa !5
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %49, %28
  %32 = load i32, ptr %4, align 4, !tbaa !5
  %33 = load i32, ptr %3, align 4, !tbaa !5
  %34 = icmp slt i32 %32, %33
  br i1 %34, label %35, label %52

35:                                               ; preds = %31
  %36 = load i32, ptr %6, align 4, !tbaa !5
  %37 = load i32, ptr %4, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [100001 x i32], ptr %2, i64 0, i64 %38
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = icmp sgt i32 %36, %40
  br i1 %41, label %42, label %48

42:                                               ; preds = %35
  %43 = load i32, ptr %4, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [100001 x i32], ptr %2, i64 0, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !5
  store i32 %46, ptr %6, align 4, !tbaa !5
  %47 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %47, ptr %5, align 4, !tbaa !5
  br label %48

48:                                               ; preds = %42, %35
  br label %49

49:                                               ; preds = %48
  %50 = load i32, ptr %4, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %4, align 4, !tbaa !5
  br label %31, !llvm.loop !11

52:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 24, ptr %9) #5
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #5
  invoke void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %9, ptr noundef nonnull align 4 dereferenceable(4) %5)
          to label %53 unwind label %69

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

56:                                               ; preds = %74, %53
  %57 = load i32, ptr %4, align 4, !tbaa !5
  %58 = load i32, ptr %3, align 4, !tbaa !5
  %59 = icmp slt i32 %57, %58
  br i1 %59, label %60, label %77

60:                                               ; preds = %56
  %61 = load i32, ptr %6, align 4, !tbaa !5
  %62 = load i32, ptr %4, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [100001 x i32], ptr %2, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = icmp eq i32 %61, %65
  br i1 %66, label %67, label %73

67:                                               ; preds = %60
  invoke void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %9, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %68 unwind label %69

68:                                               ; preds = %67
  br label %73

69:                                               ; preds = %104, %67, %52
  %70 = landingpad { ptr, i32 }
          cleanup
  %71 = extractvalue { ptr, i32 } %70, 0
  store ptr %71, ptr %10, align 8
  %72 = extractvalue { ptr, i32 } %70, 1
  store i32 %72, ptr %11, align 4
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #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 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 400004, ptr %2) #5
  br label %109

73:                                               ; preds = %68, %60
  br label %74

74:                                               ; preds = %73
  %75 = load i32, ptr %4, align 4, !tbaa !5
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %4, align 4, !tbaa !5
  br label %56, !llvm.loop !12

77:                                               ; preds = %56
  store i32 100000, ptr %6, align 4, !tbaa !5
  %78 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %9) #5
  %79 = trunc i64 %78 to i32
  store i32 %79, ptr %8, align 4, !tbaa !5
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %80

80:                                               ; preds = %101, %77
  %81 = load i32, ptr %4, align 4, !tbaa !5
  %82 = load i32, ptr %8, align 4, !tbaa !5
  %83 = icmp slt i32 %81, %82
  br i1 %83, label %84, label %104

84:                                               ; preds = %80
  %85 = load i32, ptr %4, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef %86) #5
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = load i32, ptr %4, align 4, !tbaa !5
  %90 = sub nsw i32 %89, 1
  %91 = sext i32 %90 to i64
  %92 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef %91) #5
  %93 = load i32, ptr %92, align 4, !tbaa !5
  %94 = sub nsw i32 %88, %93
  store i32 %94, ptr %7, align 4, !tbaa !5
  %95 = load i32, ptr %6, align 4, !tbaa !5
  %96 = load i32, ptr %7, align 4, !tbaa !5
  %97 = icmp sgt i32 %95, %96
  br i1 %97, label %98, label %100

98:                                               ; preds = %84
  %99 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %99, ptr %6, align 4, !tbaa !5
  br label %100

100:                                              ; preds = %98, %84
  br label %101

101:                                              ; preds = %100
  %102 = load i32, ptr %4, align 4, !tbaa !5
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %4, align 4, !tbaa !5
  br label %80, !llvm.loop !13

104:                                              ; preds = %80
  %105 = load i32, ptr %6, align 4, !tbaa !5
  %106 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %105)
          to label %107 unwind label %69

107:                                              ; preds = %104
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #5
  br label %12, !llvm.loop !14

108:                                              ; preds = %12
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #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 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 400004, ptr %2) #5
  ret i32 0

109:                                              ; preds = %69
  %110 = load ptr, ptr %10, align 8
  %111 = load i32, ptr %11, align 4
  %112 = insertvalue { ptr, i32 } poison, ptr %110, 0
  %113 = insertvalue { ptr, i32 } %112, i32 %111, 1
  resume { ptr, i32 } %113
}

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

declare i32 @__isoc99_scanf(ptr noundef, ...) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) #4 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #3 align 2

declare i32 @printf(ptr noundef, ...) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 align 2

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

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 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 = { 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}
!14 = distinct !{!14, !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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca [100001 x i32], align 16
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"class.std::vector", align 8
  call void @llvm.lifetime.start.p0(i64 400004, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %2)
  %.not37 = icmp eq i32 %6, -1
  br i1 %.not37, label %._crit_edge38, label %.preheader17

.preheader17:                                     ; preds = %0, %._crit_edge35
  store i32 0, ptr %3, align 4, !tbaa !5
  %7 = load i32, ptr %2, align 4, !tbaa !5
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %.preheader17
  %9 = load i32, ptr %1, align 16, !tbaa !5
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %._crit_edge23

.lr.ph:                                           ; preds = %.preheader17, %.lr.ph
  %storemerge18 = phi i32 [ %14, %.lr.ph ], [ 0, %.preheader17 ]
  %10 = sext i32 %storemerge18 to i64
  %11 = getelementptr inbounds [100001 x i32], ptr %1, i64 0, i64 %10
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %11)
  %13 = load i32, ptr %3, align 4, !tbaa !5
  %14 = add nsw i32 %13, 1
  store i32 %14, ptr %3, align 4, !tbaa !5
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = icmp slt i32 %14, %15
  br i1 %16, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph
  %17 = load i32, ptr %1, align 16, !tbaa !5
  store i32 0, ptr %4, align 4, !tbaa !5
  %18 = icmp sgt i32 %15, 1
  br i1 %18, label %.lr.ph22.preheader, label %._crit_edge23

.lr.ph22.preheader:                               ; preds = %._crit_edge
  %wide.trip.count = zext nneg i32 %15 to i64
  %19 = add nsw i64 %wide.trip.count, -1
  %20 = add nsw i64 %wide.trip.count, -2
  %xtraiter = and i64 %19, 3
  %21 = icmp ult i64 %20, 3
  br i1 %21, label %._crit_edge23.loopexit.unr-lcssa, label %.lr.ph22.preheader.new

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

.lr.ph22:                                         ; preds = %42, %.lr.ph22.preheader.new
  %indvars.iv = phi i64 [ 1, %.lr.ph22.preheader.new ], [ %indvars.iv.next.3, %42 ]
  %.020 = phi i32 [ %17, %.lr.ph22.preheader.new ], [ %.1.3, %42 ]
  %niter = phi i64 [ 0, %.lr.ph22.preheader.new ], [ %niter.next.3, %42 ]
  %22 = getelementptr inbounds [100001 x i32], ptr %1, i64 0, i64 %indvars.iv
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = icmp sgt i32 %.020, %23
  br i1 %24, label %25, label %.lr.ph22.1

25:                                               ; preds = %.lr.ph22
  %26 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %26, ptr %4, align 4, !tbaa !5
  br label %.lr.ph22.1

.lr.ph22.1:                                       ; preds = %.lr.ph22, %25
  %.1 = phi i32 [ %23, %25 ], [ %.020, %.lr.ph22 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %27 = getelementptr inbounds [100001 x i32], ptr %1, i64 0, i64 %indvars.iv.next
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = icmp sgt i32 %.1, %28
  br i1 %29, label %30, label %.lr.ph22.2

30:                                               ; preds = %.lr.ph22.1
  %31 = trunc nuw nsw i64 %indvars.iv.next to i32
  store i32 %31, ptr %4, align 4, !tbaa !5
  br label %.lr.ph22.2

.lr.ph22.2:                                       ; preds = %30, %.lr.ph22.1
  %.1.1 = phi i32 [ %28, %30 ], [ %.1, %.lr.ph22.1 ]
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %32 = getelementptr inbounds [100001 x i32], ptr %1, i64 0, i64 %indvars.iv.next.1
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = icmp sgt i32 %.1.1, %33
  br i1 %34, label %35, label %.lr.ph22.3

35:                                               ; preds = %.lr.ph22.2
  %36 = trunc nuw nsw i64 %indvars.iv.next.1 to i32
  store i32 %36, ptr %4, align 4, !tbaa !5
  br label %.lr.ph22.3

.lr.ph22.3:                                       ; preds = %35, %.lr.ph22.2
  %.1.2 = phi i32 [ %33, %35 ], [ %.1.1, %.lr.ph22.2 ]
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
  %37 = getelementptr inbounds [100001 x i32], ptr %1, i64 0, i64 %indvars.iv.next.2
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = icmp sgt i32 %.1.2, %38
  br i1 %39, label %40, label %42

40:                                               ; preds = %.lr.ph22.3
  %41 = trunc nuw nsw i64 %indvars.iv.next.2 to i32
  store i32 %41, ptr %4, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %40, %.lr.ph22.3
  %.1.3 = phi i32 [ %38, %40 ], [ %.1.2, %.lr.ph22.3 ]
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 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_edge23.loopexit.unr-lcssa, label %.lr.ph22, !llvm.loop !11

._crit_edge23.loopexit.unr-lcssa:                 ; preds = %42, %.lr.ph22.preheader
  %.1.lcssa.ph = phi i32 [ poison, %.lr.ph22.preheader ], [ %.1.3, %42 ]
  %indvars.iv.unr = phi i64 [ 1, %.lr.ph22.preheader ], [ %indvars.iv.next.3, %42 ]
  %.020.unr = phi i32 [ %17, %.lr.ph22.preheader ], [ %.1.3, %42 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge23, label %.lr.ph22.epil

.lr.ph22.epil:                                    ; preds = %._crit_edge23.loopexit.unr-lcssa, %48
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %48 ], [ %indvars.iv.unr, %._crit_edge23.loopexit.unr-lcssa ]
  %.020.epil = phi i32 [ %.1.epil, %48 ], [ %.020.unr, %._crit_edge23.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %48 ], [ 0, %._crit_edge23.loopexit.unr-lcssa ]
  %43 = getelementptr inbounds [100001 x i32], ptr %1, i64 0, i64 %indvars.iv.epil
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = icmp sgt i32 %.020.epil, %44
  br i1 %45, label %46, label %48

46:                                               ; preds = %.lr.ph22.epil
  %47 = trunc nuw nsw i64 %indvars.iv.epil to i32
  store i32 %47, ptr %4, align 4, !tbaa !5
  br label %48

48:                                               ; preds = %46, %.lr.ph22.epil
  %.1.epil = phi i32 [ %44, %46 ], [ %.020.epil, %.lr.ph22.epil ]
  %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.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_edge23, label %.lr.ph22.epil, !llvm.loop !12

._crit_edge23:                                    ; preds = %._crit_edge23.loopexit.unr-lcssa, %48, %._crit_edge.thread, %._crit_edge
  %storemerge14.lcssa = phi i32 [ 1, %._crit_edge ], [ 1, %._crit_edge.thread ], [ %15, %48 ], [ %15, %._crit_edge23.loopexit.unr-lcssa ]
  %.0.lcssa = phi i32 [ %17, %._crit_edge ], [ %9, %._crit_edge.thread ], [ %.1.lcssa.ph, %._crit_edge23.loopexit.unr-lcssa ], [ %.1.epil, %48 ]
  store i32 %storemerge14.lcssa, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #6
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #6
  invoke void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %.preheader unwind label %.loopexit.split-lp

.preheader:                                       ; preds = %._crit_edge23
  %storemerge15.in26 = load i32, ptr %4, align 4, !tbaa !5
  %storemerge1527 = add nsw i32 %storemerge15.in26, 1
  store i32 %storemerge1527, ptr %3, align 4, !tbaa !5
  %49 = load i32, ptr %2, align 4, !tbaa !5
  %50 = icmp slt i32 %storemerge1527, %49
  br i1 %50, label %.lr.ph29, label %._crit_edge30

.lr.ph29:                                         ; preds = %.preheader, %58
  %51 = phi i32 [ %59, %58 ], [ %49, %.preheader ]
  %storemerge1528 = phi i32 [ %storemerge15, %58 ], [ %storemerge1527, %.preheader ]
  %52 = sext i32 %storemerge1528 to i64
  %53 = getelementptr inbounds [100001 x i32], ptr %1, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = icmp eq i32 %.0.lcssa, %54
  br i1 %55, label %56, label %58

56:                                               ; preds = %.lr.ph29
  invoke void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 4 dereferenceable(4) %3)
          to label %._crit_edge42 unwind label %.loopexit

._crit_edge42:                                    ; preds = %56
  %storemerge15.in.pre = load i32, ptr %3, align 4, !tbaa !5
  %.pre = load i32, ptr %2, align 4, !tbaa !5
  br label %58

.loopexit:                                        ; preds = %56
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %57

.loopexit.split-lp:                               ; preds = %._crit_edge23
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %57

57:                                               ; preds = %.loopexit.split-lp, %.loopexit
  %lpad.phi = phi { ptr, i32 } [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 400004, ptr nonnull %1) #6
  resume { ptr, i32 } %lpad.phi

58:                                               ; preds = %._crit_edge42, %.lr.ph29
  %59 = phi i32 [ %.pre, %._crit_edge42 ], [ %51, %.lr.ph29 ]
  %storemerge15.in = phi i32 [ %storemerge15.in.pre, %._crit_edge42 ], [ %storemerge1528, %.lr.ph29 ]
  %storemerge15 = add nsw i32 %storemerge15.in, 1
  store i32 %storemerge15, ptr %3, align 4, !tbaa !5
  %60 = icmp slt i32 %storemerge15, %59
  br i1 %60, label %.lr.ph29, label %._crit_edge30, !llvm.loop !14

._crit_edge30:                                    ; preds = %58, %.preheader
  %61 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #6
  %62 = trunc i64 %61 to i32
  store i32 1, ptr %3, align 4, !tbaa !5
  %63 = icmp sgt i32 %62, 1
  br i1 %63, label %.lr.ph34, label %._crit_edge35

.lr.ph34:                                         ; preds = %._crit_edge30, %.lr.ph34
  %.232 = phi i32 [ %spec.select, %.lr.ph34 ], [ 100000, %._crit_edge30 ]
  %storemerge1631 = phi i32 [ %74, %.lr.ph34 ], [ 1, %._crit_edge30 ]
  %64 = sext i32 %storemerge1631 to i64
  %65 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %64) #6
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = load i32, ptr %3, align 4, !tbaa !5
  %68 = add nsw i32 %67, -1
  %69 = sext i32 %68 to i64
  %70 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %69) #6
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = sub nsw i32 %66, %71
  %spec.select = call i32 @llvm.smin.i32(i32 %.232, i32 %72)
  %73 = load i32, ptr %3, align 4, !tbaa !5
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %3, align 4, !tbaa !5
  %75 = icmp slt i32 %74, %62
  br i1 %75, label %.lr.ph34, label %._crit_edge35, !llvm.loop !15

._crit_edge35:                                    ; preds = %.lr.ph34, %._crit_edge30
  %.2.lcssa = phi i32 [ 100000, %._crit_edge30 ], [ %spec.select, %.lr.ph34 ]
  %76 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.2.lcssa)
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #6
  %77 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %2)
  %.not = icmp eq i32 %77, -1
  br i1 %.not, label %._crit_edge38, label %.preheader17, !llvm.loop !16

._crit_edge38:                                    ; preds = %._crit_edge35, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 400004, ptr nonnull %1) #6
  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

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 align 2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #3 align 2

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 align 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, 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 = { nofree nounwind "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 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 = { 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, !13}
!13 = !{!"llvm.loop.unroll.disable"}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}


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