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

; 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.b2MoveResult = type { ptr }
%struct.b2MovePair = type { i32, i32, ptr, i8 }

@.str.1 = external hidden unnamed_addr constant [67 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [11 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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @b2UpdateBroadPhasePairs(ptr noundef %0) #4 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, 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 ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.b2World, ptr %17, i32 0, i32 1
  store ptr %18, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.b2BroadPhase, ptr %19, i32 0, i32 3
  %21 = getelementptr inbounds %struct.b2IntArray, ptr %20, i32 0, i32 1
  %22 = load i32, ptr %21, align 8, !tbaa !9
  store i32 %22, ptr %4, align 4, !tbaa !15
  br label %23

23:                                               ; preds = %1
  %24 = load i32, ptr %4, align 4, !tbaa !15
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.b2BroadPhase, ptr %25, i32 0, i32 2
  %27 = getelementptr inbounds %struct.b2HashSet, ptr %26, i32 0, i32 2
  %28 = load i32, ptr %27, align 4, !tbaa !16
  %29 = icmp eq i32 %24, %28
  br i1 %29, label %34, label %30

30:                                               ; preds = %23
  %31 = call i32 @b2InternalAssertFcn(ptr noundef @.str.6, ptr noundef @.str.1, i32 noundef 384)
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %33, label %34

33:                                               ; preds = %30
  call void @llvm.trap()
  br label %34

34:                                               ; preds = %33, %30, %23
  br label %35

35:                                               ; preds = %34
  br label %36

36:                                               ; preds = %35
  %37 = load i32, ptr %4, align 4, !tbaa !15
  %38 = icmp eq i32 %37, 0
  br i1 %38, label %39, label %40

39:                                               ; preds = %36
  store i32 1, ptr %5, align 4
  br label %165

40:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %41 = load ptr, ptr %2, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.b2World, ptr %41, i32 0, i32 0
  store ptr %42, ptr %6, align 8, !tbaa !5
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = load i32, ptr %4, align 4, !tbaa !15
  %45 = sext i32 %44 to i64
  %46 = mul i64 %45, 8
  %47 = trunc i64 %46 to i32
  %48 = call ptr @b2AllocateArenaItem(ptr noundef %43, i32 noundef %47, ptr noundef @.str.7)
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.b2BroadPhase, ptr %49, i32 0, i32 4
  store ptr %48, ptr %50, align 8, !tbaa !17
  %51 = load i32, ptr %4, align 4, !tbaa !15
  %52 = mul nsw i32 16, %51
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.b2BroadPhase, ptr %53, i32 0, i32 6
  store i32 %52, ptr %54, align 8, !tbaa !18
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = load ptr, ptr %3, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.b2BroadPhase, ptr %56, i32 0, i32 6
  %58 = load i32, ptr %57, align 8, !tbaa !18
  %59 = sext i32 %58 to i64
  %60 = mul i64 %59, 24
  %61 = trunc i64 %60 to i32
  %62 = call ptr @b2AllocateArenaItem(ptr noundef %55, i32 noundef %61, ptr noundef @.str.8)
  %63 = load ptr, ptr %3, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.b2BroadPhase, ptr %63, i32 0, i32 5
  store ptr %62, ptr %64, align 8, !tbaa !19
  %65 = load ptr, ptr %3, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.b2BroadPhase, ptr %65, i32 0, i32 7
  call void @b2AtomicStoreInt(ptr noundef %66, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 64, ptr %7, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %67 = load ptr, ptr %2, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.b2World, ptr %67, i32 0, i32 51
  %69 = load ptr, ptr %68, align 8, !tbaa !20
  %70 = load i32, ptr %4, align 4, !tbaa !15
  %71 = load i32, ptr %7, align 4, !tbaa !15
  %72 = load ptr, ptr %2, align 8, !tbaa !5
  %73 = load ptr, ptr %2, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.b2World, ptr %73, i32 0, i32 53
  %75 = load ptr, ptr %74, align 8, !tbaa !32
  %76 = call ptr %69(ptr noundef @b2FindPairsTask, i32 noundef %70, i32 noundef %71, ptr noundef %72, ptr noundef %75)
  store ptr %76, ptr %8, align 8, !tbaa !5
  %77 = load ptr, ptr %8, align 8, !tbaa !5
  %78 = icmp ne ptr %77, null
  br i1 %78, label %79, label %91

79:                                               ; preds = %40
  %80 = load ptr, ptr %2, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.b2World, ptr %80, i32 0, i32 52
  %82 = load ptr, ptr %81, align 8, !tbaa !33
  %83 = load ptr, ptr %8, align 8, !tbaa !5
  %84 = load ptr, ptr %2, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.b2World, ptr %84, i32 0, i32 53
  %86 = load ptr, ptr %85, align 8, !tbaa !32
  call void %82(ptr noundef %83, ptr noundef %86)
  %87 = load ptr, ptr %2, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.b2World, ptr %87, i32 0, i32 58
  %89 = load i32, ptr %88, align 8, !tbaa !34
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr %88, align 8, !tbaa !34
  br label %91

91:                                               ; preds = %79, %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !15
  br label %92

92:                                               ; preds = %144, %91
  %93 = load i32, ptr %9, align 4, !tbaa !15
  %94 = load i32, ptr %4, align 4, !tbaa !15
  %95 = icmp slt i32 %93, %94
  br i1 %95, label %97, label %96

96:                                               ; preds = %92
  store i32 4, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %147

97:                                               ; preds = %92
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %98 = load ptr, ptr %3, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.b2BroadPhase, ptr %98, i32 0, i32 4
  %100 = load ptr, ptr %99, align 8, !tbaa !17
  %101 = load i32, ptr %9, align 4, !tbaa !15
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds %struct.b2MoveResult, ptr %100, i64 %102
  store ptr %103, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %104 = load ptr, ptr %10, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.b2MoveResult, ptr %104, i32 0, i32 0
  %106 = load ptr, ptr %105, align 8, !tbaa !35
  store ptr %106, ptr %11, align 8, !tbaa !5
  br label %107

107:                                              ; preds = %142, %97
  %108 = load ptr, ptr %11, align 8, !tbaa !5
  %109 = icmp ne ptr %108, null
  br i1 %109, label %110, label %143

110:                                              ; preds = %107
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %111 = load ptr, ptr %11, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.b2MovePair, ptr %111, i32 0, i32 0
  %113 = load i32, ptr %112, align 8, !tbaa !37
  store i32 %113, ptr %12, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %114 = load ptr, ptr %11, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.b2MovePair, ptr %114, i32 0, i32 1
  %116 = load i32, ptr %115, align 4, !tbaa !39
  store i32 %116, ptr %13, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %117 = load ptr, ptr %2, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.b2World, ptr %117, i32 0, i32 15
  %119 = load i32, ptr %12, align 4, !tbaa !15
  %120 = call ptr @b2ShapeArray_Get(ptr noundef %118, i32 noundef %119)
  store ptr %120, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %121 = load ptr, ptr %2, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.b2World, ptr %121, i32 0, i32 15
  %123 = load i32, ptr %13, align 4, !tbaa !15
  %124 = call ptr @b2ShapeArray_Get(ptr noundef %122, i32 noundef %123)
  store ptr %124, ptr %15, align 8, !tbaa !5
  %125 = load ptr, ptr %2, align 8, !tbaa !5
  %126 = load ptr, ptr %14, align 8, !tbaa !5
  %127 = load ptr, ptr %15, align 8, !tbaa !5
  call void @b2CreateContact(ptr noundef %125, ptr noundef %126, ptr noundef %127)
  %128 = load ptr, ptr %11, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.b2MovePair, ptr %128, i32 0, i32 3
  %130 = load i8, ptr %129, align 8, !tbaa !40, !range !41, !noundef !42
  %131 = trunc i8 %130 to i1
  br i1 %131, label %132, label %138

132:                                              ; preds = %110
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %133 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %133, ptr %16, align 8, !tbaa !5
  %134 = load ptr, ptr %11, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.b2MovePair, ptr %134, i32 0, i32 2
  %136 = load ptr, ptr %135, align 8, !tbaa !43
  store ptr %136, ptr %11, align 8, !tbaa !5
  %137 = load ptr, ptr %16, align 8, !tbaa !5
  call void @b2Free(ptr noundef %137, i32 noundef 24)
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  br label %142

138:                                              ; preds = %110
  %139 = load ptr, ptr %11, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.b2MovePair, ptr %139, i32 0, i32 2
  %141 = load ptr, ptr %140, align 8, !tbaa !43
  store ptr %141, ptr %11, align 8, !tbaa !5
  br label %142

142:                                              ; preds = %138, %132
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %107, !llvm.loop !44

143:                                              ; preds = %107
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %144

144:                                              ; preds = %143
  %145 = load i32, ptr %9, align 4, !tbaa !15
  %146 = add nsw i32 %145, 1
  store i32 %146, ptr %9, align 4, !tbaa !15
  br label %92, !llvm.loop !46

147:                                              ; preds = %96
  %148 = load ptr, ptr %3, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.b2BroadPhase, ptr %148, i32 0, i32 3
  call void @b2IntArray_Clear(ptr noundef %149)
  %150 = load ptr, ptr %3, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.b2BroadPhase, ptr %150, i32 0, i32 2
  call void @b2ClearSet(ptr noundef %151)
  %152 = load ptr, ptr %6, align 8, !tbaa !5
  %153 = load ptr, ptr %3, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.b2BroadPhase, ptr %153, i32 0, i32 5
  %155 = load ptr, ptr %154, align 8, !tbaa !19
  call void @b2FreeArenaItem(ptr noundef %152, ptr noundef %155)
  %156 = load ptr, ptr %3, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.b2BroadPhase, ptr %156, i32 0, i32 5
  store ptr null, ptr %157, align 8, !tbaa !19
  %158 = load ptr, ptr %6, align 8, !tbaa !5
  %159 = load ptr, ptr %3, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.b2BroadPhase, ptr %159, i32 0, i32 4
  %161 = load ptr, ptr %160, align 8, !tbaa !17
  call void @b2FreeArenaItem(ptr noundef %158, ptr noundef %161)
  %162 = load ptr, ptr %3, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.b2BroadPhase, ptr %162, i32 0, i32 4
  store ptr null, ptr %163, align 8, !tbaa !17
  %164 = load ptr, ptr %2, align 8, !tbaa !5
  call void @b2ValidateSolverSets(ptr noundef %164)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  store i32 0, ptr %5, align 4
  br label %165

165:                                              ; preds = %147, %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  %166 = load i32, ptr %5, align 4
  switch i32 %166, label %168 [
    i32 0, label %167
    i32 1, label %167
  ]

167:                                              ; preds = %165, %165
  ret void

168:                                              ; preds = %165
  unreachable
}

declare ptr @b2AllocateArenaItem(ptr noundef, i32 noundef, ptr noundef) #2

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

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

declare void @b2CreateContact(ptr noundef, ptr noundef, ptr noundef) #2

declare void @b2Free(ptr noundef, i32 noundef) #2

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

declare void @b2ClearSet(ptr noundef) #2

declare void @b2FreeArenaItem(ptr noundef, ptr noundef) #2

declare void @b2ValidateSolverSets(ptr noundef) #2

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


; 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.b2MoveResult = type { ptr }

@.str.1 = external hidden unnamed_addr constant [67 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [11 x i8], align 1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @b2AtomicStoreInt(ptr noundef, i32 noundef) 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: nounwind uwtable
define dso_local void @b2UpdateBroadPhasePairs(ptr noundef %0) local_unnamed_addr #3 {
  %2 = getelementptr inbounds i8, ptr %0, i64 280
  %3 = getelementptr inbounds i8, ptr %0, i64 288
  %4 = load i32, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 264
  %6 = getelementptr inbounds i8, ptr %0, i64 276
  %7 = load i32, ptr %6, align 4, !tbaa !14
  %8 = icmp eq i32 %4, %7
  br i1 %8, label %12, label %9

9:                                                ; preds = %1
  %10 = tail call i32 @b2InternalAssertFcn(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.1, i32 noundef 384) #5
  %.not = icmp eq i32 %10, 0
  br i1 %.not, label %12, label %11

11:                                               ; preds = %9
  tail call void @llvm.trap()
  unreachable

12:                                               ; preds = %9, %1
  %13 = icmp eq i32 %4, 0
  br i1 %13, label %57, label %14

14:                                               ; preds = %12
  %15 = shl i32 %4, 3
  %16 = tail call ptr @b2AllocateArenaItem(ptr noundef nonnull %0, i32 noundef %15, ptr noundef nonnull @.str.7) #5
  %17 = getelementptr inbounds i8, ptr %0, i64 296
  store ptr %16, ptr %17, align 8, !tbaa !15
  %18 = shl nsw i32 %4, 4
  %19 = getelementptr inbounds i8, ptr %0, i64 312
  store i32 %18, ptr %19, align 8, !tbaa !16
  %20 = mul i32 %4, 384
  %21 = tail call ptr @b2AllocateArenaItem(ptr noundef nonnull %0, i32 noundef %20, ptr noundef nonnull @.str.8) #5
  %22 = getelementptr inbounds i8, ptr %0, i64 304
  store ptr %21, ptr %22, align 8, !tbaa !17
  %23 = getelementptr inbounds i8, ptr %0, i64 316
  tail call void @b2AtomicStoreInt(ptr noundef nonnull %23, i32 noundef 0)
  %24 = getelementptr inbounds i8, ptr %0, i64 1744
  %25 = load ptr, ptr %24, align 8, !tbaa !18
  %26 = getelementptr inbounds i8, ptr %0, i64 1760
  %27 = load ptr, ptr %26, align 8, !tbaa !30
  %28 = tail call ptr %25(ptr noundef nonnull @b2FindPairsTask, i32 noundef %4, i32 noundef 64, ptr noundef nonnull %0, ptr noundef %27) #5
  %.not57 = icmp eq ptr %28, null
  br i1 %.not57, label %36, label %29

29:                                               ; preds = %14
  %30 = getelementptr inbounds i8, ptr %0, i64 1752
  %31 = load ptr, ptr %30, align 8, !tbaa !31
  %32 = load ptr, ptr %26, align 8, !tbaa !30
  tail call void %31(ptr noundef nonnull %28, ptr noundef %32) #5
  %33 = getelementptr inbounds i8, ptr %0, i64 1792
  %34 = load i32, ptr %33, align 8, !tbaa !32
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %33, align 8, !tbaa !32
  br label %36

36:                                               ; preds = %29, %14
  %37 = icmp sgt i32 %4, 0
  br i1 %37, label %.lr.ph63, label %._crit_edge64

.lr.ph63:                                         ; preds = %36
  %38 = getelementptr inbounds i8, ptr %0, i64 1256
  %wide.trip.count = zext nneg i32 %4 to i64
  br label %41

._crit_edge64:                                    ; preds = %._crit_edge, %36
  tail call void @b2IntArray_Clear(ptr noundef nonnull %2)
  tail call void @b2ClearSet(ptr noundef nonnull %5) #5
  %39 = load ptr, ptr %22, align 8, !tbaa !17
  tail call void @b2FreeArenaItem(ptr noundef %0, ptr noundef %39) #5
  store ptr null, ptr %22, align 8, !tbaa !17
  %40 = load ptr, ptr %17, align 8, !tbaa !15
  tail call void @b2FreeArenaItem(ptr noundef %0, ptr noundef %40) #5
  store ptr null, ptr %17, align 8, !tbaa !15
  tail call void @b2ValidateSolverSets(ptr noundef %0) #5
  br label %57

41:                                               ; preds = %.lr.ph63, %._crit_edge
  %indvars.iv = phi i64 [ 0, %.lr.ph63 ], [ %indvars.iv.next, %._crit_edge ]
  %42 = load ptr, ptr %17, align 8, !tbaa !15
  %43 = getelementptr inbounds %struct.b2MoveResult, ptr %42, i64 %indvars.iv
  %44 = load ptr, ptr %43, align 8, !tbaa !33
  %.not5859 = icmp eq ptr %44, null
  br i1 %.not5859, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %41, %56
  %.05460 = phi ptr [ %54, %56 ], [ %44, %41 ]
  %45 = load i32, ptr %.05460, align 8, !tbaa !35
  %46 = getelementptr inbounds i8, ptr %.05460, i64 4
  %47 = load i32, ptr %46, align 4, !tbaa !37
  %48 = tail call ptr @b2ShapeArray_Get(ptr noundef nonnull %38, i32 noundef %45)
  %49 = tail call ptr @b2ShapeArray_Get(ptr noundef nonnull %38, i32 noundef %47)
  tail call void @b2CreateContact(ptr noundef %0, ptr noundef %48, ptr noundef %49) #5
  %50 = getelementptr inbounds i8, ptr %.05460, i64 16
  %51 = load i8, ptr %50, align 8, !tbaa !38, !range !39, !noundef !40
  %52 = trunc nuw i8 %51 to i1
  %53 = getelementptr inbounds i8, ptr %.05460, i64 8
  %54 = load ptr, ptr %53, align 8, !tbaa !41
  br i1 %52, label %55, label %56

55:                                               ; preds = %.lr.ph
  tail call void @b2Free(ptr noundef nonnull %.05460, i32 noundef 24) #5
  br label %56

56:                                               ; preds = %.lr.ph, %55
  %.not58 = icmp eq ptr %54, null
  br i1 %.not58, label %._crit_edge, label %.lr.ph, !llvm.loop !42

._crit_edge:                                      ; preds = %56, %41
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge64, label %41, !llvm.loop !44

57:                                               ; preds = %12, %._crit_edge64
  ret void
}

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

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

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

declare void @b2CreateContact(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @b2Free(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @b2IntArray_Clear(ptr noundef) local_unnamed_addr #0

declare void @b2ClearSet(ptr noundef) local_unnamed_addr #1

declare void @b2FreeArenaItem(ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @b2ValidateSolverSets(ptr noundef) local_unnamed_addr #1

attributes #0 = { 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 #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 = { 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"="64" "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, !9, i64 248}
!6 = !{!"b2BroadPhase", !7, i64 0, !9, i64 216, !10, i64 224, !12, i64 240, !11, i64 256, !11, i64 264, !9, i64 272, !13, i64 276, !10, i64 280}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!"b2HashSet", !11, i64 0, !9, i64 8, !9, i64 12}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"", !11, i64 0, !9, i64 8, !9, i64 12}
!13 = !{!"b2AtomicInt", !9, i64 0}
!14 = !{!6, !9, i64 236}
!15 = !{!6, !11, i64 256}
!16 = !{!6, !9, i64 272}
!17 = !{!6, !11, i64 264}
!18 = !{!19, !11, i64 1744}
!19 = !{!"b2World", !20, i64 0, !6, i64 40, !21, i64 336, !22, i64 1008, !12, i64 1032, !22, i64 1048, !12, i64 1072, !22, i64 1088, !12, i64 1112, !22, i64 1128, !12, i64 1152, !22, i64 1168, !12, i64 1192, !22, i64 1208, !22, i64 1232, !12, i64 1256, !12, i64 1272, !12, i64 1288, !12, i64 1304, !12, i64 1320, !12, i64 1336, !12, i64 1352, !12, i64 1368, !7, i64 1384, !7, i64 1416, !9, i64 1448, !12, i64 1456, !23, i64 1472, !23, i64 1488, !23, i64 1504, !23, i64 1520, !24, i64 1536, !9, i64 1544, !25, i64 1548, !26, i64 1556, !26, i64 1560, !26, i64 1564, !26, i64 1568, !26, i64 1572, !26, i64 1576, !26, i64 1580, !26, i64 1584, !11, i64 1592, !11, i64 1600, !27, i64 1608, !28, i64 1612, !11, i64 1704, !11, i64 1712, !11, i64 1720, !11, i64 1728, !9, i64 1736, !11, i64 1744, !11, i64 1752, !11, i64 1760, !11, i64 1768, !11, i64 1776, !26, i64 1784, !9, i64 1788, !9, i64 1792, !27, i64 1796, !29, i64 1798, !29, i64 1799, !29, i64 1800, !29, i64 1801, !29, i64 1802, !29, i64 1803}
!20 = !{!"b2ArenaAllocator", !11, i64 0, !9, i64 8, !9, i64 12, !9, i64 16, !9, i64 20, !12, i64 24}
!21 = !{!"b2ConstraintGraph", !7, i64 0}
!22 = !{!"b2IdPool", !12, i64 0, !9, i64 16}
!23 = !{!"b2BitSet", !11, i64 0, !9, i64 8, !9, i64 12}
!24 = !{!"long", !7, i64 0}
!25 = !{!"b2Vec2", !26, i64 0, !26, i64 4}
!26 = !{!"float", !7, i64 0}
!27 = !{!"short", !7, i64 0}
!28 = !{!"b2Profile", !26, i64 0, !26, i64 4, !26, i64 8, !26, i64 12, !26, i64 16, !26, i64 20, !26, i64 24, !26, i64 28, !26, i64 32, !26, i64 36, !26, i64 40, !26, i64 44, !26, i64 48, !26, i64 52, !26, i64 56, !26, i64 60, !26, i64 64, !26, i64 68, !26, i64 72, !26, i64 76, !26, i64 80, !26, i64 84}
!29 = !{!"_Bool", !7, i64 0}
!30 = !{!19, !11, i64 1760}
!31 = !{!19, !11, i64 1752}
!32 = !{!19, !9, i64 1792}
!33 = !{!34, !11, i64 0}
!34 = !{!"b2MoveResult", !11, i64 0}
!35 = !{!36, !9, i64 0}
!36 = !{!"b2MovePair", !9, i64 0, !9, i64 4, !11, i64 8, !29, i64 16}
!37 = !{!36, !9, i64 4}
!38 = !{!36, !29, i64 16}
!39 = !{i8 0, i8 2}
!40 = !{}
!41 = !{!36, !11, i64 8}
!42 = distinct !{!42, !43}
!43 = !{!"llvm.loop.mustprogress"}
!44 = distinct !{!44, !43}


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