; LLVM IR from mtsamis/box2d-optimized :: src/common/b2_geometry.ll (Z11CreateLinksP6b2BodyP12b2FixtureDefPK6b2Vec2ibS3_S3_)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.b2Vec2 = type { float, float }
%class.b2EdgeShape = type <{ %class.b2Shape, %struct.b2Vec2, %struct.b2Vec2, %struct.b2Vec2, %struct.b2Vec2, i8, [7 x i8] }>
%class.b2Shape = type { ptr, i32, float }
%struct.b2FixtureDef = type { ptr, %struct.b2FixtureUserData, float, float, float, float, i8, %struct.b2Filter }
%struct.b2FixtureUserData = type { i64 }
%struct.b2Filter = type { i16, i16, i16 }

@.str = external hidden unnamed_addr constant [32 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [84 x i8], align 1
@__PRETTY_FUNCTION__._Z11CreateLinksP6b2BodyP12b2FixtureDefPK6b2Vec2ibS3_S3_ = external hidden unnamed_addr constant [100 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [84 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z11CreateLinksP6b2BodyP12b2FixtureDefPK6b2Vec2ibS3_S3_(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, i1 noundef zeroext %4, <2 x float> %5, <2 x float> %6) #0 personality ptr @__gxx_personality_v0 {
  %8 = alloca %struct.b2Vec2, align 4
  %9 = alloca %struct.b2Vec2, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i8, align 1
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca %struct.b2Vec2, align 4
  %18 = alloca %struct.b2Vec2, align 4
  %19 = alloca %class.b2EdgeShape, align 8
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  %22 = alloca %class.b2EdgeShape, align 8
  store <2 x float> %5, ptr %8, align 4
  store <2 x float> %6, ptr %9, align 4
  store ptr %0, ptr %10, align 8, !tbaa !5
  store ptr %1, ptr %11, align 8, !tbaa !5
  store ptr %2, ptr %12, align 8, !tbaa !5
  store i32 %3, ptr %13, align 4, !tbaa !9
  %23 = zext i1 %4 to i8
  store i8 %23, ptr %14, align 1, !tbaa !11
  %24 = load i8, ptr %14, align 1, !tbaa !11, !range !13, !noundef !14
  %25 = trunc i8 %24 to i1
  br i1 %25, label %26, label %29

26:                                               ; preds = %7
  %27 = load i32, ptr %13, align 4, !tbaa !9
  %28 = icmp sge i32 %27, 3
  br label %32

29:                                               ; preds = %7
  %30 = load i32, ptr %13, align 4, !tbaa !9
  %31 = icmp sge i32 %30, 2
  br label %32

32:                                               ; preds = %29, %26
  %33 = phi i1 [ %28, %26 ], [ %31, %29 ]
  br i1 %33, label %34, label %35

34:                                               ; preds = %32
  br label %37

35:                                               ; preds = %32
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 7, ptr noundef @__PRETTY_FUNCTION__._Z11CreateLinksP6b2BodyP12b2FixtureDefPK6b2Vec2ibS3_S3_) #8
  unreachable

36:                                               ; No predecessors!
  br label %37

37:                                               ; preds = %36, %34
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #9
  %38 = load ptr, ptr %11, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.b2FixtureDef, ptr %38, i32 0, i32 0
  %40 = load ptr, ptr %39, align 8, !tbaa !15
  store ptr %40, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #9
  store i32 1, ptr %16, align 4, !tbaa !9
  br label %41

41:                                               ; preds = %102, %37
  %42 = load i32, ptr %16, align 4, !tbaa !9
  %43 = load i32, ptr %13, align 4, !tbaa !9
  %44 = icmp slt i32 %42, %43
  br i1 %44, label %46, label %45

45:                                               ; preds = %41
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #9
  br label %109

46:                                               ; preds = %41
  %47 = load ptr, ptr %12, align 8, !tbaa !5
  %48 = load i32, ptr %16, align 4, !tbaa !9
  %49 = sub nsw i32 %48, 1
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds %struct.b2Vec2, ptr %47, i64 %50
  %52 = load ptr, ptr %12, align 8, !tbaa !5
  %53 = load i32, ptr %16, align 4, !tbaa !9
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds %struct.b2Vec2, ptr %52, i64 %54
  %56 = call noundef float @_Z17b2DistanceSquaredRK6b2Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %51, ptr noundef nonnull align 4 dereferenceable(8) %55)
  %57 = fcmp ogt float %56, 0x3EFA36E2E0000000
  br i1 %57, label %58, label %59

58:                                               ; preds = %46
  br label %61

59:                                               ; preds = %46
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 13, ptr noundef @__PRETTY_FUNCTION__._Z11CreateLinksP6b2BodyP12b2FixtureDefPK6b2Vec2ibS3_S3_) #8
  unreachable

60:                                               ; No predecessors!
  br label %61

61:                                               ; preds = %60, %58
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #9
  %62 = load i32, ptr %16, align 4, !tbaa !9
  %63 = icmp sgt i32 %62, 1
  br i1 %63, label %64, label %70

64:                                               ; preds = %61
  %65 = load ptr, ptr %12, align 8, !tbaa !5
  %66 = load i32, ptr %16, align 4, !tbaa !9
  %67 = sub nsw i32 %66, 2
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds %struct.b2Vec2, ptr %65, i64 %68
  br label %71

70:                                               ; preds = %61
  br label %71

71:                                               ; preds = %70, %64
  %72 = phi ptr [ %69, %64 ], [ %8, %70 ]
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %17, ptr align 4 %72, i64 8, i1 false), !tbaa.struct !22
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #9
  %73 = load i32, ptr %16, align 4, !tbaa !9
  %74 = load i32, ptr %13, align 4, !tbaa !9
  %75 = sub nsw i32 %74, 1
  %76 = icmp slt i32 %73, %75
  br i1 %76, label %77, label %83

77:                                               ; preds = %71
  %78 = load ptr, ptr %12, align 8, !tbaa !5
  %79 = load i32, ptr %16, align 4, !tbaa !9
  %80 = add nsw i32 %79, 1
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds %struct.b2Vec2, ptr %78, i64 %81
  br label %84

83:                                               ; preds = %71
  br label %84

84:                                               ; preds = %83, %77
  %85 = phi ptr [ %82, %77 ], [ %9, %83 ]
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %18, ptr align 4 %85, i64 8, i1 false), !tbaa.struct !22
  call void @llvm.lifetime.start.p0(i64 56, ptr %19) #9
  call void @_ZN11b2EdgeShapeC2Ev(ptr noundef nonnull align 8 dereferenceable(49) %19)
  %86 = load ptr, ptr %12, align 8, !tbaa !5
  %87 = load i32, ptr %16, align 4, !tbaa !9
  %88 = sub nsw i32 %87, 1
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds %struct.b2Vec2, ptr %86, i64 %89
  %91 = load ptr, ptr %12, align 8, !tbaa !5
  %92 = load i32, ptr %16, align 4, !tbaa !9
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds %struct.b2Vec2, ptr %91, i64 %93
  invoke void @_ZN11b2EdgeShape11SetOneSidedERK6b2Vec2S2_S2_S2_(ptr noundef nonnull align 8 dereferenceable(49) %19, ptr noundef nonnull align 4 dereferenceable(8) %17, ptr noundef nonnull align 4 dereferenceable(8) %90, ptr noundef nonnull align 4 dereferenceable(8) %94, ptr noundef nonnull align 4 dereferenceable(8) %18)
          to label %95 unwind label %105

95:                                               ; preds = %84
  %96 = load ptr, ptr %11, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.b2FixtureDef, ptr %96, i32 0, i32 0
  store ptr %19, ptr %97, align 8, !tbaa !15
  %98 = load ptr, ptr %10, align 8, !tbaa !5
  %99 = load ptr, ptr %11, align 8, !tbaa !5
  %100 = invoke noundef ptr @_ZN6b2Body13CreateFixtureEPK12b2FixtureDef(ptr noundef nonnull align 8 dereferenceable(208) %98, ptr noundef %99)
          to label %101 unwind label %105

101:                                              ; preds = %95
  call void @_ZN7b2ShapeD2Ev(ptr noundef nonnull align 8 dereferenceable(49) %19) #9
  call void @llvm.lifetime.end.p0(i64 56, ptr %19) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #9
  br label %102

102:                                              ; preds = %101
  %103 = load i32, ptr %16, align 4, !tbaa !9
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %16, align 4, !tbaa !9
  br label %41, !llvm.loop !24

105:                                              ; preds = %95, %84
  %106 = landingpad { ptr, i32 }
          cleanup
  %107 = extractvalue { ptr, i32 } %106, 0
  store ptr %107, ptr %20, align 8
  %108 = extractvalue { ptr, i32 } %106, 1
  store i32 %108, ptr %21, align 4
  call void @_ZN7b2ShapeD2Ev(ptr noundef nonnull align 8 dereferenceable(49) %19) #9
  call void @llvm.lifetime.end.p0(i64 56, ptr %19) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #9
  br label %142

109:                                              ; preds = %45
  %110 = load i8, ptr %14, align 1, !tbaa !11, !range !13, !noundef !14
  %111 = trunc i8 %110 to i1
  br i1 %111, label %112, label %138

112:                                              ; preds = %109
  call void @llvm.lifetime.start.p0(i64 56, ptr %22) #9
  call void @_ZN11b2EdgeShapeC2Ev(ptr noundef nonnull align 8 dereferenceable(49) %22)
  %113 = load ptr, ptr %12, align 8, !tbaa !5
  %114 = load i32, ptr %13, align 4, !tbaa !9
  %115 = sub nsw i32 %114, 2
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds %struct.b2Vec2, ptr %113, i64 %116
  %118 = load ptr, ptr %12, align 8, !tbaa !5
  %119 = load i32, ptr %13, align 4, !tbaa !9
  %120 = sub nsw i32 %119, 1
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds %struct.b2Vec2, ptr %118, i64 %121
  %123 = load ptr, ptr %12, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.b2Vec2, ptr %123, i64 0
  %125 = load ptr, ptr %12, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.b2Vec2, ptr %125, i64 1
  invoke void @_ZN11b2EdgeShape11SetOneSidedERK6b2Vec2S2_S2_S2_(ptr noundef nonnull align 8 dereferenceable(49) %22, ptr noundef nonnull align 4 dereferenceable(8) %117, ptr noundef nonnull align 4 dereferenceable(8) %122, ptr noundef nonnull align 4 dereferenceable(8) %124, ptr noundef nonnull align 4 dereferenceable(8) %126)
          to label %127 unwind label %134

127:                                              ; preds = %112
  %128 = load ptr, ptr %11, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.b2FixtureDef, ptr %128, i32 0, i32 0
  store ptr %22, ptr %129, align 8, !tbaa !15
  %130 = load ptr, ptr %10, align 8, !tbaa !5
  %131 = load ptr, ptr %11, align 8, !tbaa !5
  %132 = invoke noundef ptr @_ZN6b2Body13CreateFixtureEPK12b2FixtureDef(ptr noundef nonnull align 8 dereferenceable(208) %130, ptr noundef %131)
          to label %133 unwind label %134

133:                                              ; preds = %127
  call void @_ZN7b2ShapeD2Ev(ptr noundef nonnull align 8 dereferenceable(49) %22) #9
  call void @llvm.lifetime.end.p0(i64 56, ptr %22) #9
  br label %138

134:                                              ; preds = %127, %112
  %135 = landingpad { ptr, i32 }
          cleanup
  %136 = extractvalue { ptr, i32 } %135, 0
  store ptr %136, ptr %20, align 8
  %137 = extractvalue { ptr, i32 } %135, 1
  store i32 %137, ptr %21, align 4
  call void @_ZN7b2ShapeD2Ev(ptr noundef nonnull align 8 dereferenceable(49) %22) #9
  call void @llvm.lifetime.end.p0(i64 56, ptr %22) #9
  br label %142

138:                                              ; preds = %133, %109
  %139 = load ptr, ptr %15, align 8, !tbaa !5
  %140 = load ptr, ptr %11, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.b2FixtureDef, ptr %140, i32 0, i32 0
  store ptr %139, ptr %141, align 8, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #9
  ret void

142:                                              ; preds = %134, %105
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #9
  br label %143

143:                                              ; preds = %142
  %144 = load ptr, ptr %20, align 8
  %145 = load i32, ptr %21, align 4
  %146 = insertvalue { ptr, i32 } poison, ptr %144, 0
  %147 = insertvalue { ptr, i32 } %146, i32 %145, 1
  resume { ptr, i32 } %147
}

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef float @_Z17b2DistanceSquaredRK6b2Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN11b2EdgeShapeC2Ev(ptr noundef nonnull align 8 dereferenceable(49)) unnamed_addr #5 align 2

declare void @_ZN11b2EdgeShape11SetOneSidedERK6b2Vec2S2_S2_S2_(ptr noundef nonnull align 8 dereferenceable(49), ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #6

declare i32 @__gxx_personality_v0(...)

declare noundef ptr @_ZN6b2Body13CreateFixtureEPK12b2FixtureDef(ptr noundef nonnull align 8 dereferenceable(208), ptr noundef) #6

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

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="64" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint mustprogress uwtable "min-legal-vector-width"="64" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { inlinehint 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 #6 = { "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 #7 = { 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 #8 = { noreturn nounwind }
attributes #9 = { 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, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !6, i64 0}
!16 = !{!"_ZTS12b2FixtureDef", !6, i64 0, !17, i64 8, !19, i64 16, !19, i64 20, !19, i64 24, !19, i64 28, !12, i64 32, !20, i64 34}
!17 = !{!"_ZTS17b2FixtureUserData", !18, i64 0}
!18 = !{!"long", !7, i64 0}
!19 = !{!"float", !7, i64 0}
!20 = !{!"_ZTS8b2Filter", !21, i64 0, !21, i64 2, !21, i64 4}
!21 = !{!"short", !7, i64 0}
!22 = !{i64 0, i64 4, !23, i64 4, i64 4, !23}
!23 = !{!19, !19, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.b2Vec2 = type { float, float }
%class.b2EdgeShape = type <{ %class.b2Shape, %struct.b2Vec2, %struct.b2Vec2, %struct.b2Vec2, %struct.b2Vec2, i8, [7 x i8] }>
%class.b2Shape = type { ptr, i32, float }

@.str = external hidden unnamed_addr constant [32 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [84 x i8], align 1
@__PRETTY_FUNCTION__._Z11CreateLinksP6b2BodyP12b2FixtureDefPK6b2Vec2ibS3_S3_ = external hidden unnamed_addr constant [100 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [84 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z11CreateLinksP6b2BodyP12b2FixtureDefPK6b2Vec2ibS3_S3_(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, i1 noundef zeroext %4, <2 x float> %5, <2 x float> %6) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %8 = alloca %struct.b2Vec2, align 8
  %9 = alloca %struct.b2Vec2, align 8
  %10 = alloca %struct.b2Vec2, align 8
  %11 = alloca %class.b2EdgeShape, align 8
  %12 = alloca %class.b2EdgeShape, align 8
  store <2 x float> %6, ptr %8, align 8
  %.v = select i1 %4, i32 2, i32 1
  %13 = icmp slt i32 %.v, %3
  br i1 %13, label %.lr.ph, label %14

14:                                               ; preds = %7
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 7, ptr noundef nonnull @__PRETTY_FUNCTION__._Z11CreateLinksP6b2BodyP12b2FixtureDefPK6b2Vec2ibS3_S3_) #7
  unreachable

.lr.ph:                                           ; preds = %7
  %15 = load ptr, ptr %1, align 8, !tbaa !5
  %16 = add nsw i32 %3, -1
  %17 = zext nneg i32 %16 to i64
  %wide.trip.count = zext nneg i32 %3 to i64
  %18 = getelementptr i8, ptr %2, i64 8
  %19 = tail call noundef float @_Z17b2DistanceSquaredRK6b2Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %2, ptr noundef nonnull align 4 dereferenceable(8) %18)
  %20 = fcmp ogt float %19, 0x3EFA36E2E0000000
  br i1 %20, label %21, label %.loopexit

21:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #8
  store <2 x float> %5, ptr %9, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #8
  %.not = icmp eq i32 %3, 2
  %22 = getelementptr inbounds i8, ptr %2, i64 16
  %23 = select i1 %.not, ptr %8, ptr %22
  %24 = load i64, ptr %23, align 4
  store i64 %24, ptr %10, align 8
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %11) #8
  call void @_ZN11b2EdgeShapeC2Ev(ptr noundef nonnull align 8 dereferenceable(49) %11)
  invoke void @_ZN11b2EdgeShape11SetOneSidedERK6b2Vec2S2_S2_S2_(ptr noundef nonnull align 8 dereferenceable(49) %11, ptr noundef nonnull align 4 dereferenceable(8) %9, ptr noundef nonnull align 4 dereferenceable(8) %2, ptr noundef nonnull align 4 dereferenceable(8) %18, ptr noundef nonnull align 4 dereferenceable(8) %10)
          to label %25 unwind label %.loopexit.split-lp

25:                                               ; preds = %21
  store ptr %11, ptr %1, align 8, !tbaa !5
  %26 = invoke noundef ptr @_ZN6b2Body13CreateFixtureEPK12b2FixtureDef(ptr noundef nonnull align 8 dereferenceable(208) %0, ptr noundef nonnull %1)
          to label %27 unwind label %.loopexit.split-lp

27:                                               ; preds = %25
  call void @_ZN7b2ShapeD2Ev(ptr noundef nonnull align 8 dereferenceable(49) %11) #8
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #8
  %exitcond.peel.not = icmp eq i32 %3, 2
  br i1 %exitcond.peel.not, label %._crit_edge, label %.peel.next

._crit_edge:                                      ; preds = %41, %27
  br i1 %4, label %43, label %54

.peel.next:                                       ; preds = %27, %41
  %indvars.iv = phi i64 [ %indvars.iv.next, %41 ], [ 2, %27 ]
  %28 = getelementptr %struct.b2Vec2, ptr %2, i64 %indvars.iv
  %29 = getelementptr i8, ptr %28, i64 -8
  %30 = call noundef float @_Z17b2DistanceSquaredRK6b2Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %29, ptr noundef nonnull align 4 dereferenceable(8) %28)
  %31 = fcmp ogt float %30, 0x3EFA36E2E0000000
  br i1 %31, label %32, label %.loopexit

.loopexit:                                        ; preds = %.peel.next, %.lr.ph
  call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 13, ptr noundef nonnull @__PRETTY_FUNCTION__._Z11CreateLinksP6b2BodyP12b2FixtureDefPK6b2Vec2ibS3_S3_) #7
  unreachable

32:                                               ; preds = %.peel.next
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #8
  %33 = getelementptr i8, ptr %28, i64 -16
  %34 = load i64, ptr %33, align 4
  store i64 %34, ptr %9, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #8
  %35 = icmp ult i64 %indvars.iv, %17
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %36 = getelementptr inbounds %struct.b2Vec2, ptr %2, i64 %indvars.iv.next
  %37 = select i1 %35, ptr %36, ptr %8
  %38 = load i64, ptr %37, align 4
  store i64 %38, ptr %10, align 8
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %11) #8
  call void @_ZN11b2EdgeShapeC2Ev(ptr noundef nonnull align 8 dereferenceable(49) %11)
  invoke void @_ZN11b2EdgeShape11SetOneSidedERK6b2Vec2S2_S2_S2_(ptr noundef nonnull align 8 dereferenceable(49) %11, ptr noundef nonnull align 4 dereferenceable(8) %9, ptr noundef nonnull align 4 dereferenceable(8) %29, ptr noundef nonnull align 4 dereferenceable(8) %28, ptr noundef nonnull align 4 dereferenceable(8) %10)
          to label %39 unwind label %.loopexit45

39:                                               ; preds = %32
  store ptr %11, ptr %1, align 8, !tbaa !5
  %40 = invoke noundef ptr @_ZN6b2Body13CreateFixtureEPK12b2FixtureDef(ptr noundef nonnull align 8 dereferenceable(208) %0, ptr noundef nonnull %1)
          to label %41 unwind label %.loopexit45

41:                                               ; preds = %39
  call void @_ZN7b2ShapeD2Ev(ptr noundef nonnull align 8 dereferenceable(49) %11) #8
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #8
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.peel.next, !llvm.loop !16

.loopexit45:                                      ; preds = %32, %39
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %42

.loopexit.split-lp:                               ; preds = %21, %25
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %42

42:                                               ; preds = %.loopexit.split-lp, %.loopexit45
  %lpad.phi = phi { ptr, i32 } [ %lpad.loopexit, %.loopexit45 ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @_ZN7b2ShapeD2Ev(ptr noundef nonnull align 8 dereferenceable(49) %11) #8
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #8
  br label %55

43:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %12) #8
  call void @_ZN11b2EdgeShapeC2Ev(ptr noundef nonnull align 8 dereferenceable(49) %12)
  %44 = sext i32 %3 to i64
  %45 = getelementptr %struct.b2Vec2, ptr %2, i64 %44
  %46 = getelementptr i8, ptr %45, i64 -16
  %47 = getelementptr i8, ptr %45, i64 -8
  %48 = getelementptr inbounds i8, ptr %2, i64 8
  invoke void @_ZN11b2EdgeShape11SetOneSidedERK6b2Vec2S2_S2_S2_(ptr noundef nonnull align 8 dereferenceable(49) %12, ptr noundef nonnull align 4 dereferenceable(8) %46, ptr noundef nonnull align 4 dereferenceable(8) %47, ptr noundef nonnull align 4 dereferenceable(8) %2, ptr noundef nonnull align 4 dereferenceable(8) %48)
          to label %49 unwind label %52

49:                                               ; preds = %43
  store ptr %12, ptr %1, align 8, !tbaa !5
  %50 = invoke noundef ptr @_ZN6b2Body13CreateFixtureEPK12b2FixtureDef(ptr noundef nonnull align 8 dereferenceable(208) %0, ptr noundef nonnull %1)
          to label %51 unwind label %52

51:                                               ; preds = %49
  call void @_ZN7b2ShapeD2Ev(ptr noundef nonnull align 8 dereferenceable(49) %12) #8
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %12) #8
  br label %54

52:                                               ; preds = %49, %43
  %53 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7b2ShapeD2Ev(ptr noundef nonnull align 8 dereferenceable(49) %12) #8
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %12) #8
  br label %55

54:                                               ; preds = %51, %._crit_edge
  store ptr %15, ptr %1, align 8, !tbaa !5
  ret void

55:                                               ; preds = %52, %42
  %.pn = phi { ptr, i32 } [ %lpad.phi, %42 ], [ %53, %52 ]
  resume { ptr, i32 } %.pn
}

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef float @_Z17b2DistanceSquaredRK6b2Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN11b2EdgeShapeC2Ev(ptr noundef nonnull align 8 dereferenceable(49)) unnamed_addr #4 align 2

declare void @_ZN11b2EdgeShape11SetOneSidedERK6b2Vec2S2_S2_S2_(ptr noundef nonnull align 8 dereferenceable(49), ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #5

declare i32 @__gxx_personality_v0(...)

declare noundef ptr @_ZN6b2Body13CreateFixtureEPK12b2FixtureDef(ptr noundef nonnull align 8 dereferenceable(208), ptr noundef) local_unnamed_addr #5

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

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="64" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint mustprogress uwtable "min-legal-vector-width"="64" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { noreturn nounwind }
attributes #8 = { 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 = !{!"_ZTS12b2FixtureDef", !7, i64 0, !10, i64 8, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !13, i64 32, !14, i64 34}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTS17b2FixtureUserData", !11, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!"float", !8, i64 0}
!13 = !{!"bool", !8, i64 0}
!14 = !{!"_ZTS8b2Filter", !15, i64 0, !15, i64 2, !15, i64 4}
!15 = !{!"short", !8, i64 0}
!16 = distinct !{!16, !17, !18}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!"llvm.loop.peeled.count", i32 1}


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