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

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

%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.b2ParticleSystem::ParticleListNode" = type { ptr, ptr, i32, i32 }

@.str.1 = external hidden unnamed_addr constant [93 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [29 x i8], align 1
@__PRETTY_FUNCTION__._ZNK16b2ParticleSystem27MergeParticleListsInContactEPK15b2ParticleGroupPNS_16ParticleListNodeE = external hidden unnamed_addr constant [102 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: mustprogress uwtable
define dso_local void @_ZNK16b2ParticleSystem27MergeParticleListsInContactEPK15b2ParticleGroupPNS_16ParticleListNodeE(ptr noundef nonnull align 8 dereferenceable(632) %0, ptr noundef %1, ptr noundef %2) #2 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %15 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = call noundef i32 @_ZNK15b2ParticleGroup14GetBufferIndexEv(ptr noundef nonnull align 8 dereferenceable(96) %16)
  store i32 %17, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %18

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

23:                                               ; preds = %18
  store i32 2, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %91

24:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %25 = getelementptr inbounds %class.b2ParticleSystem, ptr %15, i32 0, i32 35
  %26 = load i32, ptr %8, align 4, !tbaa !9
  %27 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZNK16b2GrowableBufferI17b2ParticleContactEixEi(ptr noundef nonnull align 8 dereferenceable(24) %25, i32 noundef %26)
  store ptr %27, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %28 = load ptr, ptr %10, align 8, !tbaa !5
  %29 = call noundef i32 @_ZNK17b2ParticleContact9GetIndexAEv(ptr noundef nonnull align 4 dereferenceable(24) %28)
  store i32 %29, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %30 = load ptr, ptr %10, align 8, !tbaa !5
  %31 = call noundef i32 @_ZNK17b2ParticleContact9GetIndexBEv(ptr noundef nonnull align 4 dereferenceable(24) %30)
  store i32 %31, ptr %12, align 4, !tbaa !9
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = load i32, ptr %11, align 4, !tbaa !9
  %34 = call noundef zeroext i1 @_ZNK15b2ParticleGroup16ContainsParticleEi(ptr noundef nonnull align 8 dereferenceable(96) %32, i32 noundef %33)
  br i1 %34, label %35, label %39

35:                                               ; preds = %24
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = load i32, ptr %12, align 4, !tbaa !9
  %38 = call noundef zeroext i1 @_ZNK15b2ParticleGroup16ContainsParticleEi(ptr noundef nonnull align 8 dereferenceable(96) %36, i32 noundef %37)
  br i1 %38, label %40, label %39

39:                                               ; preds = %35, %24
  store i32 4, ptr %9, align 4
  br label %85

40:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = load i32, ptr %11, align 4, !tbaa !9
  %43 = load i32, ptr %7, align 4, !tbaa !9
  %44 = sub nsw i32 %42, %43
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds %"struct.b2ParticleSystem::ParticleListNode", ptr %41, i64 %45
  %47 = getelementptr inbounds %"struct.b2ParticleSystem::ParticleListNode", ptr %46, i32 0, i32 0
  %48 = load ptr, ptr %47, align 8, !tbaa !11
  store ptr %48, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = load i32, ptr %12, align 4, !tbaa !9
  %51 = load i32, ptr %7, align 4, !tbaa !9
  %52 = sub nsw i32 %50, %51
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds %"struct.b2ParticleSystem::ParticleListNode", ptr %49, i64 %53
  %55 = getelementptr inbounds %"struct.b2ParticleSystem::ParticleListNode", ptr %54, i32 0, i32 0
  %56 = load ptr, ptr %55, align 8, !tbaa !11
  store ptr %56, ptr %14, align 8, !tbaa !5
  %57 = load ptr, ptr %13, align 8, !tbaa !5
  %58 = load ptr, ptr %14, align 8, !tbaa !5
  %59 = icmp eq ptr %57, %58
  br i1 %59, label %60, label %61

60:                                               ; preds = %40
  store i32 4, ptr %9, align 4
  br label %84

61:                                               ; preds = %40
  %62 = load ptr, ptr %13, align 8, !tbaa !5
  %63 = getelementptr inbounds %"struct.b2ParticleSystem::ParticleListNode", ptr %62, i32 0, i32 2
  %64 = load i32, ptr %63, align 8, !tbaa !13
  %65 = load ptr, ptr %14, align 8, !tbaa !5
  %66 = getelementptr inbounds %"struct.b2ParticleSystem::ParticleListNode", ptr %65, i32 0, i32 2
  %67 = load i32, ptr %66, align 8, !tbaa !13
  %68 = icmp slt i32 %64, %67
  br i1 %68, label %69, label %70

69:                                               ; preds = %61
  call void @_Z6b2SwapIPN16b2ParticleSystem16ParticleListNodeEEvRT_S4_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %14)
  br label %70

70:                                               ; preds = %69, %61
  %71 = load ptr, ptr %13, align 8, !tbaa !5
  %72 = getelementptr inbounds %"struct.b2ParticleSystem::ParticleListNode", ptr %71, i32 0, i32 2
  %73 = load i32, ptr %72, align 8, !tbaa !13
  %74 = load ptr, ptr %14, align 8, !tbaa !5
  %75 = getelementptr inbounds %"struct.b2ParticleSystem::ParticleListNode", ptr %74, i32 0, i32 2
  %76 = load i32, ptr %75, align 8, !tbaa !13
  %77 = icmp sge i32 %73, %76
  br i1 %77, label %78, label %79

78:                                               ; preds = %70
  br label %81

79:                                               ; preds = %70
  call void @__assert_fail(ptr noundef @.str.16, ptr noundef @.str.1, i32 noundef 1190, ptr noundef @__PRETTY_FUNCTION__._ZNK16b2ParticleSystem27MergeParticleListsInContactEPK15b2ParticleGroupPNS_16ParticleListNodeE) #6
  unreachable

80:                                               ; No predecessors!
  br label %81

81:                                               ; preds = %80, %78
  %82 = load ptr, ptr %13, align 8, !tbaa !5
  %83 = load ptr, ptr %14, align 8, !tbaa !5
  call void @_ZN16b2ParticleSystem18MergeParticleListsEPNS_16ParticleListNodeES1_(ptr noundef %82, ptr noundef %83)
  store i32 0, ptr %9, align 4
  br label %84

84:                                               ; preds = %81, %60
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %85

85:                                               ; preds = %84, %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  %86 = load i32, ptr %9, align 4
  switch i32 %86, label %92 [
    i32 0, label %87
    i32 4, label %88
  ]

87:                                               ; preds = %85
  br label %88

88:                                               ; preds = %87, %85
  %89 = load i32, ptr %8, align 4, !tbaa !9
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr %8, align 4, !tbaa !9
  br label %18, !llvm.loop !14

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

92:                                               ; preds = %85
  unreachable
}

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

; 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 nonnull align 4 dereferenceable(24) ptr @_ZNK16b2GrowableBufferI17b2ParticleContactEixEi(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) #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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK15b2ParticleGroup16ContainsParticleEi(ptr noundef nonnull align 8 dereferenceable(96), i32 noundef) #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN16b2ParticleSystem18MergeParticleListsEPNS_16ParticleListNodeES1_(ptr noundef, ptr noundef) #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 = { 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 #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 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 = { nounwind }
attributes #6 = { noreturn 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, !6, i64 0}
!12 = !{!"_ZTSN16b2ParticleSystem16ParticleListNodeE", !6, i64 0, !6, i64 8, !10, i64 16, !10, i64 20}
!13 = !{!12, !10, i64 16}
!14 = distinct !{!14, !15}
!15 = !{!"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.b2ParticleSystem::ParticleListNode" = type { ptr, ptr, i32, i32 }

@.str.1 = external hidden unnamed_addr constant [93 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [29 x i8], align 1
@__PRETTY_FUNCTION__._ZNK16b2ParticleSystem27MergeParticleListsInContactEPK15b2ParticleGroupPNS_16ParticleListNodeE = external hidden unnamed_addr constant [102 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: mustprogress nounwind uwtable
define dso_local void @_ZNK16b2ParticleSystem27MergeParticleListsInContactEPK15b2ParticleGroupPNS_16ParticleListNodeE(ptr noundef nonnull align 8 dereferenceable(632) %0, ptr noundef nonnull %1, ptr nocapture noundef readonly %2) local_unnamed_addr #2 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = tail call noundef i32 @_ZNK15b2ParticleGroup14GetBufferIndexEv(ptr noundef nonnull align 8 dereferenceable(96) %1)
  %7 = getelementptr inbounds i8, ptr %0, i64 368
  %8 = tail call noundef i32 @_ZNK16b2GrowableBufferI17b2ParticleContactE8GetCountEv(ptr noundef nonnull align 8 dereferenceable(24) %7)
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %41, %3
  ret void

.lr.ph:                                           ; preds = %3, %41
  %.018 = phi i32 [ %42, %41 ], [ 0, %3 ]
  %10 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZNK16b2GrowableBufferI17b2ParticleContactEixEi(ptr noundef nonnull align 8 dereferenceable(24) %7, i32 noundef %.018)
  %11 = call noundef i32 @_ZNK17b2ParticleContact9GetIndexAEv(ptr noundef nonnull align 4 dereferenceable(24) %10)
  %12 = call noundef i32 @_ZNK17b2ParticleContact9GetIndexBEv(ptr noundef nonnull align 4 dereferenceable(24) %10)
  %13 = call noundef zeroext i1 @_ZNK15b2ParticleGroup16ContainsParticleEi(ptr noundef nonnull align 8 dereferenceable(96) %1, i32 noundef %11)
  br i1 %13, label %14, label %41

14:                                               ; preds = %.lr.ph
  %15 = call noundef zeroext i1 @_ZNK15b2ParticleGroup16ContainsParticleEi(ptr noundef nonnull align 8 dereferenceable(96) %1, i32 noundef %12)
  br i1 %15, label %16, label %41

16:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %17 = sub nsw i32 %11, %6
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds %"struct.b2ParticleSystem::ParticleListNode", ptr %2, i64 %18
  %20 = load ptr, ptr %19, align 8, !tbaa !5
  store ptr %20, ptr %4, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  %21 = sub nsw i32 %12, %6
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds %"struct.b2ParticleSystem::ParticleListNode", ptr %2, i64 %22
  %24 = load ptr, ptr %23, align 8, !tbaa !5
  store ptr %24, ptr %5, align 8, !tbaa !11
  %25 = icmp eq ptr %20, %24
  br i1 %25, label %40, label %26

26:                                               ; preds = %16
  %27 = getelementptr inbounds i8, ptr %20, i64 16
  %28 = load i32, ptr %27, align 8, !tbaa !12
  %29 = getelementptr inbounds i8, ptr %24, i64 16
  %30 = load i32, ptr %29, align 8, !tbaa !12
  %31 = icmp slt i32 %28, %30
  br i1 %31, label %32, label %33

32:                                               ; preds = %26
  call void @_Z6b2SwapIPN16b2ParticleSystem16ParticleListNodeEEvRT_S4_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %.pre = load ptr, ptr %4, align 8, !tbaa !11
  %.phi.trans.insert = getelementptr inbounds i8, ptr %.pre, i64 16
  %.pre19 = load i32, ptr %.phi.trans.insert, align 8, !tbaa !12
  %.pre20 = load ptr, ptr %5, align 8, !tbaa !11
  %.phi.trans.insert21 = getelementptr inbounds i8, ptr %.pre20, i64 16
  %.pre22 = load i32, ptr %.phi.trans.insert21, align 8, !tbaa !12
  br label %33

33:                                               ; preds = %32, %26
  %34 = phi i32 [ %.pre22, %32 ], [ %30, %26 ]
  %35 = phi ptr [ %.pre20, %32 ], [ %24, %26 ]
  %36 = phi i32 [ %.pre19, %32 ], [ %28, %26 ]
  %37 = phi ptr [ %.pre, %32 ], [ %20, %26 ]
  %.not = icmp slt i32 %36, %34
  br i1 %.not, label %38, label %39

38:                                               ; preds = %33
  call void @__assert_fail(ptr noundef nonnull @.str.16, ptr noundef nonnull @.str.1, i32 noundef 1190, ptr noundef nonnull @__PRETTY_FUNCTION__._ZNK16b2ParticleSystem27MergeParticleListsInContactEPK15b2ParticleGroupPNS_16ParticleListNodeE) #5
  unreachable

39:                                               ; preds = %33
  call void @_ZN16b2ParticleSystem18MergeParticleListsEPNS_16ParticleListNodeES1_(ptr noundef nonnull %37, ptr noundef nonnull %35)
  br label %40

40:                                               ; preds = %16, %39
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  br label %41

41:                                               ; preds = %.lr.ph, %14, %40
  %42 = add nuw nsw i32 %.018, 1
  %43 = call noundef i32 @_ZNK16b2GrowableBufferI17b2ParticleContactE8GetCountEv(ptr noundef nonnull align 8 dereferenceable(24) %7)
  %44 = icmp slt i32 %42, %43
  br i1 %44, label %.lr.ph, label %._crit_edge, !llvm.loop !13
}

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK15b2ParticleGroup16ContainsParticleEi(ptr noundef nonnull align 8 dereferenceable(96), i32 noundef) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN16b2ParticleSystem18MergeParticleListsEPNS_16ParticleListNodeES1_(ptr noundef, ptr noundef) local_unnamed_addr #2 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 = { 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 = { nounwind }
attributes #5 = { noreturn 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 = !{!"_ZTSN16b2ParticleSystem16ParticleListNodeE", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 20}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!6, !10, i64 16}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass