; 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.b2WeldJoint = type { float, float, float, float, float, %struct.b2Softness, %struct.b2Softness, %struct.b2Vec2, float, i32, i32, %struct.b2Vec2, %struct.b2Vec2, %struct.b2Vec2, float, float }
%struct.b2Softness = type { float, float, float }
%struct.b2WeldJointDef = type { %struct.b2BodyId, %struct.b2BodyId, %struct.b2Vec2, %struct.b2Vec2, float, float, float, float, float, i8, 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.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: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

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

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

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

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

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

declare ptr @b2GetWorldFromId(i32) #3

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

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

; Function Attrs: nounwind uwtable
declare hidden void @b2DestroyContactsBetweenBodies(ptr noundef, ptr noundef, ptr noundef) #5

; Function Attrs: nounwind uwtable
define dso_local i64 @b2CreateWeldJoint(i32 %0, ptr noundef %1) #5 {
  %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 %struct.b2JointPair, align 8
  %11 = alloca ptr, align 8
  %12 = alloca %struct.b2WeldJoint, align 4
  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.b2WeldJointDef, ptr %14, i32 0, i32 11
  %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 613)
  %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) #6
  %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 !17, !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 616)
  %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 !17, !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 %149

48:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.b2WeldJointDef, 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) #6
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.b2WeldJointDef, 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 16, ptr %10) #6
  %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.b2WeldJointDef, ptr %62, i32 0, i32 10
  %64 = load ptr, ptr %63, align 8, !tbaa !35
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.b2WeldJointDef, ptr %65, i32 0, i32 9
  %67 = load i8, ptr %66, align 4, !tbaa !36, !range !29, !noundef !30
  %68 = trunc i8 %67 to i1
  %69 = call { ptr, ptr } @b2CreateJoint(ptr noundef %59, ptr noundef %60, ptr noundef %61, ptr noundef %64, float noundef 1.000000e+00, i32 noundef 6, i1 noundef zeroext %68)
  %70 = getelementptr inbounds { ptr, ptr }, ptr %10, i32 0, i32 0
  %71 = extractvalue { ptr, ptr } %69, 0
  store ptr %71, ptr %70, align 8
  %72 = getelementptr inbounds { ptr, ptr }, ptr %10, i32 0, i32 1
  %73 = extractvalue { ptr, ptr } %69, 1
  store ptr %73, ptr %72, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %74 = getelementptr inbounds %struct.b2JointPair, ptr %10, i32 0, i32 1
  %75 = load ptr, ptr %74, align 8, !tbaa !37
  store ptr %75, ptr %11, align 8, !tbaa !5
  %76 = load ptr, ptr %11, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.b2JointSim, ptr %76, i32 0, i32 3
  store i32 6, ptr %77, align 4, !tbaa !39
  %78 = load ptr, ptr %11, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.b2JointSim, ptr %78, i32 0, i32 4
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.b2WeldJointDef, ptr %80, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %79, ptr align 8 %81, i64 8, i1 false), !tbaa.struct !41
  %82 = load ptr, ptr %11, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.b2JointSim, ptr %82, i32 0, i32 5
  %84 = load ptr, ptr %5, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.b2WeldJointDef, ptr %84, i32 0, i32 3
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %83, ptr align 8 %85, i64 8, i1 false), !tbaa.struct !41
  call void @llvm.lifetime.start.p0(i64 96, ptr %12) #6
  call void @llvm.memset.p0.i64(ptr align 4 %12, i8 0, i64 96, i1 false)
  %86 = load ptr, ptr %11, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.b2JointSim, ptr %86, i32 0, i32 10
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %87, ptr align 4 %12, i64 96, i1 false), !tbaa.struct !43
  %88 = load ptr, ptr %5, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.b2WeldJointDef, ptr %88, i32 0, i32 4
  %90 = load float, ptr %89, align 8, !tbaa !45
  %91 = load ptr, ptr %11, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.b2JointSim, ptr %91, i32 0, i32 10
  %93 = getelementptr inbounds %struct.b2WeldJoint, ptr %92, i32 0, i32 0
  store float %90, ptr %93, align 4, !tbaa !46
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.b2WeldJointDef, ptr %94, i32 0, i32 5
  %96 = load float, ptr %95, align 4, !tbaa !47
  %97 = load ptr, ptr %11, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.b2JointSim, ptr %97, i32 0, i32 10
  %99 = getelementptr inbounds %struct.b2WeldJoint, ptr %98, i32 0, i32 1
  store float %96, ptr %99, align 4, !tbaa !46
  %100 = load ptr, ptr %5, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.b2WeldJointDef, ptr %100, i32 0, i32 7
  %102 = load float, ptr %101, align 4, !tbaa !48
  %103 = load ptr, ptr %11, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.b2JointSim, ptr %103, i32 0, i32 10
  %105 = getelementptr inbounds %struct.b2WeldJoint, ptr %104, i32 0, i32 2
  store float %102, ptr %105, align 4, !tbaa !46
  %106 = load ptr, ptr %5, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.b2WeldJointDef, ptr %106, i32 0, i32 6
  %108 = load float, ptr %107, align 8, !tbaa !49
  %109 = load ptr, ptr %11, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.b2JointSim, ptr %109, i32 0, i32 10
  %111 = getelementptr inbounds %struct.b2WeldJoint, ptr %110, i32 0, i32 3
  store float %108, ptr %111, align 4, !tbaa !46
  %112 = load ptr, ptr %5, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.b2WeldJointDef, ptr %112, i32 0, i32 8
  %114 = load float, ptr %113, align 8, !tbaa !50
  %115 = load ptr, ptr %11, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.b2JointSim, ptr %115, i32 0, i32 10
  %117 = getelementptr inbounds %struct.b2WeldJoint, ptr %116, i32 0, i32 4
  store float %114, ptr %117, align 4, !tbaa !46
  %118 = load ptr, ptr %11, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.b2JointSim, ptr %118, i32 0, i32 10
  %120 = getelementptr inbounds %struct.b2WeldJoint, ptr %119, i32 0, i32 7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %120, ptr align 4 @b2Vec2_zero, i64 8, i1 false), !tbaa.struct !41
  %121 = load ptr, ptr %11, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.b2JointSim, ptr %121, i32 0, i32 10
  %123 = getelementptr inbounds %struct.b2WeldJoint, ptr %122, i32 0, i32 8
  store float 0.000000e+00, ptr %123, align 4, !tbaa !46
  %124 = load ptr, ptr %5, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.b2WeldJointDef, ptr %124, i32 0, i32 9
  %126 = load i8, ptr %125, align 4, !tbaa !36, !range !29, !noundef !30
  %127 = trunc i8 %126 to i1
  %128 = zext i1 %127 to i32
  %129 = icmp eq i32 %128, 0
  br i1 %129, label %130, label %134

130:                                              ; preds = %48
  %131 = load ptr, ptr %6, align 8, !tbaa !5
  %132 = load ptr, ptr %8, align 8, !tbaa !5
  %133 = load ptr, ptr %9, align 8, !tbaa !5
  call void @b2DestroyContactsBetweenBodies(ptr noundef %131, ptr noundef %132, ptr noundef %133)
  br label %134

134:                                              ; preds = %130, %48
  %135 = getelementptr inbounds %struct.b2JointId, ptr %3, i32 0, i32 0
  %136 = load ptr, ptr %11, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.b2JointSim, ptr %136, i32 0, i32 0
  %138 = load i32, ptr %137, align 4, !tbaa !51
  %139 = add nsw i32 %138, 1
  store i32 %139, ptr %135, align 4, !tbaa !31
  %140 = getelementptr inbounds %struct.b2JointId, ptr %3, i32 0, i32 1
  %141 = load ptr, ptr %6, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.b2World, ptr %141, i32 0, i32 59
  %143 = load i16, ptr %142, align 4, !tbaa !52
  store i16 %143, ptr %140, align 4, !tbaa !33
  %144 = getelementptr inbounds %struct.b2JointId, ptr %3, i32 0, i32 2
  %145 = getelementptr inbounds %struct.b2JointPair, ptr %10, i32 0, i32 0
  %146 = load ptr, ptr %145, align 8, !tbaa !53
  %147 = getelementptr inbounds %struct.b2Joint, ptr %146, i32 0, i32 11
  %148 = load i16, ptr %147, align 4, !tbaa !54
  store i16 %148, ptr %144, align 2, !tbaa !34
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 96, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %149

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

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { cold noreturn nounwind memory(inaccessiblemem: write) }
attributes #5 = { 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 #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !12, i64 64}
!10 = !{!"b2WeldJointDef", !11, i64 0, !11, i64 8, !14, i64 16, !14, i64 24, !15, i64 32, !15, i64 36, !15, i64 40, !15, i64 44, !15, i64 48, !16, i64 52, !6, i64 56, !12, i64 64}
!11 = !{!"b2BodyId", !12, i64 0, !13, i64 4, !13, i64 6}
!12 = !{!"int", !7, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = !{!"b2Vec2", !15, i64 0, !15, i64 4}
!15 = !{!"float", !7, i64 0}
!16 = !{!"_Bool", !7, i64 0}
!17 = !{!18, !16, i64 1799}
!18 = !{!"b2World", !19, i64 0, !21, i64 40, !24, i64 336, !25, i64 1008, !20, i64 1032, !25, i64 1048, !20, i64 1072, !25, i64 1088, !20, i64 1112, !25, i64 1128, !20, i64 1152, !25, i64 1168, !20, i64 1192, !25, i64 1208, !25, i64 1232, !20, i64 1256, !20, i64 1272, !20, i64 1288, !20, i64 1304, !20, i64 1320, !20, i64 1336, !20, i64 1352, !20, i64 1368, !7, i64 1384, !7, i64 1416, !12, i64 1448, !20, i64 1456, !26, i64 1472, !26, i64 1488, !26, i64 1504, !26, i64 1520, !27, i64 1536, !12, i64 1544, !14, i64 1548, !15, i64 1556, !15, i64 1560, !15, i64 1564, !15, i64 1568, !15, i64 1572, !15, i64 1576, !15, i64 1580, !15, i64 1584, !6, i64 1592, !6, i64 1600, !13, i64 1608, !28, 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, !15, i64 1784, !12, i64 1788, !12, i64 1792, !13, i64 1796, !16, i64 1798, !16, i64 1799, !16, i64 1800, !16, i64 1801, !16, i64 1802, !16, i64 1803}
!19 = !{!"b2ArenaAllocator", !6, i64 0, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !20, i64 24}
!20 = !{!"", !6, i64 0, !12, i64 8, !12, i64 12}
!21 = !{!"b2BroadPhase", !7, i64 0, !12, i64 216, !22, i64 224, !20, i64 240, !6, i64 256, !6, i64 264, !12, i64 272, !23, i64 276, !22, i64 280}
!22 = !{!"b2HashSet", !6, i64 0, !12, i64 8, !12, i64 12}
!23 = !{!"b2AtomicInt", !12, i64 0}
!24 = !{!"b2ConstraintGraph", !7, i64 0}
!25 = !{!"b2IdPool", !20, i64 0, !12, i64 16}
!26 = !{!"b2BitSet", !6, i64 0, !12, i64 8, !12, i64 12}
!27 = !{!"long", !7, i64 0}
!28 = !{!"b2Profile", !15, i64 0, !15, i64 4, !15, i64 8, !15, i64 12, !15, i64 16, !15, i64 20, !15, i64 24, !15, i64 28, !15, i64 32, !15, i64 36, !15, i64 40, !15, i64 44, !15, i64 48, !15, i64 52, !15, i64 56, !15, i64 60, !15, i64 64, !15, i64 68, !15, i64 72, !15, i64 76, !15, i64 80, !15, i64 84}
!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 = !{!10, !6, i64 56}
!36 = !{!10, !16, i64 52}
!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, !14, i64 16, !14, i64 24, !15, i64 32, !15, i64 36, !15, i64 40, !15, i64 44, !7, i64 48}
!41 = !{i64 0, i64 4, !42, i64 4, i64 4, !42}
!42 = !{!15, !15, i64 0}
!43 = !{i64 0, i64 4, !42, i64 4, i64 4, !42, i64 8, i64 4, !42, i64 12, i64 4, !42, i64 16, i64 4, !42, i64 20, i64 4, !42, i64 24, i64 4, !42, i64 28, i64 4, !42, i64 32, i64 4, !42, i64 36, i64 4, !42, i64 40, i64 4, !42, i64 44, i64 4, !42, i64 48, i64 4, !42, i64 52, i64 4, !42, i64 56, i64 4, !44, i64 60, i64 4, !44, i64 64, i64 4, !42, i64 68, i64 4, !42, i64 72, i64 4, !42, i64 76, i64 4, !42, i64 80, i64 4, !42, i64 84, i64 4, !42, i64 88, i64 4, !42, i64 92, i64 4, !42}
!44 = !{!12, !12, i64 0}
!45 = !{!10, !15, i64 32}
!46 = !{!7, !7, i64 0}
!47 = !{!10, !15, i64 36}
!48 = !{!10, !15, i64 44}
!49 = !{!10, !15, i64 40}
!50 = !{!10, !15, i64 48}
!51 = !{!40, !12, i64 0}
!52 = !{!18, !13, i64 1796}
!53 = !{!38, !6, i64 0}
!54 = !{!55, !13, i64 68}
!55 = !{!"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, !15, i64 60, !12, i64 64, !13, i64 68, !16, i64 70, !16, 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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

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

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

declare ptr @b2GetWorldFromId(i32) local_unnamed_addr #1

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

; 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 #3

; Function Attrs: nounwind uwtable
declare hidden void @b2DestroyContactsBetweenBodies(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local i64 @b2CreateWeldJoint(i32 %0, ptr nocapture noundef readonly %1) local_unnamed_addr #3 {
  %3 = getelementptr inbounds i8, ptr %1, i64 64
  %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 613) #4
  %.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) #4
  %11 = getelementptr inbounds i8, ptr %10, i64 1799
  %12 = load i8, ptr %11, align 1, !tbaa !16, !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 616) #4
  %.not38 = icmp eq i32 %15, 0
  br i1 %.not38, label %17, label %16

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

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

.thread:                                          ; preds = %9, %17
  %19 = load i64, ptr %1, align 8
  %20 = tail call ptr @b2GetBodyFullId(ptr noundef nonnull %10, i64 %19) #4
  %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) #4
  %24 = getelementptr inbounds i8, ptr %1, i64 56
  %25 = load ptr, ptr %24, align 8, !tbaa !30
  %26 = getelementptr inbounds i8, ptr %1, i64 52
  %27 = load i8, ptr %26, align 4, !tbaa !31, !range !28, !noundef !29
  %28 = trunc nuw i8 %27 to i1
  %29 = 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 6, i1 noundef zeroext %28)
  %30 = extractvalue { ptr, ptr } %29, 0
  %31 = extractvalue { ptr, ptr } %29, 1
  %32 = getelementptr inbounds i8, ptr %31, i64 12
  store i32 6, ptr %32, align 4, !tbaa !32
  %33 = getelementptr inbounds i8, ptr %31, i64 16
  %34 = getelementptr inbounds i8, ptr %1, i64 16
  %35 = load i64, ptr %34, align 8
  store i64 %35, ptr %33, align 4
  %36 = getelementptr inbounds i8, ptr %31, i64 24
  %37 = getelementptr inbounds i8, ptr %1, i64 24
  %38 = load i64, ptr %37, align 8
  store i64 %38, ptr %36, align 4
  %39 = getelementptr inbounds i8, ptr %31, i64 48
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(96) %39, i8 0, i64 96, i1 false)
  %40 = getelementptr inbounds i8, ptr %1, i64 32
  %41 = load float, ptr %40, align 8, !tbaa !34
  store float %41, ptr %39, align 4, !tbaa !35
  %42 = getelementptr inbounds i8, ptr %1, i64 36
  %43 = load float, ptr %42, align 4, !tbaa !36
  %44 = getelementptr inbounds i8, ptr %31, i64 52
  store float %43, ptr %44, align 4, !tbaa !35
  %45 = getelementptr inbounds i8, ptr %1, i64 44
  %46 = load float, ptr %45, align 4, !tbaa !37
  %47 = getelementptr inbounds i8, ptr %31, i64 56
  store float %46, ptr %47, align 4, !tbaa !35
  %48 = getelementptr inbounds i8, ptr %1, i64 40
  %49 = load float, ptr %48, align 8, !tbaa !38
  %50 = getelementptr inbounds i8, ptr %31, i64 60
  store float %49, ptr %50, align 4, !tbaa !35
  %51 = getelementptr inbounds i8, ptr %1, i64 48
  %52 = load float, ptr %51, align 8, !tbaa !39
  %53 = getelementptr inbounds i8, ptr %31, i64 64
  store float %52, ptr %53, align 4, !tbaa !35
  %54 = getelementptr inbounds i8, ptr %31, i64 92
  %55 = load i64, ptr @b2Vec2_zero, align 4
  store i64 %55, ptr %54, align 4
  %56 = getelementptr inbounds i8, ptr %31, i64 100
  store float 0.000000e+00, ptr %56, align 4, !tbaa !35
  %57 = load i8, ptr %26, align 4, !tbaa !31, !range !28, !noundef !29
  %58 = icmp eq i8 %57, 0
  br i1 %58, label %59, label %60

59:                                               ; preds = %.thread
  tail call void @b2DestroyContactsBetweenBodies(ptr noundef nonnull %10, ptr noundef %20, ptr noundef %23)
  br label %60

60:                                               ; preds = %59, %.thread
  %61 = load i32, ptr %31, align 4, !tbaa !40
  %62 = add nsw i32 %61, 1
  %63 = getelementptr inbounds i8, ptr %10, i64 1796
  %64 = load i16, ptr %63, align 4, !tbaa !41
  %65 = getelementptr inbounds i8, ptr %30, i64 68
  %66 = load i16, ptr %65, align 4, !tbaa !42
  %67 = zext i16 %66 to i64
  %68 = shl nuw i64 %67, 48
  %69 = zext i16 %64 to i64
  %70 = shl nuw nsw i64 %69, 32
  %71 = zext i32 %62 to i64
  %72 = or disjoint i64 %70, %71
  %73 = or disjoint i64 %72, %68
  br label %74

74:                                               ; preds = %17, %60
  %.sroa.037.0.insert.insert = phi i64 [ %73, %60 ], [ 0, %17 ]
  ret i64 %.sroa.037.0.insert.insert
}

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { cold noreturn nounwind memory(inaccessiblemem: write) }
attributes #3 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 64}
!6 = !{!"b2WeldJointDef", !7, i64 0, !7, i64 8, !12, i64 16, !12, i64 24, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !13, i64 48, !14, i64 52, !15, i64 56, !8, i64 64}
!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 = !{!"b2Vec2", !13, i64 0, !13, i64 4}
!13 = !{!"float", !9, i64 0}
!14 = !{!"_Bool", !9, i64 0}
!15 = !{!"any pointer", !9, i64 0}
!16 = !{!17, !14, i64 1799}
!17 = !{!"b2World", !18, i64 0, !20, i64 40, !23, i64 336, !24, i64 1008, !19, i64 1032, !24, i64 1048, !19, i64 1072, !24, i64 1088, !19, i64 1112, !24, i64 1128, !19, i64 1152, !24, i64 1168, !19, i64 1192, !24, i64 1208, !24, i64 1232, !19, i64 1256, !19, i64 1272, !19, i64 1288, !19, i64 1304, !19, i64 1320, !19, i64 1336, !19, i64 1352, !19, i64 1368, !9, i64 1384, !9, i64 1416, !8, i64 1448, !19, i64 1456, !25, i64 1472, !25, i64 1488, !25, i64 1504, !25, i64 1520, !26, i64 1536, !8, i64 1544, !12, i64 1548, !13, i64 1556, !13, i64 1560, !13, i64 1564, !13, i64 1568, !13, i64 1572, !13, i64 1576, !13, i64 1580, !13, i64 1584, !15, i64 1592, !15, i64 1600, !11, i64 1608, !27, i64 1612, !15, i64 1704, !15, i64 1712, !15, i64 1720, !15, i64 1728, !8, i64 1736, !15, i64 1744, !15, i64 1752, !15, i64 1760, !15, i64 1768, !15, i64 1776, !13, i64 1784, !8, i64 1788, !8, i64 1792, !11, i64 1796, !14, i64 1798, !14, i64 1799, !14, i64 1800, !14, i64 1801, !14, i64 1802, !14, i64 1803}
!18 = !{!"b2ArenaAllocator", !15, i64 0, !8, i64 8, !8, i64 12, !8, i64 16, !8, i64 20, !19, i64 24}
!19 = !{!"", !15, i64 0, !8, i64 8, !8, i64 12}
!20 = !{!"b2BroadPhase", !9, i64 0, !8, i64 216, !21, i64 224, !19, i64 240, !15, i64 256, !15, i64 264, !8, i64 272, !22, i64 276, !21, i64 280}
!21 = !{!"b2HashSet", !15, i64 0, !8, i64 8, !8, i64 12}
!22 = !{!"b2AtomicInt", !8, i64 0}
!23 = !{!"b2ConstraintGraph", !9, i64 0}
!24 = !{!"b2IdPool", !19, i64 0, !8, i64 16}
!25 = !{!"b2BitSet", !15, i64 0, !8, i64 8, !8, i64 12}
!26 = !{!"long", !9, i64 0}
!27 = !{!"b2Profile", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !13, i64 48, !13, i64 52, !13, i64 56, !13, i64 60, !13, i64 64, !13, i64 68, !13, i64 72, !13, i64 76, !13, i64 80, !13, i64 84}
!28 = !{i8 0, i8 2}
!29 = !{}
!30 = !{!6, !15, i64 56}
!31 = !{!6, !14, i64 52}
!32 = !{!33, !8, i64 12}
!33 = !{!"b2JointSim", !8, i64 0, !8, i64 4, !8, i64 8, !8, i64 12, !12, i64 16, !12, i64 24, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !9, i64 48}
!34 = !{!6, !13, i64 32}
!35 = !{!9, !9, i64 0}
!36 = !{!6, !13, i64 36}
!37 = !{!6, !13, i64 44}
!38 = !{!6, !13, i64 40}
!39 = !{!6, !13, i64 48}
!40 = !{!33, !8, i64 0}
!41 = !{!17, !11, i64 1796}
!42 = !{!43, !11, i64 68}
!43 = !{!"b2Joint", !15, 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, !13, i64 60, !8, i64 64, !11, i64 68, !14, i64 70, !14, i64 71}


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