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

; 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.std::pair" = type { i32, i32 }
%struct.QVector = type { float, float }

@_ZN6QWorld14MAX_WORLD_SIZEE = external dso_local global float, align 4

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIP9QParticleSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 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) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local <2 x float> @_ZN9QParticle17GetGlobalPositionEv(ptr noundef nonnull align 8 dereferenceable(290)) #2 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) #3

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

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

; 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local i64 @_ZN10QCollision24FindNearestSideOfPolygonE7QVectorSt6vectorIP9QParticleSaIS3_EEbb(<2 x float> %0, ptr noundef %1, i1 noundef zeroext %2, i1 noundef zeroext %3) #5 align 2 {
  %5 = alloca %"struct.std::pair", align 4
  %6 = alloca %struct.QVector, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i8, align 1
  %9 = alloca i8, align 1
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca float, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca %struct.QVector, align 4
  %20 = alloca %struct.QVector, align 4
  %21 = alloca %struct.QVector, align 4
  %22 = alloca %struct.QVector, align 4
  %23 = alloca %struct.QVector, align 4
  %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
  store <2 x float> %0, ptr %6, align 4
  store ptr %1, ptr %7, align 8, !tbaa !5
  %31 = zext i1 %2 to i8
  store i8 %31, ptr %8, align 1, !tbaa !9
  %32 = zext i1 %3 to i8
  store i8 %32, ptr %9, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #9
  store i32 -1, ptr %10, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #9
  store i32 -1, ptr %11, align 4, !tbaa !11
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %11)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #9
  %33 = call noundef i64 @_ZNKSt6vectorIP9QParticleSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #9
  %34 = trunc i64 %33 to i32
  store i32 %34, ptr %12, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #9
  %35 = load float, ptr @_ZN6QWorld14MAX_WORLD_SIZEE, align 4, !tbaa !13
  store float %35, ptr %13, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #9
  store i32 0, ptr %14, align 4, !tbaa !11
  br label %36

36:                                               ; preds = %110, %4
  %37 = load i32, ptr %14, align 4, !tbaa !11
  %38 = load i32, ptr %12, align 4, !tbaa !11
  %39 = icmp slt i32 %37, %38
  br i1 %39, label %41, label %40

40:                                               ; preds = %36
  store i32 2, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #9
  br label %113

41:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #9
  %42 = load i32, ptr %14, align 4, !tbaa !11
  %43 = add nsw i32 %42, 1
  %44 = load i32, ptr %12, align 4, !tbaa !11
  %45 = srem i32 %43, %44
  store i32 %45, ptr %16, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #9
  %46 = load i32, ptr %14, align 4, !tbaa !11
  %47 = sext i32 %46 to i64
  %48 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP9QParticleSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %47) #9
  %49 = load ptr, ptr %48, align 8, !tbaa !5
  store ptr %49, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #9
  %50 = load i32, ptr %16, align 4, !tbaa !11
  %51 = sext i32 %50 to i64
  %52 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP9QParticleSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %51) #9
  %53 = load ptr, ptr %52, align 8, !tbaa !5
  store ptr %53, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %20, ptr align 4 %6, i64 8, i1 false), !tbaa.struct !15
  %54 = load ptr, ptr %17, align 8, !tbaa !5
  %55 = call <2 x float> @_ZN9QParticle17GetGlobalPositionEv(ptr noundef nonnull align 8 dereferenceable(290) %54)
  store <2 x float> %55, ptr %21, align 4
  %56 = load <2 x float>, ptr %20, align 4
  %57 = load <2 x float>, ptr %21, align 4
  %58 = call <2 x float> @_Zmi7QVectorS_(<2 x float> %56, <2 x float> %57)
  store <2 x float> %58, ptr %19, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #9
  %59 = load ptr, ptr %18, align 8, !tbaa !5
  %60 = call <2 x float> @_ZN9QParticle17GetGlobalPositionEv(ptr noundef nonnull align 8 dereferenceable(290) %59)
  store <2 x float> %60, ptr %23, align 4
  %61 = load ptr, ptr %17, align 8, !tbaa !5
  %62 = call <2 x float> @_ZN9QParticle17GetGlobalPositionEv(ptr noundef nonnull align 8 dereferenceable(290) %61)
  store <2 x float> %62, ptr %24, align 4
  %63 = load <2 x float>, ptr %23, align 4
  %64 = load <2 x float>, ptr %24, align 4
  %65 = call <2 x float> @_Zmi7QVectorS_(<2 x float> %63, <2 x float> %64)
  store <2 x float> %65, ptr %22, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #9
  %66 = call <2 x float> @_ZNK7QVector13PerpendicularEv(ptr noundef nonnull align 4 dereferenceable(8) %22)
  store <2 x float> %66, ptr %25, align 4
  %67 = load i8, ptr %8, align 1, !tbaa !9, !range !16, !noundef !17
  %68 = trunc i8 %67 to i1
  br i1 %68, label %69, label %84

69:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #9
  %70 = call <2 x float> @_ZNK7QVector10NormalizedEv(ptr noundef nonnull align 4 dereferenceable(8) %22)
  store <2 x float> %70, ptr %26, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %28, ptr align 4 %26, 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) %19, <2 x float> %71)
  store float %72, ptr %27, align 4, !tbaa !13
  %73 = load float, ptr %27, align 4, !tbaa !13
  %74 = fcmp olt float %73, 0.000000e+00
  br i1 %74, label %79, label %75

75:                                               ; preds = %69
  %76 = load float, ptr %27, align 4, !tbaa !13
  %77 = call noundef float @_ZNK7QVector6LengthEv(ptr noundef nonnull align 4 dereferenceable(8) %22)
  %78 = fcmp ogt float %76, %77
  br i1 %78, label %79, label %80

79:                                               ; preds = %75, %69
  store i32 4, ptr %15, align 4
  br label %81

80:                                               ; preds = %75
  store i32 0, ptr %15, align 4
  br label %81

81:                                               ; preds = %80, %79
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #9
  %82 = load i32, ptr %15, align 4
  switch i32 %82, label %107 [
    i32 0, label %83
  ]

83:                                               ; preds = %81
  br label %84

84:                                               ; preds = %83, %41
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %30, ptr align 4 %25, i64 8, i1 false), !tbaa.struct !15
  %85 = load <2 x float>, ptr %30, align 4
  %86 = call noundef float @_ZNK7QVector3DotES_(ptr noundef nonnull align 4 dereferenceable(8) %19, <2 x float> %85)
  store float %86, ptr %29, align 4, !tbaa !13
  %87 = load i8, ptr %9, align 1, !tbaa !9, !range !16, !noundef !17
  %88 = trunc i8 %87 to i1
  br i1 %88, label %89, label %93

89:                                               ; preds = %84
  %90 = load float, ptr %29, align 4, !tbaa !13
  %91 = fcmp ogt float %90, 0.000000e+00
  br i1 %91, label %92, label %93

92:                                               ; preds = %89
  store i32 4, ptr %15, align 4
  br label %106

93:                                               ; preds = %89, %84
  %94 = load float, ptr %29, align 4, !tbaa !13
  %95 = call noundef float @_ZSt3absf(float noundef %94)
  %96 = load float, ptr %13, align 4, !tbaa !13
  %97 = fcmp olt float %95, %96
  br i1 %97, label %98, label %105

98:                                               ; preds = %93
  %99 = load i32, ptr %14, align 4, !tbaa !11
  %100 = getelementptr inbounds %"struct.std::pair", ptr %5, i32 0, i32 0
  store i32 %99, ptr %100, align 4, !tbaa !18
  %101 = load i32, ptr %16, align 4, !tbaa !11
  %102 = getelementptr inbounds %"struct.std::pair", ptr %5, i32 0, i32 1
  store i32 %101, ptr %102, align 4, !tbaa !20
  %103 = load float, ptr %29, align 4, !tbaa !13
  %104 = call noundef float @_ZSt3absf(float noundef %103)
  store float %104, ptr %13, align 4, !tbaa !13
  br label %105

105:                                              ; preds = %98, %93
  store i32 0, ptr %15, align 4
  br label %106

106:                                              ; preds = %105, %92
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #9
  br label %107

107:                                              ; preds = %106, %81
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #9
  %108 = load i32, ptr %15, align 4
  switch i32 %108, label %115 [
    i32 0, label %109
    i32 4, label %110
  ]

109:                                              ; preds = %107
  br label %110

110:                                              ; preds = %109, %107
  %111 = load i32, ptr %14, align 4, !tbaa !11
  %112 = add nsw i32 %111, 1
  store i32 %112, ptr %14, align 4, !tbaa !11
  br label %36, !llvm.loop !21

113:                                              ; preds = %40
  store i32 1, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  %114 = load i64, ptr %5, align 4
  ret i64 %114

115:                                              ; preds = %107
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #1 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { 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 #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 = { 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 #8 = { 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 #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 = !{!"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 = !{!19, !12, i64 0}
!19 = !{!"_ZTSSt4pairIiiE", !12, i64 0, !12, i64 4}
!20 = !{!19, !12, i64 4}
!21 = distinct !{!21, !22}
!22 = !{!"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.std::pair" = type { i32, i32 }
%struct.QVector = type { float, float }

@_ZN6QWorld14MAX_WORLD_SIZEE = external dso_local local_unnamed_addr global float, align 4

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIP9QParticleSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 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 #1 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3absf(float 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 #4

; 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local i64 @_ZN10QCollision24FindNearestSideOfPolygonE7QVectorSt6vectorIP9QParticleSaIS3_EEbb(<2 x float> %0, ptr noundef %1, i1 noundef zeroext %2, i1 noundef zeroext %3) local_unnamed_addr #4 align 2 {
  %5 = alloca %"struct.std::pair", align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %struct.QVector, align 8
  %9 = alloca %struct.QVector, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #8
  store i32 -1, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #8
  store i32 -1, ptr %7, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #8
  %10 = call noundef i64 @_ZNKSt6vectorIP9QParticleSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #8
  %11 = trunc i64 %10 to i32
  %12 = load float, ptr @_ZN6QWorld14MAX_WORLD_SIZEE, align 4, !tbaa !9
  %13 = icmp sgt i32 %11, 0
  br i1 %13, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %4
  %14 = getelementptr inbounds i8, ptr %5, i64 4
  %15 = and i64 %10, 2147483647
  br i1 %2, label %.lr.ph.split.us, label %.lr.ph.split

.lr.ph.split.us:                                  ; preds = %.lr.ph, %43
  %indvars.iv50 = phi i64 [ %indvars.iv.next51, %43 ], [ 0, %.lr.ph ]
  %.034.us = phi float [ %.3.us, %43 ], [ %12, %.lr.ph ]
  %indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
  %16 = icmp eq i64 %indvars.iv.next51, %15
  %17 = trunc nuw nsw i64 %indvars.iv.next51 to i32
  %iv.rem49 = select i1 %16, i32 0, i32 %17
  %18 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP9QParticleSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %indvars.iv50) #8
  %19 = load ptr, ptr %18, align 8, !tbaa !11
  %20 = zext nneg i32 %iv.rem49 to i64
  %21 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP9QParticleSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %20) #8
  %22 = load ptr, ptr %21, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  %23 = call <2 x float> @_ZN9QParticle17GetGlobalPositionEv(ptr noundef nonnull align 8 dereferenceable(290) %19)
  %24 = call <2 x float> @_Zmi7QVectorS_(<2 x float> %0, <2 x float> %23)
  store <2 x float> %24, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #8
  %25 = call <2 x float> @_ZN9QParticle17GetGlobalPositionEv(ptr noundef nonnull align 8 dereferenceable(290) %22)
  %26 = call <2 x float> @_ZN9QParticle17GetGlobalPositionEv(ptr noundef nonnull align 8 dereferenceable(290) %19)
  %27 = call <2 x float> @_Zmi7QVectorS_(<2 x float> %25, <2 x float> %26)
  store <2 x float> %27, ptr %9, align 8
  %28 = call <2 x float> @_ZNK7QVector13PerpendicularEv(ptr noundef nonnull align 4 dereferenceable(8) %9)
  %29 = call <2 x float> @_ZNK7QVector10NormalizedEv(ptr noundef nonnull align 4 dereferenceable(8) %9)
  %30 = call noundef float @_ZNK7QVector3DotES_(ptr noundef nonnull align 4 dereferenceable(8) %8, <2 x float> %29)
  %31 = fcmp olt float %30, 0.000000e+00
  br i1 %31, label %43, label %32

32:                                               ; preds = %.lr.ph.split.us
  %33 = call noundef float @_ZNK7QVector6LengthEv(ptr noundef nonnull align 4 dereferenceable(8) %9)
  %34 = fcmp ogt float %30, %33
  br i1 %34, label %43, label %.critedge.us

.critedge.us:                                     ; preds = %32
  %35 = call noundef float @_ZNK7QVector3DotES_(ptr noundef nonnull align 4 dereferenceable(8) %8, <2 x float> %28)
  %36 = fcmp ogt float %35, 0.000000e+00
  %or.cond.us = and i1 %36, %3
  br i1 %or.cond.us, label %43, label %37

37:                                               ; preds = %.critedge.us
  %38 = call noundef float @_ZSt3absf(float noundef %35)
  %39 = fcmp olt float %38, %.034.us
  br i1 %39, label %40, label %43

40:                                               ; preds = %37
  %41 = trunc nuw nsw i64 %indvars.iv50 to i32
  store i32 %41, ptr %5, align 8, !tbaa !13
  store i32 %iv.rem49, ptr %14, align 4, !tbaa !15
  %42 = call noundef float @_ZSt3absf(float noundef %35)
  br label %43

43:                                               ; preds = %40, %37, %.critedge.us, %32, %.lr.ph.split.us
  %.3.us = phi float [ %.034.us, %.lr.ph.split.us ], [ %.034.us, %32 ], [ %.034.us, %.critedge.us ], [ %42, %40 ], [ %.034.us, %37 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  %exitcond54.not = icmp eq i64 %indvars.iv.next51, %15
  br i1 %exitcond54.not, label %._crit_edge, label %.lr.ph.split.us, !llvm.loop !16

.lr.ph.split:                                     ; preds = %.lr.ph
  br i1 %3, label %.critedge, label %.critedge.us35

.critedge.us35:                                   ; preds = %.lr.ph.split, %63
  %indvars.iv = phi i64 [ %indvars.iv.next, %63 ], [ 0, %.lr.ph.split ]
  %.034.us36 = phi float [ %.3.us39, %63 ], [ %12, %.lr.ph.split ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %44 = icmp eq i64 %indvars.iv.next, %15
  %45 = trunc nuw nsw i64 %indvars.iv.next to i32
  %iv.rem = select i1 %44, i32 0, i32 %45
  %46 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP9QParticleSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %indvars.iv) #8
  %47 = load ptr, ptr %46, align 8, !tbaa !11
  %48 = zext nneg i32 %iv.rem to i64
  %49 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP9QParticleSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %48) #8
  %50 = load ptr, ptr %49, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  %51 = call <2 x float> @_ZN9QParticle17GetGlobalPositionEv(ptr noundef nonnull align 8 dereferenceable(290) %47)
  %52 = call <2 x float> @_Zmi7QVectorS_(<2 x float> %0, <2 x float> %51)
  store <2 x float> %52, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #8
  %53 = call <2 x float> @_ZN9QParticle17GetGlobalPositionEv(ptr noundef nonnull align 8 dereferenceable(290) %50)
  %54 = call <2 x float> @_ZN9QParticle17GetGlobalPositionEv(ptr noundef nonnull align 8 dereferenceable(290) %47)
  %55 = call <2 x float> @_Zmi7QVectorS_(<2 x float> %53, <2 x float> %54)
  store <2 x float> %55, ptr %9, align 8
  %56 = call <2 x float> @_ZNK7QVector13PerpendicularEv(ptr noundef nonnull align 4 dereferenceable(8) %9)
  %57 = call noundef float @_ZNK7QVector3DotES_(ptr noundef nonnull align 4 dereferenceable(8) %8, <2 x float> %56)
  %58 = call noundef float @_ZSt3absf(float noundef %57)
  %59 = fcmp olt float %58, %.034.us36
  br i1 %59, label %60, label %63

60:                                               ; preds = %.critedge.us35
  %61 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %61, ptr %5, align 8, !tbaa !13
  store i32 %iv.rem, ptr %14, align 4, !tbaa !15
  %62 = call noundef float @_ZSt3absf(float noundef %57)
  br label %63

63:                                               ; preds = %60, %.critedge.us35
  %.3.us39 = phi float [ %62, %60 ], [ %.034.us36, %.critedge.us35 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  %exitcond.not = icmp eq i64 %indvars.iv.next, %15
  br i1 %exitcond.not, label %._crit_edge, label %.critedge.us35, !llvm.loop !16

._crit_edge:                                      ; preds = %63, %86, %43, %4
  %64 = load i64, ptr %5, align 8
  ret i64 %64

.critedge:                                        ; preds = %.lr.ph.split, %86
  %indvars.iv44 = phi i64 [ %indvars.iv.next45, %86 ], [ 0, %.lr.ph.split ]
  %.034 = phi float [ %.3, %86 ], [ %12, %.lr.ph.split ]
  %indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
  %65 = icmp eq i64 %indvars.iv.next45, %15
  %66 = trunc nuw nsw i64 %indvars.iv.next45 to i32
  %iv.rem43 = select i1 %65, i32 0, i32 %66
  %67 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP9QParticleSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %indvars.iv44) #8
  %68 = load ptr, ptr %67, align 8, !tbaa !11
  %69 = zext nneg i32 %iv.rem43 to i64
  %70 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP9QParticleSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %69) #8
  %71 = load ptr, ptr %70, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  %72 = call <2 x float> @_ZN9QParticle17GetGlobalPositionEv(ptr noundef nonnull align 8 dereferenceable(290) %68)
  %73 = call <2 x float> @_Zmi7QVectorS_(<2 x float> %0, <2 x float> %72)
  store <2 x float> %73, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #8
  %74 = call <2 x float> @_ZN9QParticle17GetGlobalPositionEv(ptr noundef nonnull align 8 dereferenceable(290) %71)
  %75 = call <2 x float> @_ZN9QParticle17GetGlobalPositionEv(ptr noundef nonnull align 8 dereferenceable(290) %68)
  %76 = call <2 x float> @_Zmi7QVectorS_(<2 x float> %74, <2 x float> %75)
  store <2 x float> %76, ptr %9, align 8
  %77 = call <2 x float> @_ZNK7QVector13PerpendicularEv(ptr noundef nonnull align 4 dereferenceable(8) %9)
  %78 = call noundef float @_ZNK7QVector3DotES_(ptr noundef nonnull align 4 dereferenceable(8) %8, <2 x float> %77)
  %79 = fcmp ogt float %78, 0.000000e+00
  br i1 %79, label %86, label %80

80:                                               ; preds = %.critedge
  %81 = call noundef float @_ZSt3absf(float noundef %78)
  %82 = fcmp olt float %81, %.034
  br i1 %82, label %83, label %86

83:                                               ; preds = %80
  %84 = trunc nuw nsw i64 %indvars.iv44 to i32
  store i32 %84, ptr %5, align 8, !tbaa !13
  store i32 %iv.rem43, ptr %14, align 4, !tbaa !15
  %85 = call noundef float @_ZSt3absf(float noundef %78)
  br label %86

86:                                               ; preds = %.critedge, %83, %80
  %.3 = phi float [ %.034, %.critedge ], [ %85, %83 ], [ %.034, %80 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  %exitcond48.not = icmp eq i64 %indvars.iv.next45, %15
  br i1 %exitcond48.not, label %._crit_edge, label %.critedge, !llvm.loop !16
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #1 align 2

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


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