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

; 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 uwtable
declare dso_local void @_ZNK7cyclone18CollisionPrimitive7getAxisEj(ptr dead_on_unwind noalias writable sret(%"class.cyclone::Vector3") align 8, ptr noundef nonnull align 8 dereferenceable(200), i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7cyclone7Vector3miERKS0_(ptr dead_on_unwind noalias writable sret(%"class.cyclone::Vector3") align 8, 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 noundef double @_ZNK7cyclone7Vector315squareMagnitudeEv(ptr noundef nonnull align 8 dereferenceable(32)) #3 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) #3 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7cyclone7Matrix416transformInverseERKNS_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)) #2 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #5

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN7cyclone17CollisionDetector12boxAndSphereERKNS_12CollisionBoxERKNS_15CollisionSphereEPNS_13CollisionDataE(ptr noundef nonnull align 8 dereferenceable(232) %0, ptr noundef nonnull align 8 dereferenceable(208) %1, ptr noundef %2) #2 align 2 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %"class.cyclone::Vector3", align 8
  %9 = alloca %"class.cyclone::Vector3", align 8
  %10 = alloca i32, align 4
  %11 = alloca %"class.cyclone::Vector3", align 8
  %12 = alloca double, align 8
  %13 = alloca %"class.cyclone::Vector3", align 8
  %14 = alloca %"class.cyclone::Vector3", align 8
  %15 = alloca ptr, align 8
  %16 = alloca %"class.cyclone::Vector3", 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
  call void @llvm.lifetime.start.p0(i64 32, ptr %8) #7
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZNK7cyclone18CollisionPrimitive7getAxisEj(ptr dead_on_unwind writable sret(%"class.cyclone::Vector3") align 8 %8, ptr noundef nonnull align 8 dereferenceable(200) %17, i32 noundef 3)
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #7
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds %"class.cyclone::CollisionPrimitive", ptr %18, i32 0, i32 2
  call void @_ZNK7cyclone7Matrix416transformInverseERKNS_7Vector3E(ptr dead_on_unwind writable sret(%"class.cyclone::Vector3") align 8 %9, ptr noundef nonnull align 8 dereferenceable(96) %19, ptr noundef nonnull align 8 dereferenceable(32) %8)
  %20 = getelementptr inbounds %"class.cyclone::Vector3", ptr %9, i32 0, i32 0
  %21 = load double, ptr %20, align 8, !tbaa !9
  %22 = call double @llvm.fabs.f64(double %21)
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = getelementptr inbounds %"class.cyclone::CollisionSphere", ptr %23, i32 0, i32 1
  %25 = load double, ptr %24, align 8, !tbaa !12
  %26 = fsub double %22, %25
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds %"class.cyclone::CollisionBox", ptr %27, i32 0, i32 1
  %29 = getelementptr inbounds %"class.cyclone::Vector3", ptr %28, i32 0, i32 0
  %30 = load double, ptr %29, align 8, !tbaa !16
  %31 = fcmp ogt double %26, %30
  br i1 %31, label %58, label %32

32:                                               ; preds = %3
  %33 = getelementptr inbounds %"class.cyclone::Vector3", ptr %9, i32 0, i32 1
  %34 = load double, ptr %33, align 8, !tbaa !18
  %35 = call double @llvm.fabs.f64(double %34)
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = getelementptr inbounds %"class.cyclone::CollisionSphere", ptr %36, i32 0, i32 1
  %38 = load double, ptr %37, align 8, !tbaa !12
  %39 = fsub double %35, %38
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = getelementptr inbounds %"class.cyclone::CollisionBox", ptr %40, i32 0, i32 1
  %42 = getelementptr inbounds %"class.cyclone::Vector3", ptr %41, i32 0, i32 1
  %43 = load double, ptr %42, align 8, !tbaa !19
  %44 = fcmp ogt double %39, %43
  br i1 %44, label %58, label %45

45:                                               ; preds = %32
  %46 = getelementptr inbounds %"class.cyclone::Vector3", ptr %9, i32 0, i32 2
  %47 = load double, ptr %46, align 8, !tbaa !20
  %48 = call double @llvm.fabs.f64(double %47)
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = getelementptr inbounds %"class.cyclone::CollisionSphere", ptr %49, i32 0, i32 1
  %51 = load double, ptr %50, align 8, !tbaa !12
  %52 = fsub double %48, %51
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = getelementptr inbounds %"class.cyclone::CollisionBox", ptr %53, i32 0, i32 1
  %55 = getelementptr inbounds %"class.cyclone::Vector3", ptr %54, i32 0, i32 2
  %56 = load double, ptr %55, align 8, !tbaa !21
  %57 = fcmp ogt double %52, %56
  br i1 %57, label %58, label %59

58:                                               ; preds = %45, %32, %3
  store i32 0, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %196

59:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 32, ptr %11) #7
  call void @_ZN7cyclone7Vector3C2Eddd(ptr noundef nonnull align 8 dereferenceable(32) %11, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00)
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %60 = getelementptr inbounds %"class.cyclone::Vector3", ptr %9, i32 0, i32 0
  %61 = load double, ptr %60, align 8, !tbaa !9
  store double %61, ptr %12, align 8, !tbaa !22
  %62 = load double, ptr %12, align 8, !tbaa !22
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = getelementptr inbounds %"class.cyclone::CollisionBox", ptr %63, i32 0, i32 1
  %65 = getelementptr inbounds %"class.cyclone::Vector3", ptr %64, i32 0, i32 0
  %66 = load double, ptr %65, align 8, !tbaa !16
  %67 = fcmp ogt double %62, %66
  br i1 %67, label %68, label %73

68:                                               ; preds = %59
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = getelementptr inbounds %"class.cyclone::CollisionBox", ptr %69, i32 0, i32 1
  %71 = getelementptr inbounds %"class.cyclone::Vector3", ptr %70, i32 0, i32 0
  %72 = load double, ptr %71, align 8, !tbaa !16
  store double %72, ptr %12, align 8, !tbaa !22
  br label %73

73:                                               ; preds = %68, %59
  %74 = load double, ptr %12, align 8, !tbaa !22
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = getelementptr inbounds %"class.cyclone::CollisionBox", ptr %75, i32 0, i32 1
  %77 = getelementptr inbounds %"class.cyclone::Vector3", ptr %76, i32 0, i32 0
  %78 = load double, ptr %77, align 8, !tbaa !16
  %79 = fneg double %78
  %80 = fcmp olt double %74, %79
  br i1 %80, label %81, label %87

81:                                               ; preds = %73
  %82 = load ptr, ptr %5, align 8, !tbaa !5
  %83 = getelementptr inbounds %"class.cyclone::CollisionBox", ptr %82, i32 0, i32 1
  %84 = getelementptr inbounds %"class.cyclone::Vector3", ptr %83, i32 0, i32 0
  %85 = load double, ptr %84, align 8, !tbaa !16
  %86 = fneg double %85
  store double %86, ptr %12, align 8, !tbaa !22
  br label %87

87:                                               ; preds = %81, %73
  %88 = load double, ptr %12, align 8, !tbaa !22
  %89 = getelementptr inbounds %"class.cyclone::Vector3", ptr %11, i32 0, i32 0
  store double %88, ptr %89, align 8, !tbaa !9
  %90 = getelementptr inbounds %"class.cyclone::Vector3", ptr %9, i32 0, i32 1
  %91 = load double, ptr %90, align 8, !tbaa !18
  store double %91, ptr %12, align 8, !tbaa !22
  %92 = load double, ptr %12, align 8, !tbaa !22
  %93 = load ptr, ptr %5, align 8, !tbaa !5
  %94 = getelementptr inbounds %"class.cyclone::CollisionBox", ptr %93, i32 0, i32 1
  %95 = getelementptr inbounds %"class.cyclone::Vector3", ptr %94, i32 0, i32 1
  %96 = load double, ptr %95, align 8, !tbaa !19
  %97 = fcmp ogt double %92, %96
  br i1 %97, label %98, label %103

98:                                               ; preds = %87
  %99 = load ptr, ptr %5, align 8, !tbaa !5
  %100 = getelementptr inbounds %"class.cyclone::CollisionBox", ptr %99, i32 0, i32 1
  %101 = getelementptr inbounds %"class.cyclone::Vector3", ptr %100, i32 0, i32 1
  %102 = load double, ptr %101, align 8, !tbaa !19
  store double %102, ptr %12, align 8, !tbaa !22
  br label %103

103:                                              ; preds = %98, %87
  %104 = load double, ptr %12, align 8, !tbaa !22
  %105 = load ptr, ptr %5, align 8, !tbaa !5
  %106 = getelementptr inbounds %"class.cyclone::CollisionBox", ptr %105, i32 0, i32 1
  %107 = getelementptr inbounds %"class.cyclone::Vector3", ptr %106, i32 0, i32 1
  %108 = load double, ptr %107, align 8, !tbaa !19
  %109 = fneg double %108
  %110 = fcmp olt double %104, %109
  br i1 %110, label %111, label %117

111:                                              ; preds = %103
  %112 = load ptr, ptr %5, align 8, !tbaa !5
  %113 = getelementptr inbounds %"class.cyclone::CollisionBox", ptr %112, i32 0, i32 1
  %114 = getelementptr inbounds %"class.cyclone::Vector3", ptr %113, i32 0, i32 1
  %115 = load double, ptr %114, align 8, !tbaa !19
  %116 = fneg double %115
  store double %116, ptr %12, align 8, !tbaa !22
  br label %117

117:                                              ; preds = %111, %103
  %118 = load double, ptr %12, align 8, !tbaa !22
  %119 = getelementptr inbounds %"class.cyclone::Vector3", ptr %11, i32 0, i32 1
  store double %118, ptr %119, align 8, !tbaa !18
  %120 = getelementptr inbounds %"class.cyclone::Vector3", ptr %9, i32 0, i32 2
  %121 = load double, ptr %120, align 8, !tbaa !20
  store double %121, ptr %12, align 8, !tbaa !22
  %122 = load double, ptr %12, align 8, !tbaa !22
  %123 = load ptr, ptr %5, align 8, !tbaa !5
  %124 = getelementptr inbounds %"class.cyclone::CollisionBox", ptr %123, i32 0, i32 1
  %125 = getelementptr inbounds %"class.cyclone::Vector3", ptr %124, i32 0, i32 2
  %126 = load double, ptr %125, align 8, !tbaa !21
  %127 = fcmp ogt double %122, %126
  br i1 %127, label %128, label %133

128:                                              ; preds = %117
  %129 = load ptr, ptr %5, align 8, !tbaa !5
  %130 = getelementptr inbounds %"class.cyclone::CollisionBox", ptr %129, i32 0, i32 1
  %131 = getelementptr inbounds %"class.cyclone::Vector3", ptr %130, i32 0, i32 2
  %132 = load double, ptr %131, align 8, !tbaa !21
  store double %132, ptr %12, align 8, !tbaa !22
  br label %133

133:                                              ; preds = %128, %117
  %134 = load double, ptr %12, align 8, !tbaa !22
  %135 = load ptr, ptr %5, align 8, !tbaa !5
  %136 = getelementptr inbounds %"class.cyclone::CollisionBox", ptr %135, i32 0, i32 1
  %137 = getelementptr inbounds %"class.cyclone::Vector3", ptr %136, i32 0, i32 2
  %138 = load double, ptr %137, align 8, !tbaa !21
  %139 = fneg double %138
  %140 = fcmp olt double %134, %139
  br i1 %140, label %141, label %147

141:                                              ; preds = %133
  %142 = load ptr, ptr %5, align 8, !tbaa !5
  %143 = getelementptr inbounds %"class.cyclone::CollisionBox", ptr %142, i32 0, i32 1
  %144 = getelementptr inbounds %"class.cyclone::Vector3", ptr %143, i32 0, i32 2
  %145 = load double, ptr %144, align 8, !tbaa !21
  %146 = fneg double %145
  store double %146, ptr %12, align 8, !tbaa !22
  br label %147

147:                                              ; preds = %141, %133
  %148 = load double, ptr %12, align 8, !tbaa !22
  %149 = getelementptr inbounds %"class.cyclone::Vector3", ptr %11, i32 0, i32 2
  store double %148, ptr %149, align 8, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 32, ptr %13) #7
  call void @_ZNK7cyclone7Vector3miERKS0_(ptr dead_on_unwind writable sret(%"class.cyclone::Vector3") align 8 %13, ptr noundef nonnull align 8 dereferenceable(32) %11, ptr noundef nonnull align 8 dereferenceable(32) %9)
  %150 = call noundef double @_ZNK7cyclone7Vector315squareMagnitudeEv(ptr noundef nonnull align 8 dereferenceable(32) %13)
  store double %150, ptr %12, align 8, !tbaa !22
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #7
  %151 = load double, ptr %12, align 8, !tbaa !22
  %152 = load ptr, ptr %6, align 8, !tbaa !5
  %153 = getelementptr inbounds %"class.cyclone::CollisionSphere", ptr %152, i32 0, i32 1
  %154 = load double, ptr %153, align 8, !tbaa !12
  %155 = load ptr, ptr %6, align 8, !tbaa !5
  %156 = getelementptr inbounds %"class.cyclone::CollisionSphere", ptr %155, i32 0, i32 1
  %157 = load double, ptr %156, align 8, !tbaa !12
  %158 = fmul double %154, %157
  %159 = fcmp ogt double %151, %158
  br i1 %159, label %160, label %161

160:                                              ; preds = %147
  store i32 0, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %195

161:                                              ; preds = %147
  call void @llvm.lifetime.start.p0(i64 32, ptr %14) #7
  %162 = load ptr, ptr %5, align 8, !tbaa !5
  %163 = getelementptr inbounds %"class.cyclone::CollisionPrimitive", ptr %162, i32 0, i32 2
  call void @_ZNK7cyclone7Matrix49transformERKNS_7Vector3E(ptr dead_on_unwind writable sret(%"class.cyclone::Vector3") align 8 %14, ptr noundef nonnull align 8 dereferenceable(96) %163, ptr noundef nonnull align 8 dereferenceable(32) %11)
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %164 = load ptr, ptr %7, align 8, !tbaa !5
  %165 = getelementptr inbounds %"struct.cyclone::CollisionData", ptr %164, i32 0, i32 1
  %166 = load ptr, ptr %165, align 8, !tbaa !23
  store ptr %166, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %16) #7
  call void @_ZNK7cyclone7Vector3miERKS0_(ptr dead_on_unwind writable sret(%"class.cyclone::Vector3") align 8 %16, ptr noundef nonnull align 8 dereferenceable(32) %14, ptr noundef nonnull align 8 dereferenceable(32) %8)
  %167 = load ptr, ptr %15, align 8, !tbaa !5
  %168 = getelementptr inbounds %"class.cyclone::Contact", ptr %167, i32 0, i32 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %168, ptr align 8 %16, i64 32, i1 false), !tbaa.struct !26
  call void @llvm.lifetime.end.p0(i64 32, ptr %16) #7
  %169 = load ptr, ptr %15, align 8, !tbaa !5
  %170 = getelementptr inbounds %"class.cyclone::Contact", ptr %169, i32 0, i32 4
  call void @_ZN7cyclone7Vector39normaliseEv(ptr noundef nonnull align 8 dereferenceable(32) %170)
  %171 = load ptr, ptr %15, align 8, !tbaa !5
  %172 = getelementptr inbounds %"class.cyclone::Contact", ptr %171, i32 0, i32 3
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %172, ptr align 8 %14, i64 32, i1 false), !tbaa.struct !26
  %173 = load ptr, ptr %6, align 8, !tbaa !5
  %174 = getelementptr inbounds %"class.cyclone::CollisionSphere", ptr %173, i32 0, i32 1
  %175 = load double, ptr %174, align 8, !tbaa !12
  %176 = load double, ptr %12, align 8, !tbaa !22
  %177 = call double @sqrt(double noundef %176) #7
  %178 = fsub double %175, %177
  %179 = load ptr, ptr %15, align 8, !tbaa !5
  %180 = getelementptr inbounds %"class.cyclone::Contact", ptr %179, i32 0, i32 5
  store double %178, ptr %180, align 8, !tbaa !27
  %181 = load ptr, ptr %15, align 8, !tbaa !5
  %182 = load ptr, ptr %5, align 8, !tbaa !5
  %183 = getelementptr inbounds %"class.cyclone::CollisionPrimitive", ptr %182, i32 0, i32 0
  %184 = load ptr, ptr %183, align 8, !tbaa !30
  %185 = load ptr, ptr %6, align 8, !tbaa !5
  %186 = getelementptr inbounds %"class.cyclone::CollisionPrimitive", ptr %185, i32 0, i32 0
  %187 = load ptr, ptr %186, align 8, !tbaa !30
  %188 = load ptr, ptr %7, align 8, !tbaa !5
  %189 = getelementptr inbounds %"struct.cyclone::CollisionData", ptr %188, i32 0, i32 4
  %190 = load double, ptr %189, align 8, !tbaa !31
  %191 = load ptr, ptr %7, align 8, !tbaa !5
  %192 = getelementptr inbounds %"struct.cyclone::CollisionData", ptr %191, i32 0, i32 5
  %193 = load double, ptr %192, align 8, !tbaa !32
  call void @_ZN7cyclone7Contact11setBodyDataEPNS_9RigidBodyES2_dd(ptr noundef nonnull align 8 dereferenceable(280) %181, ptr noundef %184, ptr noundef %187, double noundef %190, double noundef %193)
  %194 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZN7cyclone13CollisionData11addContactsEj(ptr noundef nonnull align 8 dereferenceable(48) %194, i32 noundef 1)
  store i32 1, ptr %4, align 4
  store i32 1, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #7
  br label %195

195:                                              ; preds = %161, %160
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #7
  br label %196

196:                                              ; preds = %195, %58
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #7
  %197 = load i32, ptr %4, align 4
  ret i32 %197
}

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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 #7 = { 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 0}
!10 = !{!"_ZTSN7cyclone7Vector3E", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!11 = !{!"double", !7, i64 0}
!12 = !{!13, !11, i64 200}
!13 = !{!"_ZTSN7cyclone15CollisionSphereE", !14, i64 0, !11, i64 200}
!14 = !{!"_ZTSN7cyclone18CollisionPrimitiveE", !6, i64 0, !15, i64 8, !15, i64 104}
!15 = !{!"_ZTSN7cyclone7Matrix4E", !7, i64 0}
!16 = !{!17, !11, i64 200}
!17 = !{!"_ZTSN7cyclone12CollisionBoxE", !14, i64 0, !10, i64 200}
!18 = !{!10, !11, i64 8}
!19 = !{!17, !11, i64 208}
!20 = !{!10, !11, i64 16}
!21 = !{!17, !11, i64 216}
!22 = !{!11, !11, i64 0}
!23 = !{!24, !6, i64 8}
!24 = !{!"_ZTSN7cyclone13CollisionDataE", !6, i64 0, !6, i64 8, !25, i64 16, !25, i64 20, !11, i64 24, !11, i64 32, !11, i64 40}
!25 = !{!"int", !7, i64 0}
!26 = !{i64 0, i64 8, !22, i64 8, i64 8, !22, i64 16, i64 8, !22, i64 24, i64 8, !22}
!27 = !{!28, !11, i64 96}
!28 = !{!"_ZTSN7cyclone7ContactE", !7, i64 0, !11, i64 16, !11, i64 24, !10, i64 32, !10, i64 64, !11, i64 96, !29, i64 104, !10, i64 176, !11, i64 208, !7, i64 216}
!29 = !{!"_ZTSN7cyclone7Matrix3E", !7, i64 0}
!30 = !{!14, !6, i64 0}
!31 = !{!24, !11, i64 24}
!32 = !{!24, !11, i64 32}


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

; 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 uwtable
declare dso_local void @_ZNK7cyclone18CollisionPrimitive7getAxisEj(ptr dead_on_unwind noalias writable sret(%"class.cyclone::Vector3") align 8, ptr noundef nonnull align 8 dereferenceable(200), i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7cyclone7Vector3miERKS0_(ptr dead_on_unwind noalias writable sret(%"class.cyclone::Vector3") align 8, 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 noundef double @_ZNK7cyclone7Vector315squareMagnitudeEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 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 #3 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7cyclone7Matrix416transformInverseERKNS_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 #2 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #5

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 2) i32 @_ZN7cyclone17CollisionDetector12boxAndSphereERKNS_12CollisionBoxERKNS_15CollisionSphereEPNS_13CollisionDataE(ptr noundef nonnull align 8 dereferenceable(232) %0, ptr noundef nonnull align 8 dereferenceable(208) %1, ptr noundef %2) local_unnamed_addr #2 align 2 {
  %4 = alloca %"class.cyclone::Vector3", align 8
  %5 = alloca %"class.cyclone::Vector3", align 16
  %6 = alloca %"class.cyclone::Vector3", align 16
  %7 = alloca %"class.cyclone::Vector3", align 8
  %8 = alloca %"class.cyclone::Vector3", align 8
  %9 = alloca %"class.cyclone::Vector3", align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #7
  call void @_ZNK7cyclone18CollisionPrimitive7getAxisEj(ptr dead_on_unwind nonnull writable sret(%"class.cyclone::Vector3") align 8 %4, ptr noundef nonnull align 8 dereferenceable(200) %1, i32 noundef 3)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #7
  %10 = getelementptr inbounds i8, ptr %0, i64 104
  call void @_ZNK7cyclone7Matrix416transformInverseERKNS_7Vector3E(ptr dead_on_unwind nonnull writable sret(%"class.cyclone::Vector3") align 8 %5, ptr noundef nonnull align 8 dereferenceable(96) %10, ptr noundef nonnull align 8 dereferenceable(32) %4)
  %11 = load double, ptr %5, align 16, !tbaa !5
  %12 = call double @llvm.fabs.f64(double %11)
  %13 = getelementptr inbounds i8, ptr %1, i64 200
  %14 = load double, ptr %13, align 8, !tbaa !10
  %15 = fsub double %12, %14
  %16 = getelementptr inbounds i8, ptr %0, i64 200
  %17 = load double, ptr %16, align 8, !tbaa !15
  %18 = fcmp ogt double %15, %17
  br i1 %18, label %69, label %19

19:                                               ; preds = %3
  %20 = getelementptr inbounds i8, ptr %5, i64 8
  %21 = load double, ptr %20, align 8, !tbaa !17
  %22 = call double @llvm.fabs.f64(double %21)
  %23 = fsub double %22, %14
  %24 = getelementptr inbounds i8, ptr %0, i64 208
  %25 = load double, ptr %24, align 8, !tbaa !18
  %26 = fcmp ogt double %23, %25
  br i1 %26, label %69, label %27

27:                                               ; preds = %19
  %28 = getelementptr inbounds i8, ptr %5, i64 16
  %29 = load double, ptr %28, align 16, !tbaa !19
  %30 = call double @llvm.fabs.f64(double %29)
  %31 = fsub double %30, %14
  %32 = getelementptr inbounds i8, ptr %0, i64 216
  %33 = load double, ptr %32, align 8, !tbaa !20
  %34 = fcmp ogt double %31, %33
  br i1 %34, label %69, label %35

35:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #7
  call void @_ZN7cyclone7Vector3C2Eddd(ptr noundef nonnull align 8 dereferenceable(32) %6, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00)
  %36 = load <2 x double>, ptr %5, align 16, !tbaa !21
  %37 = load <2 x double>, ptr %16, align 8, !tbaa !21
  %38 = fcmp ogt <2 x double> %36, %37
  %39 = select <2 x i1> %38, <2 x double> %37, <2 x double> %36
  %40 = fneg <2 x double> %37
  %41 = fcmp olt <2 x double> %39, %40
  %42 = select <2 x i1> %41, <2 x double> %40, <2 x double> %39
  store <2 x double> %42, ptr %6, align 16, !tbaa !21
  %43 = load double, ptr %28, align 16, !tbaa !19
  %44 = load double, ptr %32, align 8, !tbaa !20
  %45 = fcmp ogt double %43, %44
  %.4 = select i1 %45, double %44, double %43
  %46 = fneg double %44
  %47 = fcmp olt double %.4, %46
  %.5 = select i1 %47, double %46, double %.4
  %48 = getelementptr inbounds i8, ptr %6, i64 16
  store double %.5, ptr %48, align 16, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #7
  call void @_ZNK7cyclone7Vector3miERKS0_(ptr dead_on_unwind nonnull writable sret(%"class.cyclone::Vector3") align 8 %7, ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef nonnull align 8 dereferenceable(32) %5)
  %49 = call noundef double @_ZNK7cyclone7Vector315squareMagnitudeEv(ptr noundef nonnull align 8 dereferenceable(32) %7)
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #7
  %50 = load double, ptr %13, align 8, !tbaa !10
  %51 = fmul double %50, %50
  %52 = fcmp ogt double %49, %51
  br i1 %52, label %68, label %53

53:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #7
  call void @_ZNK7cyclone7Matrix49transformERKNS_7Vector3E(ptr dead_on_unwind nonnull writable sret(%"class.cyclone::Vector3") align 8 %8, ptr noundef nonnull align 8 dereferenceable(96) %10, ptr noundef nonnull align 8 dereferenceable(32) %6)
  %54 = getelementptr inbounds i8, ptr %2, i64 8
  %55 = load ptr, ptr %54, align 8, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #7
  call void @_ZNK7cyclone7Vector3miERKS0_(ptr dead_on_unwind nonnull writable sret(%"class.cyclone::Vector3") align 8 %9, ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef nonnull align 8 dereferenceable(32) %4)
  %56 = getelementptr inbounds i8, ptr %55, i64 64
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %56, ptr noundef nonnull align 8 dereferenceable(32) %9, i64 32, i1 false), !tbaa.struct !25
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #7
  call void @_ZN7cyclone7Vector39normaliseEv(ptr noundef nonnull align 8 dereferenceable(32) %56)
  %57 = getelementptr inbounds i8, ptr %55, i64 32
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %57, ptr noundef nonnull align 8 dereferenceable(32) %8, i64 32, i1 false), !tbaa.struct !25
  %58 = load double, ptr %13, align 8, !tbaa !10
  %59 = call double @sqrt(double noundef %49) #7
  %60 = fsub double %58, %59
  %61 = getelementptr inbounds i8, ptr %55, i64 96
  store double %60, ptr %61, align 8, !tbaa !26
  %62 = load ptr, ptr %0, align 8, !tbaa !29
  %63 = load ptr, ptr %1, align 8, !tbaa !29
  %64 = getelementptr inbounds i8, ptr %2, i64 24
  %65 = load double, ptr %64, align 8, !tbaa !30
  %66 = getelementptr inbounds i8, ptr %2, i64 32
  %67 = load double, ptr %66, align 8, !tbaa !31
  call void @_ZN7cyclone7Contact11setBodyDataEPNS_9RigidBodyES2_dd(ptr noundef nonnull align 8 dereferenceable(280) %55, ptr noundef %62, ptr noundef %63, double noundef %65, double noundef %67)
  call void @_ZN7cyclone13CollisionData11addContactsEj(ptr noundef nonnull align 8 dereferenceable(48) %2, i32 noundef 1)
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #7
  br label %68

68:                                               ; preds = %35, %53
  %.0 = phi i32 [ 1, %53 ], [ 0, %35 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #7
  br label %69

69:                                               ; preds = %3, %19, %27, %68
  %.1 = phi i32 [ %.0, %68 ], [ 0, %27 ], [ 0, %19 ], [ 0, %3 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #7
  ret i32 %.1
}

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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 #7 = { 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, !7, i64 0}
!6 = !{!"_ZTSN7cyclone7Vector3E", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !7, i64 200}
!11 = !{!"_ZTSN7cyclone15CollisionSphereE", !12, i64 0, !7, i64 200}
!12 = !{!"_ZTSN7cyclone18CollisionPrimitiveE", !13, i64 0, !14, i64 8, !14, i64 104}
!13 = !{!"any pointer", !8, i64 0}
!14 = !{!"_ZTSN7cyclone7Matrix4E", !8, i64 0}
!15 = !{!16, !7, i64 200}
!16 = !{!"_ZTSN7cyclone12CollisionBoxE", !12, i64 0, !6, i64 200}
!17 = !{!6, !7, i64 8}
!18 = !{!16, !7, i64 208}
!19 = !{!6, !7, i64 16}
!20 = !{!16, !7, i64 216}
!21 = !{!7, !7, i64 0}
!22 = !{!23, !13, i64 8}
!23 = !{!"_ZTSN7cyclone13CollisionDataE", !13, i64 0, !13, i64 8, !24, i64 16, !24, i64 20, !7, i64 24, !7, i64 32, !7, i64 40}
!24 = !{!"int", !8, i64 0}
!25 = !{i64 0, i64 8, !21, i64 8, i64 8, !21, i64 16, i64 8, !21, i64 24, i64 8, !21}
!26 = !{!27, !7, i64 96}
!27 = !{!"_ZTSN7cyclone7ContactE", !8, i64 0, !7, i64 16, !7, i64 24, !6, i64 32, !6, i64 64, !7, i64 96, !28, i64 104, !6, i64 176, !7, i64 208, !8, i64 216}
!28 = !{!"_ZTSN7cyclone7Matrix3E", !8, i64 0}
!29 = !{!12, !13, i64 0}
!30 = !{!23, !7, i64 24}
!31 = !{!23, !7, i64 32}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass