; LLVM IR from mtsamis/box2d-optimized :: src/particle (b2_particle_system)

; 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"

%class.b2ParticleSystem = type { i8, i32, i32, i8, i32, i8, i8, i32, float, float, float, float, i32, i32, %class.b2SlabAllocator, %"struct.b2ParticleSystem::UserOverridableBuffer", %"struct.b2ParticleSystem::UserOverridableBuffer.0", %"struct.b2ParticleSystem::UserOverridableBuffer.2", %"struct.b2ParticleSystem::UserOverridableBuffer.2", ptr, ptr, ptr, ptr, ptr, ptr, %"struct.b2ParticleSystem::UserOverridableBuffer.4", ptr, %"struct.b2ParticleSystem::UserOverridableBuffer.6", i32, [4 x i8], %"struct.b2ParticleSystem::UserOverridableBuffer.8", %"struct.b2ParticleSystem::UserOverridableBuffer.8", %"struct.b2ParticleSystem::UserOverridableBuffer.8", %class.b2GrowableBuffer, %class.b2GrowableBuffer.10, %class.b2GrowableBuffer.11, %class.b2GrowableBuffer.12, %class.b2GrowableBuffer.13, %class.b2GrowableBuffer.14, %"struct.b2ParticleSystem::UserOverridableBuffer.8", %"struct.b2ParticleSystem::UserOverridableBuffer.8", i64, i8, i32, ptr, %struct.b2ParticleSystemDef, ptr, ptr, ptr }
%class.b2SlabAllocator = type { %class.b2TrackedBlockAllocator, i32, %class.b2TypedFreeList }
%class.b2TrackedBlockAllocator = type { %class.b2TypedIntrusiveListNode }
%class.b2TypedIntrusiveListNode = type { %class.b2IntrusiveListNode }
%class.b2IntrusiveListNode = type { ptr, ptr }
%class.b2TypedFreeList = type { %class.b2FreeList }
%class.b2FreeList = type { %class.b2IntrusiveListNode, %class.b2IntrusiveListNode }
%"struct.b2ParticleSystem::UserOverridableBuffer" = type <{ ptr, i32, [4 x i8] }>
%"struct.b2ParticleSystem::UserOverridableBuffer.0" = type <{ ptr, i32, [4 x i8] }>
%"struct.b2ParticleSystem::UserOverridableBuffer.2" = type <{ ptr, i32, [4 x i8] }>
%"struct.b2ParticleSystem::UserOverridableBuffer.4" = type <{ ptr, i32, [4 x i8] }>
%"struct.b2ParticleSystem::UserOverridableBuffer.6" = type <{ ptr, i32, [4 x i8] }>
%class.b2GrowableBuffer = type { ptr, i32, i32, ptr }
%class.b2GrowableBuffer.10 = type { ptr, i32, i32, ptr }
%class.b2GrowableBuffer.11 = type { ptr, i32, i32, ptr }
%class.b2GrowableBuffer.12 = type { ptr, i32, i32, ptr }
%class.b2GrowableBuffer.13 = type { ptr, i32, i32, ptr }
%class.b2GrowableBuffer.14 = type { ptr, i32, i32, ptr }
%"struct.b2ParticleSystem::UserOverridableBuffer.8" = type <{ ptr, i32, [4 x i8] }>
%struct.b2ParticleSystemDef = type { i8, float, float, float, i32, float, float, float, float, float, float, float, float, float, float, float, float, i32, float, i8, float }
%struct.b2AABB = type { %struct.b2Vec2, %struct.b2Vec2 }
%struct.b2Vec2 = type { float, float }
%"struct.b2ParticleSystem::Proxy" = type { i32, i32 }

; 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 mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL10computeTagff(float noundef, float noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK16b2GrowableBufferIN16b2ParticleSystem5ProxyEE5BeginEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK16b2GrowableBufferIN16b2ParticleSystem5ProxyEE3EndEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11lower_boundIPKN16b2ParticleSystem5ProxyEjET_S4_S4_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11upper_boundIPKN16b2ParticleSystem5ProxyEjET_S4_S4_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK16b2GrowableBufferIN16b2ParticleSystem5ProxyEE8GetCountEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK16b2ParticleSystem9QueryAABBEP15b2QueryCallbackRK6b2AABB(ptr noundef nonnull align 8 dereferenceable(632) %0, ptr noundef %1, ptr noundef nonnull align 4 dereferenceable(16) %2) #4 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %17 = load ptr, ptr %4, align 8
  %18 = getelementptr inbounds %class.b2ParticleSystem, ptr %17, i32 0, i32 34
  %19 = call noundef i32 @_ZNK16b2GrowableBufferIN16b2ParticleSystem5ProxyEE8GetCountEv(ptr noundef nonnull align 8 dereferenceable(24) %18)
  %20 = icmp eq i32 %19, 0
  br i1 %20, label %21, label %22

21:                                               ; preds = %3
  br label %132

22:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %23 = getelementptr inbounds %class.b2ParticleSystem, ptr %17, i32 0, i32 34
  %24 = call noundef ptr @_ZNK16b2GrowableBufferIN16b2ParticleSystem5ProxyEE5BeginEv(ptr noundef nonnull align 8 dereferenceable(24) %23)
  store ptr %24, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %25 = getelementptr inbounds %class.b2ParticleSystem, ptr %17, i32 0, i32 34
  %26 = call noundef ptr @_ZNK16b2GrowableBufferIN16b2ParticleSystem5ProxyEE3EndEv(ptr noundef nonnull align 8 dereferenceable(24) %25)
  store ptr %26, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %27 = load ptr, ptr %7, align 8, !tbaa !5
  %28 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %29 = getelementptr inbounds %class.b2ParticleSystem, ptr %17, i32 0, i32 10
  %30 = load float, ptr %29, align 4, !tbaa !9
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.b2AABB, ptr %31, i32 0, i32 0
  %33 = getelementptr inbounds %struct.b2Vec2, ptr %32, i32 0, i32 0
  %34 = load float, ptr %33, align 4, !tbaa !34
  %35 = fmul float %30, %34
  %36 = getelementptr inbounds %class.b2ParticleSystem, ptr %17, i32 0, i32 10
  %37 = load float, ptr %36, align 4, !tbaa !9
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.b2AABB, ptr %38, i32 0, i32 0
  %40 = getelementptr inbounds %struct.b2Vec2, ptr %39, i32 0, i32 1
  %41 = load float, ptr %40, align 4, !tbaa !37
  %42 = fmul float %37, %41
  %43 = call noundef i32 @_ZL10computeTagff(float noundef %35, float noundef %42)
  store i32 %43, ptr %10, align 4, !tbaa !38
  %44 = call noundef ptr @_ZSt11lower_boundIPKN16b2ParticleSystem5ProxyEjET_S4_S4_RKT0_(ptr noundef %27, ptr noundef %28, ptr noundef nonnull align 4 dereferenceable(4) %10)
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  store ptr %44, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %45 = load ptr, ptr %9, align 8, !tbaa !5
  %46 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %47 = getelementptr inbounds %class.b2ParticleSystem, ptr %17, i32 0, i32 10
  %48 = load float, ptr %47, align 4, !tbaa !9
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.b2AABB, ptr %49, i32 0, i32 1
  %51 = getelementptr inbounds %struct.b2Vec2, ptr %50, i32 0, i32 0
  %52 = load float, ptr %51, align 4, !tbaa !39
  %53 = fmul float %48, %52
  %54 = getelementptr inbounds %class.b2ParticleSystem, ptr %17, i32 0, i32 10
  %55 = load float, ptr %54, align 4, !tbaa !9
  %56 = load ptr, ptr %6, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.b2AABB, ptr %56, i32 0, i32 1
  %58 = getelementptr inbounds %struct.b2Vec2, ptr %57, i32 0, i32 1
  %59 = load float, ptr %58, align 4, !tbaa !40
  %60 = fmul float %55, %59
  %61 = call noundef i32 @_ZL10computeTagff(float noundef %53, float noundef %60)
  store i32 %61, ptr %12, align 4, !tbaa !38
  %62 = call noundef ptr @_ZSt11upper_boundIPKN16b2ParticleSystem5ProxyEjET_S4_S4_RKT0_(ptr noundef %45, ptr noundef %46, ptr noundef nonnull align 4 dereferenceable(4) %12)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  store ptr %62, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %63 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %63, ptr %13, align 8, !tbaa !5
  br label %64

64:                                               ; preds = %127, %22
  %65 = load ptr, ptr %13, align 8, !tbaa !5
  %66 = load ptr, ptr %11, align 8, !tbaa !5
  %67 = icmp ult ptr %65, %66
  br i1 %67, label %69, label %68

68:                                               ; preds = %64
  store i32 2, ptr %14, align 4
  br label %130

69:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %70 = load ptr, ptr %13, align 8, !tbaa !5
  %71 = getelementptr inbounds %"struct.b2ParticleSystem::Proxy", ptr %70, i32 0, i32 0
  %72 = load i32, ptr %71, align 4, !tbaa !41
  store i32 %72, ptr %15, align 4, !tbaa !38
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %73 = getelementptr inbounds %class.b2ParticleSystem, ptr %17, i32 0, i32 17
  %74 = getelementptr inbounds %"struct.b2ParticleSystem::UserOverridableBuffer.2", ptr %73, i32 0, i32 0
  %75 = load ptr, ptr %74, align 8, !tbaa !43
  %76 = load i32, ptr %15, align 4, !tbaa !38
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds %struct.b2Vec2, ptr %75, i64 %77
  store ptr %78, ptr %16, align 8, !tbaa !5
  %79 = load ptr, ptr %6, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.b2AABB, ptr %79, i32 0, i32 0
  %81 = getelementptr inbounds %struct.b2Vec2, ptr %80, i32 0, i32 0
  %82 = load float, ptr %81, align 4, !tbaa !34
  %83 = load ptr, ptr %16, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.b2Vec2, ptr %83, i32 0, i32 0
  %85 = load float, ptr %84, align 4, !tbaa !44
  %86 = fcmp olt float %82, %85
  br i1 %86, label %87, label %123

87:                                               ; preds = %69
  %88 = load ptr, ptr %16, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.b2Vec2, ptr %88, i32 0, i32 0
  %90 = load float, ptr %89, align 4, !tbaa !44
  %91 = load ptr, ptr %6, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.b2AABB, ptr %91, i32 0, i32 1
  %93 = getelementptr inbounds %struct.b2Vec2, ptr %92, i32 0, i32 0
  %94 = load float, ptr %93, align 4, !tbaa !39
  %95 = fcmp olt float %90, %94
  br i1 %95, label %96, label %123

96:                                               ; preds = %87
  %97 = load ptr, ptr %6, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.b2AABB, ptr %97, i32 0, i32 0
  %99 = getelementptr inbounds %struct.b2Vec2, ptr %98, i32 0, i32 1
  %100 = load float, ptr %99, align 4, !tbaa !37
  %101 = load ptr, ptr %16, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.b2Vec2, ptr %101, i32 0, i32 1
  %103 = load float, ptr %102, align 4, !tbaa !45
  %104 = fcmp olt float %100, %103
  br i1 %104, label %105, label %123

105:                                              ; preds = %96
  %106 = load ptr, ptr %16, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.b2Vec2, ptr %106, i32 0, i32 1
  %108 = load float, ptr %107, align 4, !tbaa !45
  %109 = load ptr, ptr %6, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.b2AABB, ptr %109, i32 0, i32 1
  %111 = getelementptr inbounds %struct.b2Vec2, ptr %110, i32 0, i32 1
  %112 = load float, ptr %111, align 4, !tbaa !40
  %113 = fcmp olt float %108, %112
  br i1 %113, label %114, label %123

114:                                              ; preds = %105
  %115 = load ptr, ptr %5, align 8, !tbaa !5
  %116 = load i32, ptr %15, align 4, !tbaa !38
  %117 = load ptr, ptr %115, align 8, !tbaa !46
  %118 = getelementptr inbounds ptr, ptr %117, i64 3
  %119 = load ptr, ptr %118, align 8
  %120 = call noundef zeroext i1 %119(ptr noundef nonnull align 8 dereferenceable(8) %115, ptr noundef %17, i32 noundef %116)
  br i1 %120, label %122, label %121

121:                                              ; preds = %114
  store i32 2, ptr %14, align 4
  br label %124

122:                                              ; preds = %114
  br label %123

123:                                              ; preds = %122, %105, %96, %87, %69
  store i32 0, ptr %14, align 4
  br label %124

124:                                              ; preds = %123, %121
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  %125 = load i32, ptr %14, align 4
  switch i32 %125, label %130 [
    i32 0, label %126
  ]

126:                                              ; preds = %124
  br label %127

127:                                              ; preds = %126
  %128 = load ptr, ptr %13, align 8, !tbaa !5
  %129 = getelementptr inbounds %"struct.b2ParticleSystem::Proxy", ptr %128, i32 1
  store ptr %129, ptr %13, align 8, !tbaa !5
  br label %64, !llvm.loop !48

130:                                              ; preds = %124, %68
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %131

131:                                              ; preds = %130
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %132

132:                                              ; preds = %131, %21
  ret void
}

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !13, i64 36}
!10 = !{!"_ZTS16b2ParticleSystem", !11, i64 0, !12, i64 4, !12, i64 8, !11, i64 12, !12, i64 16, !11, i64 20, !11, i64 21, !12, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 40, !12, i64 44, !12, i64 48, !14, i64 56, !20, i64 112, !21, i64 128, !22, i64 144, !22, i64 160, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !23, i64 224, !6, i64 240, !24, i64 248, !12, i64 264, !25, i64 272, !25, i64 288, !25, i64 304, !26, i64 320, !27, i64 344, !28, i64 368, !29, i64 392, !30, i64 416, !31, i64 440, !25, i64 464, !25, i64 480, !32, i64 496, !11, i64 504, !12, i64 508, !6, i64 512, !33, i64 520, !6, i64 608, !6, i64 616, !6, i64 624}
!11 = !{!"bool", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!"float", !7, i64 0}
!14 = !{!"_ZTS15b2SlabAllocatorI16b2ParticleHandleE", !15, i64 0, !12, i64 16, !18, i64 24}
!15 = !{!"_ZTS23b2TrackedBlockAllocator", !16, i64 0}
!16 = !{!"_ZTS24b2TypedIntrusiveListNodeI14b2TrackedBlockE", !17, i64 0}
!17 = !{!"_ZTS19b2IntrusiveListNode", !6, i64 0, !6, i64 8}
!18 = !{!"_ZTS15b2TypedFreeListI16b2ParticleHandleE", !19, i64 0}
!19 = !{!"_ZTS10b2FreeList", !17, i64 0, !17, i64 16}
!20 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferIP16b2ParticleHandleEE", !6, i64 0, !12, i64 8}
!21 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferIjEE", !6, i64 0, !12, i64 8}
!22 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferI6b2Vec2EE", !6, i64 0, !12, i64 8}
!23 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferI15b2ParticleColorEE", !6, i64 0, !12, i64 8}
!24 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferIPvEE", !6, i64 0, !12, i64 8}
!25 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferIiEE", !6, i64 0, !12, i64 8}
!26 = !{!"_ZTS16b2GrowableBufferIiE", !6, i64 0, !12, i64 8, !12, i64 12, !6, i64 16}
!27 = !{!"_ZTS16b2GrowableBufferIN16b2ParticleSystem5ProxyEE", !6, i64 0, !12, i64 8, !12, i64 12, !6, i64 16}
!28 = !{!"_ZTS16b2GrowableBufferI17b2ParticleContactE", !6, i64 0, !12, i64 8, !12, i64 12, !6, i64 16}
!29 = !{!"_ZTS16b2GrowableBufferI21b2ParticleBodyContactE", !6, i64 0, !12, i64 8, !12, i64 12, !6, i64 16}
!30 = !{!"_ZTS16b2GrowableBufferI14b2ParticlePairE", !6, i64 0, !12, i64 8, !12, i64 12, !6, i64 16}
!31 = !{!"_ZTS16b2GrowableBufferI15b2ParticleTriadE", !6, i64 0, !12, i64 8, !12, i64 12, !6, i64 16}
!32 = !{!"long long", !7, i64 0}
!33 = !{!"_ZTS19b2ParticleSystemDef", !11, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !12, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !13, i64 48, !13, i64 52, !13, i64 56, !13, i64 60, !13, i64 64, !12, i64 68, !13, i64 72, !11, i64 76, !13, i64 80}
!34 = !{!35, !13, i64 0}
!35 = !{!"_ZTS6b2AABB", !36, i64 0, !36, i64 8}
!36 = !{!"_ZTS6b2Vec2", !13, i64 0, !13, i64 4}
!37 = !{!35, !13, i64 4}
!38 = !{!12, !12, i64 0}
!39 = !{!35, !13, i64 8}
!40 = !{!35, !13, i64 12}
!41 = !{!42, !12, i64 0}
!42 = !{!"_ZTSN16b2ParticleSystem5ProxyE", !12, i64 0, !12, i64 4}
!43 = !{!10, !6, i64 144}
!44 = !{!36, !13, i64 0}
!45 = !{!36, !13, i64 4}
!46 = !{!47, !47, i64 0}
!47 = !{!"vtable pointer", !8, i64 0}
!48 = distinct !{!48, !49}
!49 = !{!"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.b2Vec2 = type { float, float }

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL10computeTagff(float noundef, float noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK16b2GrowableBufferIN16b2ParticleSystem5ProxyEE5BeginEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK16b2GrowableBufferIN16b2ParticleSystem5ProxyEE3EndEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11lower_boundIPKN16b2ParticleSystem5ProxyEjET_S4_S4_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11upper_boundIPKN16b2ParticleSystem5ProxyEjET_S4_S4_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK16b2GrowableBufferIN16b2ParticleSystem5ProxyEE8GetCountEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK16b2ParticleSystem9QueryAABBEP15b2QueryCallbackRK6b2AABB(ptr noundef nonnull align 8 dereferenceable(632) %0, ptr noundef %1, ptr nocapture noundef nonnull readonly align 4 dereferenceable(16) %2) local_unnamed_addr #4 align 2 {
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = getelementptr inbounds i8, ptr %0, i64 344
  %7 = tail call noundef i32 @_ZNK16b2GrowableBufferIN16b2ParticleSystem5ProxyEE8GetCountEv(ptr noundef nonnull align 8 dereferenceable(24) %6)
  %8 = icmp eq i32 %7, 0
  br i1 %8, label %.loopexit, label %9

9:                                                ; preds = %3
  %10 = tail call noundef ptr @_ZNK16b2GrowableBufferIN16b2ParticleSystem5ProxyEE5BeginEv(ptr noundef nonnull align 8 dereferenceable(24) %6)
  %11 = tail call noundef ptr @_ZNK16b2GrowableBufferIN16b2ParticleSystem5ProxyEE3EndEv(ptr noundef nonnull align 8 dereferenceable(24) %6)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  %12 = getelementptr inbounds i8, ptr %0, i64 36
  %13 = load float, ptr %12, align 4, !tbaa !5
  %14 = load float, ptr %2, align 4, !tbaa !33
  %15 = fmul float %13, %14
  %16 = getelementptr inbounds i8, ptr %2, i64 4
  %17 = load float, ptr %16, align 4, !tbaa !36
  %18 = fmul float %13, %17
  %19 = tail call noundef i32 @_ZL10computeTagff(float noundef %15, float noundef %18)
  store i32 %19, ptr %4, align 4, !tbaa !37
  %20 = call noundef ptr @_ZSt11lower_boundIPKN16b2ParticleSystem5ProxyEjET_S4_S4_RKT0_(ptr noundef %10, ptr noundef %11, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  %21 = load float, ptr %12, align 4, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %2, i64 8
  %23 = load float, ptr %22, align 4, !tbaa !38
  %24 = fmul float %21, %23
  %25 = getelementptr inbounds i8, ptr %2, i64 12
  %26 = load float, ptr %25, align 4, !tbaa !39
  %27 = fmul float %21, %26
  %28 = call noundef i32 @_ZL10computeTagff(float noundef %24, float noundef %27)
  store i32 %28, ptr %5, align 4, !tbaa !37
  %29 = call noundef ptr @_ZSt11upper_boundIPKN16b2ParticleSystem5ProxyEjET_S4_S4_RKT0_(ptr noundef %20, ptr noundef %11, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  %30 = icmp ult ptr %20, %29
  br i1 %30, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %9
  %31 = getelementptr inbounds i8, ptr %0, i64 144
  br label %.backedge

.backedge:                                        ; preds = %.backedge.backedge, %.lr.ph
  %.031 = phi ptr [ %20, %.lr.ph ], [ %.031.be, %.backedge.backedge ]
  %32 = load i32, ptr %.031, align 4, !tbaa !40
  %33 = load ptr, ptr %31, align 8, !tbaa !42
  %34 = sext i32 %32 to i64
  %35 = getelementptr inbounds %struct.b2Vec2, ptr %33, i64 %34
  %36 = load float, ptr %2, align 4, !tbaa !33
  %37 = load float, ptr %35, align 4, !tbaa !43
  %38 = fcmp olt float %36, %37
  %39 = load float, ptr %22, align 4
  %40 = fcmp olt float %37, %39
  %or.cond = select i1 %38, i1 %40, i1 false
  br i1 %or.cond, label %41, label %.critedge

41:                                               ; preds = %.backedge
  %42 = load float, ptr %16, align 4, !tbaa !36
  %43 = getelementptr inbounds i8, ptr %35, i64 4
  %44 = load float, ptr %43, align 4, !tbaa !44
  %45 = fcmp olt float %42, %44
  %46 = load float, ptr %25, align 4
  %47 = fcmp olt float %44, %46
  %or.cond30 = select i1 %45, i1 %47, i1 false
  br i1 %or.cond30, label %48, label %.critedge

48:                                               ; preds = %41
  %49 = load ptr, ptr %1, align 8, !tbaa !45
  %50 = getelementptr inbounds i8, ptr %49, i64 24
  %51 = load ptr, ptr %50, align 8
  %52 = call noundef zeroext i1 %51(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull %0, i32 noundef %32)
  %53 = getelementptr inbounds i8, ptr %.031, i64 8
  %54 = icmp ult ptr %53, %29
  %or.cond34 = select i1 %52, i1 %54, i1 false
  br i1 %or.cond34, label %.backedge.backedge, label %.loopexit

.critedge:                                        ; preds = %41, %.backedge
  %.old = getelementptr inbounds i8, ptr %.031, i64 8
  %.old33 = icmp ult ptr %.old, %29
  br i1 %.old33, label %.backedge.backedge, label %.loopexit

.backedge.backedge:                               ; preds = %.critedge, %48
  %.031.be = phi ptr [ %.old, %.critedge ], [ %53, %48 ]
  br label %.backedge, !llvm.loop !47

.loopexit:                                        ; preds = %48, %.critedge, %9, %3
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint mustprogress 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 = { mustprogress 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 = { inlinehint mustprogress 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 = { mustprogress 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, !11, i64 36}
!6 = !{!"_ZTS16b2ParticleSystem", !7, i64 0, !10, i64 4, !10, i64 8, !7, i64 12, !10, i64 16, !7, i64 20, !7, i64 21, !10, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !10, i64 44, !10, i64 48, !12, i64 56, !19, i64 112, !20, i64 128, !21, i64 144, !21, i64 160, !16, i64 176, !16, i64 184, !16, i64 192, !16, i64 200, !16, i64 208, !16, i64 216, !22, i64 224, !16, i64 240, !23, i64 248, !10, i64 264, !24, i64 272, !24, i64 288, !24, i64 304, !25, i64 320, !26, i64 344, !27, i64 368, !28, i64 392, !29, i64 416, !30, i64 440, !24, i64 464, !24, i64 480, !31, i64 496, !7, i64 504, !10, i64 508, !16, i64 512, !32, i64 520, !16, i64 608, !16, i64 616, !16, i64 624}
!7 = !{!"bool", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{!"_ZTS15b2SlabAllocatorI16b2ParticleHandleE", !13, i64 0, !10, i64 16, !17, i64 24}
!13 = !{!"_ZTS23b2TrackedBlockAllocator", !14, i64 0}
!14 = !{!"_ZTS24b2TypedIntrusiveListNodeI14b2TrackedBlockE", !15, i64 0}
!15 = !{!"_ZTS19b2IntrusiveListNode", !16, i64 0, !16, i64 8}
!16 = !{!"any pointer", !8, i64 0}
!17 = !{!"_ZTS15b2TypedFreeListI16b2ParticleHandleE", !18, i64 0}
!18 = !{!"_ZTS10b2FreeList", !15, i64 0, !15, i64 16}
!19 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferIP16b2ParticleHandleEE", !16, i64 0, !10, i64 8}
!20 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferIjEE", !16, i64 0, !10, i64 8}
!21 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferI6b2Vec2EE", !16, i64 0, !10, i64 8}
!22 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferI15b2ParticleColorEE", !16, i64 0, !10, i64 8}
!23 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferIPvEE", !16, i64 0, !10, i64 8}
!24 = !{!"_ZTSN16b2ParticleSystem21UserOverridableBufferIiEE", !16, i64 0, !10, i64 8}
!25 = !{!"_ZTS16b2GrowableBufferIiE", !16, i64 0, !10, i64 8, !10, i64 12, !16, i64 16}
!26 = !{!"_ZTS16b2GrowableBufferIN16b2ParticleSystem5ProxyEE", !16, i64 0, !10, i64 8, !10, i64 12, !16, i64 16}
!27 = !{!"_ZTS16b2GrowableBufferI17b2ParticleContactE", !16, i64 0, !10, i64 8, !10, i64 12, !16, i64 16}
!28 = !{!"_ZTS16b2GrowableBufferI21b2ParticleBodyContactE", !16, i64 0, !10, i64 8, !10, i64 12, !16, i64 16}
!29 = !{!"_ZTS16b2GrowableBufferI14b2ParticlePairE", !16, i64 0, !10, i64 8, !10, i64 12, !16, i64 16}
!30 = !{!"_ZTS16b2GrowableBufferI15b2ParticleTriadE", !16, i64 0, !10, i64 8, !10, i64 12, !16, i64 16}
!31 = !{!"long long", !8, i64 0}
!32 = !{!"_ZTS19b2ParticleSystemDef", !7, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !10, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !11, i64 64, !10, i64 68, !11, i64 72, !7, i64 76, !11, i64 80}
!33 = !{!34, !11, i64 0}
!34 = !{!"_ZTS6b2AABB", !35, i64 0, !35, i64 8}
!35 = !{!"_ZTS6b2Vec2", !11, i64 0, !11, i64 4}
!36 = !{!34, !11, i64 4}
!37 = !{!10, !10, i64 0}
!38 = !{!34, !11, i64 8}
!39 = !{!34, !11, i64 12}
!40 = !{!41, !10, i64 0}
!41 = !{!"_ZTSN16b2ParticleSystem5ProxyE", !10, i64 0, !10, i64 4}
!42 = !{!6, !16, i64 144}
!43 = !{!35, !11, i64 0}
!44 = !{!35, !11, i64 4}
!45 = !{!46, !46, i64 0}
!46 = !{!"vtable pointer", !9, i64 0}
!47 = distinct !{!47, !48}
!48 = !{!"llvm.loop.mustprogress"}


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