; LLVM IR from erincatto/box2d :: src (joint)

; 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 }
%struct.b2JointId = type { i32, i16, i16 }
%struct.b2WorldId = type { i16, i16 }
%struct.b2JointPair = type { ptr, ptr }
%struct.b2FilterJointDef = type { %struct.b2BodyId, %struct.b2BodyId, ptr, i32 }
%struct.b2BodyId = type { i32, i16, i16 }
%struct.b2World = type { %struct.b2ArenaAllocator, %struct.b2BroadPhase, %struct.b2ConstraintGraph, %struct.b2IdPool, %struct.b2BodyArray, %struct.b2IdPool, %struct.b2SolverSetArray, %struct.b2IdPool, %struct.b2JointArray, %struct.b2IdPool, %struct.b2ContactArray, %struct.b2IdPool, %struct.b2IslandArray, %struct.b2IdPool, %struct.b2IdPool, %struct.b2ShapeArray, %struct.b2ChainShapeArray, %struct.b2SensorArray, %struct.b2TaskContextArray, %struct.b2SensorTaskContextArray, %struct.b2BodyMoveEventArray, %struct.b2SensorBeginTouchEventArray, %struct.b2ContactBeginTouchEventArray, [2 x %struct.b2SensorEndTouchEventArray], [2 x %struct.b2ContactEndTouchEventArray], i32, %struct.b2ContactHitEventArray, %struct.b2BitSet, %struct.b2BitSet, %struct.b2BitSet, %struct.b2BitSet, i64, i32, %struct.b2Vec2, float, float, float, float, float, float, float, float, ptr, ptr, i16, %struct.b2Profile, ptr, ptr, ptr, ptr, i32, ptr, ptr, ptr, ptr, ptr, float, i32, i32, i16, i8, i8, i8, i8, i8, i8 }
%struct.b2ArenaAllocator = type { ptr, i32, i32, i32, i32, %struct.b2ArenaEntryArray }
%struct.b2ArenaEntryArray = type { ptr, i32, i32 }
%struct.b2BroadPhase = type { [3 x %struct.b2DynamicTree], i32, %struct.b2HashSet, %struct.b2IntArray, ptr, ptr, i32, %struct.b2AtomicInt, %struct.b2HashSet }
%struct.b2DynamicTree = type { ptr, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, i32 }
%struct.b2IntArray = type { ptr, i32, i32 }
%struct.b2AtomicInt = type { i32 }
%struct.b2HashSet = type { ptr, i32, i32 }
%struct.b2ConstraintGraph = type { [12 x %struct.b2GraphColor] }
%struct.b2GraphColor = type { %struct.b2BitSet, %struct.b2ContactSimArray, %struct.b2JointSimArray, %union.anon }
%struct.b2ContactSimArray = type { ptr, i32, i32 }
%struct.b2JointSimArray = type { ptr, i32, i32 }
%union.anon = type { ptr }
%struct.b2BodyArray = type { ptr, i32, i32 }
%struct.b2SolverSetArray = type { ptr, i32, i32 }
%struct.b2JointArray = type { ptr, i32, i32 }
%struct.b2ContactArray = type { ptr, i32, i32 }
%struct.b2IslandArray = type { ptr, i32, i32 }
%struct.b2IdPool = type { %struct.b2IntArray, i32 }
%struct.b2ShapeArray = type { ptr, i32, i32 }
%struct.b2ChainShapeArray = type { ptr, i32, i32 }
%struct.b2SensorArray = type { ptr, i32, i32 }
%struct.b2TaskContextArray = type { ptr, i32, i32 }
%struct.b2SensorTaskContextArray = type { ptr, i32, i32 }
%struct.b2BodyMoveEventArray = type { ptr, i32, i32 }
%struct.b2SensorBeginTouchEventArray = type { ptr, i32, i32 }
%struct.b2ContactBeginTouchEventArray = type { ptr, i32, i32 }
%struct.b2SensorEndTouchEventArray = type { ptr, i32, i32 }
%struct.b2ContactEndTouchEventArray = type { ptr, i32, i32 }
%struct.b2ContactHitEventArray = type { ptr, i32, i32 }
%struct.b2BitSet = type { ptr, i32, i32 }
%struct.b2Profile = type { float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float }
%struct.b2JointSim = type { i32, i32, i32, i32, %struct.b2Vec2, %struct.b2Vec2, float, float, float, float, %union.anon.0 }
%union.anon.0 = type { %struct.b2PrismaticJoint }
%struct.b2PrismaticJoint = type { %struct.b2Vec2, %struct.b2Vec2, float, float, float, float, float, float, float, float, float, float, float, i32, i32, %struct.b2Vec2, %struct.b2Vec2, %struct.b2Vec2, %struct.b2Vec2, float, float, %struct.b2Softness, i8, i8, i8 }
%struct.b2Softness = type { float, float, float }
%struct.b2Joint = type { ptr, i32, i32, i32, [2 x %struct.b2JointEdge], i32, i32, i32, i32, float, i32, i16, i8, i8 }
%struct.b2JointEdge = type { i32, i32, i32 }

@.str.1 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [39 x i8], align 1
@b2Vec2_zero = external hidden constant %struct.b2Vec2, align 4

; 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) #0

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

declare i32 @b2InternalAssertFcn(ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: cold noreturn nounwind memory(inaccessiblemem: write)
declare void @llvm.trap() #3

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

declare ptr @b2GetWorldFromId(i32) #2

declare ptr @b2GetBodyFullId(ptr noundef, i64) #2

; Function Attrs: nounwind uwtable
declare hidden { ptr, ptr } @b2CreateJoint(ptr noundef, ptr noundef, ptr noundef, ptr noundef, float noundef, i32 noundef, i1 noundef zeroext) #4

; Function Attrs: nounwind uwtable
define dso_local i64 @b2CreateFilterJoint(i32 %0, ptr noundef %1) #4 {
  %3 = alloca %struct.b2JointId, align 4
  %4 = alloca %struct.b2WorldId, align 2
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i8, align 1
  %11 = alloca %struct.b2JointPair, align 8
  %12 = alloca ptr, align 8
  store i32 %0, ptr %4, align 2
  store ptr %1, ptr %5, align 8, !tbaa !5
  br label %13

13:                                               ; preds = %2
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.b2FilterJointDef, ptr %14, i32 0, i32 3
  %16 = load i32, ptr %15, align 8, !tbaa !9
  %17 = icmp eq i32 %16, 1152023
  br i1 %17, label %22, label %18

18:                                               ; preds = %13
  %19 = call i32 @b2InternalAssertFcn(ptr noundef @.str.6, ptr noundef @.str.1, i32 noundef 474)
  %20 = icmp ne i32 %19, 0
  br i1 %20, label %21, label %22

21:                                               ; preds = %18
  call void @llvm.trap()
  br label %22

22:                                               ; preds = %21, %18, %13
  br label %23

23:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %24 = load i32, ptr %4, align 2
  %25 = call ptr @b2GetWorldFromId(i32 %24)
  store ptr %25, ptr %6, align 8, !tbaa !5
  br label %26

26:                                               ; preds = %23
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.b2World, ptr %27, i32 0, i32 61
  %29 = load i8, ptr %28, align 1, !tbaa !14, !range !29, !noundef !30
  %30 = trunc i8 %29 to i1
  %31 = zext i1 %30 to i32
  %32 = icmp eq i32 %31, 0
  br i1 %32, label %37, label %33

33:                                               ; preds = %26
  %34 = call i32 @b2InternalAssertFcn(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 477)
  %35 = icmp ne i32 %34, 0
  br i1 %35, label %36, label %37

36:                                               ; preds = %33
  call void @llvm.trap()
  br label %37

37:                                               ; preds = %36, %33, %26
  br label %38

38:                                               ; preds = %37
  br label %39

39:                                               ; preds = %38
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.b2World, ptr %40, i32 0, i32 61
  %42 = load i8, ptr %41, align 1, !tbaa !14, !range !29, !noundef !30
  %43 = trunc i8 %42 to i1
  br i1 %43, label %44, label %48

44:                                               ; preds = %39
  %45 = getelementptr inbounds %struct.b2JointId, ptr %3, i32 0, i32 0
  store i32 0, ptr %45, align 4, !tbaa !31
  %46 = getelementptr inbounds %struct.b2JointId, ptr %3, i32 0, i32 1
  store i16 0, ptr %46, align 4, !tbaa !33
  %47 = getelementptr inbounds %struct.b2JointId, ptr %3, i32 0, i32 2
  store i16 0, ptr %47, align 2, !tbaa !34
  store i32 1, ptr %7, align 4
  br label %94

48:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.b2FilterJointDef, ptr %50, i32 0, i32 0
  %52 = load i64, ptr %51, align 8
  %53 = call ptr @b2GetBodyFullId(ptr noundef %49, i64 %52)
  store ptr %53, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.b2FilterJointDef, ptr %55, i32 0, i32 1
  %57 = load i64, ptr %56, align 8
  %58 = call ptr @b2GetBodyFullId(ptr noundef %54, i64 %57)
  store ptr %58, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #5
  store i8 0, ptr %10, align 1, !tbaa !35
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #5
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = load ptr, ptr %8, align 8, !tbaa !5
  %61 = load ptr, ptr %9, align 8, !tbaa !5
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.b2FilterJointDef, ptr %62, i32 0, i32 2
  %64 = load ptr, ptr %63, align 8, !tbaa !36
  %65 = load i8, ptr %10, align 1, !tbaa !35, !range !29, !noundef !30
  %66 = trunc i8 %65 to i1
  %67 = call { ptr, ptr } @b2CreateJoint(ptr noundef %59, ptr noundef %60, ptr noundef %61, ptr noundef %64, float noundef 1.000000e+00, i32 noundef 1, i1 noundef zeroext %66)
  %68 = getelementptr inbounds { ptr, ptr }, ptr %11, i32 0, i32 0
  %69 = extractvalue { ptr, ptr } %67, 0
  store ptr %69, ptr %68, align 8
  %70 = getelementptr inbounds { ptr, ptr }, ptr %11, i32 0, i32 1
  %71 = extractvalue { ptr, ptr } %67, 1
  store ptr %71, ptr %70, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %72 = getelementptr inbounds %struct.b2JointPair, ptr %11, i32 0, i32 1
  %73 = load ptr, ptr %72, align 8, !tbaa !37
  store ptr %73, ptr %12, align 8, !tbaa !5
  %74 = load ptr, ptr %12, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.b2JointSim, ptr %74, i32 0, i32 3
  store i32 1, ptr %75, align 4, !tbaa !39
  %76 = load ptr, ptr %12, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.b2JointSim, ptr %76, i32 0, i32 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %77, ptr align 4 @b2Vec2_zero, i64 8, i1 false), !tbaa.struct !41
  %78 = load ptr, ptr %12, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.b2JointSim, ptr %78, i32 0, i32 5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %79, ptr align 4 @b2Vec2_zero, i64 8, i1 false), !tbaa.struct !41
  %80 = getelementptr inbounds %struct.b2JointId, ptr %3, i32 0, i32 0
  %81 = load ptr, ptr %12, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.b2JointSim, ptr %81, i32 0, i32 0
  %83 = load i32, ptr %82, align 4, !tbaa !43
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %80, align 4, !tbaa !31
  %85 = getelementptr inbounds %struct.b2JointId, ptr %3, i32 0, i32 1
  %86 = load ptr, ptr %6, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.b2World, ptr %86, i32 0, i32 59
  %88 = load i16, ptr %87, align 4, !tbaa !44
  store i16 %88, ptr %85, align 4, !tbaa !33
  %89 = getelementptr inbounds %struct.b2JointId, ptr %3, i32 0, i32 2
  %90 = getelementptr inbounds %struct.b2JointPair, ptr %11, i32 0, i32 0
  %91 = load ptr, ptr %90, align 8, !tbaa !45
  %92 = getelementptr inbounds %struct.b2Joint, ptr %91, i32 0, i32 11
  %93 = load i16, ptr %92, align 4, !tbaa !46
  store i16 %93, ptr %89, align 2, !tbaa !34
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %94

94:                                               ; preds = %48, %44
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  %95 = load i64, ptr %3, align 4
  ret i64 %95
}

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { cold noreturn nounwind memory(inaccessiblemem: write) }
attributes #4 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }

!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/C++ TBAA"}
!9 = !{!10, !12, i64 24}
!10 = !{!"b2FilterJointDef", !11, i64 0, !11, i64 8, !6, i64 16, !12, i64 24}
!11 = !{!"b2BodyId", !12, i64 0, !13, i64 4, !13, i64 6}
!12 = !{!"int", !7, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = !{!15, !28, i64 1799}
!15 = !{!"b2World", !16, i64 0, !18, i64 40, !21, i64 336, !22, i64 1008, !17, i64 1032, !22, i64 1048, !17, i64 1072, !22, i64 1088, !17, i64 1112, !22, i64 1128, !17, i64 1152, !22, i64 1168, !17, i64 1192, !22, i64 1208, !22, i64 1232, !17, i64 1256, !17, i64 1272, !17, i64 1288, !17, i64 1304, !17, i64 1320, !17, i64 1336, !17, i64 1352, !17, i64 1368, !7, i64 1384, !7, i64 1416, !12, i64 1448, !17, i64 1456, !23, i64 1472, !23, i64 1488, !23, i64 1504, !23, i64 1520, !24, i64 1536, !12, i64 1544, !25, i64 1548, !26, i64 1556, !26, i64 1560, !26, i64 1564, !26, i64 1568, !26, i64 1572, !26, i64 1576, !26, i64 1580, !26, i64 1584, !6, i64 1592, !6, i64 1600, !13, i64 1608, !27, i64 1612, !6, i64 1704, !6, i64 1712, !6, i64 1720, !6, i64 1728, !12, i64 1736, !6, i64 1744, !6, i64 1752, !6, i64 1760, !6, i64 1768, !6, i64 1776, !26, i64 1784, !12, i64 1788, !12, i64 1792, !13, i64 1796, !28, i64 1798, !28, i64 1799, !28, i64 1800, !28, i64 1801, !28, i64 1802, !28, i64 1803}
!16 = !{!"b2ArenaAllocator", !6, i64 0, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !17, i64 24}
!17 = !{!"", !6, i64 0, !12, i64 8, !12, i64 12}
!18 = !{!"b2BroadPhase", !7, i64 0, !12, i64 216, !19, i64 224, !17, i64 240, !6, i64 256, !6, i64 264, !12, i64 272, !20, i64 276, !19, i64 280}
!19 = !{!"b2HashSet", !6, i64 0, !12, i64 8, !12, i64 12}
!20 = !{!"b2AtomicInt", !12, i64 0}
!21 = !{!"b2ConstraintGraph", !7, i64 0}
!22 = !{!"b2IdPool", !17, i64 0, !12, i64 16}
!23 = !{!"b2BitSet", !6, i64 0, !12, i64 8, !12, i64 12}
!24 = !{!"long", !7, i64 0}
!25 = !{!"b2Vec2", !26, i64 0, !26, i64 4}
!26 = !{!"float", !7, i64 0}
!27 = !{!"b2Profile", !26, i64 0, !26, i64 4, !26, i64 8, !26, i64 12, !26, i64 16, !26, i64 20, !26, i64 24, !26, i64 28, !26, i64 32, !26, i64 36, !26, i64 40, !26, i64 44, !26, i64 48, !26, i64 52, !26, i64 56, !26, i64 60, !26, i64 64, !26, i64 68, !26, i64 72, !26, i64 76, !26, i64 80, !26, i64 84}
!28 = !{!"_Bool", !7, i64 0}
!29 = !{i8 0, i8 2}
!30 = !{}
!31 = !{!32, !12, i64 0}
!32 = !{!"b2JointId", !12, i64 0, !13, i64 4, !13, i64 6}
!33 = !{!32, !13, i64 4}
!34 = !{!32, !13, i64 6}
!35 = !{!28, !28, i64 0}
!36 = !{!10, !6, i64 16}
!37 = !{!38, !6, i64 8}
!38 = !{!"b2JointPair", !6, i64 0, !6, i64 8}
!39 = !{!40, !12, i64 12}
!40 = !{!"b2JointSim", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !25, i64 16, !25, i64 24, !26, i64 32, !26, i64 36, !26, i64 40, !26, i64 44, !7, i64 48}
!41 = !{i64 0, i64 4, !42, i64 4, i64 4, !42}
!42 = !{!26, !26, i64 0}
!43 = !{!40, !12, i64 0}
!44 = !{!15, !13, i64 1796}
!45 = !{!38, !6, i64 0}
!46 = !{!47, !13, i64 68}
!47 = !{!"b2Joint", !6, i64 0, !12, i64 8, !12, i64 12, !12, i64 16, !7, i64 20, !12, i64 44, !12, i64 48, !12, i64 52, !12, i64 56, !26, i64 60, !12, i64 64, !13, i64 68, !28, i64 70, !28, i64 71}


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

@.str.1 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [39 x i8], align 1
@b2Vec2_zero = external hidden local_unnamed_addr constant %struct.b2Vec2, align 4

declare i32 @b2InternalAssertFcn(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: cold noreturn nounwind memory(inaccessiblemem: write)
declare void @llvm.trap() #1

declare ptr @b2GetWorldFromId(i32) local_unnamed_addr #0

declare ptr @b2GetBodyFullId(ptr noundef, i64) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden { ptr, ptr } @b2CreateJoint(ptr noundef, ptr noundef, ptr noundef, ptr noundef, float noundef, i32 noundef, i1 noundef zeroext) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local i64 @b2CreateFilterJoint(i32 %0, ptr nocapture noundef readonly %1) local_unnamed_addr #2 {
  %3 = getelementptr inbounds i8, ptr %1, i64 24
  %4 = load i32, ptr %3, align 8, !tbaa !5
  %5 = icmp eq i32 %4, 1152023
  br i1 %5, label %9, label %6

6:                                                ; preds = %2
  %7 = tail call i32 @b2InternalAssertFcn(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.1, i32 noundef 474) #3
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %9, label %8

8:                                                ; preds = %6
  tail call void @llvm.trap()
  unreachable

9:                                                ; preds = %2, %6
  %10 = tail call ptr @b2GetWorldFromId(i32 %0) #3
  %11 = getelementptr inbounds i8, ptr %10, i64 1799
  %12 = load i8, ptr %11, align 1, !tbaa !13, !range !28, !noundef !29
  %13 = icmp eq i8 %12, 0
  br i1 %13, label %.thread, label %14

14:                                               ; preds = %9
  %15 = tail call i32 @b2InternalAssertFcn(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 477) #3
  %.not18 = icmp eq i32 %15, 0
  br i1 %.not18, label %17, label %16

16:                                               ; preds = %14
  tail call void @llvm.trap()
  unreachable

17:                                               ; preds = %14
  %.pre = load i8, ptr %11, align 1, !tbaa !13, !range !28
  %18 = trunc nuw i8 %.pre to i1
  br i1 %18, label %46, label %.thread

.thread:                                          ; preds = %9, %17
  %19 = load i64, ptr %1, align 8
  %20 = tail call ptr @b2GetBodyFullId(ptr noundef nonnull %10, i64 %19) #3
  %21 = getelementptr inbounds i8, ptr %1, i64 8
  %22 = load i64, ptr %21, align 8
  %23 = tail call ptr @b2GetBodyFullId(ptr noundef nonnull %10, i64 %22) #3
  %24 = getelementptr inbounds i8, ptr %1, i64 16
  %25 = load ptr, ptr %24, align 8, !tbaa !30
  %26 = tail call { ptr, ptr } @b2CreateJoint(ptr noundef nonnull %10, ptr noundef %20, ptr noundef %23, ptr noundef %25, float noundef 1.000000e+00, i32 noundef 1, i1 noundef zeroext false)
  %27 = extractvalue { ptr, ptr } %26, 0
  %28 = extractvalue { ptr, ptr } %26, 1
  %29 = getelementptr inbounds i8, ptr %28, i64 12
  store i32 1, ptr %29, align 4, !tbaa !31
  %30 = getelementptr inbounds i8, ptr %28, i64 16
  %31 = load i64, ptr @b2Vec2_zero, align 4
  store i64 %31, ptr %30, align 4
  %32 = getelementptr inbounds i8, ptr %28, i64 24
  store i64 %31, ptr %32, align 4
  %33 = load i32, ptr %28, align 4, !tbaa !33
  %34 = add nsw i32 %33, 1
  %35 = getelementptr inbounds i8, ptr %10, i64 1796
  %36 = load i16, ptr %35, align 4, !tbaa !34
  %37 = getelementptr inbounds i8, ptr %27, i64 68
  %38 = load i16, ptr %37, align 4, !tbaa !35
  %39 = zext i16 %38 to i64
  %40 = shl nuw i64 %39, 48
  %41 = zext i16 %36 to i64
  %42 = shl nuw nsw i64 %41, 32
  %43 = zext i32 %34 to i64
  %44 = or disjoint i64 %42, %43
  %45 = or disjoint i64 %44, %40
  br label %46

46:                                               ; preds = %17, %.thread
  %.sroa.017.0.insert.insert = phi i64 [ %45, %.thread ], [ 0, %17 ]
  ret i64 %.sroa.017.0.insert.insert
}

attributes #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 = { cold noreturn nounwind memory(inaccessiblemem: write) }
attributes #2 = { 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 = { 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, !8, i64 24}
!6 = !{!"b2FilterJointDef", !7, i64 0, !7, i64 8, !12, i64 16, !8, i64 24}
!7 = !{!"b2BodyId", !8, i64 0, !11, i64 4, !11, i64 6}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"short", !9, i64 0}
!12 = !{!"any pointer", !9, i64 0}
!13 = !{!14, !27, i64 1799}
!14 = !{!"b2World", !15, i64 0, !17, i64 40, !20, i64 336, !21, i64 1008, !16, i64 1032, !21, i64 1048, !16, i64 1072, !21, i64 1088, !16, i64 1112, !21, i64 1128, !16, i64 1152, !21, i64 1168, !16, i64 1192, !21, i64 1208, !21, i64 1232, !16, i64 1256, !16, i64 1272, !16, i64 1288, !16, i64 1304, !16, i64 1320, !16, i64 1336, !16, i64 1352, !16, i64 1368, !9, i64 1384, !9, i64 1416, !8, i64 1448, !16, i64 1456, !22, i64 1472, !22, i64 1488, !22, i64 1504, !22, i64 1520, !23, i64 1536, !8, i64 1544, !24, i64 1548, !25, i64 1556, !25, i64 1560, !25, i64 1564, !25, i64 1568, !25, i64 1572, !25, i64 1576, !25, i64 1580, !25, i64 1584, !12, i64 1592, !12, i64 1600, !11, i64 1608, !26, i64 1612, !12, i64 1704, !12, i64 1712, !12, i64 1720, !12, i64 1728, !8, i64 1736, !12, i64 1744, !12, i64 1752, !12, i64 1760, !12, i64 1768, !12, i64 1776, !25, i64 1784, !8, i64 1788, !8, i64 1792, !11, i64 1796, !27, i64 1798, !27, i64 1799, !27, i64 1800, !27, i64 1801, !27, i64 1802, !27, i64 1803}
!15 = !{!"b2ArenaAllocator", !12, i64 0, !8, i64 8, !8, i64 12, !8, i64 16, !8, i64 20, !16, i64 24}
!16 = !{!"", !12, i64 0, !8, i64 8, !8, i64 12}
!17 = !{!"b2BroadPhase", !9, i64 0, !8, i64 216, !18, i64 224, !16, i64 240, !12, i64 256, !12, i64 264, !8, i64 272, !19, i64 276, !18, i64 280}
!18 = !{!"b2HashSet", !12, i64 0, !8, i64 8, !8, i64 12}
!19 = !{!"b2AtomicInt", !8, i64 0}
!20 = !{!"b2ConstraintGraph", !9, i64 0}
!21 = !{!"b2IdPool", !16, i64 0, !8, i64 16}
!22 = !{!"b2BitSet", !12, i64 0, !8, i64 8, !8, i64 12}
!23 = !{!"long", !9, i64 0}
!24 = !{!"b2Vec2", !25, i64 0, !25, i64 4}
!25 = !{!"float", !9, i64 0}
!26 = !{!"b2Profile", !25, i64 0, !25, i64 4, !25, i64 8, !25, i64 12, !25, i64 16, !25, i64 20, !25, i64 24, !25, i64 28, !25, i64 32, !25, i64 36, !25, i64 40, !25, i64 44, !25, i64 48, !25, i64 52, !25, i64 56, !25, i64 60, !25, i64 64, !25, i64 68, !25, i64 72, !25, i64 76, !25, i64 80, !25, i64 84}
!27 = !{!"_Bool", !9, i64 0}
!28 = !{i8 0, i8 2}
!29 = !{}
!30 = !{!6, !12, i64 16}
!31 = !{!32, !8, i64 12}
!32 = !{!"b2JointSim", !8, i64 0, !8, i64 4, !8, i64 8, !8, i64 12, !24, i64 16, !24, i64 24, !25, i64 32, !25, i64 36, !25, i64 40, !25, i64 44, !9, i64 48}
!33 = !{!32, !8, i64 0}
!34 = !{!14, !11, i64 1796}
!35 = !{!36, !11, i64 68}
!36 = !{!"b2Joint", !12, i64 0, !8, i64 8, !8, i64 12, !8, i64 16, !9, i64 20, !8, i64 44, !8, i64 48, !8, i64 52, !8, i64 56, !25, i64 60, !8, i64 64, !11, i64 68, !27, i64 70, !27, i64 71}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass