; LLVM IR from idmillington/cyclone-physics :: src (collide_fine)

; 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.cyclone::Vector3" = type { double, double, double, double }
%"struct.cyclone::CollisionData" = type { ptr, ptr, i32, i32, double, double, double }
%"class.cyclone::CollisionBox" = type { %"class.cyclone::CollisionPrimitive", %"class.cyclone::Vector3" }
%"class.cyclone::CollisionPrimitive" = type { ptr, %"class.cyclone::Matrix4", %"class.cyclone::Matrix4" }
%"class.cyclone::Matrix4" = type { [12 x double] }
%"class.cyclone::CollisionPlane" = type { %"class.cyclone::Vector3", double }
%"class.cyclone::Contact" = type { [2 x ptr], double, double, %"class.cyclone::Vector3", %"class.cyclone::Vector3", double, %"class.cyclone::Matrix3", %"class.cyclone::Vector3", double, [2 x %"class.cyclone::Vector3"] }
%"class.cyclone::Matrix3" = type { [9 x double] }

@_ZZN7cyclone17CollisionDetector15boxAndHalfSpaceERKNS_12CollisionBoxERKNS_14CollisionPlaneEPNS_13CollisionDataEE5mults = external hidden global [8 x [3 x double]], align 16

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; 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 double @_ZNK7cyclone7Vector3mlERKS0_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7cyclone17IntersectionTests15boxAndHalfSpaceERKNS_12CollisionBoxERKNS_14CollisionPlaneE(ptr noundef nonnull align 8 dereferenceable(232), ptr noundef nonnull align 8 dereferenceable(40)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7cyclone7Vector3mLEd(ptr noundef nonnull align 8 dereferenceable(32), double noundef) #2 align 2

declare void @_ZN7cyclone7Contact11setBodyDataEPNS_9RigidBodyES2_dd(ptr noundef nonnull align 8 dereferenceable(280), ptr noundef, ptr noundef, double noundef, double noundef) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7cyclone13CollisionData11addContactsEj(ptr noundef nonnull align 8 dereferenceable(48), i32 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7cyclone7Vector3C2Eddd(ptr noundef nonnull align 8 dereferenceable(32), double noundef, double noundef, double noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7cyclone7Matrix49transformERKNS_7Vector3E(ptr dead_on_unwind noalias writable sret(%"class.cyclone::Vector3") align 8, ptr noundef nonnull align 8 dereferenceable(96), ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN7cyclone17CollisionDetector15boxAndHalfSpaceERKNS_12CollisionBoxERKNS_14CollisionPlaneEPNS_13CollisionDataE(ptr noundef nonnull align 8 dereferenceable(232) %0, ptr noundef nonnull align 8 dereferenceable(40) %1, ptr noundef %2) #3 align 2 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %"class.cyclone::Vector3", align 8
  %13 = alloca %"class.cyclone::Vector3", align 8
  %14 = alloca double, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %15 = load ptr, ptr %7, align 8, !tbaa !5
  %16 = getelementptr inbounds %"struct.cyclone::CollisionData", ptr %15, i32 0, i32 2
  %17 = load i32, ptr %16, align 8, !tbaa !9
  %18 = icmp sle i32 %17, 0
  br i1 %18, label %19, label %20

19:                                               ; preds = %3
  store i32 0, ptr %4, align 4
  br label %122

20:                                               ; preds = %3
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = call noundef zeroext i1 @_ZN7cyclone17IntersectionTests15boxAndHalfSpaceERKNS_12CollisionBoxERKNS_14CollisionPlaneE(ptr noundef nonnull align 8 dereferenceable(232) %21, ptr noundef nonnull align 8 dereferenceable(40) %22)
  br i1 %23, label %25, label %24

24:                                               ; preds = %20
  store i32 0, ptr %4, align 4
  br label %122

25:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = getelementptr inbounds %"struct.cyclone::CollisionData", ptr %26, i32 0, i32 1
  %28 = load ptr, ptr %27, align 8, !tbaa !13
  store ptr %28, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !14
  br label %29

29:                                               ; preds = %112, %25
  %30 = load i32, ptr %10, align 4, !tbaa !14
  %31 = icmp ult i32 %30, 8
  br i1 %31, label %33, label %32

32:                                               ; preds = %29
  store i32 2, ptr %11, align 4
  br label %115

33:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 32, ptr %12) #5
  %34 = load i32, ptr %10, align 4, !tbaa !14
  %35 = zext i32 %34 to i64
  %36 = getelementptr inbounds [8 x [3 x double]], ptr @_ZZN7cyclone17CollisionDetector15boxAndHalfSpaceERKNS_12CollisionBoxERKNS_14CollisionPlaneEPNS_13CollisionDataEE5mults, i64 0, i64 %35
  %37 = getelementptr inbounds [3 x double], ptr %36, i64 0, i64 0
  %38 = load double, ptr %37, align 8, !tbaa !15
  %39 = load i32, ptr %10, align 4, !tbaa !14
  %40 = zext i32 %39 to i64
  %41 = getelementptr inbounds [8 x [3 x double]], ptr @_ZZN7cyclone17CollisionDetector15boxAndHalfSpaceERKNS_12CollisionBoxERKNS_14CollisionPlaneEPNS_13CollisionDataEE5mults, i64 0, i64 %40
  %42 = getelementptr inbounds [3 x double], ptr %41, i64 0, i64 1
  %43 = load double, ptr %42, align 8, !tbaa !15
  %44 = load i32, ptr %10, align 4, !tbaa !14
  %45 = zext i32 %44 to i64
  %46 = getelementptr inbounds [8 x [3 x double]], ptr @_ZZN7cyclone17CollisionDetector15boxAndHalfSpaceERKNS_12CollisionBoxERKNS_14CollisionPlaneEPNS_13CollisionDataEE5mults, i64 0, i64 %45
  %47 = getelementptr inbounds [3 x double], ptr %46, i64 0, i64 2
  %48 = load double, ptr %47, align 8, !tbaa !15
  call void @_ZN7cyclone7Vector3C2Eddd(ptr noundef nonnull align 8 dereferenceable(32) %12, double noundef %38, double noundef %43, double noundef %48)
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = getelementptr inbounds %"class.cyclone::CollisionBox", ptr %49, i32 0, i32 1
  call void @_ZN7cyclone7Vector322componentProductUpdateERKS0_(ptr noundef nonnull align 8 dereferenceable(32) %12, ptr noundef nonnull align 8 dereferenceable(32) %50)
  call void @llvm.lifetime.start.p0(i64 32, ptr %13) #5
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = getelementptr inbounds %"class.cyclone::CollisionPrimitive", ptr %51, i32 0, i32 2
  call void @_ZNK7cyclone7Matrix49transformERKNS_7Vector3E(ptr dead_on_unwind writable sret(%"class.cyclone::Vector3") align 8 %13, ptr noundef nonnull align 8 dereferenceable(96) %52, ptr noundef nonnull align 8 dereferenceable(32) %12)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %12, ptr align 8 %13, i64 32, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %53 = load ptr, ptr %6, align 8, !tbaa !5
  %54 = getelementptr inbounds %"class.cyclone::CollisionPlane", ptr %53, i32 0, i32 0
  %55 = call noundef double @_ZNK7cyclone7Vector3mlERKS0_(ptr noundef nonnull align 8 dereferenceable(32) %12, ptr noundef nonnull align 8 dereferenceable(32) %54)
  store double %55, ptr %14, align 8, !tbaa !15
  %56 = load double, ptr %14, align 8, !tbaa !15
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = getelementptr inbounds %"class.cyclone::CollisionPlane", ptr %57, i32 0, i32 1
  %59 = load double, ptr %58, align 8, !tbaa !17
  %60 = fcmp ole double %56, %59
  br i1 %60, label %61, label %108

61:                                               ; preds = %33
  %62 = load ptr, ptr %6, align 8, !tbaa !5
  %63 = getelementptr inbounds %"class.cyclone::CollisionPlane", ptr %62, i32 0, i32 0
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  %65 = getelementptr inbounds %"class.cyclone::Contact", ptr %64, i32 0, i32 3
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %65, ptr align 8 %63, i64 32, i1 false), !tbaa.struct !16
  %66 = load double, ptr %14, align 8, !tbaa !15
  %67 = load ptr, ptr %6, align 8, !tbaa !5
  %68 = getelementptr inbounds %"class.cyclone::CollisionPlane", ptr %67, i32 0, i32 1
  %69 = load double, ptr %68, align 8, !tbaa !17
  %70 = fsub double %66, %69
  %71 = load ptr, ptr %8, align 8, !tbaa !5
  %72 = getelementptr inbounds %"class.cyclone::Contact", ptr %71, i32 0, i32 3
  call void @_ZN7cyclone7Vector3mLEd(ptr noundef nonnull align 8 dereferenceable(32) %72, double noundef %70)
  %73 = load ptr, ptr %8, align 8, !tbaa !5
  %74 = getelementptr inbounds %"class.cyclone::Contact", ptr %73, i32 0, i32 3
  call void @_ZN7cyclone7Vector3pLERKS0_(ptr noundef nonnull align 8 dereferenceable(32) %74, ptr noundef nonnull align 8 dereferenceable(32) %12)
  %75 = load ptr, ptr %6, align 8, !tbaa !5
  %76 = getelementptr inbounds %"class.cyclone::CollisionPlane", ptr %75, i32 0, i32 0
  %77 = load ptr, ptr %8, align 8, !tbaa !5
  %78 = getelementptr inbounds %"class.cyclone::Contact", ptr %77, i32 0, i32 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %78, ptr align 8 %76, i64 32, i1 false), !tbaa.struct !16
  %79 = load ptr, ptr %6, align 8, !tbaa !5
  %80 = getelementptr inbounds %"class.cyclone::CollisionPlane", ptr %79, i32 0, i32 1
  %81 = load double, ptr %80, align 8, !tbaa !17
  %82 = load double, ptr %14, align 8, !tbaa !15
  %83 = fsub double %81, %82
  %84 = load ptr, ptr %8, align 8, !tbaa !5
  %85 = getelementptr inbounds %"class.cyclone::Contact", ptr %84, i32 0, i32 5
  store double %83, ptr %85, align 8, !tbaa !20
  %86 = load ptr, ptr %8, align 8, !tbaa !5
  %87 = load ptr, ptr %5, align 8, !tbaa !5
  %88 = getelementptr inbounds %"class.cyclone::CollisionPrimitive", ptr %87, i32 0, i32 0
  %89 = load ptr, ptr %88, align 8, !tbaa !23
  %90 = load ptr, ptr %7, align 8, !tbaa !5
  %91 = getelementptr inbounds %"struct.cyclone::CollisionData", ptr %90, i32 0, i32 4
  %92 = load double, ptr %91, align 8, !tbaa !26
  %93 = load ptr, ptr %7, align 8, !tbaa !5
  %94 = getelementptr inbounds %"struct.cyclone::CollisionData", ptr %93, i32 0, i32 5
  %95 = load double, ptr %94, align 8, !tbaa !27
  call void @_ZN7cyclone7Contact11setBodyDataEPNS_9RigidBodyES2_dd(ptr noundef nonnull align 8 dereferenceable(280) %86, ptr noundef %89, ptr noundef null, double noundef %92, double noundef %95)
  %96 = load ptr, ptr %8, align 8, !tbaa !5
  %97 = getelementptr inbounds %"class.cyclone::Contact", ptr %96, i32 1
  store ptr %97, ptr %8, align 8, !tbaa !5
  %98 = load i32, ptr %9, align 4, !tbaa !14
  %99 = add i32 %98, 1
  store i32 %99, ptr %9, align 4, !tbaa !14
  %100 = load i32, ptr %9, align 4, !tbaa !14
  %101 = load ptr, ptr %7, align 8, !tbaa !5
  %102 = getelementptr inbounds %"struct.cyclone::CollisionData", ptr %101, i32 0, i32 2
  %103 = load i32, ptr %102, align 8, !tbaa !9
  %104 = icmp eq i32 %100, %103
  br i1 %104, label %105, label %107

105:                                              ; preds = %61
  %106 = load i32, ptr %9, align 4, !tbaa !14
  store i32 %106, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %109

107:                                              ; preds = %61
  br label %108

108:                                              ; preds = %107, %33
  store i32 0, ptr %11, align 4
  br label %109

109:                                              ; preds = %108, %105
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %12) #5
  %110 = load i32, ptr %11, align 4
  switch i32 %110, label %115 [
    i32 0, label %111
  ]

111:                                              ; preds = %109
  br label %112

112:                                              ; preds = %111
  %113 = load i32, ptr %10, align 4, !tbaa !14
  %114 = add i32 %113, 1
  store i32 %114, ptr %10, align 4, !tbaa !14
  br label %29, !llvm.loop !28

115:                                              ; preds = %109, %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  %116 = load i32, ptr %11, align 4
  switch i32 %116, label %121 [
    i32 2, label %117
  ]

117:                                              ; preds = %115
  %118 = load ptr, ptr %7, align 8, !tbaa !5
  %119 = load i32, ptr %9, align 4, !tbaa !14
  call void @_ZN7cyclone13CollisionData11addContactsEj(ptr noundef nonnull align 8 dereferenceable(48) %118, i32 noundef %119)
  %120 = load i32, ptr %9, align 4, !tbaa !14
  store i32 %120, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %121

121:                                              ; preds = %117, %115
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %122

122:                                              ; preds = %121, %24, %19
  %123 = load i32, ptr %4, align 4
  ret i32 %123
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7cyclone7Vector322componentProductUpdateERKS0_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7cyclone7Vector3pLERKS0_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { "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, !11, i64 16}
!10 = !{!"_ZTSN7cyclone13CollisionDataE", !6, i64 0, !6, i64 8, !11, i64 16, !11, i64 20, !12, i64 24, !12, i64 32, !12, i64 40}
!11 = !{!"int", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!10, !6, i64 8}
!14 = !{!11, !11, i64 0}
!15 = !{!12, !12, i64 0}
!16 = !{i64 0, i64 8, !15, i64 8, i64 8, !15, i64 16, i64 8, !15, i64 24, i64 8, !15}
!17 = !{!18, !12, i64 32}
!18 = !{!"_ZTSN7cyclone14CollisionPlaneE", !19, i64 0, !12, i64 32}
!19 = !{!"_ZTSN7cyclone7Vector3E", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!20 = !{!21, !12, i64 96}
!21 = !{!"_ZTSN7cyclone7ContactE", !7, i64 0, !12, i64 16, !12, i64 24, !19, i64 32, !19, i64 64, !12, i64 96, !22, i64 104, !19, i64 176, !12, i64 208, !7, i64 216}
!22 = !{!"_ZTSN7cyclone7Matrix3E", !7, i64 0}
!23 = !{!24, !6, i64 0}
!24 = !{!"_ZTSN7cyclone18CollisionPrimitiveE", !6, i64 0, !25, i64 8, !25, i64 104}
!25 = !{!"_ZTSN7cyclone7Matrix4E", !7, i64 0}
!26 = !{!10, !12, i64 24}
!27 = !{!10, !12, i64 32}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.cyclone::Vector3" = type { double, double, double, double }

@_ZZN7cyclone17CollisionDetector15boxAndHalfSpaceERKNS_12CollisionBoxERKNS_14CollisionPlaneEPNS_13CollisionDataEE5mults = external hidden local_unnamed_addr global [8 x [3 x double]], align 16

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; 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 double @_ZNK7cyclone7Vector3mlERKS0_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7cyclone17IntersectionTests15boxAndHalfSpaceERKNS_12CollisionBoxERKNS_14CollisionPlaneE(ptr noundef nonnull align 8 dereferenceable(232), ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7cyclone7Vector3mLEd(ptr noundef nonnull align 8 dereferenceable(32), double noundef) local_unnamed_addr #2 align 2

declare void @_ZN7cyclone7Contact11setBodyDataEPNS_9RigidBodyES2_dd(ptr noundef nonnull align 8 dereferenceable(280), ptr noundef, ptr noundef, double noundef, double noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7cyclone13CollisionData11addContactsEj(ptr noundef nonnull align 8 dereferenceable(48), i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7cyclone7Vector3C2Eddd(ptr noundef nonnull align 8 dereferenceable(32), double noundef, double noundef, double noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7cyclone7Matrix49transformERKNS_7Vector3E(ptr dead_on_unwind noalias writable sret(%"class.cyclone::Vector3") align 8, ptr noundef nonnull align 8 dereferenceable(96), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN7cyclone17CollisionDetector15boxAndHalfSpaceERKNS_12CollisionBoxERKNS_14CollisionPlaneEPNS_13CollisionDataE(ptr noundef nonnull align 8 dereferenceable(232) %0, ptr noundef nonnull align 8 dereferenceable(40) %1, ptr noundef %2) local_unnamed_addr #3 align 2 {
  %4 = alloca %"class.cyclone::Vector3", align 8
  %5 = alloca %"class.cyclone::Vector3", align 8
  %6 = getelementptr inbounds i8, ptr %2, i64 16
  %7 = load i32, ptr %6, align 8, !tbaa !5
  %8 = icmp slt i32 %7, 1
  br i1 %8, label %.loopexit, label %9

9:                                                ; preds = %3
  %10 = tail call noundef zeroext i1 @_ZN7cyclone17IntersectionTests15boxAndHalfSpaceERKNS_12CollisionBoxERKNS_14CollisionPlaneE(ptr noundef nonnull align 8 dereferenceable(232) %0, ptr noundef nonnull align 8 dereferenceable(40) %1)
  br i1 %10, label %11, label %.loopexit

11:                                               ; preds = %9
  %12 = getelementptr inbounds i8, ptr %2, i64 8
  %13 = load ptr, ptr %12, align 8, !tbaa !12
  %14 = getelementptr inbounds i8, ptr %0, i64 200
  %15 = getelementptr inbounds i8, ptr %0, i64 104
  %16 = getelementptr inbounds i8, ptr %1, i64 32
  %17 = getelementptr inbounds i8, ptr %2, i64 24
  %18 = getelementptr inbounds i8, ptr %2, i64 32
  br label %19

19:                                               ; preds = %11, %43
  %indvars.iv = phi i64 [ 0, %11 ], [ %indvars.iv.next, %43 ]
  %.04367 = phi i32 [ 0, %11 ], [ %.24559, %43 ]
  %.04766 = phi ptr [ %13, %11 ], [ %.24958, %43 ]
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #5
  %20 = getelementptr inbounds [8 x [3 x double]], ptr @_ZZN7cyclone17CollisionDetector15boxAndHalfSpaceERKNS_12CollisionBoxERKNS_14CollisionPlaneEPNS_13CollisionDataEE5mults, i64 0, i64 %indvars.iv
  %21 = load double, ptr %20, align 8, !tbaa !13
  %22 = getelementptr inbounds i8, ptr %20, i64 8
  %23 = load double, ptr %22, align 8, !tbaa !13
  %24 = getelementptr inbounds i8, ptr %20, i64 16
  %25 = load double, ptr %24, align 8, !tbaa !13
  call void @_ZN7cyclone7Vector3C2Eddd(ptr noundef nonnull align 8 dereferenceable(32) %4, double noundef %21, double noundef %23, double noundef %25)
  call void @_ZN7cyclone7Vector322componentProductUpdateERKS0_(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef nonnull align 8 dereferenceable(32) %14)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #5
  call void @_ZNK7cyclone7Matrix49transformERKNS_7Vector3E(ptr dead_on_unwind nonnull writable sret(%"class.cyclone::Vector3") align 8 %5, ptr noundef nonnull align 8 dereferenceable(96) %15, ptr noundef nonnull align 8 dereferenceable(32) %4)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef nonnull align 8 dereferenceable(32) %5, i64 32, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #5
  %26 = call noundef double @_ZNK7cyclone7Vector3mlERKS0_(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef nonnull align 8 dereferenceable(32) %1)
  %27 = load double, ptr %16, align 8, !tbaa !15
  %28 = fcmp ugt double %26, %27
  br i1 %28, label %.thread, label %29

.thread:                                          ; preds = %19
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #5
  br label %43

29:                                               ; preds = %19
  %30 = getelementptr inbounds i8, ptr %.04766, i64 32
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %30, ptr noundef nonnull align 8 dereferenceable(32) %1, i64 32, i1 false), !tbaa.struct !14
  %31 = load double, ptr %16, align 8, !tbaa !15
  %32 = fsub double %26, %31
  call void @_ZN7cyclone7Vector3mLEd(ptr noundef nonnull align 8 dereferenceable(32) %30, double noundef %32)
  call void @_ZN7cyclone7Vector3pLERKS0_(ptr noundef nonnull align 8 dereferenceable(32) %30, ptr noundef nonnull align 8 dereferenceable(32) %4)
  %33 = getelementptr inbounds i8, ptr %.04766, i64 64
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %33, ptr noundef nonnull align 8 dereferenceable(32) %1, i64 32, i1 false), !tbaa.struct !14
  %34 = load double, ptr %16, align 8, !tbaa !15
  %35 = fsub double %34, %26
  %36 = getelementptr inbounds i8, ptr %.04766, i64 96
  store double %35, ptr %36, align 8, !tbaa !18
  %37 = load ptr, ptr %0, align 8, !tbaa !21
  %38 = load double, ptr %17, align 8, !tbaa !24
  %39 = load double, ptr %18, align 8, !tbaa !25
  call void @_ZN7cyclone7Contact11setBodyDataEPNS_9RigidBodyES2_dd(ptr noundef nonnull align 8 dereferenceable(280) %.04766, ptr noundef %37, ptr noundef null, double noundef %38, double noundef %39)
  %40 = getelementptr inbounds i8, ptr %.04766, i64 280
  %41 = add i32 %.04367, 1
  %42 = load i32, ptr %6, align 8, !tbaa !5
  %.not = icmp eq i32 %41, %42
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #5
  br i1 %.not, label %.loopexit, label %43

43:                                               ; preds = %.thread, %29
  %.24559 = phi i32 [ %.04367, %.thread ], [ %41, %29 ]
  %.24958 = phi ptr [ %.04766, %.thread ], [ %40, %29 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond = icmp eq i64 %indvars.iv.next, 8
  br i1 %exitcond, label %44, label %19, !llvm.loop !26

44:                                               ; preds = %43
  call void @_ZN7cyclone13CollisionData11addContactsEj(ptr noundef nonnull align 8 dereferenceable(48) %2, i32 noundef %.24559)
  br label %.loopexit

.loopexit:                                        ; preds = %29, %44, %9, %3
  %.4 = phi i32 [ 0, %3 ], [ 0, %9 ], [ %.24559, %44 ], [ %41, %29 ]
  ret i32 %.4
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7cyclone7Vector322componentProductUpdateERKS0_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7cyclone7Vector3pLERKS0_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { "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, !10, i64 16}
!6 = !{!"_ZTSN7cyclone13CollisionDataE", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 20, !11, i64 24, !11, i64 32, !11, i64 40}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = !{!6, !7, i64 8}
!13 = !{!11, !11, i64 0}
!14 = !{i64 0, i64 8, !13, i64 8, i64 8, !13, i64 16, i64 8, !13, i64 24, i64 8, !13}
!15 = !{!16, !11, i64 32}
!16 = !{!"_ZTSN7cyclone14CollisionPlaneE", !17, i64 0, !11, i64 32}
!17 = !{!"_ZTSN7cyclone7Vector3E", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!18 = !{!19, !11, i64 96}
!19 = !{!"_ZTSN7cyclone7ContactE", !8, i64 0, !11, i64 16, !11, i64 24, !17, i64 32, !17, i64 64, !11, i64 96, !20, i64 104, !17, i64 176, !11, i64 208, !8, i64 216}
!20 = !{!"_ZTSN7cyclone7Matrix3E", !8, i64 0}
!21 = !{!22, !7, i64 0}
!22 = !{!"_ZTSN7cyclone18CollisionPrimitiveE", !7, i64 0, !23, i64 8, !23, i64 104}
!23 = !{!"_ZTSN7cyclone7Matrix4E", !8, i64 0}
!24 = !{!6, !11, i64 24}
!25 = !{!6, !11, i64 32}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}


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