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

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

@.str.1 = external hidden unnamed_addr constant [62 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [39 x i8], align 1

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

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

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

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

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

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

declare void @b2WakeSolverSet(ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
define dso_local void @b2LinkJoint(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 ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %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
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %16 = zext i1 %2 to i8
  store i8 %16, ptr %6, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.b2World, ptr %17, i32 0, i32 4
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.b2Joint, ptr %19, i32 0, i32 4
  %21 = getelementptr inbounds [2 x %struct.b2JointEdge], ptr %20, i64 0, i64 0
  %22 = getelementptr inbounds %struct.b2JointEdge, ptr %21, i32 0, i32 0
  %23 = load i32, ptr %22, align 4, !tbaa !11
  %24 = call ptr @b2BodyArray_Get(ptr noundef %18, i32 noundef %23)
  store ptr %24, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.b2World, ptr %25, i32 0, i32 4
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.b2Joint, ptr %27, i32 0, i32 4
  %29 = getelementptr inbounds [2 x %struct.b2JointEdge], ptr %28, i64 0, i64 1
  %30 = getelementptr inbounds %struct.b2JointEdge, ptr %29, i32 0, i32 0
  %31 = load i32, ptr %30, align 4, !tbaa !11
  %32 = call ptr @b2BodyArray_Get(ptr noundef %26, i32 noundef %31)
  store ptr %32, ptr %8, align 8, !tbaa !5
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.b2Body, ptr %33, i32 0, i32 2
  %35 = load i32, ptr %34, align 8, !tbaa !14
  %36 = icmp eq i32 %35, 2
  br i1 %36, label %37, label %47

37:                                               ; preds = %3
  %38 = load ptr, ptr %8, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.b2Body, ptr %38, i32 0, i32 2
  %40 = load i32, ptr %39, align 8, !tbaa !14
  %41 = icmp sge i32 %40, 3
  br i1 %41, label %42, label %47

42:                                               ; preds = %37
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = load ptr, ptr %8, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.b2Body, ptr %44, i32 0, i32 2
  %46 = load i32, ptr %45, align 8, !tbaa !14
  call void @b2WakeSolverSet(ptr noundef %43, i32 noundef %46)
  br label %63

47:                                               ; preds = %37, %3
  %48 = load ptr, ptr %8, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.b2Body, ptr %48, i32 0, i32 2
  %50 = load i32, ptr %49, align 8, !tbaa !14
  %51 = icmp eq i32 %50, 2
  br i1 %51, label %52, label %62

52:                                               ; preds = %47
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.b2Body, ptr %53, i32 0, i32 2
  %55 = load i32, ptr %54, align 8, !tbaa !14
  %56 = icmp sge i32 %55, 3
  br i1 %56, label %57, label %62

57:                                               ; preds = %52
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = load ptr, ptr %7, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.b2Body, ptr %59, i32 0, i32 2
  %61 = load i32, ptr %60, align 8, !tbaa !14
  call void @b2WakeSolverSet(ptr noundef %58, i32 noundef %61)
  br label %62

62:                                               ; preds = %57, %52, %47
  br label %63

63:                                               ; preds = %62, %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %64 = load ptr, ptr %7, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.b2Body, ptr %64, i32 0, i32 11
  %66 = load i32, ptr %65, align 4, !tbaa !18
  store i32 %66, ptr %9, align 4, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %67 = load ptr, ptr %8, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.b2Body, ptr %67, i32 0, i32 11
  %69 = load i32, ptr %68, align 4, !tbaa !18
  store i32 %69, ptr %10, align 4, !tbaa !19
  br label %70

70:                                               ; preds = %63
  %71 = load i32, ptr %9, align 4, !tbaa !19
  %72 = icmp ne i32 %71, -1
  br i1 %72, label %80, label %73

73:                                               ; preds = %70
  %74 = load i32, ptr %10, align 4, !tbaa !19
  %75 = icmp ne i32 %74, -1
  br i1 %75, label %80, label %76

76:                                               ; preds = %73
  %77 = call i32 @b2InternalAssertFcn(ptr noundef @.str.9, ptr noundef @.str.1, i32 noundef 308)
  %78 = icmp ne i32 %77, 0
  br i1 %78, label %79, label %80

79:                                               ; preds = %76
  call void @llvm.trap()
  br label %80

80:                                               ; preds = %79, %76, %73, %70
  br label %81

81:                                               ; preds = %80
  br label %82

82:                                               ; preds = %81
  %83 = load i32, ptr %9, align 4, !tbaa !19
  %84 = load i32, ptr %10, align 4, !tbaa !19
  %85 = icmp eq i32 %83, %84
  br i1 %85, label %86, label %90

86:                                               ; preds = %82
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = load i32, ptr %9, align 4, !tbaa !19
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  call void @b2AddJointToIsland(ptr noundef %87, i32 noundef %88, ptr noundef %89)
  store i32 1, ptr %11, align 4
  br label %229

90:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  store ptr null, ptr %12, align 8, !tbaa !5
  %91 = load i32, ptr %9, align 4, !tbaa !19
  %92 = icmp ne i32 %91, -1
  br i1 %92, label %93, label %126

93:                                               ; preds = %90
  %94 = load ptr, ptr %4, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.b2World, ptr %94, i32 0, i32 12
  %96 = load i32, ptr %9, align 4, !tbaa !19
  %97 = call ptr @b2IslandArray_Get(ptr noundef %95, i32 noundef %96)
  store ptr %97, ptr %12, align 8, !tbaa !5
  br label %98

98:                                               ; preds = %120, %93
  %99 = load ptr, ptr %12, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.b2Island, ptr %99, i32 0, i32 12
  %101 = load i32, ptr %100, align 4, !tbaa !20
  %102 = icmp ne i32 %101, -1
  br i1 %102, label %103, label %125

103:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %104 = load ptr, ptr %4, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.b2World, ptr %104, i32 0, i32 12
  %106 = load ptr, ptr %12, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.b2Island, ptr %106, i32 0, i32 12
  %108 = load i32, ptr %107, align 4, !tbaa !20
  %109 = call ptr @b2IslandArray_Get(ptr noundef %105, i32 noundef %108)
  store ptr %109, ptr %13, align 8, !tbaa !5
  %110 = load ptr, ptr %13, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.b2Island, ptr %110, i32 0, i32 12
  %112 = load i32, ptr %111, align 4, !tbaa !20
  %113 = icmp ne i32 %112, -1
  br i1 %113, label %114, label %120

114:                                              ; preds = %103
  %115 = load ptr, ptr %13, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.b2Island, ptr %115, i32 0, i32 12
  %117 = load i32, ptr %116, align 4, !tbaa !20
  %118 = load ptr, ptr %12, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.b2Island, ptr %118, i32 0, i32 12
  store i32 %117, ptr %119, align 4, !tbaa !20
  br label %120

120:                                              ; preds = %114, %103
  %121 = load ptr, ptr %12, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.b2Island, ptr %121, i32 0, i32 12
  %123 = load i32, ptr %122, align 4, !tbaa !20
  store i32 %123, ptr %9, align 4, !tbaa !19
  %124 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %124, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %98, !llvm.loop !22

125:                                              ; preds = %98
  br label %126

126:                                              ; preds = %125, %90
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  store ptr null, ptr %14, align 8, !tbaa !5
  %127 = load i32, ptr %10, align 4, !tbaa !19
  %128 = icmp ne i32 %127, -1
  br i1 %128, label %129, label %162

129:                                              ; preds = %126
  %130 = load ptr, ptr %4, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.b2World, ptr %130, i32 0, i32 12
  %132 = load i32, ptr %10, align 4, !tbaa !19
  %133 = call ptr @b2IslandArray_Get(ptr noundef %131, i32 noundef %132)
  store ptr %133, ptr %14, align 8, !tbaa !5
  br label %134

134:                                              ; preds = %156, %129
  %135 = load ptr, ptr %14, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.b2Island, ptr %135, i32 0, i32 12
  %137 = load i32, ptr %136, align 4, !tbaa !20
  %138 = icmp ne i32 %137, -1
  br i1 %138, label %139, label %161

139:                                              ; preds = %134
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %140 = load ptr, ptr %4, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.b2World, ptr %140, i32 0, i32 12
  %142 = load ptr, ptr %14, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.b2Island, ptr %142, i32 0, i32 12
  %144 = load i32, ptr %143, align 4, !tbaa !20
  %145 = call ptr @b2IslandArray_Get(ptr noundef %141, i32 noundef %144)
  store ptr %145, ptr %15, align 8, !tbaa !5
  %146 = load ptr, ptr %15, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.b2Island, ptr %146, i32 0, i32 12
  %148 = load i32, ptr %147, align 4, !tbaa !20
  %149 = icmp ne i32 %148, -1
  br i1 %149, label %150, label %156

150:                                              ; preds = %139
  %151 = load ptr, ptr %15, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.b2Island, ptr %151, i32 0, i32 12
  %153 = load i32, ptr %152, align 4, !tbaa !20
  %154 = load ptr, ptr %14, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.b2Island, ptr %154, i32 0, i32 12
  store i32 %153, ptr %155, align 4, !tbaa !20
  br label %156

156:                                              ; preds = %150, %139
  %157 = load ptr, ptr %14, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.b2Island, ptr %157, i32 0, i32 12
  %159 = load i32, ptr %158, align 4, !tbaa !20
  store i32 %159, ptr %10, align 4, !tbaa !19
  %160 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr %160, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %134, !llvm.loop !24

161:                                              ; preds = %134
  br label %162

162:                                              ; preds = %161, %126
  br label %163

163:                                              ; preds = %162
  %164 = load ptr, ptr %12, align 8, !tbaa !5
  %165 = icmp ne ptr %164, null
  br i1 %165, label %173, label %166

166:                                              ; preds = %163
  %167 = load ptr, ptr %14, align 8, !tbaa !5
  %168 = icmp ne ptr %167, null
  br i1 %168, label %173, label %169

169:                                              ; preds = %166
  %170 = call i32 @b2InternalAssertFcn(ptr noundef @.str.10, ptr noundef @.str.1, i32 noundef 355)
  %171 = icmp ne i32 %170, 0
  br i1 %171, label %172, label %173

172:                                              ; preds = %169
  call void @llvm.trap()
  br label %173

173:                                              ; preds = %172, %169, %166, %163
  br label %174

174:                                              ; preds = %173
  br label %175

175:                                              ; preds = %174
  %176 = load ptr, ptr %12, align 8, !tbaa !5
  %177 = load ptr, ptr %14, align 8, !tbaa !5
  %178 = icmp ne ptr %176, %177
  br i1 %178, label %179, label %212

179:                                              ; preds = %175
  %180 = load ptr, ptr %12, align 8, !tbaa !5
  %181 = icmp ne ptr %180, null
  br i1 %181, label %182, label %212

182:                                              ; preds = %179
  %183 = load ptr, ptr %14, align 8, !tbaa !5
  %184 = icmp ne ptr %183, null
  br i1 %184, label %185, label %212

185:                                              ; preds = %182
  br label %186

186:                                              ; preds = %185
  %187 = load ptr, ptr %12, align 8, !tbaa !5
  %188 = load ptr, ptr %14, align 8, !tbaa !5
  %189 = icmp ne ptr %187, %188
  br i1 %189, label %194, label %190

190:                                              ; preds = %186
  %191 = call i32 @b2InternalAssertFcn(ptr noundef @.str.11, ptr noundef @.str.1, i32 noundef 360)
  %192 = icmp ne i32 %191, 0
  br i1 %192, label %193, label %194

193:                                              ; preds = %190
  call void @llvm.trap()
  br label %194

194:                                              ; preds = %193, %190, %186
  br label %195

195:                                              ; preds = %194
  br label %196

196:                                              ; preds = %195
  br label %197

197:                                              ; preds = %196
  %198 = load ptr, ptr %14, align 8, !tbaa !5
  %199 = getelementptr inbounds %struct.b2Island, ptr %198, i32 0, i32 12
  %200 = load i32, ptr %199, align 4, !tbaa !20
  %201 = icmp eq i32 %200, -1
  br i1 %201, label %206, label %202

202:                                              ; preds = %197
  %203 = call i32 @b2InternalAssertFcn(ptr noundef @.str.12, ptr noundef @.str.1, i32 noundef 361)
  %204 = icmp ne i32 %203, 0
  br i1 %204, label %205, label %206

205:                                              ; preds = %202
  call void @llvm.trap()
  br label %206

206:                                              ; preds = %205, %202, %197
  br label %207

207:                                              ; preds = %206
  br label %208

208:                                              ; preds = %207
  %209 = load i32, ptr %9, align 4, !tbaa !19
  %210 = load ptr, ptr %14, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.b2Island, ptr %210, i32 0, i32 12
  store i32 %209, ptr %211, align 4, !tbaa !20
  br label %212

212:                                              ; preds = %208, %182, %179, %175
  %213 = load ptr, ptr %12, align 8, !tbaa !5
  %214 = icmp ne ptr %213, null
  br i1 %214, label %215, label %219

215:                                              ; preds = %212
  %216 = load ptr, ptr %4, align 8, !tbaa !5
  %217 = load i32, ptr %9, align 4, !tbaa !19
  %218 = load ptr, ptr %5, align 8, !tbaa !5
  call void @b2AddJointToIsland(ptr noundef %216, i32 noundef %217, ptr noundef %218)
  br label %223

219:                                              ; preds = %212
  %220 = load ptr, ptr %4, align 8, !tbaa !5
  %221 = load i32, ptr %10, align 4, !tbaa !19
  %222 = load ptr, ptr %5, align 8, !tbaa !5
  call void @b2AddJointToIsland(ptr noundef %220, i32 noundef %221, ptr noundef %222)
  br label %223

223:                                              ; preds = %219, %215
  %224 = load i8, ptr %6, align 1, !tbaa !9, !range !25, !noundef !26
  %225 = trunc i8 %224 to i1
  br i1 %225, label %226, label %228

226:                                              ; preds = %223
  %227 = load ptr, ptr %4, align 8, !tbaa !5
  call void @b2MergeAwakeIslands(ptr noundef %227)
  br label %228

228:                                              ; preds = %226, %223
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  store i32 0, ptr %11, align 4
  br label %229

229:                                              ; preds = %228, %86
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  %230 = load i32, ptr %11, align 4
  switch i32 %230, label %232 [
    i32 0, label %231
    i32 1, label %231
  ]

231:                                              ; preds = %229, %229
  ret void

232:                                              ; preds = %229
  unreachable
}

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

; Function Attrs: nounwind uwtable
declare dso_local void @b2MergeAwakeIslands(ptr noundef) #4

attributes #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 = { cold noreturn nounwind memory(inaccessiblemem: write) }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind uwtable "min-legal-vector-width"="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 0}
!12 = !{!"b2JointEdge", !13, i64 0, !13, i64 4, !13, i64 8}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !13, i64 40}
!15 = !{!"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, !16, i64 88, !16, i64 92, !16, i64 96, !16, i64 100, !13, i64 104, !13, i64 108, !13, i64 112, !17, i64 116, !10, i64 118, !10, i64 119, !10, i64 120, !10, i64 121}
!16 = !{!"float", !7, i64 0}
!17 = !{!"short", !7, i64 0}
!18 = !{!15, !13, i64 76}
!19 = !{!13, !13, i64 0}
!20 = !{!21, !13, i64 48}
!21 = !{!"b2Island", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !13, i64 48, !13, i64 52}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = distinct !{!24, !23}
!25 = !{i8 0, i8 2}
!26 = !{}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@.str.1 = external hidden unnamed_addr constant [62 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [39 x i8], align 1

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

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

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

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

declare void @b2WakeSolverSet(ptr noundef, i32 noundef) local_unnamed_addr #0

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

16:                                               ; preds = %3
  %17 = icmp sgt i32 %15, 2
  br i1 %17, label %.thread90.sink.split, label %.thread90

18:                                               ; preds = %3
  %19 = icmp eq i32 %15, 2
  %20 = icmp sgt i32 %12, 2
  %or.cond97 = and i1 %20, %19
  br i1 %or.cond97, label %.thread90.sink.split, label %.thread90

.thread90.sink.split:                             ; preds = %18, %16
  %.sink = phi i32 [ %15, %16 ], [ %12, %18 ]
  tail call void @b2WakeSolverSet(ptr noundef %0, i32 noundef %.sink) #4
  br label %.thread90

.thread90:                                        ; preds = %.thread90.sink.split, %16, %18
  %21 = getelementptr inbounds i8, ptr %7, i64 76
  %22 = load i32, ptr %21, align 4, !tbaa !16
  %23 = getelementptr inbounds i8, ptr %10, i64 76
  %24 = load i32, ptr %23, align 4, !tbaa !16
  %25 = icmp ne i32 %22, -1
  %26 = icmp ne i32 %24, -1
  %or.cond = select i1 %25, i1 true, i1 %26
  br i1 %or.cond, label %30, label %27

27:                                               ; preds = %.thread90
  %28 = tail call i32 @b2InternalAssertFcn(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.1, i32 noundef 308) #4
  %.not = icmp eq i32 %28, 0
  br i1 %.not, label %30, label %29

29:                                               ; preds = %27
  tail call void @llvm.trap()
  unreachable

30:                                               ; preds = %27, %.thread90
  %31 = icmp eq i32 %22, %24
  br i1 %31, label %32, label %33

32:                                               ; preds = %30
  tail call void @b2AddJointToIsland(ptr noundef %0, i32 noundef %22, ptr noundef nonnull %1)
  br label %71

33:                                               ; preds = %30
  br i1 %25, label %34, label %.loopexit.thread

34:                                               ; preds = %33
  %35 = getelementptr inbounds i8, ptr %0, i64 1192
  %36 = tail call ptr @b2IslandArray_Get(ptr noundef nonnull %35, i32 noundef %22)
  %37 = getelementptr inbounds i8, ptr %36, i64 48
  %38 = load i32, ptr %37, align 4, !tbaa !17
  %.not8498 = icmp eq i32 %38, -1
  br i1 %.not8498, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %34, %44
  %39 = phi i32 [ %.pre107, %44 ], [ %38, %34 ]
  %40 = phi ptr [ %42, %44 ], [ %37, %34 ]
  %41 = tail call ptr @b2IslandArray_Get(ptr noundef nonnull %35, i32 noundef %39)
  %42 = getelementptr inbounds i8, ptr %41, i64 48
  %43 = load i32, ptr %42, align 4, !tbaa !17
  %.not89 = icmp eq i32 %43, -1
  br i1 %.not89, label %.thread, label %44

.thread:                                          ; preds = %.lr.ph
  %.pre = load i32, ptr %40, align 4, !tbaa !17
  br label %.loopexit

44:                                               ; preds = %.lr.ph
  store i32 %43, ptr %40, align 4, !tbaa !17
  %.pre107 = load i32, ptr %42, align 4, !tbaa !17
  %.not84 = icmp eq i32 %.pre107, -1
  br i1 %.not84, label %.loopexit, label %.lr.ph, !llvm.loop !19

.loopexit:                                        ; preds = %44, %.thread, %34
  %.174 = phi ptr [ %36, %34 ], [ %41, %.thread ], [ %41, %44 ]
  %.1 = phi i32 [ %22, %34 ], [ %.pre, %.thread ], [ %43, %44 ]
  br i1 %26, label %45, label %56

.loopexit.thread:                                 ; preds = %33
  br i1 %26, label %45, label %.thread122

45:                                               ; preds = %.loopexit.thread, %.loopexit
  %.1121 = phi i32 [ -1, %.loopexit.thread ], [ %.1, %.loopexit ]
  %.174118 = phi ptr [ null, %.loopexit.thread ], [ %.174, %.loopexit ]
  %46 = getelementptr inbounds i8, ptr %0, i64 1192
  %47 = tail call ptr @b2IslandArray_Get(ptr noundef nonnull %46, i32 noundef %24)
  %48 = getelementptr inbounds i8, ptr %47, i64 48
  %49 = load i32, ptr %48, align 4, !tbaa !17
  %.not85100 = icmp eq i32 %49, -1
  br i1 %.not85100, label %.loopexit141, label %.lr.ph101

.lr.ph101:                                        ; preds = %45, %55
  %50 = phi i32 [ %.pre109, %55 ], [ %49, %45 ]
  %51 = phi ptr [ %53, %55 ], [ %48, %45 ]
  %52 = tail call ptr @b2IslandArray_Get(ptr noundef nonnull %46, i32 noundef %50)
  %53 = getelementptr inbounds i8, ptr %52, i64 48
  %54 = load i32, ptr %53, align 4, !tbaa !17
  %.not88 = icmp eq i32 %54, -1
  br i1 %.not88, label %.thread112, label %55

.thread112:                                       ; preds = %.lr.ph101
  %.pre108 = load i32, ptr %51, align 4, !tbaa !17
  br label %.loopexit141

55:                                               ; preds = %.lr.ph101
  store i32 %54, ptr %51, align 4, !tbaa !17
  %.pre109 = load i32, ptr %53, align 4, !tbaa !17
  %.not85 = icmp eq i32 %.pre109, -1
  br i1 %.not85, label %.loopexit141, label %.lr.ph101, !llvm.loop !21

56:                                               ; preds = %.loopexit
  %.not110 = icmp eq ptr %.174, null
  br i1 %.not110, label %.thread122, label %.thread128.thread

.thread122:                                       ; preds = %.loopexit.thread, %56
  %57 = tail call i32 @b2InternalAssertFcn(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.1, i32 noundef 355) #4
  %.not86 = icmp eq i32 %57, 0
  br i1 %.not86, label %.thread128.thread, label %58

58:                                               ; preds = %.thread122
  tail call void @llvm.trap()
  unreachable

.loopexit141:                                     ; preds = %55, %45, %.thread112
  %.071.lcssa = phi i32 [ %24, %45 ], [ %.pre108, %.thread112 ], [ %54, %55 ]
  %.069.lcssa = phi ptr [ %47, %45 ], [ %52, %.thread112 ], [ %52, %55 ]
  %59 = icmp ne ptr %.174118, null
  %60 = icmp ne ptr %.174118, %.069.lcssa
  %or.cond5 = and i1 %59, %60
  %or.cond7 = and i1 %26, %or.cond5
  br i1 %or.cond7, label %61, label %69

61:                                               ; preds = %.loopexit141
  %62 = getelementptr inbounds i8, ptr %.069.lcssa, i64 48
  %63 = load i32, ptr %62, align 4, !tbaa !17
  %64 = icmp eq i32 %63, -1
  br i1 %64, label %68, label %65

65:                                               ; preds = %61
  %66 = tail call i32 @b2InternalAssertFcn(ptr noundef nonnull @.str.12, ptr noundef nonnull @.str.1, i32 noundef 361) #4
  %.not87 = icmp eq i32 %66, 0
  br i1 %.not87, label %68, label %67

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

68:                                               ; preds = %65, %61
  store i32 %.1121, ptr %62, align 4, !tbaa !17
  br label %.thread128.thread

69:                                               ; preds = %.loopexit141
  %spec.select = select i1 %59, i32 %.1121, i32 %.071.lcssa
  br label %.thread128.thread

.thread128.thread:                                ; preds = %69, %.thread122, %68, %56
  %.17295136137.sink = phi i32 [ %.1121, %68 ], [ %.1, %56 ], [ -1, %.thread122 ], [ %spec.select, %69 ]
  tail call void @b2AddJointToIsland(ptr noundef %0, i32 noundef %.17295136137.sink, ptr noundef %1)
  br i1 %2, label %70, label %71

70:                                               ; preds = %.thread128.thread
  tail call void @b2MergeAwakeIslands(ptr noundef %0)
  br label %71

71:                                               ; preds = %.thread128.thread, %70, %32
  ret void
}

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

; Function Attrs: nounwind uwtable
declare dso_local void @b2MergeAwakeIslands(ptr noundef) local_unnamed_addr #3

attributes #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 = { cold noreturn nounwind memory(inaccessiblemem: write) }
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 = { 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, !7, i64 0}
!6 = !{!"b2JointEdge", !7, i64 0, !7, i64 4, !7, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !7, i64 40}
!11 = !{!"b2Body", !8, i64 0, !12, i64 32, !7, i64 40, !7, i64 44, !7, i64 48, !7, i64 52, !7, i64 56, !7, i64 60, !7, i64 64, !7, i64 68, !7, i64 72, !7, i64 76, !7, i64 80, !7, i64 84, !13, i64 88, !13, i64 92, !13, i64 96, !13, i64 100, !7, i64 104, !7, i64 108, !7, i64 112, !14, i64 116, !15, i64 118, !15, i64 119, !15, i64 120, !15, i64 121}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!"float", !8, i64 0}
!14 = !{!"short", !8, i64 0}
!15 = !{!"_Bool", !8, i64 0}
!16 = !{!11, !7, i64 76}
!17 = !{!18, !7, i64 48}
!18 = !{!"b2Island", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !7, i64 36, !7, i64 40, !7, i64 44, !7, i64 48, !7, i64 52}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = distinct !{!21, !20}


; Effective O3 passes: ADCEPass,ConstraintEliminationPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass