; LLVM IR from jrouwe/JoltPhysics :: Jolt/Physics/Constraints (ConstraintManager)

; 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.JPH::UniqueLock" = type <{ ptr, ptr, i32, [4 x i8] }>
%"struct.JPH::AssertLastParam" = type { i8 }
%"class.JPH::ConstraintManager" = type { ptr, %"class.JPH::Array", %"class.JPH::Mutex" }
%"class.JPH::Array" = type { i64, i64, ptr }
%"class.JPH::Mutex" = type { %"class.std::mutex", %"class.std::thread::id" }
%"class.std::mutex" = type { %"class.std::__mutex_base" }
%"class.std::__mutex_base" = type { %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::thread::id" = type { i64 }
%"class.JPH::Constraint" = type { ptr, %"class.JPH::RefTarget", i32, i32, i8, i8, i8, i64 }
%"class.JPH::RefTarget" = type { %"struct.std::atomic" }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }

@.str.1 = external hidden unnamed_addr constant [99 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [59 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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH10UniqueLockINS_5MutexEEC2ERS1_PKNS_11BodyManagerENS_17EPhysicsLockTypesE(ptr noundef nonnull align 8 dereferenceable(20), ptr noundef nonnull align 8 dereferenceable(48), ptr noundef, i32 noundef) unnamed_addr #1 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef, ptr noundef, i32 noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH10UniqueLockINS_5MutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(20)) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3JPH17ConstraintManager6RemoveEPPNS_10ConstraintEi(ptr noundef nonnull align 8 dereferenceable(80) %0, ptr noundef %1, i32 noundef %2) #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca %"class.JPH::UniqueLock", align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca %"struct.JPH::AssertLastParam", align 1
  %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 i32 %2, ptr %6, align 4, !tbaa !9
  %17 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #5
  %18 = getelementptr inbounds %"class.JPH::ConstraintManager", ptr %17, i32 0, i32 2
  %19 = getelementptr inbounds %"class.JPH::ConstraintManager", ptr %17, i32 0, i32 0
  %20 = load ptr, ptr %19, align 8, !tbaa !11
  call void @_ZN3JPH10UniqueLockINS_5MutexEEC2ERS1_PKNS_11BodyManagerENS_17EPhysicsLockTypesE(ptr noundef nonnull align 8 dereferenceable(20) %7, ptr noundef nonnull align 8 dereferenceable(48) %18, ptr noundef %20, i32 noundef 16)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %21, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = load i32, ptr %6, align 4, !tbaa !9
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds ptr, ptr %22, i64 %24
  store ptr %25, ptr %9, align 8, !tbaa !5
  br label %26

26:                                               ; preds = %91, %3
  %27 = load ptr, ptr %8, align 8, !tbaa !5
  %28 = load ptr, ptr %9, align 8, !tbaa !5
  %29 = icmp ult ptr %27, %28
  br i1 %29, label %31, label %30

30:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %96

31:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %32 = load ptr, ptr %8, align 8, !tbaa !5
  %33 = load ptr, ptr %32, align 8, !tbaa !5
  store ptr %33, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %34 = load ptr, ptr %10, align 8, !tbaa !5
  %35 = getelementptr inbounds %"class.JPH::Constraint", ptr %34, i32 0, i32 2
  %36 = load i32, ptr %35, align 4, !tbaa !19
  store i32 %36, ptr %11, align 4, !tbaa !9
  %37 = load ptr, ptr %10, align 8, !tbaa !5
  %38 = getelementptr inbounds %"class.JPH::Constraint", ptr %37, i32 0, i32 2
  store i32 -1, ptr %38, align 4, !tbaa !19
  br label %39

39:                                               ; preds = %31
  %40 = load i32, ptr %11, align 4, !tbaa !9
  %41 = icmp ne i32 %40, -1
  br i1 %41, label %50, label %42

42:                                               ; preds = %39
  %43 = invoke noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 47)
          to label %44 unwind label %46

44:                                               ; preds = %42
  br i1 %43, label %45, label %50

45:                                               ; preds = %44
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #5, !srcloc !25
  br label %50

46:                                               ; preds = %42
  %47 = landingpad { ptr, i32 }
          cleanup
  %48 = extractvalue { ptr, i32 } %47, 0
  store ptr %48, ptr %13, align 8
  %49 = extractvalue { ptr, i32 } %47, 1
  store i32 %49, ptr %14, align 4
  br label %95

50:                                               ; preds = %45, %44, %39
  br label %51

51:                                               ; preds = %50
  br label %52

52:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %53 = getelementptr inbounds %"class.JPH::ConstraintManager", ptr %17, i32 0, i32 1
  %54 = invoke noundef i64 @_ZNK3JPH5ArrayINS_3RefINS_10ConstraintEEENS_12STLAllocatorIS3_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %53)
          to label %55 unwind label %80

55:                                               ; preds = %52
  %56 = sub i64 %54, 1
  %57 = trunc i64 %56 to i32
  store i32 %57, ptr %15, align 4, !tbaa !9
  %58 = load i32, ptr %11, align 4, !tbaa !9
  %59 = load i32, ptr %15, align 4, !tbaa !9
  %60 = icmp ult i32 %58, %59
  br i1 %60, label %61, label %88

61:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %62 = getelementptr inbounds %"class.JPH::ConstraintManager", ptr %17, i32 0, i32 1
  %63 = load i32, ptr %15, align 4, !tbaa !9
  %64 = zext i32 %63 to i64
  %65 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN3JPH5ArrayINS_3RefINS_10ConstraintEEENS_12STLAllocatorIS3_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %62, i64 noundef %64)
          to label %66 unwind label %84

66:                                               ; preds = %61
  %67 = invoke noundef ptr @_ZNK3JPH3RefINS_10ConstraintEEcvPS1_Ev(ptr noundef nonnull align 8 dereferenceable(8) %65)
          to label %68 unwind label %84

68:                                               ; preds = %66
  store ptr %67, ptr %16, align 8, !tbaa !5
  %69 = load i32, ptr %11, align 4, !tbaa !9
  %70 = load ptr, ptr %16, align 8, !tbaa !5
  %71 = getelementptr inbounds %"class.JPH::Constraint", ptr %70, i32 0, i32 2
  store i32 %69, ptr %71, align 4, !tbaa !19
  %72 = load ptr, ptr %16, align 8, !tbaa !5
  %73 = getelementptr inbounds %"class.JPH::ConstraintManager", ptr %17, i32 0, i32 1
  %74 = load i32, ptr %11, align 4, !tbaa !9
  %75 = zext i32 %74 to i64
  %76 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN3JPH5ArrayINS_3RefINS_10ConstraintEEENS_12STLAllocatorIS3_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %73, i64 noundef %75)
          to label %77 unwind label %84

77:                                               ; preds = %68
  %78 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN3JPH3RefINS_10ConstraintEEaSEPS1_(ptr noundef nonnull align 8 dereferenceable(8) %76, ptr noundef %72)
          to label %79 unwind label %84

79:                                               ; preds = %77
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  br label %88

80:                                               ; preds = %88, %52
  %81 = landingpad { ptr, i32 }
          cleanup
  %82 = extractvalue { ptr, i32 } %81, 0
  store ptr %82, ptr %13, align 8
  %83 = extractvalue { ptr, i32 } %81, 1
  store i32 %83, ptr %14, align 4
  br label %94

84:                                               ; preds = %77, %68, %66, %61
  %85 = landingpad { ptr, i32 }
          cleanup
  %86 = extractvalue { ptr, i32 } %85, 0
  store ptr %86, ptr %13, align 8
  %87 = extractvalue { ptr, i32 } %85, 1
  store i32 %87, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  br label %94

88:                                               ; preds = %79, %55
  %89 = getelementptr inbounds %"class.JPH::ConstraintManager", ptr %17, i32 0, i32 1
  invoke void @_ZN3JPH5ArrayINS_3RefINS_10ConstraintEEENS_12STLAllocatorIS3_EEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %89)
          to label %90 unwind label %80

90:                                               ; preds = %88
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %91

91:                                               ; preds = %90
  %92 = load ptr, ptr %8, align 8, !tbaa !5
  %93 = getelementptr inbounds ptr, ptr %92, i32 1
  store ptr %93, ptr %8, align 8, !tbaa !5
  br label %26, !llvm.loop !26

94:                                               ; preds = %84, %80
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %95

95:                                               ; preds = %94, %46
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #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 @_ZN3JPH10UniqueLockINS_5MutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(20) %7) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #5
  br label %97

96:                                               ; preds = %30
  call void @_ZN3JPH10UniqueLockINS_5MutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(20) %7) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #5
  ret void

97:                                               ; preds = %95
  %98 = load ptr, ptr %13, align 8
  %99 = load i32, ptr %14, align 4
  %100 = insertvalue { ptr, i32 } poison, ptr %98, 0
  %101 = insertvalue { ptr, i32 } %100, i32 %99, 1
  resume { ptr, i32 } %101
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN3JPH5ArrayINS_3RefINS_10ConstraintEEENS_12STLAllocatorIS3_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #3 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH5ArrayINS_3RefINS_10ConstraintEEENS_12STLAllocatorIS3_EEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTSN3JPH17ConstraintManagerE", !6, i64 0, !13, i64 8, !15, i64 32}
!13 = !{!"_ZTSN3JPH5ArrayINS_3RefINS_10ConstraintEEENS_12STLAllocatorIS3_EEEE", !14, i64 0, !14, i64 8, !6, i64 16}
!14 = !{!"long", !7, i64 0}
!15 = !{!"_ZTSN3JPH5MutexE", !16, i64 0, !18, i64 40}
!16 = !{!"_ZTSSt5mutex", !17, i64 0}
!17 = !{!"_ZTSSt12__mutex_base", !7, i64 0}
!18 = !{!"_ZTSNSt6thread2idE", !14, i64 0}
!19 = !{!20, !10, i64 12}
!20 = !{!"_ZTSN3JPH10ConstraintE", !21, i64 8, !10, i64 12, !10, i64 16, !7, i64 20, !7, i64 21, !24, i64 22, !14, i64 24}
!21 = !{!"_ZTSN3JPH9RefTargetINS_10ConstraintEEE", !22, i64 0}
!22 = !{!"_ZTSSt6atomicIjE", !23, i64 0}
!23 = !{!"_ZTSSt13__atomic_baseIjE", !10, i64 0}
!24 = !{!"bool", !7, i64 0}
!25 = !{i64 2157753462}
!26 = distinct !{!26, !27}
!27 = !{!"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.JPH::UniqueLock" = type <{ ptr, ptr, i32, [4 x i8] }>

@.str.1 = external hidden unnamed_addr constant [99 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [59 x i8], align 1

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH10UniqueLockINS_5MutexEEC2ERS1_PKNS_11BodyManagerENS_17EPhysicsLockTypesE(ptr noundef nonnull align 8 dereferenceable(20), ptr noundef nonnull align 8 dereferenceable(48), ptr noundef, i32 noundef) unnamed_addr #1 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH10UniqueLockINS_5MutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(20)) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3JPH17ConstraintManager6RemoveEPPNS_10ConstraintEi(ptr noundef nonnull align 8 dereferenceable(80) %0, ptr noundef readonly %1, i32 noundef %2) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.JPH::UniqueLock", align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #5
  %5 = getelementptr inbounds i8, ptr %0, i64 32
  %6 = load ptr, ptr %0, align 8, !tbaa !5
  call void @_ZN3JPH10UniqueLockINS_5MutexEEC2ERS1_PKNS_11BodyManagerENS_17EPhysicsLockTypesE(ptr noundef nonnull align 8 dereferenceable(20) %4, ptr noundef nonnull align 8 dereferenceable(48) %5, ptr noundef %6, i32 noundef 16)
  %7 = sext i32 %2 to i64
  %8 = getelementptr inbounds ptr, ptr %1, i64 %7
  %9 = icmp sgt i32 %2, 0
  br i1 %9, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %3
  %10 = getelementptr inbounds i8, ptr %0, i64 8
  br label %11

._crit_edge:                                      ; preds = %41, %3
  call void @_ZN3JPH10UniqueLockINS_5MutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(20) %4) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #5
  ret void

11:                                               ; preds = %.lr.ph, %41
  %.026 = phi ptr [ %1, %.lr.ph ], [ %42, %41 ]
  %12 = load ptr, ptr %.026, align 8, !tbaa !16
  %13 = getelementptr inbounds i8, ptr %12, i64 12
  %14 = load i32, ptr %13, align 4, !tbaa !17
  store i32 -1, ptr %13, align 4, !tbaa !17
  %.not = icmp eq i32 %14, -1
  br i1 %.not, label %15, label %21

15:                                               ; preds = %11
  %16 = invoke noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 47)
          to label %17 unwind label %19

17:                                               ; preds = %15
  br i1 %16, label %18, label %21

18:                                               ; preds = %17
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #5, !srcloc !24
  br label %21

19:                                               ; preds = %15
  %20 = landingpad { ptr, i32 }
          cleanup
  br label %44

21:                                               ; preds = %18, %17, %11
  %22 = call noundef i64 @_ZNK3JPH5ArrayINS_3RefINS_10ConstraintEEENS_12STLAllocatorIS3_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %10)
  %23 = trunc i64 %22 to i32
  %24 = add i32 %23, -1
  %25 = icmp ult i32 %14, %24
  br i1 %25, label %26, label %40

26:                                               ; preds = %21
  %27 = zext i32 %24 to i64
  %28 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN3JPH5ArrayINS_3RefINS_10ConstraintEEENS_12STLAllocatorIS3_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %10, i64 noundef %27)
          to label %29 unwind label %38

29:                                               ; preds = %26
  %30 = call noundef ptr @_ZNK3JPH3RefINS_10ConstraintEEcvPS1_Ev(ptr noundef nonnull align 8 dereferenceable(8) %28)
  %31 = getelementptr inbounds i8, ptr %30, i64 12
  store i32 %14, ptr %31, align 4, !tbaa !17
  %32 = zext i32 %14 to i64
  %33 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN3JPH5ArrayINS_3RefINS_10ConstraintEEENS_12STLAllocatorIS3_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %10, i64 noundef %32)
          to label %34 unwind label %38

34:                                               ; preds = %29
  %35 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN3JPH3RefINS_10ConstraintEEaSEPS1_(ptr noundef nonnull align 8 dereferenceable(8) %33, ptr noundef nonnull %30)
          to label %40 unwind label %38

36:                                               ; preds = %40
  %37 = landingpad { ptr, i32 }
          cleanup
  br label %44

38:                                               ; preds = %34, %29, %26
  %39 = landingpad { ptr, i32 }
          cleanup
  br label %44

40:                                               ; preds = %34, %21
  invoke void @_ZN3JPH5ArrayINS_3RefINS_10ConstraintEEENS_12STLAllocatorIS3_EEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %10)
          to label %41 unwind label %36

41:                                               ; preds = %40
  %42 = getelementptr inbounds i8, ptr %.026, i64 8
  %43 = icmp ult ptr %42, %8
  br i1 %43, label %11, label %._crit_edge, !llvm.loop !25

44:                                               ; preds = %36, %38, %19
  %.pn.pn = phi { ptr, i32 } [ %20, %19 ], [ %37, %36 ], [ %39, %38 ]
  call void @_ZN3JPH10UniqueLockINS_5MutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(20) %4) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #5
  resume { ptr, i32 } %.pn.pn
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN3JPH5ArrayINS_3RefINS_10ConstraintEEENS_12STLAllocatorIS3_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #3 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH5ArrayINS_3RefINS_10ConstraintEEENS_12STLAllocatorIS3_EEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"_ZTSN3JPH17ConstraintManagerE", !7, i64 0, !10, i64 8, !12, i64 32}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN3JPH5ArrayINS_3RefINS_10ConstraintEEENS_12STLAllocatorIS3_EEEE", !11, i64 0, !11, i64 8, !7, i64 16}
!11 = !{!"long", !8, i64 0}
!12 = !{!"_ZTSN3JPH5MutexE", !13, i64 0, !15, i64 40}
!13 = !{!"_ZTSSt5mutex", !14, i64 0}
!14 = !{!"_ZTSSt12__mutex_base", !8, i64 0}
!15 = !{!"_ZTSNSt6thread2idE", !11, i64 0}
!16 = !{!7, !7, i64 0}
!17 = !{!18, !22, i64 12}
!18 = !{!"_ZTSN3JPH10ConstraintE", !19, i64 8, !22, i64 12, !22, i64 16, !8, i64 20, !8, i64 21, !23, i64 22, !11, i64 24}
!19 = !{!"_ZTSN3JPH9RefTargetINS_10ConstraintEEE", !20, i64 0}
!20 = !{!"_ZTSSt6atomicIjE", !21, i64 0}
!21 = !{!"_ZTSSt13__atomic_baseIjE", !22, i64 0}
!22 = !{!"int", !8, i64 0}
!23 = !{!"bool", !8, i64 0}
!24 = !{i64 2157753462}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}


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