; LLVM IR from erincatto/box2d-lite :: src/World.ll (ZN5World10BroadPhaseEv)

; 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.Arbiter = type <{ [2 x %struct.Contact], i32, [4 x i8], ptr, ptr, float, [4 x i8] }>
%struct.Contact = type { %struct.Vec2, %struct.Vec2, %struct.Vec2, %struct.Vec2, float, float, float, float, float, float, float, %union.FeaturePair }
%struct.Vec2 = type { float, float }
%union.FeaturePair = type { i32 }
%struct.ArbiterKey = type { ptr, ptr }
%"struct.std::_Rb_tree_iterator" = type { ptr }
%"struct.std::pair.8" = type { %struct.ArbiterKey, %struct.Arbiter }
%"struct.std::pair" = type <{ %"struct.std::_Rb_tree_iterator", i8, [7 x i8] }>
%struct.World = type <{ %"class.std::vector", %"class.std::vector.0", %"class.std::map", %struct.Vec2, i32, [4 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<Body *, std::allocator<Body *>>::_Vector_impl" }
%"struct.std::_Vector_base<Body *, std::allocator<Body *>>::_Vector_impl" = type { %"struct.std::_Vector_base<Body *, std::allocator<Body *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Body *, std::allocator<Body *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<Joint *, std::allocator<Joint *>>::_Vector_impl" }
%"struct.std::_Vector_base<Joint *, std::allocator<Joint *>>::_Vector_impl" = type { %"struct.std::_Vector_base<Joint *, std::allocator<Joint *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Joint *, std::allocator<Joint *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<ArbiterKey, std::pair<const ArbiterKey, Arbiter>, std::_Select1st<std::pair<const ArbiterKey, Arbiter>>, std::less<ArbiterKey>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<ArbiterKey, std::pair<const ArbiterKey, Arbiter>, std::_Select1st<std::pair<const ArbiterKey, Arbiter>>, std::less<ArbiterKey>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%struct.Body = type { %struct.Vec2, float, %struct.Vec2, float, %struct.Vec2, float, %struct.Vec2, float, float, float, float, float }
%"struct.std::pair.10" = type { %struct.ArbiterKey, %struct.Arbiter }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5World10BroadPhaseEv(ptr noundef nonnull align 8 dereferenceable(108) %0) #0 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca %struct.Arbiter, align 8
  %9 = alloca %struct.ArbiterKey, align 8
  %10 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %11 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %12 = alloca %"struct.std::pair.8", align 8
  %13 = alloca %"struct.std::pair", align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %14 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %15

15:                                               ; preds = %95, %1
  %16 = load i32, ptr %3, align 4, !tbaa !9
  %17 = getelementptr inbounds %struct.World, ptr %14, i32 0, i32 0
  %18 = call noundef i64 @_ZNKSt6vectorIP4BodySaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %17) #4
  %19 = trunc i64 %18 to i32
  %20 = icmp slt i32 %16, %19
  br i1 %20, label %22, label %21

21:                                               ; preds = %15
  store i32 2, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %98

22:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %23 = getelementptr inbounds %struct.World, ptr %14, i32 0, i32 0
  %24 = load i32, ptr %3, align 4, !tbaa !9
  %25 = sext i32 %24 to i64
  %26 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP4BodySaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %23, i64 noundef %25) #4
  %27 = load ptr, ptr %26, align 8, !tbaa !5
  store ptr %27, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %28 = load i32, ptr %3, align 4, !tbaa !9
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr %6, align 4, !tbaa !9
  br label %30

30:                                               ; preds = %91, %22
  %31 = load i32, ptr %6, align 4, !tbaa !9
  %32 = getelementptr inbounds %struct.World, ptr %14, i32 0, i32 0
  %33 = call noundef i64 @_ZNKSt6vectorIP4BodySaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %32) #4
  %34 = trunc i64 %33 to i32
  %35 = icmp slt i32 %31, %34
  br i1 %35, label %37, label %36

36:                                               ; preds = %30
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %94

37:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %38 = getelementptr inbounds %struct.World, ptr %14, i32 0, i32 0
  %39 = load i32, ptr %6, align 4, !tbaa !9
  %40 = sext i32 %39 to i64
  %41 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP4BodySaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %38, i64 noundef %40) #4
  %42 = load ptr, ptr %41, align 8, !tbaa !5
  store ptr %42, ptr %7, align 8, !tbaa !5
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.Body, ptr %43, i32 0, i32 9
  %45 = load float, ptr %44, align 4, !tbaa !11
  %46 = fcmp oeq float %45, 0.000000e+00
  br i1 %46, label %47, label %53

47:                                               ; preds = %37
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.Body, ptr %48, i32 0, i32 9
  %50 = load float, ptr %49, align 4, !tbaa !11
  %51 = fcmp oeq float %50, 0.000000e+00
  br i1 %51, label %52, label %53

52:                                               ; preds = %47
  store i32 7, ptr %4, align 4
  br label %88

53:                                               ; preds = %47, %37
  call void @llvm.lifetime.start.p0(i64 160, ptr %8) #4
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZN7ArbiterC1EP4BodyS1_(ptr noundef nonnull align 8 dereferenceable(156) %8, ptr noundef %54, ptr noundef %55)
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #4
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZN10ArbiterKeyC2EP4BodyS1_(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef %56, ptr noundef %57)
  %58 = getelementptr inbounds %struct.Arbiter, ptr %8, i32 0, i32 1
  %59 = load i32, ptr %58, align 8, !tbaa !15
  %60 = icmp sgt i32 %59, 0
  br i1 %60, label %61, label %84

61:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %62 = getelementptr inbounds %struct.World, ptr %14, i32 0, i32 2
  %63 = call ptr @_ZNSt3mapI10ArbiterKey7ArbiterSt4lessIS0_ESaISt4pairIKS0_S1_EEE4findERS5_(ptr noundef nonnull align 8 dereferenceable(48) %62, ptr noundef nonnull align 8 dereferenceable(16) %9)
  %64 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %10, i32 0, i32 0
  store ptr %63, ptr %64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %65 = getelementptr inbounds %struct.World, ptr %14, i32 0, i32 2
  %66 = call ptr @_ZNSt3mapI10ArbiterKey7ArbiterSt4lessIS0_ESaISt4pairIKS0_S1_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %65) #4
  %67 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %11, i32 0, i32 0
  store ptr %66, ptr %67, align 8
  %68 = call noundef zeroext i1 @_ZSteqRKSt17_Rb_tree_iteratorISt4pairIK10ArbiterKey7ArbiterEES7_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  br i1 %68, label %69, label %76

69:                                               ; preds = %61
  %70 = getelementptr inbounds %struct.World, ptr %14, i32 0, i32 2
  call void @llvm.lifetime.start.p0(i64 176, ptr %12) #4
  call void @_ZNSt4pairI10ArbiterKey7ArbiterEC2IRS0_RS1_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS7_S8_EEEbE4typeELb1EEEOS7_OS8_(ptr noundef nonnull align 8 dereferenceable(176) %12, ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(156) %8)
  %71 = call { ptr, i8 } @_ZNSt3mapI10ArbiterKey7ArbiterSt4lessIS0_ESaISt4pairIKS0_S1_EEE6insertIS4_IS0_S1_EEENSt9enable_ifIXsr16is_constructibleIS6_T_EE5valueES4_ISt17_Rb_tree_iteratorIS6_EbEE4typeEOSC_(ptr noundef nonnull align 8 dereferenceable(48) %70, ptr noundef nonnull align 8 dereferenceable(176) %12)
  %72 = getelementptr inbounds { ptr, i8 }, ptr %13, i32 0, i32 0
  %73 = extractvalue { ptr, i8 } %71, 0
  store ptr %73, ptr %72, align 8
  %74 = getelementptr inbounds { ptr, i8 }, ptr %13, i32 0, i32 1
  %75 = extractvalue { ptr, i8 } %71, 1
  store i8 %75, ptr %74, align 8
  call void @llvm.lifetime.end.p0(i64 176, ptr %12) #4
  br label %83

76:                                               ; preds = %61
  %77 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIK10ArbiterKey7ArbiterEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %10) #4
  %78 = getelementptr inbounds %"struct.std::pair.10", ptr %77, i32 0, i32 1
  %79 = getelementptr inbounds %struct.Arbiter, ptr %8, i32 0, i32 0
  %80 = getelementptr inbounds [2 x %struct.Contact], ptr %79, i64 0, i64 0
  %81 = getelementptr inbounds %struct.Arbiter, ptr %8, i32 0, i32 1
  %82 = load i32, ptr %81, align 8, !tbaa !15
  call void @_ZN7Arbiter6UpdateEP7Contacti(ptr noundef nonnull align 8 dereferenceable(156) %78, ptr noundef %80, i32 noundef %82)
  br label %83

83:                                               ; preds = %76, %69
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %87

84:                                               ; preds = %53
  %85 = getelementptr inbounds %struct.World, ptr %14, i32 0, i32 2
  %86 = call noundef i64 @_ZNSt3mapI10ArbiterKey7ArbiterSt4lessIS0_ESaISt4pairIKS0_S1_EEE5eraseERS5_(ptr noundef nonnull align 8 dereferenceable(48) %85, ptr noundef nonnull align 8 dereferenceable(16) %9)
  br label %87

87:                                               ; preds = %84, %83
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 160, ptr %8) #4
  store i32 0, ptr %4, align 4
  br label %88

88:                                               ; preds = %87, %52
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  %89 = load i32, ptr %4, align 4
  switch i32 %89, label %99 [
    i32 0, label %90
    i32 7, label %91
  ]

90:                                               ; preds = %88
  br label %91

91:                                               ; preds = %90, %88
  %92 = load i32, ptr %6, align 4, !tbaa !9
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %6, align 4, !tbaa !9
  br label %30, !llvm.loop !17

94:                                               ; preds = %36
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  br label %95

95:                                               ; preds = %94
  %96 = load i32, ptr %3, align 4, !tbaa !9
  %97 = add nsw i32 %96, 1
  store i32 %97, ptr %3, align 4, !tbaa !9
  br label %15, !llvm.loop !19

98:                                               ; preds = %21
  ret void

99:                                               ; preds = %88
  unreachable
}

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

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

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

declare void @_ZN7ArbiterC1EP4BodyS1_(ptr noundef nonnull align 8 dereferenceable(156), ptr noundef, ptr noundef) unnamed_addr #3

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

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt3mapI10ArbiterKey7ArbiterSt4lessIS0_ESaISt4pairIKS0_S1_EEE4findERS5_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(16)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZSteqRKSt17_Rb_tree_iteratorISt4pairIK10ArbiterKey7ArbiterEES7_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #2

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

; 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
declare dso_local { ptr, i8 } @_ZNSt3mapI10ArbiterKey7ArbiterSt4lessIS0_ESaISt4pairIKS0_S1_EEE6insertIS4_IS0_S1_EEENSt9enable_ifIXsr16is_constructibleIS6_T_EE5valueES4_ISt17_Rb_tree_iteratorIS6_EbEE4typeEOSC_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(176)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairI10ArbiterKey7ArbiterEC2IRS0_RS1_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS7_S8_EEEbE4typeELb1EEEOS7_OS8_(ptr noundef nonnull align 8 dereferenceable(176), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(156)) unnamed_addr #2 align 2

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

declare void @_ZN7Arbiter6UpdateEP7Contacti(ptr noundef nonnull align 8 dereferenceable(156), ptr noundef, i32 noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNSt3mapI10ArbiterKey7ArbiterSt4lessIS0_ESaISt4pairIKS0_S1_EEE5eraseERS5_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(16)) #0 align 2

attributes #0 = { 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 #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 = { "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, !14, i64 52}
!12 = !{!"_ZTS4Body", !13, i64 0, !14, i64 8, !13, i64 12, !14, i64 20, !13, i64 24, !14, i64 32, !13, i64 36, !14, i64 44, !14, i64 48, !14, i64 52, !14, i64 56, !14, i64 60}
!13 = !{!"_ZTS4Vec2", !14, i64 0, !14, i64 4}
!14 = !{!"float", !7, i64 0}
!15 = !{!16, !10, i64 128}
!16 = !{!"_ZTS7Arbiter", !7, i64 0, !10, i64 128, !6, i64 136, !6, i64 144, !14, i64 152}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}


; 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.Arbiter = type <{ [2 x %struct.Contact], i32, [4 x i8], ptr, ptr, float, [4 x i8] }>
%struct.Contact = type { %struct.Vec2, %struct.Vec2, %struct.Vec2, %struct.Vec2, float, float, float, float, float, float, float, %union.FeaturePair }
%struct.Vec2 = type { float, float }
%union.FeaturePair = type { i32 }
%struct.ArbiterKey = type { ptr, ptr }
%"struct.std::_Rb_tree_iterator" = type { ptr }
%"struct.std::pair.8" = type { %struct.ArbiterKey, %struct.Arbiter }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5World10BroadPhaseEv(ptr noundef nonnull align 8 dereferenceable(108) %0) local_unnamed_addr #0 align 2 {
  %2 = alloca %struct.Arbiter, align 8
  %3 = alloca %struct.ArbiterKey, align 8
  %4 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %5 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %6 = alloca %"struct.std::pair.8", align 8
  %7 = tail call noundef i64 @_ZNKSt6vectorIP4BodySaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  %8 = trunc i64 %7 to i32
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.lr.ph16, label %._crit_edge

.lr.ph16:                                         ; preds = %1
  %10 = getelementptr inbounds i8, ptr %2, i64 128
  %11 = getelementptr inbounds i8, ptr %0, i64 48
  br label %15

.loopexit:                                        ; preds = %48, %15
  %12 = call noundef i64 @_ZNKSt6vectorIP4BodySaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  %sext23 = shl i64 %12, 32
  %13 = ashr exact i64 %sext23, 32
  %14 = icmp slt i64 %indvars.iv.next21, %13
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  br i1 %14, label %15, label %._crit_edge, !llvm.loop !5

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

15:                                               ; preds = %.lr.ph16, %.loopexit
  %indvars.iv20 = phi i64 [ 0, %.lr.ph16 ], [ %indvars.iv.next21, %.loopexit ]
  %indvars.iv = phi i64 [ 1, %.lr.ph16 ], [ %indvars.iv.next, %.loopexit ]
  %16 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP4BodySaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %indvars.iv20) #4
  %17 = load ptr, ptr %16, align 8, !tbaa !7
  %indvars.iv.next21 = add nuw nsw i64 %indvars.iv20, 1
  %18 = call noundef i64 @_ZNKSt6vectorIP4BodySaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  %sext = shl i64 %18, 32
  %19 = ashr exact i64 %sext, 32
  %20 = icmp slt i64 %indvars.iv.next21, %19
  br i1 %20, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %15
  %21 = getelementptr inbounds i8, ptr %17, i64 52
  br label %22

22:                                               ; preds = %.lr.ph, %48
  %indvars.iv17 = phi i64 [ %indvars.iv, %.lr.ph ], [ %indvars.iv.next18, %48 ]
  %23 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP4BodySaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %indvars.iv17) #4
  %24 = load ptr, ptr %23, align 8, !tbaa !7
  %25 = load float, ptr %21, align 4, !tbaa !11
  %26 = fcmp oeq float %25, 0.000000e+00
  br i1 %26, label %27, label %31

27:                                               ; preds = %22
  %28 = getelementptr inbounds i8, ptr %24, i64 52
  %29 = load float, ptr %28, align 4, !tbaa !11
  %30 = fcmp oeq float %29, 0.000000e+00
  br i1 %30, label %48, label %31

31:                                               ; preds = %27, %22
  call void @llvm.lifetime.start.p0(i64 160, ptr nonnull %2) #4
  call void @_ZN7ArbiterC1EP4BodyS1_(ptr noundef nonnull align 8 dereferenceable(156) %2, ptr noundef nonnull %17, ptr noundef %24)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #4
  call void @_ZN10ArbiterKeyC2EP4BodyS1_(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull %17, ptr noundef %24)
  %32 = load i32, ptr %10, align 8, !tbaa !15
  %33 = icmp sgt i32 %32, 0
  br i1 %33, label %34, label %45

34:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %35 = call ptr @_ZNSt3mapI10ArbiterKey7ArbiterSt4lessIS0_ESaISt4pairIKS0_S1_EEE4findERS5_(ptr noundef nonnull align 8 dereferenceable(48) %11, ptr noundef nonnull align 8 dereferenceable(16) %3)
  store ptr %35, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  %36 = call ptr @_ZNSt3mapI10ArbiterKey7ArbiterSt4lessIS0_ESaISt4pairIKS0_S1_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %11) #4
  store ptr %36, ptr %5, align 8
  %37 = call noundef zeroext i1 @_ZSteqRKSt17_Rb_tree_iteratorISt4pairIK10ArbiterKey7ArbiterEES7_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  br i1 %37, label %38, label %40

38:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 176, ptr nonnull %6) #4
  call void @_ZNSt4pairI10ArbiterKey7ArbiterEC2IRS0_RS1_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS7_S8_EEEbE4typeELb1EEEOS7_OS8_(ptr noundef nonnull align 8 dereferenceable(176) %6, ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(156) %2)
  %39 = call { ptr, i8 } @_ZNSt3mapI10ArbiterKey7ArbiterSt4lessIS0_ESaISt4pairIKS0_S1_EEE6insertIS4_IS0_S1_EEENSt9enable_ifIXsr16is_constructibleIS6_T_EE5valueES4_ISt17_Rb_tree_iteratorIS6_EbEE4typeEOSC_(ptr noundef nonnull align 8 dereferenceable(48) %11, ptr noundef nonnull align 8 dereferenceable(176) %6)
  call void @llvm.lifetime.end.p0(i64 176, ptr nonnull %6) #4
  br label %44

40:                                               ; preds = %34
  %41 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIK10ArbiterKey7ArbiterEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #4
  %42 = getelementptr inbounds i8, ptr %41, i64 16
  %43 = load i32, ptr %10, align 8, !tbaa !15
  call void @_ZN7Arbiter6UpdateEP7Contacti(ptr noundef nonnull align 8 dereferenceable(156) %42, ptr noundef nonnull %2, i32 noundef %43)
  br label %44

44:                                               ; preds = %40, %38
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  br label %47

45:                                               ; preds = %31
  %46 = call noundef i64 @_ZNSt3mapI10ArbiterKey7ArbiterSt4lessIS0_ESaISt4pairIKS0_S1_EEE5eraseERS5_(ptr noundef nonnull align 8 dereferenceable(48) %11, ptr noundef nonnull align 8 dereferenceable(16) %3)
  br label %47

47:                                               ; preds = %45, %44
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 160, ptr nonnull %2) #4
  br label %48

48:                                               ; preds = %27, %47
  %indvars.iv.next18 = add nuw nsw i64 %indvars.iv17, 1
  %49 = call noundef i64 @_ZNKSt6vectorIP4BodySaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  %50 = trunc i64 %49 to i32
  %51 = trunc nuw i64 %indvars.iv.next18 to i32
  %52 = icmp slt i32 %51, %50
  br i1 %52, label %22, label %.loopexit, !llvm.loop !18
}

; 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 nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIP4BodySaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

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

declare void @_ZN7ArbiterC1EP4BodyS1_(ptr noundef nonnull align 8 dereferenceable(156), ptr noundef, ptr noundef) unnamed_addr #3

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

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt3mapI10ArbiterKey7ArbiterSt4lessIS0_ESaISt4pairIKS0_S1_EEE4findERS5_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #0 align 2

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

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

; 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 uwtable
declare dso_local { ptr, i8 } @_ZNSt3mapI10ArbiterKey7ArbiterSt4lessIS0_ESaISt4pairIKS0_S1_EEE6insertIS4_IS0_S1_EEENSt9enable_ifIXsr16is_constructibleIS6_T_EE5valueES4_ISt17_Rb_tree_iteratorIS6_EbEE4typeEOSC_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(176)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairI10ArbiterKey7ArbiterEC2IRS0_RS1_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS7_S8_EEEbE4typeELb1EEEOS7_OS8_(ptr noundef nonnull align 8 dereferenceable(176), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(156)) unnamed_addr #2 align 2

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

declare void @_ZN7Arbiter6UpdateEP7Contacti(ptr noundef nonnull align 8 dereferenceable(156), ptr noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNSt3mapI10ArbiterKey7ArbiterSt4lessIS0_ESaISt4pairIKS0_S1_EEE5eraseERS5_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #0 align 2

attributes #0 = { 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 #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 = { "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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!12, !14, i64 52}
!12 = !{!"_ZTS4Body", !13, i64 0, !14, i64 8, !13, i64 12, !14, i64 20, !13, i64 24, !14, i64 32, !13, i64 36, !14, i64 44, !14, i64 48, !14, i64 52, !14, i64 56, !14, i64 60}
!13 = !{!"_ZTS4Vec2", !14, i64 0, !14, i64 4}
!14 = !{!"float", !9, i64 0}
!15 = !{!16, !17, i64 128}
!16 = !{!"_ZTS7Arbiter", !9, i64 0, !17, i64 128, !8, i64 136, !8, i64 144, !14, i64 152}
!17 = !{!"int", !9, i64 0}
!18 = distinct !{!18, !6}


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