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

%"struct.(anonymous namespace)::LightweightPair.17" = type { ptr, i32 }
%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 }
%struct.b2Vec2 = type { float, float }

@.str.1 = external hidden unnamed_addr constant [93 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [8 x i8], align 1
@__PRETTY_FUNCTION__._ZN16b2ParticleSystem36NotifyBodyContactListenerPostContactER18FixtureParticleSet = external hidden unnamed_addr constant [82 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 nounwind uwtable
declare hidden void @_ZN12_GLOBAL__N_117FixedSetAllocator10InvalidateEi(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZNK12_GLOBAL__N_117FixedSetAllocator8GetCountEv(ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef ptr @_ZNK12_GLOBAL__N_117FixedSetAllocator14GetValidBufferEv(ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef ptr @_ZN12_GLOBAL__N_122TypedFixedSetAllocatorINS_15LightweightPairIP9b2FixtureiEEE9GetBufferEv(ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN16b2ParticleSystem36NotifyBodyContactListenerPostContactER18FixtureParticleSet(ptr noundef nonnull align 8 dereferenceable(632) %0, ptr noundef nonnull align 8 dereferenceable(32) %1) #4 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca %"struct.(anonymous namespace)::LightweightPair.17", align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %15 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %16 = call noundef ptr @_ZNK16b2ParticleSystem25GetFixtureContactListenerEv(ptr noundef nonnull align 8 dereferenceable(632) %15)
  store ptr %16, ptr %5, align 8, !tbaa !5
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = icmp eq ptr %17, null
  br i1 %18, label %19, label %20

19:                                               ; preds = %2
  store i32 1, ptr %6, align 4
  br label %100

20:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %21 = getelementptr inbounds %class.b2ParticleSystem, ptr %15, i32 0, i32 36
  %22 = call noundef ptr @_ZN16b2GrowableBufferI21b2ParticleBodyContactE5BeginEv(ptr noundef nonnull align 8 dereferenceable(24) %21)
  store ptr %22, ptr %7, align 8, !tbaa !5
  br label %23

23:                                               ; preds = %58, %20
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  %25 = getelementptr inbounds %class.b2ParticleSystem, ptr %15, i32 0, i32 36
  %26 = call noundef ptr @_ZN16b2GrowableBufferI21b2ParticleBodyContactE3EndEv(ptr noundef nonnull align 8 dereferenceable(24) %25)
  %27 = icmp ne ptr %24, %26
  br i1 %27, label %29, label %28

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

29:                                               ; preds = %23
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = icmp ne ptr %30, null
  br i1 %31, label %32, label %33

32:                                               ; preds = %29
  br label %35

33:                                               ; preds = %29
  call void @__assert_fail(ptr noundef @.str.28, ptr noundef @.str.1, i32 noundef 2337, ptr noundef @__PRETTY_FUNCTION__._ZN16b2ParticleSystem36NotifyBodyContactListenerPostContactER18FixtureParticleSet) #6
  unreachable

34:                                               ; No predecessors!
  br label %35

35:                                               ; preds = %34, %32
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #5
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.b2ParticleBodyContact, ptr %36, i32 0, i32 2
  %38 = load ptr, ptr %37, align 8, !tbaa !9
  %39 = getelementptr inbounds %"struct.(anonymous namespace)::LightweightPair.17", ptr %8, i32 0, i32 0
  store ptr %38, ptr %39, align 8, !tbaa !14
  %40 = load ptr, ptr %7, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.b2ParticleBodyContact, ptr %40, i32 0, i32 0
  %42 = load i32, ptr %41, align 8, !tbaa !16
  %43 = getelementptr inbounds %"struct.(anonymous namespace)::LightweightPair.17", ptr %8, i32 0, i32 1
  store i32 %42, ptr %43, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = call noundef i32 @_ZNK18FixtureParticleSet4FindERKN12_GLOBAL__N_115LightweightPairIP9b2FixtureiEE(ptr noundef nonnull align 8 dereferenceable(32) %44, ptr noundef nonnull align 8 dereferenceable(16) %8)
  store i32 %45, ptr %9, align 4, !tbaa !18
  %46 = load i32, ptr %9, align 4, !tbaa !18
  %47 = icmp sge i32 %46, 0
  br i1 %47, label %48, label %51

48:                                               ; preds = %35
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = load i32, ptr %9, align 4, !tbaa !18
  call void @_ZN12_GLOBAL__N_117FixedSetAllocator10InvalidateEi(ptr noundef nonnull align 8 dereferenceable(32) %49, i32 noundef %50)
  br label %57

51:                                               ; preds = %35
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = load ptr, ptr %52, align 8, !tbaa !19
  %55 = getelementptr inbounds ptr, ptr %54, i64 4
  %56 = load ptr, ptr %55, align 8
  call void %56(ptr noundef nonnull align 8 dereferenceable(8) %52, ptr noundef %15, ptr noundef %53)
  br label %57

57:                                               ; preds = %51, %48
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #5
  br label %58

58:                                               ; preds = %57
  %59 = load ptr, ptr %7, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.b2ParticleBodyContact, ptr %59, i32 1
  store ptr %60, ptr %7, align 8, !tbaa !5
  br label %23, !llvm.loop !21

61:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = call noundef ptr @_ZN12_GLOBAL__N_122TypedFixedSetAllocatorINS_15LightweightPairIP9b2FixtureiEEE9GetBufferEv(ptr noundef nonnull align 8 dereferenceable(32) %62)
  store ptr %63, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = call noundef ptr @_ZNK12_GLOBAL__N_117FixedSetAllocator14GetValidBufferEv(ptr noundef nonnull align 8 dereferenceable(32) %64)
  store ptr %65, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = call noundef i32 @_ZNK12_GLOBAL__N_117FixedSetAllocator8GetCountEv(ptr noundef nonnull align 8 dereferenceable(32) %66)
  store i32 %67, ptr %12, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !18
  br label %68

68:                                               ; preds = %96, %61
  %69 = load i32, ptr %13, align 4, !tbaa !18
  %70 = load i32, ptr %12, align 4, !tbaa !18
  %71 = icmp slt i32 %69, %70
  br i1 %71, label %73, label %72

72:                                               ; preds = %68
  store i32 5, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %99

73:                                               ; preds = %68
  %74 = load ptr, ptr %11, align 8, !tbaa !5
  %75 = load i32, ptr %13, align 4, !tbaa !18
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds i8, ptr %74, i64 %76
  %78 = load i8, ptr %77, align 1, !tbaa !23
  %79 = icmp ne i8 %78, 0
  br i1 %79, label %80, label %95

80:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %81 = load ptr, ptr %10, align 8, !tbaa !5
  %82 = load i32, ptr %13, align 4, !tbaa !18
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds %"struct.(anonymous namespace)::LightweightPair.17", ptr %81, i64 %83
  store ptr %84, ptr %14, align 8, !tbaa !5
  %85 = load ptr, ptr %5, align 8, !tbaa !5
  %86 = load ptr, ptr %14, align 8, !tbaa !5
  %87 = getelementptr inbounds %"struct.(anonymous namespace)::LightweightPair.17", ptr %86, i32 0, i32 0
  %88 = load ptr, ptr %87, align 8, !tbaa !14
  %89 = load ptr, ptr %14, align 8, !tbaa !5
  %90 = getelementptr inbounds %"struct.(anonymous namespace)::LightweightPair.17", ptr %89, i32 0, i32 1
  %91 = load i32, ptr %90, align 8, !tbaa !17
  %92 = load ptr, ptr %85, align 8, !tbaa !19
  %93 = getelementptr inbounds ptr, ptr %92, i64 5
  %94 = load ptr, ptr %93, align 8
  call void %94(ptr noundef nonnull align 8 dereferenceable(8) %85, ptr noundef %88, ptr noundef %15, i32 noundef %91)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %95

95:                                               ; preds = %80, %73
  br label %96

96:                                               ; preds = %95
  %97 = load i32, ptr %13, align 4, !tbaa !18
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %13, align 4, !tbaa !18
  br label %68, !llvm.loop !24

99:                                               ; preds = %72
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  store i32 0, ptr %6, align 4
  br label %100

100:                                              ; preds = %99, %19
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  %101 = load i32, ptr %6, align 4
  switch i32 %101, label %103 [
    i32 0, label %102
    i32 1, label %102
  ]

102:                                              ; preds = %100, %100
  ret void

103:                                              ; preds = %100
  unreachable
}

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

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

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZNK18FixtureParticleSet4FindERKN12_GLOBAL__N_115LightweightPairIP9b2FixtureiEE(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(16)) #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 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"="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, !6, i64 16}
!10 = !{!"_ZTS21b2ParticleBodyContact", !11, i64 0, !6, i64 8, !6, i64 16, !12, i64 24, !13, i64 28, !12, i64 36}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!"_ZTS6b2Vec2", !12, i64 0, !12, i64 4}
!14 = !{!15, !6, i64 0}
!15 = !{!"_ZTSN12_GLOBAL__N_115LightweightPairIP9b2FixtureiEE", !6, i64 0, !11, i64 8}
!16 = !{!10, !11, i64 0}
!17 = !{!15, !11, i64 8}
!18 = !{!11, !11, i64 0}
!19 = !{!20, !20, i64 0}
!20 = !{!"vtable pointer", !8, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!7, !7, i64 0}
!24 = distinct !{!24, !22}


; 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.(anonymous namespace)::LightweightPair.17" = type { ptr, i32 }

@.str.1 = external hidden unnamed_addr constant [93 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [8 x i8], align 1
@__PRETTY_FUNCTION__._ZN16b2ParticleSystem36NotifyBodyContactListenerPostContactER18FixtureParticleSet = external hidden unnamed_addr constant [82 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
declare hidden void @_ZN12_GLOBAL__N_117FixedSetAllocator10InvalidateEi(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZNK12_GLOBAL__N_117FixedSetAllocator8GetCountEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef ptr @_ZNK12_GLOBAL__N_117FixedSetAllocator14GetValidBufferEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef ptr @_ZN12_GLOBAL__N_122TypedFixedSetAllocatorINS_15LightweightPairIP9b2FixtureiEEE9GetBufferEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN16b2ParticleSystem36NotifyBodyContactListenerPostContactER18FixtureParticleSet(ptr noundef nonnull align 8 dereferenceable(632) %0, ptr noundef nonnull align 8 dereferenceable(32) %1) local_unnamed_addr #4 align 2 {
  %3 = alloca %"struct.(anonymous namespace)::LightweightPair.17", align 8
  %4 = tail call noundef ptr @_ZNK16b2ParticleSystem25GetFixtureContactListenerEv(ptr noundef nonnull align 8 dereferenceable(632) %0)
  %5 = icmp eq ptr %4, null
  br i1 %5, label %.loopexit, label %6

6:                                                ; preds = %2
  %7 = getelementptr inbounds i8, ptr %0, i64 392
  %8 = tail call noundef ptr @_ZN16b2GrowableBufferI21b2ParticleBodyContactE5BeginEv(ptr noundef nonnull align 8 dereferenceable(24) %7)
  %9 = tail call noundef ptr @_ZN16b2GrowableBufferI21b2ParticleBodyContactE3EndEv(ptr noundef nonnull align 8 dereferenceable(24) %7)
  %.not30 = icmp eq ptr %8, %9
  br i1 %.not30, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %6
  %10 = getelementptr inbounds i8, ptr %3, i64 8
  br label %15

._crit_edge:                                      ; preds = %28, %6
  %11 = call noundef ptr @_ZN12_GLOBAL__N_122TypedFixedSetAllocatorINS_15LightweightPairIP9b2FixtureiEEE9GetBufferEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %12 = call noundef ptr @_ZNK12_GLOBAL__N_117FixedSetAllocator14GetValidBufferEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %13 = call noundef i32 @_ZNK12_GLOBAL__N_117FixedSetAllocator8GetCountEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.lr.ph34.preheader, label %.loopexit

.lr.ph34.preheader:                               ; preds = %._crit_edge
  %wide.trip.count = zext nneg i32 %13 to i64
  br label %.lr.ph34

15:                                               ; preds = %.lr.ph, %28
  %.02531 = phi ptr [ %8, %.lr.ph ], [ %29, %28 ]
  %.not29 = icmp eq ptr %.02531, null
  br i1 %.not29, label %16, label %17

16:                                               ; preds = %15
  call void @__assert_fail(ptr noundef nonnull @.str.28, ptr noundef nonnull @.str.1, i32 noundef 2337, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN16b2ParticleSystem36NotifyBodyContactListenerPostContactER18FixtureParticleSet) #5
  unreachable

17:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #6
  %18 = getelementptr inbounds i8, ptr %.02531, i64 16
  %19 = load ptr, ptr %18, align 8, !tbaa !5
  store ptr %19, ptr %3, align 8, !tbaa !13
  %20 = load i32, ptr %.02531, align 8, !tbaa !15
  store i32 %20, ptr %10, align 8, !tbaa !16
  %21 = call noundef i32 @_ZNK18FixtureParticleSet4FindERKN12_GLOBAL__N_115LightweightPairIP9b2FixtureiEE(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(16) %3)
  %22 = icmp sgt i32 %21, -1
  br i1 %22, label %23, label %24

23:                                               ; preds = %17
  call void @_ZN12_GLOBAL__N_117FixedSetAllocator10InvalidateEi(ptr noundef nonnull align 8 dereferenceable(32) %1, i32 noundef %21)
  br label %28

24:                                               ; preds = %17
  %25 = load ptr, ptr %4, align 8, !tbaa !17
  %26 = getelementptr inbounds i8, ptr %25, i64 32
  %27 = load ptr, ptr %26, align 8
  call void %27(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull %0, ptr noundef nonnull %.02531)
  br label %28

28:                                               ; preds = %24, %23
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #6
  %29 = getelementptr inbounds i8, ptr %.02531, i64 40
  %30 = call noundef ptr @_ZN16b2GrowableBufferI21b2ParticleBodyContactE3EndEv(ptr noundef nonnull align 8 dereferenceable(24) %7)
  %.not = icmp eq ptr %29, %30
  br i1 %.not, label %._crit_edge, label %15, !llvm.loop !19

.lr.ph34:                                         ; preds = %.lr.ph34.preheader, %41
  %indvars.iv = phi i64 [ 0, %.lr.ph34.preheader ], [ %indvars.iv.next, %41 ]
  %31 = getelementptr inbounds i8, ptr %12, i64 %indvars.iv
  %32 = load i8, ptr %31, align 1, !tbaa !21
  %.not28 = icmp eq i8 %32, 0
  br i1 %.not28, label %41, label %33

33:                                               ; preds = %.lr.ph34
  %34 = getelementptr inbounds %"struct.(anonymous namespace)::LightweightPair.17", ptr %11, i64 %indvars.iv
  %35 = load ptr, ptr %34, align 8, !tbaa !13
  %36 = getelementptr inbounds i8, ptr %34, i64 8
  %37 = load i32, ptr %36, align 8, !tbaa !16
  %38 = load ptr, ptr %4, align 8, !tbaa !17
  %39 = getelementptr inbounds i8, ptr %38, i64 40
  %40 = load ptr, ptr %39, align 8
  call void %40(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef %35, ptr noundef nonnull %0, i32 noundef %37)
  br label %41

41:                                               ; preds = %.lr.ph34, %33
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.loopexit, label %.lr.ph34, !llvm.loop !22

.loopexit:                                        ; preds = %41, %._crit_edge, %2
  ret void
}

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

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

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZNK18FixtureParticleSet4FindERKN12_GLOBAL__N_115LightweightPairIP9b2FixtureiEE(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #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 = { 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 = { 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 #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, !10, i64 16}
!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 0}
!14 = !{!"_ZTSN12_GLOBAL__N_115LightweightPairIP9b2FixtureiEE", !10, i64 0, !7, i64 8}
!15 = !{!6, !7, i64 0}
!16 = !{!14, !7, i64 8}
!17 = !{!18, !18, i64 0}
!18 = !{!"vtable pointer", !9, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!8, !8, i64 0}
!22 = distinct !{!22, !20}


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