; LLVM IR from Leet-Us-Code/DSA-A-Z-Practice :: Sid's Levels/Level - 3/Arrays/Minimum Difference.ll (Z13minDifferenceSt6vectorIiSaIiEES1_)

; 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"

%"struct.std::pair" = type { i32, i32 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%"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 }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z11justSmallerSt6vectorIiSaIiEEi(ptr noundef, i32 noundef) #0

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z11justGreaterSt6vectorIiSaIiEEi(ptr noundef, i32 noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local i64 @_Z13minDifferenceSt6vectorIiSaIiEES1_(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca %"struct.std::pair", align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca %"class.std::vector", align 8
  %16 = alloca i32, align 4
  %17 = alloca %"class.std::vector", align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %18 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  %19 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %6, i32 0, i32 0
  store ptr %18, ptr %19, align 8
  %20 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  %21 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %7, i32 0, i32 0
  store ptr %20, ptr %21, align 8
  %22 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %6, i32 0, i32 0
  %23 = load ptr, ptr %22, align 8
  %24 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %7, i32 0, i32 0
  %25 = load ptr, ptr %24, align 8
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_(ptr %23, ptr %25)
  %26 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #4
  %27 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %8, i32 0, i32 0
  store ptr %26, ptr %27, align 8
  %28 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #4
  %29 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  store ptr %28, ptr %29, align 8
  %30 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %8, i32 0, i32 0
  %31 = load ptr, ptr %30, align 8
  %32 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  %33 = load ptr, ptr %32, align 8
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_(ptr %31, ptr %33)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 2147483647, ptr %10, align 4, !tbaa !9
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 4 dereferenceable(8) %3)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %34

34:                                               ; preds = %162, %2
  %35 = load i32, ptr %11, align 4, !tbaa !9
  %36 = sext i32 %35 to i64
  %37 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  %38 = icmp ult i64 %36, %37
  br i1 %38, label %40, label %39

39:                                               ; preds = %34
  store i32 2, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %165

40:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %41 = load i32, ptr %11, align 4, !tbaa !9
  %42 = sext i32 %41 to i64
  %43 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %42) #4
  %44 = load i32, ptr %43, align 4, !tbaa !9
  store i32 %44, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  call void @_ZNSt6vectorIiSaIiEEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %15, ptr noundef nonnull align 8 dereferenceable(24) %1)
  %45 = load i32, ptr %13, align 4, !tbaa !9
  %46 = call noundef i32 @_Z11justSmallerSt6vectorIiSaIiEEi(ptr noundef %15, i32 noundef %45)
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %15) #4
  store i32 %46, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  call void @_ZNSt6vectorIiSaIiEEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull align 8 dereferenceable(24) %1)
  %47 = load i32, ptr %13, align 4, !tbaa !9
  %48 = call noundef i32 @_Z11justGreaterSt6vectorIiSaIiEEi(ptr noundef %17, i32 noundef %47)
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %17) #4
  store i32 %48, ptr %16, align 4, !tbaa !9
  %49 = load i32, ptr %14, align 4, !tbaa !9
  %50 = icmp eq i32 %49, -1
  br i1 %50, label %51, label %55

51:                                               ; preds = %40
  %52 = load i32, ptr %16, align 4, !tbaa !9
  %53 = icmp eq i32 %52, -1
  br i1 %53, label %54, label %55

54:                                               ; preds = %51
  store i32 4, ptr %12, align 4
  br label %159

55:                                               ; preds = %51, %40
  %56 = load i32, ptr %14, align 4, !tbaa !9
  %57 = icmp eq i32 %56, -1
  br i1 %57, label %58, label %82

58:                                               ; preds = %55
  %59 = load i32, ptr %10, align 4, !tbaa !9
  %60 = load i32, ptr %16, align 4, !tbaa !9
  %61 = sext i32 %60 to i64
  %62 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %61) #4
  %63 = load i32, ptr %62, align 4, !tbaa !9
  %64 = load i32, ptr %13, align 4, !tbaa !9
  %65 = sub nsw i32 %63, %64
  %66 = icmp sgt i32 %59, %65
  br i1 %66, label %67, label %81

67:                                               ; preds = %58
  %68 = load i32, ptr %13, align 4, !tbaa !9
  %69 = getelementptr inbounds %"struct.std::pair", ptr %3, i32 0, i32 0
  store i32 %68, ptr %69, align 4, !tbaa !11
  %70 = load i32, ptr %16, align 4, !tbaa !9
  %71 = sext i32 %70 to i64
  %72 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %71) #4
  %73 = load i32, ptr %72, align 4, !tbaa !9
  %74 = getelementptr inbounds %"struct.std::pair", ptr %3, i32 0, i32 1
  store i32 %73, ptr %74, align 4, !tbaa !13
  %75 = load i32, ptr %16, align 4, !tbaa !9
  %76 = sext i32 %75 to i64
  %77 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %76) #4
  %78 = load i32, ptr %77, align 4, !tbaa !9
  %79 = load i32, ptr %13, align 4, !tbaa !9
  %80 = sub nsw i32 %78, %79
  store i32 %80, ptr %10, align 4, !tbaa !9
  br label %81

81:                                               ; preds = %67, %58
  br label %157

82:                                               ; preds = %55
  %83 = load i32, ptr %16, align 4, !tbaa !9
  %84 = icmp eq i32 %83, -1
  br i1 %84, label %85, label %109

85:                                               ; preds = %82
  %86 = load i32, ptr %10, align 4, !tbaa !9
  %87 = load i32, ptr %13, align 4, !tbaa !9
  %88 = load i32, ptr %14, align 4, !tbaa !9
  %89 = sext i32 %88 to i64
  %90 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %89) #4
  %91 = load i32, ptr %90, align 4, !tbaa !9
  %92 = sub nsw i32 %87, %91
  %93 = icmp sgt i32 %86, %92
  br i1 %93, label %94, label %108

94:                                               ; preds = %85
  %95 = load i32, ptr %14, align 4, !tbaa !9
  %96 = sext i32 %95 to i64
  %97 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %96) #4
  %98 = load i32, ptr %97, align 4, !tbaa !9
  %99 = getelementptr inbounds %"struct.std::pair", ptr %3, i32 0, i32 0
  store i32 %98, ptr %99, align 4, !tbaa !11
  %100 = load i32, ptr %13, align 4, !tbaa !9
  %101 = getelementptr inbounds %"struct.std::pair", ptr %3, i32 0, i32 1
  store i32 %100, ptr %101, align 4, !tbaa !13
  %102 = load i32, ptr %13, align 4, !tbaa !9
  %103 = load i32, ptr %14, align 4, !tbaa !9
  %104 = sext i32 %103 to i64
  %105 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %104) #4
  %106 = load i32, ptr %105, align 4, !tbaa !9
  %107 = sub nsw i32 %102, %106
  store i32 %107, ptr %10, align 4, !tbaa !9
  br label %108

108:                                              ; preds = %94, %85
  br label %156

109:                                              ; preds = %82
  %110 = load i32, ptr %10, align 4, !tbaa !9
  %111 = load i32, ptr %16, align 4, !tbaa !9
  %112 = sext i32 %111 to i64
  %113 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %112) #4
  %114 = load i32, ptr %113, align 4, !tbaa !9
  %115 = load i32, ptr %13, align 4, !tbaa !9
  %116 = sub nsw i32 %114, %115
  %117 = icmp sgt i32 %110, %116
  br i1 %117, label %118, label %132

118:                                              ; preds = %109
  %119 = load i32, ptr %13, align 4, !tbaa !9
  %120 = getelementptr inbounds %"struct.std::pair", ptr %3, i32 0, i32 0
  store i32 %119, ptr %120, align 4, !tbaa !11
  %121 = load i32, ptr %16, align 4, !tbaa !9
  %122 = sext i32 %121 to i64
  %123 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %122) #4
  %124 = load i32, ptr %123, align 4, !tbaa !9
  %125 = getelementptr inbounds %"struct.std::pair", ptr %3, i32 0, i32 1
  store i32 %124, ptr %125, align 4, !tbaa !13
  %126 = load i32, ptr %16, align 4, !tbaa !9
  %127 = sext i32 %126 to i64
  %128 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %127) #4
  %129 = load i32, ptr %128, align 4, !tbaa !9
  %130 = load i32, ptr %13, align 4, !tbaa !9
  %131 = sub nsw i32 %129, %130
  store i32 %131, ptr %10, align 4, !tbaa !9
  br label %132

132:                                              ; preds = %118, %109
  %133 = load i32, ptr %10, align 4, !tbaa !9
  %134 = load i32, ptr %13, align 4, !tbaa !9
  %135 = load i32, ptr %14, align 4, !tbaa !9
  %136 = sext i32 %135 to i64
  %137 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %136) #4
  %138 = load i32, ptr %137, align 4, !tbaa !9
  %139 = sub nsw i32 %134, %138
  %140 = icmp sgt i32 %133, %139
  br i1 %140, label %141, label %155

141:                                              ; preds = %132
  %142 = load i32, ptr %14, align 4, !tbaa !9
  %143 = sext i32 %142 to i64
  %144 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %143) #4
  %145 = load i32, ptr %144, align 4, !tbaa !9
  %146 = getelementptr inbounds %"struct.std::pair", ptr %3, i32 0, i32 0
  store i32 %145, ptr %146, align 4, !tbaa !11
  %147 = load i32, ptr %13, align 4, !tbaa !9
  %148 = getelementptr inbounds %"struct.std::pair", ptr %3, i32 0, i32 1
  store i32 %147, ptr %148, align 4, !tbaa !13
  %149 = load i32, ptr %13, align 4, !tbaa !9
  %150 = load i32, ptr %14, align 4, !tbaa !9
  %151 = sext i32 %150 to i64
  %152 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %151) #4
  %153 = load i32, ptr %152, align 4, !tbaa !9
  %154 = sub nsw i32 %149, %153
  store i32 %154, ptr %10, align 4, !tbaa !9
  br label %155

155:                                              ; preds = %141, %132
  br label %156

156:                                              ; preds = %155, %108
  br label %157

157:                                              ; preds = %156, %81
  br label %158

158:                                              ; preds = %157
  store i32 0, ptr %12, align 4
  br label %159

159:                                              ; preds = %158, %54
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  %160 = load i32, ptr %12, align 4
  switch i32 %160, label %167 [
    i32 0, label %161
    i32 4, label %162
  ]

161:                                              ; preds = %159
  br label %162

162:                                              ; preds = %161, %159
  %163 = load i32, ptr %11, align 4, !tbaa !9
  %164 = add nsw i32 %163, 1
  store i32 %164, ptr %11, align 4, !tbaa !9
  br label %34, !llvm.loop !14

165:                                              ; preds = %39
  store i32 1, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  %166 = load i64, ptr %3, align 4
  ret i64 %166

167:                                              ; preds = %159
  unreachable
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_(ptr, ptr) #3

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 4 dereferenceable(8)) unnamed_addr #0 align 2

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

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

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


; 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"

%"struct.std::pair" = type { i32, i32 }
%"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 }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z11justSmallerSt6vectorIiSaIiEEi(ptr noundef, i32 noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z11justGreaterSt6vectorIiSaIiEEi(ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local i64 @_Z13minDifferenceSt6vectorIiSaIiEES1_(ptr noundef nonnull %0, ptr noundef %1) local_unnamed_addr #1 {
  %3 = alloca %"struct.std::pair", align 8
  %4 = alloca %"class.std::vector", align 8
  %5 = alloca %"class.std::vector", align 8
  %6 = tail call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  %7 = tail call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  tail call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_(ptr %6, ptr %7)
  %8 = tail call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #3
  %9 = tail call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #3
  tail call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_(ptr %8, ptr %9)
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 4 dereferenceable(8) %3)
  %10 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  %.not = icmp eq i64 %10, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2
  %11 = getelementptr inbounds i8, ptr %3, i64 4
  br label %13

._crit_edge:                                      ; preds = %71, %2
  %12 = load i64, ptr %3, align 8
  ret i64 %12

13:                                               ; preds = %.lr.ph, %71
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %71 ]
  %.046 = phi i32 [ 2147483647, %.lr.ph ], [ %.3, %71 ]
  %14 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %indvars.iv) #3
  %15 = load i32, ptr %14, align 4, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) %1)
  %16 = call noundef i32 @_Z11justSmallerSt6vectorIiSaIiEEi(ptr noundef nonnull %4, i32 noundef %15)
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #3
  call void @_ZNSt6vectorIiSaIiEEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(24) %1)
  %17 = call noundef i32 @_Z11justGreaterSt6vectorIiSaIiEEi(ptr noundef nonnull %5, i32 noundef %15)
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #3
  %18 = icmp eq i32 %17, -1
  %19 = and i32 %17, %16
  %or.cond = icmp eq i32 %19, -1
  br i1 %or.cond, label %71, label %20

20:                                               ; preds = %13
  %21 = icmp eq i32 %16, -1
  br i1 %21, label %22, label %34

22:                                               ; preds = %20
  %23 = sext i32 %17 to i64
  %24 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %23) #3
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = sub nsw i32 %25, %15
  %27 = icmp sgt i32 %.046, %26
  br i1 %27, label %28, label %71

28:                                               ; preds = %22
  store i32 %15, ptr %3, align 8, !tbaa !9
  %29 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %23) #3
  %30 = load i32, ptr %29, align 4, !tbaa !5
  store i32 %30, ptr %11, align 4, !tbaa !11
  %31 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %23) #3
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = sub nsw i32 %32, %15
  br label %71

34:                                               ; preds = %20
  br i1 %18, label %35, label %47

35:                                               ; preds = %34
  %36 = sext i32 %16 to i64
  %37 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %36) #3
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = sub nsw i32 %15, %38
  %40 = icmp sgt i32 %.046, %39
  br i1 %40, label %41, label %71

41:                                               ; preds = %35
  %42 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %36) #3
  %43 = load i32, ptr %42, align 4, !tbaa !5
  store i32 %43, ptr %3, align 8, !tbaa !9
  store i32 %15, ptr %11, align 4, !tbaa !11
  %44 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %36) #3
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = sub nsw i32 %15, %45
  br label %71

47:                                               ; preds = %34
  %48 = sext i32 %17 to i64
  %49 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %48) #3
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = sub nsw i32 %50, %15
  %52 = icmp sgt i32 %.046, %51
  br i1 %52, label %53, label %59

53:                                               ; preds = %47
  store i32 %15, ptr %3, align 8, !tbaa !9
  %54 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %48) #3
  %55 = load i32, ptr %54, align 4, !tbaa !5
  store i32 %55, ptr %11, align 4, !tbaa !11
  %56 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %48) #3
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = sub nsw i32 %57, %15
  br label %59

59:                                               ; preds = %53, %47
  %.1 = phi i32 [ %58, %53 ], [ %.046, %47 ]
  %60 = sext i32 %16 to i64
  %61 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %60) #3
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = sub nsw i32 %15, %62
  %64 = icmp sgt i32 %.1, %63
  br i1 %64, label %65, label %71

65:                                               ; preds = %59
  %66 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %60) #3
  %67 = load i32, ptr %66, align 4, !tbaa !5
  store i32 %67, ptr %3, align 8, !tbaa !9
  store i32 %15, ptr %11, align 4, !tbaa !11
  %68 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %60) #3
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = sub nsw i32 %15, %69
  br label %71

71:                                               ; preds = %41, %35, %65, %59, %22, %28, %13
  %.3 = phi i32 [ %.046, %13 ], [ %33, %28 ], [ %.046, %22 ], [ %46, %41 ], [ %.046, %35 ], [ %70, %65 ], [ %.1, %59 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %72 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  %73 = icmp ugt i64 %72, %indvars.iv.next
  br i1 %73, label %13, label %._crit_edge, !llvm.loop !12
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_(ptr, ptr) local_unnamed_addr #2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 4 dereferenceable(8)) unnamed_addr #0 align 2

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

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

attributes #0 = { 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 #1 = { 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 #2 = { 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 #3 = { 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 = !{!10, !6, i64 0}
!10 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!11 = !{!10, !6, i64 4}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass