; LLVM IR from vczh/herodb :: Kernel/Source/Utility (Log)

; 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.17" = type { i64 }
%"struct.vl::database::IdObject.16" = type { i64 }
%"struct.vl::database::IdObject.15" = type { i64 }
%"struct.vl::database::IdObject" = type { i32 }
%"class.vl::database::log_internal::LogAddressItem" = type { %"class.vl::Object", ptr, %"struct.vl::database::IdObject", i64, i64, %"class.vl::collections::List" }
%"class.vl::Object" = type { ptr }
%"class.vl::collections::List" = 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 }

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

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

declare i32 @__gxx_personality_v0(...)

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

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

declare noundef ptr @_ZN2vl8database13BufferManager8LockPageENS0_8IdObjectIiLl0EEENS2_ImLl1EEE(ptr noundef nonnull align 8 dereferenceable(168), i32, i64) #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

declare noundef zeroext i1 @_ZN2vl8database13BufferManager10UnlockPageENS0_8IdObjectIiLl0EEENS2_ImLl1EEEPvNS0_15PersistanceTypeE(ptr noundef nonnull align 8 dereferenceable(168), i32, i64, ptr noundef, i32 noundef) #3

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

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

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

declare ptr @__cxa_allocate_exception(i64)

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

declare void @__cxa_free_exception(ptr)

declare void @__cxa_throw(ptr, ptr, ptr)

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN2vl8database12log_internal14LogAddressItem16WriteAddressItemENS0_8IdObjectImLl3EEENS3_ImLl2EEE(ptr noundef nonnull align 8 dereferenceable(88) %0, i64 %1, i64 %2) #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca i1, align 1
  %5 = alloca %"struct.vl::database::IdObject.17", align 8
  %6 = alloca %"struct.vl::database::IdObject.16", align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca %"struct.vl::database::IdObject.15", align 8
  %13 = alloca ptr, align 8
  %14 = alloca %"struct.vl::database::IdObject", align 4
  %15 = alloca %"struct.vl::database::IdObject.15", align 8
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca %"struct.vl::database::IdObject", align 4
  %19 = alloca %"struct.vl::database::IdObject.15", align 8
  %20 = alloca %"struct.vl::database::IdObject.15", align 8
  %21 = alloca %"struct.vl::database::IdObject.15", align 8
  %22 = alloca %"struct.vl::database::IdObject", align 4
  %23 = alloca ptr, align 8
  %24 = alloca %"struct.vl::database::IdObject", align 4
  %25 = alloca %"struct.vl::database::IdObject.15", align 8
  %26 = alloca %"struct.vl::database::IdObject", align 4
  %27 = alloca %"struct.vl::database::IdObject.15", align 8
  %28 = alloca %"struct.vl::database::IdObject", align 4
  %29 = alloca %"struct.vl::database::IdObject.15", align 8
  %30 = alloca %"struct.vl::database::IdObject", align 4
  %31 = alloca %"struct.vl::database::IdObject.15", align 8
  %32 = getelementptr inbounds %"struct.vl::database::IdObject.17", ptr %5, i32 0, i32 0
  store i64 %1, ptr %32, align 8
  %33 = getelementptr inbounds %"struct.vl::database::IdObject.16", ptr %6, i32 0, i32 0
  store i64 %2, ptr %33, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  %34 = load ptr, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %35 = getelementptr inbounds %"struct.vl::database::IdObject.17", ptr %5, i32 0, i32 0
  %36 = load i64, ptr %35, align 8, !tbaa !9
  %37 = getelementptr inbounds %"class.vl::database::log_internal::LogAddressItem", ptr %34, i32 0, i32 4
  %38 = load i64, ptr %37, align 8, !tbaa !12
  %39 = udiv i64 %36, %38
  store i64 %39, ptr %8, align 8, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %40 = getelementptr inbounds %"struct.vl::database::IdObject.17", ptr %5, i32 0, i32 0
  %41 = load i64, ptr %40, align 8, !tbaa !9
  %42 = getelementptr inbounds %"class.vl::database::log_internal::LogAddressItem", ptr %34, i32 0, i32 4
  %43 = load i64, ptr %42, align 8, !tbaa !12
  %44 = urem i64 %41, %43
  store i64 %44, ptr %9, align 8, !tbaa !22
  br label %45

45:                                               ; preds = %3
  %46 = load i64, ptr %8, align 8, !tbaa !22
  %47 = getelementptr inbounds %"class.vl::database::log_internal::LogAddressItem", ptr %34, i32 0, i32 5
  %48 = call noundef i64 @_ZNK2vl11collections9ArrayBaseINS_8database8IdObjectImLl1EEEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %47)
  %49 = icmp ule i64 %46, %48
  br i1 %49, label %57, label %50

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

52:                                               ; preds = %50
  call void @__cxa_throw(ptr %51, ptr @_ZTIN2vl5ErrorE, ptr null) #7
  unreachable

53:                                               ; preds = %50
  %54 = landingpad { ptr, i32 }
          cleanup
  %55 = extractvalue { ptr, i32 } %54, 0
  store ptr %55, ptr %10, align 8
  %56 = extractvalue { ptr, i32 } %54, 1
  store i32 %56, ptr %11, align 4
  call void @__cxa_free_exception(ptr %51) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %189

57:                                               ; preds = %45
  br label %58

58:                                               ; preds = %57
  br label %59

59:                                               ; preds = %58
  %60 = load i64, ptr %8, align 8, !tbaa !22
  %61 = getelementptr inbounds %"class.vl::database::log_internal::LogAddressItem", ptr %34, i32 0, i32 5
  %62 = call noundef i64 @_ZNK2vl11collections9ArrayBaseINS_8database8IdObjectImLl1EEEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %61)
  %63 = icmp ult i64 %60, %62
  br i1 %63, label %64, label %109

64:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %65 = getelementptr inbounds %"class.vl::database::log_internal::LogAddressItem", ptr %34, i32 0, i32 5
  %66 = load i64, ptr %8, align 8, !tbaa !22
  %67 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN2vl11collections4ListINS_8database8IdObjectImLl1EEES4_EixEl(ptr noundef nonnull align 8 dereferenceable(33) %65, i64 noundef %66)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %12, ptr align 8 %67, i64 8, i1 false), !tbaa.struct !23
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %68 = getelementptr inbounds %"class.vl::database::log_internal::LogAddressItem", ptr %34, i32 0, i32 1
  %69 = load ptr, ptr %68, align 8, !tbaa !24
  %70 = getelementptr inbounds %"class.vl::database::log_internal::LogAddressItem", ptr %34, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %14, ptr align 8 %70, i64 4, i1 false), !tbaa.struct !25
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %15, ptr align 8 %12, i64 8, i1 false), !tbaa.struct !23
  %71 = getelementptr inbounds %"struct.vl::database::IdObject", ptr %14, i32 0, i32 0
  %72 = load i32, ptr %71, align 4
  %73 = getelementptr inbounds %"struct.vl::database::IdObject.15", ptr %15, i32 0, i32 0
  %74 = load i64, ptr %73, align 8
  %75 = call noundef ptr @_ZN2vl8database13BufferManager8LockPageENS0_8IdObjectIiLl0EEENS2_ImLl1EEE(ptr noundef nonnull align 8 dereferenceable(168) %69, i32 %72, i64 %74)
  store ptr %75, ptr %13, align 8, !tbaa !5
  %76 = load ptr, ptr %13, align 8, !tbaa !5
  %77 = icmp ne ptr %76, null
  br i1 %77, label %79, label %78

78:                                               ; preds = %64
  store i1 false, ptr %4, align 1
  store i32 1, ptr %16, align 4
  br label %106

79:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %80 = load ptr, ptr %13, align 8, !tbaa !5
  %81 = getelementptr inbounds i64, ptr %80, i64 0
  store ptr %81, ptr %17, align 8, !tbaa !5
  %82 = load ptr, ptr %17, align 8, !tbaa !5
  %83 = load i64, ptr %82, align 8, !tbaa !22
  %84 = load i64, ptr %9, align 8, !tbaa !22
  %85 = icmp ule i64 %83, %84
  br i1 %85, label %86, label %90

86:                                               ; preds = %79
  %87 = load i64, ptr %9, align 8, !tbaa !22
  %88 = add i64 %87, 1
  %89 = load ptr, ptr %17, align 8, !tbaa !5
  store i64 %88, ptr %89, align 8, !tbaa !22
  br label %90

90:                                               ; preds = %86, %79
  %91 = getelementptr inbounds %"struct.vl::database::IdObject.16", ptr %6, i32 0, i32 0
  %92 = load i64, ptr %91, align 8, !tbaa !27
  %93 = load ptr, ptr %13, align 8, !tbaa !5
  %94 = load i64, ptr %9, align 8, !tbaa !22
  %95 = add i64 %94, 2
  %96 = getelementptr inbounds i64, ptr %93, i64 %95
  store i64 %92, ptr %96, align 8, !tbaa !22
  %97 = getelementptr inbounds %"class.vl::database::log_internal::LogAddressItem", ptr %34, i32 0, i32 1
  %98 = load ptr, ptr %97, align 8, !tbaa !24
  %99 = getelementptr inbounds %"class.vl::database::log_internal::LogAddressItem", ptr %34, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %18, ptr align 8 %99, i64 4, i1 false), !tbaa.struct !25
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %19, ptr align 8 %12, i64 8, i1 false), !tbaa.struct !23
  %100 = load ptr, ptr %13, align 8, !tbaa !5
  %101 = getelementptr inbounds %"struct.vl::database::IdObject", ptr %18, i32 0, i32 0
  %102 = load i32, ptr %101, align 4
  %103 = getelementptr inbounds %"struct.vl::database::IdObject.15", ptr %19, i32 0, i32 0
  %104 = load i64, ptr %103, align 8
  %105 = call noundef zeroext i1 @_ZN2vl8database13BufferManager10UnlockPageENS0_8IdObjectIiLl0EEENS2_ImLl1EEEPvNS0_15PersistanceTypeE(ptr noundef nonnull align 8 dereferenceable(168) %98, i32 %102, i64 %104, ptr noundef %100, i32 noundef 2)
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  store i32 0, ptr %16, align 4
  br label %106

106:                                              ; preds = %90, %78
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  %107 = load i32, ptr %16, align 4
  switch i32 %107, label %187 [
    i32 0, label %108
  ]

108:                                              ; preds = %106
  br label %186

109:                                              ; preds = %59
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  %110 = getelementptr inbounds %"class.vl::database::log_internal::LogAddressItem", ptr %34, i32 0, i32 5
  %111 = getelementptr inbounds %"class.vl::database::log_internal::LogAddressItem", ptr %34, i32 0, i32 5
  %112 = call noundef i64 @_ZNK2vl11collections9ArrayBaseINS_8database8IdObjectImLl1EEEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %111)
  %113 = sub nsw i64 %112, 1
  %114 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN2vl11collections4ListINS_8database8IdObjectImLl1EEES4_EixEl(ptr noundef nonnull align 8 dereferenceable(33) %110, i64 noundef %113)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %20, ptr align 8 %114, i64 8, i1 false), !tbaa.struct !23
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %115 = getelementptr inbounds %"class.vl::database::log_internal::LogAddressItem", ptr %34, i32 0, i32 1
  %116 = load ptr, ptr %115, align 8, !tbaa !24
  %117 = getelementptr inbounds %"class.vl::database::log_internal::LogAddressItem", ptr %34, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %22, ptr align 8 %117, i64 4, i1 false), !tbaa.struct !25
  %118 = getelementptr inbounds %"struct.vl::database::IdObject", ptr %22, i32 0, i32 0
  %119 = load i32, ptr %118, align 4
  %120 = call i64 @_ZN2vl8database13BufferManager12AllocatePageENS0_8IdObjectIiLl0EEE(ptr noundef nonnull align 8 dereferenceable(168) %116, i32 %119)
  %121 = getelementptr inbounds %"struct.vl::database::IdObject.15", ptr %21, i32 0, i32 0
  store i64 %120, ptr %121, align 8
  %122 = call noundef zeroext i1 @_ZNK2vl8database8IdObjectImLl1EE7IsValidEv(ptr noundef nonnull align 8 dereferenceable(8) %21)
  br i1 %122, label %124, label %123

123:                                              ; preds = %109
  store i1 false, ptr %4, align 1
  store i32 1, ptr %16, align 4
  br label %183

124:                                              ; preds = %109
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #6
  %125 = getelementptr inbounds %"class.vl::database::log_internal::LogAddressItem", ptr %34, i32 0, i32 1
  %126 = load ptr, ptr %125, align 8, !tbaa !24
  %127 = getelementptr inbounds %"class.vl::database::log_internal::LogAddressItem", ptr %34, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %24, ptr align 8 %127, i64 4, i1 false), !tbaa.struct !25
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %25, ptr align 8 %20, i64 8, i1 false), !tbaa.struct !23
  %128 = getelementptr inbounds %"struct.vl::database::IdObject", ptr %24, i32 0, i32 0
  %129 = load i32, ptr %128, align 4
  %130 = getelementptr inbounds %"struct.vl::database::IdObject.15", ptr %25, i32 0, i32 0
  %131 = load i64, ptr %130, align 8
  %132 = call noundef ptr @_ZN2vl8database13BufferManager8LockPageENS0_8IdObjectIiLl0EEENS2_ImLl1EEE(ptr noundef nonnull align 8 dereferenceable(168) %126, i32 %129, i64 %131)
  store ptr %132, ptr %23, align 8, !tbaa !5
  %133 = load ptr, ptr %23, align 8, !tbaa !5
  %134 = icmp ne ptr %133, null
  br i1 %134, label %136, label %135

135:                                              ; preds = %124
  store i1 false, ptr %4, align 1
  store i32 1, ptr %16, align 4
  br label %182

136:                                              ; preds = %124
  %137 = getelementptr inbounds %"struct.vl::database::IdObject.15", ptr %21, i32 0, i32 0
  %138 = load i64, ptr %137, align 8, !tbaa !29
  %139 = load ptr, ptr %23, align 8, !tbaa !5
  %140 = getelementptr inbounds i64, ptr %139, i64 1
  store i64 %138, ptr %140, align 8, !tbaa !22
  %141 = getelementptr inbounds %"class.vl::database::log_internal::LogAddressItem", ptr %34, i32 0, i32 1
  %142 = load ptr, ptr %141, align 8, !tbaa !24
  %143 = getelementptr inbounds %"class.vl::database::log_internal::LogAddressItem", ptr %34, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %26, ptr align 8 %143, i64 4, i1 false), !tbaa.struct !25
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %27, ptr align 8 %20, i64 8, i1 false), !tbaa.struct !23
  %144 = load ptr, ptr %23, align 8, !tbaa !5
  %145 = getelementptr inbounds %"struct.vl::database::IdObject", ptr %26, i32 0, i32 0
  %146 = load i32, ptr %145, align 4
  %147 = getelementptr inbounds %"struct.vl::database::IdObject.15", ptr %27, i32 0, i32 0
  %148 = load i64, ptr %147, align 8
  %149 = call noundef zeroext i1 @_ZN2vl8database13BufferManager10UnlockPageENS0_8IdObjectIiLl0EEENS2_ImLl1EEEPvNS0_15PersistanceTypeE(ptr noundef nonnull align 8 dereferenceable(168) %142, i32 %146, i64 %148, ptr noundef %144, i32 noundef 2)
  %150 = getelementptr inbounds %"class.vl::database::log_internal::LogAddressItem", ptr %34, i32 0, i32 1
  %151 = load ptr, ptr %150, align 8, !tbaa !24
  %152 = getelementptr inbounds %"class.vl::database::log_internal::LogAddressItem", ptr %34, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %28, ptr align 8 %152, i64 4, i1 false), !tbaa.struct !25
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %29, ptr align 8 %21, i64 8, i1 false), !tbaa.struct !23
  %153 = getelementptr inbounds %"struct.vl::database::IdObject", ptr %28, i32 0, i32 0
  %154 = load i32, ptr %153, align 4
  %155 = getelementptr inbounds %"struct.vl::database::IdObject.15", ptr %29, i32 0, i32 0
  %156 = load i64, ptr %155, align 8
  %157 = call noundef ptr @_ZN2vl8database13BufferManager8LockPageENS0_8IdObjectIiLl0EEENS2_ImLl1EEE(ptr noundef nonnull align 8 dereferenceable(168) %151, i32 %154, i64 %156)
  store ptr %157, ptr %23, align 8, !tbaa !5
  %158 = load ptr, ptr %23, align 8, !tbaa !5
  %159 = getelementptr inbounds %"class.vl::database::log_internal::LogAddressItem", ptr %34, i32 0, i32 3
  %160 = load i64, ptr %159, align 8, !tbaa !31
  call void @llvm.memset.p0.i64(ptr align 8 %158, i8 0, i64 %160, i1 false)
  %161 = load ptr, ptr %23, align 8, !tbaa !5
  %162 = getelementptr inbounds i64, ptr %161, i64 0
  store i64 1, ptr %162, align 8, !tbaa !22
  %163 = load ptr, ptr %23, align 8, !tbaa !5
  %164 = getelementptr inbounds i64, ptr %163, i64 1
  store i64 -1, ptr %164, align 8, !tbaa !22
  %165 = getelementptr inbounds %"struct.vl::database::IdObject.16", ptr %6, i32 0, i32 0
  %166 = load i64, ptr %165, align 8, !tbaa !27
  %167 = load ptr, ptr %23, align 8, !tbaa !5
  %168 = load i64, ptr %9, align 8, !tbaa !22
  %169 = add i64 %168, 2
  %170 = getelementptr inbounds i64, ptr %167, i64 %169
  store i64 %166, ptr %170, align 8, !tbaa !22
  %171 = getelementptr inbounds %"class.vl::database::log_internal::LogAddressItem", ptr %34, i32 0, i32 1
  %172 = load ptr, ptr %171, align 8, !tbaa !24
  %173 = getelementptr inbounds %"class.vl::database::log_internal::LogAddressItem", ptr %34, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %30, ptr align 8 %173, i64 4, i1 false), !tbaa.struct !25
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %31, ptr align 8 %21, i64 8, i1 false), !tbaa.struct !23
  %174 = load ptr, ptr %23, align 8, !tbaa !5
  %175 = getelementptr inbounds %"struct.vl::database::IdObject", ptr %30, i32 0, i32 0
  %176 = load i32, ptr %175, align 4
  %177 = getelementptr inbounds %"struct.vl::database::IdObject.15", ptr %31, i32 0, i32 0
  %178 = load i64, ptr %177, align 8
  %179 = call noundef zeroext i1 @_ZN2vl8database13BufferManager10UnlockPageENS0_8IdObjectIiLl0EEENS2_ImLl1EEEPvNS0_15PersistanceTypeE(ptr noundef nonnull align 8 dereferenceable(168) %172, i32 %176, i64 %178, ptr noundef %174, i32 noundef 2)
  %180 = getelementptr inbounds %"class.vl::database::log_internal::LogAddressItem", ptr %34, i32 0, i32 5
  %181 = call noundef i64 @_ZN2vl11collections4ListINS_8database8IdObjectImLl1EEES4_E3AddERKS4_(ptr noundef nonnull align 8 dereferenceable(33) %180, ptr noundef nonnull align 8 dereferenceable(8) %21)
  store i32 0, ptr %16, align 4
  br label %182

182:                                              ; preds = %136, %135
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  br label %183

183:                                              ; preds = %182, %123
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  %184 = load i32, ptr %16, align 4
  switch i32 %184, label %187 [
    i32 0, label %185
  ]

185:                                              ; preds = %183
  br label %186

186:                                              ; preds = %185, %108
  store i1 true, ptr %4, align 1
  store i32 1, ptr %16, align 4
  br label %187

187:                                              ; preds = %186, %183, %106
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  %188 = load i1, ptr %4, align 1
  ret i1 %188

189:                                              ; preds = %53
  %190 = load ptr, ptr %10, align 8
  %191 = load i32, ptr %11, align 4
  %192 = insertvalue { ptr, i32 } poison, ptr %190, 0
  %193 = insertvalue { ptr, i32 } %192, i32 %191, 1
  resume { ptr, i32 } %193
}

declare i64 @_ZN2vl8database13BufferManager12AllocatePageENS0_8IdObjectIiLl0EEE(ptr noundef nonnull align 8 dereferenceable(168), i32) #3

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 #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, !11, i64 0}
!10 = !{!"_ZTSN2vl8database8IdObjectImLl3EEE", !11, i64 0}
!11 = !{!"long", !7, i64 0}
!12 = !{!13, !11, i64 32}
!13 = !{!"_ZTSN2vl8database12log_internal14LogAddressItemE", !14, i64 0, !6, i64 8, !15, i64 16, !11, i64 24, !11, i64 32, !17, i64 40}
!14 = !{!"_ZTSN2vl6ObjectE"}
!15 = !{!"_ZTSN2vl8database8IdObjectIiLl0EEE", !16, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = !{!"_ZTSN2vl11collections4ListINS_8database8IdObjectImLl1EEES4_EE", !18, i64 0}
!18 = !{!"_ZTSN2vl11collections8ListBaseINS_8database8IdObjectImLl1EEES4_EE", !19, i64 0, !11, i64 24, !21, i64 32}
!19 = !{!"_ZTSN2vl11collections9ArrayBaseINS_8database8IdObjectImLl1EEEEE", !20, i64 0, !6, i64 8, !11, i64 16}
!20 = !{!"_ZTSN2vl11collections9ListStoreINS_8database8IdObjectImLl1EEELb1EEE", !14, i64 0}
!21 = !{!"bool", !7, i64 0}
!22 = !{!11, !11, i64 0}
!23 = !{i64 0, i64 8, !22}
!24 = !{!13, !6, i64 8}
!25 = !{i64 0, i64 4, !26}
!26 = !{!16, !16, i64 0}
!27 = !{!28, !11, i64 0}
!28 = !{!"_ZTSN2vl8database8IdObjectImLl2EEE", !11, i64 0}
!29 = !{!30, !11, i64 0}
!30 = !{!"_ZTSN2vl8database8IdObjectImLl1EEE", !11, i64 0}
!31 = !{!13, !11, i64 24}


; 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.15" = type { i64 }

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

declare i32 @__gxx_personality_v0(...)

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

declare noundef ptr @_ZN2vl8database13BufferManager8LockPageENS0_8IdObjectIiLl0EEENS2_ImLl1EEE(ptr noundef nonnull align 8 dereferenceable(168), i32, i64) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

declare noundef zeroext i1 @_ZN2vl8database13BufferManager10UnlockPageENS0_8IdObjectIiLl0EEENS2_ImLl1EEEPvNS0_15PersistanceTypeE(ptr noundef nonnull align 8 dereferenceable(168), i32, i64, ptr noundef, i32 noundef) local_unnamed_addr #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 zeroext i1 @_ZNK2vl8database8IdObjectImLl1EE7IsValidEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK2vl11collections9ArrayBaseINS_8database8IdObjectImLl1EEEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 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 #2

declare void @__cxa_free_exception(ptr) local_unnamed_addr

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN2vl8database12log_internal14LogAddressItem16WriteAddressItemENS0_8IdObjectImLl3EEENS3_ImLl2EEE(ptr noundef nonnull align 8 dereferenceable(88) %0, i64 %1, i64 %2) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"struct.vl::database::IdObject.15", align 8
  %5 = getelementptr inbounds i8, ptr %0, i64 32
  %6 = load i64, ptr %5, align 8, !tbaa !5
  %7 = udiv i64 %1, %6
  %8 = urem i64 %1, %6
  %9 = getelementptr inbounds i8, ptr %0, i64 40
  %10 = tail call noundef i64 @_ZNK2vl11collections9ArrayBaseINS_8database8IdObjectImLl1EEEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %9)
  %.not = icmp ugt i64 %7, %10
  br i1 %.not, label %11, label %16

11:                                               ; preds = %3
  %12 = tail call ptr @__cxa_allocate_exception(i64 8) #5
  invoke void @_ZN2vl5ErrorC1EPKw(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull @.str)
          to label %13 unwind label %14

13:                                               ; preds = %11
  tail call void @__cxa_throw(ptr nonnull %12, ptr nonnull @_ZTIN2vl5ErrorE, ptr null) #6
  unreachable

14:                                               ; preds = %11
  %15 = landingpad { ptr, i32 }
          cleanup
  tail call void @__cxa_free_exception(ptr %12) #5
  resume { ptr, i32 } %15

16:                                               ; preds = %3
  %17 = tail call noundef i64 @_ZNK2vl11collections9ArrayBaseINS_8database8IdObjectImLl1EEEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %9)
  %18 = icmp ult i64 %7, %17
  br i1 %18, label %19, label %34

19:                                               ; preds = %16
  %20 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN2vl11collections4ListINS_8database8IdObjectImLl1EEES4_EixEl(ptr noundef nonnull align 8 dereferenceable(33) %9, i64 noundef %7)
  %.sroa.030.0.copyload = load i64, ptr %20, align 8, !tbaa !19
  %21 = getelementptr inbounds i8, ptr %0, i64 8
  %22 = load ptr, ptr %21, align 8, !tbaa !20
  %23 = getelementptr inbounds i8, ptr %0, i64 16
  %.sroa.025.0.copyload = load i32, ptr %23, align 8, !tbaa !21
  %24 = tail call noundef ptr @_ZN2vl8database13BufferManager8LockPageENS0_8IdObjectIiLl0EEENS2_ImLl1EEE(ptr noundef nonnull align 8 dereferenceable(168) %22, i32 %.sroa.025.0.copyload, i64 %.sroa.030.0.copyload)
  %.not54.not = icmp eq ptr %24, null
  br i1 %.not54.not, label %.critedge, label %25

25:                                               ; preds = %19
  %26 = load i64, ptr %24, align 8, !tbaa !19
  %.not55 = icmp ugt i64 %26, %8
  br i1 %.not55, label %29, label %27

27:                                               ; preds = %25
  %28 = add nuw i64 %8, 1
  store i64 %28, ptr %24, align 8, !tbaa !19
  br label %29

29:                                               ; preds = %27, %25
  %30 = getelementptr i64, ptr %24, i64 %8
  %31 = getelementptr i8, ptr %30, i64 16
  store i64 %2, ptr %31, align 8, !tbaa !19
  %32 = load ptr, ptr %21, align 8, !tbaa !20
  %.sroa.020.0.copyload = load i32, ptr %23, align 8, !tbaa !21
  %33 = tail call noundef zeroext i1 @_ZN2vl8database13BufferManager10UnlockPageENS0_8IdObjectIiLl0EEENS2_ImLl1EEEPvNS0_15PersistanceTypeE(ptr noundef nonnull align 8 dereferenceable(168) %32, i32 %.sroa.020.0.copyload, i64 %.sroa.030.0.copyload, ptr noundef nonnull %24, i32 noundef 2)
  br label %.critedge

34:                                               ; preds = %16
  %35 = tail call noundef i64 @_ZNK2vl11collections9ArrayBaseINS_8database8IdObjectImLl1EEEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %9)
  %36 = add nsw i64 %35, -1
  %37 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN2vl11collections4ListINS_8database8IdObjectImLl1EEES4_EixEl(ptr noundef nonnull align 8 dereferenceable(33) %9, i64 noundef %36)
  %.sroa.017.0.copyload = load i64, ptr %37, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  %38 = getelementptr inbounds i8, ptr %0, i64 8
  %39 = load ptr, ptr %38, align 8, !tbaa !20
  %40 = getelementptr inbounds i8, ptr %0, i64 16
  %.sroa.016.0.copyload = load i32, ptr %40, align 8, !tbaa !21
  %41 = tail call i64 @_ZN2vl8database13BufferManager12AllocatePageENS0_8IdObjectIiLl0EEE(ptr noundef nonnull align 8 dereferenceable(168) %39, i32 %.sroa.016.0.copyload)
  store i64 %41, ptr %4, align 8
  %42 = call noundef zeroext i1 @_ZNK2vl8database8IdObjectImLl1EE7IsValidEv(ptr noundef nonnull align 8 dereferenceable(8) %4)
  br i1 %42, label %43, label %.critedge57

43:                                               ; preds = %34
  %44 = load ptr, ptr %38, align 8, !tbaa !20
  %.sroa.08.0.copyload = load i32, ptr %40, align 8, !tbaa !21
  %45 = call noundef ptr @_ZN2vl8database13BufferManager8LockPageENS0_8IdObjectIiLl0EEENS2_ImLl1EEE(ptr noundef nonnull align 8 dereferenceable(168) %44, i32 %.sroa.08.0.copyload, i64 %.sroa.017.0.copyload)
  %.not53.not = icmp eq ptr %45, null
  br i1 %.not53.not, label %.critedge59, label %46

46:                                               ; preds = %43
  %47 = load i64, ptr %4, align 8, !tbaa !22
  %48 = getelementptr inbounds i8, ptr %45, i64 8
  store i64 %47, ptr %48, align 8, !tbaa !19
  %49 = load ptr, ptr %38, align 8, !tbaa !20
  %.sroa.06.0.copyload = load i32, ptr %40, align 8, !tbaa !21
  %50 = call noundef zeroext i1 @_ZN2vl8database13BufferManager10UnlockPageENS0_8IdObjectIiLl0EEENS2_ImLl1EEEPvNS0_15PersistanceTypeE(ptr noundef nonnull align 8 dereferenceable(168) %49, i32 %.sroa.06.0.copyload, i64 %.sroa.017.0.copyload, ptr noundef nonnull %45, i32 noundef 2)
  %51 = load ptr, ptr %38, align 8, !tbaa !20
  %.sroa.04.0.copyload = load i32, ptr %40, align 8, !tbaa !21
  %.sroa.03.0.copyload = load i64, ptr %4, align 8, !tbaa !19
  %52 = call noundef ptr @_ZN2vl8database13BufferManager8LockPageENS0_8IdObjectIiLl0EEENS2_ImLl1EEE(ptr noundef nonnull align 8 dereferenceable(168) %51, i32 %.sroa.04.0.copyload, i64 %.sroa.03.0.copyload)
  %53 = getelementptr inbounds i8, ptr %0, i64 24
  %54 = load i64, ptr %53, align 8, !tbaa !24
  call void @llvm.memset.p0.i64(ptr align 8 %52, i8 0, i64 %54, i1 false)
  store i64 1, ptr %52, align 8, !tbaa !19
  %55 = getelementptr inbounds i8, ptr %52, i64 8
  store i64 -1, ptr %55, align 8, !tbaa !19
  %56 = getelementptr i64, ptr %52, i64 %8
  %57 = getelementptr i8, ptr %56, i64 16
  store i64 %2, ptr %57, align 8, !tbaa !19
  %58 = load ptr, ptr %38, align 8, !tbaa !20
  %.sroa.02.0.copyload = load i32, ptr %40, align 8, !tbaa !21
  %.sroa.0.0.copyload = load i64, ptr %4, align 8, !tbaa !19
  %59 = call noundef zeroext i1 @_ZN2vl8database13BufferManager10UnlockPageENS0_8IdObjectIiLl0EEENS2_ImLl1EEEPvNS0_15PersistanceTypeE(ptr noundef nonnull align 8 dereferenceable(168) %58, i32 %.sroa.02.0.copyload, i64 %.sroa.0.0.copyload, ptr noundef nonnull %52, i32 noundef 2)
  %60 = call noundef i64 @_ZN2vl11collections4ListINS_8database8IdObjectImLl1EEES4_E3AddERKS4_(ptr noundef nonnull align 8 dereferenceable(33) %9, ptr noundef nonnull align 8 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  br label %.critedge

.critedge57:                                      ; preds = %34
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  br label %.critedge

.critedge59:                                      ; preds = %43
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  br label %.critedge

.critedge:                                        ; preds = %46, %29, %19, %.critedge59, %.critedge57
  %.3 = phi i1 [ false, %.critedge57 ], [ false, %.critedge59 ], [ false, %19 ], [ true, %29 ], [ true, %46 ]
  ret i1 %.3
}

declare i64 @_ZN2vl8database13BufferManager12AllocatePageENS0_8IdObjectIiLl0EEE(ptr noundef nonnull align 8 dereferenceable(168), i32) local_unnamed_addr #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 = { "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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 }
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, !13, i64 32}
!6 = !{!"_ZTSN2vl8database12log_internal14LogAddressItemE", !7, i64 0, !8, i64 8, !11, i64 16, !13, i64 24, !13, i64 32, !14, i64 40}
!7 = !{!"_ZTSN2vl6ObjectE"}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"_ZTSN2vl8database8IdObjectIiLl0EEE", !12, i64 0}
!12 = !{!"int", !9, i64 0}
!13 = !{!"long", !9, i64 0}
!14 = !{!"_ZTSN2vl11collections4ListINS_8database8IdObjectImLl1EEES4_EE", !15, i64 0}
!15 = !{!"_ZTSN2vl11collections8ListBaseINS_8database8IdObjectImLl1EEES4_EE", !16, i64 0, !13, i64 24, !18, i64 32}
!16 = !{!"_ZTSN2vl11collections9ArrayBaseINS_8database8IdObjectImLl1EEEEE", !17, i64 0, !8, i64 8, !13, i64 16}
!17 = !{!"_ZTSN2vl11collections9ListStoreINS_8database8IdObjectImLl1EEELb1EEE", !7, i64 0}
!18 = !{!"bool", !9, i64 0}
!19 = !{!13, !13, i64 0}
!20 = !{!6, !8, i64 8}
!21 = !{!12, !12, i64 0}
!22 = !{!23, !13, i64 0}
!23 = !{!"_ZTSN2vl8database8IdObjectImLl1EEE", !13, i64 0}
!24 = !{!6, !13, i64 24}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,SROAPass,SimplifyCFGPass,TailCallElimPass