; LLVM IR from vczh/herodb :: Kernel/Source/Utility/Lock.ll (ZN2vl8database11LockManager8RollbackENS0_8IdObjectImLl3EEE)

; 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.vl::database::IdObject" = type { i64 }
%"class.vl::SpinLock::Scope" = type { %"class.vl::Object", ptr }
%"class.vl::Object" = type { ptr }
%"class.vl::Ptr" = type { ptr, ptr, ptr, ptr }
%"class.vl::database::LockManager" = type { %"class.vl::Object", ptr, %"class.vl::SpinLock", %"class.vl::collections::Dictionary", %"class.vl::collections::Dictionary.10", %"class.vl::collections::Array", %"class.vl::collections::Dictionary.33" }
%"class.vl::SpinLock" = type { %"class.vl::Object", i64 }
%"class.vl::collections::Dictionary" = type { %"class.vl::Object", %"class.vl::collections::SortedList", %"class.vl::collections::List", %"class.vl::collections::IEnumerable.9" }
%"class.vl::collections::SortedList" = type { %"class.vl::collections::ListBase.base", %"class.vl::collections::IEnumerable" }
%"class.vl::collections::ListBase.base" = type <{ %"class.vl::collections::ArrayBase.base", i64, i8 }>
%"class.vl::collections::ArrayBase.base" = type { %"class.vl::collections::ListStore", ptr, i64 }
%"class.vl::collections::ListStore" = type { %"class.vl::Object" }
%"class.vl::collections::IEnumerable" = type { %"class.vl::Interface" }
%"class.vl::Interface" = type { ptr }
%"class.vl::collections::List" = type { %"class.vl::collections::ListBase.base.8", %"class.vl::collections::IEnumerable.6" }
%"class.vl::collections::ListBase.base.8" = type <{ %"class.vl::collections::ArrayBase.base.7", i64, i8 }>
%"class.vl::collections::ArrayBase.base.7" = type { %"class.vl::collections::ListStore.5", ptr, i64 }
%"class.vl::collections::ListStore.5" = type { %"class.vl::Object" }
%"class.vl::collections::IEnumerable.6" = type { %"class.vl::Interface" }
%"class.vl::collections::IEnumerable.9" = type { %"class.vl::Interface" }
%"class.vl::collections::Dictionary.10" = type { %"class.vl::Object", %"class.vl::collections::SortedList.11", %"class.vl::collections::List.19", %"class.vl::collections::IEnumerable.27" }
%"class.vl::collections::SortedList.11" = type { %"class.vl::collections::ListBase.base.17", %"class.vl::collections::IEnumerable.15" }
%"class.vl::collections::ListBase.base.17" = type <{ %"class.vl::collections::ArrayBase.base.16", i64, i8 }>
%"class.vl::collections::ArrayBase.base.16" = type { %"class.vl::collections::ListStore.14", ptr, i64 }
%"class.vl::collections::ListStore.14" = type { %"class.vl::Object" }
%"class.vl::collections::IEnumerable.15" = type { %"class.vl::Interface" }
%"class.vl::collections::List.19" = type { %"class.vl::collections::ListBase.base.25", %"class.vl::collections::IEnumerable.23" }
%"class.vl::collections::ListBase.base.25" = type <{ %"class.vl::collections::ArrayBase.base.24", i64, i8 }>
%"class.vl::collections::ArrayBase.base.24" = type { %"class.vl::collections::ListStore.22", ptr, i64 }
%"class.vl::collections::ListStore.22" = type { %"class.vl::Object" }
%"class.vl::collections::IEnumerable.23" = type { %"class.vl::Interface" }
%"class.vl::collections::IEnumerable.27" = type { %"class.vl::Interface" }
%"class.vl::collections::Array" = type { %"class.vl::collections::ArrayBase.base.32", %"class.vl::collections::IEnumerable.31" }
%"class.vl::collections::ArrayBase.base.32" = type { %"class.vl::collections::ListStore.30", ptr, i64 }
%"class.vl::collections::ListStore.30" = type { %"class.vl::Object" }
%"class.vl::collections::IEnumerable.31" = type { %"class.vl::Interface" }
%"class.vl::collections::Dictionary.33" = type { %"class.vl::Object", %"class.vl::collections::SortedList.34", %"class.vl::collections::List.42", %"class.vl::collections::IEnumerable.50" }
%"class.vl::collections::SortedList.34" = type { %"class.vl::collections::ListBase.base.40", %"class.vl::collections::IEnumerable.38" }
%"class.vl::collections::ListBase.base.40" = type <{ %"class.vl::collections::ArrayBase.base.39", i64, i8 }>
%"class.vl::collections::ArrayBase.base.39" = type { %"class.vl::collections::ListStore.37", ptr, i64 }
%"class.vl::collections::ListStore.37" = type { %"class.vl::Object" }
%"class.vl::collections::IEnumerable.38" = type { %"class.vl::Interface" }
%"class.vl::collections::List.42" = type { %"class.vl::collections::ListBase.base.48", %"class.vl::collections::IEnumerable.46" }
%"class.vl::collections::ListBase.base.48" = type <{ %"class.vl::collections::ArrayBase.base.47", i64, i8 }>
%"class.vl::collections::ArrayBase.base.47" = type { %"class.vl::collections::ListStore.45", ptr, i64 }
%"class.vl::collections::ListStore.45" = type { %"class.vl::Object" }
%"class.vl::collections::IEnumerable.46" = type { %"class.vl::Interface" }
%"class.vl::collections::IEnumerable.50" = type { %"class.vl::Interface" }
%"struct.vl::database::LockManager::TransInfo" = type { %"struct.vl::database::IdObject", i64, %"class.vl::collections::SortedList.52", %"struct.vl::database::LockTarget" }
%"class.vl::collections::SortedList.52" = type { %"class.vl::collections::ListBase.base.58", %"class.vl::collections::IEnumerable.56" }
%"class.vl::collections::ListBase.base.58" = type <{ %"class.vl::collections::ArrayBase.base.57", i64, i8 }>
%"class.vl::collections::ArrayBase.base.57" = type { %"class.vl::collections::ListStore.55", ptr, i64 }
%"class.vl::collections::ListStore.55" = type { %"class.vl::Object" }
%"class.vl::collections::IEnumerable.56" = type { %"class.vl::Interface" }
%"struct.vl::database::LockTarget" = type { i32, i32, %"struct.vl::database::IdObject.0", %union.anon }
%"struct.vl::database::IdObject.0" = type { i32 }
%union.anon = type { %"struct.vl::database::IdObject.1" }
%"struct.vl::database::IdObject.1" = type { i64 }

@_ZTIN2vl5ErrorE = external dso_local constant { ptr, ptr }, align 8
@.str.2 = external hidden unnamed_addr constant [105 x i32], align 4

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(33) ptr @_ZNK2vl11collections10DictionaryINS_8database8IdObjectImLl3EEENS_3PtrINS2_11LockManager9TransInfoEEES4_PS7_E4KeysEv(ptr noundef nonnull align 8 dereferenceable(104)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNK2vl11collections10SortedListINS_8database8IdObjectImLl3EEES4_E7IndexOfERKS4_(ptr noundef nonnull align 8 dereferenceable(33), ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(33) ptr @_ZNK2vl11collections10DictionaryINS_8database8IdObjectImLl3EEENS_3PtrINS2_11LockManager9TransInfoEEES4_PS7_E6ValuesEv(ptr noundef nonnull align 8 dereferenceable(104)) #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2vl3PtrINS_8database11LockManager9TransInfoEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

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

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

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

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) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2vl3PtrINS_8database11LockManager9TransInfoEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN2vl8database11LockManager17ReleaseLockUnsafeENS0_8IdObjectImLl3EEERKNS0_10LockTargetE(ptr noundef nonnull align 8 dereferenceable(400), i64, ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

declare void @_ZN2vl8SpinLock5ScopeC1ERS0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #4

; Function Attrs: nounwind
declare void @_ZN2vl8SpinLock5ScopeD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #5

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

declare ptr @__cxa_allocate_exception(i64)

declare void @_ZN2vl5ErrorC1EPKw(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) unnamed_addr #4

declare void @__cxa_free_exception(ptr)

declare void @__cxa_throw(ptr, ptr, ptr)

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN2vl8database11LockManager8RollbackENS0_8IdObjectImLl3EEE(ptr noundef nonnull align 8 dereferenceable(400) %0, i64 %1) #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i1, align 1
  %4 = alloca %"struct.vl::database::IdObject", align 8
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca ptr, align 8
  %8 = alloca %"class.vl::SpinLock::Scope", align 8
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca %"class.vl::Ptr", align 8
  %14 = alloca i8, align 1
  %15 = alloca %"struct.vl::database::IdObject", align 8
  %16 = alloca i64, align 8
  %17 = alloca %"struct.vl::database::IdObject", align 8
  %18 = getelementptr inbounds %"struct.vl::database::IdObject", ptr %4, i32 0, i32 0
  store i64 %1, ptr %18, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  %19 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #6
  store i8 1, ptr %6, align 1, !tbaa !9
  %20 = load i8, ptr %6, align 1, !tbaa !9, !range !11, !noundef !12
  %21 = trunc i8 %20 to i1
  br i1 %21, label %22, label %143

22:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #6
  %23 = getelementptr inbounds %"class.vl::database::LockManager", ptr %19, i32 0, i32 2
  call void @_ZN2vl8SpinLock5ScopeC1ERS0_(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 8 dereferenceable(16) %23)
  store ptr %8, ptr %7, align 8, !tbaa !5
  br label %24

24:                                               ; preds = %139, %22
  %25 = load i8, ptr %6, align 1, !tbaa !9, !range !11, !noundef !12
  %26 = trunc i8 %25 to i1
  br i1 %26, label %28, label %27

27:                                               ; preds = %24
  store i32 2, ptr %9, align 4
  br label %140

28:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %29 = getelementptr inbounds %"class.vl::database::LockManager", ptr %19, i32 0, i32 4
  %30 = invoke noundef nonnull align 8 dereferenceable(33) ptr @_ZNK2vl11collections10DictionaryINS_8database8IdObjectImLl3EEENS_3PtrINS2_11LockManager9TransInfoEEES4_PS7_E4KeysEv(ptr noundef nonnull align 8 dereferenceable(104) %29)
          to label %31 unwind label %37

31:                                               ; preds = %28
  %32 = invoke noundef i64 @_ZNK2vl11collections10SortedListINS_8database8IdObjectImLl3EEES4_E7IndexOfERKS4_(ptr noundef nonnull align 8 dereferenceable(33) %30, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %33 unwind label %37

33:                                               ; preds = %31
  store i64 %32, ptr %10, align 8, !tbaa !13
  %34 = load i64, ptr %10, align 8, !tbaa !13
  %35 = icmp eq i64 %34, -1
  br i1 %35, label %36, label %41

36:                                               ; preds = %33
  store i1 false, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %137

37:                                               ; preds = %31, %28
  %38 = landingpad { ptr, i32 }
          cleanup
  %39 = extractvalue { ptr, i32 } %38, 0
  store ptr %39, ptr %11, align 8
  %40 = extractvalue { ptr, i32 } %38, 1
  store i32 %40, ptr %12, align 4
  br label %138

41:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 32, ptr %13) #6
  %42 = getelementptr inbounds %"class.vl::database::LockManager", ptr %19, i32 0, i32 4
  %43 = invoke noundef nonnull align 8 dereferenceable(33) ptr @_ZNK2vl11collections10DictionaryINS_8database8IdObjectImLl3EEENS_3PtrINS2_11LockManager9TransInfoEEES4_PS7_E6ValuesEv(ptr noundef nonnull align 8 dereferenceable(104) %42)
          to label %44 unwind label %55

44:                                               ; preds = %41
  %45 = load i64, ptr %10, align 8, !tbaa !13
  %46 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNK2vl11collections9ArrayBaseINS_3PtrINS_8database11LockManager9TransInfoEEEEixEl(ptr noundef nonnull align 8 dereferenceable(24) %43, i64 noundef %45)
          to label %47 unwind label %55

47:                                               ; preds = %44
  invoke void @_ZN2vl3PtrINS_8database11LockManager9TransInfoEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %13, ptr noundef nonnull align 8 dereferenceable(32) %46)
          to label %48 unwind label %55

48:                                               ; preds = %47
  %49 = invoke noundef ptr @_ZNK2vl3PtrINS_8database11LockManager9TransInfoEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %13)
          to label %50 unwind label %59

50:                                               ; preds = %48
  %51 = getelementptr inbounds %"struct.vl::database::LockManager::TransInfo", ptr %49, i32 0, i32 3
  %52 = invoke noundef zeroext i1 @_ZN2vl8database10LockTarget7IsValidEv(ptr noundef nonnull align 8 dereferenceable(24) %51)
          to label %53 unwind label %59

53:                                               ; preds = %50
  br i1 %52, label %63, label %54

54:                                               ; preds = %53
  store i1 false, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %134

55:                                               ; preds = %47, %44, %41
  %56 = landingpad { ptr, i32 }
          cleanup
  %57 = extractvalue { ptr, i32 } %56, 0
  store ptr %57, ptr %11, align 8
  %58 = extractvalue { ptr, i32 } %56, 1
  store i32 %58, ptr %12, align 4
  br label %136

59:                                               ; preds = %50, %48
  %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
  br label %135

63:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %15, ptr align 8 %4, i64 8, i1 false), !tbaa.struct !15
  %64 = invoke noundef ptr @_ZNK2vl3PtrINS_8database11LockManager9TransInfoEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %13)
          to label %65 unwind label %78

65:                                               ; preds = %63
  %66 = getelementptr inbounds %"struct.vl::database::LockManager::TransInfo", ptr %64, i32 0, i32 3
  %67 = getelementptr inbounds %"struct.vl::database::IdObject", ptr %15, i32 0, i32 0
  %68 = load i64, ptr %67, align 8
  %69 = invoke noundef zeroext i1 @_ZN2vl8database11LockManager17ReleaseLockUnsafeENS0_8IdObjectImLl3EEERKNS0_10LockTargetE(ptr noundef nonnull align 8 dereferenceable(400) %19, i64 %68, ptr noundef nonnull align 8 dereferenceable(24) %66)
          to label %70 unwind label %78

70:                                               ; preds = %65
  %71 = zext i1 %69 to i8
  store i8 %71, ptr %14, align 1, !tbaa !9
  %72 = load i8, ptr %14, align 1, !tbaa !9, !range !11, !noundef !12
  %73 = trunc i8 %72 to i1
  br i1 %73, label %88, label %74

74:                                               ; preds = %70
  br label %75

75:                                               ; preds = %74
  %76 = call ptr @__cxa_allocate_exception(i64 8) #6
  invoke void @_ZN2vl5ErrorC1EPKw(ptr noundef nonnull align 8 dereferenceable(8) %76, ptr noundef @.str.2)
          to label %77 unwind label %82

77:                                               ; preds = %75
  invoke void @__cxa_throw(ptr %76, ptr @_ZTIN2vl5ErrorE, ptr null) #7
          to label %154 unwind label %78

78:                                               ; preds = %77, %65, %63
  %79 = landingpad { ptr, i32 }
          cleanup
  %80 = extractvalue { ptr, i32 } %79, 0
  store ptr %80, ptr %11, align 8
  %81 = extractvalue { ptr, i32 } %79, 1
  store i32 %81, ptr %12, align 4
  br label %133

82:                                               ; preds = %75
  %83 = landingpad { ptr, i32 }
          cleanup
  %84 = extractvalue { ptr, i32 } %83, 0
  store ptr %84, ptr %11, align 8
  %85 = extractvalue { ptr, i32 } %83, 1
  store i32 %85, ptr %12, align 4
  call void @__cxa_free_exception(ptr %76) #6
  br label %133

86:                                               ; No predecessors!
  br label %87

87:                                               ; preds = %86
  br label %88

88:                                               ; preds = %87, %70
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %89 = invoke noundef ptr @_ZNK2vl3PtrINS_8database11LockManager9TransInfoEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %13)
          to label %90 unwind label %99

90:                                               ; preds = %88
  %91 = getelementptr inbounds %"struct.vl::database::LockManager::TransInfo", ptr %89, i32 0, i32 2
  %92 = invoke noundef i64 @_ZNK2vl11collections9ArrayBaseINS_8database10LockTargetEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %91)
          to label %93 unwind label %99

93:                                               ; preds = %90
  %94 = sub nsw i64 %92, 1
  store i64 %94, ptr %16, align 8, !tbaa !13
  br label %95

95:                                               ; preds = %128, %93
  %96 = load i64, ptr %16, align 8, !tbaa !13
  %97 = icmp sge i64 %96, 0
  br i1 %97, label %103, label %98

98:                                               ; preds = %95
  store i32 7, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  br label %132

99:                                               ; preds = %120, %109, %105, %103, %90, %88
  %100 = landingpad { ptr, i32 }
          cleanup
  %101 = extractvalue { ptr, i32 } %100, 0
  store ptr %101, ptr %11, align 8
  %102 = extractvalue { ptr, i32 } %100, 1
  store i32 %102, ptr %12, align 4
  br label %131

103:                                              ; preds = %95
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %17, ptr align 8 %4, i64 8, i1 false), !tbaa.struct !15
  %104 = invoke noundef ptr @_ZNK2vl3PtrINS_8database11LockManager9TransInfoEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %13)
          to label %105 unwind label %99

105:                                              ; preds = %103
  %106 = getelementptr inbounds %"struct.vl::database::LockManager::TransInfo", ptr %104, i32 0, i32 2
  %107 = load i64, ptr %16, align 8, !tbaa !13
  %108 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK2vl11collections9ArrayBaseINS_8database10LockTargetEEixEl(ptr noundef nonnull align 8 dereferenceable(24) %106, i64 noundef %107)
          to label %109 unwind label %99

109:                                              ; preds = %105
  %110 = getelementptr inbounds %"struct.vl::database::IdObject", ptr %17, i32 0, i32 0
  %111 = load i64, ptr %110, align 8
  %112 = invoke noundef zeroext i1 @_ZN2vl8database11LockManager17ReleaseLockUnsafeENS0_8IdObjectImLl3EEERKNS0_10LockTargetE(ptr noundef nonnull align 8 dereferenceable(400) %19, i64 %111, ptr noundef nonnull align 8 dereferenceable(24) %108)
          to label %113 unwind label %99

113:                                              ; preds = %109
  %114 = zext i1 %112 to i8
  store i8 %114, ptr %14, align 1, !tbaa !9
  %115 = load i8, ptr %14, align 1, !tbaa !9, !range !11, !noundef !12
  %116 = trunc i8 %115 to i1
  br i1 %116, label %127, label %117

117:                                              ; preds = %113
  br label %118

118:                                              ; preds = %117
  %119 = call ptr @__cxa_allocate_exception(i64 8) #6
  invoke void @_ZN2vl5ErrorC1EPKw(ptr noundef nonnull align 8 dereferenceable(8) %119, ptr noundef @.str.2)
          to label %120 unwind label %121

120:                                              ; preds = %118
  invoke void @__cxa_throw(ptr %119, ptr @_ZTIN2vl5ErrorE, ptr null) #7
          to label %154 unwind label %99

121:                                              ; preds = %118
  %122 = landingpad { ptr, i32 }
          cleanup
  %123 = extractvalue { ptr, i32 } %122, 0
  store ptr %123, ptr %11, align 8
  %124 = extractvalue { ptr, i32 } %122, 1
  store i32 %124, ptr %12, align 4
  call void @__cxa_free_exception(ptr %119) #6
  br label %131

125:                                              ; No predecessors!
  br label %126

126:                                              ; preds = %125
  br label %127

127:                                              ; preds = %126, %113
  br label %128

128:                                              ; preds = %127
  %129 = load i64, ptr %16, align 8, !tbaa !13
  %130 = add nsw i64 %129, -1
  store i64 %130, ptr %16, align 8, !tbaa !13
  br label %95, !llvm.loop !16

131:                                              ; preds = %121, %99
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  br label %133

132:                                              ; preds = %98
  store i1 true, ptr %3, align 1
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #6
  br label %134

133:                                              ; preds = %131, %82, %78
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #6
  br label %135

134:                                              ; preds = %132, %54
  call void @_ZN2vl3PtrINS_8database11LockManager9TransInfoEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #6
  br label %137

135:                                              ; preds = %133, %59
  call void @_ZN2vl3PtrINS_8database11LockManager9TransInfoEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13) #6
  br label %136

136:                                              ; preds = %135, %55
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #6
  br label %138

137:                                              ; preds = %134, %36
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %140

138:                                              ; preds = %136, %37
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @_ZN2vl8SpinLock5ScopeD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #6
  br label %149

139:                                              ; No predecessors!
  store i8 0, ptr %6, align 1, !tbaa !9
  br label %24, !llvm.loop !18

140:                                              ; preds = %137, %27
  call void @_ZN2vl8SpinLock5ScopeD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  %141 = load i32, ptr %9, align 4
  switch i32 %141, label %144 [
    i32 2, label %142
  ]

142:                                              ; preds = %140
  br label %143

143:                                              ; preds = %142, %2
  store i32 0, ptr %9, align 4
  br label %144

144:                                              ; preds = %143, %140
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #6
  %145 = load i32, ptr %9, align 4
  switch i32 %145, label %154 [
    i32 0, label %146
    i32 1, label %147
  ]

146:                                              ; preds = %144
  store i1 false, ptr %3, align 1
  br label %147

147:                                              ; preds = %146, %144
  %148 = load i1, ptr %3, align 1
  ret i1 %148

149:                                              ; preds = %138
  %150 = load ptr, ptr %11, align 8
  %151 = load i32, ptr %12, align 4
  %152 = insertvalue { ptr, i32 } poison, ptr %150, 0
  %153 = insertvalue { ptr, i32 } %152, i32 %151, 1
  resume { ptr, i32 } %153

154:                                              ; preds = %144, %120, %77
  unreachable
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { "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 "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 }
attributes #7 = { noreturn }

!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 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{i64 0, i64 8, !13}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}


; 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.vl::database::IdObject" = type { i64 }
%"class.vl::SpinLock::Scope" = type { %"class.vl::Object", ptr }
%"class.vl::Object" = type { ptr }
%"class.vl::Ptr" = type { ptr, ptr, ptr, ptr }

@_ZTIN2vl5ErrorE = external dso_local constant { ptr, ptr }, align 8
@.str.2 = external hidden unnamed_addr constant [105 x i32], align 4

; 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 nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(33) ptr @_ZNK2vl11collections10DictionaryINS_8database8IdObjectImLl3EEENS_3PtrINS2_11LockManager9TransInfoEEES4_PS7_E4KeysEv(ptr noundef nonnull align 8 dereferenceable(104)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNK2vl11collections10SortedListINS_8database8IdObjectImLl3EEES4_E7IndexOfERKS4_(ptr noundef nonnull align 8 dereferenceable(33), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(33) ptr @_ZNK2vl11collections10DictionaryINS_8database8IdObjectImLl3EEENS_3PtrINS2_11LockManager9TransInfoEEES4_PS7_E6ValuesEv(ptr noundef nonnull align 8 dereferenceable(104)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2vl3PtrINS_8database11LockManager9TransInfoEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

; 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 nounwind uwtable
declare dso_local noundef ptr @_ZNK2vl3PtrINS_8database11LockManager9TransInfoEEptEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2vl3PtrINS_8database11LockManager9TransInfoEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN2vl8database11LockManager17ReleaseLockUnsafeENS0_8IdObjectImLl3EEERKNS0_10LockTargetE(ptr noundef nonnull align 8 dereferenceable(400), i64, ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

declare void @_ZN2vl8SpinLock5ScopeC1ERS0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3

; Function Attrs: nounwind
declare void @_ZN2vl8SpinLock5ScopeD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #4

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

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

declare void @_ZN2vl5ErrorC1EPKw(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) unnamed_addr #3

declare void @__cxa_free_exception(ptr) local_unnamed_addr

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN2vl8database11LockManager8RollbackENS0_8IdObjectImLl3EEE(ptr noundef nonnull align 8 dereferenceable(400) %0, i64 %1) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"struct.vl::database::IdObject", align 8
  %4 = alloca %"class.vl::SpinLock::Scope", align 8
  %5 = alloca %"class.vl::Ptr", align 8
  store i64 %1, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #5
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  call void @_ZN2vl8SpinLock5ScopeC1ERS0_(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 8 dereferenceable(16) %6)
  %7 = getelementptr inbounds i8, ptr %0, i64 144
  %8 = call noundef nonnull align 8 dereferenceable(33) ptr @_ZNK2vl11collections10DictionaryINS_8database8IdObjectImLl3EEENS_3PtrINS2_11LockManager9TransInfoEEES4_PS7_E4KeysEv(ptr noundef nonnull align 8 dereferenceable(104) %7)
  %9 = invoke noundef i64 @_ZNK2vl11collections10SortedListINS_8database8IdObjectImLl3EEES4_E7IndexOfERKS4_(ptr noundef nonnull align 8 dereferenceable(33) %8, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %10 unwind label %12

10:                                               ; preds = %2
  %11 = icmp eq i64 %9, -1
  br i1 %11, label %59, label %14

12:                                               ; preds = %2
  %13 = landingpad { ptr, i32 }
          cleanup
  br label %58

14:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #5
  %15 = call noundef nonnull align 8 dereferenceable(33) ptr @_ZNK2vl11collections10DictionaryINS_8database8IdObjectImLl3EEENS_3PtrINS2_11LockManager9TransInfoEEES4_PS7_E6ValuesEv(ptr noundef nonnull align 8 dereferenceable(104) %7)
  %16 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNK2vl11collections9ArrayBaseINS_3PtrINS_8database11LockManager9TransInfoEEEEixEl(ptr noundef nonnull align 8 dereferenceable(24) %15, i64 noundef %9)
          to label %17 unwind label %22

17:                                               ; preds = %14
  call void @_ZN2vl3PtrINS_8database11LockManager9TransInfoEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef nonnull align 8 dereferenceable(32) %16)
  %18 = call noundef ptr @_ZNK2vl3PtrINS_8database11LockManager9TransInfoEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %5)
  %19 = getelementptr inbounds i8, ptr %18, i64 64
  %20 = invoke noundef zeroext i1 @_ZN2vl8database10LockTarget7IsValidEv(ptr noundef nonnull align 8 dereferenceable(24) %19)
          to label %21 unwind label %24

21:                                               ; preds = %17
  br i1 %20, label %26, label %.loopexit

22:                                               ; preds = %14
  %23 = landingpad { ptr, i32 }
          cleanup
  br label %57

24:                                               ; preds = %17
  %25 = landingpad { ptr, i32 }
          cleanup
  br label %56

26:                                               ; preds = %21
  %.sroa.03.0.copyload = load i64, ptr %3, align 8, !tbaa !5
  %27 = call noundef ptr @_ZNK2vl3PtrINS_8database11LockManager9TransInfoEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %5)
  %28 = getelementptr inbounds i8, ptr %27, i64 64
  %29 = invoke noundef zeroext i1 @_ZN2vl8database11LockManager17ReleaseLockUnsafeENS0_8IdObjectImLl3EEERKNS0_10LockTargetE(ptr noundef nonnull align 8 dereferenceable(400) %0, i64 %.sroa.03.0.copyload, ptr noundef nonnull align 8 dereferenceable(24) %28)
          to label %30 unwind label %34

30:                                               ; preds = %26
  br i1 %29, label %38, label %31

31:                                               ; preds = %30
  %32 = call ptr @__cxa_allocate_exception(i64 8) #5
  invoke void @_ZN2vl5ErrorC1EPKw(ptr noundef nonnull align 8 dereferenceable(8) %32, ptr noundef nonnull @.str.2)
          to label %33 unwind label %36

33:                                               ; preds = %31
  invoke void @__cxa_throw(ptr nonnull %32, ptr nonnull @_ZTIN2vl5ErrorE, ptr null) #6
          to label %60 unwind label %34

34:                                               ; preds = %33, %26
  %35 = landingpad { ptr, i32 }
          cleanup
  br label %56

36:                                               ; preds = %31
  %37 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %32) #5
  br label %56

38:                                               ; preds = %30
  %39 = call noundef ptr @_ZNK2vl3PtrINS_8database11LockManager9TransInfoEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %5)
  %40 = getelementptr inbounds i8, ptr %39, i64 16
  %41 = call noundef i64 @_ZNK2vl11collections9ArrayBaseINS_8database10LockTargetEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %40)
  br label %42

42:                                               ; preds = %50, %38
  %.015.in = phi i64 [ %41, %38 ], [ %.015, %50 ]
  %.015 = add nsw i64 %.015.in, -1
  %43 = icmp sgt i64 %.015.in, 0
  br i1 %43, label %44, label %.loopexit

.loopexit36:                                      ; preds = %44, %48
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %56

.loopexit.split-lp:                               ; preds = %53
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %56

44:                                               ; preds = %42
  %.sroa.0.0.copyload = load i64, ptr %3, align 8, !tbaa !5
  %45 = call noundef ptr @_ZNK2vl3PtrINS_8database11LockManager9TransInfoEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %5)
  %46 = getelementptr inbounds i8, ptr %45, i64 16
  %47 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK2vl11collections9ArrayBaseINS_8database10LockTargetEEixEl(ptr noundef nonnull align 8 dereferenceable(24) %46, i64 noundef %.015)
          to label %48 unwind label %.loopexit36

48:                                               ; preds = %44
  %49 = invoke noundef zeroext i1 @_ZN2vl8database11LockManager17ReleaseLockUnsafeENS0_8IdObjectImLl3EEERKNS0_10LockTargetE(ptr noundef nonnull align 8 dereferenceable(400) %0, i64 %.sroa.0.0.copyload, ptr noundef nonnull align 8 dereferenceable(24) %47)
          to label %50 unwind label %.loopexit36

50:                                               ; preds = %48
  br i1 %49, label %42, label %51, !llvm.loop !9

51:                                               ; preds = %50
  %52 = call ptr @__cxa_allocate_exception(i64 8) #5
  invoke void @_ZN2vl5ErrorC1EPKw(ptr noundef nonnull align 8 dereferenceable(8) %52, ptr noundef nonnull @.str.2)
          to label %53 unwind label %54

53:                                               ; preds = %51
  invoke void @__cxa_throw(ptr nonnull %52, ptr nonnull @_ZTIN2vl5ErrorE, ptr null) #6
          to label %60 unwind label %.loopexit.split-lp

54:                                               ; preds = %51
  %55 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %52) #5
  br label %56

.loopexit:                                        ; preds = %42, %21
  call void @_ZN2vl3PtrINS_8database11LockManager9TransInfoEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #5
  br label %59

56:                                               ; preds = %.loopexit36, %.loopexit.split-lp, %34, %36, %54, %24
  %.pn.pn.pn = phi { ptr, i32 } [ %25, %24 ], [ %35, %34 ], [ %37, %36 ], [ %55, %54 ], [ %lpad.loopexit, %.loopexit36 ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @_ZN2vl3PtrINS_8database11LockManager9TransInfoEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #5
  br label %57

57:                                               ; preds = %56, %22
  %.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn, %56 ], [ %23, %22 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #5
  br label %58

58:                                               ; preds = %57, %12
  %.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn.pn, %57 ], [ %13, %12 ]
  call void @_ZN2vl8SpinLock5ScopeD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #5
  resume { ptr, i32 } %.pn.pn.pn.pn.pn

59:                                               ; preds = %.loopexit, %10
  %.1 = phi i1 [ %20, %.loopexit ], [ false, %10 ]
  call void @_ZN2vl8SpinLock5ScopeD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #5
  ret i1 %.1

60:                                               ; preds = %53, %33
  unreachable
}

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 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 = { "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 "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 }
attributes #6 = { noreturn }

!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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass