; 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.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 }
%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.b2Vec2 = type { float, float }
%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.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.b2SolverSet = type { %struct.b2BodySimArray, %struct.b2BodyStateArray, %struct.b2JointSimArray, %struct.b2ContactSimArray, %struct.b2IslandSimArray, i32 }
%struct.b2BodySimArray = type { ptr, i32, i32 }
%struct.b2BodyStateArray = type { ptr, i32, i32 }
%struct.b2IslandSimArray = type { ptr, i32, i32 }
%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 }

@.str.1 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [37 x i8], align 1

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @b2DestroyJointInternal(ptr noundef %0, ptr noundef %1, i1 noundef zeroext %2) #4 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca ptr, align 8
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca ptr, align 8
  %27 = alloca i32, align 4
  %28 = alloca ptr, align 8
  %29 = alloca i32, align 4
  %30 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %31 = zext i1 %2 to i8
  store i8 %31, ptr %6, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.b2Joint, ptr %32, i32 0, i32 5
  %34 = load i32, ptr %33, align 4, !tbaa !11
  store i32 %34, ptr %7, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.b2Joint, ptr %35, i32 0, i32 4
  %37 = getelementptr inbounds [2 x %struct.b2JointEdge], ptr %36, i64 0, i64 0
  %38 = getelementptr inbounds %struct.b2JointEdge, ptr %37, i64 0
  store ptr %38, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.b2Joint, ptr %39, i32 0, i32 4
  %41 = getelementptr inbounds [2 x %struct.b2JointEdge], ptr %40, i64 0, i64 0
  %42 = getelementptr inbounds %struct.b2JointEdge, ptr %41, i64 1
  store ptr %42, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.b2JointEdge, ptr %43, i32 0, i32 0
  %45 = load i32, ptr %44, align 4, !tbaa !17
  store i32 %45, ptr %10, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %46 = load ptr, ptr %9, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.b2JointEdge, ptr %46, i32 0, i32 0
  %48 = load i32, ptr %47, align 4, !tbaa !17
  store i32 %48, ptr %11, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.b2World, ptr %49, i32 0, i32 4
  %51 = load i32, ptr %10, align 4, !tbaa !16
  %52 = call ptr @b2BodyArray_Get(ptr noundef %50, i32 noundef %51)
  store ptr %52, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.b2World, ptr %53, i32 0, i32 4
  %55 = load i32, ptr %11, align 4, !tbaa !16
  %56 = call ptr @b2BodyArray_Get(ptr noundef %54, i32 noundef %55)
  store ptr %56, ptr %13, align 8, !tbaa !5
  %57 = load ptr, ptr %8, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.b2JointEdge, ptr %57, i32 0, i32 1
  %59 = load i32, ptr %58, align 4, !tbaa !19
  %60 = icmp ne i32 %59, -1
  br i1 %60, label %61, label %83

61:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.b2World, ptr %62, i32 0, i32 8
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.b2JointEdge, ptr %64, i32 0, i32 1
  %66 = load i32, ptr %65, align 4, !tbaa !19
  %67 = ashr i32 %66, 1
  %68 = call ptr @b2JointArray_Get(ptr noundef %63, i32 noundef %67)
  store ptr %68, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %69 = load ptr, ptr %14, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.b2Joint, ptr %69, i32 0, i32 4
  %71 = getelementptr inbounds [2 x %struct.b2JointEdge], ptr %70, i64 0, i64 0
  %72 = load ptr, ptr %8, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.b2JointEdge, ptr %72, i32 0, i32 1
  %74 = load i32, ptr %73, align 4, !tbaa !19
  %75 = and i32 %74, 1
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds %struct.b2JointEdge, ptr %71, i64 %76
  store ptr %77, ptr %15, align 8, !tbaa !5
  %78 = load ptr, ptr %8, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.b2JointEdge, ptr %78, i32 0, i32 2
  %80 = load i32, ptr %79, align 4, !tbaa !20
  %81 = load ptr, ptr %15, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.b2JointEdge, ptr %81, i32 0, i32 2
  store i32 %80, ptr %82, align 4, !tbaa !20
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %83

83:                                               ; preds = %61, %3
  %84 = load ptr, ptr %8, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.b2JointEdge, ptr %84, i32 0, i32 2
  %86 = load i32, ptr %85, align 4, !tbaa !20
  %87 = icmp ne i32 %86, -1
  br i1 %87, label %88, label %110

88:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %89 = load ptr, ptr %4, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.b2World, ptr %89, i32 0, i32 8
  %91 = load ptr, ptr %8, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.b2JointEdge, ptr %91, i32 0, i32 2
  %93 = load i32, ptr %92, align 4, !tbaa !20
  %94 = ashr i32 %93, 1
  %95 = call ptr @b2JointArray_Get(ptr noundef %90, i32 noundef %94)
  store ptr %95, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %96 = load ptr, ptr %16, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.b2Joint, ptr %96, i32 0, i32 4
  %98 = getelementptr inbounds [2 x %struct.b2JointEdge], ptr %97, i64 0, i64 0
  %99 = load ptr, ptr %8, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.b2JointEdge, ptr %99, i32 0, i32 2
  %101 = load i32, ptr %100, align 4, !tbaa !20
  %102 = and i32 %101, 1
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds %struct.b2JointEdge, ptr %98, i64 %103
  store ptr %104, ptr %17, align 8, !tbaa !5
  %105 = load ptr, ptr %8, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.b2JointEdge, ptr %105, i32 0, i32 1
  %107 = load i32, ptr %106, align 4, !tbaa !19
  %108 = load ptr, ptr %17, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.b2JointEdge, ptr %108, i32 0, i32 1
  store i32 %107, ptr %109, align 4, !tbaa !19
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  br label %110

110:                                              ; preds = %88, %83
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  %111 = load i32, ptr %7, align 4, !tbaa !16
  %112 = shl i32 %111, 1
  %113 = or i32 %112, 0
  store i32 %113, ptr %18, align 4, !tbaa !16
  %114 = load ptr, ptr %12, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.b2Body, ptr %114, i32 0, i32 9
  %116 = load i32, ptr %115, align 4, !tbaa !21
  %117 = load i32, ptr %18, align 4, !tbaa !16
  %118 = icmp eq i32 %116, %117
  br i1 %118, label %119, label %125

119:                                              ; preds = %110
  %120 = load ptr, ptr %8, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.b2JointEdge, ptr %120, i32 0, i32 2
  %122 = load i32, ptr %121, align 4, !tbaa !20
  %123 = load ptr, ptr %12, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.b2Body, ptr %123, i32 0, i32 9
  store i32 %122, ptr %124, align 4, !tbaa !21
  br label %125

125:                                              ; preds = %119, %110
  %126 = load ptr, ptr %12, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.b2Body, ptr %126, i32 0, i32 10
  %128 = load i32, ptr %127, align 8, !tbaa !23
  %129 = sub nsw i32 %128, 1
  store i32 %129, ptr %127, align 8, !tbaa !23
  %130 = load ptr, ptr %9, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.b2JointEdge, ptr %130, i32 0, i32 1
  %132 = load i32, ptr %131, align 4, !tbaa !19
  %133 = icmp ne i32 %132, -1
  br i1 %133, label %134, label %156

134:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %135 = load ptr, ptr %4, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.b2World, ptr %135, i32 0, i32 8
  %137 = load ptr, ptr %9, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.b2JointEdge, ptr %137, i32 0, i32 1
  %139 = load i32, ptr %138, align 4, !tbaa !19
  %140 = ashr i32 %139, 1
  %141 = call ptr @b2JointArray_Get(ptr noundef %136, i32 noundef %140)
  store ptr %141, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %142 = load ptr, ptr %19, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.b2Joint, ptr %142, i32 0, i32 4
  %144 = getelementptr inbounds [2 x %struct.b2JointEdge], ptr %143, i64 0, i64 0
  %145 = load ptr, ptr %9, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.b2JointEdge, ptr %145, i32 0, i32 1
  %147 = load i32, ptr %146, align 4, !tbaa !19
  %148 = and i32 %147, 1
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds %struct.b2JointEdge, ptr %144, i64 %149
  store ptr %150, ptr %20, align 8, !tbaa !5
  %151 = load ptr, ptr %9, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.b2JointEdge, ptr %151, i32 0, i32 2
  %153 = load i32, ptr %152, align 4, !tbaa !20
  %154 = load ptr, ptr %20, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.b2JointEdge, ptr %154, i32 0, i32 2
  store i32 %153, ptr %155, align 4, !tbaa !20
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  br label %156

156:                                              ; preds = %134, %125
  %157 = load ptr, ptr %9, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.b2JointEdge, ptr %157, i32 0, i32 2
  %159 = load i32, ptr %158, align 4, !tbaa !20
  %160 = icmp ne i32 %159, -1
  br i1 %160, label %161, label %183

161:                                              ; preds = %156
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %162 = load ptr, ptr %4, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.b2World, ptr %162, i32 0, i32 8
  %164 = load ptr, ptr %9, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.b2JointEdge, ptr %164, i32 0, i32 2
  %166 = load i32, ptr %165, align 4, !tbaa !20
  %167 = ashr i32 %166, 1
  %168 = call ptr @b2JointArray_Get(ptr noundef %163, i32 noundef %167)
  store ptr %168, ptr %21, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  %169 = load ptr, ptr %21, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.b2Joint, ptr %169, i32 0, i32 4
  %171 = getelementptr inbounds [2 x %struct.b2JointEdge], ptr %170, i64 0, i64 0
  %172 = load ptr, ptr %9, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.b2JointEdge, ptr %172, i32 0, i32 2
  %174 = load i32, ptr %173, align 4, !tbaa !20
  %175 = and i32 %174, 1
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds %struct.b2JointEdge, ptr %171, i64 %176
  store ptr %177, ptr %22, align 8, !tbaa !5
  %178 = load ptr, ptr %9, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct.b2JointEdge, ptr %178, i32 0, i32 1
  %180 = load i32, ptr %179, align 4, !tbaa !19
  %181 = load ptr, ptr %22, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.b2JointEdge, ptr %181, i32 0, i32 1
  store i32 %180, ptr %182, align 4, !tbaa !19
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  br label %183

183:                                              ; preds = %161, %156
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #5
  %184 = load i32, ptr %7, align 4, !tbaa !16
  %185 = shl i32 %184, 1
  %186 = or i32 %185, 1
  store i32 %186, ptr %23, align 4, !tbaa !16
  %187 = load ptr, ptr %13, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.b2Body, ptr %187, i32 0, i32 9
  %189 = load i32, ptr %188, align 4, !tbaa !21
  %190 = load i32, ptr %23, align 4, !tbaa !16
  %191 = icmp eq i32 %189, %190
  br i1 %191, label %192, label %198

192:                                              ; preds = %183
  %193 = load ptr, ptr %9, align 8, !tbaa !5
  %194 = getelementptr inbounds %struct.b2JointEdge, ptr %193, i32 0, i32 2
  %195 = load i32, ptr %194, align 4, !tbaa !20
  %196 = load ptr, ptr %13, align 8, !tbaa !5
  %197 = getelementptr inbounds %struct.b2Body, ptr %196, i32 0, i32 9
  store i32 %195, ptr %197, align 4, !tbaa !21
  br label %198

198:                                              ; preds = %192, %183
  %199 = load ptr, ptr %13, align 8, !tbaa !5
  %200 = getelementptr inbounds %struct.b2Body, ptr %199, i32 0, i32 10
  %201 = load i32, ptr %200, align 8, !tbaa !23
  %202 = sub nsw i32 %201, 1
  store i32 %202, ptr %200, align 8, !tbaa !23
  %203 = load ptr, ptr %5, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.b2Joint, ptr %203, i32 0, i32 6
  %205 = load i32, ptr %204, align 8, !tbaa !24
  %206 = icmp ne i32 %205, -1
  br i1 %206, label %207, label %222

207:                                              ; preds = %198
  br label %208

208:                                              ; preds = %207
  %209 = load ptr, ptr %5, align 8, !tbaa !5
  %210 = getelementptr inbounds %struct.b2Joint, ptr %209, i32 0, i32 1
  %211 = load i32, ptr %210, align 8, !tbaa !25
  %212 = icmp sgt i32 %211, 1
  br i1 %212, label %217, label %213

213:                                              ; preds = %208
  %214 = call i32 @b2InternalAssertFcn(ptr noundef @.str.14, ptr noundef @.str.1, i32 noundef 764)
  %215 = icmp ne i32 %214, 0
  br i1 %215, label %216, label %217

216:                                              ; preds = %213
  call void @llvm.trap()
  br label %217

217:                                              ; preds = %216, %213, %208
  br label %218

218:                                              ; preds = %217
  br label %219

219:                                              ; preds = %218
  %220 = load ptr, ptr %4, align 8, !tbaa !5
  %221 = load ptr, ptr %5, align 8, !tbaa !5
  call void @b2UnlinkJoint(ptr noundef %220, ptr noundef %221)
  br label %235

222:                                              ; preds = %198
  br label %223

223:                                              ; preds = %222
  %224 = load ptr, ptr %5, align 8, !tbaa !5
  %225 = getelementptr inbounds %struct.b2Joint, ptr %224, i32 0, i32 1
  %226 = load i32, ptr %225, align 8, !tbaa !25
  %227 = icmp sle i32 %226, 1
  br i1 %227, label %232, label %228

228:                                              ; preds = %223
  %229 = call i32 @b2InternalAssertFcn(ptr noundef @.str.15, ptr noundef @.str.1, i32 noundef 769)
  %230 = icmp ne i32 %229, 0
  br i1 %230, label %231, label %232

231:                                              ; preds = %228
  call void @llvm.trap()
  br label %232

232:                                              ; preds = %231, %228, %223
  br label %233

233:                                              ; preds = %232
  br label %234

234:                                              ; preds = %233
  br label %235

235:                                              ; preds = %234, %219
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #5
  %236 = load ptr, ptr %5, align 8, !tbaa !5
  %237 = getelementptr inbounds %struct.b2Joint, ptr %236, i32 0, i32 1
  %238 = load i32, ptr %237, align 8, !tbaa !25
  store i32 %238, ptr %24, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #5
  %239 = load ptr, ptr %5, align 8, !tbaa !5
  %240 = getelementptr inbounds %struct.b2Joint, ptr %239, i32 0, i32 3
  %241 = load i32, ptr %240, align 8, !tbaa !26
  store i32 %241, ptr %25, align 4, !tbaa !16
  %242 = load i32, ptr %24, align 4, !tbaa !16
  %243 = icmp eq i32 %242, 2
  br i1 %243, label %244, label %260

244:                                              ; preds = %235
  %245 = load ptr, ptr %4, align 8, !tbaa !5
  %246 = load ptr, ptr %5, align 8, !tbaa !5
  %247 = getelementptr inbounds %struct.b2Joint, ptr %246, i32 0, i32 4
  %248 = getelementptr inbounds [2 x %struct.b2JointEdge], ptr %247, i64 0, i64 0
  %249 = getelementptr inbounds %struct.b2JointEdge, ptr %248, i32 0, i32 0
  %250 = load i32, ptr %249, align 4, !tbaa !17
  %251 = load ptr, ptr %5, align 8, !tbaa !5
  %252 = getelementptr inbounds %struct.b2Joint, ptr %251, i32 0, i32 4
  %253 = getelementptr inbounds [2 x %struct.b2JointEdge], ptr %252, i64 0, i64 1
  %254 = getelementptr inbounds %struct.b2JointEdge, ptr %253, i32 0, i32 0
  %255 = load i32, ptr %254, align 4, !tbaa !17
  %256 = load ptr, ptr %5, align 8, !tbaa !5
  %257 = getelementptr inbounds %struct.b2Joint, ptr %256, i32 0, i32 2
  %258 = load i32, ptr %257, align 4, !tbaa !27
  %259 = load i32, ptr %25, align 4, !tbaa !16
  call void @b2RemoveJointFromGraph(ptr noundef %245, i32 noundef %250, i32 noundef %255, i32 noundef %258, i32 noundef %259)
  br label %303

260:                                              ; preds = %235
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #5
  %261 = load ptr, ptr %4, align 8, !tbaa !5
  %262 = getelementptr inbounds %struct.b2World, ptr %261, i32 0, i32 6
  %263 = load i32, ptr %24, align 4, !tbaa !16
  %264 = call ptr @b2SolverSetArray_Get(ptr noundef %262, i32 noundef %263)
  store ptr %264, ptr %26, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #5
  %265 = load ptr, ptr %26, align 8, !tbaa !5
  %266 = getelementptr inbounds %struct.b2SolverSet, ptr %265, i32 0, i32 2
  %267 = load i32, ptr %25, align 4, !tbaa !16
  %268 = call i32 @b2JointSimArray_RemoveSwap(ptr noundef %266, i32 noundef %267)
  store i32 %268, ptr %27, align 4, !tbaa !16
  %269 = load i32, ptr %27, align 4, !tbaa !16
  %270 = icmp ne i32 %269, -1
  br i1 %270, label %271, label %302

271:                                              ; preds = %260
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #5
  %272 = load ptr, ptr %26, align 8, !tbaa !5
  %273 = getelementptr inbounds %struct.b2SolverSet, ptr %272, i32 0, i32 2
  %274 = getelementptr inbounds %struct.b2JointSimArray, ptr %273, i32 0, i32 0
  %275 = load ptr, ptr %274, align 8, !tbaa !28
  %276 = load i32, ptr %25, align 4, !tbaa !16
  %277 = sext i32 %276 to i64
  %278 = getelementptr inbounds %struct.b2JointSim, ptr %275, i64 %277
  store ptr %278, ptr %28, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #5
  %279 = load ptr, ptr %28, align 8, !tbaa !5
  %280 = getelementptr inbounds %struct.b2JointSim, ptr %279, i32 0, i32 0
  %281 = load i32, ptr %280, align 4, !tbaa !31
  store i32 %281, ptr %29, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #5
  %282 = load ptr, ptr %4, align 8, !tbaa !5
  %283 = getelementptr inbounds %struct.b2World, ptr %282, i32 0, i32 8
  %284 = load i32, ptr %29, align 4, !tbaa !16
  %285 = call ptr @b2JointArray_Get(ptr noundef %283, i32 noundef %284)
  store ptr %285, ptr %30, align 8, !tbaa !5
  br label %286

286:                                              ; preds = %271
  %287 = load ptr, ptr %30, align 8, !tbaa !5
  %288 = getelementptr inbounds %struct.b2Joint, ptr %287, i32 0, i32 3
  %289 = load i32, ptr %288, align 8, !tbaa !26
  %290 = load i32, ptr %27, align 4, !tbaa !16
  %291 = icmp eq i32 %289, %290
  br i1 %291, label %296, label %292

292:                                              ; preds = %286
  %293 = call i32 @b2InternalAssertFcn(ptr noundef @.str.16, ptr noundef @.str.1, i32 noundef 790)
  %294 = icmp ne i32 %293, 0
  br i1 %294, label %295, label %296

295:                                              ; preds = %292
  call void @llvm.trap()
  br label %296

296:                                              ; preds = %295, %292, %286
  br label %297

297:                                              ; preds = %296
  br label %298

298:                                              ; preds = %297
  %299 = load i32, ptr %25, align 4, !tbaa !16
  %300 = load ptr, ptr %30, align 8, !tbaa !5
  %301 = getelementptr inbounds %struct.b2Joint, ptr %300, i32 0, i32 3
  store i32 %299, ptr %301, align 8, !tbaa !26
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #5
  br label %302

302:                                              ; preds = %298, %260
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #5
  br label %303

303:                                              ; preds = %302, %244
  %304 = load ptr, ptr %5, align 8, !tbaa !5
  %305 = getelementptr inbounds %struct.b2Joint, ptr %304, i32 0, i32 1
  store i32 -1, ptr %305, align 8, !tbaa !25
  %306 = load ptr, ptr %5, align 8, !tbaa !5
  %307 = getelementptr inbounds %struct.b2Joint, ptr %306, i32 0, i32 3
  store i32 -1, ptr %307, align 8, !tbaa !26
  %308 = load ptr, ptr %5, align 8, !tbaa !5
  %309 = getelementptr inbounds %struct.b2Joint, ptr %308, i32 0, i32 2
  store i32 -1, ptr %309, align 4, !tbaa !27
  %310 = load ptr, ptr %5, align 8, !tbaa !5
  %311 = getelementptr inbounds %struct.b2Joint, ptr %310, i32 0, i32 5
  store i32 -1, ptr %311, align 4, !tbaa !11
  %312 = load ptr, ptr %4, align 8, !tbaa !5
  %313 = getelementptr inbounds %struct.b2World, ptr %312, i32 0, i32 7
  %314 = load i32, ptr %7, align 4, !tbaa !16
  call void @b2FreeId(ptr noundef %313, i32 noundef %314)
  %315 = load i8, ptr %6, align 1, !tbaa !9, !range !34, !noundef !35
  %316 = trunc i8 %315 to i1
  br i1 %316, label %317, label %324

317:                                              ; preds = %303
  %318 = load ptr, ptr %4, align 8, !tbaa !5
  %319 = load ptr, ptr %12, align 8, !tbaa !5
  %320 = call zeroext i1 @b2WakeBody(ptr noundef %318, ptr noundef %319)
  %321 = load ptr, ptr %4, align 8, !tbaa !5
  %322 = load ptr, ptr %13, align 8, !tbaa !5
  %323 = call zeroext i1 @b2WakeBody(ptr noundef %321, ptr noundef %322)
  br label %324

324:                                              ; preds = %317, %303
  %325 = load ptr, ptr %4, align 8, !tbaa !5
  call void @b2ValidateSolverSets(ptr noundef %325)
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  ret void
}

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

declare void @b2UnlinkJoint(ptr noundef, ptr noundef) #2

declare void @b2RemoveJointFromGraph(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #2

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

declare void @b2FreeId(ptr noundef, i32 noundef) #2

declare zeroext i1 @b2WakeBody(ptr noundef, ptr noundef) #2

declare void @b2ValidateSolverSets(ptr noundef) #2

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"_Bool", !7, i64 0}
!11 = !{!12, !13, i64 44}
!12 = !{!"b2Joint", !6, i64 0, !13, i64 8, !13, i64 12, !13, i64 16, !7, i64 20, !13, i64 44, !13, i64 48, !13, i64 52, !13, i64 56, !14, i64 60, !13, i64 64, !15, i64 68, !10, i64 70, !10, i64 71}
!13 = !{!"int", !7, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = !{!"short", !7, i64 0}
!16 = !{!13, !13, i64 0}
!17 = !{!18, !13, i64 0}
!18 = !{!"b2JointEdge", !13, i64 0, !13, i64 4, !13, i64 8}
!19 = !{!18, !13, i64 4}
!20 = !{!18, !13, i64 8}
!21 = !{!22, !13, i64 68}
!22 = !{!"b2Body", !7, i64 0, !6, i64 32, !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, !14, i64 88, !14, i64 92, !14, i64 96, !14, i64 100, !13, i64 104, !13, i64 108, !13, i64 112, !15, i64 116, !10, i64 118, !10, i64 119, !10, i64 120, !10, i64 121}
!23 = !{!22, !13, i64 72}
!24 = !{!12, !13, i64 48}
!25 = !{!12, !13, i64 8}
!26 = !{!12, !13, i64 16}
!27 = !{!12, !13, i64 12}
!28 = !{!29, !6, i64 32}
!29 = !{!"b2SolverSet", !30, i64 0, !30, i64 16, !30, i64 32, !30, i64 48, !30, i64 64, !13, i64 80}
!30 = !{!"", !6, i64 0, !13, i64 8, !13, i64 12}
!31 = !{!32, !13, i64 0}
!32 = !{!"b2JointSim", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !33, i64 16, !33, i64 24, !14, i64 32, !14, i64 36, !14, i64 40, !14, i64 44, !7, i64 48}
!33 = !{!"b2Vec2", !14, i64 0, !14, i64 4}
!34 = !{i8 0, i8 2}
!35 = !{}


; 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 }
%struct.b2JointSim = type { i32, i32, i32, i32, %struct.b2Vec2, %struct.b2Vec2, float, float, float, float, %union.anon.0 }
%struct.b2Vec2 = type { float, float }
%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 }

@.str.1 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [37 x i8], align 1

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @b2JointArray_Get(ptr noundef, i32 noundef) 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 @b2SolverSetArray_Get(ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @b2DestroyJointInternal(ptr noundef %0, ptr noundef %1, i1 noundef zeroext %2) local_unnamed_addr #3 {
  %4 = getelementptr inbounds i8, ptr %1, i64 44
  %5 = load i32, ptr %4, align 4, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %1, i64 20
  %7 = getelementptr inbounds i8, ptr %1, i64 32
  %8 = load i32, ptr %6, align 4, !tbaa !14
  %9 = load i32, ptr %7, align 4, !tbaa !14
  %10 = getelementptr inbounds i8, ptr %0, i64 1032
  %11 = tail call ptr @b2BodyArray_Get(ptr noundef nonnull %10, i32 noundef %8)
  %12 = tail call ptr @b2BodyArray_Get(ptr noundef nonnull %10, i32 noundef %9)
  %13 = getelementptr inbounds i8, ptr %1, i64 24
  %14 = load i32, ptr %13, align 4, !tbaa !16
  %.not = icmp eq i32 %14, -1
  br i1 %.not, label %._crit_edge, label %15

._crit_edge:                                      ; preds = %3
  %.phi.trans.insert = getelementptr inbounds i8, ptr %1, i64 28
  %.pre = load i32, ptr %.phi.trans.insert, align 4, !tbaa !17
  br label %26

15:                                               ; preds = %3
  %16 = getelementptr inbounds i8, ptr %0, i64 1112
  %17 = ashr i32 %14, 1
  %18 = tail call ptr @b2JointArray_Get(ptr noundef nonnull %16, i32 noundef %17)
  %19 = getelementptr inbounds i8, ptr %18, i64 20
  %20 = load i32, ptr %13, align 4, !tbaa !16
  %21 = and i32 %20, 1
  %22 = zext nneg i32 %21 to i64
  %23 = getelementptr inbounds i8, ptr %1, i64 28
  %24 = load i32, ptr %23, align 4, !tbaa !17
  %25 = getelementptr inbounds %struct.b2JointEdge, ptr %19, i64 %22, i32 2
  store i32 %24, ptr %25, align 4, !tbaa !17
  br label %26

26:                                               ; preds = %._crit_edge, %15
  %27 = phi i32 [ %.pre, %._crit_edge ], [ %24, %15 ]
  %.not92 = icmp eq i32 %27, -1
  br i1 %.not92, label %39, label %28

28:                                               ; preds = %26
  %29 = getelementptr inbounds i8, ptr %1, i64 28
  %30 = getelementptr inbounds i8, ptr %0, i64 1112
  %31 = ashr i32 %27, 1
  %32 = tail call ptr @b2JointArray_Get(ptr noundef nonnull %30, i32 noundef %31)
  %33 = getelementptr inbounds i8, ptr %32, i64 20
  %34 = load i32, ptr %29, align 4, !tbaa !17
  %35 = and i32 %34, 1
  %36 = zext nneg i32 %35 to i64
  %37 = load i32, ptr %13, align 4, !tbaa !16
  %38 = getelementptr inbounds %struct.b2JointEdge, ptr %33, i64 %36, i32 1
  store i32 %37, ptr %38, align 4, !tbaa !16
  br label %39

39:                                               ; preds = %28, %26
  %40 = phi i32 [ %34, %28 ], [ -1, %26 ]
  %41 = shl i32 %5, 1
  %42 = getelementptr inbounds i8, ptr %11, i64 68
  %43 = load i32, ptr %42, align 4, !tbaa !18
  %44 = icmp eq i32 %43, %41
  br i1 %44, label %45, label %46

45:                                               ; preds = %39
  store i32 %40, ptr %42, align 4, !tbaa !18
  br label %46

46:                                               ; preds = %45, %39
  %47 = getelementptr inbounds i8, ptr %11, i64 72
  %48 = load i32, ptr %47, align 8, !tbaa !20
  %49 = add nsw i32 %48, -1
  store i32 %49, ptr %47, align 8, !tbaa !20
  %50 = getelementptr inbounds i8, ptr %1, i64 36
  %51 = load i32, ptr %50, align 4, !tbaa !16
  %.not93 = icmp eq i32 %51, -1
  br i1 %.not93, label %._crit_edge100, label %52

._crit_edge100:                                   ; preds = %46
  %.phi.trans.insert101 = getelementptr inbounds i8, ptr %1, i64 40
  %.pre102 = load i32, ptr %.phi.trans.insert101, align 4, !tbaa !17
  br label %63

52:                                               ; preds = %46
  %53 = getelementptr inbounds i8, ptr %0, i64 1112
  %54 = ashr i32 %51, 1
  %55 = tail call ptr @b2JointArray_Get(ptr noundef nonnull %53, i32 noundef %54)
  %56 = getelementptr inbounds i8, ptr %55, i64 20
  %57 = load i32, ptr %50, align 4, !tbaa !16
  %58 = and i32 %57, 1
  %59 = zext nneg i32 %58 to i64
  %60 = getelementptr inbounds i8, ptr %1, i64 40
  %61 = load i32, ptr %60, align 4, !tbaa !17
  %62 = getelementptr inbounds %struct.b2JointEdge, ptr %56, i64 %59, i32 2
  store i32 %61, ptr %62, align 4, !tbaa !17
  br label %63

63:                                               ; preds = %._crit_edge100, %52
  %64 = phi i32 [ %.pre102, %._crit_edge100 ], [ %61, %52 ]
  %.not94 = icmp eq i32 %64, -1
  br i1 %.not94, label %76, label %65

65:                                               ; preds = %63
  %66 = getelementptr inbounds i8, ptr %1, i64 40
  %67 = getelementptr inbounds i8, ptr %0, i64 1112
  %68 = ashr i32 %64, 1
  %69 = tail call ptr @b2JointArray_Get(ptr noundef nonnull %67, i32 noundef %68)
  %70 = getelementptr inbounds i8, ptr %69, i64 20
  %71 = load i32, ptr %66, align 4, !tbaa !17
  %72 = and i32 %71, 1
  %73 = zext nneg i32 %72 to i64
  %74 = load i32, ptr %50, align 4, !tbaa !16
  %75 = getelementptr inbounds %struct.b2JointEdge, ptr %70, i64 %73, i32 1
  store i32 %74, ptr %75, align 4, !tbaa !16
  br label %76

76:                                               ; preds = %65, %63
  %77 = phi i32 [ %71, %65 ], [ -1, %63 ]
  %78 = or disjoint i32 %41, 1
  %79 = getelementptr inbounds i8, ptr %12, i64 68
  %80 = load i32, ptr %79, align 4, !tbaa !18
  %81 = icmp eq i32 %80, %78
  br i1 %81, label %82, label %83

82:                                               ; preds = %76
  store i32 %77, ptr %79, align 4, !tbaa !18
  br label %83

83:                                               ; preds = %82, %76
  %84 = getelementptr inbounds i8, ptr %12, i64 72
  %85 = load i32, ptr %84, align 8, !tbaa !20
  %86 = add nsw i32 %85, -1
  store i32 %86, ptr %84, align 8, !tbaa !20
  %87 = getelementptr inbounds i8, ptr %1, i64 48
  %88 = load i32, ptr %87, align 8, !tbaa !21
  %.not95 = icmp eq i32 %88, -1
  %89 = getelementptr inbounds i8, ptr %1, i64 8
  %90 = load i32, ptr %89, align 8, !tbaa !22
  br i1 %.not95, label %97, label %91

91:                                               ; preds = %83
  %92 = icmp sgt i32 %90, 1
  br i1 %92, label %96, label %93

93:                                               ; preds = %91
  %94 = tail call i32 @b2InternalAssertFcn(ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.1, i32 noundef 764) #4
  %.not97 = icmp eq i32 %94, 0
  br i1 %.not97, label %96, label %95

95:                                               ; preds = %93
  tail call void @llvm.trap()
  unreachable

96:                                               ; preds = %93, %91
  tail call void @b2UnlinkJoint(ptr noundef %0, ptr noundef nonnull %1) #4
  br label %102

97:                                               ; preds = %83
  %98 = icmp slt i32 %90, 2
  br i1 %98, label %102, label %99

99:                                               ; preds = %97
  %100 = tail call i32 @b2InternalAssertFcn(ptr noundef nonnull @.str.15, ptr noundef nonnull @.str.1, i32 noundef 769) #4
  %.not96 = icmp eq i32 %100, 0
  br i1 %.not96, label %102, label %101

101:                                              ; preds = %99
  tail call void @llvm.trap()
  unreachable

102:                                              ; preds = %97, %99, %96
  %103 = getelementptr inbounds i8, ptr %1, i64 8
  %104 = load i32, ptr %103, align 8, !tbaa !22
  %105 = getelementptr inbounds i8, ptr %1, i64 16
  %106 = load i32, ptr %105, align 8, !tbaa !23
  %107 = icmp eq i32 %104, 2
  br i1 %107, label %108, label %113

108:                                              ; preds = %102
  %109 = load i32, ptr %6, align 4, !tbaa !14
  %110 = load i32, ptr %7, align 4, !tbaa !14
  %111 = getelementptr inbounds i8, ptr %1, i64 12
  %112 = load i32, ptr %111, align 4, !tbaa !24
  tail call void @b2RemoveJointFromGraph(ptr noundef %0, i32 noundef %109, i32 noundef %110, i32 noundef %112, i32 noundef %106) #4
  br label %132

113:                                              ; preds = %102
  %114 = getelementptr inbounds i8, ptr %0, i64 1072
  %115 = tail call ptr @b2SolverSetArray_Get(ptr noundef nonnull %114, i32 noundef %104)
  %116 = getelementptr inbounds i8, ptr %115, i64 32
  %117 = tail call i32 @b2JointSimArray_RemoveSwap(ptr noundef nonnull %116, i32 noundef %106)
  %.not98 = icmp eq i32 %117, -1
  br i1 %.not98, label %132, label %118

118:                                              ; preds = %113
  %119 = load ptr, ptr %116, align 8, !tbaa !25
  %120 = sext i32 %106 to i64
  %121 = getelementptr inbounds %struct.b2JointSim, ptr %119, i64 %120
  %122 = load i32, ptr %121, align 4, !tbaa !28
  %123 = getelementptr inbounds i8, ptr %0, i64 1112
  %124 = tail call ptr @b2JointArray_Get(ptr noundef nonnull %123, i32 noundef %122)
  %125 = getelementptr inbounds i8, ptr %124, i64 16
  %126 = load i32, ptr %125, align 8, !tbaa !23
  %127 = icmp eq i32 %126, %117
  br i1 %127, label %131, label %128

128:                                              ; preds = %118
  %129 = tail call i32 @b2InternalAssertFcn(ptr noundef nonnull @.str.16, ptr noundef nonnull @.str.1, i32 noundef 790) #4
  %.not99 = icmp eq i32 %129, 0
  br i1 %.not99, label %131, label %130

130:                                              ; preds = %128
  tail call void @llvm.trap()
  unreachable

131:                                              ; preds = %128, %118
  store i32 %106, ptr %125, align 8, !tbaa !23
  br label %132

132:                                              ; preds = %113, %131, %108
  store i32 -1, ptr %103, align 8, !tbaa !22
  store i32 -1, ptr %105, align 8, !tbaa !23
  %133 = getelementptr inbounds i8, ptr %1, i64 12
  store i32 -1, ptr %133, align 4, !tbaa !24
  store i32 -1, ptr %4, align 4, !tbaa !5
  %134 = getelementptr inbounds i8, ptr %0, i64 1088
  tail call void @b2FreeId(ptr noundef nonnull %134, i32 noundef %5) #4
  br i1 %2, label %135, label %138

135:                                              ; preds = %132
  %136 = tail call zeroext i1 @b2WakeBody(ptr noundef %0, ptr noundef nonnull %11) #4
  %137 = tail call zeroext i1 @b2WakeBody(ptr noundef %0, ptr noundef nonnull %12) #4
  br label %138

138:                                              ; preds = %135, %132
  tail call void @b2ValidateSolverSets(ptr noundef %0) #4
  ret void
}

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

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

declare void @b2RemoveJointFromGraph(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

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

declare void @b2FreeId(ptr noundef, i32 noundef) local_unnamed_addr #1

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

declare void @b2ValidateSolverSets(ptr noundef) local_unnamed_addr #1

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !10, i64 44}
!6 = !{!"b2Joint", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !8, 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}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{!"short", !8, i64 0}
!13 = !{!"_Bool", !8, i64 0}
!14 = !{!15, !10, i64 0}
!15 = !{!"b2JointEdge", !10, i64 0, !10, i64 4, !10, i64 8}
!16 = !{!15, !10, i64 4}
!17 = !{!15, !10, i64 8}
!18 = !{!19, !10, i64 68}
!19 = !{!"b2Body", !8, i64 0, !7, 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}
!20 = !{!19, !10, i64 72}
!21 = !{!6, !10, i64 48}
!22 = !{!6, !10, i64 8}
!23 = !{!6, !10, i64 16}
!24 = !{!6, !10, i64 12}
!25 = !{!26, !7, i64 32}
!26 = !{!"b2SolverSet", !27, i64 0, !27, i64 16, !27, i64 32, !27, i64 48, !27, i64 64, !10, i64 80}
!27 = !{!"", !7, i64 0, !10, i64 8, !10, i64 12}
!28 = !{!29, !10, i64 0}
!29 = !{!"b2JointSim", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !30, i64 16, !30, i64 24, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !8, i64 48}
!30 = !{!"b2Vec2", !11, i64 0, !11, i64 4}


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