; LLVM IR from mtsamis/box2d-optimized :: src/particle/b2_particle_system.ll (ZN16b2ParticleSystem17SolveExtraDampingEv)

; 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.b2Vec2 = type { float, float }
%class.b2ParticleSystem = type { i8, i32, i32, i8, i32, i8, i8, i32, float, float, float, float, i32, i32, %class.b2SlabAllocator, %"struct.b2ParticleSystem::UserOverridableBuffer", %"struct.b2ParticleSystem::UserOverridableBuffer.0", %"struct.b2ParticleSystem::UserOverridableBuffer.2", %"struct.b2ParticleSystem::UserOverridableBuffer.2", ptr, ptr, ptr, ptr, ptr, ptr, %"struct.b2ParticleSystem::UserOverridableBuffer.4", ptr, %"struct.b2ParticleSystem::UserOverridableBuffer.6", i32, [4 x i8], %"struct.b2ParticleSystem::UserOverridableBuffer.8", %"struct.b2ParticleSystem::UserOverridableBuffer.8", %"struct.b2ParticleSystem::UserOverridableBuffer.8", %class.b2GrowableBuffer, %class.b2GrowableBuffer.10, %class.b2GrowableBuffer.11, %class.b2GrowableBuffer.12, %class.b2GrowableBuffer.13, %class.b2GrowableBuffer.14, %"struct.b2ParticleSystem::UserOverridableBuffer.8", %"struct.b2ParticleSystem::UserOverridableBuffer.8", i64, i8, i32, ptr, %struct.b2ParticleSystemDef, ptr, ptr, ptr }
%class.b2SlabAllocator = type { %class.b2TrackedBlockAllocator, i32, %class.b2TypedFreeList }
%class.b2TrackedBlockAllocator = type { %class.b2TypedIntrusiveListNode }
%class.b2TypedIntrusiveListNode = type { %class.b2IntrusiveListNode }
%class.b2IntrusiveListNode = type { ptr, ptr }
%class.b2TypedFreeList = type { %class.b2FreeList }
%class.b2FreeList = type { %class.b2IntrusiveListNode, %class.b2IntrusiveListNode }
%"struct.b2ParticleSystem::UserOverridableBuffer" = type <{ ptr, i32, [4 x i8] }>
%"struct.b2ParticleSystem::UserOverridableBuffer.0" = type <{ ptr, i32, [4 x i8] }>
%"struct.b2ParticleSystem::UserOverridableBuffer.2" = type <{ ptr, i32, [4 x i8] }>
%"struct.b2ParticleSystem::UserOverridableBuffer.4" = type <{ ptr, i32, [4 x i8] }>
%"struct.b2ParticleSystem::UserOverridableBuffer.6" = type <{ ptr, i32, [4 x i8] }>
%class.b2GrowableBuffer = type { ptr, i32, i32, ptr }
%class.b2GrowableBuffer.10 = type { ptr, i32, i32, ptr }
%class.b2GrowableBuffer.11 = type { ptr, i32, i32, ptr }
%class.b2GrowableBuffer.12 = type { ptr, i32, i32, ptr }
%class.b2GrowableBuffer.13 = type { ptr, i32, i32, ptr }
%class.b2GrowableBuffer.14 = type { ptr, i32, i32, ptr }
%"struct.b2ParticleSystem::UserOverridableBuffer.8" = type <{ ptr, i32, [4 x i8] }>
%struct.b2ParticleSystemDef = type { i8, float, float, float, i32, float, float, float, float, float, float, float, float, float, float, float, float, i32, float, i8, float }
%struct.b2ParticleBodyContact = type { i32, ptr, ptr, float, %struct.b2Vec2, float }

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(40) ptr @_ZN16b2GrowableBufferI21b2ParticleBodyContactEixEi(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_Z5b2DotRK6b2Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #4

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN16b2ParticleSystem17SolveExtraDampingEv(ptr noundef nonnull align 8 dereferenceable(632) %0) #5 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca float, align 4
  %8 = alloca %struct.b2Vec2, align 4
  %9 = alloca %struct.b2Vec2, align 4
  %10 = alloca %struct.b2Vec2, align 4
  %11 = alloca %struct.b2Vec2, align 4
  %12 = alloca float, align 4
  %13 = alloca %struct.b2Vec2, align 4
  %14 = alloca %struct.b2Vec2, align 4
  %15 = alloca %struct.b2Vec2, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %16 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %17

17:                                               ; preds = %84, %1
  %18 = load i32, ptr %3, align 4, !tbaa !9
  %19 = getelementptr inbounds %class.b2ParticleSystem, ptr %16, i32 0, i32 36
  %20 = call noundef i32 @_ZNK16b2GrowableBufferI21b2ParticleBodyContactE8GetCountEv(ptr noundef nonnull align 8 dereferenceable(24) %19)
  %21 = icmp slt i32 %18, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %87

23:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  %24 = getelementptr inbounds %class.b2ParticleSystem, ptr %16, i32 0, i32 36
  %25 = load i32, ptr %3, align 4, !tbaa !9
  %26 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZN16b2GrowableBufferI21b2ParticleBodyContactEixEi(ptr noundef nonnull align 8 dereferenceable(24) %24, i32 noundef %25)
  store ptr %26, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.b2ParticleBodyContact, ptr %27, i32 0, i32 0
  %29 = load i32, ptr %28, align 8, !tbaa !11
  store i32 %29, ptr %5, align 4, !tbaa !9
  %30 = getelementptr inbounds %class.b2ParticleSystem, ptr %16, i32 0, i32 16
  %31 = getelementptr inbounds %"struct.b2ParticleSystem::UserOverridableBuffer.0", ptr %30, i32 0, i32 0
  %32 = load ptr, ptr %31, align 8, !tbaa !15
  %33 = load i32, ptr %5, align 4, !tbaa !9
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds i32, ptr %32, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !9
  %37 = and i32 %36, 2048
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %39, label %83

39:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.b2ParticleBodyContact, ptr %40, i32 0, i32 1
  %42 = load ptr, ptr %41, align 8, !tbaa !38
  store ptr %42, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.b2ParticleBodyContact, ptr %43, i32 0, i32 5
  %45 = load float, ptr %44, align 4, !tbaa !39
  store float %45, ptr %7, align 4, !tbaa !40
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.b2ParticleBodyContact, ptr %46, i32 0, i32 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %8, ptr align 4 %47, i64 8, i1 false), !tbaa.struct !41
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %48 = getelementptr inbounds %class.b2ParticleSystem, ptr %16, i32 0, i32 17
  %49 = getelementptr inbounds %"struct.b2ParticleSystem::UserOverridableBuffer.2", ptr %48, i32 0, i32 0
  %50 = load ptr, ptr %49, align 8, !tbaa !42
  %51 = load i32, ptr %5, align 4, !tbaa !9
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds %struct.b2Vec2, ptr %50, i64 %52
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %9, ptr align 4 %53, i64 8, i1 false), !tbaa.struct !41
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = call <2 x float> @_ZNK6b2Body31GetLinearVelocityFromWorldPointERK6b2Vec2(ptr noundef nonnull align 8 dereferenceable(208) %54, ptr noundef nonnull align 4 dereferenceable(8) %9)
  store <2 x float> %55, ptr %11, align 4
  %56 = getelementptr inbounds %class.b2ParticleSystem, ptr %16, i32 0, i32 18
  %57 = getelementptr inbounds %"struct.b2ParticleSystem::UserOverridableBuffer.2", ptr %56, i32 0, i32 0
  %58 = load ptr, ptr %57, align 8, !tbaa !43
  %59 = load i32, ptr %5, align 4, !tbaa !9
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds %struct.b2Vec2, ptr %58, i64 %60
  %62 = call <2 x float> @_ZmiRK6b2Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %11, ptr noundef nonnull align 4 dereferenceable(8) %61)
  store <2 x float> %62, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %63 = call noundef float @_Z5b2DotRK6b2Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %10, ptr noundef nonnull align 4 dereferenceable(8) %8)
  store float %63, ptr %12, align 4, !tbaa !40
  %64 = load float, ptr %12, align 4, !tbaa !40
  %65 = fcmp olt float %64, 0.000000e+00
  br i1 %65, label %66, label %82

66:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %67 = load float, ptr %7, align 4, !tbaa !40
  %68 = fmul float 5.000000e-01, %67
  %69 = load float, ptr %12, align 4, !tbaa !40
  %70 = fmul float %68, %69
  %71 = call <2 x float> @_ZmlfRK6b2Vec2(float noundef %70, ptr noundef nonnull align 4 dereferenceable(8) %8)
  store <2 x float> %71, ptr %13, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %72 = call noundef float @_ZNK16b2ParticleSystem18GetParticleInvMassEv(ptr noundef nonnull align 8 dereferenceable(632) %16)
  %73 = call <2 x float> @_ZmlfRK6b2Vec2(float noundef %72, ptr noundef nonnull align 4 dereferenceable(8) %13)
  store <2 x float> %73, ptr %14, align 4
  %74 = getelementptr inbounds %class.b2ParticleSystem, ptr %16, i32 0, i32 18
  %75 = getelementptr inbounds %"struct.b2ParticleSystem::UserOverridableBuffer.2", ptr %74, i32 0, i32 0
  %76 = load ptr, ptr %75, align 8, !tbaa !43
  %77 = load i32, ptr %5, align 4, !tbaa !9
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds %struct.b2Vec2, ptr %76, i64 %78
  call void @_ZN6b2Vec2pLERKS_(ptr noundef nonnull align 4 dereferenceable(8) %79, ptr noundef nonnull align 4 dereferenceable(8) %14)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  %80 = load ptr, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %81 = call <2 x float> @_ZNK6b2Vec2ngEv(ptr noundef nonnull align 4 dereferenceable(8) %13)
  store <2 x float> %81, ptr %15, align 4
  call void @_ZN6b2Body18ApplyLinearImpulseERK6b2Vec2S2_(ptr noundef nonnull align 8 dereferenceable(208) %80, ptr noundef nonnull align 4 dereferenceable(8) %15, ptr noundef nonnull align 4 dereferenceable(8) %9)
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %82

82:                                               ; preds = %66, %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %83

83:                                               ; preds = %82, %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  br label %84

84:                                               ; preds = %83
  %85 = load i32, ptr %3, align 4, !tbaa !9
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %3, align 4, !tbaa !9
  br label %17, !llvm.loop !44

87:                                               ; preds = %22
  ret void
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6b2Body18ApplyLinearImpulseERK6b2Vec2S2_(ptr noundef nonnull align 8 dereferenceable(208), ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #6 align 2

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree 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"="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 = { 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 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 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_ZTS21b2ParticleBodyContact", !10, i64 0, !6, i64 8, !6, i64 16, !13, i64 24, !14, i64 28, !13, i64 36}
!13 = !{!"float", !7, i64 0}
!14 = !{!"_ZTS6b2Vec2", !13, i64 0, !13, i64 4}
!15 = !{!16, !6, i64 128}
!16 = !{!"_ZTS16b2ParticleSystem", !17, i64 0, !10, i64 4, !10, i64 8, !17, i64 12, !10, i64 16, !17, i64 20, !17, i64 21, !10, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 40, !10, i64 44, !10, i64 48, !18, i64 56, !24, i64 112, !25, i64 128, !26, i64 144, !26, i64 160, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !27, i64 224, !6, i64 240, !28, i64 248, !10, i64 264, !29, i64 272, !29, i64 288, !29, i64 304, !30, i64 320, !31, i64 344, !32, i64 368, !33, i64 392, !34, i64 416, !35, i64 440, !29, i64 464, !29, i64 480, !36, i64 496, !17, i64 504, !10, i64 508, !6, i64 512, !37, i64 520, !6, i64 608, !6, i64 616, !6, i64 624}
!17 = !{!"bool", !7, i64 0}
!18 = !{!"_ZTS15b2SlabAllocatorI16b2ParticleHandleE", !19, i64 0, !10, i64 16, !22, i64 24}
!19 = !{!"_ZTS23b2TrackedBlockAllocator", !20, i64 0}
!20 = !{!"_ZTS24b2TypedIntrusiveListNodeI14b2TrackedBlockE", !21, i64 0}
!21 = !{!"_ZTS19b2IntrusiveListNode", !6, i64 0, !6, i64 8}
!22 = !{!"_ZTS15b2TypedFreeListI16b2ParticleHandleE", !23, i64 0}
!23 = !{!"_ZTS10b2FreeList", !21, i64 0, !21, i64 16}
!24 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferIP16b2ParticleHandleEE", !6, i64 0, !10, i64 8}
!25 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferIjEE", !6, i64 0, !10, i64 8}
!26 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferI6b2Vec2EE", !6, i64 0, !10, i64 8}
!27 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferI15b2ParticleColorEE", !6, i64 0, !10, i64 8}
!28 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferIPvEE", !6, i64 0, !10, i64 8}
!29 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferIiEE", !6, i64 0, !10, i64 8}
!30 = !{!"_ZTS16b2GrowableBufferIiE", !6, i64 0, !10, i64 8, !10, i64 12, !6, i64 16}
!31 = !{!"_ZTS16b2GrowableBufferIN16b2ParticleSystem5ProxyEE", !6, i64 0, !10, i64 8, !10, i64 12, !6, i64 16}
!32 = !{!"_ZTS16b2GrowableBufferI17b2ParticleContactE", !6, i64 0, !10, i64 8, !10, i64 12, !6, i64 16}
!33 = !{!"_ZTS16b2GrowableBufferI21b2ParticleBodyContactE", !6, i64 0, !10, i64 8, !10, i64 12, !6, i64 16}
!34 = !{!"_ZTS16b2GrowableBufferI14b2ParticlePairE", !6, i64 0, !10, i64 8, !10, i64 12, !6, i64 16}
!35 = !{!"_ZTS16b2GrowableBufferI15b2ParticleTriadE", !6, i64 0, !10, i64 8, !10, i64 12, !6, i64 16}
!36 = !{!"long long", !7, i64 0}
!37 = !{!"_ZTS19b2ParticleSystemDef", !17, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !10, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !13, i64 48, !13, i64 52, !13, i64 56, !13, i64 60, !13, i64 64, !10, i64 68, !13, i64 72, !17, i64 76, !13, i64 80}
!38 = !{!12, !6, i64 8}
!39 = !{!12, !13, i64 36}
!40 = !{!13, !13, i64 0}
!41 = !{i64 0, i64 4, !40, i64 4, i64 4, !40}
!42 = !{!16, !6, i64 144}
!43 = !{!16, !6, i64 160}
!44 = distinct !{!44, !45}
!45 = !{!"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.b2Vec2 = type { float, float }

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

; Function Attrs: mustprogress nocallback nofree 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 <2 x float> @_ZmiRK6b2Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(40) ptr @_ZN16b2GrowableBufferI21b2ParticleBodyContactEixEi(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_Z5b2DotRK6b2Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #3

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN16b2ParticleSystem17SolveExtraDampingEv(ptr noundef nonnull align 8 dereferenceable(632) %0) local_unnamed_addr #4 align 2 {
  %2 = alloca %struct.b2Vec2, align 8
  %3 = alloca %struct.b2Vec2, align 8
  %4 = alloca %struct.b2Vec2, align 8
  %5 = alloca %struct.b2Vec2, align 8
  %6 = alloca %struct.b2Vec2, align 8
  %7 = alloca %struct.b2Vec2, align 8
  %8 = alloca %struct.b2Vec2, align 8
  %9 = getelementptr inbounds i8, ptr %0, i64 392
  %10 = tail call noundef i32 @_ZNK16b2GrowableBufferI21b2ParticleBodyContactE8GetCountEv(ptr noundef nonnull align 8 dereferenceable(24) %9)
  %11 = icmp sgt i32 %10, 0
  br i1 %11, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %1
  %12 = getelementptr inbounds i8, ptr %0, i64 128
  %13 = getelementptr inbounds i8, ptr %0, i64 144
  %14 = getelementptr inbounds i8, ptr %0, i64 160
  br label %15

._crit_edge:                                      ; preds = %49, %1
  ret void

15:                                               ; preds = %.lr.ph, %49
  %.017 = phi i32 [ 0, %.lr.ph ], [ %50, %49 ]
  %16 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZN16b2GrowableBufferI21b2ParticleBodyContactEixEi(ptr noundef nonnull align 8 dereferenceable(24) %9, i32 noundef %.017)
  %17 = load i32, ptr %16, align 8, !tbaa !5
  %18 = load ptr, ptr %12, align 8, !tbaa !13
  %19 = sext i32 %17 to i64
  %20 = getelementptr inbounds i32, ptr %18, i64 %19
  %21 = load i32, ptr %20, align 4, !tbaa !36
  %22 = and i32 %21, 2048
  %.not = icmp eq i32 %22, 0
  br i1 %.not, label %49, label %23

23:                                               ; preds = %15
  %24 = getelementptr inbounds i8, ptr %16, i64 8
  %25 = load ptr, ptr %24, align 8, !tbaa !37
  %26 = getelementptr inbounds i8, ptr %16, i64 36
  %27 = load float, ptr %26, align 4, !tbaa !38
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %28 = getelementptr inbounds i8, ptr %16, i64 28
  %29 = load i64, ptr %28, align 4
  store i64 %29, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %30 = load ptr, ptr %13, align 8, !tbaa !39
  %31 = getelementptr inbounds %struct.b2Vec2, ptr %30, i64 %19
  %32 = load i64, ptr %31, align 4
  store i64 %32, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %33 = call <2 x float> @_ZNK6b2Body31GetLinearVelocityFromWorldPointERK6b2Vec2(ptr noundef nonnull align 8 dereferenceable(208) %25, ptr noundef nonnull align 4 dereferenceable(8) %3)
  store <2 x float> %33, ptr %5, align 8
  %34 = load ptr, ptr %14, align 8, !tbaa !40
  %35 = getelementptr inbounds %struct.b2Vec2, ptr %34, i64 %19
  %36 = call <2 x float> @_ZmiRK6b2Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(8) %35)
  store <2 x float> %36, ptr %4, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  %37 = call noundef float @_Z5b2DotRK6b2Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(8) %2)
  %38 = fcmp olt float %37, 0.000000e+00
  br i1 %38, label %39, label %48

39:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %40 = fmul float %27, 5.000000e-01
  %41 = fmul float %40, %37
  %42 = call <2 x float> @_ZmlfRK6b2Vec2(float noundef %41, ptr noundef nonnull align 4 dereferenceable(8) %2)
  store <2 x float> %42, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %43 = call noundef float @_ZNK16b2ParticleSystem18GetParticleInvMassEv(ptr noundef nonnull align 8 dereferenceable(632) %0)
  %44 = call <2 x float> @_ZmlfRK6b2Vec2(float noundef %43, ptr noundef nonnull align 4 dereferenceable(8) %6)
  store <2 x float> %44, ptr %7, align 8
  %45 = load ptr, ptr %14, align 8, !tbaa !40
  %46 = getelementptr inbounds %struct.b2Vec2, ptr %45, i64 %19
  call void @_ZN6b2Vec2pLERKS_(ptr noundef nonnull align 4 dereferenceable(8) %46, ptr noundef nonnull align 4 dereferenceable(8) %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  %47 = call <2 x float> @_ZNK6b2Vec2ngEv(ptr noundef nonnull align 4 dereferenceable(8) %6)
  store <2 x float> %47, ptr %8, align 8
  call void @_ZN6b2Body18ApplyLinearImpulseERK6b2Vec2S2_(ptr noundef nonnull align 8 dereferenceable(208) %25, ptr noundef nonnull align 4 dereferenceable(8) %8, ptr noundef nonnull align 4 dereferenceable(8) %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  br label %48

48:                                               ; preds = %39, %23
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  br label %49

49:                                               ; preds = %48, %15
  %50 = add nuw nsw i32 %.017, 1
  %51 = call noundef i32 @_ZNK16b2GrowableBufferI21b2ParticleBodyContactE8GetCountEv(ptr noundef nonnull align 8 dereferenceable(24) %9)
  %52 = icmp slt i32 %50, %51
  br i1 %52, label %15, label %._crit_edge, !llvm.loop !41
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK16b2ParticleSystem18GetParticleInvMassEv(ptr noundef nonnull align 8 dereferenceable(632)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6b2Body18ApplyLinearImpulseERK6b2Vec2S2_(ptr noundef nonnull align 8 dereferenceable(208), ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #5 align 2

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 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 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"_ZTS21b2ParticleBodyContact", !7, i64 0, !10, i64 8, !10, i64 16, !11, i64 24, !12, i64 28, !11, i64 36}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{!"_ZTS6b2Vec2", !11, i64 0, !11, i64 4}
!13 = !{!14, !10, i64 128}
!14 = !{!"_ZTS16b2ParticleSystem", !15, i64 0, !7, i64 4, !7, i64 8, !15, i64 12, !7, i64 16, !15, i64 20, !15, i64 21, !7, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !7, i64 44, !7, i64 48, !16, i64 56, !22, i64 112, !23, i64 128, !24, i64 144, !24, i64 160, !10, i64 176, !10, i64 184, !10, i64 192, !10, i64 200, !10, i64 208, !10, i64 216, !25, i64 224, !10, i64 240, !26, i64 248, !7, i64 264, !27, i64 272, !27, i64 288, !27, i64 304, !28, i64 320, !29, i64 344, !30, i64 368, !31, i64 392, !32, i64 416, !33, i64 440, !27, i64 464, !27, i64 480, !34, i64 496, !15, i64 504, !7, i64 508, !10, i64 512, !35, i64 520, !10, i64 608, !10, i64 616, !10, i64 624}
!15 = !{!"bool", !8, i64 0}
!16 = !{!"_ZTS15b2SlabAllocatorI16b2ParticleHandleE", !17, i64 0, !7, i64 16, !20, i64 24}
!17 = !{!"_ZTS23b2TrackedBlockAllocator", !18, i64 0}
!18 = !{!"_ZTS24b2TypedIntrusiveListNodeI14b2TrackedBlockE", !19, i64 0}
!19 = !{!"_ZTS19b2IntrusiveListNode", !10, i64 0, !10, i64 8}
!20 = !{!"_ZTS15b2TypedFreeListI16b2ParticleHandleE", !21, i64 0}
!21 = !{!"_ZTS10b2FreeList", !19, i64 0, !19, i64 16}
!22 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferIP16b2ParticleHandleEE", !10, i64 0, !7, i64 8}
!23 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferIjEE", !10, i64 0, !7, i64 8}
!24 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferI6b2Vec2EE", !10, i64 0, !7, i64 8}
!25 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferI15b2ParticleColorEE", !10, i64 0, !7, i64 8}
!26 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferIPvEE", !10, i64 0, !7, i64 8}
!27 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferIiEE", !10, i64 0, !7, i64 8}
!28 = !{!"_ZTS16b2GrowableBufferIiE", !10, i64 0, !7, i64 8, !7, i64 12, !10, i64 16}
!29 = !{!"_ZTS16b2GrowableBufferIN16b2ParticleSystem5ProxyEE", !10, i64 0, !7, i64 8, !7, i64 12, !10, i64 16}
!30 = !{!"_ZTS16b2GrowableBufferI17b2ParticleContactE", !10, i64 0, !7, i64 8, !7, i64 12, !10, i64 16}
!31 = !{!"_ZTS16b2GrowableBufferI21b2ParticleBodyContactE", !10, i64 0, !7, i64 8, !7, i64 12, !10, i64 16}
!32 = !{!"_ZTS16b2GrowableBufferI14b2ParticlePairE", !10, i64 0, !7, i64 8, !7, i64 12, !10, i64 16}
!33 = !{!"_ZTS16b2GrowableBufferI15b2ParticleTriadE", !10, i64 0, !7, i64 8, !7, i64 12, !10, i64 16}
!34 = !{!"long long", !8, i64 0}
!35 = !{!"_ZTS19b2ParticleSystemDef", !15, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !7, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !11, i64 64, !7, i64 68, !11, i64 72, !15, i64 76, !11, i64 80}
!36 = !{!7, !7, i64 0}
!37 = !{!6, !10, i64 8}
!38 = !{!6, !11, i64 36}
!39 = !{!14, !10, i64 144}
!40 = !{!14, !10, i64 160}
!41 = distinct !{!41, !42}
!42 = !{!"llvm.loop.mustprogress"}


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