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

; 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.b2ShapeId = type { i32, i16, i16 }
%struct.b2Shape = type { i32, i32, i32, i32, i32, i32, float, float, float, float, float, i32, %struct.b2AABB, %struct.b2AABB, %struct.b2Vec2, i32, %struct.b2Filter, ptr, i32, %union.anon.0, i16, i8, i8, i8, i8, i8 }
%struct.b2AABB = type { %struct.b2Vec2, %struct.b2Vec2 }
%struct.b2Vec2 = type { float, float }
%struct.b2Filter = type { i64, i64, i32 }
%union.anon.0 = type { %struct.b2Polygon }
%struct.b2Polygon = type { [8 x %struct.b2Vec2], [8 x %struct.b2Vec2], %struct.b2Vec2, float, i32 }
%struct.b2World = type { %struct.b2ArenaAllocator, %struct.b2BroadPhase, %struct.b2ConstraintGraph, %struct.b2IdPool, %struct.b2BodyArray, %struct.b2IdPool, %struct.b2SolverSetArray, %struct.b2IdPool, %struct.b2JointArray, %struct.b2IdPool, %struct.b2ContactArray, %struct.b2IdPool, %struct.b2IslandArray, %struct.b2IdPool, %struct.b2IdPool, %struct.b2ShapeArray, %struct.b2ChainShapeArray, %struct.b2SensorArray, %struct.b2TaskContextArray, %struct.b2SensorTaskContextArray, %struct.b2BodyMoveEventArray, %struct.b2SensorBeginTouchEventArray, %struct.b2ContactBeginTouchEventArray, [2 x %struct.b2SensorEndTouchEventArray], [2 x %struct.b2ContactEndTouchEventArray], i32, %struct.b2ContactHitEventArray, %struct.b2BitSet, %struct.b2BitSet, %struct.b2BitSet, %struct.b2BitSet, i64, i32, %struct.b2Vec2, float, float, float, float, float, float, float, float, ptr, ptr, i16, %struct.b2Profile, ptr, ptr, ptr, ptr, i32, ptr, ptr, ptr, ptr, ptr, float, i32, i32, i16, i8, i8, i8, i8, i8, i8 }
%struct.b2ArenaAllocator = type { ptr, i32, i32, i32, i32, %struct.b2ArenaEntryArray }
%struct.b2ArenaEntryArray = type { ptr, i32, i32 }
%struct.b2BroadPhase = type { [3 x %struct.b2DynamicTree], i32, %struct.b2HashSet, %struct.b2IntArray, ptr, ptr, i32, %struct.b2AtomicInt, %struct.b2HashSet }
%struct.b2DynamicTree = type { ptr, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, i32 }
%struct.b2IntArray = type { ptr, i32, i32 }
%struct.b2AtomicInt = type { i32 }
%struct.b2HashSet = type { ptr, i32, i32 }
%struct.b2ConstraintGraph = type { [12 x %struct.b2GraphColor] }
%struct.b2GraphColor = type { %struct.b2BitSet, %struct.b2ContactSimArray, %struct.b2JointSimArray, %union.anon }
%struct.b2ContactSimArray = type { ptr, i32, i32 }
%struct.b2JointSimArray = type { ptr, i32, i32 }
%union.anon = type { ptr }
%struct.b2BodyArray = type { ptr, i32, i32 }
%struct.b2SolverSetArray = type { ptr, i32, i32 }
%struct.b2JointArray = type { ptr, i32, i32 }
%struct.b2ContactArray = type { ptr, i32, i32 }
%struct.b2IslandArray = type { ptr, i32, i32 }
%struct.b2IdPool = type { %struct.b2IntArray, i32 }
%struct.b2ShapeArray = type { ptr, i32, i32 }
%struct.b2ChainShapeArray = type { ptr, i32, i32 }
%struct.b2SensorArray = type { ptr, i32, i32 }
%struct.b2TaskContextArray = type { ptr, i32, i32 }
%struct.b2SensorTaskContextArray = type { ptr, i32, i32 }
%struct.b2BodyMoveEventArray = type { ptr, i32, i32 }
%struct.b2SensorBeginTouchEventArray = type { ptr, i32, i32 }
%struct.b2ContactBeginTouchEventArray = type { ptr, i32, i32 }
%struct.b2SensorEndTouchEventArray = type { ptr, i32, i32 }
%struct.b2ContactEndTouchEventArray = type { ptr, i32, i32 }
%struct.b2ContactHitEventArray = type { ptr, i32, i32 }
%struct.b2BitSet = type { ptr, i32, i32 }
%struct.b2Profile = type { float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float }
%struct.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.b2Contact = type { i32, i32, i32, [2 x %struct.b2ContactEdge], i32, i32, i32, i32, i32, i32, i32, i8 }
%struct.b2ContactEdge = type { i32, i32, i32 }
%struct.b2ContactData = type { %struct.b2ShapeId, %struct.b2ShapeId, %struct.b2Manifold }
%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.b2ContactSim = type { i32, i32, i32, i32, i32, float, float, float, float, %struct.b2Manifold, float, float, float, float, i32, %struct.b2SimplexCache }
%struct.b2SimplexCache = type { i16, [3 x i8], [3 x i8] }

@.str.1 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [18 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

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

; Function Attrs: 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

declare ptr @b2GetWorldLocked(i32 noundef) #1

; Function Attrs: nounwind uwtable
declare hidden ptr @b2GetShape(ptr noundef, i64) #4

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

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

28:                                               ; preds = %3
  store i32 0, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %174

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

37:                                               ; preds = %29
  store i32 0, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %173

38:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.b2World, ptr %39, i32 0, i32 4
  %41 = load ptr, ptr %10, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.b2Shape, ptr %41, i32 0, i32 1
  %43 = load i32, ptr %42, align 4, !tbaa !22
  %44 = call ptr @b2BodyArray_Get(ptr noundef %40, i32 noundef %43)
  store ptr %44, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %45 = load ptr, ptr %11, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.b2Body, ptr %45, i32 0, i32 4
  %47 = load i32, ptr %46, align 8, !tbaa !23
  store i32 %47, 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 %48

48:                                               ; preds = %152, %38
  %49 = load i32, ptr %12, align 4, !tbaa !9
  %50 = icmp ne i32 %49, -1
  br i1 %50, label %51, label %55

51:                                               ; preds = %48
  %52 = load i32, ptr %13, align 4, !tbaa !9
  %53 = load i32, ptr %7, align 4, !tbaa !9
  %54 = icmp slt i32 %52, %53
  br label %55

55:                                               ; preds = %51, %48
  %56 = phi i1 [ false, %48 ], [ %54, %51 ]
  br i1 %56, label %57, label %160

57:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %58 = load i32, ptr %12, align 4, !tbaa !9
  %59 = ashr i32 %58, 1
  store i32 %59, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %60 = load i32, ptr %12, align 4, !tbaa !9
  %61 = and i32 %60, 1
  store i32 %61, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %62 = load ptr, ptr %8, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.b2World, ptr %62, i32 0, i32 10
  %64 = load i32, ptr %14, align 4, !tbaa !9
  %65 = call ptr @b2ContactArray_Get(ptr noundef %63, i32 noundef %64)
  store ptr %65, ptr %16, align 8, !tbaa !5
  %66 = load ptr, ptr %16, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.b2Contact, ptr %66, i32 0, i32 4
  %68 = load i32, ptr %67, align 4, !tbaa !25
  %69 = getelementptr inbounds %struct.b2ShapeId, ptr %5, i32 0, i32 0
  %70 = load i32, ptr %69, align 4, !tbaa !27
  %71 = sub nsw i32 %70, 1
  %72 = icmp eq i32 %68, %71
  br i1 %72, label %81, label %73

73:                                               ; preds = %57
  %74 = load ptr, ptr %16, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.b2Contact, ptr %74, i32 0, i32 5
  %76 = load i32, ptr %75, align 4, !tbaa !28
  %77 = getelementptr inbounds %struct.b2ShapeId, ptr %5, i32 0, i32 0
  %78 = load i32, ptr %77, align 4, !tbaa !27
  %79 = sub nsw i32 %78, 1
  %80 = icmp eq i32 %76, %79
  br i1 %80, label %81, label %152

81:                                               ; preds = %73, %57
  %82 = load ptr, ptr %16, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.b2Contact, ptr %82, i32 0, i32 10
  %84 = load i32, ptr %83, align 4, !tbaa !29
  %85 = and i32 %84, 1
  %86 = icmp ne i32 %85, 0
  br i1 %86, label %87, label %152

87:                                               ; preds = %81
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %88 = load ptr, ptr %8, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.b2World, ptr %88, i32 0, i32 15
  %90 = getelementptr inbounds %struct.b2ShapeArray, ptr %89, i32 0, i32 0
  %91 = load ptr, ptr %90, align 8, !tbaa !30
  %92 = load ptr, ptr %16, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.b2Contact, ptr %92, i32 0, i32 4
  %94 = load i32, ptr %93, align 4, !tbaa !25
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds %struct.b2Shape, ptr %91, i64 %95
  store ptr %96, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %97 = load ptr, ptr %8, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.b2World, ptr %97, i32 0, i32 15
  %99 = getelementptr inbounds %struct.b2ShapeArray, ptr %98, i32 0, i32 0
  %100 = load ptr, ptr %99, align 8, !tbaa !30
  %101 = load ptr, ptr %16, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.b2Contact, ptr %101, i32 0, i32 5
  %103 = load i32, ptr %102, align 4, !tbaa !28
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds %struct.b2Shape, ptr %100, i64 %104
  store ptr %105, ptr %18, align 8, !tbaa !5
  %106 = load ptr, ptr %6, align 8, !tbaa !5
  %107 = load i32, ptr %13, align 4, !tbaa !9
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds %struct.b2ContactData, ptr %106, i64 %108
  %110 = getelementptr inbounds %struct.b2ContactData, ptr %109, i32 0, i32 0
  %111 = getelementptr inbounds %struct.b2ShapeId, ptr %19, i32 0, i32 0
  %112 = load ptr, ptr %17, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.b2Shape, ptr %112, i32 0, i32 0
  %114 = load i32, ptr %113, align 8, !tbaa !41
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %111, align 4, !tbaa !27
  %116 = getelementptr inbounds %struct.b2ShapeId, ptr %19, i32 0, i32 1
  %117 = getelementptr inbounds %struct.b2ShapeId, ptr %5, i32 0, i32 1
  %118 = load i16, ptr %117, align 4, !tbaa !11
  store i16 %118, ptr %116, align 4, !tbaa !11
  %119 = getelementptr inbounds %struct.b2ShapeId, ptr %19, i32 0, i32 2
  %120 = load ptr, ptr %17, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.b2Shape, ptr %120, i32 0, i32 20
  %122 = load i16, ptr %121, align 4, !tbaa !42
  store i16 %122, ptr %119, align 2, !tbaa !43
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %110, ptr align 4 %19, i64 8, i1 false), !tbaa.struct !44
  %123 = load ptr, ptr %6, align 8, !tbaa !5
  %124 = load i32, ptr %13, align 4, !tbaa !9
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds %struct.b2ContactData, ptr %123, i64 %125
  %127 = getelementptr inbounds %struct.b2ContactData, ptr %126, i32 0, i32 1
  %128 = getelementptr inbounds %struct.b2ShapeId, ptr %20, i32 0, i32 0
  %129 = load ptr, ptr %18, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.b2Shape, ptr %129, i32 0, i32 0
  %131 = load i32, ptr %130, align 8, !tbaa !41
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %128, align 4, !tbaa !27
  %133 = getelementptr inbounds %struct.b2ShapeId, ptr %20, i32 0, i32 1
  %134 = getelementptr inbounds %struct.b2ShapeId, ptr %5, i32 0, i32 1
  %135 = load i16, ptr %134, align 4, !tbaa !11
  store i16 %135, ptr %133, align 4, !tbaa !11
  %136 = getelementptr inbounds %struct.b2ShapeId, ptr %20, i32 0, i32 2
  %137 = load ptr, ptr %18, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.b2Shape, ptr %137, i32 0, i32 20
  %139 = load i16, ptr %138, align 4, !tbaa !42
  store i16 %139, ptr %136, align 2, !tbaa !43
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %127, ptr align 4 %20, i64 8, i1 false), !tbaa.struct !44
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %140 = load ptr, ptr %8, align 8, !tbaa !5
  %141 = load ptr, ptr %16, align 8, !tbaa !5
  %142 = call ptr @b2GetContactSim(ptr noundef %140, ptr noundef %141)
  store ptr %142, ptr %21, align 8, !tbaa !5
  %143 = load ptr, ptr %6, align 8, !tbaa !5
  %144 = load i32, ptr %13, align 4, !tbaa !9
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds %struct.b2ContactData, ptr %143, i64 %145
  %147 = getelementptr inbounds %struct.b2ContactData, ptr %146, i32 0, i32 2
  %148 = load ptr, ptr %21, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.b2ContactSim, ptr %148, i32 0, i32 9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %147, ptr align 4 %149, i64 112, i1 false), !tbaa.struct !46
  %150 = load i32, ptr %13, align 4, !tbaa !9
  %151 = add nsw i32 %150, 1
  store i32 %151, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  br label %152

152:                                              ; preds = %87, %81, %73
  %153 = load ptr, ptr %16, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.b2Contact, ptr %153, i32 0, i32 3
  %155 = load i32, ptr %15, align 4, !tbaa !9
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [2 x %struct.b2ContactEdge], ptr %154, i64 0, i64 %156
  %158 = getelementptr inbounds %struct.b2ContactEdge, ptr %157, i32 0, i32 2
  %159 = load i32, ptr %158, align 4, !tbaa !49
  store i32 %159, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %48, !llvm.loop !51

160:                                              ; preds = %55
  br label %161

161:                                              ; preds = %160
  %162 = load i32, ptr %13, align 4, !tbaa !9
  %163 = load i32, ptr %7, align 4, !tbaa !9
  %164 = icmp sle i32 %162, %163
  br i1 %164, label %169, label %165

165:                                              ; preds = %161
  %166 = call i32 @b2InternalAssertFcn(ptr noundef @.str.25, ptr noundef @.str.1, i32 noundef 1614)
  %167 = icmp ne i32 %166, 0
  br i1 %167, label %168, label %169

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

169:                                              ; preds = %168, %165, %161
  br label %170

170:                                              ; preds = %169
  br label %171

171:                                              ; preds = %170
  %172 = load i32, ptr %13, align 4, !tbaa !9
  store i32 %172, ptr %4, align 4
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %173

173:                                              ; preds = %171, %37
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %174

174:                                              ; preds = %173, %28
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  %175 = load i32, ptr %4, align 4
  ret i32 %175
}

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

declare ptr @b2GetContactSim(ptr noundef, ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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, !13, i64 4}
!12 = !{!"b2ShapeId", !10, i64 0, !13, i64 4, !13, i64 6}
!13 = !{!"short", !7, i64 0}
!14 = !{!15, !10, i64 16}
!15 = !{!"b2Shape", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !16, i64 24, !16, i64 28, !16, i64 32, !16, i64 36, !16, i64 40, !10, i64 44, !17, i64 48, !17, i64 64, !18, i64 80, !10, i64 88, !19, i64 96, !6, i64 120, !10, i64 128, !7, i64 132, !13, i64 276, !21, i64 278, !21, i64 279, !21, i64 280, !21, i64 281, !21, i64 282}
!16 = !{!"float", !7, i64 0}
!17 = !{!"b2AABB", !18, i64 0, !18, i64 8}
!18 = !{!"b2Vec2", !16, i64 0, !16, i64 4}
!19 = !{!"b2Filter", !20, i64 0, !20, i64 8, !10, i64 16}
!20 = !{!"long", !7, i64 0}
!21 = !{!"_Bool", !7, i64 0}
!22 = !{!15, !10, i64 4}
!23 = !{!24, !10, i64 48}
!24 = !{!"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, !16, i64 88, !16, i64 92, !16, i64 96, !16, i64 100, !10, i64 104, !10, i64 108, !10, i64 112, !13, i64 116, !21, i64 118, !21, i64 119, !21, i64 120, !21, i64 121}
!25 = !{!26, !10, i64 36}
!26 = !{!"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, !21, i64 64}
!27 = !{!12, !10, i64 0}
!28 = !{!26, !10, i64 40}
!29 = !{!26, !10, i64 60}
!30 = !{!31, !6, i64 1256}
!31 = !{!"b2World", !32, i64 0, !34, i64 40, !37, i64 336, !38, i64 1008, !33, i64 1032, !38, i64 1048, !33, i64 1072, !38, i64 1088, !33, i64 1112, !38, i64 1128, !33, i64 1152, !38, i64 1168, !33, i64 1192, !38, i64 1208, !38, i64 1232, !33, i64 1256, !33, i64 1272, !33, i64 1288, !33, i64 1304, !33, i64 1320, !33, i64 1336, !33, i64 1352, !33, i64 1368, !7, i64 1384, !7, i64 1416, !10, i64 1448, !33, i64 1456, !39, i64 1472, !39, i64 1488, !39, i64 1504, !39, i64 1520, !20, i64 1536, !10, i64 1544, !18, i64 1548, !16, i64 1556, !16, i64 1560, !16, i64 1564, !16, i64 1568, !16, i64 1572, !16, i64 1576, !16, i64 1580, !16, i64 1584, !6, i64 1592, !6, i64 1600, !13, i64 1608, !40, 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, !16, i64 1784, !10, i64 1788, !10, i64 1792, !13, i64 1796, !21, i64 1798, !21, i64 1799, !21, i64 1800, !21, i64 1801, !21, i64 1802, !21, i64 1803}
!32 = !{!"b2ArenaAllocator", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !33, i64 24}
!33 = !{!"", !6, i64 0, !10, i64 8, !10, i64 12}
!34 = !{!"b2BroadPhase", !7, i64 0, !10, i64 216, !35, i64 224, !33, i64 240, !6, i64 256, !6, i64 264, !10, i64 272, !36, i64 276, !35, i64 280}
!35 = !{!"b2HashSet", !6, i64 0, !10, i64 8, !10, i64 12}
!36 = !{!"b2AtomicInt", !10, i64 0}
!37 = !{!"b2ConstraintGraph", !7, i64 0}
!38 = !{!"b2IdPool", !33, i64 0, !10, i64 16}
!39 = !{!"b2BitSet", !6, i64 0, !10, i64 8, !10, i64 12}
!40 = !{!"b2Profile", !16, i64 0, !16, i64 4, !16, i64 8, !16, i64 12, !16, i64 16, !16, i64 20, !16, i64 24, !16, i64 28, !16, i64 32, !16, i64 36, !16, i64 40, !16, i64 44, !16, i64 48, !16, i64 52, !16, i64 56, !16, i64 60, !16, i64 64, !16, i64 68, !16, i64 72, !16, i64 76, !16, i64 80, !16, i64 84}
!41 = !{!15, !10, i64 0}
!42 = !{!15, !13, i64 276}
!43 = !{!12, !13, i64 6}
!44 = !{i64 0, i64 4, !9, i64 4, i64 2, !45, i64 6, i64 2, !45}
!45 = !{!13, !13, i64 0}
!46 = !{i64 0, i64 4, !47, i64 4, i64 4, !47, i64 8, i64 4, !47, i64 12, i64 96, !48, i64 108, i64 4, !9}
!47 = !{!16, !16, i64 0}
!48 = !{!7, !7, i64 0}
!49 = !{!50, !10, i64 8}
!50 = !{!"b2ContactEdge", !10, i64 0, !10, i64 4, !10, i64 8}
!51 = distinct !{!51, !52}
!52 = !{!"llvm.loop.mustprogress"}


; 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.b2Shape = type { i32, i32, i32, i32, i32, i32, float, float, float, float, float, i32, %struct.b2AABB, %struct.b2AABB, %struct.b2Vec2, i32, %struct.b2Filter, ptr, i32, %union.anon.0, i16, i8, i8, i8, i8, i8 }
%struct.b2AABB = type { %struct.b2Vec2, %struct.b2Vec2 }
%struct.b2Vec2 = type { float, float }
%struct.b2Filter = type { i64, i64, i32 }
%union.anon.0 = type { %struct.b2Polygon }
%struct.b2Polygon = type { [8 x %struct.b2Vec2], [8 x %struct.b2Vec2], %struct.b2Vec2, float, i32 }
%struct.b2ContactData = type { %struct.b2ShapeId, %struct.b2ShapeId, %struct.b2Manifold }
%struct.b2ShapeId = type { i32, i16, i16 }
%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.b2ContactEdge = type { i32, i32, i32 }

@.str.1 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [18 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: 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 ptr @b2GetWorldLocked(i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden ptr @b2GetShape(ptr noundef, i64) local_unnamed_addr #3

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

; Function Attrs: nounwind uwtable
define dso_local i32 @b2Shape_GetContactData(i64 %0, ptr nocapture noundef writeonly %1, i32 noundef %2) local_unnamed_addr #3 {
  %.sroa.041.0.extract.trunc = trunc i64 %0 to i32
  %.sroa.4.0.extract.shift = lshr i64 %0, 32
  %.sroa.4.0.extract.trunc = trunc i64 %.sroa.4.0.extract.shift to i16
  %4 = trunc nuw i64 %.sroa.4.0.extract.shift to i32
  %5 = and i32 %4, 65535
  %6 = tail call ptr @b2GetWorldLocked(i32 noundef %5) #5
  %7 = icmp eq ptr %6, null
  br i1 %7, label %72, label %8

8:                                                ; preds = %3
  %9 = tail call ptr @b2GetShape(ptr noundef nonnull %6, i64 %0)
  %10 = getelementptr inbounds i8, ptr %9, i64 16
  %11 = load i32, ptr %10, align 8, !tbaa !5
  %.not = icmp eq i32 %11, -1
  br i1 %.not, label %12, label %72

12:                                               ; preds = %8
  %13 = getelementptr inbounds i8, ptr %6, i64 1032
  %14 = getelementptr inbounds i8, ptr %9, i64 4
  %15 = load i32, ptr %14, align 4, !tbaa !18
  %16 = tail call ptr @b2BodyArray_Get(ptr noundef nonnull %13, i32 noundef %15)
  %17 = getelementptr inbounds i8, ptr %16, i64 48
  %.04755 = load i32, ptr %17, align 4, !tbaa !19
  %18 = icmp ne i32 %.04755, -1
  %19 = icmp sgt i32 %2, 0
  %20 = and i1 %18, %19
  br i1 %20, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %12
  %21 = getelementptr inbounds i8, ptr %6, i64 1152
  %22 = add nsw i32 %.sroa.041.0.extract.trunc, -1
  %23 = getelementptr inbounds i8, ptr %6, i64 1256
  br label %24

24:                                               ; preds = %.lr.ph, %62
  %.04757 = phi i32 [ %.04755, %.lr.ph ], [ %.047, %62 ]
  %.04856 = phi i32 [ 0, %.lr.ph ], [ %.149, %62 ]
  %25 = ashr i32 %.04757, 1
  %26 = and i32 %.04757, 1
  %27 = tail call ptr @b2ContactArray_Get(ptr noundef nonnull %21, i32 noundef %25)
  %28 = getelementptr inbounds i8, ptr %27, i64 36
  %29 = load i32, ptr %28, align 4, !tbaa !20
  %30 = icmp eq i32 %29, %22
  br i1 %30, label %35, label %31

31:                                               ; preds = %24
  %32 = getelementptr inbounds i8, ptr %27, i64 40
  %33 = load i32, ptr %32, align 4, !tbaa !22
  %34 = icmp eq i32 %33, %22
  br i1 %34, label %35, label %62

35:                                               ; preds = %31, %24
  %36 = getelementptr inbounds i8, ptr %27, i64 60
  %37 = load i32, ptr %36, align 4, !tbaa !23
  %38 = and i32 %37, 1
  %.not54 = icmp eq i32 %38, 0
  br i1 %.not54, label %62, label %39

39:                                               ; preds = %35
  %40 = load ptr, ptr %23, align 8, !tbaa !24
  %41 = sext i32 %29 to i64
  %42 = getelementptr inbounds %struct.b2Shape, ptr %40, i64 %41
  %43 = getelementptr inbounds i8, ptr %27, i64 40
  %44 = load i32, ptr %43, align 4, !tbaa !22
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds %struct.b2Shape, ptr %40, i64 %45
  %47 = sext i32 %.04856 to i64
  %48 = getelementptr inbounds %struct.b2ContactData, ptr %1, i64 %47
  %49 = load i32, ptr %42, align 8, !tbaa !35
  %50 = add nsw i32 %49, 1
  %51 = getelementptr inbounds i8, ptr %42, i64 276
  %52 = load i16, ptr %51, align 4, !tbaa !36
  store i32 %50, ptr %48, align 4, !tbaa !19
  %.sroa.22.0..sroa_idx = getelementptr inbounds i8, ptr %48, i64 4
  store i16 %.sroa.4.0.extract.trunc, ptr %.sroa.22.0..sroa_idx, align 4, !tbaa !37
  %.sroa.33.0..sroa_idx = getelementptr inbounds i8, ptr %48, i64 6
  store i16 %52, ptr %.sroa.33.0..sroa_idx, align 2, !tbaa !37
  %53 = getelementptr inbounds i8, ptr %48, i64 8
  %54 = load i32, ptr %46, align 8, !tbaa !35
  %55 = add nsw i32 %54, 1
  %56 = getelementptr inbounds i8, ptr %46, i64 276
  %57 = load i16, ptr %56, align 4, !tbaa !36
  store i32 %55, ptr %53, align 4, !tbaa !19
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %48, i64 12
  store i16 %.sroa.4.0.extract.trunc, ptr %.sroa.2.0..sroa_idx, align 4, !tbaa !37
  %.sroa.3.0..sroa_idx = getelementptr inbounds i8, ptr %48, i64 14
  store i16 %57, ptr %.sroa.3.0..sroa_idx, align 2, !tbaa !37
  %58 = tail call ptr @b2GetContactSim(ptr noundef nonnull %6, ptr noundef nonnull %27) #5
  %59 = getelementptr inbounds i8, ptr %48, i64 16
  %60 = getelementptr inbounds i8, ptr %58, i64 36
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(112) %59, ptr noundef nonnull align 4 dereferenceable(112) %60, i64 112, i1 false), !tbaa.struct !38
  %61 = add nsw i32 %.04856, 1
  br label %62

62:                                               ; preds = %39, %35, %31
  %.149 = phi i32 [ %61, %39 ], [ %.04856, %35 ], [ %.04856, %31 ]
  %63 = getelementptr inbounds i8, ptr %27, i64 12
  %64 = zext nneg i32 %26 to i64
  %65 = getelementptr inbounds [2 x %struct.b2ContactEdge], ptr %63, i64 0, i64 %64, i32 2
  %.047 = load i32, ptr %65, align 4, !tbaa !19
  %66 = icmp ne i32 %.047, -1
  %67 = icmp slt i32 %.149, %2
  %68 = select i1 %66, i1 %67, i1 false
  br i1 %68, label %24, label %._crit_edge, !llvm.loop !41

._crit_edge:                                      ; preds = %62, %12
  %.048.lcssa = phi i32 [ 0, %12 ], [ %.149, %62 ]
  %.not52 = icmp sgt i32 %.048.lcssa, %2
  br i1 %.not52, label %69, label %72

69:                                               ; preds = %._crit_edge
  %70 = tail call i32 @b2InternalAssertFcn(ptr noundef nonnull @.str.25, ptr noundef nonnull @.str.1, i32 noundef 1614) #5
  %.not53 = icmp eq i32 %70, 0
  br i1 %.not53, label %72, label %71

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

72:                                               ; preds = %8, %69, %._crit_edge, %3
  %.1 = phi i32 [ 0, %3 ], [ 0, %8 ], [ %.048.lcssa, %69 ], [ %.048.lcssa, %._crit_edge ]
  ret i32 %.1
}

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

declare ptr @b2GetContactSim(ptr noundef, ptr noundef) local_unnamed_addr #0

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 16}
!6 = !{!"b2Shape", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !7, i64 44, !11, i64 48, !11, i64 64, !12, i64 80, !7, i64 88, !13, i64 96, !15, i64 120, !7, i64 128, !8, i64 132, !16, i64 276, !17, i64 278, !17, i64 279, !17, i64 280, !17, i64 281, !17, i64 282}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"float", !8, i64 0}
!11 = !{!"b2AABB", !12, i64 0, !12, i64 8}
!12 = !{!"b2Vec2", !10, i64 0, !10, i64 4}
!13 = !{!"b2Filter", !14, i64 0, !14, i64 8, !7, i64 16}
!14 = !{!"long", !8, i64 0}
!15 = !{!"any pointer", !8, i64 0}
!16 = !{!"short", !8, i64 0}
!17 = !{!"_Bool", !8, i64 0}
!18 = !{!6, !7, i64 4}
!19 = !{!7, !7, i64 0}
!20 = !{!21, !7, i64 36}
!21 = !{!"b2Contact", !7, i64 0, !7, i64 4, !7, i64 8, !8, i64 12, !7, i64 36, !7, i64 40, !7, i64 44, !7, i64 48, !7, i64 52, !7, i64 56, !7, i64 60, !17, i64 64}
!22 = !{!21, !7, i64 40}
!23 = !{!21, !7, i64 60}
!24 = !{!25, !15, i64 1256}
!25 = !{!"b2World", !26, i64 0, !28, i64 40, !31, i64 336, !32, i64 1008, !27, i64 1032, !32, i64 1048, !27, i64 1072, !32, i64 1088, !27, i64 1112, !32, i64 1128, !27, i64 1152, !32, i64 1168, !27, i64 1192, !32, i64 1208, !32, i64 1232, !27, i64 1256, !27, i64 1272, !27, i64 1288, !27, i64 1304, !27, i64 1320, !27, i64 1336, !27, i64 1352, !27, i64 1368, !8, i64 1384, !8, i64 1416, !7, i64 1448, !27, i64 1456, !33, i64 1472, !33, i64 1488, !33, i64 1504, !33, i64 1520, !14, i64 1536, !7, i64 1544, !12, i64 1548, !10, i64 1556, !10, i64 1560, !10, i64 1564, !10, i64 1568, !10, i64 1572, !10, i64 1576, !10, i64 1580, !10, i64 1584, !15, i64 1592, !15, i64 1600, !16, i64 1608, !34, i64 1612, !15, i64 1704, !15, i64 1712, !15, i64 1720, !15, i64 1728, !7, i64 1736, !15, i64 1744, !15, i64 1752, !15, i64 1760, !15, i64 1768, !15, i64 1776, !10, i64 1784, !7, i64 1788, !7, i64 1792, !16, i64 1796, !17, i64 1798, !17, i64 1799, !17, i64 1800, !17, i64 1801, !17, i64 1802, !17, i64 1803}
!26 = !{!"b2ArenaAllocator", !15, i64 0, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !27, i64 24}
!27 = !{!"", !15, i64 0, !7, i64 8, !7, i64 12}
!28 = !{!"b2BroadPhase", !8, i64 0, !7, i64 216, !29, i64 224, !27, i64 240, !15, i64 256, !15, i64 264, !7, i64 272, !30, i64 276, !29, i64 280}
!29 = !{!"b2HashSet", !15, i64 0, !7, i64 8, !7, i64 12}
!30 = !{!"b2AtomicInt", !7, i64 0}
!31 = !{!"b2ConstraintGraph", !8, i64 0}
!32 = !{!"b2IdPool", !27, i64 0, !7, i64 16}
!33 = !{!"b2BitSet", !15, i64 0, !7, i64 8, !7, i64 12}
!34 = !{!"b2Profile", !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, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84}
!35 = !{!6, !7, i64 0}
!36 = !{!6, !16, i64 276}
!37 = !{!16, !16, i64 0}
!38 = !{i64 0, i64 4, !39, i64 4, i64 4, !39, i64 8, i64 4, !39, i64 12, i64 96, !40, i64 108, i64 4, !19}
!39 = !{!10, !10, i64 0}
!40 = !{!8, !8, i64 0}
!41 = distinct !{!41, !42}
!42 = !{!"llvm.loop.mustprogress"}


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