; 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.b2JointPair = type { ptr, ptr }
%struct.b2Vec2 = type { float, float }
%struct.b2MotorJoint = type { %struct.b2Vec2, float, %struct.b2Vec2, float, float, float, float, i32, i32, %struct.b2Vec2, %struct.b2Vec2, %struct.b2Vec2, float, %struct.b2Mat22, float }
%struct.b2Mat22 = type { %struct.b2Vec2, %struct.b2Vec2 }
%struct.b2MotorJointDef = type { %struct.b2BodyId, %struct.b2BodyId, %struct.b2Vec2, 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.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

; 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 @b2CreateMotorJoint(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.b2Vec2, align 4
  %13 = alloca %struct.b2Vec2, align 4
  %14 = alloca %struct.b2MotorJoint, align 4
  store i32 %0, ptr %4, align 2
  store ptr %1, ptr %5, align 8, !tbaa !5
  br label %15

15:                                               ; preds = %2
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.b2MotorJointDef, ptr %16, i32 0, i32 9
  %18 = load i32, ptr %17, align 8, !tbaa !9
  %19 = icmp eq i32 %18, 1152023
  br i1 %19, label %24, label %20

20:                                               ; preds = %15
  %21 = call i32 @b2InternalAssertFcn(ptr noundef @.str.6, ptr noundef @.str.1, i32 noundef 400)
  %22 = icmp ne i32 %21, 0
  br i1 %22, label %23, label %24

23:                                               ; preds = %20
  call void @llvm.trap()
  br label %24

24:                                               ; preds = %23, %20, %15
  br label %25

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

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

35:                                               ; preds = %28
  %36 = call i32 @b2InternalAssertFcn(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 403)
  %37 = icmp ne i32 %36, 0
  br i1 %37, label %38, label %39

38:                                               ; preds = %35
  call void @llvm.trap()
  br label %39

39:                                               ; preds = %38, %35, %28
  br label %40

40:                                               ; preds = %39
  br label %41

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

46:                                               ; preds = %41
  %47 = getelementptr inbounds %struct.b2JointId, ptr %3, i32 0, i32 0
  store i32 0, ptr %47, align 4, !tbaa !31
  %48 = getelementptr inbounds %struct.b2JointId, ptr %3, i32 0, i32 1
  store i16 0, ptr %48, align 4, !tbaa !33
  %49 = getelementptr inbounds %struct.b2JointId, ptr %3, i32 0, i32 2
  store i16 0, ptr %49, align 2, !tbaa !34
  store i32 1, ptr %7, align 4
  br label %162

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

143:                                              ; preds = %50
  %144 = load ptr, ptr %6, align 8, !tbaa !5
  %145 = load ptr, ptr %8, align 8, !tbaa !5
  %146 = load ptr, ptr %9, align 8, !tbaa !5
  call void @b2DestroyContactsBetweenBodies(ptr noundef %144, ptr noundef %145, ptr noundef %146)
  br label %147

147:                                              ; preds = %143, %50
  %148 = getelementptr inbounds %struct.b2JointId, ptr %3, i32 0, i32 0
  %149 = load ptr, ptr %11, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.b2JointSim, ptr %149, i32 0, i32 0
  %151 = load i32, ptr %150, align 4, !tbaa !52
  %152 = add nsw i32 %151, 1
  store i32 %152, ptr %148, align 4, !tbaa !31
  %153 = getelementptr inbounds %struct.b2JointId, ptr %3, i32 0, i32 1
  %154 = load ptr, ptr %6, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.b2World, ptr %154, i32 0, i32 59
  %156 = load i16, ptr %155, align 4, !tbaa !53
  store i16 %156, ptr %153, align 4, !tbaa !33
  %157 = getelementptr inbounds %struct.b2JointId, ptr %3, i32 0, i32 2
  %158 = getelementptr inbounds %struct.b2JointPair, ptr %10, i32 0, i32 0
  %159 = load ptr, ptr %158, align 8, !tbaa !54
  %160 = getelementptr inbounds %struct.b2Joint, ptr %159, i32 0, i32 11
  %161 = load i16, ptr %160, align 4, !tbaa !55
  store i16 %161, ptr %157, align 2, !tbaa !34
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %162

162:                                              ; preds = %147, %46
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  %163 = load i64, ptr %3, align 4
  ret i64 %163
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden float @b2ClampFloat(float noundef, float noundef, float noundef) #6

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 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 56}
!10 = !{!"b2MotorJointDef", !11, i64 0, !11, i64 8, !14, i64 16, !15, i64 24, !15, i64 28, !15, i64 32, !15, i64 36, !16, i64 40, !6, i64 48, !12, i64 56}
!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 48}
!36 = !{!10, !16, i64 40}
!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 = !{!14, !15, i64 0}
!42 = !{!14, !15, i64 4}
!43 = !{i64 0, i64 4, !44, i64 4, i64 4, !44}
!44 = !{!15, !15, i64 0}
!45 = !{i64 0, i64 4, !44, i64 4, i64 4, !44, i64 8, i64 4, !44, i64 12, i64 4, !44, i64 16, i64 4, !44, i64 20, i64 4, !44, i64 24, i64 4, !44, i64 28, i64 4, !44, i64 32, i64 4, !44, i64 36, i64 4, !46, i64 40, i64 4, !46, i64 44, i64 4, !44, i64 48, i64 4, !44, i64 52, i64 4, !44, i64 56, i64 4, !44, i64 60, i64 4, !44, i64 64, i64 4, !44, i64 68, i64 4, !44, i64 72, i64 4, !44, i64 76, i64 4, !44, i64 80, i64 4, !44, i64 84, i64 4, !44, i64 88, i64 4, !44}
!46 = !{!12, !12, i64 0}
!47 = !{!10, !15, i64 24}
!48 = !{!7, !7, i64 0}
!49 = !{!10, !15, i64 28}
!50 = !{!10, !15, i64 32}
!51 = !{!10, !15, i64 36}
!52 = !{!40, !12, i64 0}
!53 = !{!18, !13, i64 1796}
!54 = !{!38, !6, i64 0}
!55 = !{!56, !13, i64 68}
!56 = !{!"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
declare hidden void @b2DestroyContactsBetweenBodies(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local i64 @b2CreateMotorJoint(i32 %0, ptr nocapture noundef readonly %1) local_unnamed_addr #3 {
  %3 = getelementptr inbounds i8, ptr %1, i64 56
  %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 400) #5
  %.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) #5
  %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 403) #5
  %.not37 = icmp eq i32 %15, 0
  br i1 %.not37, 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 %67, label %.thread

.thread:                                          ; preds = %9, %17
  %19 = load i64, ptr %1, align 8
  %20 = tail call ptr @b2GetBodyFullId(ptr noundef nonnull %10, i64 %19) #5
  %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) #5
  %24 = getelementptr inbounds i8, ptr %1, i64 48
  %25 = load ptr, ptr %24, align 8, !tbaa !30
  %26 = getelementptr inbounds i8, ptr %1, i64 40
  %27 = load i8, ptr %26, align 8, !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 2, 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 2, ptr %32, align 4, !tbaa !32
  %33 = getelementptr inbounds i8, ptr %31, i64 16
  %34 = getelementptr inbounds i8, ptr %31, i64 48
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %33, i8 0, i64 16, i1 false)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(92) %34, i8 0, i64 92, i1 false)
  %35 = getelementptr inbounds i8, ptr %1, i64 16
  %36 = load i64, ptr %35, align 8
  store i64 %36, ptr %34, align 4
  %37 = getelementptr inbounds i8, ptr %1, i64 24
  %38 = load float, ptr %37, align 8, !tbaa !34
  %39 = getelementptr inbounds i8, ptr %31, i64 56
  store float %38, ptr %39, align 4, !tbaa !35
  %40 = getelementptr inbounds i8, ptr %1, i64 28
  %41 = load float, ptr %40, align 4, !tbaa !36
  %42 = getelementptr inbounds i8, ptr %31, i64 72
  store float %41, ptr %42, align 4, !tbaa !35
  %43 = getelementptr inbounds i8, ptr %1, i64 32
  %44 = load float, ptr %43, align 8, !tbaa !37
  %45 = getelementptr inbounds i8, ptr %31, i64 76
  store float %44, ptr %45, align 4, !tbaa !35
  %46 = getelementptr inbounds i8, ptr %1, i64 36
  %47 = load float, ptr %46, align 4, !tbaa !38
  %48 = tail call float @b2ClampFloat(float noundef %47, float noundef 0.000000e+00, float noundef 1.000000e+00)
  %49 = getelementptr inbounds i8, ptr %31, i64 80
  store float %48, ptr %49, align 4, !tbaa !35
  %50 = load i8, ptr %26, align 8, !tbaa !31, !range !28, !noundef !29
  %51 = icmp eq i8 %50, 0
  br i1 %51, label %52, label %53

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

53:                                               ; preds = %52, %.thread
  %54 = load i32, ptr %31, align 4, !tbaa !39
  %55 = add nsw i32 %54, 1
  %56 = getelementptr inbounds i8, ptr %10, i64 1796
  %57 = load i16, ptr %56, align 4, !tbaa !40
  %58 = getelementptr inbounds i8, ptr %30, i64 68
  %59 = load i16, ptr %58, align 4, !tbaa !41
  %60 = zext i16 %59 to i64
  %61 = shl nuw i64 %60, 48
  %62 = zext i16 %57 to i64
  %63 = shl nuw nsw i64 %62, 32
  %64 = zext i32 %55 to i64
  %65 = or disjoint i64 %63, %64
  %66 = or disjoint i64 %65, %61
  br label %67

67:                                               ; preds = %17, %53
  %.sroa.036.0.insert.insert = phi i64 [ %66, %53 ], [ 0, %17 ]
  ret i64 %.sroa.036.0.insert.insert
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden float @b2ClampFloat(float noundef, float noundef, float noundef) local_unnamed_addr #4

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 = { inlinehint 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, !8, i64 56}
!6 = !{!"b2MotorJointDef", !7, i64 0, !7, i64 8, !12, i64 16, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !14, i64 40, !15, i64 48, !8, i64 56}
!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 48}
!31 = !{!6, !14, i64 40}
!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 = !{!6, !13, i64 36}
!39 = !{!33, !8, i64 0}
!40 = !{!17, !11, i64 1796}
!41 = !{!42, !11, i64 68}
!42 = !{!"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