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

; 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.b2SensorEndTouchEvent = type { %struct.b2ShapeId, %struct.b2ShapeId }
%struct.b2ShapeId = type { i32, i16, i16 }
%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.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.b2Sensor = type { %struct.b2ShapeRefArray, %struct.b2ShapeRefArray, i32 }
%struct.b2ShapeRefArray = type { ptr, i32, i32 }
%struct.b2ShapeRef = type { i32, i16 }

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

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

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

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @b2SensorEndTouchEventArray_Push(ptr noundef, i64, i64) #2

; Function Attrs: nounwind uwtable
define dso_local void @b2DestroySensor(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca %struct.b2SensorEndTouchEvent, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.b2World, ptr %12, i32 0, i32 17
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.b2Shape, ptr %14, i32 0, i32 4
  %16 = load i32, ptr %15, align 8, !tbaa !9
  %17 = call ptr @b2SensorArray_Get(ptr noundef %13, i32 noundef %16)
  store ptr %17, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 0, ptr %6, align 4, !tbaa !19
  br label %18

18:                                               ; preds = %74, %2
  %19 = load i32, ptr %6, align 4, !tbaa !19
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.b2Sensor, ptr %20, i32 0, i32 1
  %22 = getelementptr inbounds %struct.b2ShapeRefArray, ptr %21, i32 0, i32 1
  %23 = load i32, ptr %22, align 8, !tbaa !20
  %24 = icmp slt i32 %19, %23
  br i1 %24, label %26, label %25

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

26:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.b2Sensor, ptr %27, i32 0, i32 1
  %29 = getelementptr inbounds %struct.b2ShapeRefArray, ptr %28, i32 0, i32 0
  %30 = load ptr, ptr %29, align 8, !tbaa !23
  %31 = load i32, ptr %6, align 4, !tbaa !19
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds %struct.b2ShapeRef, ptr %30, i64 %32
  store ptr %33, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #3
  %34 = getelementptr inbounds %struct.b2SensorEndTouchEvent, ptr %8, i32 0, i32 0
  %35 = getelementptr inbounds %struct.b2ShapeId, ptr %34, i32 0, i32 0
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.b2Shape, ptr %36, i32 0, i32 0
  %38 = load i32, ptr %37, align 8, !tbaa !24
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr %35, align 4, !tbaa !25
  %40 = getelementptr inbounds %struct.b2ShapeId, ptr %34, i32 0, i32 1
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.b2World, ptr %41, i32 0, i32 59
  %43 = load i16, ptr %42, align 4, !tbaa !27
  store i16 %43, ptr %40, align 4, !tbaa !37
  %44 = getelementptr inbounds %struct.b2ShapeId, ptr %34, i32 0, i32 2
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.b2Shape, ptr %45, i32 0, i32 20
  %47 = load i16, ptr %46, align 4, !tbaa !38
  store i16 %47, ptr %44, align 2, !tbaa !39
  %48 = getelementptr inbounds %struct.b2SensorEndTouchEvent, ptr %8, i32 0, i32 1
  %49 = getelementptr inbounds %struct.b2ShapeId, ptr %48, i32 0, i32 0
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.b2ShapeRef, ptr %50, i32 0, i32 0
  %52 = load i32, ptr %51, align 4, !tbaa !40
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %49, align 4, !tbaa !25
  %54 = getelementptr inbounds %struct.b2ShapeId, ptr %48, i32 0, i32 1
  %55 = load ptr, ptr %3, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.b2World, ptr %55, i32 0, i32 59
  %57 = load i16, ptr %56, align 4, !tbaa !27
  store i16 %57, ptr %54, align 4, !tbaa !37
  %58 = getelementptr inbounds %struct.b2ShapeId, ptr %48, i32 0, i32 2
  %59 = load ptr, ptr %7, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.b2ShapeRef, ptr %59, i32 0, i32 1
  %61 = load i16, ptr %60, align 4, !tbaa !42
  store i16 %61, ptr %58, align 2, !tbaa !39
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.b2World, ptr %62, i32 0, i32 23
  %64 = getelementptr inbounds [2 x %struct.b2SensorEndTouchEventArray], ptr %63, i64 0, i64 0
  %65 = load ptr, ptr %3, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.b2World, ptr %65, i32 0, i32 25
  %67 = load i32, ptr %66, align 8, !tbaa !43
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds %struct.b2SensorEndTouchEventArray, ptr %64, i64 %68
  %70 = getelementptr inbounds { i64, i64 }, ptr %8, i32 0, i32 0
  %71 = load i64, ptr %70, align 4
  %72 = getelementptr inbounds { i64, i64 }, ptr %8, i32 0, i32 1
  %73 = load i64, ptr %72, align 4
  call void @b2SensorEndTouchEventArray_Push(ptr noundef %69, i64 %71, i64 %73)
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  br label %74

74:                                               ; preds = %26
  %75 = load i32, ptr %6, align 4, !tbaa !19
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %6, align 4, !tbaa !19
  br label %18, !llvm.loop !44

77:                                               ; preds = %25
  %78 = load ptr, ptr %5, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.b2Sensor, ptr %78, i32 0, i32 0
  call void @b2ShapeRefArray_Destroy(ptr noundef %79)
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.b2Sensor, ptr %80, i32 0, i32 1
  call void @b2ShapeRefArray_Destroy(ptr noundef %81)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  %82 = load ptr, ptr %3, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.b2World, ptr %82, i32 0, i32 17
  %84 = load ptr, ptr %4, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.b2Shape, ptr %84, i32 0, i32 4
  %86 = load i32, ptr %85, align 8, !tbaa !9
  %87 = call i32 @b2SensorArray_RemoveSwap(ptr noundef %83, i32 noundef %86)
  store i32 %87, ptr %9, align 4, !tbaa !19
  %88 = load i32, ptr %9, align 4, !tbaa !19
  %89 = icmp ne i32 %88, -1
  br i1 %89, label %90, label %108

90:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %91 = load ptr, ptr %3, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.b2World, ptr %91, i32 0, i32 17
  %93 = load ptr, ptr %4, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.b2Shape, ptr %93, i32 0, i32 4
  %95 = load i32, ptr %94, align 8, !tbaa !9
  %96 = call ptr @b2SensorArray_Get(ptr noundef %92, i32 noundef %95)
  store ptr %96, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %97 = load ptr, ptr %3, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.b2World, ptr %97, i32 0, i32 15
  %99 = load ptr, ptr %10, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.b2Sensor, ptr %99, i32 0, i32 2
  %101 = load i32, ptr %100, align 8, !tbaa !46
  %102 = call ptr @b2ShapeArray_Get(ptr noundef %98, i32 noundef %101)
  store ptr %102, ptr %11, align 8, !tbaa !5
  %103 = load ptr, ptr %4, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.b2Shape, ptr %103, i32 0, i32 4
  %105 = load i32, ptr %104, align 8, !tbaa !9
  %106 = load ptr, ptr %11, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.b2Shape, ptr %106, i32 0, i32 4
  store i32 %105, ptr %107, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  br label %108

108:                                              ; preds = %90, %77
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  ret void
}

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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, !11, i64 16}
!10 = !{!"b2Shape", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 40, !11, i64 44, !13, i64 48, !13, i64 64, !14, i64 80, !11, i64 88, !15, i64 96, !6, i64 120, !11, i64 128, !7, i64 132, !17, i64 276, !18, i64 278, !18, i64 279, !18, i64 280, !18, i64 281, !18, i64 282}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!"b2AABB", !14, i64 0, !14, i64 8}
!14 = !{!"b2Vec2", !12, i64 0, !12, i64 4}
!15 = !{!"b2Filter", !16, i64 0, !16, i64 8, !11, i64 16}
!16 = !{!"long", !7, i64 0}
!17 = !{!"short", !7, i64 0}
!18 = !{!"_Bool", !7, i64 0}
!19 = !{!11, !11, i64 0}
!20 = !{!21, !11, i64 24}
!21 = !{!"b2Sensor", !22, i64 0, !22, i64 16, !11, i64 32}
!22 = !{!"", !6, i64 0, !11, i64 8, !11, i64 12}
!23 = !{!21, !6, i64 16}
!24 = !{!10, !11, i64 0}
!25 = !{!26, !11, i64 0}
!26 = !{!"b2ShapeId", !11, i64 0, !17, i64 4, !17, i64 6}
!27 = !{!28, !17, i64 1796}
!28 = !{!"b2World", !29, i64 0, !30, i64 40, !33, i64 336, !34, i64 1008, !22, i64 1032, !34, i64 1048, !22, i64 1072, !34, i64 1088, !22, i64 1112, !34, i64 1128, !22, i64 1152, !34, i64 1168, !22, i64 1192, !34, i64 1208, !34, i64 1232, !22, i64 1256, !22, i64 1272, !22, i64 1288, !22, i64 1304, !22, i64 1320, !22, i64 1336, !22, i64 1352, !22, i64 1368, !7, i64 1384, !7, i64 1416, !11, i64 1448, !22, i64 1456, !35, i64 1472, !35, i64 1488, !35, i64 1504, !35, i64 1520, !16, i64 1536, !11, i64 1544, !14, i64 1548, !12, i64 1556, !12, i64 1560, !12, i64 1564, !12, i64 1568, !12, i64 1572, !12, i64 1576, !12, i64 1580, !12, i64 1584, !6, i64 1592, !6, i64 1600, !17, i64 1608, !36, i64 1612, !6, i64 1704, !6, i64 1712, !6, i64 1720, !6, i64 1728, !11, i64 1736, !6, i64 1744, !6, i64 1752, !6, i64 1760, !6, i64 1768, !6, i64 1776, !12, i64 1784, !11, i64 1788, !11, i64 1792, !17, i64 1796, !18, i64 1798, !18, i64 1799, !18, i64 1800, !18, i64 1801, !18, i64 1802, !18, i64 1803}
!29 = !{!"b2ArenaAllocator", !6, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !22, i64 24}
!30 = !{!"b2BroadPhase", !7, i64 0, !11, i64 216, !31, i64 224, !22, i64 240, !6, i64 256, !6, i64 264, !11, i64 272, !32, i64 276, !31, i64 280}
!31 = !{!"b2HashSet", !6, i64 0, !11, i64 8, !11, i64 12}
!32 = !{!"b2AtomicInt", !11, i64 0}
!33 = !{!"b2ConstraintGraph", !7, i64 0}
!34 = !{!"b2IdPool", !22, i64 0, !11, i64 16}
!35 = !{!"b2BitSet", !6, i64 0, !11, i64 8, !11, i64 12}
!36 = !{!"b2Profile", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 40, !12, i64 44, !12, i64 48, !12, i64 52, !12, i64 56, !12, i64 60, !12, i64 64, !12, i64 68, !12, i64 72, !12, i64 76, !12, i64 80, !12, i64 84}
!37 = !{!26, !17, i64 4}
!38 = !{!10, !17, i64 276}
!39 = !{!26, !17, i64 6}
!40 = !{!41, !11, i64 0}
!41 = !{!"b2ShapeRef", !11, i64 0, !17, i64 4}
!42 = !{!41, !17, i64 4}
!43 = !{!28, !11, i64 1448}
!44 = distinct !{!44, !45}
!45 = !{!"llvm.loop.mustprogress"}
!46 = !{!21, !11, i64 32}


; 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.b2ShapeRef = type { i32, i16 }
%struct.b2SensorEndTouchEventArray = type { ptr, i32, i32 }

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

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @b2SensorEndTouchEventArray_Push(ptr noundef, i64, i64) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @b2DestroySensor(ptr noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 1288
  %4 = getelementptr inbounds i8, ptr %1, i64 16
  %5 = load i32, ptr %4, align 8, !tbaa !5
  %6 = tail call ptr @b2SensorArray_Get(ptr noundef nonnull %3, i32 noundef %5)
  %7 = getelementptr inbounds i8, ptr %6, i64 16
  %8 = getelementptr inbounds i8, ptr %6, i64 24
  %9 = load i32, ptr %8, align 8, !tbaa !18
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %2
  %11 = getelementptr inbounds i8, ptr %0, i64 1796
  %12 = getelementptr inbounds i8, ptr %1, i64 276
  %13 = getelementptr inbounds i8, ptr %0, i64 1384
  %14 = getelementptr inbounds i8, ptr %0, i64 1448
  br label %17

._crit_edge:                                      ; preds = %17, %2
  tail call void @b2ShapeRefArray_Destroy(ptr noundef nonnull %6)
  tail call void @b2ShapeRefArray_Destroy(ptr noundef nonnull %7)
  %15 = load i32, ptr %4, align 8, !tbaa !5
  %16 = tail call i32 @b2SensorArray_RemoveSwap(ptr noundef nonnull %3, i32 noundef %15)
  %.not = icmp eq i32 %16, -1
  br i1 %.not, label %45, label %36

17:                                               ; preds = %.lr.ph, %17
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %17 ]
  %18 = load ptr, ptr %7, align 8, !tbaa !21
  %19 = getelementptr inbounds %struct.b2ShapeRef, ptr %18, i64 %indvars.iv
  %20 = load i32, ptr %1, align 8, !tbaa !22
  %21 = add nsw i32 %20, 1
  %.sroa.0.0.insert.ext = zext i32 %21 to i64
  %22 = load i16, ptr %11, align 4, !tbaa !23
  %.sroa.0.4.insert.ext = zext i16 %22 to i64
  %.sroa.0.4.insert.shift = shl nuw nsw i64 %.sroa.0.4.insert.ext, 32
  %23 = load i16, ptr %12, align 4, !tbaa !33
  %.sroa.0.6.insert.ext = zext i16 %23 to i64
  %.sroa.0.6.insert.shift = shl nuw i64 %.sroa.0.6.insert.ext, 48
  %24 = or disjoint i64 %.sroa.0.6.insert.shift, %.sroa.0.0.insert.ext
  %.sroa.0.6.insert.insert = or disjoint i64 %24, %.sroa.0.4.insert.shift
  %25 = load i32, ptr %19, align 4, !tbaa !34
  %26 = add nsw i32 %25, 1
  %.sroa.6.8.insert.ext = zext i32 %26 to i64
  %27 = getelementptr inbounds i8, ptr %19, i64 4
  %28 = load i16, ptr %27, align 4, !tbaa !36
  %.sroa.6.14.insert.ext = zext i16 %28 to i64
  %.sroa.6.14.insert.shift = shl nuw i64 %.sroa.6.14.insert.ext, 48
  %29 = or disjoint i64 %.sroa.6.14.insert.shift, %.sroa.6.8.insert.ext
  %.sroa.6.14.insert.insert = or disjoint i64 %29, %.sroa.0.4.insert.shift
  %30 = load i32, ptr %14, align 8, !tbaa !37
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds %struct.b2SensorEndTouchEventArray, ptr %13, i64 %31
  tail call void @b2SensorEndTouchEventArray_Push(ptr noundef nonnull %32, i64 %.sroa.0.6.insert.insert, i64 %.sroa.6.14.insert.insert)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %33 = load i32, ptr %8, align 8, !tbaa !18
  %34 = sext i32 %33 to i64
  %35 = icmp slt i64 %indvars.iv.next, %34
  br i1 %35, label %17, label %._crit_edge, !llvm.loop !38

36:                                               ; preds = %._crit_edge
  %37 = load i32, ptr %4, align 8, !tbaa !5
  %38 = tail call ptr @b2SensorArray_Get(ptr noundef nonnull %3, i32 noundef %37)
  %39 = getelementptr inbounds i8, ptr %0, i64 1256
  %40 = getelementptr inbounds i8, ptr %38, i64 32
  %41 = load i32, ptr %40, align 8, !tbaa !40
  %42 = tail call ptr @b2ShapeArray_Get(ptr noundef nonnull %39, i32 noundef %41)
  %43 = load i32, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds i8, ptr %42, i64 16
  store i32 %43, ptr %44, align 8, !tbaa !5
  br label %45

45:                                               ; preds = %36, %._crit_edge
  ret void
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @b2SensorArray_RemoveSwap(ptr noundef, i32 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 = { 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" }

!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 = !{!19, !7, i64 24}
!19 = !{!"b2Sensor", !20, i64 0, !20, i64 16, !7, i64 32}
!20 = !{!"", !15, i64 0, !7, i64 8, !7, i64 12}
!21 = !{!19, !15, i64 16}
!22 = !{!6, !7, i64 0}
!23 = !{!24, !16, i64 1796}
!24 = !{!"b2World", !25, i64 0, !26, i64 40, !29, i64 336, !30, i64 1008, !20, i64 1032, !30, i64 1048, !20, i64 1072, !30, i64 1088, !20, i64 1112, !30, i64 1128, !20, i64 1152, !30, i64 1168, !20, i64 1192, !30, i64 1208, !30, i64 1232, !20, i64 1256, !20, i64 1272, !20, i64 1288, !20, i64 1304, !20, i64 1320, !20, i64 1336, !20, i64 1352, !20, i64 1368, !8, i64 1384, !8, i64 1416, !7, i64 1448, !20, i64 1456, !31, i64 1472, !31, i64 1488, !31, i64 1504, !31, 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, !32, 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}
!25 = !{!"b2ArenaAllocator", !15, i64 0, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !20, i64 24}
!26 = !{!"b2BroadPhase", !8, i64 0, !7, i64 216, !27, i64 224, !20, i64 240, !15, i64 256, !15, i64 264, !7, i64 272, !28, i64 276, !27, i64 280}
!27 = !{!"b2HashSet", !15, i64 0, !7, i64 8, !7, i64 12}
!28 = !{!"b2AtomicInt", !7, i64 0}
!29 = !{!"b2ConstraintGraph", !8, i64 0}
!30 = !{!"b2IdPool", !20, i64 0, !7, i64 16}
!31 = !{!"b2BitSet", !15, i64 0, !7, i64 8, !7, i64 12}
!32 = !{!"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}
!33 = !{!6, !16, i64 276}
!34 = !{!35, !7, i64 0}
!35 = !{!"b2ShapeRef", !7, i64 0, !16, i64 4}
!36 = !{!35, !16, i64 4}
!37 = !{!24, !7, i64 1448}
!38 = distinct !{!38, !39}
!39 = !{!"llvm.loop.mustprogress"}
!40 = !{!19, !7, i64 32}


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