; LLVM IR from amritansh22/Data-Structures-and-Algorithms-in-cpp :: minimum number of swaps required to sort the array.ll (Z8minSwapsPii)

; 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::_Bvector_base" }
%"struct.std::_Bvector_base" = type { %"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl" }
%"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl" = type { %"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl_data" }
%"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl_data" = type { %"struct.std::_Bit_iterator", %"struct.std::_Bit_iterator", ptr }
%"struct.std::_Bit_iterator" = type { %"struct.std::_Bit_iterator_base.base", [4 x i8] }
%"struct.std::_Bit_iterator_base.base" = type <{ ptr, i32 }>
%"class.std::allocator.0" = type { i8 }
%"struct.std::_Bit_reference" = type { ptr, i64 }
%"struct.std::pair" = type { i32, i32 }

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z8minSwapsPii(ptr noundef %0, i32 noundef %1) #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca %"class.std::vector", align 8
  %9 = alloca i8, align 1
  %10 = alloca %"class.std::allocator.0", align 1
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca %"struct.std::_Bit_reference", align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca %"struct.std::_Bit_reference", align 8
  %19 = alloca %"struct.std::_Bit_reference", align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %20 = load i32, ptr %4, align 4, !tbaa !9
  %21 = zext i32 %20 to i64
  %22 = call ptr @llvm.stacksave.p0()
  store ptr %22, ptr %5, align 8
  %23 = alloca %"struct.std::pair", i64 %21, align 16
  store i64 %21, ptr %6, align 8
  %24 = icmp eq i64 %21, 0
  br i1 %24, label %31, label %25

25:                                               ; preds = %2
  %26 = getelementptr inbounds %"struct.std::pair", ptr %23, i64 %21
  br label %27

27:                                               ; preds = %27, %25
  %28 = phi ptr [ %23, %25 ], [ %29, %27 ]
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 4 dereferenceable(8) %28)
  %29 = getelementptr inbounds %"struct.std::pair", ptr %28, i64 1
  %30 = icmp eq ptr %29, %26
  br i1 %30, label %31, label %27

31:                                               ; preds = %27, %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %32

32:                                               ; preds = %52, %31
  %33 = load i32, ptr %7, align 4, !tbaa !9
  %34 = load i32, ptr %4, align 4, !tbaa !9
  %35 = icmp slt i32 %33, %34
  br i1 %35, label %37, label %36

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

37:                                               ; preds = %32
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = load i32, ptr %7, align 4, !tbaa !9
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds i32, ptr %38, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !9
  %43 = load i32, ptr %7, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds %"struct.std::pair", ptr %23, i64 %44
  %46 = getelementptr inbounds %"struct.std::pair", ptr %45, i32 0, i32 0
  store i32 %42, ptr %46, align 8, !tbaa !11
  %47 = load i32, ptr %7, align 4, !tbaa !9
  %48 = load i32, ptr %7, align 4, !tbaa !9
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds %"struct.std::pair", ptr %23, i64 %49
  %51 = getelementptr inbounds %"struct.std::pair", ptr %50, i32 0, i32 1
  store i32 %47, ptr %51, align 4, !tbaa !13
  br label %52

52:                                               ; preds = %37
  %53 = load i32, ptr %7, align 4, !tbaa !9
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %7, align 4, !tbaa !9
  br label %32, !llvm.loop !14

55:                                               ; preds = %36
  %56 = load i32, ptr %4, align 4, !tbaa !9
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds %"struct.std::pair", ptr %23, i64 %57
  call void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef %23, ptr noundef %58)
  call void @llvm.lifetime.start.p0(i64 40, ptr %8) #5
  %59 = load i32, ptr %4, align 4, !tbaa !9
  %60 = sext i32 %59 to i64
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #5
  store i8 0, ptr %9, align 1, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #5
  call void @_ZNSaIbEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #5
  invoke void @_ZNSt6vectorIbSaIbEEC2EmRKbRKS0_(ptr noundef nonnull align 8 dereferenceable(40) %8, i64 noundef %60, ptr noundef nonnull align 1 dereferenceable(1) %9, ptr noundef nonnull align 1 dereferenceable(1) %10)
          to label %61 unwind label %67

61:                                               ; preds = %55
  call void @_ZNSt15__new_allocatorIbED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %62

62:                                               ; preds = %143, %61
  %63 = load i32, ptr %14, align 4, !tbaa !9
  %64 = load i32, ptr %4, align 4, !tbaa !9
  %65 = icmp slt i32 %63, %64
  br i1 %65, label %71, label %66

66:                                               ; preds = %62
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %148

67:                                               ; preds = %55
  %68 = landingpad { ptr, i32 }
          cleanup
  %69 = extractvalue { ptr, i32 } %68, 0
  store ptr %69, ptr %11, align 8
  %70 = extractvalue { ptr, i32 } %68, 1
  store i32 %70, ptr %12, align 4
  call void @_ZNSt15__new_allocatorIbED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #5
  br label %151

71:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #5
  %72 = load i32, ptr %14, align 4, !tbaa !9
  %73 = sext i32 %72 to i64
  %74 = invoke { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) %8, i64 noundef %73)
          to label %75 unwind label %92

75:                                               ; preds = %71
  %76 = getelementptr inbounds { ptr, i64 }, ptr %15, i32 0, i32 0
  %77 = extractvalue { ptr, i64 } %74, 0
  store ptr %77, ptr %76, align 8
  %78 = getelementptr inbounds { ptr, i64 }, ptr %15, i32 0, i32 1
  %79 = extractvalue { ptr, i64 } %74, 1
  store i64 %79, ptr %78, align 8
  %80 = call noundef zeroext i1 @_ZNKSt14_Bit_referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %15) #5
  br i1 %80, label %89, label %81

81:                                               ; preds = %75
  %82 = load i32, ptr %14, align 4, !tbaa !9
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds %"struct.std::pair", ptr %23, i64 %83
  %85 = getelementptr inbounds %"struct.std::pair", ptr %84, i32 0, i32 1
  %86 = load i32, ptr %85, align 4, !tbaa !13
  %87 = load i32, ptr %14, align 4, !tbaa !9
  %88 = icmp eq i32 %86, %87
  br label %89

89:                                               ; preds = %81, %75
  %90 = phi i1 [ true, %75 ], [ %88, %81 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #5
  br i1 %90, label %91, label %96

91:                                               ; preds = %89
  br label %143

92:                                               ; preds = %71
  %93 = landingpad { ptr, i32 }
          cleanup
  %94 = extractvalue { ptr, i32 } %93, 0
  store ptr %94, ptr %11, align 8
  %95 = extractvalue { ptr, i32 } %93, 1
  store i32 %95, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #5
  br label %147

96:                                               ; preds = %89
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 0, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %97 = load i32, ptr %14, align 4, !tbaa !9
  store i32 %97, ptr %17, align 4, !tbaa !9
  br label %98

98:                                               ; preds = %113, %96
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #5
  %99 = load i32, ptr %17, align 4, !tbaa !9
  %100 = sext i32 %99 to i64
  %101 = invoke { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) %8, i64 noundef %100)
          to label %102 unwind label %126

102:                                              ; preds = %98
  %103 = getelementptr inbounds { ptr, i64 }, ptr %18, i32 0, i32 0
  %104 = extractvalue { ptr, i64 } %101, 0
  store ptr %104, ptr %103, align 8
  %105 = getelementptr inbounds { ptr, i64 }, ptr %18, i32 0, i32 1
  %106 = extractvalue { ptr, i64 } %101, 1
  store i64 %106, ptr %105, align 8
  %107 = call noundef zeroext i1 @_ZNKSt14_Bit_referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %18) #5
  %108 = xor i1 %107, true
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #5
  br i1 %108, label %109, label %134

109:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #5
  %110 = load i32, ptr %17, align 4, !tbaa !9
  %111 = sext i32 %110 to i64
  %112 = invoke { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) %8, i64 noundef %111)
          to label %113 unwind label %130

113:                                              ; preds = %109
  %114 = getelementptr inbounds { ptr, i64 }, ptr %19, i32 0, i32 0
  %115 = extractvalue { ptr, i64 } %112, 0
  store ptr %115, ptr %114, align 8
  %116 = getelementptr inbounds { ptr, i64 }, ptr %19, i32 0, i32 1
  %117 = extractvalue { ptr, i64 } %112, 1
  store i64 %117, ptr %116, align 8
  %118 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt14_Bit_referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %19, i1 noundef zeroext true) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #5
  %119 = load i32, ptr %17, align 4, !tbaa !9
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds %"struct.std::pair", ptr %23, i64 %120
  %122 = getelementptr inbounds %"struct.std::pair", ptr %121, i32 0, i32 1
  %123 = load i32, ptr %122, align 4, !tbaa !13
  store i32 %123, ptr %17, align 4, !tbaa !9
  %124 = load i32, ptr %16, align 4, !tbaa !9
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr %16, align 4, !tbaa !9
  br label %98, !llvm.loop !18

126:                                              ; preds = %98
  %127 = landingpad { ptr, i32 }
          cleanup
  %128 = extractvalue { ptr, i32 } %127, 0
  store ptr %128, ptr %11, align 8
  %129 = extractvalue { ptr, i32 } %127, 1
  store i32 %129, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #5
  br label %146

130:                                              ; preds = %109
  %131 = landingpad { ptr, i32 }
          cleanup
  %132 = extractvalue { ptr, i32 } %131, 0
  store ptr %132, ptr %11, align 8
  %133 = extractvalue { ptr, i32 } %131, 1
  store i32 %133, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #5
  br label %146

134:                                              ; preds = %102
  %135 = load i32, ptr %16, align 4, !tbaa !9
  %136 = icmp sgt i32 %135, 0
  br i1 %136, label %137, label %142

137:                                              ; preds = %134
  %138 = load i32, ptr %16, align 4, !tbaa !9
  %139 = sub nsw i32 %138, 1
  %140 = load i32, ptr %13, align 4, !tbaa !9
  %141 = add nsw i32 %140, %139
  store i32 %141, ptr %13, align 4, !tbaa !9
  br label %142

142:                                              ; preds = %137, %134
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %143

143:                                              ; preds = %142, %91
  %144 = load i32, ptr %14, align 4, !tbaa !9
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %14, align 4, !tbaa !9
  br label %62, !llvm.loop !19

146:                                              ; preds = %130, %126
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %147

147:                                              ; preds = %146, %92
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @_ZNSt13_Bvector_baseISaIbEED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %8) #5
  br label %151

148:                                              ; preds = %66
  %149 = load i32, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @_ZNSt13_Bvector_baseISaIbEED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %8) #5
  call void @llvm.lifetime.end.p0(i64 40, ptr %8) #5
  %150 = load ptr, ptr %5, align 8
  call void @llvm.stackrestore.p0(ptr %150)
  ret i32 %149

151:                                              ; preds = %147, %67
  call void @llvm.lifetime.end.p0(i64 40, ptr %8) #5
  br label %152

152:                                              ; preds = %151
  %153 = load ptr, ptr %11, align 8
  %154 = load i32, ptr %12, align 4
  %155 = insertvalue { ptr, i32 } poison, ptr %153, 0
  %156 = insertvalue { ptr, i32 } %155, i32 %154, 1
  resume { ptr, i32 } %156
}

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

; 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 #2 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef, ptr noundef) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSaIbEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIbSaIbEEC2EmRKbRKS0_(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef, ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIbED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt14_Bit_referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt14_Bit_referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16), i1 noundef zeroext) #2 align 2

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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"}
!16 = !{!17, !17, i64 0}
!17 = !{!"bool", !7, i64 0}
!18 = distinct !{!18, !15}
!19 = distinct !{!19, !15}


; 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::_Bvector_base" }
%"struct.std::_Bvector_base" = type { %"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl" }
%"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl" = type { %"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl_data" }
%"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl_data" = type { %"struct.std::_Bit_iterator", %"struct.std::_Bit_iterator", ptr }
%"struct.std::_Bit_iterator" = type { %"struct.std::_Bit_iterator_base.base", [4 x i8] }
%"struct.std::_Bit_iterator_base.base" = type <{ ptr, i32 }>
%"class.std::allocator.0" = type { i8 }
%"struct.std::_Bit_reference" = type { ptr, i64 }
%"struct.std::pair" = type { i32, i32 }

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z8minSwapsPii(ptr nocapture noundef readonly %0, i32 noundef %1) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::vector", align 8
  %4 = alloca i8, align 1
  %5 = alloca %"class.std::allocator.0", align 1
  %6 = alloca %"struct.std::_Bit_reference", align 8
  %7 = alloca %"struct.std::_Bit_reference", align 8
  %8 = alloca %"struct.std::_Bit_reference", align 8
  %9 = zext i32 %1 to i64
  %10 = alloca %"struct.std::pair", i64 %9, align 16
  %11 = icmp eq i32 %1, 0
  br i1 %11, label %._crit_edge, label %12

12:                                               ; preds = %2
  %13 = getelementptr inbounds %"struct.std::pair", ptr %10, i64 %9
  br label %14

14:                                               ; preds = %14, %12
  %15 = phi ptr [ %10, %12 ], [ %16, %14 ]
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 4 dereferenceable(8) %15)
  %16 = getelementptr inbounds i8, ptr %15, i64 8
  %17 = icmp eq ptr %16, %13
  br i1 %17, label %.loopexit, label %14

.loopexit:                                        ; preds = %14
  %18 = icmp sgt i32 %1, 0
  br i1 %18, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.loopexit
  %min.iters.check = icmp ult i32 %1, 4
  br i1 %min.iters.check, label %.lr.ph.preheader71, label %vector.ph

.lr.ph.preheader71:                               ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %9, 2147483644
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <2 x i32> [ <i32 0, i32 1>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %step.add = add <2 x i32> %vec.ind, <i32 2, i32 2>
  %19 = or disjoint i64 %index, 2
  %20 = getelementptr inbounds i32, ptr %0, i64 %index
  %21 = getelementptr inbounds i8, ptr %20, i64 8
  %wide.load = load <2 x i32>, ptr %20, align 4, !tbaa !5
  %wide.load67 = load <2 x i32>, ptr %21, align 4, !tbaa !5
  %22 = getelementptr inbounds %"struct.std::pair", ptr %10, i64 %index
  %23 = getelementptr inbounds %"struct.std::pair", ptr %10, i64 %19
  %interleaved.vec = shufflevector <2 x i32> %wide.load, <2 x i32> %vec.ind, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
  store <4 x i32> %interleaved.vec, ptr %22, align 16, !tbaa !5
  %interleaved.vec68 = shufflevector <2 x i32> %wide.load67, <2 x i32> %step.add, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
  store <4 x i32> %interleaved.vec68, ptr %23, align 16, !tbaa !5
  %index.next = add nuw i64 %index, 4
  %vec.ind.next = add <2 x i32> %vec.ind, <i32 4, i32 4>
  %24 = icmp eq i64 %index.next, %n.vec
  br i1 %24, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %9
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader71

._crit_edge:                                      ; preds = %.lr.ph, %middle.block, %2, %.loopexit
  %25 = phi i1 [ false, %.loopexit ], [ false, %2 ], [ %18, %middle.block ], [ %18, %.lr.ph ]
  %26 = sext i32 %1 to i64
  %27 = getelementptr inbounds %"struct.std::pair", ptr %10, i64 %26
  call void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef nonnull %10, ptr noundef nonnull %27)
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #5
  store i8 0, ptr %4, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #5
  call void @_ZNSaIbEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #5
  invoke void @_ZNSt6vectorIbSaIbEEC2EmRKbRKS0_(ptr noundef nonnull align 8 dereferenceable(40) %3, i64 noundef %26, ptr noundef nonnull align 1 dereferenceable(1) %4, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %33 unwind label %37

.lr.ph:                                           ; preds = %.lr.ph.preheader71, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader71 ]
  %28 = getelementptr inbounds i32, ptr %0, i64 %indvars.iv
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = getelementptr inbounds %"struct.std::pair", ptr %10, i64 %indvars.iv
  store i32 %29, ptr %30, align 8, !tbaa !15
  %31 = getelementptr inbounds i8, ptr %30, i64 4
  %32 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %32, ptr %31, align 4, !tbaa !17
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %9
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !18

33:                                               ; preds = %._crit_edge
  call void @_ZNSt15__new_allocatorIbED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #5
  br i1 %25, label %.lr.ph52, label %._crit_edge53

.lr.ph52:                                         ; preds = %33
  %34 = getelementptr inbounds i8, ptr %6, i64 8
  %35 = getelementptr inbounds i8, ptr %7, i64 8
  %36 = getelementptr inbounds i8, ptr %8, i64 8
  br label %39

._crit_edge53:                                    ; preds = %74, %33
  %.030.lcssa = phi i32 [ 0, %33 ], [ %.2, %74 ]
  call void @_ZNSt13_Bvector_baseISaIbEED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %3) #5
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %3) #5
  ret i32 %.030.lcssa

37:                                               ; preds = %._crit_edge
  %38 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIbED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #5
  br label %76

39:                                               ; preds = %.lr.ph52, %74
  %indvars.iv57 = phi i64 [ 0, %.lr.ph52 ], [ %indvars.iv.next58, %74 ]
  %.03049 = phi i32 [ 0, %.lr.ph52 ], [ %.2, %74 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #5
  %40 = invoke { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) %3, i64 noundef %indvars.iv57)
          to label %41 unwind label %51

41:                                               ; preds = %39
  %42 = extractvalue { ptr, i64 } %40, 0
  store ptr %42, ptr %6, align 8
  %43 = extractvalue { ptr, i64 } %40, 1
  store i64 %43, ptr %34, align 8
  %44 = call noundef zeroext i1 @_ZNKSt14_Bit_referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %6) #5
  br i1 %44, label %.critedge, label %45

45:                                               ; preds = %41
  %46 = getelementptr inbounds %"struct.std::pair", ptr %10, i64 %indvars.iv57, i32 1
  %47 = load i32, ptr %46, align 4, !tbaa !17
  %48 = zext i32 %47 to i64
  %49 = icmp eq i64 %indvars.iv57, %48
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #5
  br i1 %49, label %74, label %.preheader.preheader

.preheader.preheader:                             ; preds = %45
  %50 = trunc nuw nsw i64 %indvars.iv57 to i32
  br label %.preheader

.critedge:                                        ; preds = %41
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #5
  br label %74

51:                                               ; preds = %39
  %52 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #5
  br label %75

.preheader:                                       ; preds = %.preheader.preheader, %61
  %.028 = phi i32 [ %67, %61 ], [ 0, %.preheader.preheader ]
  %.0 = phi i32 [ %66, %61 ], [ %50, %.preheader.preheader ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #5
  %53 = sext i32 %.0 to i64
  %54 = invoke { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) %3, i64 noundef %53)
          to label %55 unwind label %68

55:                                               ; preds = %.preheader
  %56 = extractvalue { ptr, i64 } %54, 0
  store ptr %56, ptr %7, align 8
  %57 = extractvalue { ptr, i64 } %54, 1
  store i64 %57, ptr %35, align 8
  %58 = call noundef zeroext i1 @_ZNKSt14_Bit_referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %7) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #5
  br i1 %58, label %72, label %59

59:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #5
  %60 = invoke { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) %3, i64 noundef %53)
          to label %61 unwind label %70

61:                                               ; preds = %59
  %62 = extractvalue { ptr, i64 } %60, 0
  store ptr %62, ptr %8, align 8
  %63 = extractvalue { ptr, i64 } %60, 1
  store i64 %63, ptr %36, align 8
  %64 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt14_Bit_referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %8, i1 noundef zeroext true) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #5
  %65 = getelementptr inbounds %"struct.std::pair", ptr %10, i64 %53, i32 1
  %66 = load i32, ptr %65, align 4, !tbaa !17
  %67 = add nuw nsw i32 %.028, 1
  br label %.preheader, !llvm.loop !19

68:                                               ; preds = %.preheader
  %69 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #5
  br label %75

70:                                               ; preds = %59
  %71 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #5
  br label %75

72:                                               ; preds = %55
  %73 = call i32 @llvm.usub.sat.i32(i32 %.028, i32 1)
  %.1 = add nsw i32 %73, %.03049
  br label %74

74:                                               ; preds = %45, %.critedge, %72
  %.2 = phi i32 [ %.03049, %.critedge ], [ %.03049, %45 ], [ %.1, %72 ]
  %indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
  %exitcond61.not = icmp eq i64 %indvars.iv.next58, %9
  br i1 %exitcond61.not, label %._crit_edge53, label %39, !llvm.loop !20

75:                                               ; preds = %68, %70, %51
  %.pn.pn = phi { ptr, i32 } [ %52, %51 ], [ %71, %70 ], [ %69, %68 ]
  call void @_ZNSt13_Bvector_baseISaIbEED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %3) #5
  br label %76

76:                                               ; preds = %75, %37
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %75 ], [ %38, %37 ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %3) #5
  resume { ptr, i32 } %.pn.pn.pn
}

; 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 #1 align 2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSaIbEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIbSaIbEEC2EmRKbRKS0_(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef, ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIbED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt14_Bit_referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt14_Bit_referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16), i1 noundef zeroext) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt13_Bvector_baseISaIbEED2Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #1 align 2

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

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


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