; LLVM IR from erthink/libmdbx :: src (dpl)

; 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.libmdbx_globals = type { %union.bin128, i32, i32, i8, i8, i8, i8, i32, %union.logger_union, %union.pthread_mutex_t, i64, ptr }
%union.bin128 = type { %struct.anon.6 }
%struct.anon.6 = type { i64, i64 }
%union.logger_union = type { ptr }
%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 }
%struct.MDBX_txn = type { i32, i32, i64, i64, ptr, ptr, %struct.geo, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, %struct.MDBX_canary, ptr, %union.anon.1 }
%struct.geo = type { i16, i16, i32, i32, %union.anon, %union.anon.0 }
%union.anon = type { i32 }
%union.anon.0 = type { i32 }
%struct.MDBX_canary = type { i64, i64, i64, i64 }
%union.anon.1 = type { %struct.anon.2 }
%struct.anon.2 = type { %struct.troika, ptr, %struct.anon.3, i8, i32, i32, i64, ptr, ptr, ptr, i64, %union.anon.4 }
%struct.troika = type { i8, i8, i8, i8, i32, [3 x i64] }
%struct.anon.3 = type { %struct.MDBX_rkl, i64, %struct.MDBX_rkl }
%struct.MDBX_rkl = type { i64, i64, i32, i32, ptr, [12 x i64] }
%union.anon.4 = type { %struct.anon.5 }
%struct.anon.5 = type { i64, ptr }
%struct.MDBX_env = type { %union.mdbx_atomic_uint32_t, i32, i32, %struct.osal_mmap, i32, i32, %struct.osal_mmap, ptr, i16, i16, i16, i16, i16, i16, %union.mdbx_atomic_uint32_t, i8, i8, i16, i32, i32, i32, i32, %struct.anon.9, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, ptr, ptr, i64, %struct.anon.10, %struct.anon.14, i8, ptr, ptr, ptr, %struct.anon.15, %union.pthread_mutex_t, i32, i32, ptr, %struct.osal_ioring, %union.pthread_mutex_t, [71 x %union.mdbx_atomic_uint64_t] }
%struct.osal_mmap = type { %union.anon.8, i32, i64, i64, i64 }
%union.anon.8 = type { ptr }
%union.mdbx_atomic_uint32_t = type { i32 }
%struct.anon.9 = type { ptr, ptr, ptr, ptr }
%struct.anon.10 = type { i32, i32, i32, i32, i64, i8, i8, i8, i8, i32, i32, i8, i8, i8, %struct.anon.11, %union.anon.12 }
%struct.anon.11 = type { i16, i16, i16, i16 }
%union.anon.12 = type { i32 }
%struct.anon.14 = type { i64, i64, i64, i64, i64 }
%struct.anon.15 = type { i64 }
%struct.osal_ioring = type { i32, i32, i32, ptr, ptr, ptr }
%union.mdbx_atomic_uint64_t = type { i64 }
%struct.dpl = type { i64, i64, i64, i64, [18 x %struct.dp] }
%struct.dp = type { ptr, i32, i32 }

@globals = external global %struct.libmdbx_globals, align 8
@.str = external hidden unnamed_addr constant [36 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [39 x i8], align 1
@__func__.dpl_alloc = external hidden unnamed_addr constant [10 x i8], align 1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @dpl_reserve(ptr noundef, i64 noundef) #1

; Function Attrs: noreturn
declare void @mdbx_assert_fail(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #2

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @dpl_alloc(ptr noundef %0) #1 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  br label %6

6:                                                ; preds = %1
  %7 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !9
  %8 = zext i8 %7 to i32
  %9 = and i32 %8, 1
  %10 = icmp ne i32 %9, 0
  %11 = xor i1 %10, true
  %12 = xor i1 %11, true
  %13 = zext i1 %12 to i32
  %14 = sext i32 %13 to i64
  %15 = call i64 @llvm.expect.i64(i64 %14, i64 1)
  %16 = icmp ne i64 %15, 0
  br i1 %16, label %17, label %37

17:                                               ; preds = %6
  br label %18

18:                                               ; preds = %17
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.MDBX_txn, ptr %19, i32 0, i32 1
  %21 = load i32, ptr %20, align 4, !tbaa !14
  %22 = and i32 %21, 131072
  %23 = icmp eq i32 %22, 0
  %24 = xor i1 %23, true
  %25 = xor i1 %24, true
  %26 = xor i1 %25, true
  %27 = zext i1 %26 to i32
  %28 = sext i32 %27 to i64
  %29 = call i64 @llvm.expect.i64(i64 %28, i64 0)
  %30 = icmp ne i64 %29, 0
  br i1 %30, label %31, label %35

31:                                               ; preds = %18
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.MDBX_txn, ptr %32, i32 0, i32 9
  %34 = load ptr, ptr %33, align 8, !tbaa !19
  call void @mdbx_assert_fail(ptr noundef %34, ptr noundef @.str, ptr noundef @__func__.dpl_alloc, i32 noundef 55) #5
  unreachable

35:                                               ; preds = %18
  br label %36

36:                                               ; preds = %35
  br label %37

37:                                               ; preds = %36, %6
  br label %38

38:                                               ; preds = %37
  br label %39

39:                                               ; preds = %38
  %40 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !9
  %41 = zext i8 %40 to i32
  %42 = and i32 %41, 1
  %43 = icmp ne i32 %42, 0
  %44 = xor i1 %43, true
  %45 = xor i1 %44, true
  %46 = zext i1 %45 to i32
  %47 = sext i32 %46 to i64
  %48 = call i64 @llvm.expect.i64(i64 %47, i64 1)
  %49 = icmp ne i64 %48, 0
  br i1 %49, label %50, label %73

50:                                               ; preds = %39
  br label %51

51:                                               ; preds = %50
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.MDBX_txn, ptr %52, i32 0, i32 1
  %54 = load i32, ptr %53, align 4, !tbaa !14
  %55 = and i32 %54, 524288
  %56 = icmp eq i32 %55, 0
  br i1 %56, label %58, label %57

57:                                               ; preds = %51
  br label %58

58:                                               ; preds = %57, %51
  %59 = phi i1 [ true, %51 ], [ false, %57 ]
  %60 = xor i1 %59, true
  %61 = xor i1 %60, true
  %62 = xor i1 %61, true
  %63 = zext i1 %62 to i32
  %64 = sext i32 %63 to i64
  %65 = call i64 @llvm.expect.i64(i64 %64, i64 0)
  %66 = icmp ne i64 %65, 0
  br i1 %66, label %67, label %71

67:                                               ; preds = %58
  %68 = load ptr, ptr %3, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.MDBX_txn, ptr %68, i32 0, i32 9
  %70 = load ptr, ptr %69, align 8, !tbaa !19
  call void @mdbx_assert_fail(ptr noundef %70, ptr noundef @.str.1, ptr noundef @__func__.dpl_alloc, i32 noundef 56) #5
  unreachable

71:                                               ; preds = %58
  br label %72

72:                                               ; preds = %71
  br label %73

73:                                               ; preds = %72, %39
  br label %74

74:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  %75 = load ptr, ptr %3, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.MDBX_txn, ptr %75, i32 0, i32 9
  %77 = load ptr, ptr %76, align 8, !tbaa !19
  %78 = getelementptr inbounds %struct.MDBX_env, ptr %77, i32 0, i32 34
  %79 = getelementptr inbounds %struct.anon.10, ptr %78, i32 0, i32 3
  %80 = load i32, ptr %79, align 4, !tbaa !20
  %81 = load ptr, ptr %3, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.MDBX_txn, ptr %81, i32 0, i32 6
  %83 = getelementptr inbounds %struct.geo, ptr %82, i32 0, i32 3
  %84 = load i32, ptr %83, align 8, !tbaa !29
  %85 = icmp ult i32 %80, %84
  br i1 %85, label %86, label %93

86:                                               ; preds = %74
  %87 = load ptr, ptr %3, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.MDBX_txn, ptr %87, i32 0, i32 9
  %89 = load ptr, ptr %88, align 8, !tbaa !19
  %90 = getelementptr inbounds %struct.MDBX_env, ptr %89, i32 0, i32 34
  %91 = getelementptr inbounds %struct.anon.10, ptr %90, i32 0, i32 3
  %92 = load i32, ptr %91, align 4, !tbaa !20
  br label %98

93:                                               ; preds = %74
  %94 = load ptr, ptr %3, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.MDBX_txn, ptr %94, i32 0, i32 6
  %96 = getelementptr inbounds %struct.geo, ptr %95, i32 0, i32 3
  %97 = load i32, ptr %96, align 8, !tbaa !29
  br label %98

98:                                               ; preds = %93, %86
  %99 = phi i32 [ %92, %86 ], [ %97, %93 ]
  %100 = zext i32 %99 to i64
  store i64 %100, ptr %4, align 8, !tbaa !30
  %101 = load ptr, ptr %3, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.MDBX_txn, ptr %101, i32 0, i32 17
  %103 = getelementptr inbounds %struct.anon.2, ptr %102, i32 0, i32 7
  %104 = load ptr, ptr %103, align 8, !tbaa !31
  %105 = icmp ne ptr %104, null
  br i1 %105, label %106, label %117

106:                                              ; preds = %98
  %107 = load ptr, ptr %3, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.MDBX_txn, ptr %107, i32 0, i32 17
  %109 = getelementptr inbounds %struct.anon.2, ptr %108, i32 0, i32 7
  %110 = load ptr, ptr %109, align 8, !tbaa !31
  %111 = getelementptr inbounds %struct.dpl, ptr %110, i32 0, i32 1
  store i64 0, ptr %111, align 8, !tbaa !32
  %112 = load ptr, ptr %3, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.MDBX_txn, ptr %112, i32 0, i32 17
  %114 = getelementptr inbounds %struct.anon.2, ptr %113, i32 0, i32 7
  %115 = load ptr, ptr %114, align 8, !tbaa !31
  %116 = getelementptr inbounds %struct.dpl, ptr %115, i32 0, i32 0
  store i64 0, ptr %116, align 8, !tbaa !34
  br label %117

117:                                              ; preds = %106, %98
  %118 = load ptr, ptr %3, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.MDBX_txn, ptr %118, i32 0, i32 17
  %120 = getelementptr inbounds %struct.anon.2, ptr %119, i32 0, i32 7
  %121 = load ptr, ptr %120, align 8, !tbaa !31
  %122 = icmp ne ptr %121, null
  br i1 %122, label %123, label %143

123:                                              ; preds = %117
  %124 = load ptr, ptr %3, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.MDBX_txn, ptr %124, i32 0, i32 17
  %126 = getelementptr inbounds %struct.anon.2, ptr %125, i32 0, i32 7
  %127 = load ptr, ptr %126, align 8, !tbaa !31
  %128 = getelementptr inbounds %struct.dpl, ptr %127, i32 0, i32 3
  %129 = load i64, ptr %128, align 8, !tbaa !35
  %130 = load i64, ptr %4, align 8, !tbaa !30
  %131 = icmp ult i64 %129, %130
  br i1 %131, label %143, label %132

132:                                              ; preds = %123
  %133 = load ptr, ptr %3, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.MDBX_txn, ptr %133, i32 0, i32 17
  %135 = getelementptr inbounds %struct.anon.2, ptr %134, i32 0, i32 7
  %136 = load ptr, ptr %135, align 8, !tbaa !31
  %137 = getelementptr inbounds %struct.dpl, ptr %136, i32 0, i32 3
  %138 = load i64, ptr %137, align 8, !tbaa !35
  %139 = load i64, ptr %4, align 8, !tbaa !30
  %140 = load i64, ptr %4, align 8, !tbaa !30
  %141 = add i64 %139, %140
  %142 = icmp ugt i64 %138, %141
  br label %143

143:                                              ; preds = %132, %123, %117
  %144 = phi i1 [ true, %123 ], [ true, %117 ], [ %142, %132 ]
  %145 = xor i1 %144, true
  %146 = xor i1 %145, true
  %147 = zext i1 %146 to i32
  %148 = sext i32 %147 to i64
  %149 = call i64 @llvm.expect.i64(i64 %148, i64 0)
  %150 = icmp ne i64 %149, 0
  br i1 %150, label %151, label %164

151:                                              ; preds = %143
  %152 = load ptr, ptr %3, align 8, !tbaa !5
  %153 = load i64, ptr %4, align 8, !tbaa !30
  %154 = call ptr @dpl_reserve(ptr noundef %152, i64 noundef %153)
  %155 = icmp ne ptr %154, null
  %156 = xor i1 %155, true
  %157 = xor i1 %156, true
  %158 = xor i1 %157, true
  %159 = zext i1 %158 to i32
  %160 = sext i32 %159 to i64
  %161 = call i64 @llvm.expect.i64(i64 %160, i64 0)
  %162 = icmp ne i64 %161, 0
  br i1 %162, label %163, label %164

163:                                              ; preds = %151
  store i32 12, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %169

164:                                              ; preds = %151, %143
  %165 = load ptr, ptr %3, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.MDBX_txn, ptr %165, i32 0, i32 17
  %167 = getelementptr inbounds %struct.anon.2, ptr %166, i32 0, i32 7
  %168 = load ptr, ptr %167, align 8, !tbaa !31
  call void @dpl_clear(ptr noundef %168)
  store i32 0, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %169

169:                                              ; preds = %164, %163
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  %170 = load i32, ptr %2, align 4
  ret i32 %170
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @dpl_clear(ptr noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #1 = { 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 = { noreturn "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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { inlinehint 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 = { noreturn }
attributes #6 = { 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/C++ TBAA"}
!9 = !{!10, !7, i64 25}
!10 = !{!"libmdbx_globals", !7, i64 0, !11, i64 16, !11, i64 20, !7, i64 24, !7, i64 25, !7, i64 26, !12, i64 27, !11, i64 28, !7, i64 32, !7, i64 40, !13, i64 80, !6, i64 88}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!15, !11, i64 4}
!15 = !{!"MDBX_txn", !11, i64 0, !11, i64 4, !13, i64 8, !13, i64 16, !6, i64 24, !6, i64 32, !16, i64 40, !13, i64 64, !13, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !18, i64 128, !6, i64 160, !7, i64 168}
!16 = !{!"geo", !17, i64 0, !17, i64 2, !11, i64 4, !11, i64 8, !7, i64 12, !7, i64 16}
!17 = !{!"short", !7, i64 0}
!18 = !{!"MDBX_canary", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24}
!19 = !{!15, !6, i64 80}
!20 = !{!21, !11, i64 276}
!21 = !{!"MDBX_env", !7, i64 0, !11, i64 4, !11, i64 8, !22, i64 16, !11, i64 56, !11, i64 60, !22, i64 64, !6, i64 104, !17, i64 112, !17, i64 114, !17, i64 116, !17, i64 118, !17, i64 120, !17, i64 122, !7, i64 124, !7, i64 128, !7, i64 129, !17, i64 130, !11, i64 132, !11, i64 136, !11, i64 140, !11, i64 144, !23, i64 152, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !11, i64 224, !11, i64 228, !11, i64 232, !6, i64 240, !6, i64 248, !13, i64 256, !24, i64 264, !26, i64 320, !12, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !27, i64 392, !7, i64 400, !11, i64 440, !11, i64 444, !6, i64 448, !28, i64 456, !7, i64 496, !7, i64 536}
!22 = !{!"osal_mmap", !7, i64 0, !11, i64 8, !13, i64 16, !13, i64 24, !13, i64 32}
!23 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!24 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !13, i64 16, !7, i64 24, !7, i64 25, !7, i64 26, !7, i64 27, !11, i64 28, !11, i64 32, !12, i64 36, !12, i64 37, !12, i64 38, !25, i64 40, !7, i64 48}
!25 = !{!"", !17, i64 0, !17, i64 2, !17, i64 4, !17, i64 6}
!26 = !{!"", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32}
!27 = !{!"", !13, i64 0}
!28 = !{!"osal_ioring", !11, i64 0, !11, i64 4, !11, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!29 = !{!15, !11, i64 48}
!30 = !{!13, !13, i64 0}
!31 = !{!7, !7, i64 0}
!32 = !{!33, !13, i64 8}
!33 = !{!"dpl", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !7, i64 32}
!34 = !{!33, !13, i64 0}
!35 = !{!33, !13, 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.libmdbx_globals = type { %union.bin128, i32, i32, i8, i8, i8, i8, i32, %union.logger_union, %union.pthread_mutex_t, i64, ptr }
%union.bin128 = type { %struct.anon.6 }
%struct.anon.6 = type { i64, i64 }
%union.logger_union = type { ptr }
%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 }

@globals = external local_unnamed_addr global %struct.libmdbx_globals, align 8
@.str = external hidden unnamed_addr constant [36 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [39 x i8], align 1
@__func__.dpl_alloc = external hidden unnamed_addr constant [10 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local ptr @dpl_reserve(ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: noreturn
declare void @mdbx_assert_fail(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 13) i32 @dpl_alloc(ptr noundef %0) local_unnamed_addr #0 {
  %2 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !5
  %3 = and i8 %2, 1
  %.not = icmp eq i8 %3, 0
  br i1 %.not, label %.thread, label %4, !prof !13

4:                                                ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 4
  %6 = load i32, ptr %5, align 4, !tbaa !14
  %7 = and i32 %6, 131072
  %.not26 = icmp eq i32 %7, 0
  br i1 %.not26, label %11, label %8, !prof !19

8:                                                ; preds = %4
  %9 = getelementptr inbounds i8, ptr %0, i64 80
  %10 = load ptr, ptr %9, align 8, !tbaa !20
  tail call void @mdbx_assert_fail(ptr noundef %10, ptr noundef nonnull @.str, ptr noundef nonnull @__func__.dpl_alloc, i32 noundef 55) #4
  unreachable

11:                                               ; preds = %4
  %12 = and i32 %6, 524288
  %.not28 = icmp eq i32 %12, 0
  br i1 %.not28, label %.thread, label %13, !prof !19

13:                                               ; preds = %11
  %14 = getelementptr inbounds i8, ptr %0, i64 80
  %15 = load ptr, ptr %14, align 8, !tbaa !20
  tail call void @mdbx_assert_fail(ptr noundef %15, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.dpl_alloc, i32 noundef 56) #4
  unreachable

.thread:                                          ; preds = %1, %11
  %16 = getelementptr inbounds i8, ptr %0, i64 80
  %17 = load ptr, ptr %16, align 8, !tbaa !20
  %18 = getelementptr inbounds i8, ptr %17, i64 276
  %19 = load i32, ptr %18, align 4, !tbaa !21
  %20 = getelementptr inbounds i8, ptr %0, i64 48
  %21 = load i32, ptr %20, align 8, !tbaa !30
  %. = tail call i32 @llvm.umin.i32(i32 %19, i32 %21)
  %22 = zext i32 %. to i64
  %23 = getelementptr inbounds i8, ptr %0, i64 496
  %24 = load ptr, ptr %23, align 8, !tbaa !31
  %.not29 = icmp eq ptr %24, null
  br i1 %.not29, label %.critedge, label %25

25:                                               ; preds = %.thread
  %26 = getelementptr inbounds i8, ptr %24, i64 8
  store i64 0, ptr %26, align 8, !tbaa !32
  %27 = load ptr, ptr %23, align 8, !tbaa !31
  store i64 0, ptr %27, align 8, !tbaa !34
  %.pr = load ptr, ptr %23, align 8, !tbaa !31
  %.not30 = icmp eq ptr %.pr, null
  br i1 %.not30, label %.critedge, label %28, !prof !35

28:                                               ; preds = %25
  %29 = getelementptr inbounds i8, ptr %.pr, i64 24
  %30 = load i64, ptr %29, align 8, !tbaa !36
  %31 = icmp ult i64 %30, %22
  %32 = shl nuw nsw i64 %22, 1
  %33 = icmp ugt i64 %30, %32
  %or.cond = select i1 %31, i1 true, i1 %33
  br i1 %or.cond, label %.critedge, label %35, !prof !37

.critedge:                                        ; preds = %.thread, %28, %25
  %34 = tail call ptr @dpl_reserve(ptr noundef nonnull %0, i64 noundef %22)
  %.not31 = icmp eq ptr %34, null
  br i1 %.not31, label %37, label %.critedge._crit_edge, !prof !13

.critedge._crit_edge:                             ; preds = %.critedge
  %.pre = load ptr, ptr %23, align 8, !tbaa !31
  br label %35

35:                                               ; preds = %.critedge._crit_edge, %28
  %36 = phi ptr [ %.pre, %.critedge._crit_edge ], [ %.pr, %28 ]
  tail call void @dpl_clear(ptr noundef %36)
  br label %37

37:                                               ; preds = %.critedge, %35
  %.0 = phi i32 [ 0, %35 ], [ 12, %.critedge ]
  ret i32 %.0
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @dpl_clear(ptr noundef) local_unnamed_addr #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umin.i32(i32, i32) #3

attributes #0 = { 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 #1 = { noreturn "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 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { noreturn 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 25}
!6 = !{!"libmdbx_globals", !7, i64 0, !9, i64 16, !9, i64 20, !7, i64 24, !7, i64 25, !7, i64 26, !10, i64 27, !9, i64 28, !7, i64 32, !7, i64 40, !11, i64 80, !12, i64 88}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!"_Bool", !7, i64 0}
!11 = !{!"long", !7, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!14 = !{!15, !9, i64 4}
!15 = !{!"MDBX_txn", !9, i64 0, !9, i64 4, !11, i64 8, !11, i64 16, !12, i64 24, !12, i64 32, !16, i64 40, !11, i64 64, !11, i64 72, !12, i64 80, !12, i64 88, !12, i64 96, !12, i64 104, !12, i64 112, !12, i64 120, !18, i64 128, !12, i64 160, !7, i64 168}
!16 = !{!"geo", !17, i64 0, !17, i64 2, !9, i64 4, !9, i64 8, !7, i64 12, !7, i64 16}
!17 = !{!"short", !7, i64 0}
!18 = !{!"MDBX_canary", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!19 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!20 = !{!15, !12, i64 80}
!21 = !{!22, !9, i64 276}
!22 = !{!"MDBX_env", !7, i64 0, !9, i64 4, !9, i64 8, !23, i64 16, !9, i64 56, !9, i64 60, !23, i64 64, !12, i64 104, !17, i64 112, !17, i64 114, !17, i64 116, !17, i64 118, !17, i64 120, !17, i64 122, !7, i64 124, !7, i64 128, !7, i64 129, !17, i64 130, !9, i64 132, !9, i64 136, !9, i64 140, !9, i64 144, !24, i64 152, !12, i64 184, !12, i64 192, !12, i64 200, !12, i64 208, !12, i64 216, !9, i64 224, !9, i64 228, !9, i64 232, !12, i64 240, !12, i64 248, !11, i64 256, !25, i64 264, !27, i64 320, !10, i64 360, !12, i64 368, !12, i64 376, !12, i64 384, !28, i64 392, !7, i64 400, !9, i64 440, !9, i64 444, !12, i64 448, !29, i64 456, !7, i64 496, !7, i64 536}
!23 = !{!"osal_mmap", !7, i64 0, !9, i64 8, !11, i64 16, !11, i64 24, !11, i64 32}
!24 = !{!"", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!25 = !{!"", !9, i64 0, !9, i64 4, !9, i64 8, !9, i64 12, !11, i64 16, !7, i64 24, !7, i64 25, !7, i64 26, !7, i64 27, !9, i64 28, !9, i64 32, !10, i64 36, !10, i64 37, !10, i64 38, !26, i64 40, !7, i64 48}
!26 = !{!"", !17, i64 0, !17, i64 2, !17, i64 4, !17, i64 6}
!27 = !{!"", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32}
!28 = !{!"", !11, i64 0}
!29 = !{!"osal_ioring", !9, i64 0, !9, i64 4, !9, i64 8, !12, i64 16, !12, i64 24, !12, i64 32}
!30 = !{!15, !9, i64 48}
!31 = !{!7, !7, i64 0}
!32 = !{!33, !11, i64 8}
!33 = !{!"dpl", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !7, i64 32}
!34 = !{!33, !11, i64 0}
!35 = !{!"branch_weights", !"expected", i32 0, i32 -2147483648}
!36 = !{!33, !11, i64 24}
!37 = !{!"branch_weights", i32 4001, i32 4000000}


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