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

; 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.(anonymous namespace)::ExpirationTimeComparator" = type { ptr }
%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.b2TimeStep = type { float, float, float, i32, i32, i32, i8 }

@.str.1 = external hidden unnamed_addr constant [93 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [28 x i8], align 1
@__PRETTY_FUNCTION__._ZN16b2ParticleSystem14SolveLifetimesERK10b2TimeStep = external hidden unnamed_addr constant [58 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, 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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK16b2ParticleSystem16GetParticleCountEv(ptr noundef nonnull align 8 dereferenceable(632)) #4 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN16b2ParticleSystem14SolveLifetimesERK10b2TimeStep(ptr noundef nonnull align 8 dereferenceable(632) %0, ptr noundef nonnull align 4 dereferenceable(28) %1) #5 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca %"class.(anonymous namespace)::ExpirationTimeComparator", align 8
  %10 = alloca %"class.(anonymous namespace)::ExpirationTimeComparator", align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %17 = load ptr, ptr %3, align 8
  %18 = getelementptr inbounds %class.b2ParticleSystem, ptr %17, i32 0, i32 39
  %19 = getelementptr inbounds %"struct.b2ParticleSystem::UserOverridableBuffer.8", ptr %18, i32 0, i32 0
  %20 = load ptr, ptr %19, align 8, !tbaa !9
  %21 = icmp ne ptr %20, null
  br i1 %21, label %22, label %23

22:                                               ; preds = %2
  br label %25

23:                                               ; preds = %2
  call void @__assert_fail(ptr noundef @.str.32, ptr noundef @.str.1, i32 noundef 3807, ptr noundef @__PRETTY_FUNCTION__._ZN16b2ParticleSystem14SolveLifetimesERK10b2TimeStep) #7
  unreachable

24:                                               ; No predecessors!
  br label %25

25:                                               ; preds = %24, %22
  %26 = getelementptr inbounds %class.b2ParticleSystem, ptr %17, i32 0, i32 40
  %27 = getelementptr inbounds %"struct.b2ParticleSystem::UserOverridableBuffer.8", ptr %26, i32 0, i32 0
  %28 = load ptr, ptr %27, align 8, !tbaa !34
  %29 = icmp ne ptr %28, null
  br i1 %29, label %30, label %31

30:                                               ; preds = %25
  br label %33

31:                                               ; preds = %25
  call void @__assert_fail(ptr noundef @.str.10, ptr noundef @.str.1, i32 noundef 3808, ptr noundef @__PRETTY_FUNCTION__._ZN16b2ParticleSystem14SolveLifetimesERK10b2TimeStep) #7
  unreachable

32:                                               ; No predecessors!
  br label %33

33:                                               ; preds = %32, %30
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.b2TimeStep, ptr %34, i32 0, i32 0
  %36 = load float, ptr %35, align 4, !tbaa !35
  %37 = call noundef i64 @_ZNK16b2ParticleSystem24LifetimeToExpirationTimeEf(ptr noundef nonnull align 8 dereferenceable(632) %17, float noundef %36)
  %38 = getelementptr inbounds %class.b2ParticleSystem, ptr %17, i32 0, i32 41
  store i64 %37, ptr %38, align 8, !tbaa !37
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  %39 = call noundef i32 @_ZNK16b2ParticleSystem23GetQuantizedTimeElapsedEv(ptr noundef nonnull align 8 dereferenceable(632) %17)
  store i32 %39, ptr %5, align 4, !tbaa !38
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  %40 = getelementptr inbounds %class.b2ParticleSystem, ptr %17, i32 0, i32 39
  %41 = getelementptr inbounds %"struct.b2ParticleSystem::UserOverridableBuffer.8", ptr %40, i32 0, i32 0
  %42 = load ptr, ptr %41, align 8, !tbaa !9
  store ptr %42, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  %43 = getelementptr inbounds %class.b2ParticleSystem, ptr %17, i32 0, i32 40
  %44 = getelementptr inbounds %"struct.b2ParticleSystem::UserOverridableBuffer.8", ptr %43, i32 0, i32 0
  %45 = load ptr, ptr %44, align 8, !tbaa !34
  store ptr %45, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  %46 = call noundef i32 @_ZNK16b2ParticleSystem16GetParticleCountEv(ptr noundef nonnull align 8 dereferenceable(632) %17)
  store i32 %46, ptr %8, align 4, !tbaa !38
  %47 = getelementptr inbounds %class.b2ParticleSystem, ptr %17, i32 0, i32 42
  %48 = load i8, ptr %47, align 8, !tbaa !39, !range !40, !noundef !41
  %49 = trunc i8 %48 to i1
  br i1 %49, label %50, label %63

50:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN12_GLOBAL__N_124ExpirationTimeComparatorC2EPKi(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef %51)
  %52 = load ptr, ptr %7, align 8, !tbaa !5
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = load i32, ptr %8, align 4, !tbaa !38
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds i32, ptr %53, i64 %55
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 %9, i64 8, i1 false), !tbaa.struct !42
  invoke void @_ZSt4sortIPiN12_GLOBAL__N_124ExpirationTimeComparatorEEvT_S3_T0_(ptr noundef %52, ptr noundef %56, ptr noundef %10)
          to label %57 unwind label %59

57:                                               ; preds = %50
  call void @_ZN12_GLOBAL__N_124ExpirationTimeComparatorD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %10) #8
  %58 = getelementptr inbounds %class.b2ParticleSystem, ptr %17, i32 0, i32 42
  store i8 0, ptr %58, align 8, !tbaa !39
  call void @_ZN12_GLOBAL__N_124ExpirationTimeComparatorD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  br label %63

59:                                               ; preds = %50
  %60 = landingpad { ptr, i32 }
          cleanup
  %61 = extractvalue { ptr, i32 } %60, 0
  store ptr %61, ptr %11, align 8
  %62 = extractvalue { ptr, i32 } %60, 1
  store i32 %62, ptr %12, align 4
  call void @_ZN12_GLOBAL__N_124ExpirationTimeComparatorD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %10) #8
  call void @_ZN12_GLOBAL__N_124ExpirationTimeComparatorD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  br label %98

63:                                               ; preds = %57, %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  %64 = load i32, ptr %8, align 4, !tbaa !38
  %65 = sub nsw i32 %64, 1
  store i32 %65, ptr %13, align 4, !tbaa !38
  br label %66

66:                                               ; preds = %93, %63
  %67 = load i32, ptr %13, align 4, !tbaa !38
  %68 = icmp sge i32 %67, 0
  br i1 %68, label %70, label %69

69:                                               ; preds = %66
  store i32 2, ptr %14, align 4
  br label %96

70:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  %71 = load ptr, ptr %7, align 8, !tbaa !5
  %72 = load i32, ptr %13, align 4, !tbaa !38
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds i32, ptr %71, i64 %73
  %75 = load i32, ptr %74, align 4, !tbaa !38
  store i32 %75, ptr %15, align 4, !tbaa !38
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = load i32, ptr %15, align 4, !tbaa !38
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds i32, ptr %76, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !38
  store i32 %80, ptr %16, align 4, !tbaa !38
  %81 = load i32, ptr %5, align 4, !tbaa !38
  %82 = load i32, ptr %16, align 4, !tbaa !38
  %83 = icmp slt i32 %81, %82
  br i1 %83, label %87, label %84

84:                                               ; preds = %70
  %85 = load i32, ptr %16, align 4, !tbaa !38
  %86 = icmp sle i32 %85, 0
  br i1 %86, label %87, label %88

87:                                               ; preds = %84, %70
  store i32 2, ptr %14, align 4
  br label %90

88:                                               ; preds = %84
  %89 = load i32, ptr %15, align 4, !tbaa !38
  call void @_ZN16b2ParticleSystem15DestroyParticleEi(ptr noundef nonnull align 8 dereferenceable(632) %17, i32 noundef %89)
  store i32 0, ptr %14, align 4
  br label %90

90:                                               ; preds = %88, %87
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  %91 = load i32, ptr %14, align 4
  switch i32 %91, label %96 [
    i32 0, label %92
  ]

92:                                               ; preds = %90
  br label %93

93:                                               ; preds = %92
  %94 = load i32, ptr %13, align 4, !tbaa !38
  %95 = add nsw i32 %94, -1
  store i32 %95, ptr %13, align 4, !tbaa !38
  br label %66, !llvm.loop !43

96:                                               ; preds = %90, %69
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  br label %97

97:                                               ; preds = %96
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  ret void

98:                                               ; preds = %59
  %99 = load ptr, ptr %11, align 8
  %100 = load i32, ptr %12, align 4
  %101 = insertvalue { ptr, i32 } poison, ptr %99, 0
  %102 = insertvalue { ptr, i32 } %101, i32 %100, 1
  resume { ptr, i32 } %102
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK16b2ParticleSystem24LifetimeToExpirationTimeEf(ptr noundef nonnull align 8 dereferenceable(632), float noundef) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZN12_GLOBAL__N_124ExpirationTimeComparatorC2EPKi(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @_ZSt4sortIPiN12_GLOBAL__N_124ExpirationTimeComparatorEEvT_S3_T0_(ptr noundef, ptr noundef, ptr noundef) #6

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZN12_GLOBAL__N_124ExpirationTimeComparatorD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN16b2ParticleSystem15DestroyParticleEi(ptr noundef nonnull align 8 dereferenceable(632), i32 noundef) #5 align 2

attributes #0 = { noreturn nounwind "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #5 = { 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 #6 = { 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 #7 = { noreturn nounwind }
attributes #8 = { 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, !6, i64 464}
!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 = !{!10, !6, i64 480}
!35 = !{!36, !13, i64 0}
!36 = !{!"_ZTS10b2TimeStep", !13, i64 0, !13, i64 4, !13, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !11, i64 24}
!37 = !{!10, !32, i64 496}
!38 = !{!12, !12, i64 0}
!39 = !{!10, !11, i64 504}
!40 = !{i8 0, i8 2}
!41 = !{}
!42 = !{i64 0, i64 8, !5}
!43 = distinct !{!43, !44}
!44 = !{!"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"

%"class.(anonymous namespace)::ExpirationTimeComparator" = type { ptr }

@.str.1 = external hidden unnamed_addr constant [93 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [28 x i8], align 1
@__PRETTY_FUNCTION__._ZN16b2ParticleSystem14SolveLifetimesERK10b2TimeStep = external hidden unnamed_addr constant [58 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

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

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK16b2ParticleSystem16GetParticleCountEv(ptr noundef nonnull align 8 dereferenceable(632)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN16b2ParticleSystem14SolveLifetimesERK10b2TimeStep(ptr noundef nonnull align 8 dereferenceable(632) %0, ptr nocapture noundef nonnull readonly align 4 dereferenceable(28) %1) local_unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.(anonymous namespace)::ExpirationTimeComparator", align 8
  %4 = alloca %"class.(anonymous namespace)::ExpirationTimeComparator", align 8
  %5 = getelementptr inbounds i8, ptr %0, i64 464
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %.not = icmp eq ptr %6, null
  br i1 %.not, label %7, label %8

7:                                                ; preds = %2
  tail call void @__assert_fail(ptr noundef nonnull @.str.32, ptr noundef nonnull @.str.1, i32 noundef 3807, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN16b2ParticleSystem14SolveLifetimesERK10b2TimeStep) #6
  unreachable

8:                                                ; preds = %2
  %9 = getelementptr inbounds i8, ptr %0, i64 480
  %10 = load ptr, ptr %9, align 8, !tbaa !33
  %.not21 = icmp eq ptr %10, null
  br i1 %.not21, label %11, label %12

11:                                               ; preds = %8
  tail call void @__assert_fail(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.1, i32 noundef 3808, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN16b2ParticleSystem14SolveLifetimesERK10b2TimeStep) #6
  unreachable

12:                                               ; preds = %8
  %13 = load float, ptr %1, align 4, !tbaa !34
  %14 = tail call noundef i64 @_ZNK16b2ParticleSystem24LifetimeToExpirationTimeEf(ptr noundef nonnull align 8 dereferenceable(632) %0, float noundef %13)
  %15 = getelementptr inbounds i8, ptr %0, i64 496
  store i64 %14, ptr %15, align 8, !tbaa !36
  %16 = tail call noundef i32 @_ZNK16b2ParticleSystem23GetQuantizedTimeElapsedEv(ptr noundef nonnull align 8 dereferenceable(632) %0)
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = load ptr, ptr %9, align 8, !tbaa !33
  %19 = tail call noundef i32 @_ZNK16b2ParticleSystem16GetParticleCountEv(ptr noundef nonnull align 8 dereferenceable(632) %0)
  %20 = getelementptr inbounds i8, ptr %0, i64 504
  %21 = load i8, ptr %20, align 8, !tbaa !37, !range !38, !noundef !39
  %22 = trunc nuw i8 %21 to i1
  br i1 %22, label %23, label %30

23:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  call void @_ZN12_GLOBAL__N_124ExpirationTimeComparatorC2EPKi(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef %17)
  %24 = sext i32 %19 to i64
  %25 = getelementptr inbounds i32, ptr %18, i64 %24
  %26 = load i64, ptr %3, align 8, !tbaa !40
  store i64 %26, ptr %4, align 8, !tbaa !40
  invoke void @_ZSt4sortIPiN12_GLOBAL__N_124ExpirationTimeComparatorEEvT_S3_T0_(ptr noundef %18, ptr noundef %25, ptr noundef nonnull %4)
          to label %27 unwind label %28

27:                                               ; preds = %23
  call void @_ZN12_GLOBAL__N_124ExpirationTimeComparatorD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  store i8 0, ptr %20, align 8, !tbaa !37
  call void @_ZN12_GLOBAL__N_124ExpirationTimeComparatorD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  br label %30

28:                                               ; preds = %23
  %29 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN12_GLOBAL__N_124ExpirationTimeComparatorD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  call void @_ZN12_GLOBAL__N_124ExpirationTimeComparatorD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  resume { ptr, i32 } %29

30:                                               ; preds = %27, %12
  %31 = icmp sgt i32 %19, 0
  br i1 %31, label %.lr.ph.preheader, label %.critedge

.lr.ph.preheader:                                 ; preds = %30
  %32 = zext nneg i32 %19 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %40
  %indvars.iv = phi i64 [ %32, %.lr.ph.preheader ], [ %indvars.iv.next, %40 ]
  %indvars.iv.next = add nsw i64 %indvars.iv, -1
  %33 = getelementptr inbounds i32, ptr %18, i64 %indvars.iv.next
  %34 = load i32, ptr %33, align 4, !tbaa !41
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds i32, ptr %17, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !41
  %38 = icmp sge i32 %16, %37
  %39 = icmp sgt i32 %37, 0
  %or.cond.not = and i1 %38, %39
  br i1 %or.cond.not, label %40, label %.critedge

40:                                               ; preds = %.lr.ph
  call void @_ZN16b2ParticleSystem15DestroyParticleEi(ptr noundef nonnull align 8 dereferenceable(632) %0, i32 noundef %34)
  %41 = icmp ugt i64 %indvars.iv, 1
  br i1 %41, label %.lr.ph, label %.critedge, !llvm.loop !42

.critedge:                                        ; preds = %40, %.lr.ph, %30
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK16b2ParticleSystem24LifetimeToExpirationTimeEf(ptr noundef nonnull align 8 dereferenceable(632), float noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZN12_GLOBAL__N_124ExpirationTimeComparatorC2EPKi(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @_ZSt4sortIPiN12_GLOBAL__N_124ExpirationTimeComparatorEEvT_S3_T0_(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZN12_GLOBAL__N_124ExpirationTimeComparatorD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN16b2ParticleSystem15DestroyParticleEi(ptr noundef nonnull align 8 dereferenceable(632), i32 noundef) local_unnamed_addr #4 align 2

attributes #0 = { noreturn nounwind "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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 = { 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 = { 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 #6 = { noreturn nounwind }
attributes #7 = { 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, !16, i64 464}
!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 = !{!6, !16, i64 480}
!34 = !{!35, !11, i64 0}
!35 = !{!"_ZTS10b2TimeStep", !11, i64 0, !11, i64 4, !11, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !7, i64 24}
!36 = !{!6, !31, i64 496}
!37 = !{!6, !7, i64 504}
!38 = !{i8 0, i8 2}
!39 = !{}
!40 = !{!16, !16, i64 0}
!41 = !{!10, !10, i64 0}
!42 = distinct !{!42, !43}
!43 = !{!"llvm.loop.mustprogress"}


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