; LLVM IR from erayzesen/QuarkPhysics :: QuarkPhysics (qraycast)

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

%struct.QVector = type { float, float }
%"struct.QRaycast::Contact" = type <{ ptr, %struct.QVector, %struct.QVector, float, [4 x i8] }>
%struct.QMesh = type { %"class.std::vector.47", %struct.QVector, %struct.QVector, float, float, %"class.std::vector.10", %"class.std::vector.52", %"class.std::vector.47", %"class.std::vector.57", %"class.std::vector.62", float, ptr, i32, %"class.std::vector.67", i8, i8, %"class.std::vector.72", float, i8, i8, i8, i8 }
%"class.std::vector.10" = type { %"struct.std::_Vector_base.11" }
%"struct.std::_Vector_base.11" = type { %"struct.std::_Vector_base<QSpring *, std::allocator<QSpring *>>::_Vector_impl" }
%"struct.std::_Vector_base<QSpring *, std::allocator<QSpring *>>::_Vector_impl" = type { %"struct.std::_Vector_base<QSpring *, std::allocator<QSpring *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<QSpring *, std::allocator<QSpring *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.52" = type { %"struct.std::_Vector_base.53" }
%"struct.std::_Vector_base.53" = type { %"struct.std::_Vector_base<QAngleConstraint *, std::allocator<QAngleConstraint *>>::_Vector_impl" }
%"struct.std::_Vector_base<QAngleConstraint *, std::allocator<QAngleConstraint *>>::_Vector_impl" = type { %"struct.std::_Vector_base<QAngleConstraint *, std::allocator<QAngleConstraint *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<QAngleConstraint *, std::allocator<QAngleConstraint *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.47" = type { %"struct.std::_Vector_base.48" }
%"struct.std::_Vector_base.48" = type { %"struct.std::_Vector_base<QParticle *, std::allocator<QParticle *>>::_Vector_impl" }
%"struct.std::_Vector_base<QParticle *, std::allocator<QParticle *>>::_Vector_impl" = type { %"struct.std::_Vector_base<QParticle *, std::allocator<QParticle *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<QParticle *, std::allocator<QParticle *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.57" = type { %"struct.std::_Vector_base.58" }
%"struct.std::_Vector_base.58" = type { %"struct.std::_Vector_base<std::vector<QParticle *>, std::allocator<std::vector<QParticle *>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<QParticle *>, std::allocator<std::vector<QParticle *>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<QParticle *>, std::allocator<std::vector<QParticle *>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<QParticle *>, std::allocator<std::vector<QParticle *>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.62" = type { %"struct.std::_Vector_base.63" }
%"struct.std::_Vector_base.63" = type { %"struct.std::_Vector_base<QVector, std::allocator<QVector>>::_Vector_impl" }
%"struct.std::_Vector_base<QVector, std::allocator<QVector>>::_Vector_impl" = type { %"struct.std::_Vector_base<QVector, std::allocator<QVector>>::_Vector_impl_data" }
%"struct.std::_Vector_base<QVector, std::allocator<QVector>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.67" = type { %"struct.std::_Vector_base.68" }
%"struct.std::_Vector_base.68" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.72" = type { %"struct.std::_Vector_base.73" }
%"struct.std::_Vector_base.73" = type { %"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl" }
%"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl" = type { %"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl_data" }
%"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@_ZN6QWorld14MAX_WORLD_SIZEE = external dso_local global float, align 4

; Function Attrs: mustprogress uwtable
declare dso_local <2 x float> @_ZN7QVector4ZeroEv() #0 align 2

; 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.start.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: mustprogress uwtable
declare dso_local <2 x float> @_Zpl7QVectorS_(<2 x float>, <2 x float>) #0

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_ZNK7QVector10NormalizedEv(ptr noundef nonnull align 4 dereferenceable(8)) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_ZNK7QVector13PerpendicularEv(ptr noundef nonnull align 4 dereferenceable(8)) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8QRaycast16RaycastToPolygonEP5QBodyP5QMesh7QVectorS4_S4_S4_bPSt6vectorINS_7ContactESaIS6_EE(ptr noundef %0, ptr noundef %1, <2 x float> %2, <2 x float> %3, <2 x float> %4, <2 x float> %5, i1 noundef zeroext %6, ptr noundef %7) #0 align 2 {
  %9 = alloca %struct.QVector, align 4
  %10 = alloca %struct.QVector, align 4
  %11 = alloca %struct.QVector, align 4
  %12 = alloca %struct.QVector, align 4
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i8, align 1
  %16 = alloca ptr, align 8
  %17 = alloca %struct.QVector, align 4
  %18 = alloca %struct.QVector, align 4
  %19 = alloca %struct.QVector, align 4
  %20 = alloca %struct.QVector, align 4
  %21 = alloca i8, align 1
  %22 = alloca float, align 4
  %23 = alloca %struct.QVector, align 4
  %24 = alloca %struct.QVector, align 4
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca ptr, align 8
  %28 = alloca ptr, align 8
  %29 = alloca %struct.QVector, align 4
  %30 = alloca %struct.QVector, align 4
  %31 = alloca %struct.QVector, align 4
  %32 = alloca %struct.QVector, align 4
  %33 = alloca %struct.QVector, align 4
  %34 = alloca float, align 4
  %35 = alloca %struct.QVector, align 4
  %36 = alloca %struct.QVector, align 4
  %37 = alloca %struct.QVector, align 4
  %38 = alloca %struct.QVector, align 4
  %39 = alloca %struct.QVector, align 4
  %40 = alloca %struct.QVector, align 4
  %41 = alloca %struct.QVector, align 4
  %42 = alloca %struct.QVector, align 4
  %43 = alloca %struct.QVector, align 4
  %44 = alloca %"struct.QRaycast::Contact", align 8
  %45 = alloca %struct.QVector, align 4
  %46 = alloca %struct.QVector, align 4
  store <2 x float> %2, ptr %9, align 4
  store <2 x float> %3, ptr %10, align 4
  store <2 x float> %4, ptr %11, align 4
  store <2 x float> %5, ptr %12, align 4
  store ptr %0, ptr %13, align 8, !tbaa !5
  store ptr %1, ptr %14, align 8, !tbaa !5
  %47 = zext i1 %6 to i8
  store i8 %47, ptr %15, align 1, !tbaa !9
  store ptr %7, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #10
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %17, ptr align 4 %9, i64 8, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #10
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 4 %9, i64 8, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %20, ptr align 4 %10, i64 8, i1 false), !tbaa.struct !11
  %48 = load <2 x float>, ptr %19, align 4
  %49 = load <2 x float>, ptr %20, align 4
  %50 = call <2 x float> @_Zpl7QVectorS_(<2 x float> %48, <2 x float> %49)
  store <2 x float> %50, ptr %18, align 4
  call void @llvm.lifetime.start.p0(i64 1, ptr %21) #10
  store i8 0, ptr %21, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #10
  %51 = load float, ptr @_ZN6QWorld14MAX_WORLD_SIZEE, align 4, !tbaa !12
  store float %51, ptr %22, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #10
  %52 = call <2 x float> @_ZN7QVector4ZeroEv()
  store <2 x float> %52, ptr %23, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #10
  %53 = call <2 x float> @_ZN7QVector4ZeroEv()
  store <2 x float> %53, ptr %24, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #10
  store i32 0, ptr %25, align 4, !tbaa !14
  br label %54

54:                                               ; preds = %115, %8
  %55 = load i32, ptr %25, align 4, !tbaa !14
  %56 = sext i32 %55 to i64
  %57 = load ptr, ptr %14, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.QMesh, ptr %57, i32 0, i32 7
  %59 = call noundef i64 @_ZNKSt6vectorIP9QParticleSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %58) #10
  %60 = icmp ult i64 %56, %59
  br i1 %60, label %62, label %61

61:                                               ; preds = %54
  store i32 2, ptr %26, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #10
  br label %118

62:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #10
  %63 = load ptr, ptr %14, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.QMesh, ptr %63, i32 0, i32 7
  %65 = load i32, ptr %25, align 4, !tbaa !14
  %66 = sext i32 %65 to i64
  %67 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP9QParticleSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %64, i64 noundef %66) #10
  %68 = load ptr, ptr %67, align 8, !tbaa !5
  store ptr %68, ptr %27, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #10
  %69 = load ptr, ptr %14, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.QMesh, ptr %69, i32 0, i32 7
  %71 = load i32, ptr %25, align 4, !tbaa !14
  %72 = add nsw i32 %71, 1
  %73 = sext i32 %72 to i64
  %74 = load ptr, ptr %14, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.QMesh, ptr %74, i32 0, i32 7
  %76 = call noundef i64 @_ZNKSt6vectorIP9QParticleSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %75) #10
  %77 = urem i64 %73, %76
  %78 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP9QParticleSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %70, i64 noundef %77) #10
  %79 = load ptr, ptr %78, align 8, !tbaa !5
  store ptr %79, ptr %28, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #10
  %80 = load ptr, ptr %27, align 8, !tbaa !5
  %81 = call <2 x float> @_ZN9QParticle17GetGlobalPositionEv(ptr noundef nonnull align 8 dereferenceable(290) %80)
  store <2 x float> %81, ptr %30, align 4
  %82 = load ptr, ptr %28, align 8, !tbaa !5
  %83 = call <2 x float> @_ZN9QParticle17GetGlobalPositionEv(ptr noundef nonnull align 8 dereferenceable(290) %82)
  store <2 x float> %83, ptr %31, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %32, ptr align 4 %17, i64 8, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %33, ptr align 4 %18, i64 8, i1 false), !tbaa.struct !11
  %84 = load <2 x float>, ptr %30, align 4
  %85 = load <2 x float>, ptr %31, align 4
  %86 = load <2 x float>, ptr %32, align 4
  %87 = load <2 x float>, ptr %33, align 4
  %88 = call <2 x float> @_ZN10QCollision20LineIntersectionLineE7QVectorS0_S0_S0_(<2 x float> %84, <2 x float> %85, <2 x float> %86, <2 x float> %87)
  store <2 x float> %88, ptr %29, align 4
  %89 = call noundef zeroext i1 @_ZNK7QVector5isNaNEv(ptr noundef nonnull align 4 dereferenceable(8) %29)
  br i1 %89, label %90, label %91

90:                                               ; preds = %62
  store i32 4, ptr %26, align 4
  br label %112

91:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 4, ptr %34) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr %35) #10
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %36, ptr align 4 %29, i64 8, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %37, ptr align 4 %17, i64 8, i1 false), !tbaa.struct !11
  %92 = load <2 x float>, ptr %36, align 4
  %93 = load <2 x float>, ptr %37, align 4
  %94 = call <2 x float> @_Zmi7QVectorS_(<2 x float> %92, <2 x float> %93)
  store <2 x float> %94, ptr %35, align 4
  %95 = call noundef float @_ZNK7QVector6LengthEv(ptr noundef nonnull align 4 dereferenceable(8) %35)
  call void @llvm.lifetime.end.p0(i64 8, ptr %35) #10
  store float %95, ptr %34, align 4, !tbaa !12
  %96 = load float, ptr %34, align 4, !tbaa !12
  %97 = load float, ptr %22, align 4, !tbaa !12
  %98 = fcmp ogt float %96, %97
  br i1 %98, label %99, label %100

99:                                               ; preds = %91
  store i32 4, ptr %26, align 4
  br label %111

100:                                              ; preds = %91
  %101 = load float, ptr %34, align 4, !tbaa !12
  store float %101, ptr %22, align 4, !tbaa !12
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %23, ptr align 4 %29, i64 8, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %38) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr %39) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr %40) #10
  %102 = load ptr, ptr %28, align 8, !tbaa !5
  %103 = call <2 x float> @_ZN9QParticle17GetGlobalPositionEv(ptr noundef nonnull align 8 dereferenceable(290) %102)
  store <2 x float> %103, ptr %41, align 4
  %104 = load ptr, ptr %27, align 8, !tbaa !5
  %105 = call <2 x float> @_ZN9QParticle17GetGlobalPositionEv(ptr noundef nonnull align 8 dereferenceable(290) %104)
  store <2 x float> %105, ptr %42, align 4
  %106 = load <2 x float>, ptr %41, align 4
  %107 = load <2 x float>, ptr %42, align 4
  %108 = call <2 x float> @_Zmi7QVectorS_(<2 x float> %106, <2 x float> %107)
  store <2 x float> %108, ptr %40, align 4
  %109 = call <2 x float> @_ZNK7QVector10NormalizedEv(ptr noundef nonnull align 4 dereferenceable(8) %40)
  store <2 x float> %109, ptr %39, align 4
  %110 = call <2 x float> @_ZNK7QVector13PerpendicularEv(ptr noundef nonnull align 4 dereferenceable(8) %39)
  store <2 x float> %110, ptr %38, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %24, ptr align 4 %38, i64 8, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %40) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %39) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %38) #10
  store i8 1, ptr %21, align 1, !tbaa !9
  store i32 0, ptr %26, align 4
  br label %111

111:                                              ; preds = %100, %99
  call void @llvm.lifetime.end.p0(i64 4, ptr %34) #10
  br label %112

112:                                              ; preds = %111, %90
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #10
  %113 = load i32, ptr %26, align 4
  switch i32 %113, label %143 [
    i32 0, label %114
    i32 4, label %115
  ]

114:                                              ; preds = %112
  br label %115

115:                                              ; preds = %114, %112
  %116 = load i32, ptr %25, align 4, !tbaa !14
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %25, align 4, !tbaa !14
  br label %54, !llvm.loop !16

118:                                              ; preds = %61
  %119 = load i8, ptr %21, align 1, !tbaa !9, !range !18, !noundef !19
  %120 = trunc i8 %119 to i1
  %121 = zext i1 %120 to i32
  %122 = icmp eq i32 %121, 0
  br i1 %122, label %123, label %124

123:                                              ; preds = %118
  store i32 1, ptr %26, align 4
  br label %140

124:                                              ; preds = %118
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %43, ptr align 4 %24, i64 8, i1 false), !tbaa.struct !11
  %125 = load <2 x float>, ptr %43, align 4
  %126 = call noundef float @_ZNK7QVector3DotES_(ptr noundef nonnull align 4 dereferenceable(8) %10, <2 x float> %125)
  %127 = fcmp ogt float %126, 0.000000e+00
  br i1 %127, label %128, label %134

128:                                              ; preds = %124
  %129 = load i8, ptr %15, align 1, !tbaa !9, !range !18, !noundef !19
  %130 = trunc i8 %129 to i1
  br i1 %130, label %131, label %132

131:                                              ; preds = %128
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %23, ptr align 4 %9, i64 8, i1 false), !tbaa.struct !11
  store float 0.000000e+00, ptr %22, align 4, !tbaa !12
  br label %133

132:                                              ; preds = %128
  store i32 1, ptr %26, align 4
  br label %140

133:                                              ; preds = %131
  br label %134

134:                                              ; preds = %133, %124
  call void @llvm.lifetime.start.p0(i64 32, ptr %44) #10
  %135 = load ptr, ptr %13, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %45, ptr align 4 %23, i64 8, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %46, ptr align 4 %24, i64 8, i1 false), !tbaa.struct !11
  %136 = load float, ptr %22, align 4, !tbaa !12
  %137 = load <2 x float>, ptr %45, align 4
  %138 = load <2 x float>, ptr %46, align 4
  call void @_ZN8QRaycast7ContactC2EP5QBody7QVectorS3_f(ptr noundef nonnull align 8 dereferenceable(28) %44, ptr noundef %135, <2 x float> %137, <2 x float> %138, float noundef %136)
  %139 = load ptr, ptr %16, align 8, !tbaa !5
  call void @_ZNSt6vectorIN8QRaycast7ContactESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %139, ptr noundef nonnull align 8 dereferenceable(28) %44)
  call void @llvm.lifetime.end.p0(i64 32, ptr %44) #10
  store i32 0, ptr %26, align 4
  br label %140

140:                                              ; preds = %134, %132, %123
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr %21) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #10
  %141 = load i32, ptr %26, align 4
  switch i32 %141, label %143 [
    i32 0, label %142
    i32 1, label %142
  ]

142:                                              ; preds = %140, %140
  ret void

143:                                              ; preds = %140, %112
  unreachable
}

; Function Attrs: mustprogress uwtable
declare dso_local <2 x float> @_Zmi7QVectorS_(<2 x float>, <2 x float>) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local <2 x float> @_ZN9QParticle17GetGlobalPositionEv(ptr noundef nonnull align 8 dereferenceable(290)) #4 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef float @_ZNK7QVector6LengthEv(ptr noundef nonnull align 4 dereferenceable(8)) #6 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8QRaycast7ContactC2EP5QBody7QVectorS3_f(ptr noundef nonnull align 8 dereferenceable(28), ptr noundef, <2 x float>, <2 x float>, float noundef) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIN8QRaycast7ContactESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(28)) #7 align 2

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

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

declare <2 x float> @_ZN10QCollision20LineIntersectionLineE7QVectorS0_S0_S0_(<2 x float>, <2 x float>, <2 x float>, <2 x float>) #9

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK7QVector5isNaNEv(ptr noundef nonnull align 4 dereferenceable(8)) #6 align 2

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="64" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint mustprogress uwtable "min-legal-vector-width"="64" "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 = { mustprogress nounwind uwtable "min-legal-vector-width"="64" "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"="64" "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 = { 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 #7 = { 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 #8 = { 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 #9 = { "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 #10 = { 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 = !{!"bool", !7, i64 0}
!11 = !{i64 0, i64 4, !12, i64 4, i64 4, !12}
!12 = !{!13, !13, i64 0}
!13 = !{!"float", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{i8 0, i8 2}
!19 = !{}


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

%struct.QVector = type { float, float }
%"struct.QRaycast::Contact" = type <{ ptr, %struct.QVector, %struct.QVector, float, [4 x i8] }>

@_ZN6QWorld14MAX_WORLD_SIZEE = external dso_local local_unnamed_addr global float, align 4

; Function Attrs: mustprogress uwtable
declare dso_local <2 x float> @_ZN7QVector4ZeroEv() local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local <2 x float> @_Zpl7QVectorS_(<2 x float>, <2 x float>) local_unnamed_addr #0

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_ZNK7QVector10NormalizedEv(ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_ZNK7QVector13PerpendicularEv(ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8QRaycast16RaycastToPolygonEP5QBodyP5QMesh7QVectorS4_S4_S4_bPSt6vectorINS_7ContactESaIS6_EE(ptr noundef %0, ptr noundef %1, <2 x float> %2, <2 x float> %3, <2 x float> %4, <2 x float> %5, i1 noundef zeroext %6, ptr noundef %7) local_unnamed_addr #0 align 2 {
  %9 = alloca %struct.QVector, align 8
  %10 = alloca %struct.QVector, align 8
  %11 = alloca %struct.QVector, align 8
  %12 = alloca %struct.QVector, align 8
  %13 = alloca %struct.QVector, align 8
  %14 = alloca %"struct.QRaycast::Contact", align 8
  store <2 x float> %3, ptr %9, align 8
  %15 = tail call <2 x float> @_Zpl7QVectorS_(<2 x float> %2, <2 x float> %3)
  %16 = load float, ptr @_ZN6QWorld14MAX_WORLD_SIZEE, align 4, !tbaa !5
  %17 = tail call <2 x float> @_ZN7QVector4ZeroEv()
  %18 = tail call <2 x float> @_ZN7QVector4ZeroEv()
  %19 = getelementptr inbounds i8, ptr %1, i64 96
  %20 = tail call noundef i64 @_ZNKSt6vectorIP9QParticleSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %19) #9
  %.not = icmp eq i64 %20, 0
  br i1 %.not, label %._crit_edge.thread, label %.lr.ph

._crit_edge:                                      ; preds = %43
  %21 = and i8 %.2, 1
  %22 = icmp eq i8 %21, 0
  br i1 %22, label %._crit_edge.thread, label %46

.lr.ph:                                           ; preds = %8, %43
  %indvars.iv = phi i64 [ %indvars.iv.next, %43 ], [ 0, %8 ]
  %.054 = phi i8 [ %.2, %43 ], [ 0, %8 ]
  %.04453 = phi float [ %.246, %43 ], [ %16, %8 ]
  %.sroa.022.052 = phi <2 x float> [ %.sroa.022.2, %43 ], [ %17, %8 ]
  %.sroa.020.051 = phi <2 x float> [ %.sroa.020.2, %43 ], [ %18, %8 ]
  %23 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP9QParticleSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %19, i64 noundef %indvars.iv) #9
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %25 = call noundef i64 @_ZNKSt6vectorIP9QParticleSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %19) #9
  %26 = urem i64 %indvars.iv.next, %25
  %27 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP9QParticleSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %19, i64 noundef %26) #9
  %28 = load ptr, ptr %27, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #9
  %29 = call <2 x float> @_ZN9QParticle17GetGlobalPositionEv(ptr noundef nonnull align 8 dereferenceable(290) %24)
  %30 = call <2 x float> @_ZN9QParticle17GetGlobalPositionEv(ptr noundef nonnull align 8 dereferenceable(290) %28)
  %31 = call <2 x float> @_ZN10QCollision20LineIntersectionLineE7QVectorS0_S0_S0_(<2 x float> %29, <2 x float> %30, <2 x float> %2, <2 x float> %15)
  store <2 x float> %31, ptr %10, align 8
  %32 = call noundef zeroext i1 @_ZNK7QVector5isNaNEv(ptr noundef nonnull align 4 dereferenceable(8) %10)
  br i1 %32, label %43, label %33

33:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #9
  %.sroa.07.0.copyload = load <2 x float>, ptr %10, align 8
  %34 = call <2 x float> @_Zmi7QVectorS_(<2 x float> %.sroa.07.0.copyload, <2 x float> %2)
  store <2 x float> %34, ptr %11, align 8
  %35 = call noundef float @_ZNK7QVector6LengthEv(ptr noundef nonnull align 4 dereferenceable(8) %11)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #9
  %36 = fcmp ogt float %35, %.04453
  br i1 %36, label %43, label %37

37:                                               ; preds = %33
  %.sroa.022.0.copyload = load <2 x float>, ptr %10, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #9
  %38 = call <2 x float> @_ZN9QParticle17GetGlobalPositionEv(ptr noundef nonnull align 8 dereferenceable(290) %28)
  %39 = call <2 x float> @_ZN9QParticle17GetGlobalPositionEv(ptr noundef nonnull align 8 dereferenceable(290) %24)
  %40 = call <2 x float> @_Zmi7QVectorS_(<2 x float> %38, <2 x float> %39)
  store <2 x float> %40, ptr %13, align 8
  %41 = call <2 x float> @_ZNK7QVector10NormalizedEv(ptr noundef nonnull align 4 dereferenceable(8) %13)
  store <2 x float> %41, ptr %12, align 8
  %42 = call <2 x float> @_ZNK7QVector13PerpendicularEv(ptr noundef nonnull align 4 dereferenceable(8) %12)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #9
  br label %43

43:                                               ; preds = %37, %33, %.lr.ph
  %.sroa.020.2 = phi <2 x float> [ %.sroa.020.051, %.lr.ph ], [ %42, %37 ], [ %.sroa.020.051, %33 ]
  %.sroa.022.2 = phi <2 x float> [ %.sroa.022.052, %.lr.ph ], [ %.sroa.022.0.copyload, %37 ], [ %.sroa.022.052, %33 ]
  %.246 = phi float [ %.04453, %.lr.ph ], [ %35, %37 ], [ %.04453, %33 ]
  %.2 = phi i8 [ %.054, %.lr.ph ], [ 1, %37 ], [ %.054, %33 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #9
  %44 = call noundef i64 @_ZNKSt6vectorIP9QParticleSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %19) #9
  %45 = icmp ugt i64 %44, %indvars.iv.next
  br i1 %45, label %.lr.ph, label %._crit_edge, !llvm.loop !11

46:                                               ; preds = %._crit_edge
  %47 = call noundef float @_ZNK7QVector3DotES_(ptr noundef nonnull align 4 dereferenceable(8) %9, <2 x float> %.sroa.020.2)
  %48 = fcmp ule float %47, 0.000000e+00
  %brmerge = or i1 %48, %6
  br i1 %brmerge, label %49, label %._crit_edge.thread

49:                                               ; preds = %46
  %.044.mux = select i1 %48, float %.246, float 0.000000e+00
  %.sroa.022.0.mux = select i1 %48, <2 x float> %.sroa.022.2, <2 x float> %2
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %14) #9
  call void @_ZN8QRaycast7ContactC2EP5QBody7QVectorS3_f(ptr noundef nonnull align 8 dereferenceable(28) %14, ptr noundef %0, <2 x float> %.sroa.022.0.mux, <2 x float> %.sroa.020.2, float noundef %.044.mux)
  call void @_ZNSt6vectorIN8QRaycast7ContactESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 8 dereferenceable(28) %14)
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %14) #9
  br label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %8, %46, %._crit_edge, %49
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local <2 x float> @_Zmi7QVectorS_(<2 x float>, <2 x float>) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local <2 x float> @_ZN9QParticle17GetGlobalPositionEv(ptr noundef nonnull align 8 dereferenceable(290)) local_unnamed_addr #3 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8QRaycast7ContactC2EP5QBody7QVectorS3_f(ptr noundef nonnull align 8 dereferenceable(28), ptr noundef, <2 x float>, <2 x float>, float noundef) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIN8QRaycast7ContactESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(28)) local_unnamed_addr #6 align 2

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

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

declare <2 x float> @_ZN10QCollision20LineIntersectionLineE7QVectorS0_S0_S0_(<2 x float>, <2 x float>, <2 x float>, <2 x float>) local_unnamed_addr #8

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK7QVector5isNaNEv(ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #5 align 2

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="64" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint mustprogress uwtable "min-legal-vector-width"="64" "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"="64" "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 nounwind uwtable "min-legal-vector-width"="64" "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 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 = { 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 #7 = { 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 #8 = { "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 #9 = { 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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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