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

; 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.b2TimeStep = type { float, float, float, i32, i32, i32, i8 }

@.str.1 = external hidden unnamed_addr constant [93 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [14 x i8], align 1
@__PRETTY_FUNCTION__._ZN16b2ParticleSystem10SolveSolidERK10b2TimeStep = external hidden unnamed_addr constant [54 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #0

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK17b2ParticleContact9GetWeightEv(ptr noundef nonnull align 4 dereferenceable(24)) #4 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN16b2ParticleSystem10SolveSolidERK10b2TimeStep(ptr noundef nonnull align 8 dereferenceable(632) %0, ptr noundef nonnull align 4 dereferenceable(28) %1) #5 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca float, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca float, align 4
  %11 = alloca %struct.b2Vec2, align 4
  %12 = alloca float, align 4
  %13 = alloca %struct.b2Vec2, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %14 = load ptr, ptr %3, align 8
  %15 = getelementptr inbounds %class.b2ParticleSystem, ptr %14, i32 0, i32 24
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  %17 = icmp ne ptr %16, null
  br i1 %17, label %18, label %19

18:                                               ; preds = %2
  br label %21

19:                                               ; preds = %2
  call void @__assert_fail(ptr noundef @.str.26, ptr noundef @.str.1, i32 noundef 3510, ptr noundef @__PRETTY_FUNCTION__._ZN16b2ParticleSystem10SolveSolidERK10b2TimeStep) #6
  unreachable

20:                                               ; No predecessors!
  br label %21

21:                                               ; preds = %20, %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.b2TimeStep, ptr %22, i32 0, i32 1
  %24 = load float, ptr %23, align 4, !tbaa !34
  %25 = getelementptr inbounds %class.b2ParticleSystem, ptr %14, i32 0, i32 45
  %26 = getelementptr inbounds %struct.b2ParticleSystemDef, ptr %25, i32 0, i32 14
  %27 = load float, ptr %26, align 8, !tbaa !36
  %28 = fmul float %24, %27
  store float %28, ptr %5, align 4, !tbaa !37
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 0, ptr %6, align 4, !tbaa !38
  br label %29

29:                                               ; preds = %93, %21
  %30 = load i32, ptr %6, align 4, !tbaa !38
  %31 = getelementptr inbounds %class.b2ParticleSystem, ptr %14, i32 0, i32 35
  %32 = call noundef i32 @_ZNK16b2GrowableBufferI17b2ParticleContactE8GetCountEv(ptr noundef nonnull align 8 dereferenceable(24) %31)
  %33 = icmp slt i32 %30, %32
  br i1 %33, label %35, label %34

34:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %96

35:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %36 = getelementptr inbounds %class.b2ParticleSystem, ptr %14, i32 0, i32 35
  %37 = load i32, ptr %6, align 4, !tbaa !38
  %38 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZN16b2GrowableBufferI17b2ParticleContactEixEi(ptr noundef nonnull align 8 dereferenceable(24) %36, i32 noundef %37)
  store ptr %38, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = call noundef i32 @_ZNK17b2ParticleContact9GetIndexAEv(ptr noundef nonnull align 4 dereferenceable(24) %39)
  store i32 %40, ptr %8, align 4, !tbaa !38
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  %42 = call noundef i32 @_ZNK17b2ParticleContact9GetIndexBEv(ptr noundef nonnull align 4 dereferenceable(24) %41)
  store i32 %42, ptr %9, align 4, !tbaa !38
  %43 = getelementptr inbounds %class.b2ParticleSystem, ptr %14, i32 0, i32 26
  %44 = load ptr, ptr %43, align 8, !tbaa !39
  %45 = load i32, ptr %8, align 4, !tbaa !38
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds ptr, ptr %44, i64 %46
  %48 = load ptr, ptr %47, align 8, !tbaa !5
  %49 = getelementptr inbounds %class.b2ParticleSystem, ptr %14, i32 0, i32 26
  %50 = load ptr, ptr %49, align 8, !tbaa !39
  %51 = load i32, ptr %9, align 4, !tbaa !38
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds ptr, ptr %50, i64 %52
  %54 = load ptr, ptr %53, align 8, !tbaa !5
  %55 = icmp ne ptr %48, %54
  br i1 %55, label %56, label %92

56:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  %58 = call noundef float @_ZNK17b2ParticleContact9GetWeightEv(ptr noundef nonnull align 4 dereferenceable(24) %57)
  store float %58, ptr %10, align 4, !tbaa !37
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %59 = load ptr, ptr %7, align 8, !tbaa !5
  %60 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNK17b2ParticleContact9GetNormalEv(ptr noundef nonnull align 4 dereferenceable(24) %59)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %11, ptr align 4 %60, i64 8, i1 false), !tbaa.struct !40
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %61 = getelementptr inbounds %class.b2ParticleSystem, ptr %14, i32 0, i32 24
  %62 = load ptr, ptr %61, align 8, !tbaa !9
  %63 = load i32, ptr %8, align 4, !tbaa !38
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds float, ptr %62, i64 %64
  %66 = load float, ptr %65, align 4, !tbaa !37
  %67 = getelementptr inbounds %class.b2ParticleSystem, ptr %14, i32 0, i32 24
  %68 = load ptr, ptr %67, align 8, !tbaa !9
  %69 = load i32, ptr %9, align 4, !tbaa !38
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds float, ptr %68, i64 %70
  %72 = load float, ptr %71, align 4, !tbaa !37
  %73 = fadd float %66, %72
  store float %73, ptr %12, align 4, !tbaa !37
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %74 = load float, ptr %5, align 4, !tbaa !37
  %75 = load float, ptr %12, align 4, !tbaa !37
  %76 = fmul float %74, %75
  %77 = load float, ptr %10, align 4, !tbaa !37
  %78 = fmul float %76, %77
  %79 = call <2 x float> @_ZmlfRK6b2Vec2(float noundef %78, ptr noundef nonnull align 4 dereferenceable(8) %11)
  store <2 x float> %79, ptr %13, align 4
  %80 = getelementptr inbounds %class.b2ParticleSystem, ptr %14, i32 0, i32 18
  %81 = getelementptr inbounds %"struct.b2ParticleSystem::UserOverridableBuffer.2", ptr %80, i32 0, i32 0
  %82 = load ptr, ptr %81, align 8, !tbaa !41
  %83 = load i32, ptr %8, align 4, !tbaa !38
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds %struct.b2Vec2, ptr %82, i64 %84
  call void @_ZN6b2Vec2mIERKS_(ptr noundef nonnull align 4 dereferenceable(8) %85, ptr noundef nonnull align 4 dereferenceable(8) %13)
  %86 = getelementptr inbounds %class.b2ParticleSystem, ptr %14, i32 0, i32 18
  %87 = getelementptr inbounds %"struct.b2ParticleSystem::UserOverridableBuffer.2", ptr %86, i32 0, i32 0
  %88 = load ptr, ptr %87, align 8, !tbaa !41
  %89 = load i32, ptr %9, align 4, !tbaa !38
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds %struct.b2Vec2, ptr %88, i64 %90
  call void @_ZN6b2Vec2pLERKS_(ptr noundef nonnull align 4 dereferenceable(8) %91, ptr noundef nonnull align 4 dereferenceable(8) %13)
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %92

92:                                               ; preds = %56, %35
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  br label %93

93:                                               ; preds = %92
  %94 = load i32, ptr %6, align 4, !tbaa !38
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %6, align 4, !tbaa !38
  br label %29, !llvm.loop !42

96:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  ret void
}

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

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

attributes #0 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint mustprogress uwtable "min-legal-vector-width"="64" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nounwind uwtable "min-legal-vector-width"="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 = { noreturn nounwind }
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, !6, i64 216}
!10 = !{!"_ZTS16b2ParticleSystem", !11, i64 0, !12, i64 4, !12, i64 8, !11, i64 12, !12, i64 16, !11, i64 20, !11, i64 21, !12, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 40, !12, i64 44, !12, i64 48, !14, i64 56, !20, i64 112, !21, i64 128, !22, i64 144, !22, i64 160, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !23, i64 224, !6, i64 240, !24, i64 248, !12, i64 264, !25, i64 272, !25, i64 288, !25, i64 304, !26, i64 320, !27, i64 344, !28, i64 368, !29, i64 392, !30, i64 416, !31, i64 440, !25, i64 464, !25, i64 480, !32, i64 496, !11, i64 504, !12, i64 508, !6, i64 512, !33, i64 520, !6, i64 608, !6, i64 616, !6, i64 624}
!11 = !{!"bool", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!"float", !7, i64 0}
!14 = !{!"_ZTS15b2SlabAllocatorI16b2ParticleHandleE", !15, i64 0, !12, i64 16, !18, i64 24}
!15 = !{!"_ZTS23b2TrackedBlockAllocator", !16, i64 0}
!16 = !{!"_ZTS24b2TypedIntrusiveListNodeI14b2TrackedBlockE", !17, i64 0}
!17 = !{!"_ZTS19b2IntrusiveListNode", !6, i64 0, !6, i64 8}
!18 = !{!"_ZTS15b2TypedFreeListI16b2ParticleHandleE", !19, i64 0}
!19 = !{!"_ZTS10b2FreeList", !17, i64 0, !17, i64 16}
!20 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferIP16b2ParticleHandleEE", !6, i64 0, !12, i64 8}
!21 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferIjEE", !6, i64 0, !12, i64 8}
!22 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferI6b2Vec2EE", !6, i64 0, !12, i64 8}
!23 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferI15b2ParticleColorEE", !6, i64 0, !12, i64 8}
!24 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferIPvEE", !6, i64 0, !12, i64 8}
!25 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferIiEE", !6, i64 0, !12, i64 8}
!26 = !{!"_ZTS16b2GrowableBufferIiE", !6, i64 0, !12, i64 8, !12, i64 12, !6, i64 16}
!27 = !{!"_ZTS16b2GrowableBufferIN16b2ParticleSystem5ProxyEE", !6, i64 0, !12, i64 8, !12, i64 12, !6, i64 16}
!28 = !{!"_ZTS16b2GrowableBufferI17b2ParticleContactE", !6, i64 0, !12, i64 8, !12, i64 12, !6, i64 16}
!29 = !{!"_ZTS16b2GrowableBufferI21b2ParticleBodyContactE", !6, i64 0, !12, i64 8, !12, i64 12, !6, i64 16}
!30 = !{!"_ZTS16b2GrowableBufferI14b2ParticlePairE", !6, i64 0, !12, i64 8, !12, i64 12, !6, i64 16}
!31 = !{!"_ZTS16b2GrowableBufferI15b2ParticleTriadE", !6, i64 0, !12, i64 8, !12, i64 12, !6, i64 16}
!32 = !{!"long long", !7, i64 0}
!33 = !{!"_ZTS19b2ParticleSystemDef", !11, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !12, 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, !12, i64 68, !13, i64 72, !11, i64 76, !13, i64 80}
!34 = !{!35, !13, i64 4}
!35 = !{!"_ZTS10b2TimeStep", !13, i64 0, !13, i64 4, !13, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !11, i64 24}
!36 = !{!10, !13, i64 576}
!37 = !{!13, !13, i64 0}
!38 = !{!12, !12, i64 0}
!39 = !{!10, !6, i64 240}
!40 = !{i64 0, i64 4, !37, i64 4, i64 4, !37}
!41 = !{!10, !6, i64 160}
!42 = distinct !{!42, !43}
!43 = !{!"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 }

@.str.1 = external hidden unnamed_addr constant [93 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [14 x i8], align 1
@__PRETTY_FUNCTION__._ZN16b2ParticleSystem10SolveSolidERK10b2TimeStep = external hidden unnamed_addr constant [54 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; 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 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> @_ZmlfRK6b2Vec2(float noundef, ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK17b2ParticleContact9GetWeightEv(ptr noundef nonnull align 4 dereferenceable(24)) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN16b2ParticleSystem10SolveSolidERK10b2TimeStep(ptr noundef nonnull align 8 dereferenceable(632) %0, ptr nocapture noundef nonnull readonly align 4 dereferenceable(28) %1) local_unnamed_addr #4 align 2 {
  %3 = alloca %struct.b2Vec2, align 8
  %4 = alloca %struct.b2Vec2, align 8
  %5 = getelementptr inbounds i8, ptr %0, i64 216
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %.not = icmp eq ptr %6, null
  br i1 %.not, label %7, label %8

7:                                                ; preds = %2
  tail call void @__assert_fail(ptr noundef nonnull @.str.26, ptr noundef nonnull @.str.1, i32 noundef 3510, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN16b2ParticleSystem10SolveSolidERK10b2TimeStep) #5
  unreachable

8:                                                ; preds = %2
  %9 = getelementptr inbounds i8, ptr %1, i64 4
  %10 = load float, ptr %9, align 4, !tbaa !33
  %11 = getelementptr inbounds i8, ptr %0, i64 576
  %12 = load float, ptr %11, align 8, !tbaa !35
  %13 = fmul float %10, %12
  %14 = getelementptr inbounds i8, ptr %0, i64 368
  %15 = tail call noundef i32 @_ZNK16b2GrowableBufferI17b2ParticleContactE8GetCountEv(ptr noundef nonnull align 8 dereferenceable(24) %14)
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %8
  %17 = getelementptr inbounds i8, ptr %0, i64 240
  %18 = getelementptr inbounds i8, ptr %0, i64 160
  br label %19

._crit_edge:                                      ; preds = %47, %8
  ret void

19:                                               ; preds = %.lr.ph, %47
  %.018 = phi i32 [ 0, %.lr.ph ], [ %48, %47 ]
  %20 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZN16b2GrowableBufferI17b2ParticleContactEixEi(ptr noundef nonnull align 8 dereferenceable(24) %14, i32 noundef %.018)
  %21 = call noundef i32 @_ZNK17b2ParticleContact9GetIndexAEv(ptr noundef nonnull align 4 dereferenceable(24) %20)
  %22 = call noundef i32 @_ZNK17b2ParticleContact9GetIndexBEv(ptr noundef nonnull align 4 dereferenceable(24) %20)
  %23 = load ptr, ptr %17, align 8, !tbaa !36
  %24 = sext i32 %21 to i64
  %25 = getelementptr inbounds ptr, ptr %23, i64 %24
  %26 = load ptr, ptr %25, align 8, !tbaa !37
  %27 = sext i32 %22 to i64
  %28 = getelementptr inbounds ptr, ptr %23, i64 %27
  %29 = load ptr, ptr %28, align 8, !tbaa !37
  %.not17 = icmp eq ptr %26, %29
  br i1 %.not17, label %47, label %30

30:                                               ; preds = %19
  %31 = call noundef float @_ZNK17b2ParticleContact9GetWeightEv(ptr noundef nonnull align 4 dereferenceable(24) %20)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %32 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNK17b2ParticleContact9GetNormalEv(ptr noundef nonnull align 4 dereferenceable(24) %20)
  %33 = load i64, ptr %32, align 4
  store i64 %33, ptr %3, align 8
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = getelementptr inbounds float, ptr %34, i64 %24
  %36 = load float, ptr %35, align 4, !tbaa !38
  %37 = getelementptr inbounds float, ptr %34, i64 %27
  %38 = load float, ptr %37, align 4, !tbaa !38
  %39 = fadd float %36, %38
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %40 = fmul float %13, %39
  %41 = fmul float %31, %40
  %42 = call <2 x float> @_ZmlfRK6b2Vec2(float noundef %41, ptr noundef nonnull align 4 dereferenceable(8) %3)
  store <2 x float> %42, ptr %4, align 8
  %43 = load ptr, ptr %18, align 8, !tbaa !39
  %44 = getelementptr inbounds %struct.b2Vec2, ptr %43, i64 %24
  call void @_ZN6b2Vec2mIERKS_(ptr noundef nonnull align 4 dereferenceable(8) %44, ptr noundef nonnull align 4 dereferenceable(8) %4)
  %45 = load ptr, ptr %18, align 8, !tbaa !39
  %46 = getelementptr inbounds %struct.b2Vec2, ptr %45, i64 %27
  call void @_ZN6b2Vec2pLERKS_(ptr noundef nonnull align 4 dereferenceable(8) %46, ptr noundef nonnull align 4 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  br label %47

47:                                               ; preds = %30, %19
  %48 = add nuw nsw i32 %.018, 1
  %49 = call noundef i32 @_ZNK16b2GrowableBufferI17b2ParticleContactE8GetCountEv(ptr noundef nonnull align 8 dereferenceable(24) %14)
  %50 = icmp slt i32 %48, %49
  br i1 %50, label %19, label %._crit_edge, !llvm.loop !40
}

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

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

attributes #0 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint mustprogress uwtable "min-legal-vector-width"="64" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="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 = { noreturn nounwind }
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, !16, i64 216}
!6 = !{!"_ZTS16b2ParticleSystem", !7, i64 0, !10, i64 4, !10, i64 8, !7, i64 12, !10, i64 16, !7, i64 20, !7, i64 21, !10, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !10, i64 44, !10, i64 48, !12, i64 56, !19, i64 112, !20, i64 128, !21, i64 144, !21, i64 160, !16, i64 176, !16, i64 184, !16, i64 192, !16, i64 200, !16, i64 208, !16, i64 216, !22, i64 224, !16, i64 240, !23, i64 248, !10, i64 264, !24, i64 272, !24, i64 288, !24, i64 304, !25, i64 320, !26, i64 344, !27, i64 368, !28, i64 392, !29, i64 416, !30, i64 440, !24, i64 464, !24, i64 480, !31, i64 496, !7, i64 504, !10, i64 508, !16, i64 512, !32, i64 520, !16, i64 608, !16, i64 616, !16, i64 624}
!7 = !{!"bool", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{!"_ZTS15b2SlabAllocatorI16b2ParticleHandleE", !13, i64 0, !10, i64 16, !17, i64 24}
!13 = !{!"_ZTS23b2TrackedBlockAllocator", !14, i64 0}
!14 = !{!"_ZTS24b2TypedIntrusiveListNodeI14b2TrackedBlockE", !15, i64 0}
!15 = !{!"_ZTS19b2IntrusiveListNode", !16, i64 0, !16, i64 8}
!16 = !{!"any pointer", !8, i64 0}
!17 = !{!"_ZTS15b2TypedFreeListI16b2ParticleHandleE", !18, i64 0}
!18 = !{!"_ZTS10b2FreeList", !15, i64 0, !15, i64 16}
!19 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferIP16b2ParticleHandleEE", !16, i64 0, !10, i64 8}
!20 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferIjEE", !16, i64 0, !10, i64 8}
!21 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferI6b2Vec2EE", !16, i64 0, !10, i64 8}
!22 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferI15b2ParticleColorEE", !16, i64 0, !10, i64 8}
!23 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferIPvEE", !16, i64 0, !10, i64 8}
!24 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferIiEE", !16, i64 0, !10, i64 8}
!25 = !{!"_ZTS16b2GrowableBufferIiE", !16, i64 0, !10, i64 8, !10, i64 12, !16, i64 16}
!26 = !{!"_ZTS16b2GrowableBufferIN16b2ParticleSystem5ProxyEE", !16, i64 0, !10, i64 8, !10, i64 12, !16, i64 16}
!27 = !{!"_ZTS16b2GrowableBufferI17b2ParticleContactE", !16, i64 0, !10, i64 8, !10, i64 12, !16, i64 16}
!28 = !{!"_ZTS16b2GrowableBufferI21b2ParticleBodyContactE", !16, i64 0, !10, i64 8, !10, i64 12, !16, i64 16}
!29 = !{!"_ZTS16b2GrowableBufferI14b2ParticlePairE", !16, i64 0, !10, i64 8, !10, i64 12, !16, i64 16}
!30 = !{!"_ZTS16b2GrowableBufferI15b2ParticleTriadE", !16, i64 0, !10, i64 8, !10, i64 12, !16, i64 16}
!31 = !{!"long long", !8, i64 0}
!32 = !{!"_ZTS19b2ParticleSystemDef", !7, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !10, 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, !10, i64 68, !11, i64 72, !7, i64 76, !11, i64 80}
!33 = !{!34, !11, i64 4}
!34 = !{!"_ZTS10b2TimeStep", !11, i64 0, !11, i64 4, !11, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !7, i64 24}
!35 = !{!6, !11, i64 576}
!36 = !{!6, !16, i64 240}
!37 = !{!16, !16, i64 0}
!38 = !{!11, !11, i64 0}
!39 = !{!6, !16, i64 160}
!40 = distinct !{!40, !41}
!41 = !{!"llvm.loop.mustprogress"}


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