; LLVM IR from mtsamis/box2d-optimized :: src/dynamics/b2_contact_manager.ll (ZN16b2ContactManager13QueryCallbackEP9b2FixtureS1_)

; 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.b2Contact = type { ptr, ptr, ptr, ptr, ptr, %struct.b2Manifold, i32, i32, float, float, float, float }
%struct.b2Manifold = type { [2 x %struct.b2ManifoldPoint], %struct.b2Vec2, %struct.b2Vec2, i32, i32 }
%struct.b2ManifoldPoint = type { %struct.b2Vec2, float, float, %union.b2ContactID }
%union.b2ContactID = type { i32 }
%struct.b2Vec2 = type { float, float }
%class.b2ContactManager = type { %class.b2BroadPhase, i32, ptr, ptr, ptr, ptr }
%class.b2BroadPhase = type <{ ptr, ptr, ptr, ptr, %struct.b2TreeNode, ptr, ptr, ptr, i32, i32, %class.b2IntHashTable, i32, i32, i8, [7 x i8] }>
%struct.b2TreeNode = type { ptr, ptr, ptr, ptr, %struct.b2AABB }
%struct.b2AABB = type { %struct.b2Vec2, %struct.b2Vec2 }
%class.b2IntHashTable = type <{ ptr, i32, [4 x i8] }>

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN9b2Contact11GetFixtureAEv(ptr noundef nonnull align 8 dereferenceable(128)) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN9b2Contact11GetFixtureBEv(ptr noundef nonnull align 8 dereferenceable(128)) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN9b2Fixture7GetBodyEv(ptr noundef nonnull align 8 dereferenceable(84)) #1 align 2

declare noundef zeroext i1 @_ZNK6b2Body13ShouldCollideEPKS_(ptr noundef nonnull align 8 dereferenceable(208), ptr noundef) #2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN16b2ContactManager13QueryCallbackEP9b2FixtureS1_(ptr noundef nonnull align 8 dereferenceable(184) %0, ptr noundef %1, ptr noundef %2) #3 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %16 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = call noundef ptr @_ZN9b2Fixture7GetBodyEv(ptr noundef nonnull align 8 dereferenceable(84) %17)
  store ptr %18, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  %20 = call noundef ptr @_ZN9b2Fixture7GetBodyEv(ptr noundef nonnull align 8 dereferenceable(84) %19)
  store ptr %20, ptr %9, align 8, !tbaa !5
  %21 = load ptr, ptr %8, align 8, !tbaa !5
  %22 = load ptr, ptr %9, align 8, !tbaa !5
  %23 = icmp eq ptr %21, %22
  br i1 %23, label %24, label %25

24:                                               ; preds = %3
  store ptr null, ptr %4, align 8
  store i32 1, ptr %10, align 4
  br label %132

25:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %26

26:                                               ; preds = %65, %25
  %27 = load i32, ptr %11, align 4, !tbaa !9
  %28 = load ptr, ptr %9, align 8, !tbaa !5
  %29 = call noundef i32 @_ZN6b2Body15GetContactCountEv(ptr noundef nonnull align 8 dereferenceable(208) %28)
  %30 = icmp slt i32 %27, %29
  br i1 %30, label %32, label %31

31:                                               ; preds = %26
  store i32 2, ptr %10, align 4
  br label %68

32:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %33 = load ptr, ptr %9, align 8, !tbaa !5
  %34 = load i32, ptr %11, align 4, !tbaa !9
  %35 = call noundef ptr @_ZN6b2Body10GetContactEi(ptr noundef nonnull align 8 dereferenceable(208) %33, i32 noundef %34)
  store ptr %35, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %36 = load ptr, ptr %12, align 8, !tbaa !5
  %37 = call noundef ptr @_ZN9b2Contact11GetFixtureAEv(ptr noundef nonnull align 8 dereferenceable(128) %36)
  store ptr %37, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %38 = load ptr, ptr %12, align 8, !tbaa !5
  %39 = call noundef ptr @_ZN9b2Contact11GetFixtureBEv(ptr noundef nonnull align 8 dereferenceable(128) %38)
  store ptr %39, ptr %14, align 8, !tbaa !5
  %40 = load ptr, ptr %13, align 8, !tbaa !5
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = icmp eq ptr %40, %41
  br i1 %42, label %43, label %47

43:                                               ; preds = %32
  %44 = load ptr, ptr %14, align 8, !tbaa !5
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = icmp eq ptr %44, %45
  br i1 %46, label %55, label %47

47:                                               ; preds = %43, %32
  %48 = load ptr, ptr %13, align 8, !tbaa !5
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  %50 = icmp eq ptr %48, %49
  br i1 %50, label %51, label %61

51:                                               ; preds = %47
  %52 = load ptr, ptr %14, align 8, !tbaa !5
  %53 = load ptr, ptr %6, align 8, !tbaa !5
  %54 = icmp eq ptr %52, %53
  br i1 %54, label %55, label %61

55:                                               ; preds = %51, %43
  %56 = load ptr, ptr %12, align 8, !tbaa !5
  %57 = getelementptr inbounds %class.b2Contact, ptr %56, i32 0, i32 6
  %58 = load i32, ptr %57, align 8, !tbaa !11
  %59 = or i32 %58, 2
  store i32 %59, ptr %57, align 8, !tbaa !11
  %60 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %60, ptr %4, align 8
  store i32 1, ptr %10, align 4
  br label %62

61:                                               ; preds = %51, %47
  store i32 0, ptr %10, align 4
  br label %62

62:                                               ; preds = %61, %55
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  %63 = load i32, ptr %10, align 4
  switch i32 %63, label %68 [
    i32 0, label %64
  ]

64:                                               ; preds = %62
  br label %65

65:                                               ; preds = %64
  %66 = load i32, ptr %11, align 4, !tbaa !9
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %11, align 4, !tbaa !9
  br label %26, !llvm.loop !17

68:                                               ; preds = %62, %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  %69 = load i32, ptr %10, align 4
  switch i32 %69, label %132 [
    i32 2, label %70
  ]

70:                                               ; preds = %68
  %71 = load ptr, ptr %9, align 8, !tbaa !5
  %72 = load ptr, ptr %8, align 8, !tbaa !5
  %73 = call noundef zeroext i1 @_ZNK6b2Body13ShouldCollideEPKS_(ptr noundef nonnull align 8 dereferenceable(208) %71, ptr noundef %72)
  %74 = zext i1 %73 to i32
  %75 = icmp eq i32 %74, 0
  br i1 %75, label %76, label %77

76:                                               ; preds = %70
  store ptr null, ptr %4, align 8
  store i32 1, ptr %10, align 4
  br label %132

77:                                               ; preds = %70
  %78 = getelementptr inbounds %class.b2ContactManager, ptr %16, i32 0, i32 2
  %79 = load ptr, ptr %78, align 8, !tbaa !19
  %80 = icmp ne ptr %79, null
  br i1 %80, label %81, label %93

81:                                               ; preds = %77
  %82 = getelementptr inbounds %class.b2ContactManager, ptr %16, i32 0, i32 2
  %83 = load ptr, ptr %82, align 8, !tbaa !19
  %84 = load ptr, ptr %6, align 8, !tbaa !5
  %85 = load ptr, ptr %7, align 8, !tbaa !5
  %86 = load ptr, ptr %83, align 8, !tbaa !26
  %87 = getelementptr inbounds ptr, ptr %86, i64 2
  %88 = load ptr, ptr %87, align 8
  %89 = call noundef zeroext i1 %88(ptr noundef nonnull align 8 dereferenceable(8) %83, ptr noundef %84, ptr noundef %85)
  %90 = zext i1 %89 to i32
  %91 = icmp eq i32 %90, 0
  br i1 %91, label %92, label %93

92:                                               ; preds = %81
  store ptr null, ptr %4, align 8
  store i32 1, ptr %10, align 4
  br label %132

93:                                               ; preds = %81, %77
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %94 = load ptr, ptr %6, align 8, !tbaa !5
  %95 = load ptr, ptr %7, align 8, !tbaa !5
  %96 = getelementptr inbounds %class.b2ContactManager, ptr %16, i32 0, i32 4
  %97 = load ptr, ptr %96, align 8, !tbaa !28
  %98 = call noundef ptr @_ZN9b2Contact6CreateEP9b2FixtureS1_P16b2BlockAllocator(ptr noundef %94, ptr noundef %95, ptr noundef %97)
  store ptr %98, ptr %15, align 8, !tbaa !5
  %99 = load ptr, ptr %15, align 8, !tbaa !5
  %100 = icmp eq ptr %99, null
  br i1 %100, label %101, label %102

101:                                              ; preds = %93
  store ptr null, ptr %4, align 8
  store i32 1, ptr %10, align 4
  br label %131

102:                                              ; preds = %93
  %103 = getelementptr inbounds %class.b2ContactManager, ptr %16, i32 0, i32 5
  %104 = load ptr, ptr %103, align 8, !tbaa !29
  %105 = load ptr, ptr %15, align 8, !tbaa !5
  %106 = getelementptr inbounds %class.b2Contact, ptr %105, i32 0, i32 1
  store ptr %104, ptr %106, align 8, !tbaa !30
  %107 = getelementptr inbounds %class.b2ContactManager, ptr %16, i32 0, i32 5
  %108 = load ptr, ptr %107, align 8, !tbaa !29
  %109 = getelementptr inbounds %class.b2Contact, ptr %108, i32 0, i32 2
  %110 = load ptr, ptr %109, align 8, !tbaa !31
  %111 = load ptr, ptr %15, align 8, !tbaa !5
  %112 = getelementptr inbounds %class.b2Contact, ptr %111, i32 0, i32 2
  store ptr %110, ptr %112, align 8, !tbaa !31
  %113 = load ptr, ptr %15, align 8, !tbaa !5
  %114 = getelementptr inbounds %class.b2ContactManager, ptr %16, i32 0, i32 5
  %115 = load ptr, ptr %114, align 8, !tbaa !29
  %116 = getelementptr inbounds %class.b2Contact, ptr %115, i32 0, i32 2
  %117 = load ptr, ptr %116, align 8, !tbaa !31
  %118 = getelementptr inbounds %class.b2Contact, ptr %117, i32 0, i32 1
  store ptr %113, ptr %118, align 8, !tbaa !30
  %119 = load ptr, ptr %15, align 8, !tbaa !5
  %120 = getelementptr inbounds %class.b2ContactManager, ptr %16, i32 0, i32 5
  %121 = load ptr, ptr %120, align 8, !tbaa !29
  %122 = getelementptr inbounds %class.b2Contact, ptr %121, i32 0, i32 2
  store ptr %119, ptr %122, align 8, !tbaa !31
  %123 = load ptr, ptr %8, align 8, !tbaa !5
  %124 = load ptr, ptr %15, align 8, !tbaa !5
  call void @_ZN6b2Body10AddContactEP9b2Contact(ptr noundef nonnull align 8 dereferenceable(208) %123, ptr noundef %124)
  %125 = load ptr, ptr %9, align 8, !tbaa !5
  %126 = load ptr, ptr %15, align 8, !tbaa !5
  call void @_ZN6b2Body10AddContactEP9b2Contact(ptr noundef nonnull align 8 dereferenceable(208) %125, ptr noundef %126)
  %127 = getelementptr inbounds %class.b2ContactManager, ptr %16, i32 0, i32 1
  %128 = load i32, ptr %127, align 8, !tbaa !32
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %127, align 8, !tbaa !32
  %130 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr %130, ptr %4, align 8
  store i32 1, ptr %10, align 4
  br label %131

131:                                              ; preds = %102, %101
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  br label %132

132:                                              ; preds = %131, %92, %76, %68, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  %133 = load ptr, ptr %4, align 8
  ret ptr %133
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN6b2Body15GetContactCountEv(ptr noundef nonnull align 8 dereferenceable(208)) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN6b2Body10GetContactEi(ptr noundef nonnull align 8 dereferenceable(208), i32 noundef) #1 align 2

declare noundef ptr @_ZN9b2Contact6CreateEP9b2FixtureS1_P16b2BlockAllocator(ptr noundef, ptr noundef, ptr noundef) #2

declare void @_ZN6b2Body10AddContactEP9b2Contact(ptr noundef nonnull align 8 dereferenceable(208), ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "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 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 }

!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 104}
!12 = !{!"_ZTS9b2Contact", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !13, i64 40, !10, i64 104, !10, i64 108, !15, i64 112, !15, i64 116, !15, i64 120, !15, i64 124}
!13 = !{!"_ZTS10b2Manifold", !7, i64 0, !14, i64 40, !14, i64 48, !16, i64 56, !10, i64 60}
!14 = !{!"_ZTS6b2Vec2", !15, i64 0, !15, i64 4}
!15 = !{!"float", !7, i64 0}
!16 = !{!"_ZTSN10b2Manifold4TypeE", !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!20, !6, i64 152}
!20 = !{!"_ZTS16b2ContactManager", !21, i64 0, !10, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176}
!21 = !{!"_ZTS12b2BroadPhase", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !22, i64 32, !6, i64 80, !6, i64 88, !6, i64 96, !10, i64 104, !10, i64 108, !24, i64 112, !10, i64 128, !10, i64 132, !25, i64 136}
!22 = !{!"_ZTS10b2TreeNode", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !23, i64 32}
!23 = !{!"_ZTS6b2AABB", !14, i64 0, !14, i64 8}
!24 = !{!"_ZTS14b2IntHashTable", !6, i64 0, !10, i64 8}
!25 = !{!"bool", !7, i64 0}
!26 = !{!27, !27, i64 0}
!27 = !{!"vtable pointer", !8, i64 0}
!28 = !{!20, !6, i64 168}
!29 = !{!20, !6, i64 176}
!30 = !{!12, !6, i64 8}
!31 = !{!12, !6, i64 16}
!32 = !{!20, !10, i64 144}


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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN9b2Contact11GetFixtureAEv(ptr noundef nonnull align 8 dereferenceable(128)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN9b2Contact11GetFixtureBEv(ptr noundef nonnull align 8 dereferenceable(128)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN9b2Fixture7GetBodyEv(ptr noundef nonnull align 8 dereferenceable(84)) local_unnamed_addr #0 align 2

declare noundef zeroext i1 @_ZNK6b2Body13ShouldCollideEPKS_(ptr noundef nonnull align 8 dereferenceable(208), ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN16b2ContactManager13QueryCallbackEP9b2FixtureS1_(ptr nocapture noundef nonnull align 8 dereferenceable(184) %0, ptr noundef nonnull %1, ptr noundef %2) local_unnamed_addr #2 align 2 {
  %4 = tail call noundef ptr @_ZN9b2Fixture7GetBodyEv(ptr noundef nonnull align 8 dereferenceable(84) %1)
  %5 = tail call noundef ptr @_ZN9b2Fixture7GetBodyEv(ptr noundef nonnull align 8 dereferenceable(84) %2)
  %6 = icmp eq ptr %4, %5
  br i1 %6, label %47, label %.preheader

.preheader:                                       ; preds = %3
  %7 = tail call noundef i32 @_ZN6b2Body15GetContactCountEv(ptr noundef nonnull align 8 dereferenceable(208) %5)
  %.not55 = icmp sgt i32 %7, 0
  br i1 %.not55, label %.lr.ph, label %._crit_edge

8:                                                ; preds = %16
  %9 = add nuw nsw i32 %.04356, 1
  %10 = tail call noundef i32 @_ZN6b2Body15GetContactCountEv(ptr noundef nonnull align 8 dereferenceable(208) %5)
  %.not = icmp slt i32 %9, %10
  br i1 %.not, label %.lr.ph, label %._crit_edge, !llvm.loop !5

.lr.ph:                                           ; preds = %.preheader, %8
  %.04356 = phi i32 [ %9, %8 ], [ 0, %.preheader ]
  %11 = tail call noundef ptr @_ZN6b2Body10GetContactEi(ptr noundef nonnull align 8 dereferenceable(208) %5, i32 noundef %.04356)
  %12 = tail call noundef ptr @_ZN9b2Contact11GetFixtureAEv(ptr noundef nonnull align 8 dereferenceable(128) %11)
  %13 = tail call noundef ptr @_ZN9b2Contact11GetFixtureBEv(ptr noundef nonnull align 8 dereferenceable(128) %11)
  %14 = icmp eq ptr %12, %1
  %15 = icmp eq ptr %13, %2
  %or.cond = and i1 %14, %15
  br i1 %or.cond, label %.thread53, label %16

16:                                               ; preds = %.lr.ph
  %17 = icmp eq ptr %12, %2
  %18 = icmp eq ptr %13, %1
  %or.cond49 = and i1 %17, %18
  br i1 %or.cond49, label %.thread53, label %8

.thread53:                                        ; preds = %16, %.lr.ph
  %19 = getelementptr inbounds i8, ptr %11, i64 104
  %20 = load i32, ptr %19, align 8, !tbaa !7
  %21 = or i32 %20, 2
  store i32 %21, ptr %19, align 8, !tbaa !7
  br label %47

._crit_edge:                                      ; preds = %8, %.preheader
  %22 = tail call noundef zeroext i1 @_ZNK6b2Body13ShouldCollideEPKS_(ptr noundef nonnull align 8 dereferenceable(208) %5, ptr noundef %4)
  br i1 %22, label %23, label %47

23:                                               ; preds = %._crit_edge
  %24 = getelementptr inbounds i8, ptr %0, i64 152
  %25 = load ptr, ptr %24, align 8, !tbaa !17
  %.not48 = icmp eq ptr %25, null
  br i1 %.not48, label %31, label %26

26:                                               ; preds = %23
  %27 = load ptr, ptr %25, align 8, !tbaa !24
  %28 = getelementptr inbounds i8, ptr %27, i64 16
  %29 = load ptr, ptr %28, align 8
  %30 = tail call noundef zeroext i1 %29(ptr noundef nonnull align 8 dereferenceable(8) %25, ptr noundef nonnull %1, ptr noundef nonnull %2)
  br i1 %30, label %31, label %47

31:                                               ; preds = %26, %23
  %32 = getelementptr inbounds i8, ptr %0, i64 168
  %33 = load ptr, ptr %32, align 8, !tbaa !26
  %34 = tail call noundef ptr @_ZN9b2Contact6CreateEP9b2FixtureS1_P16b2BlockAllocator(ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef %33)
  %35 = icmp eq ptr %34, null
  br i1 %35, label %47, label %36

36:                                               ; preds = %31
  %37 = getelementptr inbounds i8, ptr %0, i64 176
  %38 = load ptr, ptr %37, align 8, !tbaa !27
  %39 = getelementptr inbounds i8, ptr %34, i64 8
  store ptr %38, ptr %39, align 8, !tbaa !28
  %40 = getelementptr inbounds i8, ptr %38, i64 16
  %41 = load ptr, ptr %40, align 8, !tbaa !29
  %42 = getelementptr inbounds i8, ptr %34, i64 16
  store ptr %41, ptr %42, align 8, !tbaa !29
  %43 = getelementptr inbounds i8, ptr %41, i64 8
  store ptr %34, ptr %43, align 8, !tbaa !28
  store ptr %34, ptr %40, align 8, !tbaa !29
  tail call void @_ZN6b2Body10AddContactEP9b2Contact(ptr noundef nonnull align 8 dereferenceable(208) %4, ptr noundef nonnull %34)
  tail call void @_ZN6b2Body10AddContactEP9b2Contact(ptr noundef nonnull align 8 dereferenceable(208) %5, ptr noundef nonnull %34)
  %44 = getelementptr inbounds i8, ptr %0, i64 144
  %45 = load i32, ptr %44, align 8, !tbaa !30
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %44, align 8, !tbaa !30
  br label %47

47:                                               ; preds = %.thread53, %36, %31, %26, %._crit_edge, %3
  %.4 = phi ptr [ null, %3 ], [ null, %._crit_edge ], [ null, %26 ], [ %34, %36 ], [ null, %31 ], [ %11, %.thread53 ]
  ret ptr %.4
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN6b2Body15GetContactCountEv(ptr noundef nonnull align 8 dereferenceable(208)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN6b2Body10GetContactEi(ptr noundef nonnull align 8 dereferenceable(208), i32 noundef) local_unnamed_addr #0 align 2

declare noundef ptr @_ZN9b2Contact6CreateEP9b2FixtureS1_P16b2BlockAllocator(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @_ZN6b2Body10AddContactEP9b2Contact(ptr noundef nonnull align 8 dereferenceable(208), ptr noundef) local_unnamed_addr #1

attributes #0 = { 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 #1 = { "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 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" }

!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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !16, i64 104}
!8 = !{!"_ZTS9b2Contact", !9, i64 0, !9, i64 8, !9, i64 16, !9, i64 24, !9, i64 32, !12, i64 40, !16, i64 104, !16, i64 108, !14, i64 112, !14, i64 116, !14, i64 120, !14, i64 124}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"_ZTS10b2Manifold", !10, i64 0, !13, i64 40, !13, i64 48, !15, i64 56, !16, i64 60}
!13 = !{!"_ZTS6b2Vec2", !14, i64 0, !14, i64 4}
!14 = !{!"float", !10, i64 0}
!15 = !{!"_ZTSN10b2Manifold4TypeE", !10, i64 0}
!16 = !{!"int", !10, i64 0}
!17 = !{!18, !9, i64 152}
!18 = !{!"_ZTS16b2ContactManager", !19, i64 0, !16, i64 144, !9, i64 152, !9, i64 160, !9, i64 168, !9, i64 176}
!19 = !{!"_ZTS12b2BroadPhase", !9, i64 0, !9, i64 8, !9, i64 16, !9, i64 24, !20, i64 32, !9, i64 80, !9, i64 88, !9, i64 96, !16, i64 104, !16, i64 108, !22, i64 112, !16, i64 128, !16, i64 132, !23, i64 136}
!20 = !{!"_ZTS10b2TreeNode", !9, i64 0, !9, i64 8, !9, i64 16, !9, i64 24, !21, i64 32}
!21 = !{!"_ZTS6b2AABB", !13, i64 0, !13, i64 8}
!22 = !{!"_ZTS14b2IntHashTable", !9, i64 0, !16, i64 8}
!23 = !{!"bool", !10, i64 0}
!24 = !{!25, !25, i64 0}
!25 = !{!"vtable pointer", !11, i64 0}
!26 = !{!18, !9, i64 168}
!27 = !{!18, !9, i64 176}
!28 = !{!8, !9, i64 8}
!29 = !{!8, !9, i64 16}
!30 = !{!18, !16, i64 144}


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