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

; 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.b2BodyId = type { i32, i16, i16 }
%struct.b2Transform = type { %struct.b2Vec2, %struct.b2Rot }
%struct.b2Vec2 = type { float, float }
%struct.b2Rot = type { float, float }
%struct.b2Body = type { [32 x i8], ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, float, float, float, float, i32, i32, i32, i16, i8, i8, i8, i8 }
%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.b2Shape = type { i32, i32, i32, i32, i32, i32, float, float, float, float, float, i32, %struct.b2AABB, %struct.b2AABB, %struct.b2Vec2, i32, %struct.b2Filter, ptr, i32, %union.anon.0, i16, i8, i8, i8, i8, i8 }
%struct.b2AABB = type { %struct.b2Vec2, %struct.b2Vec2 }
%struct.b2Filter = type { i64, i64, i32 }
%union.anon.0 = type { %struct.b2Polygon }
%struct.b2Polygon = type { [8 x %struct.b2Vec2], [8 x %struct.b2Vec2], %struct.b2Vec2, float, i32 }
%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 [60 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [33 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local ptr @b2GetBodyFullId(ptr noundef, i64) #0

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @b2BodyArray_Get(ptr noundef, i32 noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local { <2 x float>, <2 x float> } @b2GetBodyTransformQuick(ptr noundef, ptr noundef) #0

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @b2SolverSetArray_Get(ptr noundef, i32 noundef) #3

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

; Function Attrs: nounwind uwtable
declare hidden void @b2CreateIslandForBody(ptr noundef, i32 noundef, ptr noundef) #0

declare void @b2ValidateSolverSets(ptr noundef) #1

declare ptr @b2GetWorldLocked(i32 noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @b2JointArray_Get(ptr noundef, i32 noundef) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @b2ShapeArray_Get(ptr noundef, i32 noundef) #3

declare void @b2TransferBody(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

declare void @b2TransferJoint(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

declare void @b2CreateShapeProxy(ptr noundef, ptr noundef, i32 noundef, <2 x float>, <2 x float>, i1 noundef zeroext) #1

declare void @b2LinkJoint(ptr noundef, ptr noundef, i1 noundef zeroext) #1

declare void @b2MergeAwakeIslands(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @b2Body_Enable(i64 %0) #5 {
  %2 = alloca %struct.b2BodyId, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca %struct.b2Transform, align 4
  %10 = alloca i32, align 4
  %11 = alloca i8, align 1
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i8, align 1
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  %22 = alloca ptr, align 8
  store i64 %0, ptr %2, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  %23 = getelementptr inbounds %struct.b2BodyId, ptr %2, i32 0, i32 1
  %24 = load i16, ptr %23, align 4, !tbaa !5
  %25 = zext i16 %24 to i32
  %26 = call ptr @b2GetWorldLocked(i32 noundef %25)
  store ptr %26, ptr %3, align 8, !tbaa !11
  %27 = load ptr, ptr %3, align 8, !tbaa !11
  %28 = icmp eq ptr %27, null
  br i1 %28, label %29, label %30

29:                                               ; preds = %1
  store i32 1, ptr %4, align 4
  br label %220

30:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %31 = load ptr, ptr %3, align 8, !tbaa !11
  %32 = load i64, ptr %2, align 4
  %33 = call ptr @b2GetBodyFullId(ptr noundef %31, i64 %32)
  store ptr %33, ptr %5, align 8, !tbaa !11
  %34 = load ptr, ptr %5, align 8, !tbaa !11
  %35 = getelementptr inbounds %struct.b2Body, ptr %34, i32 0, i32 2
  %36 = load i32, ptr %35, align 8, !tbaa !13
  %37 = icmp ne i32 %36, 1
  br i1 %37, label %38, label %39

38:                                               ; preds = %30
  store i32 1, ptr %4, align 4
  br label %219

39:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %40 = load ptr, ptr %3, align 8, !tbaa !11
  %41 = getelementptr inbounds %struct.b2World, ptr %40, i32 0, i32 6
  %42 = call ptr @b2SolverSetArray_Get(ptr noundef %41, i32 noundef 1)
  store ptr %42, ptr %6, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %43 = load ptr, ptr %5, align 8, !tbaa !11
  %44 = getelementptr inbounds %struct.b2Body, ptr %43, i32 0, i32 20
  %45 = load i32, ptr %44, align 8, !tbaa !17
  %46 = icmp eq i32 %45, 0
  %47 = zext i1 %46 to i64
  %48 = select i1 %46, i32 0, i32 2
  store i32 %48, ptr %7, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %49 = load ptr, ptr %3, align 8, !tbaa !11
  %50 = getelementptr inbounds %struct.b2World, ptr %49, i32 0, i32 6
  %51 = load i32, ptr %7, align 4, !tbaa !18
  %52 = call ptr @b2SolverSetArray_Get(ptr noundef %50, i32 noundef %51)
  store ptr %52, ptr %8, align 8, !tbaa !11
  %53 = load ptr, ptr %3, align 8, !tbaa !11
  %54 = load ptr, ptr %8, align 8, !tbaa !11
  %55 = load ptr, ptr %6, align 8, !tbaa !11
  %56 = load ptr, ptr %5, align 8, !tbaa !11
  call void @b2TransferBody(ptr noundef %53, ptr noundef %54, ptr noundef %55, ptr noundef %56)
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #6
  %57 = load ptr, ptr %3, align 8, !tbaa !11
  %58 = load ptr, ptr %5, align 8, !tbaa !11
  %59 = call { <2 x float>, <2 x float> } @b2GetBodyTransformQuick(ptr noundef %57, ptr noundef %58)
  %60 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %9, i32 0, i32 0
  %61 = extractvalue { <2 x float>, <2 x float> } %59, 0
  store <2 x float> %61, ptr %60, align 4
  %62 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %9, i32 0, i32 1
  %63 = extractvalue { <2 x float>, <2 x float> } %59, 1
  store <2 x float> %63, ptr %62, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %64 = load ptr, ptr %5, align 8, !tbaa !11
  %65 = getelementptr inbounds %struct.b2Body, ptr %64, i32 0, i32 20
  %66 = load i32, ptr %65, align 8, !tbaa !17
  store i32 %66, ptr %10, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #6
  store i8 1, ptr %11, align 1, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %67 = load ptr, ptr %5, align 8, !tbaa !11
  %68 = getelementptr inbounds %struct.b2Body, ptr %67, i32 0, i32 6
  %69 = load i32, ptr %68, align 8, !tbaa !20
  store i32 %69, ptr %12, align 4, !tbaa !18
  br label %70

70:                                               ; preds = %73, %39
  %71 = load i32, ptr %12, align 4, !tbaa !18
  %72 = icmp ne i32 %71, -1
  br i1 %72, label %73, label %91

73:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %74 = load ptr, ptr %3, align 8, !tbaa !11
  %75 = getelementptr inbounds %struct.b2World, ptr %74, i32 0, i32 15
  %76 = load i32, ptr %12, align 4, !tbaa !18
  %77 = call ptr @b2ShapeArray_Get(ptr noundef %75, i32 noundef %76)
  store ptr %77, ptr %13, align 8, !tbaa !11
  %78 = load ptr, ptr %13, align 8, !tbaa !11
  %79 = getelementptr inbounds %struct.b2Shape, ptr %78, i32 0, i32 3
  %80 = load i32, ptr %79, align 4, !tbaa !21
  store i32 %80, ptr %12, align 4, !tbaa !18
  %81 = load ptr, ptr %13, align 8, !tbaa !11
  %82 = load ptr, ptr %3, align 8, !tbaa !11
  %83 = getelementptr inbounds %struct.b2World, ptr %82, i32 0, i32 1
  %84 = load i32, ptr %10, align 4, !tbaa !18
  %85 = load i8, ptr %11, align 1, !tbaa !19, !range !27, !noundef !28
  %86 = trunc i8 %85 to i1
  %87 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %9, i32 0, i32 0
  %88 = load <2 x float>, ptr %87, align 4
  %89 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %9, i32 0, i32 1
  %90 = load <2 x float>, ptr %89, align 4
  call void @b2CreateShapeProxy(ptr noundef %81, ptr noundef %83, i32 noundef %84, <2 x float> %88, <2 x float> %90, i1 noundef zeroext %86)
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %70, !llvm.loop !29

91:                                               ; preds = %70
  %92 = load i32, ptr %7, align 4, !tbaa !18
  %93 = icmp ne i32 %92, 0
  br i1 %93, label %94, label %98

94:                                               ; preds = %91
  %95 = load ptr, ptr %3, align 8, !tbaa !11
  %96 = load i32, ptr %7, align 4, !tbaa !18
  %97 = load ptr, ptr %5, align 8, !tbaa !11
  call void @b2CreateIslandForBody(ptr noundef %95, i32 noundef %96, ptr noundef %97)
  br label %98

98:                                               ; preds = %94, %91
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #6
  store i8 0, ptr %14, align 1, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %99 = load ptr, ptr %5, align 8, !tbaa !11
  %100 = getelementptr inbounds %struct.b2Body, ptr %99, i32 0, i32 9
  %101 = load i32, ptr %100, align 4, !tbaa !31
  store i32 %101, ptr %15, align 4, !tbaa !18
  br label %102

102:                                              ; preds = %215, %213, %98
  %103 = load i32, ptr %15, align 4, !tbaa !18
  %104 = icmp ne i32 %103, -1
  br i1 %104, label %105, label %216

105:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  %106 = load i32, ptr %15, align 4, !tbaa !18
  %107 = ashr i32 %106, 1
  store i32 %107, ptr %16, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  %108 = load i32, ptr %15, align 4, !tbaa !18
  %109 = and i32 %108, 1
  store i32 %109, ptr %17, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %110 = load ptr, ptr %3, align 8, !tbaa !11
  %111 = getelementptr inbounds %struct.b2World, ptr %110, i32 0, i32 8
  %112 = load i32, ptr %16, align 4, !tbaa !18
  %113 = call ptr @b2JointArray_Get(ptr noundef %111, i32 noundef %112)
  store ptr %113, ptr %18, align 8, !tbaa !11
  br label %114

114:                                              ; preds = %105
  %115 = load ptr, ptr %18, align 8, !tbaa !11
  %116 = getelementptr inbounds %struct.b2Joint, ptr %115, i32 0, i32 1
  %117 = load i32, ptr %116, align 8, !tbaa !32
  %118 = icmp eq i32 %117, 1
  br i1 %118, label %123, label %119

119:                                              ; preds = %114
  %120 = call i32 @b2InternalAssertFcn(ptr noundef @.str.24, ptr noundef @.str.1, i32 noundef 1664)
  %121 = icmp ne i32 %120, 0
  br i1 %121, label %122, label %123

122:                                              ; preds = %119
  call void @llvm.trap()
  br label %123

123:                                              ; preds = %122, %119, %114
  br label %124

124:                                              ; preds = %123
  br label %125

125:                                              ; preds = %124
  br label %126

126:                                              ; preds = %125
  %127 = load ptr, ptr %18, align 8, !tbaa !11
  %128 = getelementptr inbounds %struct.b2Joint, ptr %127, i32 0, i32 6
  %129 = load i32, ptr %128, align 8, !tbaa !34
  %130 = icmp eq i32 %129, -1
  br i1 %130, label %135, label %131

131:                                              ; preds = %126
  %132 = call i32 @b2InternalAssertFcn(ptr noundef @.str.39, ptr noundef @.str.1, i32 noundef 1665)
  %133 = icmp ne i32 %132, 0
  br i1 %133, label %134, label %135

134:                                              ; preds = %131
  call void @llvm.trap()
  br label %135

135:                                              ; preds = %134, %131, %126
  br label %136

136:                                              ; preds = %135
  br label %137

137:                                              ; preds = %136
  %138 = load ptr, ptr %18, align 8, !tbaa !11
  %139 = getelementptr inbounds %struct.b2Joint, ptr %138, i32 0, i32 4
  %140 = load i32, ptr %17, align 4, !tbaa !18
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [2 x %struct.b2JointEdge], ptr %139, i64 0, i64 %141
  %143 = getelementptr inbounds %struct.b2JointEdge, ptr %142, i32 0, i32 2
  %144 = load i32, ptr %143, align 4, !tbaa !35
  store i32 %144, ptr %15, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  %145 = load ptr, ptr %3, align 8, !tbaa !11
  %146 = getelementptr inbounds %struct.b2World, ptr %145, i32 0, i32 4
  %147 = load ptr, ptr %18, align 8, !tbaa !11
  %148 = getelementptr inbounds %struct.b2Joint, ptr %147, i32 0, i32 4
  %149 = getelementptr inbounds [2 x %struct.b2JointEdge], ptr %148, i64 0, i64 0
  %150 = getelementptr inbounds %struct.b2JointEdge, ptr %149, i32 0, i32 0
  %151 = load i32, ptr %150, align 4, !tbaa !37
  %152 = call ptr @b2BodyArray_Get(ptr noundef %146, i32 noundef %151)
  store ptr %152, ptr %19, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  %153 = load ptr, ptr %3, align 8, !tbaa !11
  %154 = getelementptr inbounds %struct.b2World, ptr %153, i32 0, i32 4
  %155 = load ptr, ptr %18, align 8, !tbaa !11
  %156 = getelementptr inbounds %struct.b2Joint, ptr %155, i32 0, i32 4
  %157 = getelementptr inbounds [2 x %struct.b2JointEdge], ptr %156, i64 0, i64 1
  %158 = getelementptr inbounds %struct.b2JointEdge, ptr %157, i32 0, i32 0
  %159 = load i32, ptr %158, align 4, !tbaa !37
  %160 = call ptr @b2BodyArray_Get(ptr noundef %154, i32 noundef %159)
  store ptr %160, ptr %20, align 8, !tbaa !11
  %161 = load ptr, ptr %19, align 8, !tbaa !11
  %162 = getelementptr inbounds %struct.b2Body, ptr %161, i32 0, i32 2
  %163 = load i32, ptr %162, align 8, !tbaa !13
  %164 = icmp eq i32 %163, 1
  br i1 %164, label %170, label %165

165:                                              ; preds = %137
  %166 = load ptr, ptr %20, align 8, !tbaa !11
  %167 = getelementptr inbounds %struct.b2Body, ptr %166, i32 0, i32 2
  %168 = load i32, ptr %167, align 8, !tbaa !13
  %169 = icmp eq i32 %168, 1
  br i1 %169, label %170, label %171

170:                                              ; preds = %165, %137
  store i32 4, ptr %4, align 4
  br label %213, !llvm.loop !38

171:                                              ; preds = %165
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  %172 = load ptr, ptr %19, align 8, !tbaa !11
  %173 = getelementptr inbounds %struct.b2Body, ptr %172, i32 0, i32 2
  %174 = load i32, ptr %173, align 8, !tbaa !13
  %175 = icmp eq i32 %174, 0
  br i1 %175, label %176, label %182

176:                                              ; preds = %171
  %177 = load ptr, ptr %20, align 8, !tbaa !11
  %178 = getelementptr inbounds %struct.b2Body, ptr %177, i32 0, i32 2
  %179 = load i32, ptr %178, align 8, !tbaa !13
  %180 = icmp eq i32 %179, 0
  br i1 %180, label %181, label %182

181:                                              ; preds = %176
  store i32 0, ptr %21, align 4, !tbaa !18
  br label %196

182:                                              ; preds = %176, %171
  %183 = load ptr, ptr %19, align 8, !tbaa !11
  %184 = getelementptr inbounds %struct.b2Body, ptr %183, i32 0, i32 2
  %185 = load i32, ptr %184, align 8, !tbaa !13
  %186 = icmp eq i32 %185, 0
  br i1 %186, label %187, label %191

187:                                              ; preds = %182
  %188 = load ptr, ptr %20, align 8, !tbaa !11
  %189 = getelementptr inbounds %struct.b2Body, ptr %188, i32 0, i32 2
  %190 = load i32, ptr %189, align 8, !tbaa !13
  store i32 %190, ptr %21, align 4, !tbaa !18
  br label %195

191:                                              ; preds = %182
  %192 = load ptr, ptr %19, align 8, !tbaa !11
  %193 = getelementptr inbounds %struct.b2Body, ptr %192, i32 0, i32 2
  %194 = load i32, ptr %193, align 8, !tbaa !13
  store i32 %194, ptr %21, align 4, !tbaa !18
  br label %195

195:                                              ; preds = %191, %187
  br label %196

196:                                              ; preds = %195, %181
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #6
  %197 = load ptr, ptr %3, align 8, !tbaa !11
  %198 = getelementptr inbounds %struct.b2World, ptr %197, i32 0, i32 6
  %199 = load i32, ptr %21, align 4, !tbaa !18
  %200 = call ptr @b2SolverSetArray_Get(ptr noundef %198, i32 noundef %199)
  store ptr %200, ptr %22, align 8, !tbaa !11
  %201 = load ptr, ptr %3, align 8, !tbaa !11
  %202 = load ptr, ptr %22, align 8, !tbaa !11
  %203 = load ptr, ptr %6, align 8, !tbaa !11
  %204 = load ptr, ptr %18, align 8, !tbaa !11
  call void @b2TransferJoint(ptr noundef %201, ptr noundef %202, ptr noundef %203, ptr noundef %204)
  %205 = load i32, ptr %21, align 4, !tbaa !18
  %206 = icmp ne i32 %205, 0
  br i1 %206, label %207, label %212

207:                                              ; preds = %196
  %208 = load ptr, ptr %3, align 8, !tbaa !11
  %209 = load ptr, ptr %18, align 8, !tbaa !11
  %210 = load i8, ptr %14, align 1, !tbaa !19, !range !27, !noundef !28
  %211 = trunc i8 %210 to i1
  call void @b2LinkJoint(ptr noundef %208, ptr noundef %209, i1 noundef zeroext %211)
  br label %212

212:                                              ; preds = %207, %196
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  store i32 0, ptr %4, align 4
  br label %213

213:                                              ; preds = %212, %170
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  %214 = load i32, ptr %4, align 4
  switch i32 %214, label %223 [
    i32 0, label %215
    i32 4, label %102
  ]

215:                                              ; preds = %213
  br label %102, !llvm.loop !38

216:                                              ; preds = %102
  %217 = load ptr, ptr %3, align 8, !tbaa !11
  call void @b2MergeAwakeIslands(ptr noundef %217)
  %218 = load ptr, ptr %3, align 8, !tbaa !11
  call void @b2ValidateSolverSets(ptr noundef %218)
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  store i32 0, ptr %4, align 4
  br label %219

219:                                              ; preds = %216, %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  br label %220

220:                                              ; preds = %219, %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  %221 = load i32, ptr %4, align 4
  switch i32 %221, label %223 [
    i32 0, label %222
    i32 1, label %222
  ]

222:                                              ; preds = %220, %220
  ret void

223:                                              ; preds = %220, %213
  unreachable
}

attributes #0 = { 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 #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 = { 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 #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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, !10, i64 4}
!6 = !{!"b2BodyId", !7, i64 0, !10, i64 4, !10, i64 6}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"short", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!14, !7, i64 40}
!14 = !{!"b2Body", !8, i64 0, !12, i64 32, !7, i64 40, !7, i64 44, !7, i64 48, !7, i64 52, !7, i64 56, !7, i64 60, !7, i64 64, !7, i64 68, !7, i64 72, !7, i64 76, !7, i64 80, !7, i64 84, !15, i64 88, !15, i64 92, !15, i64 96, !15, i64 100, !7, i64 104, !7, i64 108, !7, i64 112, !10, i64 116, !16, i64 118, !16, i64 119, !16, i64 120, !16, i64 121}
!15 = !{!"float", !8, i64 0}
!16 = !{!"_Bool", !8, i64 0}
!17 = !{!14, !7, i64 112}
!18 = !{!7, !7, i64 0}
!19 = !{!16, !16, i64 0}
!20 = !{!14, !7, i64 56}
!21 = !{!22, !7, i64 12}
!22 = !{!"b2Shape", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !15, i64 24, !15, i64 28, !15, i64 32, !15, i64 36, !15, i64 40, !7, i64 44, !23, i64 48, !23, i64 64, !24, i64 80, !7, i64 88, !25, i64 96, !12, i64 120, !7, i64 128, !8, i64 132, !10, i64 276, !16, i64 278, !16, i64 279, !16, i64 280, !16, i64 281, !16, i64 282}
!23 = !{!"b2AABB", !24, i64 0, !24, i64 8}
!24 = !{!"b2Vec2", !15, i64 0, !15, i64 4}
!25 = !{!"b2Filter", !26, i64 0, !26, i64 8, !7, i64 16}
!26 = !{!"long", !8, i64 0}
!27 = !{i8 0, i8 2}
!28 = !{}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = !{!14, !7, i64 68}
!32 = !{!33, !7, i64 8}
!33 = !{!"b2Joint", !12, i64 0, !7, i64 8, !7, i64 12, !7, i64 16, !8, i64 20, !7, i64 44, !7, i64 48, !7, i64 52, !7, i64 56, !15, i64 60, !7, i64 64, !10, i64 68, !16, i64 70, !16, i64 71}
!34 = !{!33, !7, i64 48}
!35 = !{!36, !7, i64 8}
!36 = !{!"b2JointEdge", !7, i64 0, !7, i64 4, !7, i64 8}
!37 = !{!36, !7, i64 0}
!38 = distinct !{!38, !30}


; 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.b2JointEdge = type { i32, i32, i32 }

@.str.1 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [33 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local ptr @b2GetBodyFullId(ptr noundef, i64) local_unnamed_addr #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

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @b2BodyArray_Get(ptr noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare dso_local { <2 x float>, <2 x float> } @b2GetBodyTransformQuick(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @b2SolverSetArray_Get(ptr noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden void @b2CreateIslandForBody(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

declare void @b2ValidateSolverSets(ptr noundef) local_unnamed_addr #1

declare ptr @b2GetWorldLocked(i32 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @b2JointArray_Get(ptr noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @b2ShapeArray_Get(ptr noundef, i32 noundef) local_unnamed_addr #3

declare void @b2TransferBody(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @b2TransferJoint(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @b2CreateShapeProxy(ptr noundef, ptr noundef, i32 noundef, <2 x float>, <2 x float>, i1 noundef zeroext) local_unnamed_addr #1

declare void @b2LinkJoint(ptr noundef, ptr noundef, i1 noundef zeroext) local_unnamed_addr #1

declare void @b2MergeAwakeIslands(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @b2Body_Enable(i64 %0) local_unnamed_addr #4 {
  %.sroa.2.0.extract.shift = lshr i64 %0, 32
  %2 = trunc nuw i64 %.sroa.2.0.extract.shift to i32
  %3 = and i32 %2, 65535
  %4 = tail call ptr @b2GetWorldLocked(i32 noundef %3) #5
  %5 = icmp eq ptr %4, null
  br i1 %5, label %76, label %6

6:                                                ; preds = %1
  %7 = tail call ptr @b2GetBodyFullId(ptr noundef nonnull %4, i64 %0)
  %8 = getelementptr inbounds i8, ptr %7, i64 40
  %9 = load i32, ptr %8, align 8, !tbaa !5
  %.not = icmp eq i32 %9, 1
  br i1 %.not, label %10, label %76

10:                                               ; preds = %6
  %11 = getelementptr inbounds i8, ptr %4, i64 1072
  %12 = tail call ptr @b2SolverSetArray_Get(ptr noundef nonnull %11, i32 noundef 1)
  %13 = getelementptr inbounds i8, ptr %7, i64 112
  %14 = load i32, ptr %13, align 8, !tbaa !14
  %15 = icmp eq i32 %14, 0
  %16 = select i1 %15, i32 0, i32 2
  %17 = tail call ptr @b2SolverSetArray_Get(ptr noundef nonnull %11, i32 noundef %16)
  tail call void @b2TransferBody(ptr noundef nonnull %4, ptr noundef %17, ptr noundef %12, ptr noundef nonnull %7) #5
  %18 = tail call { <2 x float>, <2 x float> } @b2GetBodyTransformQuick(ptr noundef nonnull %4, ptr noundef nonnull %7)
  %19 = extractvalue { <2 x float>, <2 x float> } %18, 0
  %20 = extractvalue { <2 x float>, <2 x float> } %18, 1
  %21 = load i32, ptr %13, align 8, !tbaa !14
  %22 = getelementptr inbounds i8, ptr %7, i64 56
  %23 = load i32, ptr %22, align 8, !tbaa !15
  %.not6773 = icmp eq i32 %23, -1
  br i1 %.not6773, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %10
  %24 = getelementptr inbounds i8, ptr %4, i64 1256
  %25 = getelementptr inbounds i8, ptr %4, i64 40
  br label %26

26:                                               ; preds = %.lr.ph, %26
  %.06074 = phi i32 [ %23, %.lr.ph ], [ %29, %26 ]
  %27 = tail call ptr @b2ShapeArray_Get(ptr noundef nonnull %24, i32 noundef %.06074)
  %28 = getelementptr inbounds i8, ptr %27, i64 12
  %29 = load i32, ptr %28, align 4, !tbaa !16
  tail call void @b2CreateShapeProxy(ptr noundef %27, ptr noundef nonnull %25, i32 noundef %21, <2 x float> %19, <2 x float> %20, i1 noundef zeroext true) #5
  %.not67 = icmp eq i32 %29, -1
  br i1 %.not67, label %._crit_edge, label %26, !llvm.loop !22

._crit_edge:                                      ; preds = %26, %10
  br i1 %15, label %31, label %30

30:                                               ; preds = %._crit_edge
  tail call void @b2CreateIslandForBody(ptr noundef nonnull %4, i32 noundef 2, ptr noundef %7)
  br label %31

31:                                               ; preds = %30, %._crit_edge
  %32 = getelementptr inbounds i8, ptr %7, i64 68
  %33 = load i32, ptr %32, align 4, !tbaa !24
  %.not6975 = icmp eq i32 %33, -1
  br i1 %.not6975, label %._crit_edge79, label %.lr.ph78

.lr.ph78:                                         ; preds = %31
  %34 = getelementptr inbounds i8, ptr %4, i64 1112
  %35 = getelementptr inbounds i8, ptr %4, i64 1032
  br label %36

36:                                               ; preds = %.lr.ph78, %75
  %.06176 = phi i32 [ %33, %.lr.ph78 ], [ %57, %75 ]
  %37 = ashr i32 %.06176, 1
  %38 = and i32 %.06176, 1
  %39 = tail call ptr @b2JointArray_Get(ptr noundef nonnull %34, i32 noundef %37)
  %40 = getelementptr inbounds i8, ptr %39, i64 8
  %41 = load i32, ptr %40, align 8, !tbaa !25
  %42 = icmp eq i32 %41, 1
  br i1 %42, label %46, label %43

43:                                               ; preds = %36
  %44 = tail call i32 @b2InternalAssertFcn(ptr noundef nonnull @.str.24, ptr noundef nonnull @.str.1, i32 noundef 1664) #5
  %.not70 = icmp eq i32 %44, 0
  br i1 %.not70, label %46, label %45

45:                                               ; preds = %43
  tail call void @llvm.trap()
  unreachable

46:                                               ; preds = %36, %43
  %47 = getelementptr inbounds i8, ptr %39, i64 48
  %48 = load i32, ptr %47, align 8, !tbaa !27
  %49 = icmp eq i32 %48, -1
  br i1 %49, label %53, label %50

50:                                               ; preds = %46
  %51 = tail call i32 @b2InternalAssertFcn(ptr noundef nonnull @.str.39, ptr noundef nonnull @.str.1, i32 noundef 1665) #5
  %.not71 = icmp eq i32 %51, 0
  br i1 %.not71, label %53, label %52

52:                                               ; preds = %50
  tail call void @llvm.trap()
  unreachable

53:                                               ; preds = %50, %46
  %54 = getelementptr inbounds i8, ptr %39, i64 20
  %55 = zext nneg i32 %38 to i64
  %56 = getelementptr inbounds [2 x %struct.b2JointEdge], ptr %54, i64 0, i64 %55, i32 2
  %57 = load i32, ptr %56, align 4, !tbaa !28
  %58 = load i32, ptr %54, align 4, !tbaa !30
  %59 = tail call ptr @b2BodyArray_Get(ptr noundef nonnull %35, i32 noundef %58)
  %60 = getelementptr inbounds i8, ptr %39, i64 32
  %61 = load i32, ptr %60, align 4, !tbaa !30
  %62 = tail call ptr @b2BodyArray_Get(ptr noundef nonnull %35, i32 noundef %61)
  %63 = getelementptr inbounds i8, ptr %59, i64 40
  %64 = load i32, ptr %63, align 8, !tbaa !5
  %65 = icmp eq i32 %64, 1
  br i1 %65, label %75, label %66, !llvm.loop !31

66:                                               ; preds = %53
  %67 = getelementptr inbounds i8, ptr %62, i64 40
  %68 = load i32, ptr %67, align 8, !tbaa !5
  %69 = icmp eq i32 %68, 1
  br i1 %69, label %75, label %70, !llvm.loop !31

70:                                               ; preds = %66
  %71 = icmp eq i32 %64, 0
  %72 = or i32 %68, %64
  %or.cond = icmp eq i32 %72, 0
  %spec.select = select i1 %71, i32 %68, i32 %64
  %.0 = select i1 %or.cond, i32 0, i32 %spec.select
  %73 = tail call ptr @b2SolverSetArray_Get(ptr noundef nonnull %11, i32 noundef %.0)
  tail call void @b2TransferJoint(ptr noundef nonnull %4, ptr noundef %73, ptr noundef %12, ptr noundef nonnull %39) #5
  %.not72 = icmp eq i32 %.0, 0
  br i1 %.not72, label %75, label %74

74:                                               ; preds = %70
  tail call void @b2LinkJoint(ptr noundef nonnull %4, ptr noundef nonnull %39, i1 noundef zeroext false) #5
  br label %75

75:                                               ; preds = %70, %74, %53, %66
  %.not69 = icmp eq i32 %57, -1
  br i1 %.not69, label %._crit_edge79, label %36

._crit_edge79:                                    ; preds = %75, %31
  tail call void @b2MergeAwakeIslands(ptr noundef nonnull %4) #5
  tail call void @b2ValidateSolverSets(ptr noundef nonnull %4) #5
  br label %76

76:                                               ; preds = %._crit_edge79, %6, %1
  ret void
}

attributes #0 = { 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 #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 = { 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 #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 = { 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, !10, i64 40}
!6 = !{!"b2Body", !7, i64 0, !9, i64 32, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84, !11, i64 88, !11, i64 92, !11, i64 96, !11, i64 100, !10, i64 104, !10, i64 108, !10, i64 112, !12, i64 116, !13, i64 118, !13, i64 119, !13, i64 120, !13, i64 121}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"any pointer", !7, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!"float", !7, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!"_Bool", !7, i64 0}
!14 = !{!6, !10, i64 112}
!15 = !{!6, !10, i64 56}
!16 = !{!17, !10, i64 12}
!17 = !{!"b2Shape", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !10, i64 44, !18, i64 48, !18, i64 64, !19, i64 80, !10, i64 88, !20, i64 96, !9, i64 120, !10, i64 128, !7, i64 132, !12, i64 276, !13, i64 278, !13, i64 279, !13, i64 280, !13, i64 281, !13, i64 282}
!18 = !{!"b2AABB", !19, i64 0, !19, i64 8}
!19 = !{!"b2Vec2", !11, i64 0, !11, i64 4}
!20 = !{!"b2Filter", !21, i64 0, !21, i64 8, !10, i64 16}
!21 = !{!"long", !7, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!6, !10, i64 68}
!25 = !{!26, !10, i64 8}
!26 = !{!"b2Joint", !9, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !7, i64 20, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !11, i64 60, !10, i64 64, !12, i64 68, !13, i64 70, !13, i64 71}
!27 = !{!26, !10, i64 48}
!28 = !{!29, !10, i64 8}
!29 = !{!"b2JointEdge", !10, i64 0, !10, i64 4, !10, i64 8}
!30 = !{!29, !10, i64 0}
!31 = distinct !{!31, !23}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass