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

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.b2BodyId = type { i32, i16, i16 }
%struct.b2ShapeId = type { i32, i16, i16 }
%struct.b2Body = type { [32 x i8], ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, float, float, float, float, i32, i32, i32, i16, i8, i8, i8, i8 }
%struct.b2World = type { %struct.b2ArenaAllocator, %struct.b2BroadPhase, %struct.b2ConstraintGraph, %struct.b2IdPool, %struct.b2BodyArray, %struct.b2IdPool, %struct.b2SolverSetArray, %struct.b2IdPool, %struct.b2JointArray, %struct.b2IdPool, %struct.b2ContactArray, %struct.b2IdPool, %struct.b2IslandArray, %struct.b2IdPool, %struct.b2IdPool, %struct.b2ShapeArray, %struct.b2ChainShapeArray, %struct.b2SensorArray, %struct.b2TaskContextArray, %struct.b2SensorTaskContextArray, %struct.b2BodyMoveEventArray, %struct.b2SensorBeginTouchEventArray, %struct.b2ContactBeginTouchEventArray, [2 x %struct.b2SensorEndTouchEventArray], [2 x %struct.b2ContactEndTouchEventArray], i32, %struct.b2ContactHitEventArray, %struct.b2BitSet, %struct.b2BitSet, %struct.b2BitSet, %struct.b2BitSet, i64, i32, %struct.b2Vec2, float, float, float, float, float, float, float, float, ptr, ptr, i16, %struct.b2Profile, ptr, ptr, ptr, ptr, i32, ptr, ptr, ptr, ptr, ptr, float, i32, i32, i16, i8, i8, i8, i8, i8, i8 }
%struct.b2ArenaAllocator = type { ptr, i32, i32, i32, i32, %struct.b2ArenaEntryArray }
%struct.b2ArenaEntryArray = type { ptr, i32, i32 }
%struct.b2BroadPhase = type { [3 x %struct.b2DynamicTree], i32, %struct.b2HashSet, %struct.b2IntArray, ptr, ptr, i32, %struct.b2AtomicInt, %struct.b2HashSet }
%struct.b2DynamicTree = type { ptr, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, i32 }
%struct.b2IntArray = type { ptr, i32, i32 }
%struct.b2AtomicInt = type { i32 }
%struct.b2HashSet = type { ptr, i32, i32 }
%struct.b2ConstraintGraph = type { [12 x %struct.b2GraphColor] }
%struct.b2GraphColor = type { %struct.b2BitSet, %struct.b2ContactSimArray, %struct.b2JointSimArray, %union.anon }
%struct.b2ContactSimArray = type { ptr, i32, i32 }
%struct.b2JointSimArray = type { ptr, i32, i32 }
%union.anon = type { ptr }
%struct.b2BodyArray = type { ptr, i32, i32 }
%struct.b2SolverSetArray = type { ptr, i32, i32 }
%struct.b2JointArray = type { ptr, i32, i32 }
%struct.b2ContactArray = type { ptr, i32, i32 }
%struct.b2IslandArray = type { ptr, i32, i32 }
%struct.b2IdPool = type { %struct.b2IntArray, i32 }
%struct.b2ShapeArray = type { ptr, i32, i32 }
%struct.b2ChainShapeArray = type { ptr, i32, i32 }
%struct.b2SensorArray = type { ptr, i32, i32 }
%struct.b2TaskContextArray = type { ptr, i32, i32 }
%struct.b2SensorTaskContextArray = type { ptr, i32, i32 }
%struct.b2BodyMoveEventArray = type { ptr, i32, i32 }
%struct.b2SensorBeginTouchEventArray = type { ptr, i32, i32 }
%struct.b2ContactBeginTouchEventArray = type { ptr, i32, i32 }
%struct.b2SensorEndTouchEventArray = type { ptr, i32, i32 }
%struct.b2ContactEndTouchEventArray = type { ptr, i32, i32 }
%struct.b2ContactHitEventArray = type { ptr, i32, i32 }
%struct.b2BitSet = type { ptr, i32, i32 }
%struct.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.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.b2Shape = type { i32, i32, i32, i32, i32, i32, float, float, float, float, float, i32, %struct.b2AABB, %struct.b2AABB, %struct.b2Vec2, i32, %struct.b2Filter, ptr, i32, %union.anon.0, i16, i8, i8, i8, i8, i8 }
%struct.b2AABB = type { %struct.b2Vec2, %struct.b2Vec2 }
%struct.b2Filter = type { i64, i64, i32 }
%union.anon.0 = type { %struct.b2Polygon }
%struct.b2Polygon = type { [8 x %struct.b2Vec2], [8 x %struct.b2Vec2], %struct.b2Vec2, float, i32 }
%struct.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 [60 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [18 x i8], align 1

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

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

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

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

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

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

declare ptr @b2GetWorldLocked(i32 noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @b2Body_GetContactData(i64 %0, ptr noundef %1, i32 noundef %2) #0 {
  %4 = alloca i32, align 4
  %5 = alloca %struct.b2BodyId, 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 i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca %struct.b2ShapeId, align 4
  %19 = alloca %struct.b2ShapeId, align 4
  %20 = 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
  %21 = getelementptr inbounds %struct.b2BodyId, ptr %5, i32 0, i32 1
  %22 = load i16, ptr %21, align 4, !tbaa !11
  %23 = zext i16 %22 to i32
  %24 = call ptr @b2GetWorldLocked(i32 noundef %23)
  store ptr %24, ptr %8, align 8, !tbaa !5
  %25 = load ptr, ptr %8, align 8, !tbaa !5
  %26 = icmp eq ptr %25, null
  br i1 %26, label %27, label %28

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

28:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %29 = load ptr, ptr %8, align 8, !tbaa !5
  %30 = load i64, ptr %5, align 4
  %31 = call ptr @b2GetBodyFullId(ptr noundef %29, i64 %30)
  store ptr %31, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %32 = load ptr, ptr %10, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.b2Body, ptr %32, i32 0, i32 4
  %34 = load i32, ptr %33, align 8, !tbaa !14
  store i32 %34, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %35

35:                                               ; preds = %117, %28
  %36 = load i32, ptr %11, align 4, !tbaa !9
  %37 = icmp ne i32 %36, -1
  br i1 %37, label %38, label %42

38:                                               ; preds = %35
  %39 = load i32, ptr %12, align 4, !tbaa !9
  %40 = load i32, ptr %7, align 4, !tbaa !9
  %41 = icmp slt i32 %39, %40
  br label %42

42:                                               ; preds = %38, %35
  %43 = phi i1 [ false, %35 ], [ %41, %38 ]
  br i1 %43, label %44, label %125

44:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %45 = load i32, ptr %11, align 4, !tbaa !9
  %46 = ashr i32 %45, 1
  store i32 %46, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %47 = load i32, ptr %11, align 4, !tbaa !9
  %48 = and i32 %47, 1
  store i32 %48, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %49 = load ptr, ptr %8, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.b2World, ptr %49, i32 0, i32 10
  %51 = load i32, ptr %13, align 4, !tbaa !9
  %52 = call ptr @b2ContactArray_Get(ptr noundef %50, i32 noundef %51)
  store ptr %52, ptr %15, align 8, !tbaa !5
  %53 = load ptr, ptr %15, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.b2Contact, ptr %53, i32 0, i32 10
  %55 = load i32, ptr %54, align 4, !tbaa !18
  %56 = and i32 %55, 1
  %57 = icmp ne i32 %56, 0
  br i1 %57, label %58, label %117

58:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %59 = load ptr, ptr %8, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.b2World, ptr %59, i32 0, i32 15
  %61 = load ptr, ptr %15, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.b2Contact, ptr %61, i32 0, i32 4
  %63 = load i32, ptr %62, align 4, !tbaa !20
  %64 = call ptr @b2ShapeArray_Get(ptr noundef %60, i32 noundef %63)
  store ptr %64, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %65 = load ptr, ptr %8, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.b2World, ptr %65, i32 0, i32 15
  %67 = load ptr, ptr %15, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.b2Contact, ptr %67, i32 0, i32 5
  %69 = load i32, ptr %68, align 4, !tbaa !21
  %70 = call ptr @b2ShapeArray_Get(ptr noundef %66, i32 noundef %69)
  store ptr %70, ptr %17, align 8, !tbaa !5
  %71 = load ptr, ptr %6, align 8, !tbaa !5
  %72 = load i32, ptr %12, align 4, !tbaa !9
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds %struct.b2ContactData, ptr %71, i64 %73
  %75 = getelementptr inbounds %struct.b2ContactData, ptr %74, i32 0, i32 0
  %76 = getelementptr inbounds %struct.b2ShapeId, ptr %18, i32 0, i32 0
  %77 = load ptr, ptr %16, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.b2Shape, ptr %77, i32 0, i32 0
  %79 = load i32, ptr %78, align 8, !tbaa !22
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %76, align 4, !tbaa !28
  %81 = getelementptr inbounds %struct.b2ShapeId, ptr %18, i32 0, i32 1
  %82 = getelementptr inbounds %struct.b2BodyId, ptr %5, i32 0, i32 1
  %83 = load i16, ptr %82, align 4, !tbaa !11
  store i16 %83, ptr %81, align 4, !tbaa !30
  %84 = getelementptr inbounds %struct.b2ShapeId, ptr %18, i32 0, i32 2
  %85 = load ptr, ptr %16, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.b2Shape, ptr %85, i32 0, i32 20
  %87 = load i16, ptr %86, align 4, !tbaa !31
  store i16 %87, ptr %84, align 2, !tbaa !32
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %75, ptr align 4 %18, i64 8, i1 false), !tbaa.struct !33
  %88 = load ptr, ptr %6, align 8, !tbaa !5
  %89 = load i32, ptr %12, align 4, !tbaa !9
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds %struct.b2ContactData, ptr %88, i64 %90
  %92 = getelementptr inbounds %struct.b2ContactData, ptr %91, i32 0, i32 1
  %93 = getelementptr inbounds %struct.b2ShapeId, ptr %19, i32 0, i32 0
  %94 = load ptr, ptr %17, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.b2Shape, ptr %94, i32 0, i32 0
  %96 = load i32, ptr %95, align 8, !tbaa !22
  %97 = add nsw i32 %96, 1
  store i32 %97, ptr %93, align 4, !tbaa !28
  %98 = getelementptr inbounds %struct.b2ShapeId, ptr %19, i32 0, i32 1
  %99 = getelementptr inbounds %struct.b2BodyId, ptr %5, i32 0, i32 1
  %100 = load i16, ptr %99, align 4, !tbaa !11
  store i16 %100, ptr %98, align 4, !tbaa !30
  %101 = getelementptr inbounds %struct.b2ShapeId, ptr %19, i32 0, i32 2
  %102 = load ptr, ptr %17, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.b2Shape, ptr %102, i32 0, i32 20
  %104 = load i16, ptr %103, align 4, !tbaa !31
  store i16 %104, ptr %101, align 2, !tbaa !32
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %92, ptr align 4 %19, i64 8, i1 false), !tbaa.struct !33
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  %105 = load ptr, ptr %8, align 8, !tbaa !5
  %106 = load ptr, ptr %15, align 8, !tbaa !5
  %107 = call ptr @b2GetContactSim(ptr noundef %105, ptr noundef %106)
  store ptr %107, ptr %20, align 8, !tbaa !5
  %108 = load ptr, ptr %6, align 8, !tbaa !5
  %109 = load i32, ptr %12, align 4, !tbaa !9
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds %struct.b2ContactData, ptr %108, i64 %110
  %112 = getelementptr inbounds %struct.b2ContactData, ptr %111, i32 0, i32 2
  %113 = load ptr, ptr %20, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.b2ContactSim, ptr %113, i32 0, i32 9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %112, ptr align 4 %114, i64 112, i1 false), !tbaa.struct !35
  %115 = load i32, ptr %12, align 4, !tbaa !9
  %116 = add nsw i32 %115, 1
  store i32 %116, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  br label %117

117:                                              ; preds = %58, %44
  %118 = load ptr, ptr %15, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.b2Contact, ptr %118, i32 0, i32 3
  %120 = load i32, ptr %14, align 4, !tbaa !9
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [2 x %struct.b2ContactEdge], ptr %119, i64 0, i64 %121
  %123 = getelementptr inbounds %struct.b2ContactEdge, ptr %122, i32 0, i32 2
  %124 = load i32, ptr %123, align 4, !tbaa !38
  store i32 %124, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %35, !llvm.loop !40

125:                                              ; preds = %42
  br label %126

126:                                              ; preds = %125
  %127 = load i32, ptr %12, align 4, !tbaa !9
  %128 = load i32, ptr %7, align 4, !tbaa !9
  %129 = icmp sle i32 %127, %128
  br i1 %129, label %134, label %130

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

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

134:                                              ; preds = %133, %130, %126
  br label %135

135:                                              ; preds = %134
  br label %136

136:                                              ; preds = %135
  %137 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %137, ptr %4, align 4
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %138

138:                                              ; preds = %136, %27
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  %139 = load i32, ptr %4, align 4
  ret i32 %139
}

; 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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { cold noreturn nounwind memory(inaccessiblemem: write) }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"b2BodyId", !10, i64 0, !13, i64 4, !13, i64 6}
!13 = !{!"short", !7, i64 0}
!14 = !{!15, !10, i64 48}
!15 = !{!"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, !17, i64 118, !17, i64 119, !17, i64 120, !17, i64 121}
!16 = !{!"float", !7, i64 0}
!17 = !{!"_Bool", !7, i64 0}
!18 = !{!19, !10, i64 60}
!19 = !{!"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, !17, i64 64}
!20 = !{!19, !10, i64 36}
!21 = !{!19, !10, i64 40}
!22 = !{!23, !10, i64 0}
!23 = !{!"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, !24, i64 48, !24, i64 64, !25, i64 80, !10, i64 88, !26, i64 96, !6, i64 120, !10, i64 128, !7, i64 132, !13, i64 276, !17, i64 278, !17, i64 279, !17, i64 280, !17, i64 281, !17, i64 282}
!24 = !{!"b2AABB", !25, i64 0, !25, i64 8}
!25 = !{!"b2Vec2", !16, i64 0, !16, i64 4}
!26 = !{!"b2Filter", !27, i64 0, !27, i64 8, !10, i64 16}
!27 = !{!"long", !7, i64 0}
!28 = !{!29, !10, i64 0}
!29 = !{!"b2ShapeId", !10, i64 0, !13, i64 4, !13, i64 6}
!30 = !{!29, !13, i64 4}
!31 = !{!23, !13, i64 276}
!32 = !{!29, !13, i64 6}
!33 = !{i64 0, i64 4, !9, i64 4, i64 2, !34, i64 6, i64 2, !34}
!34 = !{!13, !13, i64 0}
!35 = !{i64 0, i64 4, !36, i64 4, i64 4, !36, i64 8, i64 4, !36, i64 12, i64 96, !37, i64 108, i64 4, !9}
!36 = !{!16, !16, i64 0}
!37 = !{!7, !7, i64 0}
!38 = !{!39, !10, i64 8}
!39 = !{!"b2ContactEdge", !10, i64 0, !10, i64 4, !10, i64 8}
!40 = distinct !{!40, !41}
!41 = !{!"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.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.b2Vec2 = type { float, float }
%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 [60 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [18 x i8], align 1

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

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

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

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

declare ptr @b2GetWorldLocked(i32 noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @b2Body_GetContactData(i64 %0, ptr nocapture noundef writeonly %1, i32 noundef %2) local_unnamed_addr #0 {
  %.sroa.237.0.extract.shift = lshr i64 %0, 32
  %.sroa.237.0.extract.trunc = trunc i64 %.sroa.237.0.extract.shift to i16
  %4 = trunc nuw i64 %.sroa.237.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 %55, label %8

8:                                                ; preds = %3
  %9 = tail call ptr @b2GetBodyFullId(ptr noundef nonnull %6, i64 %0)
  %10 = getelementptr inbounds i8, ptr %9, i64 48
  %.04146 = load i32, ptr %10, align 4, !tbaa !5
  %11 = icmp ne i32 %.04146, -1
  %12 = icmp sgt i32 %2, 0
  %13 = and i1 %11, %12
  br i1 %13, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %8
  %14 = getelementptr inbounds i8, ptr %6, i64 1152
  %15 = getelementptr inbounds i8, ptr %6, i64 1256
  br label %16

16:                                               ; preds = %.lr.ph, %45
  %.04148 = phi i32 [ %.04146, %.lr.ph ], [ %.041, %45 ]
  %.04247 = phi i32 [ 0, %.lr.ph ], [ %.1, %45 ]
  %17 = ashr i32 %.04148, 1
  %18 = and i32 %.04148, 1
  %19 = tail call ptr @b2ContactArray_Get(ptr noundef nonnull %14, i32 noundef %17)
  %20 = getelementptr inbounds i8, ptr %19, i64 60
  %21 = load i32, ptr %20, align 4, !tbaa !9
  %22 = and i32 %21, 1
  %.not45 = icmp eq i32 %22, 0
  br i1 %.not45, label %45, label %23

23:                                               ; preds = %16
  %24 = getelementptr inbounds i8, ptr %19, i64 36
  %25 = load i32, ptr %24, align 4, !tbaa !12
  %26 = tail call ptr @b2ShapeArray_Get(ptr noundef nonnull %15, i32 noundef %25)
  %27 = getelementptr inbounds i8, ptr %19, i64 40
  %28 = load i32, ptr %27, align 4, !tbaa !13
  %29 = tail call ptr @b2ShapeArray_Get(ptr noundef nonnull %15, i32 noundef %28)
  %30 = sext i32 %.04247 to i64
  %31 = getelementptr inbounds %struct.b2ContactData, ptr %1, i64 %30
  %32 = load i32, ptr %26, align 8, !tbaa !14
  %33 = add nsw i32 %32, 1
  %34 = getelementptr inbounds i8, ptr %26, i64 276
  %35 = load i16, ptr %34, align 4, !tbaa !23
  store i32 %33, ptr %31, align 4, !tbaa !5
  %.sroa.22.0..sroa_idx = getelementptr inbounds i8, ptr %31, i64 4
  store i16 %.sroa.237.0.extract.trunc, ptr %.sroa.22.0..sroa_idx, align 4, !tbaa !24
  %.sroa.33.0..sroa_idx = getelementptr inbounds i8, ptr %31, i64 6
  store i16 %35, ptr %.sroa.33.0..sroa_idx, align 2, !tbaa !24
  %36 = getelementptr inbounds i8, ptr %31, i64 8
  %37 = load i32, ptr %29, align 8, !tbaa !14
  %38 = add nsw i32 %37, 1
  %39 = getelementptr inbounds i8, ptr %29, i64 276
  %40 = load i16, ptr %39, align 4, !tbaa !23
  store i32 %38, ptr %36, align 4, !tbaa !5
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %31, i64 12
  store i16 %.sroa.237.0.extract.trunc, ptr %.sroa.2.0..sroa_idx, align 4, !tbaa !24
  %.sroa.3.0..sroa_idx = getelementptr inbounds i8, ptr %31, i64 14
  store i16 %40, ptr %.sroa.3.0..sroa_idx, align 2, !tbaa !24
  %41 = tail call ptr @b2GetContactSim(ptr noundef nonnull %6, ptr noundef nonnull %19) #5
  %42 = getelementptr inbounds i8, ptr %31, i64 16
  %43 = getelementptr inbounds i8, ptr %41, i64 36
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(112) %42, ptr noundef nonnull align 4 dereferenceable(112) %43, i64 112, i1 false), !tbaa.struct !25
  %44 = add nsw i32 %.04247, 1
  br label %45

45:                                               ; preds = %23, %16
  %.1 = phi i32 [ %44, %23 ], [ %.04247, %16 ]
  %46 = getelementptr inbounds i8, ptr %19, i64 12
  %47 = zext nneg i32 %18 to i64
  %48 = getelementptr inbounds [2 x %struct.b2ContactEdge], ptr %46, i64 0, i64 %47, i32 2
  %.041 = load i32, ptr %48, align 4, !tbaa !5
  %49 = icmp ne i32 %.041, -1
  %50 = icmp slt i32 %.1, %2
  %51 = select i1 %49, i1 %50, i1 false
  br i1 %51, label %16, label %._crit_edge, !llvm.loop !28

._crit_edge:                                      ; preds = %45, %8
  %.042.lcssa = phi i32 [ 0, %8 ], [ %.1, %45 ]
  %.not = icmp sgt i32 %.042.lcssa, %2
  br i1 %.not, label %52, label %55

52:                                               ; preds = %._crit_edge
  %53 = tail call i32 @b2InternalAssertFcn(ptr noundef nonnull @.str.18, ptr noundef nonnull @.str.1, i32 noundef 490) #5
  %.not44 = icmp eq i32 %53, 0
  br i1 %.not44, label %55, label %54

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

55:                                               ; preds = %._crit_edge, %52, %3
  %.0 = phi i32 [ 0, %3 ], [ %.042.lcssa, %52 ], [ %.042.lcssa, %._crit_edge ]
  ret i32 %.0
}

; 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 #1

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { cold noreturn nounwind memory(inaccessiblemem: write) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 60}
!10 = !{!"b2Contact", !6, i64 0, !6, i64 4, !6, i64 8, !7, i64 12, !6, i64 36, !6, i64 40, !6, i64 44, !6, i64 48, !6, i64 52, !6, i64 56, !6, i64 60, !11, i64 64}
!11 = !{!"_Bool", !7, i64 0}
!12 = !{!10, !6, i64 36}
!13 = !{!10, !6, i64 40}
!14 = !{!15, !6, i64 0}
!15 = !{!"b2Shape", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !16, i64 24, !16, i64 28, !16, i64 32, !16, i64 36, !16, i64 40, !6, i64 44, !17, i64 48, !17, i64 64, !18, i64 80, !6, i64 88, !19, i64 96, !21, i64 120, !6, i64 128, !7, i64 132, !22, i64 276, !11, i64 278, !11, i64 279, !11, i64 280, !11, i64 281, !11, 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, !6, i64 16}
!20 = !{!"long", !7, i64 0}
!21 = !{!"any pointer", !7, i64 0}
!22 = !{!"short", !7, i64 0}
!23 = !{!15, !22, i64 276}
!24 = !{!22, !22, i64 0}
!25 = !{i64 0, i64 4, !26, i64 4, i64 4, !26, i64 8, i64 4, !26, i64 12, i64 96, !27, i64 108, i64 4, !5}
!26 = !{!16, !16, i64 0}
!27 = !{!7, !7, i64 0}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}


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