; LLVM IR from erthink/libmdbx :: src (api-dbi)

; 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.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.2 }
%struct.geo = type { i16, i16, i32, i32, %union.anon.0, %union.anon.1 }
%union.anon.0 = type { i32 }
%union.anon.1 = type { i32 }
%struct.MDBX_canary = type { i64, i64, i64, i64 }
%union.anon.2 = type { %struct.anon.4 }
%struct.anon.4 = type { %struct.troika, ptr, %struct.anon.5, i8, i32, i32, i64, ptr, ptr, ptr, i64, %union.anon.6 }
%struct.troika = type { i8, i8, i8, i8, i32, [3 x i64] }
%struct.anon.5 = type { %struct.MDBX_rkl, i64, %struct.MDBX_rkl }
%struct.MDBX_rkl = type { i64, i64, i32, i32, ptr, [12 x i64] }
%union.anon.6 = type { %struct.anon.7 }
%struct.anon.7 = 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.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 }
%union.mdbx_atomic_uint64_t = type { i64 }
%struct.MDBX_stat = type { i32, i32, i64, i64, i64, i64, i64 }
%struct.tree = type { i16, i16, i32, i32, i32, i32, i32, i64, i64, i64 }

@__func__.mdbx_dbi_stat = external hidden unnamed_addr constant [14 x i8], align 1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @log_if_error(i32 noundef, ptr noundef, i32 noundef) #0

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

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @dbi_check(ptr noundef, i64 noundef) #0

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @check_txn(ptr noundef, i32 noundef) #3

; Function Attrs: cold nounwind optsize uwtable
define dso_local i32 @mdbx_dbi_stat(ptr noundef %0, i32 noundef %1, ptr noundef %2, i64 noundef %3) #4 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store ptr %2, ptr %8, align 8, !tbaa !5
  store i64 %3, ptr %9, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = call i32 @check_txn(ptr noundef %13, i32 noundef 51)
  store i32 %14, ptr %10, align 4, !tbaa !9
  %15 = load i32, ptr %10, align 4, !tbaa !9
  %16 = icmp ne i32 %15, 0
  %17 = xor i1 %16, true
  %18 = xor i1 %17, true
  %19 = zext i1 %18 to i32
  %20 = sext i32 %19 to i64
  %21 = call i64 @llvm.expect.i64(i64 %20, i64 0)
  %22 = icmp ne i64 %21, 0
  br i1 %22, label %23, label %26

23:                                               ; preds = %4
  %24 = load i32, ptr %10, align 4, !tbaa !9
  %25 = call i32 @log_if_error(i32 noundef %24, ptr noundef @__func__.mdbx_dbi_stat, i32 noundef 234)
  store i32 %25, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %133

26:                                               ; preds = %4
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = load i32, ptr %7, align 4, !tbaa !9
  %29 = zext i32 %28 to i64
  %30 = call i32 @dbi_check(ptr noundef %27, i64 noundef %29)
  store i32 %30, ptr %10, align 4, !tbaa !9
  %31 = load i32, ptr %10, align 4, !tbaa !9
  %32 = icmp ne i32 %31, 0
  %33 = xor i1 %32, true
  %34 = xor i1 %33, true
  %35 = zext i1 %34 to i32
  %36 = sext i32 %35 to i64
  %37 = call i64 @llvm.expect.i64(i64 %36, i64 0)
  %38 = icmp ne i64 %37, 0
  br i1 %38, label %39, label %42

39:                                               ; preds = %26
  %40 = load i32, ptr %10, align 4, !tbaa !9
  %41 = call i32 @log_if_error(i32 noundef %40, ptr noundef @__func__.mdbx_dbi_stat, i32 noundef 238)
  store i32 %41, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %133

42:                                               ; preds = %26
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.MDBX_txn, ptr %43, i32 0, i32 1
  %45 = load i32, ptr %44, align 4, !tbaa !13
  %46 = and i32 %45, 51
  %47 = icmp ne i32 %46, 0
  %48 = xor i1 %47, true
  %49 = xor i1 %48, true
  %50 = zext i1 %49 to i32
  %51 = sext i32 %50 to i64
  %52 = call i64 @llvm.expect.i64(i64 %51, i64 0)
  %53 = icmp ne i64 %52, 0
  br i1 %53, label %54, label %56

54:                                               ; preds = %42
  %55 = call i32 @log_if_error(i32 noundef -30782, ptr noundef @__func__.mdbx_dbi_stat, i32 noundef 241)
  store i32 %55, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %133

56:                                               ; preds = %42
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.MDBX_txn, ptr %57, i32 0, i32 12
  %59 = load ptr, ptr %58, align 8, !tbaa !18
  %60 = load i32, ptr %7, align 4, !tbaa !9
  %61 = zext i32 %60 to i64
  %62 = getelementptr inbounds i8, ptr %59, i64 %61
  %63 = load i8, ptr %62, align 1, !tbaa !19
  %64 = zext i8 %63 to i32
  %65 = and i32 %64, 2
  %66 = icmp ne i32 %65, 0
  %67 = xor i1 %66, true
  %68 = xor i1 %67, true
  %69 = zext i1 %68 to i32
  %70 = sext i32 %69 to i64
  %71 = call i64 @llvm.expect.i64(i64 %70, i64 0)
  %72 = icmp ne i64 %71, 0
  br i1 %72, label %73, label %90

73:                                               ; preds = %56
  %74 = load ptr, ptr %6, align 8, !tbaa !5
  %75 = load i32, ptr %7, align 4, !tbaa !9
  %76 = zext i32 %75 to i64
  %77 = call i32 @tbl_fetch(ptr noundef %74, i64 noundef %76)
  store i32 %77, ptr %10, align 4, !tbaa !9
  %78 = load i32, ptr %10, align 4, !tbaa !9
  %79 = icmp ne i32 %78, 0
  %80 = xor i1 %79, true
  %81 = xor i1 %80, true
  %82 = zext i1 %81 to i32
  %83 = sext i32 %82 to i64
  %84 = call i64 @llvm.expect.i64(i64 %83, i64 0)
  %85 = icmp ne i64 %84, 0
  br i1 %85, label %86, label %89

86:                                               ; preds = %73
  %87 = load i32, ptr %10, align 4, !tbaa !9
  %88 = call i32 @log_if_error(i32 noundef %87, ptr noundef @__func__.mdbx_dbi_stat, i32 noundef 246)
  store i32 %88, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %133

89:                                               ; preds = %73
  br label %90

90:                                               ; preds = %89, %56
  %91 = load ptr, ptr %8, align 8, !tbaa !5
  %92 = icmp ne ptr %91, null
  %93 = xor i1 %92, true
  %94 = xor i1 %93, true
  %95 = xor i1 %94, true
  %96 = zext i1 %95 to i32
  %97 = sext i32 %96 to i64
  %98 = call i64 @llvm.expect.i64(i64 %97, i64 0)
  %99 = icmp ne i64 %98, 0
  br i1 %99, label %100, label %102

100:                                              ; preds = %90
  %101 = call i32 @log_if_error(i32 noundef 22, ptr noundef @__func__.mdbx_dbi_stat, i32 noundef 250)
  store i32 %101, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %133

102:                                              ; preds = %90
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  store i64 40, ptr %12, align 8, !tbaa !11
  %103 = load i64, ptr %9, align 8, !tbaa !11
  %104 = icmp ne i64 %103, 48
  %105 = xor i1 %104, true
  %106 = xor i1 %105, true
  %107 = zext i1 %106 to i32
  %108 = sext i32 %107 to i64
  %109 = call i64 @llvm.expect.i64(i64 %108, i64 0)
  %110 = icmp ne i64 %109, 0
  br i1 %110, label %111, label %116

111:                                              ; preds = %102
  %112 = load i64, ptr %9, align 8, !tbaa !11
  %113 = icmp ne i64 %112, 40
  br i1 %113, label %114, label %116

114:                                              ; preds = %111
  %115 = call i32 @log_if_error(i32 noundef 22, ptr noundef @__func__.mdbx_dbi_stat, i32 noundef 254)
  store i32 %115, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %132

116:                                              ; preds = %111, %102
  %117 = load ptr, ptr %6, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.MDBX_txn, ptr %117, i32 0, i32 9
  %119 = load ptr, ptr %118, align 8, !tbaa !20
  %120 = getelementptr inbounds %struct.MDBX_env, ptr %119, i32 0, i32 2
  %121 = load i32, ptr %120, align 8, !tbaa !21
  %122 = load ptr, ptr %8, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.MDBX_stat, ptr %122, i32 0, i32 0
  store i32 %121, ptr %123, align 8, !tbaa !31
  %124 = load ptr, ptr %6, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.MDBX_txn, ptr %124, i32 0, i32 10
  %126 = load ptr, ptr %125, align 8, !tbaa !33
  %127 = load i32, ptr %7, align 4, !tbaa !9
  %128 = zext i32 %127 to i64
  %129 = getelementptr inbounds %struct.tree, ptr %126, i64 %128
  %130 = load ptr, ptr %8, align 8, !tbaa !5
  %131 = load i64, ptr %9, align 8, !tbaa !11
  call void @stat_get(ptr noundef %129, ptr noundef %130, i64 noundef %131)
  store i32 0, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %132

132:                                              ; preds = %116, %114
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  br label %133

133:                                              ; preds = %132, %100, %86, %54, %39, %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  %134 = load i32, ptr %5, align 4
  ret i32 %134
}

declare i32 @tbl_fetch(ptr noundef, i64 noundef) #5

; Function Attrs: nounwind uwtable
declare hidden void @stat_get(ptr noundef, ptr noundef, i64 noundef) #6

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #3 = { alwaysinline nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { cold nounwind optsize 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 = { "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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !10, i64 4}
!14 = !{!"MDBX_txn", !10, i64 0, !10, i64 4, !12, i64 8, !12, i64 16, !6, i64 24, !6, i64 32, !15, i64 40, !12, i64 64, !12, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !17, i64 128, !6, i64 160, !7, i64 168}
!15 = !{!"geo", !16, i64 0, !16, i64 2, !10, i64 4, !10, i64 8, !7, i64 12, !7, i64 16}
!16 = !{!"short", !7, i64 0}
!17 = !{!"MDBX_canary", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!18 = !{!14, !6, i64 104}
!19 = !{!7, !7, i64 0}
!20 = !{!14, !6, i64 80}
!21 = !{!22, !10, i64 8}
!22 = !{!"MDBX_env", !7, i64 0, !10, i64 4, !10, i64 8, !23, i64 16, !10, i64 56, !10, i64 60, !23, i64 64, !6, i64 104, !16, i64 112, !16, i64 114, !16, i64 116, !16, i64 118, !16, i64 120, !16, i64 122, !7, i64 124, !7, i64 128, !7, i64 129, !16, i64 130, !10, i64 132, !10, i64 136, !10, i64 140, !10, i64 144, !24, i64 152, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !10, i64 224, !10, i64 228, !10, i64 232, !6, i64 240, !6, i64 248, !12, i64 256, !25, i64 264, !28, i64 320, !26, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !29, i64 392, !7, i64 400, !10, i64 440, !10, i64 444, !6, i64 448, !30, i64 456, !7, i64 496, !7, i64 536}
!23 = !{!"osal_mmap", !7, i64 0, !10, i64 8, !12, i64 16, !12, i64 24, !12, i64 32}
!24 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!25 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !12, i64 16, !7, i64 24, !7, i64 25, !7, i64 26, !7, i64 27, !10, i64 28, !10, i64 32, !26, i64 36, !26, i64 37, !26, i64 38, !27, i64 40, !7, i64 48}
!26 = !{!"_Bool", !7, i64 0}
!27 = !{!"", !16, i64 0, !16, i64 2, !16, i64 4, !16, i64 6}
!28 = !{!"", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32}
!29 = !{!"", !12, i64 0}
!30 = !{!"osal_ioring", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!31 = !{!32, !10, i64 0}
!32 = !{!"MDBX_stat", !10, i64 0, !10, i64 4, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40}
!33 = !{!14, !6, i64 88}


; 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.tree = type { i16, i16, i32, i32, i32, i32, i32, i64, i64, i64 }

@__func__.mdbx_dbi_stat = external hidden unnamed_addr constant [14 x i8], align 1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @log_if_error(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @dbi_check(ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @check_txn(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: cold nounwind optsize uwtable
define dso_local i32 @mdbx_dbi_stat(ptr noundef %0, i32 noundef %1, ptr noundef %2, i64 noundef %3) local_unnamed_addr #2 {
  %5 = tail call i32 @check_txn(ptr noundef %0, i32 noundef 51)
  %.not = icmp eq i32 %5, 0
  br i1 %.not, label %8, label %6, !prof !5

6:                                                ; preds = %4
  %7 = tail call i32 @log_if_error(i32 noundef %5, ptr noundef nonnull @__func__.mdbx_dbi_stat, i32 noundef 234)
  br label %43

8:                                                ; preds = %4
  %9 = zext i32 %1 to i64
  %10 = tail call i32 @dbi_check(ptr noundef %0, i64 noundef %9)
  %.not27 = icmp eq i32 %10, 0
  br i1 %.not27, label %13, label %11, !prof !5

11:                                               ; preds = %8
  %12 = tail call i32 @log_if_error(i32 noundef %10, ptr noundef nonnull @__func__.mdbx_dbi_stat, i32 noundef 238)
  br label %43

13:                                               ; preds = %8
  %14 = getelementptr inbounds i8, ptr %0, i64 4
  %15 = load i32, ptr %14, align 4, !tbaa !6
  %16 = and i32 %15, 51
  %.not28 = icmp eq i32 %16, 0
  br i1 %.not28, label %19, label %17, !prof !5

17:                                               ; preds = %13
  %18 = tail call i32 @log_if_error(i32 noundef -30782, ptr noundef nonnull @__func__.mdbx_dbi_stat, i32 noundef 241)
  br label %43

19:                                               ; preds = %13
  %20 = getelementptr inbounds i8, ptr %0, i64 104
  %21 = load ptr, ptr %20, align 8, !tbaa !16
  %22 = getelementptr inbounds i8, ptr %21, i64 %9
  %23 = load i8, ptr %22, align 1, !tbaa !17
  %24 = and i8 %23, 2
  %.not29 = icmp eq i8 %24, 0
  br i1 %.not29, label %29, label %25, !prof !5

25:                                               ; preds = %19
  %26 = tail call i32 @tbl_fetch(ptr noundef nonnull %0, i64 noundef %9) #5
  %.not30 = icmp eq i32 %26, 0
  br i1 %.not30, label %29, label %27, !prof !5

27:                                               ; preds = %25
  %28 = tail call i32 @log_if_error(i32 noundef %26, ptr noundef nonnull @__func__.mdbx_dbi_stat, i32 noundef 246)
  br label %43

29:                                               ; preds = %25, %19
  %.not31 = icmp eq ptr %2, null
  br i1 %.not31, label %30, label %32, !prof !18

30:                                               ; preds = %29
  %31 = tail call i32 @log_if_error(i32 noundef 22, ptr noundef nonnull @__func__.mdbx_dbi_stat, i32 noundef 250)
  br label %43

32:                                               ; preds = %29
  switch i64 %3, label %33 [
    i64 48, label %35
    i64 40, label %35
  ], !prof !19

33:                                               ; preds = %32
  %34 = tail call i32 @log_if_error(i32 noundef 22, ptr noundef nonnull @__func__.mdbx_dbi_stat, i32 noundef 254)
  br label %43

35:                                               ; preds = %32, %32
  %36 = getelementptr inbounds i8, ptr %0, i64 80
  %37 = load ptr, ptr %36, align 8, !tbaa !20
  %38 = getelementptr inbounds i8, ptr %37, i64 8
  %39 = load i32, ptr %38, align 8, !tbaa !21
  store i32 %39, ptr %2, align 8, !tbaa !31
  %40 = getelementptr inbounds i8, ptr %0, i64 88
  %41 = load ptr, ptr %40, align 8, !tbaa !33
  %42 = getelementptr inbounds %struct.tree, ptr %41, i64 %9
  tail call void @stat_get(ptr noundef %42, ptr noundef nonnull %2, i64 noundef %3)
  br label %43

43:                                               ; preds = %33, %35, %30, %27, %17, %11, %6
  %.1 = phi i32 [ %7, %6 ], [ %12, %11 ], [ %18, %17 ], [ %28, %27 ], [ %31, %30 ], [ %34, %33 ], [ 0, %35 ]
  ret i32 %.1
}

declare i32 @tbl_fetch(ptr noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden void @stat_get(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #4

attributes #0 = { 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 #1 = { alwaysinline 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 = { cold nounwind optsize 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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!6 = !{!7, !8, i64 4}
!7 = !{!"MDBX_txn", !8, i64 0, !8, i64 4, !11, i64 8, !11, i64 16, !12, i64 24, !12, i64 32, !13, 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, !15, i64 128, !12, i64 160, !9, i64 168}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"long", !9, i64 0}
!12 = !{!"any pointer", !9, i64 0}
!13 = !{!"geo", !14, i64 0, !14, i64 2, !8, i64 4, !8, i64 8, !9, i64 12, !9, i64 16}
!14 = !{!"short", !9, i64 0}
!15 = !{!"MDBX_canary", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!16 = !{!7, !12, i64 104}
!17 = !{!9, !9, i64 0}
!18 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!19 = !{!"branch_weights", i32 1, i32 4000, i32 1}
!20 = !{!7, !12, i64 80}
!21 = !{!22, !8, i64 8}
!22 = !{!"MDBX_env", !9, i64 0, !8, i64 4, !8, i64 8, !23, i64 16, !8, i64 56, !8, i64 60, !23, i64 64, !12, i64 104, !14, i64 112, !14, i64 114, !14, i64 116, !14, i64 118, !14, i64 120, !14, i64 122, !9, i64 124, !9, i64 128, !9, i64 129, !14, i64 130, !8, i64 132, !8, i64 136, !8, i64 140, !8, i64 144, !24, i64 152, !12, i64 184, !12, i64 192, !12, i64 200, !12, i64 208, !12, i64 216, !8, i64 224, !8, i64 228, !8, i64 232, !12, i64 240, !12, i64 248, !11, i64 256, !25, i64 264, !28, i64 320, !26, i64 360, !12, i64 368, !12, i64 376, !12, i64 384, !29, i64 392, !9, i64 400, !8, i64 440, !8, i64 444, !12, i64 448, !30, i64 456, !9, i64 496, !9, i64 536}
!23 = !{!"osal_mmap", !9, i64 0, !8, 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 = !{!"", !8, i64 0, !8, i64 4, !8, i64 8, !8, i64 12, !11, i64 16, !9, i64 24, !9, i64 25, !9, i64 26, !9, i64 27, !8, i64 28, !8, i64 32, !26, i64 36, !26, i64 37, !26, i64 38, !27, i64 40, !9, i64 48}
!26 = !{!"_Bool", !9, i64 0}
!27 = !{!"", !14, i64 0, !14, i64 2, !14, i64 4, !14, i64 6}
!28 = !{!"", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32}
!29 = !{!"", !11, i64 0}
!30 = !{!"osal_ioring", !8, i64 0, !8, i64 4, !8, i64 8, !12, i64 16, !12, i64 24, !12, i64 32}
!31 = !{!32, !8, i64 0}
!32 = !{!"MDBX_stat", !8, i64 0, !8, i64 4, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40}
!33 = !{!7, !12, i64 88}


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