; 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.b2JointId = type { i32, i16, i16 }
%struct.b2WorldId = type { i16, i16 }
%struct.b2Transform = type { %struct.b2Vec2, %struct.b2Rot }
%struct.b2Vec2 = type { float, float }
%struct.b2Rot = type { float, float }
%struct.b2JointPair = type { ptr, ptr }
%struct.b2MouseJoint = type { %struct.b2Vec2, float, float, float, %struct.b2Vec2, float, %struct.b2Softness, %struct.b2Softness, i32, %struct.b2Vec2, %struct.b2Vec2, %struct.b2Mat22 }
%struct.b2Softness = type { float, float, float }
%struct.b2Mat22 = type { %struct.b2Vec2, %struct.b2Vec2 }
%struct.b2MouseJointDef = type { %struct.b2BodyId, %struct.b2BodyId, %struct.b2Vec2, 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

; 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
define dso_local i64 @b2CreateMouseJoint(i32 %0, ptr noundef %1) #6 {
  %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.b2Transform, align 4
  %11 = alloca %struct.b2Transform, align 4
  %12 = alloca %struct.b2JointPair, align 8
  %13 = alloca ptr, align 8
  %14 = alloca %struct.b2Vec2, align 4
  %15 = alloca %struct.b2Vec2, align 4
  %16 = alloca %struct.b2MouseJoint, align 4
  store i32 %0, ptr %4, align 2
  store ptr %1, ptr %5, align 8, !tbaa !5
  br label %17

17:                                               ; preds = %2
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.b2MouseJointDef, ptr %18, i32 0, i32 8
  %20 = load i32, ptr %19, align 8, !tbaa !9
  %21 = icmp eq i32 %20, 1152023
  br i1 %21, label %26, label %22

22:                                               ; preds = %17
  %23 = call i32 @b2InternalAssertFcn(ptr noundef @.str.6, ptr noundef @.str.1, i32 noundef 438)
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %25, label %26

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

26:                                               ; preds = %25, %22, %17
  br label %27

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

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

37:                                               ; preds = %30
  %38 = call i32 @b2InternalAssertFcn(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 441)
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %40, label %41

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

41:                                               ; preds = %40, %37, %30
  br label %42

42:                                               ; preds = %41
  br label %43

43:                                               ; preds = %42
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.b2World, ptr %44, i32 0, i32 61
  %46 = load i8, ptr %45, align 1, !tbaa !17, !range !29, !noundef !30
  %47 = trunc i8 %46 to i1
  br i1 %47, label %48, label %52

48:                                               ; preds = %43
  %49 = getelementptr inbounds %struct.b2JointId, ptr %3, i32 0, i32 0
  store i32 0, ptr %49, align 4, !tbaa !31
  %50 = getelementptr inbounds %struct.b2JointId, ptr %3, i32 0, i32 1
  store i16 0, ptr %50, align 4, !tbaa !33
  %51 = getelementptr inbounds %struct.b2JointId, ptr %3, i32 0, i32 2
  store i16 0, ptr %51, align 2, !tbaa !34
  store i32 1, ptr %7, align 4
  br label %155

52:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  %53 = load ptr, ptr %6, align 8, !tbaa !5
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.b2MouseJointDef, ptr %54, i32 0, i32 0
  %56 = load i64, ptr %55, align 8
  %57 = call ptr @b2GetBodyFullId(ptr noundef %53, i64 %56)
  store ptr %57, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.b2MouseJointDef, ptr %59, i32 0, i32 1
  %61 = load i64, ptr %60, align 8
  %62 = call ptr @b2GetBodyFullId(ptr noundef %58, i64 %61)
  store ptr %62, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #8
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  %65 = call { <2 x float>, <2 x float> } @b2GetBodyTransformQuick(ptr noundef %63, ptr noundef %64)
  %66 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %10, i32 0, i32 0
  %67 = extractvalue { <2 x float>, <2 x float> } %65, 0
  store <2 x float> %67, ptr %66, align 4
  %68 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %10, i32 0, i32 1
  %69 = extractvalue { <2 x float>, <2 x float> } %65, 1
  store <2 x float> %69, ptr %68, align 4
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #8
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = load ptr, ptr %9, align 8, !tbaa !5
  %72 = call { <2 x float>, <2 x float> } @b2GetBodyTransformQuick(ptr noundef %70, ptr noundef %71)
  %73 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %11, i32 0, i32 0
  %74 = extractvalue { <2 x float>, <2 x float> } %72, 0
  store <2 x float> %74, ptr %73, align 4
  %75 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %11, i32 0, i32 1
  %76 = extractvalue { <2 x float>, <2 x float> } %72, 1
  store <2 x float> %76, ptr %75, align 4
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #8
  %77 = load ptr, ptr %6, align 8, !tbaa !5
  %78 = load ptr, ptr %8, align 8, !tbaa !5
  %79 = load ptr, ptr %9, align 8, !tbaa !5
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.b2MouseJointDef, ptr %80, i32 0, i32 7
  %82 = load ptr, ptr %81, align 8, !tbaa !35
  %83 = load ptr, ptr %5, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.b2MouseJointDef, ptr %83, i32 0, i32 6
  %85 = load i8, ptr %84, align 4, !tbaa !36, !range !29, !noundef !30
  %86 = trunc i8 %85 to i1
  %87 = call { ptr, ptr } @b2CreateJoint(ptr noundef %77, ptr noundef %78, ptr noundef %79, ptr noundef %82, float noundef 1.000000e+00, i32 noundef 3, i1 noundef zeroext %86)
  %88 = getelementptr inbounds { ptr, ptr }, ptr %12, i32 0, i32 0
  %89 = extractvalue { ptr, ptr } %87, 0
  store ptr %89, ptr %88, align 8
  %90 = getelementptr inbounds { ptr, ptr }, ptr %12, i32 0, i32 1
  %91 = extractvalue { ptr, ptr } %87, 1
  store ptr %91, ptr %90, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  %92 = getelementptr inbounds %struct.b2JointPair, ptr %12, i32 0, i32 1
  %93 = load ptr, ptr %92, align 8, !tbaa !37
  store ptr %93, ptr %13, align 8, !tbaa !5
  %94 = load ptr, ptr %13, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.b2JointSim, ptr %94, i32 0, i32 3
  store i32 3, ptr %95, align 4, !tbaa !39
  %96 = load ptr, ptr %13, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.b2JointSim, ptr %96, i32 0, i32 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  %98 = load ptr, ptr %5, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.b2MouseJointDef, ptr %98, i32 0, i32 2
  %100 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %10, i32 0, i32 0
  %101 = load <2 x float>, ptr %100, align 4
  %102 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %10, i32 0, i32 1
  %103 = load <2 x float>, ptr %102, align 4
  %104 = load <2 x float>, ptr %99, align 8
  %105 = call <2 x float> @b2InvTransformPoint(<2 x float> %101, <2 x float> %103, <2 x float> %104)
  store <2 x float> %105, ptr %14, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %97, ptr align 4 %14, i64 8, i1 false), !tbaa.struct !41
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  %106 = load ptr, ptr %13, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.b2JointSim, ptr %106, i32 0, i32 5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  %108 = load ptr, ptr %5, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.b2MouseJointDef, ptr %108, i32 0, i32 2
  %110 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %11, i32 0, i32 0
  %111 = load <2 x float>, ptr %110, align 4
  %112 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %11, i32 0, i32 1
  %113 = load <2 x float>, ptr %112, align 4
  %114 = load <2 x float>, ptr %109, align 8
  %115 = call <2 x float> @b2InvTransformPoint(<2 x float> %111, <2 x float> %113, <2 x float> %114)
  store <2 x float> %115, ptr %15, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %107, ptr align 4 %15, i64 8, i1 false), !tbaa.struct !41
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  call void @llvm.lifetime.start.p0(i64 92, ptr %16) #8
  call void @llvm.memset.p0.i64(ptr align 4 %16, i8 0, i64 92, i1 false)
  %116 = load ptr, ptr %13, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.b2JointSim, ptr %116, i32 0, i32 10
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %117, ptr align 4 %16, i64 92, i1 false), !tbaa.struct !43
  %118 = load ptr, ptr %13, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.b2JointSim, ptr %118, i32 0, i32 10
  %120 = getelementptr inbounds %struct.b2MouseJoint, ptr %119, i32 0, i32 0
  %121 = load ptr, ptr %5, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.b2MouseJointDef, ptr %121, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %120, ptr align 8 %122, i64 8, i1 false), !tbaa.struct !41
  %123 = load ptr, ptr %5, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.b2MouseJointDef, ptr %123, i32 0, i32 3
  %125 = load float, ptr %124, align 8, !tbaa !45
  %126 = load ptr, ptr %13, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.b2JointSim, ptr %126, i32 0, i32 10
  %128 = getelementptr inbounds %struct.b2MouseJoint, ptr %127, i32 0, i32 1
  store float %125, ptr %128, align 4, !tbaa !46
  %129 = load ptr, ptr %5, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.b2MouseJointDef, ptr %129, i32 0, i32 4
  %131 = load float, ptr %130, align 4, !tbaa !47
  %132 = load ptr, ptr %13, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.b2JointSim, ptr %132, i32 0, i32 10
  %134 = getelementptr inbounds %struct.b2MouseJoint, ptr %133, i32 0, i32 2
  store float %131, ptr %134, align 4, !tbaa !46
  %135 = load ptr, ptr %5, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.b2MouseJointDef, ptr %135, i32 0, i32 5
  %137 = load float, ptr %136, align 8, !tbaa !48
  %138 = load ptr, ptr %13, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.b2JointSim, ptr %138, i32 0, i32 10
  %140 = getelementptr inbounds %struct.b2MouseJoint, ptr %139, i32 0, i32 3
  store float %137, ptr %140, align 4, !tbaa !46
  %141 = getelementptr inbounds %struct.b2JointId, ptr %3, i32 0, i32 0
  %142 = load ptr, ptr %13, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.b2JointSim, ptr %142, i32 0, i32 0
  %144 = load i32, ptr %143, align 4, !tbaa !49
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %141, align 4, !tbaa !31
  %146 = getelementptr inbounds %struct.b2JointId, ptr %3, i32 0, i32 1
  %147 = load ptr, ptr %6, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.b2World, ptr %147, i32 0, i32 59
  %149 = load i16, ptr %148, align 4, !tbaa !50
  store i16 %149, ptr %146, align 4, !tbaa !33
  %150 = getelementptr inbounds %struct.b2JointId, ptr %3, i32 0, i32 2
  %151 = getelementptr inbounds %struct.b2JointPair, ptr %12, i32 0, i32 0
  %152 = load ptr, ptr %151, align 8, !tbaa !51
  %153 = getelementptr inbounds %struct.b2Joint, ptr %152, i32 0, i32 11
  %154 = load i16, ptr %153, align 4, !tbaa !52
  store i16 %154, ptr %150, align 2, !tbaa !34
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 92, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  br label %155

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

declare { <2 x float>, <2 x float> } @b2GetBodyTransformQuick(ptr noundef, ptr noundef) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden <2 x float> @b2InvTransformPoint(<2 x float>, <2 x float>, <2 x float>) #7

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 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 #7 = { inlinehint nounwind 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 #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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !12, i64 48}
!10 = !{!"b2MouseJointDef", !11, i64 0, !11, i64 8, !14, i64 16, !15, i64 24, !15, i64 28, !15, i64 32, !16, i64 36, !6, i64 40, !12, i64 48}
!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 40}
!36 = !{!10, !16, i64 36}
!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, !42, 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}
!44 = !{!12, !12, i64 0}
!45 = !{!10, !15, i64 24}
!46 = !{!7, !7, i64 0}
!47 = !{!10, !15, i64 28}
!48 = !{!10, !15, i64 32}
!49 = !{!40, !12, i64 0}
!50 = !{!18, !13, i64 1796}
!51 = !{!38, !6, i64 0}
!52 = !{!53, !13, i64 68}
!53 = !{!"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"

@.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

; 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
define dso_local i64 @b2CreateMouseJoint(i32 %0, ptr nocapture noundef readonly %1) local_unnamed_addr #4 {
  %3 = getelementptr inbounds i8, ptr %1, i64 48
  %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 438) #6
  %.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) #6
  %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 441) #6
  %.not40 = icmp eq i32 %15, 0
  br i1 %.not40, 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 %70, label %.thread

.thread:                                          ; preds = %9, %17
  %19 = load i64, ptr %1, align 8
  %20 = tail call ptr @b2GetBodyFullId(ptr noundef nonnull %10, i64 %19) #6
  %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) #6
  %24 = tail call { <2 x float>, <2 x float> } @b2GetBodyTransformQuick(ptr noundef nonnull %10, ptr noundef %20) #6
  %25 = extractvalue { <2 x float>, <2 x float> } %24, 0
  %26 = extractvalue { <2 x float>, <2 x float> } %24, 1
  %27 = tail call { <2 x float>, <2 x float> } @b2GetBodyTransformQuick(ptr noundef nonnull %10, ptr noundef %23) #6
  %28 = extractvalue { <2 x float>, <2 x float> } %27, 0
  %29 = extractvalue { <2 x float>, <2 x float> } %27, 1
  %30 = getelementptr inbounds i8, ptr %1, i64 40
  %31 = load ptr, ptr %30, align 8, !tbaa !30
  %32 = getelementptr inbounds i8, ptr %1, i64 36
  %33 = load i8, ptr %32, align 4, !tbaa !31, !range !28, !noundef !29
  %34 = trunc nuw i8 %33 to i1
  %35 = tail call { ptr, ptr } @b2CreateJoint(ptr noundef nonnull %10, ptr noundef %20, ptr noundef %23, ptr noundef %31, float noundef 1.000000e+00, i32 noundef 3, i1 noundef zeroext %34)
  %36 = extractvalue { ptr, ptr } %35, 0
  %37 = extractvalue { ptr, ptr } %35, 1
  %38 = getelementptr inbounds i8, ptr %37, i64 12
  store i32 3, ptr %38, align 4, !tbaa !32
  %39 = getelementptr inbounds i8, ptr %37, i64 16
  %40 = getelementptr inbounds i8, ptr %1, i64 16
  %41 = load <2 x float>, ptr %40, align 8
  %42 = tail call <2 x float> @b2InvTransformPoint(<2 x float> %25, <2 x float> %26, <2 x float> %41)
  store <2 x float> %42, ptr %39, align 4
  %43 = getelementptr inbounds i8, ptr %37, i64 24
  %44 = load <2 x float>, ptr %40, align 8
  %45 = tail call <2 x float> @b2InvTransformPoint(<2 x float> %28, <2 x float> %29, <2 x float> %44)
  store <2 x float> %45, ptr %43, align 4
  %46 = getelementptr inbounds i8, ptr %37, i64 48
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(92) %46, i8 0, i64 92, i1 false)
  %47 = load i64, ptr %40, align 8
  store i64 %47, ptr %46, align 4
  %48 = getelementptr inbounds i8, ptr %1, i64 24
  %49 = load float, ptr %48, align 8, !tbaa !34
  %50 = getelementptr inbounds i8, ptr %37, i64 56
  store float %49, ptr %50, align 4, !tbaa !35
  %51 = getelementptr inbounds i8, ptr %1, i64 28
  %52 = load float, ptr %51, align 4, !tbaa !36
  %53 = getelementptr inbounds i8, ptr %37, i64 60
  store float %52, ptr %53, align 4, !tbaa !35
  %54 = getelementptr inbounds i8, ptr %1, i64 32
  %55 = load float, ptr %54, align 8, !tbaa !37
  %56 = getelementptr inbounds i8, ptr %37, i64 64
  store float %55, ptr %56, align 4, !tbaa !35
  %57 = load i32, ptr %37, align 4, !tbaa !38
  %58 = add nsw i32 %57, 1
  %59 = getelementptr inbounds i8, ptr %10, i64 1796
  %60 = load i16, ptr %59, align 4, !tbaa !39
  %61 = getelementptr inbounds i8, ptr %36, i64 68
  %62 = load i16, ptr %61, align 4, !tbaa !40
  %63 = zext i16 %62 to i64
  %64 = shl nuw i64 %63, 48
  %65 = zext i16 %60 to i64
  %66 = shl nuw nsw i64 %65, 32
  %67 = zext i32 %58 to i64
  %68 = or disjoint i64 %66, %67
  %69 = or disjoint i64 %68, %64
  br label %70

70:                                               ; preds = %17, %.thread
  %.sroa.039.0.insert.insert = phi i64 [ %69, %.thread ], [ 0, %17 ]
  ret i64 %.sroa.039.0.insert.insert
}

declare { <2 x float>, <2 x float> } @b2GetBodyTransformQuick(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden <2 x float> @b2InvTransformPoint(<2 x float>, <2 x float>, <2 x float>) local_unnamed_addr #5

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 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 #5 = { inlinehint nounwind 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 #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, !8, i64 48}
!6 = !{!"b2MouseJointDef", !7, i64 0, !7, i64 8, !12, i64 16, !13, i64 24, !13, i64 28, !13, i64 32, !14, i64 36, !15, i64 40, !8, i64 48}
!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 40}
!31 = !{!6, !14, i64 36}
!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 24}
!35 = !{!9, !9, i64 0}
!36 = !{!6, !13, i64 28}
!37 = !{!6, !13, i64 32}
!38 = !{!33, !8, i64 0}
!39 = !{!17, !11, i64 1796}
!40 = !{!41, !11, i64 68}
!41 = !{!"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