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

@_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: mustprogress uwtable
define dso_local void @_ZN8QRaycast18RaycastToParticlesEP5QBodyP5QMesh7QVectorS4_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 i32, align 4
  %18 = alloca float, align 4
  %19 = alloca %struct.QVector, align 4
  %20 = alloca %struct.QVector, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca ptr, align 8
  %24 = alloca %struct.QVector, align 4
  %25 = alloca %struct.QVector, align 4
  %26 = alloca %struct.QVector, align 4
  %27 = alloca float, align 4
  %28 = alloca %struct.QVector, align 4
  %29 = alloca float, 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 %struct.QVector, align 4
  %35 = alloca float, 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 float, align 4
  %41 = alloca %struct.QVector, align 4
  %42 = alloca %struct.QVector, align 4
  %43 = alloca %struct.QVector, align 4
  %44 = alloca %struct.QVector, align 4
  %45 = alloca %struct.QVector, align 4
  %46 = alloca %struct.QVector, align 4
  %47 = alloca %struct.QVector, align 4
  %48 = alloca %struct.QVector, align 4
  %49 = alloca %"struct.QRaycast::Contact", align 8
  %50 = alloca %struct.QVector, align 4
  %51 = 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
  %52 = zext i1 %6 to i8
  store i8 %52, ptr %15, align 1, !tbaa !9
  store ptr %7, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #12
  store i32 -1, ptr %17, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #12
  %53 = load float, ptr @_ZN6QWorld14MAX_WORLD_SIZEE, align 4, !tbaa !13
  store float %53, ptr %18, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #12
  %54 = call <2 x float> @_ZN7QVector4ZeroEv()
  store <2 x float> %54, ptr %19, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #12
  %55 = call <2 x float> @_ZN7QVector4ZeroEv()
  store <2 x float> %55, ptr %20, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #12
  store i32 0, ptr %21, align 4, !tbaa !11
  br label %56

56:                                               ; preds = %158, %8
  %57 = load i32, ptr %21, align 4, !tbaa !11
  %58 = load ptr, ptr %14, align 8, !tbaa !5
  %59 = call noundef i32 @_ZN5QMesh16GetParticleCountEv(ptr noundef nonnull align 8 dereferenceable(256) %58)
  %60 = icmp slt i32 %57, %59
  br i1 %60, label %62, label %61

61:                                               ; preds = %56
  store i32 2, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #12
  br label %161

62:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #12
  %63 = load ptr, ptr %14, align 8, !tbaa !5
  %64 = load i32, ptr %21, align 4, !tbaa !11
  %65 = call noundef ptr @_ZN5QMesh13GetParticleAtEi(ptr noundef nonnull align 8 dereferenceable(256) %63, i32 noundef %64)
  store ptr %65, ptr %23, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #12
  %66 = load ptr, ptr %23, align 8, !tbaa !5
  %67 = call <2 x float> @_ZN9QParticle17GetGlobalPositionEv(ptr noundef nonnull align 8 dereferenceable(290) %66)
  store <2 x float> %67, ptr %25, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %26, ptr align 4 %9, i64 8, i1 false), !tbaa.struct !15
  %68 = load <2 x float>, ptr %25, align 4
  %69 = load <2 x float>, ptr %26, align 4
  %70 = call <2 x float> @_Zmi7QVectorS_(<2 x float> %68, <2 x float> %69)
  store <2 x float> %70, ptr %24, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #12
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %28, ptr align 4 %11, i64 8, i1 false), !tbaa.struct !15
  %71 = load <2 x float>, ptr %28, align 4
  %72 = call noundef float @_ZNK7QVector3DotES_(ptr noundef nonnull align 4 dereferenceable(8) %24, <2 x float> %71)
  store float %72, ptr %27, align 4, !tbaa !13
  %73 = load float, ptr %27, align 4, !tbaa !13
  %74 = load ptr, ptr %23, align 8, !tbaa !5
  %75 = call noundef float @_ZN9QParticle9GetRadiusEv(ptr noundef nonnull align 8 dereferenceable(290) %74)
  %76 = fsub float %73, %75
  %77 = load float, ptr %18, align 4, !tbaa !13
  %78 = fcmp ogt float %76, %77
  br i1 %78, label %79, label %80

79:                                               ; preds = %62
  store i32 4, ptr %22, align 4
  br label %155

80:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #12
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %30, ptr align 4 %12, i64 8, i1 false), !tbaa.struct !15
  %81 = load <2 x float>, ptr %30, align 4
  %82 = call noundef float @_ZNK7QVector3DotES_(ptr noundef nonnull align 4 dereferenceable(8) %24, <2 x float> %81)
  store float %82, ptr %29, align 4, !tbaa !13
  %83 = load float, ptr %29, align 4, !tbaa !13
  %84 = call noundef float @_ZSt3absf(float noundef %83)
  %85 = load ptr, ptr %23, align 8, !tbaa !5
  %86 = call noundef float @_ZN9QParticle9GetRadiusEv(ptr noundef nonnull align 8 dereferenceable(290) %85)
  %87 = fcmp olt float %84, %86
  br i1 %87, label %88, label %153

88:                                               ; preds = %80
  %89 = load float, ptr %27, align 4, !tbaa !13
  %90 = load ptr, ptr %23, align 8, !tbaa !5
  %91 = call noundef float @_ZN9QParticle9GetRadiusEv(ptr noundef nonnull align 8 dereferenceable(290) %90)
  %92 = fneg float %91
  %93 = fcmp oge float %89, %92
  br i1 %93, label %94, label %153

94:                                               ; preds = %88
  %95 = load float, ptr %27, align 4, !tbaa !13
  %96 = call noundef float @_ZNK7QVector6LengthEv(ptr noundef nonnull align 4 dereferenceable(8) %10)
  %97 = load ptr, ptr %23, align 8, !tbaa !5
  %98 = call noundef float @_ZN9QParticle9GetRadiusEv(ptr noundef nonnull align 8 dereferenceable(290) %97)
  %99 = fadd float %96, %98
  %100 = fcmp ole float %95, %99
  br i1 %100, label %101, label %153

101:                                              ; preds = %94
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #12
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %32, ptr align 4 %9, i64 8, i1 false), !tbaa.struct !15
  %102 = load float, ptr %27, align 4, !tbaa !13
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %34, ptr align 4 %11, i64 8, i1 false), !tbaa.struct !15
  %103 = load <2 x float>, ptr %34, align 4
  %104 = call <2 x float> @_Zmlf7QVector(float noundef %102, <2 x float> %103)
  store <2 x float> %104, ptr %33, align 4
  %105 = load <2 x float>, ptr %32, align 4
  %106 = load <2 x float>, ptr %33, align 4
  %107 = call <2 x float> @_Zpl7QVectorS_(<2 x float> %105, <2 x float> %106)
  store <2 x float> %107, ptr %31, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %35) #12
  %108 = load ptr, ptr %23, align 8, !tbaa !5
  %109 = call noundef float @_ZN9QParticle9GetRadiusEv(ptr noundef nonnull align 8 dereferenceable(290) %108)
  %110 = load ptr, ptr %23, align 8, !tbaa !5
  %111 = call noundef float @_ZN9QParticle9GetRadiusEv(ptr noundef nonnull align 8 dereferenceable(290) %110)
  %112 = load float, ptr %29, align 4, !tbaa !13
  %113 = load float, ptr %29, align 4, !tbaa !13
  %114 = fmul float %112, %113
  %115 = fneg float %114
  %116 = call float @llvm.fmuladd.f32(float %109, float %111, float %115)
  %117 = call noundef float @_ZSt4sqrtf(float noundef %116)
  store float %117, ptr %35, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %36) #12
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %37, ptr align 4 %31, i64 8, i1 false), !tbaa.struct !15
  %118 = load float, ptr %35, align 4, !tbaa !13
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %39, ptr align 4 %11, i64 8, i1 false), !tbaa.struct !15
  %119 = load <2 x float>, ptr %39, align 4
  %120 = call <2 x float> @_Zmlf7QVector(float noundef %118, <2 x float> %119)
  store <2 x float> %120, ptr %38, align 4
  %121 = load <2 x float>, ptr %37, align 4
  %122 = load <2 x float>, ptr %38, align 4
  %123 = call <2 x float> @_Zmi7QVectorS_(<2 x float> %121, <2 x float> %122)
  store <2 x float> %123, ptr %36, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %40) #12
  call void @llvm.lifetime.start.p0(i64 8, ptr %41) #12
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %42, ptr align 4 %36, i64 8, i1 false), !tbaa.struct !15
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %43, ptr align 4 %9, i64 8, i1 false), !tbaa.struct !15
  %124 = load <2 x float>, ptr %42, align 4
  %125 = load <2 x float>, ptr %43, align 4
  %126 = call <2 x float> @_Zmi7QVectorS_(<2 x float> %124, <2 x float> %125)
  store <2 x float> %126, ptr %41, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %44, ptr align 4 %11, i64 8, i1 false), !tbaa.struct !15
  %127 = load <2 x float>, ptr %44, align 4
  %128 = call noundef float @_ZNK7QVector3DotES_(ptr noundef nonnull align 4 dereferenceable(8) %41, <2 x float> %127)
  call void @llvm.lifetime.end.p0(i64 8, ptr %41) #12
  store float %128, ptr %40, align 4, !tbaa !13
  %129 = load i8, ptr %15, align 1, !tbaa !9, !range !16, !noundef !17
  %130 = trunc i8 %129 to i1
  br i1 %130, label %131, label %136

131:                                              ; preds = %101
  %132 = load float, ptr %40, align 4, !tbaa !13
  %133 = fcmp ole float %132, 0.000000e+00
  br i1 %133, label %134, label %135

134:                                              ; preds = %131
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %36, ptr align 4 %9, i64 8, i1 false), !tbaa.struct !15
  br label %135

135:                                              ; preds = %134, %131
  br label %141

136:                                              ; preds = %101
  %137 = load float, ptr %40, align 4, !tbaa !13
  %138 = fcmp ole float %137, 0.000000e+00
  br i1 %138, label %139, label %140

139:                                              ; preds = %136
  store i32 4, ptr %22, align 4
  br label %150

140:                                              ; preds = %136
  br label %141

141:                                              ; preds = %140, %135
  %142 = load float, ptr %27, align 4, !tbaa !13
  store float %142, ptr %18, align 4, !tbaa !13
  %143 = load i32, ptr %21, align 4, !tbaa !11
  store i32 %143, ptr %17, align 4, !tbaa !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 4 %36, i64 8, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %45) #12
  call void @llvm.lifetime.start.p0(i64 8, ptr %46) #12
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %47, ptr align 4 %36, i64 8, i1 false), !tbaa.struct !15
  %144 = load ptr, ptr %23, align 8, !tbaa !5
  %145 = call <2 x float> @_ZN9QParticle17GetGlobalPositionEv(ptr noundef nonnull align 8 dereferenceable(290) %144)
  store <2 x float> %145, ptr %48, align 4
  %146 = load <2 x float>, ptr %47, align 4
  %147 = load <2 x float>, ptr %48, align 4
  %148 = call <2 x float> @_Zmi7QVectorS_(<2 x float> %146, <2 x float> %147)
  store <2 x float> %148, ptr %46, align 4
  %149 = call <2 x float> @_ZNK7QVector10NormalizedEv(ptr noundef nonnull align 4 dereferenceable(8) %46)
  store <2 x float> %149, ptr %45, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %20, ptr align 4 %45, i64 8, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 8, ptr %46) #12
  call void @llvm.lifetime.end.p0(i64 8, ptr %45) #12
  store i32 0, ptr %22, align 4
  br label %150

150:                                              ; preds = %141, %139
  call void @llvm.lifetime.end.p0(i64 4, ptr %40) #12
  call void @llvm.lifetime.end.p0(i64 8, ptr %36) #12
  call void @llvm.lifetime.end.p0(i64 4, ptr %35) #12
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #12
  %151 = load i32, ptr %22, align 4
  switch i32 %151, label %154 [
    i32 0, label %152
  ]

152:                                              ; preds = %150
  br label %153

153:                                              ; preds = %152, %94, %88, %80
  store i32 0, ptr %22, align 4
  br label %154

154:                                              ; preds = %153, %150
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #12
  br label %155

155:                                              ; preds = %154, %79
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #12
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #12
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #12
  %156 = load i32, ptr %22, align 4
  switch i32 %156, label %174 [
    i32 0, label %157
    i32 4, label %158
  ]

157:                                              ; preds = %155
  br label %158

158:                                              ; preds = %157, %155
  %159 = load i32, ptr %21, align 4, !tbaa !11
  %160 = add nsw i32 %159, 1
  store i32 %160, ptr %21, align 4, !tbaa !11
  br label %56, !llvm.loop !18

161:                                              ; preds = %61
  %162 = load i32, ptr %17, align 4, !tbaa !11
  %163 = icmp eq i32 %162, -1
  br i1 %163, label %164, label %165

164:                                              ; preds = %161
  store i32 1, ptr %22, align 4
  br label %171

165:                                              ; preds = %161
  call void @llvm.lifetime.start.p0(i64 32, ptr %49) #12
  %166 = load ptr, ptr %13, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %50, ptr align 4 %19, i64 8, i1 false), !tbaa.struct !15
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %51, ptr align 4 %20, i64 8, i1 false), !tbaa.struct !15
  %167 = load float, ptr %18, align 4, !tbaa !13
  %168 = load <2 x float>, ptr %50, align 4
  %169 = load <2 x float>, ptr %51, align 4
  call void @_ZN8QRaycast7ContactC2EP5QBody7QVectorS3_f(ptr noundef nonnull align 8 dereferenceable(28) %49, ptr noundef %166, <2 x float> %168, <2 x float> %169, float noundef %167)
  %170 = load ptr, ptr %16, align 8, !tbaa !5
  call void @_ZNSt6vectorIN8QRaycast7ContactESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %170, ptr noundef nonnull align 8 dereferenceable(28) %49)
  call void @llvm.lifetime.end.p0(i64 32, ptr %49) #12
  store i32 0, ptr %22, align 4
  br label %171

171:                                              ; preds = %165, %164
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #12
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #12
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #12
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #12
  %172 = load i32, ptr %22, align 4
  switch i32 %172, label %174 [
    i32 0, label %173
    i32 1, label %173
  ]

173:                                              ; preds = %171, %171
  ret void

174:                                              ; preds = %171, %155
  unreachable
}

declare noundef i32 @_ZN5QMesh16GetParticleCountEv(ptr noundef nonnull align 8 dereferenceable(256)) #4

declare noundef ptr @_ZN5QMesh13GetParticleAtEi(ptr noundef nonnull align 8 dereferenceable(256), i32 noundef) #4

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZN9QParticle9GetRadiusEv(ptr noundef nonnull align 8 dereferenceable(290)) #7 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3absf(float noundef) #8

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt4sqrtf(float noundef) #8

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

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

%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: mustprogress uwtable
define dso_local void @_ZN8QRaycast18RaycastToParticlesEP5QBodyP5QMesh7QVectorS4_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.QRaycast::Contact", align 8
  store <2 x float> %3, ptr %9, align 8
  %14 = load float, ptr @_ZN6QWorld14MAX_WORLD_SIZEE, align 4, !tbaa !5
  %15 = tail call <2 x float> @_ZN7QVector4ZeroEv()
  %16 = tail call <2 x float> @_ZN7QVector4ZeroEv()
  %17 = tail call noundef i32 @_ZN5QMesh16GetParticleCountEv(ptr noundef nonnull align 8 dereferenceable(256) %1)
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %.lr.ph, label %._crit_edge.thread

._crit_edge:                                      ; preds = %62
  %19 = icmp eq i32 %.4, -1
  br i1 %19, label %._crit_edge.thread, label %66

.lr.ph:                                           ; preds = %8, %62
  %.075 = phi i32 [ %.4, %62 ], [ -1, %8 ]
  %.06374 = phi float [ %.467, %62 ], [ %14, %8 ]
  %.sroa.045.073 = phi <2 x float> [ %.sroa.045.4, %62 ], [ %15, %8 ]
  %.sroa.044.072 = phi <2 x float> [ %.sroa.044.4, %62 ], [ %16, %8 ]
  %.06871 = phi i32 [ %63, %62 ], [ 0, %8 ]
  %20 = call noundef ptr @_ZN5QMesh13GetParticleAtEi(ptr noundef nonnull align 8 dereferenceable(256) %1, i32 noundef %.06871)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #11
  %21 = call <2 x float> @_ZN9QParticle17GetGlobalPositionEv(ptr noundef nonnull align 8 dereferenceable(290) %20)
  %22 = call <2 x float> @_Zmi7QVectorS_(<2 x float> %21, <2 x float> %2)
  store <2 x float> %22, ptr %10, align 8
  %23 = call noundef float @_ZNK7QVector3DotES_(ptr noundef nonnull align 4 dereferenceable(8) %10, <2 x float> %4)
  %24 = call noundef float @_ZN9QParticle9GetRadiusEv(ptr noundef nonnull align 8 dereferenceable(290) %20)
  %25 = fsub float %23, %24
  %26 = fcmp ogt float %25, %.06374
  br i1 %26, label %62, label %27

27:                                               ; preds = %.lr.ph
  %28 = call noundef float @_ZNK7QVector3DotES_(ptr noundef nonnull align 4 dereferenceable(8) %10, <2 x float> %5)
  %29 = call noundef float @_ZSt3absf(float noundef %28)
  %30 = call noundef float @_ZN9QParticle9GetRadiusEv(ptr noundef nonnull align 8 dereferenceable(290) %20)
  %31 = fcmp olt float %29, %30
  br i1 %31, label %32, label %62

32:                                               ; preds = %27
  %33 = call noundef float @_ZN9QParticle9GetRadiusEv(ptr noundef nonnull align 8 dereferenceable(290) %20)
  %34 = fneg float %33
  %35 = fcmp ult float %23, %34
  br i1 %35, label %62, label %36

36:                                               ; preds = %32
  %37 = call noundef float @_ZNK7QVector6LengthEv(ptr noundef nonnull align 4 dereferenceable(8) %9)
  %38 = call noundef float @_ZN9QParticle9GetRadiusEv(ptr noundef nonnull align 8 dereferenceable(290) %20)
  %39 = fadd float %37, %38
  %40 = fcmp ugt float %23, %39
  br i1 %40, label %62, label %41

41:                                               ; preds = %36
  %42 = call <2 x float> @_Zmlf7QVector(float noundef %23, <2 x float> %4)
  %43 = call <2 x float> @_Zpl7QVectorS_(<2 x float> %2, <2 x float> %42)
  %44 = call noundef float @_ZN9QParticle9GetRadiusEv(ptr noundef nonnull align 8 dereferenceable(290) %20)
  %45 = call noundef float @_ZN9QParticle9GetRadiusEv(ptr noundef nonnull align 8 dereferenceable(290) %20)
  %46 = fneg float %28
  %47 = fmul float %28, %46
  %48 = call float @llvm.fmuladd.f32(float %44, float %45, float %47)
  %49 = call noundef float @_ZSt4sqrtf(float noundef %48)
  %50 = call <2 x float> @_Zmlf7QVector(float noundef %49, <2 x float> %4)
  %51 = call <2 x float> @_Zmi7QVectorS_(<2 x float> %43, <2 x float> %50)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #11
  %52 = call <2 x float> @_Zmi7QVectorS_(<2 x float> %51, <2 x float> %2)
  store <2 x float> %52, ptr %11, align 8
  %53 = call noundef float @_ZNK7QVector3DotES_(ptr noundef nonnull align 4 dereferenceable(8) %11, <2 x float> %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #11
  %54 = fcmp ugt float %53, 0.000000e+00
  br i1 %6, label %55, label %57

55:                                               ; preds = %41
  br i1 %54, label %58, label %56

56:                                               ; preds = %55
  br label %58

57:                                               ; preds = %41
  br i1 %54, label %58, label %62

58:                                               ; preds = %57, %55, %56
  %.sroa.012.0 = phi <2 x float> [ %2, %56 ], [ %51, %55 ], [ %51, %57 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #11
  %59 = call <2 x float> @_ZN9QParticle17GetGlobalPositionEv(ptr noundef nonnull align 8 dereferenceable(290) %20)
  %60 = call <2 x float> @_Zmi7QVectorS_(<2 x float> %.sroa.012.0, <2 x float> %59)
  store <2 x float> %60, ptr %12, align 8
  %61 = call <2 x float> @_ZNK7QVector10NormalizedEv(ptr noundef nonnull align 4 dereferenceable(8) %12)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #11
  br label %62

62:                                               ; preds = %58, %57, %36, %32, %27, %.lr.ph
  %.sroa.044.4 = phi <2 x float> [ %.sroa.044.072, %.lr.ph ], [ %.sroa.044.072, %36 ], [ %.sroa.044.072, %32 ], [ %.sroa.044.072, %27 ], [ %61, %58 ], [ %.sroa.044.072, %57 ]
  %.sroa.045.4 = phi <2 x float> [ %.sroa.045.073, %.lr.ph ], [ %.sroa.045.073, %36 ], [ %.sroa.045.073, %32 ], [ %.sroa.045.073, %27 ], [ %.sroa.012.0, %58 ], [ %.sroa.045.073, %57 ]
  %.467 = phi float [ %.06374, %.lr.ph ], [ %.06374, %36 ], [ %.06374, %32 ], [ %.06374, %27 ], [ %23, %58 ], [ %.06374, %57 ]
  %.4 = phi i32 [ %.075, %.lr.ph ], [ %.075, %36 ], [ %.075, %32 ], [ %.075, %27 ], [ %.06871, %58 ], [ %.075, %57 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #11
  %63 = add nuw nsw i32 %.06871, 1
  %64 = call noundef i32 @_ZN5QMesh16GetParticleCountEv(ptr noundef nonnull align 8 dereferenceable(256) %1)
  %65 = icmp slt i32 %63, %64
  br i1 %65, label %.lr.ph, label %._crit_edge, !llvm.loop !9

66:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %13) #11
  call void @_ZN8QRaycast7ContactC2EP5QBody7QVectorS3_f(ptr noundef nonnull align 8 dereferenceable(28) %13, ptr noundef %0, <2 x float> %.sroa.045.4, <2 x float> %.sroa.044.4, float noundef %.467)
  call void @_ZNSt6vectorIN8QRaycast7ContactESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 8 dereferenceable(28) %13)
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %13) #11
  br label %._crit_edge.thread

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

declare noundef i32 @_ZN5QMesh16GetParticleCountEv(ptr noundef nonnull align 8 dereferenceable(256)) local_unnamed_addr #3

declare noundef ptr @_ZN5QMesh13GetParticleAtEi(ptr noundef nonnull align 8 dereferenceable(256), i32 noundef) local_unnamed_addr #3

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZN9QParticle9GetRadiusEv(ptr noundef nonnull align 8 dereferenceable(290)) local_unnamed_addr #6 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3absf(float noundef) local_unnamed_addr #7

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt4sqrtf(float noundef) local_unnamed_addr #7

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

; 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)) local_unnamed_addr #10 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 = { "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 = { 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 #7 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { 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 #9 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #10 = { 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 #11 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


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