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

; 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.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.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.b2BodySim = type { %struct.b2Transform, %struct.b2Vec2, %struct.b2Rot, %struct.b2Vec2, %struct.b2Vec2, %struct.b2Vec2, float, float, float, float, float, float, float, float, i32, i8, i8, i8, i8, i8 }
%struct.b2Transform = type { %struct.b2Vec2, %struct.b2Rot }
%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.b2ContactSim = type { i32, i32, i32, i32, i32, float, float, float, float, %struct.b2Manifold, float, float, float, float, i32, %struct.b2SimplexCache }
%struct.b2Manifold = type { %struct.b2Vec2, float, [2 x %struct.b2ManifoldPoint], i32 }
%struct.b2ManifoldPoint = type { %struct.b2Vec2, %struct.b2Vec2, %struct.b2Vec2, float, float, float, float, float, i16, i8 }
%struct.b2SimplexCache = type { i16, [3 x i8], [3 x i8] }
%struct.b2Contact = type { i32, i32, i32, [2 x %struct.b2ContactEdge], i32, i32, i32, i32, i32, i32, i32, i8 }
%struct.b2ContactEdge = type { i32, 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 }
%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.b2IslandSim = type { i32 }
%struct.b2Island = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }

@.str.1 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [26 x i8], align 1

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

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

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

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

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

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @b2BodySimArray_Add(ptr noundef) #2

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @b2ContactSimArray_Add(ptr noundef) #2

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @b2IslandSimArray_Add(ptr noundef) #2

declare void @b2ValidateSolverSets(ptr noundef) #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @b2JointSimArray_Add(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @b2MergeSolverSets(ptr noundef %0, i32 noundef %1, i32 noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca ptr, align 8
  %25 = alloca ptr, align 8
  %26 = alloca ptr, align 8
  %27 = alloca i32, align 4
  %28 = alloca i32, align 4
  %29 = alloca ptr, align 8
  %30 = alloca i32, align 4
  %31 = alloca ptr, align 8
  %32 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !9
  br label %33

33:                                               ; preds = %3
  %34 = load i32, ptr %5, align 4, !tbaa !9
  %35 = icmp sge i32 %34, 3
  br i1 %35, label %40, label %36

36:                                               ; preds = %33
  %37 = call i32 @b2InternalAssertFcn(ptr noundef @.str.29, ptr noundef @.str.1, i32 noundef 429)
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %39, label %40

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

40:                                               ; preds = %39, %36, %33
  br label %41

41:                                               ; preds = %40
  br label %42

42:                                               ; preds = %41
  %43 = load i32, ptr %6, align 4, !tbaa !9
  %44 = icmp sge i32 %43, 3
  br i1 %44, label %49, label %45

45:                                               ; preds = %42
  %46 = call i32 @b2InternalAssertFcn(ptr noundef @.str.30, ptr noundef @.str.1, i32 noundef 430)
  %47 = icmp ne i32 %46, 0
  br i1 %47, label %48, label %49

48:                                               ; preds = %45
  call void @llvm.trap()
  br label %49

49:                                               ; preds = %48, %45, %42
  br label %50

50:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.b2World, ptr %51, i32 0, i32 6
  %53 = load i32, ptr %5, align 4, !tbaa !9
  %54 = call ptr @b2SolverSetArray_Get(ptr noundef %52, i32 noundef %53)
  store ptr %54, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.b2World, ptr %55, i32 0, i32 6
  %57 = load i32, ptr %6, align 4, !tbaa !9
  %58 = call ptr @b2SolverSetArray_Get(ptr noundef %56, i32 noundef %57)
  store ptr %58, ptr %8, align 8, !tbaa !5
  %59 = load ptr, ptr %7, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.b2SolverSet, ptr %59, i32 0, i32 0
  %61 = getelementptr inbounds %struct.b2BodySimArray, ptr %60, i32 0, i32 1
  %62 = load i32, ptr %61, align 8, !tbaa !11
  %63 = load ptr, ptr %8, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.b2SolverSet, ptr %63, i32 0, i32 0
  %65 = getelementptr inbounds %struct.b2BodySimArray, ptr %64, i32 0, i32 1
  %66 = load i32, ptr %65, align 8, !tbaa !11
  %67 = icmp slt i32 %62, %66
  br i1 %67, label %68, label %75

68:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %69 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %69, ptr %9, align 8, !tbaa !5
  %70 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %70, ptr %7, align 8, !tbaa !5
  %71 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %71, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %72 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %72, ptr %10, align 4, !tbaa !9
  %73 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %73, ptr %5, align 4, !tbaa !9
  %74 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %74, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %75

75:                                               ; preds = %68, %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.b2World, ptr %76, i32 0, i32 4
  %78 = getelementptr inbounds %struct.b2BodyArray, ptr %77, i32 0, i32 0
  %79 = load ptr, ptr %78, align 8, !tbaa !14
  store ptr %79, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %80 = load ptr, ptr %8, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.b2SolverSet, ptr %80, i32 0, i32 0
  %82 = getelementptr inbounds %struct.b2BodySimArray, ptr %81, i32 0, i32 1
  %83 = load i32, ptr %82, align 8, !tbaa !11
  store i32 %83, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %84

84:                                               ; preds = %130, %75
  %85 = load i32, ptr %13, align 4, !tbaa !9
  %86 = load i32, ptr %12, align 4, !tbaa !9
  %87 = icmp slt i32 %85, %86
  br i1 %87, label %89, label %88

88:                                               ; preds = %84
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %133

89:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %90 = load ptr, ptr %8, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.b2SolverSet, ptr %90, i32 0, i32 0
  %92 = getelementptr inbounds %struct.b2BodySimArray, ptr %91, i32 0, i32 0
  %93 = load ptr, ptr %92, align 8, !tbaa !29
  %94 = load i32, ptr %13, align 4, !tbaa !9
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds %struct.b2BodySim, ptr %93, i64 %95
  store ptr %96, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %97 = load ptr, ptr %11, align 8, !tbaa !5
  %98 = load ptr, ptr %14, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.b2BodySim, ptr %98, i32 0, i32 14
  %100 = load i32, ptr %99, align 4, !tbaa !30
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds %struct.b2Body, ptr %97, i64 %101
  store ptr %102, ptr %15, align 8, !tbaa !5
  br label %103

103:                                              ; preds = %89
  %104 = load ptr, ptr %15, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.b2Body, ptr %104, i32 0, i32 2
  %106 = load i32, ptr %105, align 8, !tbaa !34
  %107 = load i32, ptr %6, align 4, !tbaa !9
  %108 = icmp eq i32 %106, %107
  br i1 %108, label %113, label %109

109:                                              ; preds = %103
  %110 = call i32 @b2InternalAssertFcn(ptr noundef @.str.31, ptr noundef @.str.1, i32 noundef 455)
  %111 = icmp ne i32 %110, 0
  br i1 %111, label %112, label %113

112:                                              ; preds = %109
  call void @llvm.trap()
  br label %113

113:                                              ; preds = %112, %109, %103
  br label %114

114:                                              ; preds = %113
  br label %115

115:                                              ; preds = %114
  %116 = load i32, ptr %5, align 4, !tbaa !9
  %117 = load ptr, ptr %15, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.b2Body, ptr %117, i32 0, i32 2
  store i32 %116, ptr %118, align 8, !tbaa !34
  %119 = load ptr, ptr %7, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.b2SolverSet, ptr %119, i32 0, i32 0
  %121 = getelementptr inbounds %struct.b2BodySimArray, ptr %120, i32 0, i32 1
  %122 = load i32, ptr %121, align 8, !tbaa !11
  %123 = load ptr, ptr %15, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.b2Body, ptr %123, i32 0, i32 3
  store i32 %122, ptr %124, align 4, !tbaa !36
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %125 = load ptr, ptr %7, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.b2SolverSet, ptr %125, i32 0, i32 0
  %127 = call ptr @b2BodySimArray_Add(ptr noundef %126)
  store ptr %127, ptr %16, align 8, !tbaa !5
  %128 = load ptr, ptr %16, align 8, !tbaa !5
  %129 = load ptr, ptr %14, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %128, ptr align 4 %129, i64 100, i1 false)
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %130

130:                                              ; preds = %115
  %131 = load i32, ptr %13, align 4, !tbaa !9
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %13, align 4, !tbaa !9
  br label %84, !llvm.loop !37

133:                                              ; preds = %88
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  %134 = load ptr, ptr %8, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.b2SolverSet, ptr %134, i32 0, i32 3
  %136 = getelementptr inbounds %struct.b2ContactSimArray, ptr %135, i32 0, i32 1
  %137 = load i32, ptr %136, align 8, !tbaa !39
  store i32 %137, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %138

138:                                              ; preds = %184, %133
  %139 = load i32, ptr %18, align 4, !tbaa !9
  %140 = load i32, ptr %17, align 4, !tbaa !9
  %141 = icmp slt i32 %139, %140
  br i1 %141, label %143, label %142

142:                                              ; preds = %138
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %187

143:                                              ; preds = %138
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  %144 = load ptr, ptr %8, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.b2SolverSet, ptr %144, i32 0, i32 3
  %146 = getelementptr inbounds %struct.b2ContactSimArray, ptr %145, i32 0, i32 0
  %147 = load ptr, ptr %146, align 8, !tbaa !40
  %148 = load i32, ptr %18, align 4, !tbaa !9
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds %struct.b2ContactSim, ptr %147, i64 %149
  store ptr %150, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  %151 = load ptr, ptr %4, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.b2World, ptr %151, i32 0, i32 10
  %153 = load ptr, ptr %19, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.b2ContactSim, ptr %153, i32 0, i32 0
  %155 = load i32, ptr %154, align 4, !tbaa !41
  %156 = call ptr @b2ContactArray_Get(ptr noundef %152, i32 noundef %155)
  store ptr %156, ptr %20, align 8, !tbaa !5
  br label %157

157:                                              ; preds = %143
  %158 = load ptr, ptr %20, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.b2Contact, ptr %158, i32 0, i32 0
  %160 = load i32, ptr %159, align 4, !tbaa !45
  %161 = load i32, ptr %6, align 4, !tbaa !9
  %162 = icmp eq i32 %160, %161
  br i1 %162, label %167, label %163

163:                                              ; preds = %157
  %164 = call i32 @b2InternalAssertFcn(ptr noundef @.str.32, ptr noundef @.str.1, i32 noundef 472)
  %165 = icmp ne i32 %164, 0
  br i1 %165, label %166, label %167

166:                                              ; preds = %163
  call void @llvm.trap()
  br label %167

167:                                              ; preds = %166, %163, %157
  br label %168

168:                                              ; preds = %167
  br label %169

169:                                              ; preds = %168
  %170 = load i32, ptr %5, align 4, !tbaa !9
  %171 = load ptr, ptr %20, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.b2Contact, ptr %171, i32 0, i32 0
  store i32 %170, ptr %172, align 4, !tbaa !45
  %173 = load ptr, ptr %7, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.b2SolverSet, ptr %173, i32 0, i32 3
  %175 = getelementptr inbounds %struct.b2ContactSimArray, ptr %174, i32 0, i32 1
  %176 = load i32, ptr %175, align 8, !tbaa !39
  %177 = load ptr, ptr %20, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.b2Contact, ptr %177, i32 0, i32 2
  store i32 %176, ptr %178, align 4, !tbaa !47
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %179 = load ptr, ptr %7, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct.b2SolverSet, ptr %179, i32 0, i32 3
  %181 = call ptr @b2ContactSimArray_Add(ptr noundef %180)
  store ptr %181, ptr %21, align 8, !tbaa !5
  %182 = load ptr, ptr %21, align 8, !tbaa !5
  %183 = load ptr, ptr %19, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %182, ptr align 4 %183, i64 176, i1 false)
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  br label %184

184:                                              ; preds = %169
  %185 = load i32, ptr %18, align 4, !tbaa !9
  %186 = add nsw i32 %185, 1
  store i32 %186, ptr %18, align 4, !tbaa !9
  br label %138, !llvm.loop !48

187:                                              ; preds = %142
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  %188 = load ptr, ptr %8, align 8, !tbaa !5
  %189 = getelementptr inbounds %struct.b2SolverSet, ptr %188, i32 0, i32 2
  %190 = getelementptr inbounds %struct.b2JointSimArray, ptr %189, i32 0, i32 1
  %191 = load i32, ptr %190, align 8, !tbaa !49
  store i32 %191, ptr %22, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #6
  store i32 0, ptr %23, align 4, !tbaa !9
  br label %192

192:                                              ; preds = %238, %187
  %193 = load i32, ptr %23, align 4, !tbaa !9
  %194 = load i32, ptr %22, align 4, !tbaa !9
  %195 = icmp slt i32 %193, %194
  br i1 %195, label %197, label %196

196:                                              ; preds = %192
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  br label %241

197:                                              ; preds = %192
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #6
  %198 = load ptr, ptr %8, align 8, !tbaa !5
  %199 = getelementptr inbounds %struct.b2SolverSet, ptr %198, i32 0, i32 2
  %200 = getelementptr inbounds %struct.b2JointSimArray, ptr %199, i32 0, i32 0
  %201 = load ptr, ptr %200, align 8, !tbaa !50
  %202 = load i32, ptr %23, align 4, !tbaa !9
  %203 = sext i32 %202 to i64
  %204 = getelementptr inbounds %struct.b2JointSim, ptr %201, i64 %203
  store ptr %204, ptr %24, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #6
  %205 = load ptr, ptr %4, align 8, !tbaa !5
  %206 = getelementptr inbounds %struct.b2World, ptr %205, i32 0, i32 8
  %207 = load ptr, ptr %24, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct.b2JointSim, ptr %207, i32 0, i32 0
  %209 = load i32, ptr %208, align 4, !tbaa !51
  %210 = call ptr @b2JointArray_Get(ptr noundef %206, i32 noundef %209)
  store ptr %210, ptr %25, align 8, !tbaa !5
  br label %211

211:                                              ; preds = %197
  %212 = load ptr, ptr %25, align 8, !tbaa !5
  %213 = getelementptr inbounds %struct.b2Joint, ptr %212, i32 0, i32 1
  %214 = load i32, ptr %213, align 8, !tbaa !53
  %215 = load i32, ptr %6, align 4, !tbaa !9
  %216 = icmp eq i32 %214, %215
  br i1 %216, label %221, label %217

217:                                              ; preds = %211
  %218 = call i32 @b2InternalAssertFcn(ptr noundef @.str.33, ptr noundef @.str.1, i32 noundef 489)
  %219 = icmp ne i32 %218, 0
  br i1 %219, label %220, label %221

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

221:                                              ; preds = %220, %217, %211
  br label %222

222:                                              ; preds = %221
  br label %223

223:                                              ; preds = %222
  %224 = load i32, ptr %5, align 4, !tbaa !9
  %225 = load ptr, ptr %25, align 8, !tbaa !5
  %226 = getelementptr inbounds %struct.b2Joint, ptr %225, i32 0, i32 1
  store i32 %224, ptr %226, align 8, !tbaa !53
  %227 = load ptr, ptr %7, align 8, !tbaa !5
  %228 = getelementptr inbounds %struct.b2SolverSet, ptr %227, i32 0, i32 2
  %229 = getelementptr inbounds %struct.b2JointSimArray, ptr %228, i32 0, i32 1
  %230 = load i32, ptr %229, align 8, !tbaa !49
  %231 = load ptr, ptr %25, align 8, !tbaa !5
  %232 = getelementptr inbounds %struct.b2Joint, ptr %231, i32 0, i32 3
  store i32 %230, ptr %232, align 8, !tbaa !55
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #6
  %233 = load ptr, ptr %7, align 8, !tbaa !5
  %234 = getelementptr inbounds %struct.b2SolverSet, ptr %233, i32 0, i32 2
  %235 = call ptr @b2JointSimArray_Add(ptr noundef %234)
  store ptr %235, ptr %26, align 8, !tbaa !5
  %236 = load ptr, ptr %26, align 8, !tbaa !5
  %237 = load ptr, ptr %24, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %236, ptr align 4 %237, i64 172, i1 false)
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  br label %238

238:                                              ; preds = %223
  %239 = load i32, ptr %23, align 4, !tbaa !9
  %240 = add nsw i32 %239, 1
  store i32 %240, ptr %23, align 4, !tbaa !9
  br label %192, !llvm.loop !56

241:                                              ; preds = %196
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #6
  %242 = load ptr, ptr %8, align 8, !tbaa !5
  %243 = getelementptr inbounds %struct.b2SolverSet, ptr %242, i32 0, i32 4
  %244 = getelementptr inbounds %struct.b2IslandSimArray, ptr %243, i32 0, i32 1
  %245 = load i32, ptr %244, align 8, !tbaa !57
  store i32 %245, ptr %27, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #6
  store i32 0, ptr %28, align 4, !tbaa !9
  br label %246

246:                                              ; preds = %280, %241
  %247 = load i32, ptr %28, align 4, !tbaa !9
  %248 = load i32, ptr %27, align 4, !tbaa !9
  %249 = icmp slt i32 %247, %248
  br i1 %249, label %251, label %250

250:                                              ; preds = %246
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #6
  br label %283

251:                                              ; preds = %246
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #6
  %252 = load ptr, ptr %8, align 8, !tbaa !5
  %253 = getelementptr inbounds %struct.b2SolverSet, ptr %252, i32 0, i32 4
  %254 = getelementptr inbounds %struct.b2IslandSimArray, ptr %253, i32 0, i32 0
  %255 = load ptr, ptr %254, align 8, !tbaa !58
  %256 = load i32, ptr %28, align 4, !tbaa !9
  %257 = sext i32 %256 to i64
  %258 = getelementptr inbounds %struct.b2IslandSim, ptr %255, i64 %257
  store ptr %258, ptr %29, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #6
  %259 = load ptr, ptr %29, align 8, !tbaa !5
  %260 = getelementptr inbounds %struct.b2IslandSim, ptr %259, i32 0, i32 0
  %261 = load i32, ptr %260, align 4, !tbaa !59
  store i32 %261, ptr %30, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #6
  %262 = load ptr, ptr %4, align 8, !tbaa !5
  %263 = getelementptr inbounds %struct.b2World, ptr %262, i32 0, i32 12
  %264 = load i32, ptr %30, align 4, !tbaa !9
  %265 = call ptr @b2IslandArray_Get(ptr noundef %263, i32 noundef %264)
  store ptr %265, ptr %31, align 8, !tbaa !5
  %266 = load i32, ptr %5, align 4, !tbaa !9
  %267 = load ptr, ptr %31, align 8, !tbaa !5
  %268 = getelementptr inbounds %struct.b2Island, ptr %267, i32 0, i32 0
  store i32 %266, ptr %268, align 4, !tbaa !61
  %269 = load ptr, ptr %7, align 8, !tbaa !5
  %270 = getelementptr inbounds %struct.b2SolverSet, ptr %269, i32 0, i32 4
  %271 = getelementptr inbounds %struct.b2IslandSimArray, ptr %270, i32 0, i32 1
  %272 = load i32, ptr %271, align 8, !tbaa !57
  %273 = load ptr, ptr %31, align 8, !tbaa !5
  %274 = getelementptr inbounds %struct.b2Island, ptr %273, i32 0, i32 1
  store i32 %272, ptr %274, align 4, !tbaa !63
  call void @llvm.lifetime.start.p0(i64 8, ptr %32) #6
  %275 = load ptr, ptr %7, align 8, !tbaa !5
  %276 = getelementptr inbounds %struct.b2SolverSet, ptr %275, i32 0, i32 4
  %277 = call ptr @b2IslandSimArray_Add(ptr noundef %276)
  store ptr %277, ptr %32, align 8, !tbaa !5
  %278 = load ptr, ptr %32, align 8, !tbaa !5
  %279 = load ptr, ptr %29, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %278, ptr align 4 %279, i64 4, i1 false)
  call void @llvm.lifetime.end.p0(i64 8, ptr %32) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #6
  br label %280

280:                                              ; preds = %251
  %281 = load i32, ptr %28, align 4, !tbaa !9
  %282 = add nsw i32 %281, 1
  store i32 %282, ptr %28, align 4, !tbaa !9
  br label %246, !llvm.loop !64

283:                                              ; preds = %250
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #6
  %284 = load ptr, ptr %4, align 8, !tbaa !5
  %285 = load i32, ptr %6, align 4, !tbaa !9
  call void @b2DestroySolverSet(ptr noundef %284, i32 noundef %285)
  %286 = load ptr, ptr %4, align 8, !tbaa !5
  call void @b2ValidateSolverSets(ptr noundef %286)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { "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 = { cold noreturn nounwind memory(inaccessiblemem: write) }
attributes #6 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"b2SolverSet", !13, i64 0, !13, i64 16, !13, i64 32, !13, i64 48, !13, i64 64, !10, i64 80}
!13 = !{!"", !6, i64 0, !10, i64 8, !10, i64 12}
!14 = !{!15, !6, i64 1032}
!15 = !{!"b2World", !16, i64 0, !17, i64 40, !20, i64 336, !21, i64 1008, !13, i64 1032, !21, i64 1048, !13, i64 1072, !21, i64 1088, !13, i64 1112, !21, i64 1128, !13, i64 1152, !21, i64 1168, !13, i64 1192, !21, i64 1208, !21, i64 1232, !13, i64 1256, !13, i64 1272, !13, i64 1288, !13, i64 1304, !13, i64 1320, !13, i64 1336, !13, i64 1352, !13, i64 1368, !7, i64 1384, !7, i64 1416, !10, i64 1448, !13, i64 1456, !22, i64 1472, !22, i64 1488, !22, i64 1504, !22, i64 1520, !23, i64 1536, !10, i64 1544, !24, i64 1548, !25, i64 1556, !25, i64 1560, !25, i64 1564, !25, i64 1568, !25, i64 1572, !25, i64 1576, !25, i64 1580, !25, i64 1584, !6, i64 1592, !6, i64 1600, !26, i64 1608, !27, i64 1612, !6, i64 1704, !6, i64 1712, !6, i64 1720, !6, i64 1728, !10, i64 1736, !6, i64 1744, !6, i64 1752, !6, i64 1760, !6, i64 1768, !6, i64 1776, !25, i64 1784, !10, i64 1788, !10, i64 1792, !26, i64 1796, !28, i64 1798, !28, i64 1799, !28, i64 1800, !28, i64 1801, !28, i64 1802, !28, i64 1803}
!16 = !{!"b2ArenaAllocator", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !13, i64 24}
!17 = !{!"b2BroadPhase", !7, i64 0, !10, i64 216, !18, i64 224, !13, i64 240, !6, i64 256, !6, i64 264, !10, i64 272, !19, i64 276, !18, i64 280}
!18 = !{!"b2HashSet", !6, i64 0, !10, i64 8, !10, i64 12}
!19 = !{!"b2AtomicInt", !10, i64 0}
!20 = !{!"b2ConstraintGraph", !7, i64 0}
!21 = !{!"b2IdPool", !13, i64 0, !10, i64 16}
!22 = !{!"b2BitSet", !6, i64 0, !10, i64 8, !10, i64 12}
!23 = !{!"long", !7, i64 0}
!24 = !{!"b2Vec2", !25, i64 0, !25, i64 4}
!25 = !{!"float", !7, i64 0}
!26 = !{!"short", !7, i64 0}
!27 = !{!"b2Profile", !25, i64 0, !25, i64 4, !25, i64 8, !25, i64 12, !25, i64 16, !25, i64 20, !25, i64 24, !25, i64 28, !25, i64 32, !25, i64 36, !25, i64 40, !25, i64 44, !25, i64 48, !25, i64 52, !25, i64 56, !25, i64 60, !25, i64 64, !25, i64 68, !25, i64 72, !25, i64 76, !25, i64 80, !25, i64 84}
!28 = !{!"_Bool", !7, i64 0}
!29 = !{!12, !6, i64 0}
!30 = !{!31, !10, i64 88}
!31 = !{!"b2BodySim", !32, i64 0, !24, i64 16, !33, i64 24, !24, i64 32, !24, i64 40, !24, i64 48, !25, i64 56, !25, i64 60, !25, i64 64, !25, i64 68, !25, i64 72, !25, i64 76, !25, i64 80, !25, i64 84, !10, i64 88, !28, i64 92, !28, i64 93, !28, i64 94, !28, i64 95, !28, i64 96}
!32 = !{!"b2Transform", !24, i64 0, !33, i64 8}
!33 = !{!"b2Rot", !25, i64 0, !25, i64 4}
!34 = !{!35, !10, i64 40}
!35 = !{!"b2Body", !7, i64 0, !6, 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, !25, i64 88, !25, i64 92, !25, i64 96, !25, i64 100, !10, i64 104, !10, i64 108, !10, i64 112, !26, i64 116, !28, i64 118, !28, i64 119, !28, i64 120, !28, i64 121}
!36 = !{!35, !10, i64 44}
!37 = distinct !{!37, !38}
!38 = !{!"llvm.loop.mustprogress"}
!39 = !{!12, !10, i64 56}
!40 = !{!12, !6, i64 48}
!41 = !{!42, !10, i64 0}
!42 = !{!"b2ContactSim", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !25, i64 20, !25, i64 24, !25, i64 28, !25, i64 32, !43, i64 36, !25, i64 148, !25, i64 152, !25, i64 156, !25, i64 160, !10, i64 164, !44, i64 168}
!43 = !{!"b2Manifold", !24, i64 0, !25, i64 8, !7, i64 12, !10, i64 108}
!44 = !{!"b2SimplexCache", !26, i64 0, !7, i64 2, !7, i64 5}
!45 = !{!46, !10, i64 0}
!46 = !{!"b2Contact", !10, i64 0, !10, i64 4, !10, i64 8, !7, i64 12, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !28, i64 64}
!47 = !{!46, !10, i64 8}
!48 = distinct !{!48, !38}
!49 = !{!12, !10, i64 40}
!50 = !{!12, !6, i64 32}
!51 = !{!52, !10, i64 0}
!52 = !{!"b2JointSim", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !24, i64 16, !24, i64 24, !25, i64 32, !25, i64 36, !25, i64 40, !25, i64 44, !7, i64 48}
!53 = !{!54, !10, i64 8}
!54 = !{!"b2Joint", !6, 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, !25, i64 60, !10, i64 64, !26, i64 68, !28, i64 70, !28, i64 71}
!55 = !{!54, !10, i64 16}
!56 = distinct !{!56, !38}
!57 = !{!12, !10, i64 72}
!58 = !{!12, !6, i64 64}
!59 = !{!60, !10, i64 0}
!60 = !{!"b2IslandSim", !10, i64 0}
!61 = !{!62, !10, i64 0}
!62 = !{!"b2Island", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52}
!63 = !{!62, !10, i64 4}
!64 = distinct !{!64, !38}


; 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.b2BodySim = type { %struct.b2Transform, %struct.b2Vec2, %struct.b2Rot, %struct.b2Vec2, %struct.b2Vec2, %struct.b2Vec2, float, float, float, float, float, float, float, float, i32, i8, i8, i8, i8, i8 }
%struct.b2Transform = type { %struct.b2Vec2, %struct.b2Rot }
%struct.b2Rot = type { float, float }
%struct.b2Vec2 = 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.b2ContactSim = type { i32, i32, i32, i32, i32, float, float, float, float, %struct.b2Manifold, float, float, float, float, i32, %struct.b2SimplexCache }
%struct.b2Manifold = type { %struct.b2Vec2, float, [2 x %struct.b2ManifoldPoint], i32 }
%struct.b2ManifoldPoint = type { %struct.b2Vec2, %struct.b2Vec2, %struct.b2Vec2, float, float, float, float, float, i16, i8 }
%struct.b2SimplexCache = type { i16, [3 x i8], [3 x i8] }
%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.b2IslandSim = type { i32 }

@.str.1 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [26 x i8], align 1

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

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

; Function Attrs: mustprogress 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) #2

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @b2BodySimArray_Add(ptr noundef) local_unnamed_addr #1

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @b2ContactSimArray_Add(ptr noundef) local_unnamed_addr #1

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @b2IslandSimArray_Add(ptr noundef) local_unnamed_addr #1

declare void @b2ValidateSolverSets(ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @b2JointSimArray_Add(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @b2MergeSolverSets(ptr noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = icmp sgt i32 %1, 2
  br i1 %4, label %8, label %5

5:                                                ; preds = %3
  %6 = tail call i32 @b2InternalAssertFcn(ptr noundef nonnull @.str.29, ptr noundef nonnull @.str.1, i32 noundef 429) #5
  %.not = icmp eq i32 %6, 0
  br i1 %.not, label %8, label %7

7:                                                ; preds = %5
  tail call void @llvm.trap()
  unreachable

8:                                                ; preds = %5, %3
  %9 = icmp sgt i32 %2, 2
  br i1 %9, label %13, label %10

10:                                               ; preds = %8
  %11 = tail call i32 @b2InternalAssertFcn(ptr noundef nonnull @.str.30, ptr noundef nonnull @.str.1, i32 noundef 430) #5
  %.not91 = icmp eq i32 %11, 0
  br i1 %.not91, label %13, label %12

12:                                               ; preds = %10
  tail call void @llvm.trap()
  unreachable

13:                                               ; preds = %8, %10
  %14 = getelementptr inbounds i8, ptr %0, i64 1072
  %15 = tail call ptr @b2SolverSetArray_Get(ptr noundef nonnull %14, i32 noundef %1)
  %16 = tail call ptr @b2SolverSetArray_Get(ptr noundef nonnull %14, i32 noundef %2)
  %17 = getelementptr inbounds i8, ptr %15, i64 8
  %18 = load i32, ptr %17, align 8, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %16, i64 8
  %20 = load i32, ptr %19, align 8, !tbaa !5
  %21 = icmp slt i32 %18, %20
  br i1 %21, label %22, label %23

22:                                               ; preds = %13
  br label %23

23:                                               ; preds = %22, %13
  %24 = phi i32 [ %18, %22 ], [ %20, %13 ]
  %.086 = phi ptr [ %15, %22 ], [ %16, %13 ]
  %.085 = phi ptr [ %16, %22 ], [ %15, %13 ]
  %.084 = phi i32 [ %1, %22 ], [ %2, %13 ]
  %.0 = phi i32 [ %2, %22 ], [ %1, %13 ]
  %25 = getelementptr inbounds i8, ptr %0, i64 1032
  %26 = load ptr, ptr %25, align 8, !tbaa !12
  %27 = icmp sgt i32 %24, 0
  br i1 %27, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %23
  %28 = getelementptr inbounds i8, ptr %.085, i64 8
  %wide.trip.count = zext nneg i32 %24 to i64
  br label %36

._crit_edge:                                      ; preds = %49, %23
  %29 = getelementptr inbounds i8, ptr %.086, i64 48
  %30 = getelementptr inbounds i8, ptr %.086, i64 56
  %31 = load i32, ptr %30, align 8, !tbaa !27
  %32 = icmp sgt i32 %31, 0
  br i1 %32, label %.lr.ph98, label %._crit_edge99

.lr.ph98:                                         ; preds = %._crit_edge
  %33 = getelementptr inbounds i8, ptr %0, i64 1152
  %34 = getelementptr inbounds i8, ptr %.085, i64 48
  %35 = getelementptr inbounds i8, ptr %.085, i64 56
  %wide.trip.count112 = zext nneg i32 %31 to i64
  br label %60

36:                                               ; preds = %.lr.ph, %49
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %49 ]
  %37 = load ptr, ptr %.086, align 8, !tbaa !28
  %38 = getelementptr inbounds %struct.b2BodySim, ptr %37, i64 %indvars.iv
  %39 = getelementptr inbounds i8, ptr %38, i64 88
  %40 = load i32, ptr %39, align 4, !tbaa !29
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds %struct.b2Body, ptr %26, i64 %41
  %43 = getelementptr inbounds i8, ptr %42, i64 40
  %44 = load i32, ptr %43, align 8, !tbaa !33
  %45 = icmp eq i32 %44, %.084
  br i1 %45, label %49, label %46

46:                                               ; preds = %36
  %47 = tail call i32 @b2InternalAssertFcn(ptr noundef nonnull @.str.31, ptr noundef nonnull @.str.1, i32 noundef 455) #5
  %.not94 = icmp eq i32 %47, 0
  br i1 %.not94, label %49, label %48

48:                                               ; preds = %46
  tail call void @llvm.trap()
  unreachable

49:                                               ; preds = %46, %36
  store i32 %.0, ptr %43, align 8, !tbaa !33
  %50 = load i32, ptr %28, align 8, !tbaa !5
  %51 = getelementptr inbounds i8, ptr %42, i64 44
  store i32 %50, ptr %51, align 4, !tbaa !35
  %52 = tail call ptr @b2BodySimArray_Add(ptr noundef nonnull %.085)
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(100) %52, ptr noundef nonnull align 4 dereferenceable(100) %38, i64 100, i1 false)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %36, !llvm.loop !36

._crit_edge99:                                    ; preds = %70, %._crit_edge
  %53 = getelementptr inbounds i8, ptr %.086, i64 32
  %54 = getelementptr inbounds i8, ptr %.086, i64 40
  %55 = load i32, ptr %54, align 8, !tbaa !38
  %56 = icmp sgt i32 %55, 0
  br i1 %56, label %.lr.ph102, label %._crit_edge103

.lr.ph102:                                        ; preds = %._crit_edge99
  %57 = getelementptr inbounds i8, ptr %0, i64 1112
  %58 = getelementptr inbounds i8, ptr %.085, i64 32
  %59 = getelementptr inbounds i8, ptr %.085, i64 40
  %wide.trip.count117 = zext nneg i32 %55 to i64
  br label %81

60:                                               ; preds = %.lr.ph98, %70
  %indvars.iv109 = phi i64 [ 0, %.lr.ph98 ], [ %indvars.iv.next110, %70 ]
  %61 = load ptr, ptr %29, align 8, !tbaa !39
  %62 = getelementptr inbounds %struct.b2ContactSim, ptr %61, i64 %indvars.iv109
  %63 = load i32, ptr %62, align 4, !tbaa !40
  %64 = tail call ptr @b2ContactArray_Get(ptr noundef nonnull %33, i32 noundef %63)
  %65 = load i32, ptr %64, align 4, !tbaa !44
  %66 = icmp eq i32 %65, %.084
  br i1 %66, label %70, label %67

67:                                               ; preds = %60
  %68 = tail call i32 @b2InternalAssertFcn(ptr noundef nonnull @.str.32, ptr noundef nonnull @.str.1, i32 noundef 472) #5
  %.not93 = icmp eq i32 %68, 0
  br i1 %.not93, label %70, label %69

69:                                               ; preds = %67
  tail call void @llvm.trap()
  unreachable

70:                                               ; preds = %67, %60
  store i32 %.0, ptr %64, align 4, !tbaa !44
  %71 = load i32, ptr %35, align 8, !tbaa !27
  %72 = getelementptr inbounds i8, ptr %64, i64 8
  store i32 %71, ptr %72, align 4, !tbaa !46
  %73 = tail call ptr @b2ContactSimArray_Add(ptr noundef nonnull %34)
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(176) %73, ptr noundef nonnull align 4 dereferenceable(176) %62, i64 176, i1 false)
  %indvars.iv.next110 = add nuw nsw i64 %indvars.iv109, 1
  %exitcond113.not = icmp eq i64 %indvars.iv.next110, %wide.trip.count112
  br i1 %exitcond113.not, label %._crit_edge99, label %60, !llvm.loop !47

._crit_edge103:                                   ; preds = %92, %._crit_edge99
  %74 = getelementptr inbounds i8, ptr %.086, i64 64
  %75 = getelementptr inbounds i8, ptr %.086, i64 72
  %76 = load i32, ptr %75, align 8, !tbaa !48
  %77 = icmp sgt i32 %76, 0
  br i1 %77, label %.lr.ph106, label %._crit_edge107

.lr.ph106:                                        ; preds = %._crit_edge103
  %78 = getelementptr inbounds i8, ptr %0, i64 1192
  %79 = getelementptr inbounds i8, ptr %.085, i64 64
  %80 = getelementptr inbounds i8, ptr %.085, i64 72
  %wide.trip.count122 = zext nneg i32 %76 to i64
  br label %96

81:                                               ; preds = %.lr.ph102, %92
  %indvars.iv114 = phi i64 [ 0, %.lr.ph102 ], [ %indvars.iv.next115, %92 ]
  %82 = load ptr, ptr %53, align 8, !tbaa !49
  %83 = getelementptr inbounds %struct.b2JointSim, ptr %82, i64 %indvars.iv114
  %84 = load i32, ptr %83, align 4, !tbaa !50
  %85 = tail call ptr @b2JointArray_Get(ptr noundef nonnull %57, i32 noundef %84)
  %86 = getelementptr inbounds i8, ptr %85, i64 8
  %87 = load i32, ptr %86, align 8, !tbaa !52
  %88 = icmp eq i32 %87, %.084
  br i1 %88, label %92, label %89

89:                                               ; preds = %81
  %90 = tail call i32 @b2InternalAssertFcn(ptr noundef nonnull @.str.33, ptr noundef nonnull @.str.1, i32 noundef 489) #5
  %.not92 = icmp eq i32 %90, 0
  br i1 %.not92, label %92, label %91

91:                                               ; preds = %89
  tail call void @llvm.trap()
  unreachable

92:                                               ; preds = %89, %81
  store i32 %.0, ptr %86, align 8, !tbaa !52
  %93 = load i32, ptr %59, align 8, !tbaa !38
  %94 = getelementptr inbounds i8, ptr %85, i64 16
  store i32 %93, ptr %94, align 8, !tbaa !54
  %95 = tail call ptr @b2JointSimArray_Add(ptr noundef nonnull %58)
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(172) %95, ptr noundef nonnull align 4 dereferenceable(172) %83, i64 172, i1 false)
  %indvars.iv.next115 = add nuw nsw i64 %indvars.iv114, 1
  %exitcond118.not = icmp eq i64 %indvars.iv.next115, %wide.trip.count117
  br i1 %exitcond118.not, label %._crit_edge103, label %81, !llvm.loop !55

._crit_edge107:                                   ; preds = %96, %._crit_edge103
  tail call void @b2DestroySolverSet(ptr noundef %0, i32 noundef %.084)
  tail call void @b2ValidateSolverSets(ptr noundef %0) #5
  ret void

96:                                               ; preds = %.lr.ph106, %96
  %indvars.iv119 = phi i64 [ 0, %.lr.ph106 ], [ %indvars.iv.next120, %96 ]
  %97 = load ptr, ptr %74, align 8, !tbaa !56
  %98 = getelementptr inbounds %struct.b2IslandSim, ptr %97, i64 %indvars.iv119
  %99 = load i32, ptr %98, align 4, !tbaa !57
  %100 = tail call ptr @b2IslandArray_Get(ptr noundef nonnull %78, i32 noundef %99)
  store i32 %.0, ptr %100, align 4, !tbaa !59
  %101 = load i32, ptr %80, align 8, !tbaa !48
  %102 = getelementptr inbounds i8, ptr %100, i64 4
  store i32 %101, ptr %102, align 4, !tbaa !61
  %103 = tail call ptr @b2IslandSimArray_Add(ptr noundef nonnull %79)
  %104 = load i32, ptr %98, align 4
  store i32 %104, ptr %103, align 4
  %indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1
  %exitcond123.not = icmp eq i64 %indvars.iv.next120, %wide.trip.count122
  br i1 %exitcond123.not, label %._crit_edge107, label %96, !llvm.loop !62
}

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 = { 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 = { mustprogress nocallback nofree 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 }

!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, !11, i64 8}
!6 = !{!"b2SolverSet", !7, i64 0, !7, i64 16, !7, i64 32, !7, i64 48, !7, i64 64, !11, i64 80}
!7 = !{!"", !8, i64 0, !11, i64 8, !11, i64 12}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!13, !8, i64 1032}
!13 = !{!"b2World", !14, i64 0, !15, i64 40, !18, i64 336, !19, i64 1008, !7, i64 1032, !19, i64 1048, !7, i64 1072, !19, i64 1088, !7, i64 1112, !19, i64 1128, !7, i64 1152, !19, i64 1168, !7, i64 1192, !19, i64 1208, !19, i64 1232, !7, i64 1256, !7, i64 1272, !7, i64 1288, !7, i64 1304, !7, i64 1320, !7, i64 1336, !7, i64 1352, !7, i64 1368, !9, i64 1384, !9, i64 1416, !11, i64 1448, !7, i64 1456, !20, i64 1472, !20, i64 1488, !20, i64 1504, !20, i64 1520, !21, i64 1536, !11, i64 1544, !22, i64 1548, !23, i64 1556, !23, i64 1560, !23, i64 1564, !23, i64 1568, !23, i64 1572, !23, i64 1576, !23, i64 1580, !23, i64 1584, !8, i64 1592, !8, i64 1600, !24, i64 1608, !25, i64 1612, !8, i64 1704, !8, i64 1712, !8, i64 1720, !8, i64 1728, !11, i64 1736, !8, i64 1744, !8, i64 1752, !8, i64 1760, !8, i64 1768, !8, i64 1776, !23, i64 1784, !11, i64 1788, !11, i64 1792, !24, i64 1796, !26, i64 1798, !26, i64 1799, !26, i64 1800, !26, i64 1801, !26, i64 1802, !26, i64 1803}
!14 = !{!"b2ArenaAllocator", !8, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !7, i64 24}
!15 = !{!"b2BroadPhase", !9, i64 0, !11, i64 216, !16, i64 224, !7, i64 240, !8, i64 256, !8, i64 264, !11, i64 272, !17, i64 276, !16, i64 280}
!16 = !{!"b2HashSet", !8, i64 0, !11, i64 8, !11, i64 12}
!17 = !{!"b2AtomicInt", !11, i64 0}
!18 = !{!"b2ConstraintGraph", !9, i64 0}
!19 = !{!"b2IdPool", !7, i64 0, !11, i64 16}
!20 = !{!"b2BitSet", !8, i64 0, !11, i64 8, !11, i64 12}
!21 = !{!"long", !9, i64 0}
!22 = !{!"b2Vec2", !23, i64 0, !23, i64 4}
!23 = !{!"float", !9, i64 0}
!24 = !{!"short", !9, i64 0}
!25 = !{!"b2Profile", !23, i64 0, !23, i64 4, !23, i64 8, !23, i64 12, !23, i64 16, !23, i64 20, !23, i64 24, !23, i64 28, !23, i64 32, !23, i64 36, !23, i64 40, !23, i64 44, !23, i64 48, !23, i64 52, !23, i64 56, !23, i64 60, !23, i64 64, !23, i64 68, !23, i64 72, !23, i64 76, !23, i64 80, !23, i64 84}
!26 = !{!"_Bool", !9, i64 0}
!27 = !{!6, !11, i64 56}
!28 = !{!6, !8, i64 0}
!29 = !{!30, !11, i64 88}
!30 = !{!"b2BodySim", !31, i64 0, !22, i64 16, !32, i64 24, !22, i64 32, !22, i64 40, !22, i64 48, !23, i64 56, !23, i64 60, !23, i64 64, !23, i64 68, !23, i64 72, !23, i64 76, !23, i64 80, !23, i64 84, !11, i64 88, !26, i64 92, !26, i64 93, !26, i64 94, !26, i64 95, !26, i64 96}
!31 = !{!"b2Transform", !22, i64 0, !32, i64 8}
!32 = !{!"b2Rot", !23, i64 0, !23, i64 4}
!33 = !{!34, !11, i64 40}
!34 = !{!"b2Body", !9, i64 0, !8, i64 32, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !11, i64 64, !11, i64 68, !11, i64 72, !11, i64 76, !11, i64 80, !11, i64 84, !23, i64 88, !23, i64 92, !23, i64 96, !23, i64 100, !11, i64 104, !11, i64 108, !11, i64 112, !24, i64 116, !26, i64 118, !26, i64 119, !26, i64 120, !26, i64 121}
!35 = !{!34, !11, i64 44}
!36 = distinct !{!36, !37}
!37 = !{!"llvm.loop.mustprogress"}
!38 = !{!6, !11, i64 40}
!39 = !{!6, !8, i64 48}
!40 = !{!41, !11, i64 0}
!41 = !{!"b2ContactSim", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !23, i64 20, !23, i64 24, !23, i64 28, !23, i64 32, !42, i64 36, !23, i64 148, !23, i64 152, !23, i64 156, !23, i64 160, !11, i64 164, !43, i64 168}
!42 = !{!"b2Manifold", !22, i64 0, !23, i64 8, !9, i64 12, !11, i64 108}
!43 = !{!"b2SimplexCache", !24, i64 0, !9, i64 2, !9, i64 5}
!44 = !{!45, !11, i64 0}
!45 = !{!"b2Contact", !11, i64 0, !11, i64 4, !11, i64 8, !9, i64 12, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !26, i64 64}
!46 = !{!45, !11, i64 8}
!47 = distinct !{!47, !37}
!48 = !{!6, !11, i64 72}
!49 = !{!6, !8, i64 32}
!50 = !{!51, !11, i64 0}
!51 = !{!"b2JointSim", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !22, i64 16, !22, i64 24, !23, i64 32, !23, i64 36, !23, i64 40, !23, i64 44, !9, i64 48}
!52 = !{!53, !11, i64 8}
!53 = !{!"b2Joint", !8, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !9, i64 20, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !23, i64 60, !11, i64 64, !24, i64 68, !26, i64 70, !26, i64 71}
!54 = !{!53, !11, i64 16}
!55 = distinct !{!55, !37}
!56 = !{!6, !8, i64 64}
!57 = !{!58, !11, i64 0}
!58 = !{!"b2IslandSim", !11, i64 0}
!59 = !{!60, !11, i64 0}
!60 = !{!"b2Island", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52}
!61 = !{!60, !11, i64 4}
!62 = distinct !{!62, !37}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass