; LLVM IR from atlantis13579/Riemann :: Src/Geometry (ConvexHull2)

; 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.Maths::TVector2" = type { float, float }

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fabs.f32(float) #2

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Maths8TVector2IfEmiERKS1_(ptr dead_on_unwind noalias writable sret(%"class.Maths::TVector2") align 4, ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK5Maths8TVector2IfE5CrossERKS1_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7Riemann23ConvexHull_GiftWrappingERKSt6vectorIN5Maths8TVector2IfEESaIS3_EEPS5_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %1) #3 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca float, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca float, align 4
  %15 = alloca %"class.Maths::TVector2", align 4
  %16 = alloca %"class.Maths::TVector2", align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store float 0x3EE4F8B580000000, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = call noundef i64 @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %17) #6
  %19 = trunc i64 %18 to i32
  store i32 %19, ptr %6, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 1, ptr %8, align 4, !tbaa !11
  br label %20

20:                                               ; preds = %73, %2
  %21 = load i32, ptr %8, align 4, !tbaa !11
  %22 = load i32, ptr %6, align 4, !tbaa !11
  %23 = icmp slt i32 %21, %22
  br i1 %23, label %25, label %24

24:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %76

25:                                               ; preds = %20
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = load i32, ptr %8, align 4, !tbaa !11
  %28 = sext i32 %27 to i64
  %29 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %26, i64 noundef %28) #6
  %30 = getelementptr inbounds %"class.Maths::TVector2", ptr %29, i32 0, i32 1
  %31 = load float, ptr %30, align 4, !tbaa !13
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = load i32, ptr %7, align 4, !tbaa !11
  %34 = sext i32 %33 to i64
  %35 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %32, i64 noundef %34) #6
  %36 = getelementptr inbounds %"class.Maths::TVector2", ptr %35, i32 0, i32 1
  %37 = load float, ptr %36, align 4, !tbaa !13
  %38 = fsub float %37, 0x3EE4F8B580000000
  %39 = fcmp olt float %31, %38
  br i1 %39, label %70, label %40

40:                                               ; preds = %25
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = load i32, ptr %8, align 4, !tbaa !11
  %43 = sext i32 %42 to i64
  %44 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %41, i64 noundef %43) #6
  %45 = getelementptr inbounds %"class.Maths::TVector2", ptr %44, i32 0, i32 1
  %46 = load float, ptr %45, align 4, !tbaa !13
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = load i32, ptr %7, align 4, !tbaa !11
  %49 = sext i32 %48 to i64
  %50 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %47, i64 noundef %49) #6
  %51 = getelementptr inbounds %"class.Maths::TVector2", ptr %50, i32 0, i32 1
  %52 = load float, ptr %51, align 4, !tbaa !13
  %53 = fsub float %46, %52
  %54 = call float @llvm.fabs.f32(float %53)
  %55 = fcmp ole float %54, 0x3EE4F8B580000000
  br i1 %55, label %56, label %72

56:                                               ; preds = %40
  %57 = load ptr, ptr %3, align 8, !tbaa !5
  %58 = load i32, ptr %8, align 4, !tbaa !11
  %59 = sext i32 %58 to i64
  %60 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %57, i64 noundef %59) #6
  %61 = getelementptr inbounds %"class.Maths::TVector2", ptr %60, i32 0, i32 0
  %62 = load float, ptr %61, align 4, !tbaa !15
  %63 = load ptr, ptr %3, align 8, !tbaa !5
  %64 = load i32, ptr %7, align 4, !tbaa !11
  %65 = sext i32 %64 to i64
  %66 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %63, i64 noundef %65) #6
  %67 = getelementptr inbounds %"class.Maths::TVector2", ptr %66, i32 0, i32 0
  %68 = load float, ptr %67, align 4, !tbaa !15
  %69 = fcmp olt float %62, %68
  br i1 %69, label %70, label %72

70:                                               ; preds = %56, %25
  %71 = load i32, ptr %8, align 4, !tbaa !11
  store i32 %71, ptr %7, align 4, !tbaa !11
  br label %72

72:                                               ; preds = %70, %56, %40
  br label %73

73:                                               ; preds = %72
  %74 = load i32, ptr %8, align 4, !tbaa !11
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %8, align 4, !tbaa !11
  br label %20, !llvm.loop !16

76:                                               ; preds = %24
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  %78 = load ptr, ptr %3, align 8, !tbaa !5
  %79 = load i32, ptr %7, align 4, !tbaa !11
  %80 = sext i32 %79 to i64
  %81 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %78, i64 noundef %80) #6
  call void @_ZNSt6vectorIN5Maths8TVector2IfEESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %77, ptr noundef nonnull align 4 dereferenceable(8) %81)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %82 = load i32, ptr %7, align 4, !tbaa !11
  store i32 %82, ptr %9, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 1, ptr %10, align 4, !tbaa !11
  br label %83

83:                                               ; preds = %154, %76
  %84 = load i32, ptr %10, align 4, !tbaa !11
  %85 = load i32, ptr %6, align 4, !tbaa !11
  %86 = icmp slt i32 %84, %85
  br i1 %86, label %88, label %87

87:                                               ; preds = %83
  store i32 5, ptr %11, align 4
  br label %157

88:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %89 = load i32, ptr %9, align 4, !tbaa !11
  store i32 %89, ptr %12, align 4, !tbaa !11
  %90 = load i32, ptr %12, align 4, !tbaa !11
  store i32 %90, ptr %9, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !11
  br label %91

91:                                               ; preds = %137, %88
  %92 = load i32, ptr %13, align 4, !tbaa !11
  %93 = load i32, ptr %6, align 4, !tbaa !11
  %94 = icmp slt i32 %92, %93
  br i1 %94, label %96, label %95

95:                                               ; preds = %91
  store i32 8, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %140

96:                                               ; preds = %91
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %97 = load ptr, ptr %3, align 8, !tbaa !5
  %98 = load i32, ptr %9, align 4, !tbaa !11
  %99 = sext i32 %98 to i64
  %100 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %97, i64 noundef %99) #6
  %101 = load ptr, ptr %3, align 8, !tbaa !5
  %102 = load i32, ptr %12, align 4, !tbaa !11
  %103 = sext i32 %102 to i64
  %104 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %101, i64 noundef %103) #6
  call void @_ZNK5Maths8TVector2IfEmiERKS1_(ptr dead_on_unwind writable sret(%"class.Maths::TVector2") align 4 %15, ptr noundef nonnull align 4 dereferenceable(8) %100, ptr noundef nonnull align 4 dereferenceable(8) %104)
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %105 = load ptr, ptr %3, align 8, !tbaa !5
  %106 = load i32, ptr %13, align 4, !tbaa !11
  %107 = sext i32 %106 to i64
  %108 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %105, i64 noundef %107) #6
  %109 = load ptr, ptr %3, align 8, !tbaa !5
  %110 = load i32, ptr %12, align 4, !tbaa !11
  %111 = sext i32 %110 to i64
  %112 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %109, i64 noundef %111) #6
  call void @_ZNK5Maths8TVector2IfEmiERKS1_(ptr dead_on_unwind writable sret(%"class.Maths::TVector2") align 4 %16, ptr noundef nonnull align 4 dereferenceable(8) %108, ptr noundef nonnull align 4 dereferenceable(8) %112)
  %113 = call noundef float @_ZNK5Maths8TVector2IfE5CrossERKS1_(ptr noundef nonnull align 4 dereferenceable(8) %15, ptr noundef nonnull align 4 dereferenceable(8) %16)
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  store float %113, ptr %14, align 4, !tbaa !9
  %114 = load float, ptr %14, align 4, !tbaa !9
  %115 = fcmp olt float %114, 0xBEE4F8B580000000
  br i1 %115, label %134, label %116

116:                                              ; preds = %96
  %117 = load float, ptr %14, align 4, !tbaa !9
  %118 = call float @llvm.fabs.f32(float %117)
  %119 = fcmp ole float %118, 0x3EE4F8B580000000
  br i1 %119, label %120, label %136

120:                                              ; preds = %116
  %121 = load ptr, ptr %3, align 8, !tbaa !5
  %122 = load i32, ptr %12, align 4, !tbaa !11
  %123 = sext i32 %122 to i64
  %124 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %121, i64 noundef %123) #6
  %125 = load ptr, ptr %3, align 8, !tbaa !5
  %126 = load i32, ptr %9, align 4, !tbaa !11
  %127 = sext i32 %126 to i64
  %128 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %125, i64 noundef %127) #6
  %129 = load ptr, ptr %3, align 8, !tbaa !5
  %130 = load i32, ptr %13, align 4, !tbaa !11
  %131 = sext i32 %130 to i64
  %132 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %129, i64 noundef %131) #6
  %133 = call noundef zeroext i1 @_ZN7RiemannL9IsFarAwayERKN5Maths8TVector2IfEES4_S4_(ptr noundef nonnull align 4 dereferenceable(8) %124, ptr noundef nonnull align 4 dereferenceable(8) %128, ptr noundef nonnull align 4 dereferenceable(8) %132)
  br i1 %133, label %134, label %136

134:                                              ; preds = %120, %96
  %135 = load i32, ptr %13, align 4, !tbaa !11
  store i32 %135, ptr %9, align 4, !tbaa !11
  br label %136

136:                                              ; preds = %134, %120, %116
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %137

137:                                              ; preds = %136
  %138 = load i32, ptr %13, align 4, !tbaa !11
  %139 = add nsw i32 %138, 1
  store i32 %139, ptr %13, align 4, !tbaa !11
  br label %91, !llvm.loop !18

140:                                              ; preds = %95
  %141 = load i32, ptr %9, align 4, !tbaa !11
  %142 = load i32, ptr %7, align 4, !tbaa !11
  %143 = icmp eq i32 %141, %142
  br i1 %143, label %144, label %145

144:                                              ; preds = %140
  store i32 5, ptr %11, align 4
  br label %151

145:                                              ; preds = %140
  %146 = load ptr, ptr %4, align 8, !tbaa !5
  %147 = load ptr, ptr %3, align 8, !tbaa !5
  %148 = load i32, ptr %9, align 4, !tbaa !11
  %149 = sext i32 %148 to i64
  %150 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %147, i64 noundef %149) #6
  call void @_ZNSt6vectorIN5Maths8TVector2IfEESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %146, ptr noundef nonnull align 4 dereferenceable(8) %150)
  store i32 0, ptr %11, align 4
  br label %151

151:                                              ; preds = %145, %144
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  %152 = load i32, ptr %11, align 4
  switch i32 %152, label %157 [
    i32 0, label %153
  ]

153:                                              ; preds = %151
  br label %154

154:                                              ; preds = %153
  %155 = load i32, ptr %10, align 4, !tbaa !11
  %156 = add nsw i32 %155, 1
  store i32 %156, ptr %10, align 4, !tbaa !11
  br label %83, !llvm.loop !19

157:                                              ; preds = %151, %87
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %158

158:                                              ; preds = %157
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  ret void
}

; Function Attrs: mustprogress uwtable
declare hidden noundef zeroext i1 @_ZN7RiemannL9IsFarAwayERKN5Maths8TVector2IfEES4_S4_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #3

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !10, i64 4}
!14 = !{!"_ZTSN5Maths8TVector2IfEE", !10, i64 0, !10, i64 4}
!15 = !{!14, !10, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}
!19 = distinct !{!19, !17}


; 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.Maths::TVector2" = type { float, float }

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fabs.f32(float) #2

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Maths8TVector2IfEmiERKS1_(ptr dead_on_unwind noalias writable sret(%"class.Maths::TVector2") align 4, ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK5Maths8TVector2IfE5CrossERKS1_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7Riemann23ConvexHull_GiftWrappingERKSt6vectorIN5Maths8TVector2IfEESaIS3_EEPS5_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %1) local_unnamed_addr #3 {
  %3 = alloca %"class.Maths::TVector2", align 4
  %4 = alloca %"class.Maths::TVector2", align 4
  %5 = tail call noundef i64 @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  %6 = trunc i64 %5 to i32
  %7 = icmp sgt i32 %6, 1
  br i1 %7, label %.lr.ph.preheader, label %._crit_edge

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

._crit_edge:                                      ; preds = %61, %2
  %.0.lcssa = phi i32 [ 0, %2 ], [ %.1, %61 ]
  %8 = sext i32 %.0.lcssa to i64
  %9 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %8) #6
  tail call void @_ZNSt6vectorIN5Maths8TVector2IfEESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 4 dereferenceable(8) %9)
  br i1 %7, label %.preheader.us.preheader, label %.critedge

.preheader.us.preheader:                          ; preds = %._crit_edge
  %wide.trip.count73 = and i64 %5, 2147483647
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %11
  %.05467.us = phi i32 [ %14, %11 ], [ 1, %.preheader.us.preheader ]
  %.05566.us = phi i32 [ %.2.us, %11 ], [ %.0.lcssa, %.preheader.us.preheader ]
  %10 = sext i32 %.05566.us to i64
  br label %15

11:                                               ; preds = %._crit_edge64.us
  %12 = sext i32 %.2.us to i64
  %13 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %12) #6
  call void @_ZNSt6vectorIN5Maths8TVector2IfEESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 4 dereferenceable(8) %13)
  %14 = add nuw nsw i32 %.05467.us, 1
  %exitcond75.not = icmp eq i32 %14, %6
  br i1 %exitcond75.not, label %.critedge, label %.preheader.us, !llvm.loop !5

15:                                               ; preds = %.preheader.us, %33
  %indvars.iv70 = phi i64 [ 0, %.preheader.us ], [ %indvars.iv.next71, %33 ]
  %.15661.us = phi i32 [ %.05566.us, %.preheader.us ], [ %.2.us, %33 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %16 = sext i32 %.15661.us to i64
  %17 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %16) #6
  %18 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %10) #6
  call void @_ZNK5Maths8TVector2IfEmiERKS1_(ptr dead_on_unwind nonnull writable sret(%"class.Maths::TVector2") align 4 %3, ptr noundef nonnull align 4 dereferenceable(8) %17, ptr noundef nonnull align 4 dereferenceable(8) %18)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %19 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %indvars.iv70) #6
  %20 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %10) #6
  call void @_ZNK5Maths8TVector2IfEmiERKS1_(ptr dead_on_unwind nonnull writable sret(%"class.Maths::TVector2") align 4 %4, ptr noundef nonnull align 4 dereferenceable(8) %19, ptr noundef nonnull align 4 dereferenceable(8) %20)
  %21 = call noundef float @_ZNK5Maths8TVector2IfE5CrossERKS1_(ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  %22 = fcmp olt float %21, 0xBEE4F8B580000000
  br i1 %22, label %31, label %23

23:                                               ; preds = %15
  %24 = call float @llvm.fabs.f32(float %21)
  %25 = fcmp ugt float %24, 0x3EE4F8B580000000
  br i1 %25, label %33, label %26

26:                                               ; preds = %23
  %27 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %10) #6
  %28 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %16) #6
  %29 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %indvars.iv70) #6
  %30 = call noundef zeroext i1 @_ZN7RiemannL9IsFarAwayERKN5Maths8TVector2IfEES4_S4_(ptr noundef nonnull align 4 dereferenceable(8) %27, ptr noundef nonnull align 4 dereferenceable(8) %28, ptr noundef nonnull align 4 dereferenceable(8) %29)
  br i1 %30, label %31, label %33

31:                                               ; preds = %26, %15
  %32 = trunc nuw nsw i64 %indvars.iv70 to i32
  br label %33

33:                                               ; preds = %31, %26, %23
  %.2.us = phi i32 [ %32, %31 ], [ %.15661.us, %26 ], [ %.15661.us, %23 ]
  %indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
  %exitcond74.not = icmp eq i64 %indvars.iv.next71, %wide.trip.count73
  br i1 %exitcond74.not, label %._crit_edge64.us, label %15, !llvm.loop !7

._crit_edge64.us:                                 ; preds = %33
  %.not.us = icmp eq i32 %.2.us, %.0.lcssa
  br i1 %.not.us, label %.critedge, label %11

.lr.ph:                                           ; preds = %.lr.ph.preheader, %61
  %indvars.iv = phi i64 [ 1, %.lr.ph.preheader ], [ %indvars.iv.next, %61 ]
  %.060 = phi i32 [ 0, %.lr.ph.preheader ], [ %.1, %61 ]
  %34 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %indvars.iv) #6
  %35 = getelementptr inbounds i8, ptr %34, i64 4
  %36 = load float, ptr %35, align 4, !tbaa !8
  %37 = sext i32 %.060 to i64
  %38 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %37) #6
  %39 = getelementptr inbounds i8, ptr %38, i64 4
  %40 = load float, ptr %39, align 4, !tbaa !8
  %41 = fadd float %40, 0xBEE4F8B580000000
  %42 = fcmp olt float %36, %41
  br i1 %42, label %59, label %43

43:                                               ; preds = %.lr.ph
  %44 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %indvars.iv) #6
  %45 = getelementptr inbounds i8, ptr %44, i64 4
  %46 = load float, ptr %45, align 4, !tbaa !8
  %47 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %37) #6
  %48 = getelementptr inbounds i8, ptr %47, i64 4
  %49 = load float, ptr %48, align 4, !tbaa !8
  %50 = fsub float %46, %49
  %51 = tail call float @llvm.fabs.f32(float %50)
  %52 = fcmp ugt float %51, 0x3EE4F8B580000000
  br i1 %52, label %61, label %53

53:                                               ; preds = %43
  %54 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %indvars.iv) #6
  %55 = load float, ptr %54, align 4, !tbaa !13
  %56 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt6vectorIN5Maths8TVector2IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %37) #6
  %57 = load float, ptr %56, align 4, !tbaa !13
  %58 = fcmp olt float %55, %57
  br i1 %58, label %59, label %61

59:                                               ; preds = %53, %.lr.ph
  %60 = trunc nuw nsw i64 %indvars.iv to i32
  br label %61

61:                                               ; preds = %43, %53, %59
  %.1 = phi i32 [ %60, %59 ], [ %.060, %53 ], [ %.060, %43 ]
  %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 !14

.critedge:                                        ; preds = %11, %._crit_edge64.us, %._crit_edge
  ret void
}

; Function Attrs: mustprogress uwtable
declare hidden noundef zeroext i1 @_ZN7RiemannL9IsFarAwayERKN5Maths8TVector2IfEES4_S4_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #3

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = !{!9, !10, i64 4}
!9 = !{!"_ZTSN5Maths8TVector2IfEE", !10, i64 0, !10, i64 4}
!10 = !{!"float", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C++ TBAA"}
!13 = !{!9, !10, i64 0}
!14 = distinct !{!14, !6}


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