; LLVM IR from xirc/cp-algorithm :: aoj/CGL/CGL4B/main.ll (Z15convex_diameterRKSt6vectorI7vector2SaIS0_EE)

; 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::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Tuple_impl.base", %"struct.std::_Head_base.3" }
%"struct.std::_Tuple_impl.base" = type <{ %"struct.std::_Tuple_impl.1", %"struct.std::_Head_base.2" }>
%"struct.std::_Tuple_impl.1" = type { %"struct.std::_Head_base" }
%"struct.std::_Head_base" = type { double }
%"struct.std::_Head_base.2" = type { i32 }
%"struct.std::_Head_base.3" = type { i32 }
%struct.vector2 = type { double, double }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_Z5crossRK7vector2S1_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z2GQRKdS0_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z15convex_diameterRKSt6vectorI7vector2SaIS0_EE(ptr dead_on_unwind noalias writable sret(%"class.std::tuple") align 8 %0, ptr noundef nonnull align 8 dereferenceable(24) %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca double, align 8
  %10 = alloca %struct.vector2, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca double, align 8
  %18 = alloca %struct.vector2, align 8
  %19 = alloca %struct.vector2, align 8
  %20 = alloca double, align 8
  %21 = alloca double, align 8
  %22 = alloca %struct.vector2, align 8
  %23 = alloca double, align 8
  store ptr %0, ptr %3, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = call noundef i64 @_ZNKSt6vectorI7vector2SaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %24) #4
  %26 = icmp ule i64 %25, 1
  br i1 %26, label %27, label %28

27:                                               ; preds = %2
  call void @__cxa_rethrow() #5
  unreachable

28:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = call noundef i64 @_ZNKSt6vectorI7vector2SaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %29) #4
  %31 = trunc i64 %30 to i32
  store i32 %31, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 1, ptr %8, align 4, !tbaa !9
  br label %32

32:                                               ; preds = %70, %28
  %33 = load i32, ptr %8, align 4, !tbaa !9
  %34 = load i32, ptr %5, 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 %8) #4
  br label %73

37:                                               ; preds = %32
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = load i32, ptr %8, align 4, !tbaa !9
  %40 = sext i32 %39 to i64
  %41 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorI7vector2SaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %38, i64 noundef %40) #4
  %42 = getelementptr inbounds %struct.vector2, ptr %41, i32 0, i32 1
  %43 = load double, ptr %42, align 8, !tbaa !11
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = load i32, ptr %6, align 4, !tbaa !9
  %46 = sext i32 %45 to i64
  %47 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorI7vector2SaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %44, i64 noundef %46) #4
  %48 = getelementptr inbounds %struct.vector2, ptr %47, i32 0, i32 1
  %49 = load double, ptr %48, align 8, !tbaa !11
  %50 = fcmp ogt double %43, %49
  br i1 %50, label %51, label %53

51:                                               ; preds = %37
  %52 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %52, ptr %6, align 4, !tbaa !9
  br label %53

53:                                               ; preds = %51, %37
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = load i32, ptr %8, align 4, !tbaa !9
  %56 = sext i32 %55 to i64
  %57 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorI7vector2SaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %54, i64 noundef %56) #4
  %58 = getelementptr inbounds %struct.vector2, ptr %57, i32 0, i32 1
  %59 = load double, ptr %58, align 8, !tbaa !11
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = load i32, ptr %7, align 4, !tbaa !9
  %62 = sext i32 %61 to i64
  %63 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorI7vector2SaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %60, i64 noundef %62) #4
  %64 = getelementptr inbounds %struct.vector2, ptr %63, i32 0, i32 1
  %65 = load double, ptr %64, align 8, !tbaa !11
  %66 = fcmp olt double %59, %65
  br i1 %66, label %67, label %69

67:                                               ; preds = %53
  %68 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %68, ptr %7, align 4, !tbaa !9
  br label %69

69:                                               ; preds = %67, %53
  br label %70

70:                                               ; preds = %69
  %71 = load i32, ptr %8, align 4, !tbaa !9
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %8, align 4, !tbaa !9
  br label %32, !llvm.loop !14

73:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #4
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = load i32, ptr %6, align 4, !tbaa !9
  %76 = sext i32 %75 to i64
  %77 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorI7vector2SaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %74, i64 noundef %76) #4
  %78 = load ptr, ptr %4, align 8, !tbaa !5
  %79 = load i32, ptr %7, align 4, !tbaa !9
  %80 = sext i32 %79 to i64
  %81 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorI7vector2SaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %78, i64 noundef %80) #4
  %82 = call { double, double } @_ZNK7vector2miERKS_(ptr noundef nonnull align 8 dereferenceable(16) %77, ptr noundef nonnull align 8 dereferenceable(16) %81)
  %83 = getelementptr inbounds { double, double }, ptr %10, i32 0, i32 0
  %84 = extractvalue { double, double } %82, 0
  store double %84, ptr %83, align 8
  %85 = getelementptr inbounds { double, double }, ptr %10, i32 0, i32 1
  %86 = extractvalue { double, double } %82, 1
  store double %86, ptr %85, align 8
  %87 = call noundef double @_ZNK7vector24normEv(ptr noundef nonnull align 8 dereferenceable(16) %10)
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #4
  store double %87, ptr %9, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %88 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %88, ptr %12, align 4, !tbaa !9
  store i32 %88, ptr %11, align 4, !tbaa !9
  %89 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %89, ptr %14, align 4, !tbaa !9
  store i32 %89, ptr %13, align 4, !tbaa !9
  br label %90

90:                                               ; preds = %162, %73
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %91 = load i32, ptr %11, align 4, !tbaa !9
  %92 = add nsw i32 %91, 1
  %93 = load i32, ptr %5, align 4, !tbaa !9
  %94 = srem i32 %92, %93
  store i32 %94, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %95 = load i32, ptr %13, align 4, !tbaa !9
  %96 = add nsw i32 %95, 1
  %97 = load i32, ptr %5, align 4, !tbaa !9
  %98 = srem i32 %96, %97
  store i32 %98, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #4
  %99 = load ptr, ptr %4, align 8, !tbaa !5
  %100 = load i32, ptr %15, align 4, !tbaa !9
  %101 = sext i32 %100 to i64
  %102 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorI7vector2SaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %99, i64 noundef %101) #4
  %103 = load ptr, ptr %4, align 8, !tbaa !5
  %104 = load i32, ptr %11, align 4, !tbaa !9
  %105 = sext i32 %104 to i64
  %106 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorI7vector2SaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %103, i64 noundef %105) #4
  %107 = call { double, double } @_ZNK7vector2miERKS_(ptr noundef nonnull align 8 dereferenceable(16) %102, ptr noundef nonnull align 8 dereferenceable(16) %106)
  %108 = getelementptr inbounds { double, double }, ptr %18, i32 0, i32 0
  %109 = extractvalue { double, double } %107, 0
  store double %109, ptr %108, align 8
  %110 = getelementptr inbounds { double, double }, ptr %18, i32 0, i32 1
  %111 = extractvalue { double, double } %107, 1
  store double %111, ptr %110, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #4
  %112 = load ptr, ptr %4, align 8, !tbaa !5
  %113 = load i32, ptr %16, align 4, !tbaa !9
  %114 = sext i32 %113 to i64
  %115 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorI7vector2SaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %112, i64 noundef %114) #4
  %116 = load ptr, ptr %4, align 8, !tbaa !5
  %117 = load i32, ptr %13, align 4, !tbaa !9
  %118 = sext i32 %117 to i64
  %119 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorI7vector2SaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %116, i64 noundef %118) #4
  %120 = call { double, double } @_ZNK7vector2miERKS_(ptr noundef nonnull align 8 dereferenceable(16) %115, ptr noundef nonnull align 8 dereferenceable(16) %119)
  %121 = getelementptr inbounds { double, double }, ptr %19, i32 0, i32 0
  %122 = extractvalue { double, double } %120, 0
  store double %122, ptr %121, align 8
  %123 = getelementptr inbounds { double, double }, ptr %19, i32 0, i32 1
  %124 = extractvalue { double, double } %120, 1
  store double %124, ptr %123, align 8
  %125 = call noundef double @_Z5crossRK7vector2S1_(ptr noundef nonnull align 8 dereferenceable(16) %18, ptr noundef nonnull align 8 dereferenceable(16) %19)
  store double %125, ptr %17, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  store double 0.000000e+00, ptr %20, align 8, !tbaa !16
  %126 = call noundef zeroext i1 @_Z2GQRKdS0_(ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 8 dereferenceable(8) %20)
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  br i1 %126, label %127, label %129

127:                                              ; preds = %90
  %128 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %128, ptr %13, align 4, !tbaa !9
  br label %131

129:                                              ; preds = %90
  %130 = load i32, ptr %15, align 4, !tbaa !9
  store i32 %130, ptr %11, align 4, !tbaa !9
  br label %131

131:                                              ; preds = %129, %127
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr %22) #4
  %132 = load ptr, ptr %4, align 8, !tbaa !5
  %133 = load i32, ptr %11, align 4, !tbaa !9
  %134 = sext i32 %133 to i64
  %135 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorI7vector2SaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %132, i64 noundef %134) #4
  %136 = load ptr, ptr %4, align 8, !tbaa !5
  %137 = load i32, ptr %13, align 4, !tbaa !9
  %138 = sext i32 %137 to i64
  %139 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorI7vector2SaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %136, i64 noundef %138) #4
  %140 = call { double, double } @_ZNK7vector2miERKS_(ptr noundef nonnull align 8 dereferenceable(16) %135, ptr noundef nonnull align 8 dereferenceable(16) %139)
  %141 = getelementptr inbounds { double, double }, ptr %22, i32 0, i32 0
  %142 = extractvalue { double, double } %140, 0
  store double %142, ptr %141, align 8
  %143 = getelementptr inbounds { double, double }, ptr %22, i32 0, i32 1
  %144 = extractvalue { double, double } %140, 1
  store double %144, ptr %143, align 8
  %145 = call noundef double @_ZNK7vector24normEv(ptr noundef nonnull align 8 dereferenceable(16) %22)
  call void @llvm.lifetime.end.p0(i64 16, ptr %22) #4
  store double %145, ptr %21, align 8, !tbaa !16
  %146 = load double, ptr %21, align 8, !tbaa !16
  %147 = load double, ptr %9, align 8, !tbaa !16
  %148 = fcmp ogt double %146, %147
  br i1 %148, label %149, label %153

149:                                              ; preds = %131
  %150 = load double, ptr %21, align 8, !tbaa !16
  store double %150, ptr %9, align 8, !tbaa !16
  %151 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %151, ptr %12, align 4, !tbaa !9
  %152 = load i32, ptr %13, align 4, !tbaa !9
  store i32 %152, ptr %14, align 4, !tbaa !9
  br label %153

153:                                              ; preds = %149, %131
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  br label %154

154:                                              ; preds = %153
  %155 = load i32, ptr %11, align 4, !tbaa !9
  %156 = load i32, ptr %6, align 4, !tbaa !9
  %157 = icmp ne i32 %155, %156
  br i1 %157, label %162, label %158

158:                                              ; preds = %154
  %159 = load i32, ptr %13, align 4, !tbaa !9
  %160 = load i32, ptr %7, align 4, !tbaa !9
  %161 = icmp ne i32 %159, %160
  br label %162

162:                                              ; preds = %158, %154
  %163 = phi i1 [ true, %154 ], [ %161, %158 ]
  br i1 %163, label %90, label %164, !llvm.loop !17

164:                                              ; preds = %162
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #4
  %165 = load double, ptr %9, align 8, !tbaa !16
  %166 = call double @sqrt(double noundef %165) #4
  store double %166, ptr %23, align 8, !tbaa !16
  call void @_ZSt10make_tupleIJRiS0_dEESt5tupleIJDpNSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeEEEDpOS4_(ptr dead_on_unwind writable sret(%"class.std::tuple") align 8 %0, ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 8 dereferenceable(8) %23)
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  ret void
}

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

declare void @__cxa_rethrow()

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { double, double } @_ZNK7vector2miERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZSt10make_tupleIJRiS0_dEESt5tupleIJDpNSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeEEEDpOS4_(ptr dead_on_unwind noalias writable sret(%"class.std::tuple") align 8, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 8 dereferenceable(8)) #0

; Function Attrs: nounwind
declare double @sqrt(double noundef) #3

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 = { nounwind }
attributes #5 = { noreturn }

!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, !13, i64 8}
!12 = !{!"_ZTS7vector2", !13, i64 0, !13, i64 8}
!13 = !{!"double", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!13, !13, i64 0}
!17 = distinct !{!17, !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::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Tuple_impl.base", %"struct.std::_Head_base.3" }
%"struct.std::_Tuple_impl.base" = type <{ %"struct.std::_Tuple_impl.1", %"struct.std::_Head_base.2" }>
%"struct.std::_Tuple_impl.1" = type { %"struct.std::_Head_base" }
%"struct.std::_Head_base" = type { double }
%"struct.std::_Head_base.2" = type { i32 }
%"struct.std::_Head_base.3" = type { i32 }
%struct.vector2 = type { double, double }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_Z5crossRK7vector2S1_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #0

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z15convex_diameterRKSt6vectorI7vector2SaIS0_EE(ptr dead_on_unwind noalias writable sret(%"class.std::tuple") align 8 %0, ptr noundef nonnull align 8 dereferenceable(24) %1) local_unnamed_addr #1 {
  %3 = alloca %struct.vector2, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca double, align 8
  %7 = alloca %struct.vector2, align 8
  %8 = alloca %struct.vector2, align 8
  %9 = alloca double, align 8
  %10 = alloca %struct.vector2, align 8
  %11 = alloca double, align 8
  %12 = tail call noundef i64 @_ZNKSt6vectorI7vector2SaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #4
  %13 = icmp ult i64 %12, 2
  br i1 %13, label %14, label %15

14:                                               ; preds = %2
  tail call void @__cxa_rethrow() #5
  unreachable

15:                                               ; preds = %2
  %16 = tail call noundef i64 @_ZNKSt6vectorI7vector2SaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #4
  %17 = trunc i64 %16 to i32
  %18 = icmp sgt i32 %17, 1
  br i1 %18, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %15
  %wide.trip.count = and i64 %16, 2147483647
  br label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %15
  %.048.lcssa = phi i32 [ 0, %15 ], [ %.149, %.lr.ph ]
  %.0.lcssa = phi i32 [ 0, %15 ], [ %.1, %.lr.ph ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #4
  %19 = sext i32 %.0.lcssa to i64
  %20 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorI7vector2SaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %19) #4
  %21 = sext i32 %.048.lcssa to i64
  %22 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorI7vector2SaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %21) #4
  %23 = tail call { double, double } @_ZNK7vector2miERKS_(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 8 dereferenceable(16) %22)
  %24 = extractvalue { double, double } %23, 0
  store double %24, ptr %3, align 8
  %25 = getelementptr inbounds i8, ptr %3, i64 8
  %26 = extractvalue { double, double } %23, 1
  store double %26, ptr %25, align 8
  %27 = call noundef double @_ZNK7vector24normEv(ptr noundef nonnull align 8 dereferenceable(16) %3)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #4
  store i32 %.0.lcssa, ptr %4, align 4, !tbaa !5
  store i32 %.048.lcssa, ptr %5, align 4, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %7, i64 8
  %29 = getelementptr inbounds i8, ptr %8, i64 8
  %30 = getelementptr inbounds i8, ptr %10, i64 8
  br label %48

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 1, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %.061 = phi i32 [ 0, %.lr.ph.preheader ], [ %.1, %.lr.ph ]
  %.04860 = phi i32 [ 0, %.lr.ph.preheader ], [ %.149, %.lr.ph ]
  %31 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorI7vector2SaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %indvars.iv) #4
  %32 = getelementptr inbounds i8, ptr %31, i64 8
  %33 = load double, ptr %32, align 8, !tbaa !9
  %34 = sext i32 %.061 to i64
  %35 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorI7vector2SaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %34) #4
  %36 = getelementptr inbounds i8, ptr %35, i64 8
  %37 = load double, ptr %36, align 8, !tbaa !9
  %38 = fcmp ogt double %33, %37
  %39 = trunc nuw nsw i64 %indvars.iv to i32
  %.1 = select i1 %38, i32 %39, i32 %.061
  %40 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorI7vector2SaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %indvars.iv) #4
  %41 = getelementptr inbounds i8, ptr %40, i64 8
  %42 = load double, ptr %41, align 8, !tbaa !9
  %43 = sext i32 %.04860 to i64
  %44 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorI7vector2SaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %43) #4
  %45 = getelementptr inbounds i8, ptr %44, i64 8
  %46 = load double, ptr %45, align 8, !tbaa !9
  %47 = fcmp olt double %42, %46
  %.149 = select i1 %47, i32 %39, i32 %.04860
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !12

48:                                               ; preds = %79, %._crit_edge
  %.055 = phi double [ %27, %._crit_edge ], [ %.156, %79 ]
  %.053 = phi i32 [ %.0.lcssa, %._crit_edge ], [ %.053., %79 ]
  %.051 = phi i32 [ %.048.lcssa, %._crit_edge ], [ %..051, %79 ]
  %49 = add nsw i32 %.053, 1
  %50 = srem i32 %49, %17
  %51 = add nsw i32 %.051, 1
  %52 = srem i32 %51, %17
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #4
  %53 = sext i32 %50 to i64
  %54 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorI7vector2SaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %53) #4
  %55 = sext i32 %.053 to i64
  %56 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorI7vector2SaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %55) #4
  %57 = call { double, double } @_ZNK7vector2miERKS_(ptr noundef nonnull align 8 dereferenceable(16) %54, ptr noundef nonnull align 8 dereferenceable(16) %56)
  %58 = extractvalue { double, double } %57, 0
  store double %58, ptr %7, align 8
  %59 = extractvalue { double, double } %57, 1
  store double %59, ptr %28, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #4
  %60 = sext i32 %52 to i64
  %61 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorI7vector2SaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %60) #4
  %62 = sext i32 %.051 to i64
  %63 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorI7vector2SaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %62) #4
  %64 = call { double, double } @_ZNK7vector2miERKS_(ptr noundef nonnull align 8 dereferenceable(16) %61, ptr noundef nonnull align 8 dereferenceable(16) %63)
  %65 = extractvalue { double, double } %64, 0
  store double %65, ptr %8, align 8
  %66 = extractvalue { double, double } %64, 1
  store double %66, ptr %29, align 8
  %67 = call noundef double @_Z5crossRK7vector2S1_(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 8 dereferenceable(16) %8)
  store double %67, ptr %6, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #4
  store double 0.000000e+00, ptr %9, align 8, !tbaa !14
  %68 = call noundef zeroext i1 @_Z2GQRKdS0_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %9)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  %.053. = select i1 %68, i32 %.053, i32 %50
  %..051 = select i1 %68, i32 %52, i32 %.051
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #4
  %69 = sext i32 %.053. to i64
  %70 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorI7vector2SaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %69) #4
  %71 = sext i32 %..051 to i64
  %72 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorI7vector2SaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %71) #4
  %73 = call { double, double } @_ZNK7vector2miERKS_(ptr noundef nonnull align 8 dereferenceable(16) %70, ptr noundef nonnull align 8 dereferenceable(16) %72)
  %74 = extractvalue { double, double } %73, 0
  store double %74, ptr %10, align 8
  %75 = extractvalue { double, double } %73, 1
  store double %75, ptr %30, align 8
  %76 = call noundef double @_ZNK7vector24normEv(ptr noundef nonnull align 8 dereferenceable(16) %10)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #4
  %77 = fcmp ogt double %76, %.055
  br i1 %77, label %78, label %79

78:                                               ; preds = %48
  store i32 %.053., ptr %4, align 4, !tbaa !5
  store i32 %..051, ptr %5, align 4, !tbaa !5
  br label %79

79:                                               ; preds = %78, %48
  %.156 = phi double [ %76, %78 ], [ %.055, %48 ]
  %80 = icmp ne i32 %.053., %.0.lcssa
  %81 = icmp ne i32 %..051, %.048.lcssa
  %82 = select i1 %80, i1 true, i1 %81
  br i1 %82, label %48, label %83, !llvm.loop !15

83:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #4
  %84 = call double @sqrt(double noundef %.156) #4
  store double %84, ptr %11, align 8, !tbaa !14
  call void @_ZSt10make_tupleIJRiS0_dEESt5tupleIJDpNSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeEEEDpOS4_(ptr dead_on_unwind writable sret(%"class.std::tuple") align 8 %0, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 8 dereferenceable(8) %11)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  ret void
}

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

declare void @__cxa_rethrow() local_unnamed_addr

; 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 nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorI7vector2SaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 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: mustprogress uwtable
declare dso_local { double, double } @_ZNK7vector2miERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZSt10make_tupleIJRiS0_dEESt5tupleIJDpNSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeEEEDpOS4_(ptr dead_on_unwind noalias writable sret(%"class.std::tuple") align 8, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "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 }
attributes #5 = { noreturn }

!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, !11, i64 8}
!10 = !{!"_ZTS7vector2", !11, i64 0, !11, i64 8}
!11 = !{!"double", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!11, !11, i64 0}
!15 = distinct !{!15, !13}


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