; LLVM IR from VastoLorde95/Competitive-Programming :: CodeChef/WF/Easy Medium/AMR14E/A.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::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 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@nums = external dso_local global %"class.std::vector", align 8
@pr = external dso_local global %"class.std::vector", align 8
@pp = external dso_local global [200100 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@_ZL1N = external hidden constant i32, align 4
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = alloca i32, align 4
  %9 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %10 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %11 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %12 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %1, ptr noundef %2)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  %21 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @nums) #6
  %22 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %5, i32 0, i32 0
  store ptr %21, ptr %22, align 8
  %23 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @nums) #6
  %24 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %6, i32 0, i32 0
  store ptr %23, ptr %24, align 8
  %25 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %5, i32 0, i32 0
  %26 = load ptr, ptr %25, align 8
  %27 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %6, i32 0, i32 0
  %28 = load ptr, ptr %27, align 8
  %29 = call ptr @_ZSt11upper_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_(ptr %26, ptr %28, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %30 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %4, i32 0, i32 0
  store ptr %29, ptr %30, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %31 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @nums) #6
  %32 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %7, i32 0, i32 0
  store ptr %31, ptr %32, align 8
  %33 = call noundef i64 @_ZN9__gnu_cxxmiIPiSt6vectorIiSaIiEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS8_SB_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  %34 = trunc i64 %33 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  store i32 %34, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %35 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @nums) #6
  %36 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %10, i32 0, i32 0
  store ptr %35, ptr %36, align 8
  %37 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @nums) #6
  %38 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %11, i32 0, i32 0
  store ptr %37, ptr %38, align 8
  %39 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %10, i32 0, i32 0
  %40 = load ptr, ptr %39, align 8
  %41 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %11, i32 0, i32 0
  %42 = load ptr, ptr %41, align 8
  %43 = call ptr @_ZSt11lower_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_(ptr %40, ptr %42, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %44 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  store ptr %43, ptr %44, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %45 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @nums) #6
  %46 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %12, i32 0, i32 0
  store ptr %45, ptr %46, align 8
  %47 = call noundef i64 @_ZN9__gnu_cxxmiIPiSt6vectorIiSaIiEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS8_SB_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %12) #6
  %48 = trunc i64 %47 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  store i32 %48, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %49 = load i32, ptr %3, align 4, !tbaa !5
  %50 = load i32, ptr %8, align 4, !tbaa !5
  %51 = sub nsw i32 %49, %50
  store i32 %51, ptr %13, align 4, !tbaa !5
  %52 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) @_ZL1N)
  %53 = load i32, ptr %52, align 4, !tbaa !5
  store i32 %53, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %54 = load i32, ptr %1, align 4, !tbaa !5
  store i32 %54, ptr %14, align 4, !tbaa !5
  br label %55

55:                                               ; preds = %66, %0
  %56 = load i32, ptr %14, align 4, !tbaa !5
  %57 = load i32, ptr %2, align 4, !tbaa !5
  %58 = icmp sle i32 %56, %57
  br i1 %58, label %60, label %59

59:                                               ; preds = %55
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %69

60:                                               ; preds = %55
  %61 = load i32, ptr %14, align 4, !tbaa !5
  %62 = load i32, ptr %1, align 4, !tbaa !5
  %63 = sub nsw i32 %61, %62
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [200100 x i32], ptr @pp, i64 0, i64 %64
  store i32 1, ptr %65, align 4, !tbaa !5
  br label %66

66:                                               ; preds = %60
  %67 = load i32, ptr %14, align 4, !tbaa !5
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %14, align 4, !tbaa !5
  br label %55, !llvm.loop !9

69:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %70

70:                                               ; preds = %105, %69
  %71 = load i32, ptr %15, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @pr) #6
  %74 = icmp ult i64 %72, %73
  br i1 %74, label %76, label %75

75:                                               ; preds = %70
  store i32 5, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %108

76:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  %77 = load i32, ptr %15, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @pr, i64 noundef %78) #6
  %80 = load i32, ptr %79, align 4, !tbaa !5
  store i32 %80, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %81 = load i32, ptr %1, align 4, !tbaa !5
  %82 = load i32, ptr %17, align 4, !tbaa !5
  %83 = add nsw i32 %81, %82
  %84 = sub nsw i32 %83, 1
  %85 = load i32, ptr %17, align 4, !tbaa !5
  %86 = sdiv i32 %84, %85
  %87 = load i32, ptr %17, align 4, !tbaa !5
  %88 = mul nsw i32 %86, %87
  store i32 %88, ptr %18, align 4, !tbaa !5
  br label %89

89:                                               ; preds = %100, %76
  %90 = load i32, ptr %18, align 4, !tbaa !5
  %91 = load i32, ptr %2, align 4, !tbaa !5
  %92 = icmp sle i32 %90, %91
  br i1 %92, label %94, label %93

93:                                               ; preds = %89
  store i32 8, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %104

94:                                               ; preds = %89
  %95 = load i32, ptr %18, align 4, !tbaa !5
  %96 = load i32, ptr %1, align 4, !tbaa !5
  %97 = sub nsw i32 %95, %96
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [200100 x i32], ptr @pp, i64 0, i64 %98
  store i32 0, ptr %99, align 4, !tbaa !5
  br label %100

100:                                              ; preds = %94
  %101 = load i32, ptr %17, align 4, !tbaa !5
  %102 = load i32, ptr %18, align 4, !tbaa !5
  %103 = add nsw i32 %102, %101
  store i32 %103, ptr %18, align 4, !tbaa !5
  br label %89, !llvm.loop !11

104:                                              ; preds = %93
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %105

105:                                              ; preds = %104
  %106 = load i32, ptr %15, align 4, !tbaa !5
  %107 = add nsw i32 %106, 1
  store i32 %107, ptr %15, align 4, !tbaa !5
  br label %70, !llvm.loop !12

108:                                              ; preds = %75
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  %109 = load i32, ptr %1, align 4, !tbaa !5
  store i32 %109, ptr %19, align 4, !tbaa !5
  br label %110

110:                                              ; preds = %127, %108
  %111 = load i32, ptr %19, align 4, !tbaa !5
  %112 = load i32, ptr %2, align 4, !tbaa !5
  %113 = icmp sle i32 %111, %112
  br i1 %113, label %115, label %114

114:                                              ; preds = %110
  store i32 11, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %130

115:                                              ; preds = %110
  %116 = load i32, ptr %19, align 4, !tbaa !5
  %117 = load i32, ptr %1, align 4, !tbaa !5
  %118 = sub nsw i32 %116, %117
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [200100 x i32], ptr @pp, i64 0, i64 %119
  %121 = load i32, ptr %120, align 4, !tbaa !5
  %122 = icmp ne i32 %121, 0
  br i1 %122, label %123, label %126

123:                                              ; preds = %115
  %124 = load i32, ptr %13, align 4, !tbaa !5
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr %13, align 4, !tbaa !5
  br label %126

126:                                              ; preds = %123, %115
  br label %127

127:                                              ; preds = %126
  %128 = load i32, ptr %19, align 4, !tbaa !5
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %19, align 4, !tbaa !5
  br label %110, !llvm.loop !13

130:                                              ; preds = %114
  %131 = load i32, ptr %13, align 4, !tbaa !5
  %132 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %131)
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #6
  ret void
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN9__gnu_cxxmiIPiSt6vectorIiSaIiEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS8_SB_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local ptr @_ZSt11upper_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_(ptr, ptr, ptr noundef nonnull align 4 dereferenceable(4)) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local ptr @_ZSt11lower_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_(ptr, ptr, ptr noundef nonnull align 4 dereferenceable(4)) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 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) #1 align 2

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #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::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 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@nums = external dso_local global %"class.std::vector", align 8
@pr = external dso_local global %"class.std::vector", align 8
@pp = external dso_local local_unnamed_addr global [200100 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@_ZL1N = external hidden constant i32, align 4
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  %7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  %8 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @nums) #7
  %9 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @nums) #7
  %10 = call ptr @_ZSt11upper_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_(ptr %8, ptr %9, ptr noundef nonnull align 4 dereferenceable(4) %2)
  store ptr %10, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %11 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @nums) #7
  store ptr %11, ptr %4, align 8
  %12 = call noundef i64 @_ZN9__gnu_cxxmiIPiSt6vectorIiSaIiEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS8_SB_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  %13 = trunc i64 %12 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %14 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @nums) #7
  %15 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @nums) #7
  %16 = call ptr @_ZSt11lower_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_(ptr %14, ptr %15, ptr noundef nonnull align 4 dereferenceable(4) %1)
  store ptr %16, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  %17 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @nums) #7
  store ptr %17, ptr %6, align 8
  %18 = call noundef i64 @_ZN9__gnu_cxxmiIPiSt6vectorIiSaIiEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS8_SB_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  %19 = trunc i64 %18 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  %20 = sub nsw i32 %13, %19
  %21 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) @_ZL1N)
  %22 = load i32, ptr %21, align 4, !tbaa !5
  store i32 %22, ptr %1, align 4, !tbaa !5
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %.not32 = icmp sgt i32 %22, %23
  br i1 %.not32, label %.preheader, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %0
  %24 = sext i32 %22 to i64
  %25 = add i32 %23, 1
  %26 = sub i32 %23, %22
  %27 = zext i32 %26 to i64
  %28 = add nuw nsw i64 %27, 1
  %min.iters.check = icmp ult i32 %26, 7
  br i1 %min.iters.check, label %.lr.ph.preheader89, label %vector.ph

.lr.ph.preheader89:                               ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ %24, %.lr.ph.preheader ], [ %ind.end, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %28, 8589934584
  %ind.end = add nsw i64 %n.vec, %24
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %29 = getelementptr inbounds [200100 x i32], ptr @pp, i64 0, i64 %index
  %30 = getelementptr inbounds i8, ptr %29, i64 16
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %29, align 16, !tbaa !5
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %30, align 16, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %31 = icmp eq i64 %index.next, %n.vec
  br i1 %31, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %28, %n.vec
  br i1 %cmp.n, label %.preheader, label %.lr.ph.preheader89

.preheader:                                       ; preds = %.lr.ph, %middle.block, %0
  %32 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @pr) #7
  %.not = icmp eq i64 %32, 0
  br i1 %.not, label %._crit_edge39, label %.lr.ph38

.lr.ph:                                           ; preds = %.lr.ph.preheader89, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader89 ]
  %33 = sub nsw i64 %indvars.iv, %24
  %34 = getelementptr inbounds [200100 x i32], ptr @pp, i64 0, i64 %33
  store i32 1, ptr %34, align 4, !tbaa !5
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
  %exitcond.not = icmp eq i32 %25, %lftr.wideiv
  br i1 %exitcond.not, label %.preheader, label %.lr.ph, !llvm.loop !13

._crit_edge39:                                    ; preds = %._crit_edge, %.preheader
  %35 = load i32, ptr %1, align 4, !tbaa !5
  %36 = load i32, ptr %2, align 4, !tbaa !5
  %.not2840 = icmp sgt i32 %35, %36
  br i1 %.not2840, label %._crit_edge45, label %.lr.ph44.preheader

.lr.ph44.preheader:                               ; preds = %._crit_edge39
  %37 = sext i32 %35 to i64
  %38 = add i32 %36, 1
  %39 = sub i32 %36, %35
  %40 = zext i32 %39 to i64
  %41 = add nuw nsw i64 %40, 1
  %min.iters.check73 = icmp ult i32 %39, 7
  br i1 %min.iters.check73, label %.lr.ph44.preheader86, label %vector.ph74

.lr.ph44.preheader86:                             ; preds = %middle.block71, %.lr.ph44.preheader
  %indvars.iv53.ph = phi i64 [ %37, %.lr.ph44.preheader ], [ %ind.end77, %middle.block71 ]
  %.02441.ph = phi i32 [ %20, %.lr.ph44.preheader ], [ %52, %middle.block71 ]
  br label %.lr.ph44

vector.ph74:                                      ; preds = %.lr.ph44.preheader
  %n.vec76 = and i64 %41, 8589934584
  %ind.end77 = add nsw i64 %n.vec76, %37
  %42 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %20, i64 0
  br label %vector.body79

vector.body79:                                    ; preds = %vector.body79, %vector.ph74
  %index80 = phi i64 [ 0, %vector.ph74 ], [ %index.next84, %vector.body79 ]
  %vec.phi = phi <4 x i32> [ %42, %vector.ph74 ], [ %49, %vector.body79 ]
  %vec.phi81 = phi <4 x i32> [ zeroinitializer, %vector.ph74 ], [ %50, %vector.body79 ]
  %43 = getelementptr inbounds [200100 x i32], ptr @pp, i64 0, i64 %index80
  %44 = getelementptr inbounds i8, ptr %43, i64 16
  %wide.load = load <4 x i32>, ptr %43, align 16, !tbaa !5
  %wide.load83 = load <4 x i32>, ptr %44, align 16, !tbaa !5
  %45 = icmp ne <4 x i32> %wide.load, zeroinitializer
  %46 = icmp ne <4 x i32> %wide.load83, zeroinitializer
  %47 = zext <4 x i1> %45 to <4 x i32>
  %48 = zext <4 x i1> %46 to <4 x i32>
  %49 = add <4 x i32> %vec.phi, %47
  %50 = add <4 x i32> %vec.phi81, %48
  %index.next84 = add nuw i64 %index80, 8
  %51 = icmp eq i64 %index.next84, %n.vec76
  br i1 %51, label %middle.block71, label %vector.body79, !llvm.loop !14

middle.block71:                                   ; preds = %vector.body79
  %bin.rdx = add <4 x i32> %50, %49
  %52 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n85 = icmp eq i64 %41, %n.vec76
  br i1 %cmp.n85, label %._crit_edge45, label %.lr.ph44.preheader86

.lr.ph38:                                         ; preds = %.preheader, %._crit_edge
  %indvars.iv50 = phi i64 [ %indvars.iv.next51, %._crit_edge ], [ 0, %.preheader ]
  %53 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @pr, i64 noundef %indvars.iv50) #7
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = load i32, ptr %1, align 4, !tbaa !5
  %56 = add nsw i32 %55, %54
  %.fr30 = freeze i32 %56
  %57 = add i32 %.fr30, -1
  %58 = srem i32 %57, %54
  %59 = sub nsw i32 %57, %58
  %60 = load i32, ptr %2, align 4, !tbaa !5
  %.not3134 = icmp sgt i32 %59, %60
  br i1 %.not3134, label %._crit_edge, label %.lr.ph36.preheader

.lr.ph36.preheader:                               ; preds = %.lr.ph38
  %61 = sext i32 %59 to i64
  %62 = sext i32 %54 to i64
  %63 = sext i32 %55 to i64
  %64 = sext i32 %60 to i64
  %65 = sext i32 %57 to i64
  %66 = add nsw i64 %62, %65
  %67 = sext i32 %58 to i64
  %68 = sub nsw i64 %66, %67
  %69 = add nsw i64 %64, 1
  %smax = call i64 @llvm.smax.i64(i64 %68, i64 %69)
  %70 = add i64 %smax, %67
  %71 = add nsw i64 %62, %65
  %72 = icmp ne i64 %70, %71
  %umin.neg = sext i1 %72 to i64
  %73 = select i1 %72, i64 2, i64 1
  %74 = add i64 %70, %umin.neg
  %75 = add nsw i64 %62, %65
  %76 = sub i64 %74, %75
  %umax = call i64 @llvm.umax.i64(i64 %62, i64 1)
  %77 = udiv i64 %76, %umax
  %78 = add i64 %73, %77
  %min.iters.check60 = icmp ugt i64 %78, 7
  %ident.check.not = icmp eq i32 %54, 1
  %or.cond = and i1 %min.iters.check60, %ident.check.not
  br i1 %or.cond, label %vector.ph61, label %.lr.ph36.preheader88

.lr.ph36.preheader88:                             ; preds = %middle.block58, %.lr.ph36.preheader
  %indvars.iv47.ph = phi i64 [ %61, %.lr.ph36.preheader ], [ %ind.end64, %middle.block58 ]
  br label %.lr.ph36

vector.ph61:                                      ; preds = %.lr.ph36.preheader
  %n.vec63 = and i64 %78, -8
  %79 = mul nuw i64 %n.vec63, %62
  %ind.end64 = add i64 %79, %61
  br label %vector.body66

vector.body66:                                    ; preds = %vector.body66, %vector.ph61
  %index67 = phi i64 [ 0, %vector.ph61 ], [ %index.next69, %vector.body66 ]
  %80 = mul nuw i64 %index67, %62
  %offset.idx68 = add i64 %80, %61
  %81 = sub nsw i64 %offset.idx68, %63
  %82 = getelementptr inbounds [200100 x i32], ptr @pp, i64 0, i64 %81
  %83 = getelementptr inbounds i8, ptr %82, i64 16
  store <4 x i32> zeroinitializer, ptr %82, align 4, !tbaa !5
  store <4 x i32> zeroinitializer, ptr %83, align 4, !tbaa !5
  %index.next69 = add nuw i64 %index67, 8
  %84 = icmp eq i64 %index.next69, %n.vec63
  br i1 %84, label %middle.block58, label %vector.body66, !llvm.loop !15

middle.block58:                                   ; preds = %vector.body66
  %cmp.n70 = icmp eq i64 %78, %n.vec63
  br i1 %cmp.n70, label %._crit_edge, label %.lr.ph36.preheader88

._crit_edge:                                      ; preds = %.lr.ph36, %middle.block58, %.lr.ph38
  %indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
  %85 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @pr) #7
  %86 = icmp ugt i64 %85, %indvars.iv.next51
  br i1 %86, label %.lr.ph38, label %._crit_edge39, !llvm.loop !16

.lr.ph36:                                         ; preds = %.lr.ph36.preheader88, %.lr.ph36
  %indvars.iv47 = phi i64 [ %indvars.iv.next48, %.lr.ph36 ], [ %indvars.iv47.ph, %.lr.ph36.preheader88 ]
  %87 = sub nsw i64 %indvars.iv47, %63
  %88 = getelementptr inbounds [200100 x i32], ptr @pp, i64 0, i64 %87
  store i32 0, ptr %88, align 4, !tbaa !5
  %indvars.iv.next48 = add nsw i64 %indvars.iv47, %62
  %.not31 = icmp sgt i64 %indvars.iv.next48, %64
  br i1 %.not31, label %._crit_edge, label %.lr.ph36, !llvm.loop !17

._crit_edge45:                                    ; preds = %.lr.ph44, %middle.block71, %._crit_edge39
  %.024.lcssa = phi i32 [ %20, %._crit_edge39 ], [ %52, %middle.block71 ], [ %spec.select, %.lr.ph44 ]
  %89 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.024.lcssa)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret void

.lr.ph44:                                         ; preds = %.lr.ph44.preheader86, %.lr.ph44
  %indvars.iv53 = phi i64 [ %indvars.iv.next54, %.lr.ph44 ], [ %indvars.iv53.ph, %.lr.ph44.preheader86 ]
  %.02441 = phi i32 [ %spec.select, %.lr.ph44 ], [ %.02441.ph, %.lr.ph44.preheader86 ]
  %90 = sub nsw i64 %indvars.iv53, %37
  %91 = getelementptr inbounds [200100 x i32], ptr @pp, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %.not29 = icmp ne i32 %92, 0
  %93 = zext i1 %.not29 to i32
  %spec.select = add nsw i32 %.02441, %93
  %indvars.iv.next54 = add nsw i64 %indvars.iv53, 1
  %lftr.wideiv56 = trunc i64 %indvars.iv.next54 to i32
  %exitcond57.not = icmp eq i32 %38, %lftr.wideiv56
  br i1 %exitcond57.not, label %._crit_edge45, label %.lr.ph44, !llvm.loop !18
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN9__gnu_cxxmiIPiSt6vectorIiSaIiEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS8_SB_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local ptr @_ZSt11upper_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_(ptr, ptr, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local ptr @_ZSt11lower_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_(ptr, ptr, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 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 #1 align 2

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #6

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { 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 #4 = { 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 #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, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10, !11, !12}
!15 = distinct !{!15, !10, !11, !12}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !11}
!18 = distinct !{!18, !10, !12, !11}


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