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

; 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 }
%struct.anon = 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_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.1, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, ptr, ptr, i64, %struct.anon.2, %struct.anon.6, i8, ptr, ptr, ptr, %struct.anon.7, %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, i32, i64, i64, i64 }
%union.anon = type { ptr }
%union.mdbx_atomic_uint32_t = type { i32 }
%struct.anon.1 = type { ptr, ptr, ptr, ptr }
%struct.anon.2 = type { i32, i32, i32, i32, i64, i8, i8, i8, i8, i32, i32, i8, i8, i8, %struct.anon.3, %union.anon.4 }
%struct.anon.3 = type { i16, i16, i16, i16 }
%union.anon.4 = type { i32 }
%struct.anon.6 = type { i64, i64, i64, i64, i64 }
%struct.anon.7 = type { i64 }
%struct.osal_ioring = type { i32, i32, i32, ptr, ptr, ptr }
%union.mdbx_atomic_uint64_t = type { i64 }
%struct.meta = type { [2 x i32], %union.anon.11, i16, i8, i8, %struct.geo, %union.anon.14, %struct.MDBX_canary, %union.anon.17, [2 x %union.mdbx_atomic_uint32_t], [2 x i32], %union.bin128, %union.bin128 }
%union.anon.11 = type { i64 }
%struct.geo = type { i16, i16, i32, i32, %union.anon.12, %union.anon.13 }
%union.anon.12 = type { i32 }
%union.anon.13 = type { i32 }
%union.anon.14 = type { %struct.anon.15 }
%struct.anon.15 = type { %struct.tree, %struct.tree }
%struct.tree = type { i16, i16, i32, i32, i32, i32, i32, i64, i64, i64 }
%struct.MDBX_canary = type { i64, i64, i64, i64 }
%union.anon.17 = type { i64 }
%struct.MDBX_envinfo = type { %struct.anon.27, i64, i64, i64, i64, i64, [3 x i64], [3 x i64], i32, i32, i32, i32, %struct.anon.28, i64, i64, i32, i32, i32, i32, %struct.anon.30, %struct.anon.31 }
%struct.anon.27 = type { i64, i64, i64, i64, i64 }
%struct.anon.28 = type { %struct.anon.29, [3 x %struct.anon.29] }
%struct.anon.29 = type { i64, i64 }
%struct.anon.30 = type { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 }
%struct.anon.31 = type { i64, i64 }
%struct.anon.16 = type { i16, i16, i32 }

@globals = external global %struct.libmdbx_globals, align 8
@.str = external hidden unnamed_addr constant [31 x i8], align 1
@__func__.mdbx_preopen_snapinfo = external hidden unnamed_addr constant [22 x i8], align 1

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

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

; Function Attrs: inlinehint nounwind willreturn memory(none) uwtable
declare hidden zeroext i1 @is_powerof2(i64 noundef) #2

declare void @debug_log(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) #3

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

declare void @env_options_init(ptr noundef) #3

declare i32 @env_setup_pagesize(ptr noundef, i64 noundef) #3

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

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare hidden i64 @constmeta_txnid(ptr noundef) #5

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

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

; Function Attrs: cold nounwind optsize uwtable
declare hidden i32 @env_handle_pathname(ptr noundef, ptr noundef, i32 noundef) #8

declare i32 @osal_openfile(i32 noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) #3

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare hidden i64 @unaligned_peek_u64(i64 noundef, ptr noalias noundef) #5

declare i32 @env_close(ptr noundef, i1 noundef zeroext) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @osal_getpid() #1

; Function Attrs: cold nounwind optsize uwtable
define dso_local i32 @mdbx_preopen_snapinfo(ptr noundef %0, ptr noundef %1, i64 noundef %2) #8 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca %struct.MDBX_env, align 8
  %13 = alloca i32, align 4
  %14 = alloca %struct.meta, align 4
  %15 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i64 %2, ptr %7, align 8, !tbaa !9
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = icmp ne ptr %16, null
  %18 = xor i1 %17, true
  %19 = xor i1 %18, true
  %20 = xor i1 %19, true
  %21 = zext i1 %20 to i32
  %22 = sext i32 %21 to i64
  %23 = call i64 @llvm.expect.i64(i64 %22, i64 0)
  %24 = icmp ne i64 %23, 0
  br i1 %24, label %25, label %27

25:                                               ; preds = %3
  %26 = call i32 @log_if_error(i32 noundef 22, ptr noundef @__func__.mdbx_preopen_snapinfo, i32 noundef 857)
  store i32 %26, ptr %4, align 4
  br label %252

27:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #10
  store i64 144, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #10
  store i64 240, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #10
  store i64 336, ptr %10, align 8, !tbaa !9
  %28 = load i64, ptr %7, align 8, !tbaa !9
  %29 = icmp ne i64 %28, 352
  %30 = xor i1 %29, true
  %31 = xor i1 %30, true
  %32 = zext i1 %31 to i32
  %33 = sext i32 %32 to i64
  %34 = call i64 @llvm.expect.i64(i64 %33, i64 0)
  %35 = icmp ne i64 %34, 0
  br i1 %35, label %36, label %47

36:                                               ; preds = %27
  %37 = load i64, ptr %7, align 8, !tbaa !9
  %38 = icmp ne i64 %37, 144
  br i1 %38, label %39, label %47

39:                                               ; preds = %36
  %40 = load i64, ptr %7, align 8, !tbaa !9
  %41 = icmp ne i64 %40, 240
  br i1 %41, label %42, label %47

42:                                               ; preds = %39
  %43 = load i64, ptr %7, align 8, !tbaa !9
  %44 = icmp ne i64 %43, 336
  br i1 %44, label %45, label %47

45:                                               ; preds = %42
  %46 = call i32 @log_if_error(i32 noundef 22, ptr noundef @__func__.mdbx_preopen_snapinfo, i32 noundef 864)
  store i32 %46, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %251

47:                                               ; preds = %42, %39, %36, %27
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = load i64, ptr %7, align 8, !tbaa !9
  call void @llvm.memset.p0.i64(ptr align 8 %48, i8 0, i64 %49, i1 false)
  %50 = load i64, ptr %7, align 8, !tbaa !9
  %51 = icmp ugt i64 %50, 144
  %52 = xor i1 %51, true
  %53 = xor i1 %52, true
  %54 = zext i1 %53 to i32
  %55 = sext i32 %54 to i64
  %56 = call i64 @llvm.expect.i64(i64 %55, i64 1)
  %57 = icmp ne i64 %56, 0
  br i1 %57, label %58, label %69

58:                                               ; preds = %47
  %59 = load i64, ptr @globals, align 8, !tbaa !11
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.MDBX_envinfo, ptr %60, i32 0, i32 12
  %62 = getelementptr inbounds %struct.anon.28, ptr %61, i32 0, i32 0
  %63 = getelementptr inbounds %struct.anon.29, ptr %62, i32 0, i32 0
  store i64 %59, ptr %63, align 8, !tbaa !12
  %64 = load i64, ptr getelementptr inbounds (%struct.anon, ptr @globals, i32 0, i32 1), align 8, !tbaa !11
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.MDBX_envinfo, ptr %65, i32 0, i32 12
  %67 = getelementptr inbounds %struct.anon.28, ptr %66, i32 0, i32 0
  %68 = getelementptr inbounds %struct.anon.29, ptr %67, i32 0, i32 1
  store i64 %64, ptr %68, align 8, !tbaa !19
  br label %69

69:                                               ; preds = %58, %47
  call void @llvm.lifetime.start.p0(i64 1104, ptr %12) #10
  call void @llvm.memset.p0.i64(ptr align 8 %12, i8 0, i64 1104, i1 false)
  %70 = call i32 @osal_getpid()
  %71 = getelementptr inbounds %struct.MDBX_env, ptr %12, i32 0, i32 20
  store i32 %70, ptr %71, align 4, !tbaa !20
  %72 = load i32, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 1), align 8, !tbaa !30
  %73 = zext i32 %72 to i64
  %74 = call zeroext i1 @is_powerof2(i64 noundef %73) #11
  br i1 %74, label %75, label %78

75:                                               ; preds = %69
  %76 = load i32, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 1), align 8, !tbaa !30
  %77 = icmp ult i32 %76, 256
  br label %78

78:                                               ; preds = %75, %69
  %79 = phi i1 [ true, %69 ], [ %77, %75 ]
  %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 %103

86:                                               ; preds = %78
  br label %87

87:                                               ; preds = %86
  %88 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 5), align 2, !tbaa !32
  %89 = zext i8 %88 to i32
  %90 = icmp sle i32 1, %89
  %91 = xor i1 %90, true
  %92 = xor i1 %91, true
  %93 = zext i1 %92 to i32
  %94 = sext i32 %93 to i64
  %95 = call i64 @llvm.expect.i64(i64 %94, i64 0)
  %96 = icmp ne i64 %95, 0
  br i1 %96, label %97, label %99

97:                                               ; preds = %87
  %98 = load i32, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 1), align 8, !tbaa !30
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 1, ptr noundef @__func__.mdbx_preopen_snapinfo, i32 noundef 876, ptr noundef @.str, i32 noundef %98)
  br label %99

99:                                               ; preds = %97, %87
  br label %100

100:                                              ; preds = %99
  br label %101

101:                                              ; preds = %100
  %102 = call i32 @log_if_error(i32 noundef -30784, ptr noundef @__func__.mdbx_preopen_snapinfo, i32 noundef 877)
  store i32 %102, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %250

103:                                              ; preds = %78
  %104 = load i32, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 1), align 8, !tbaa !30
  %105 = load ptr, ptr %6, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.MDBX_envinfo, ptr %105, i32 0, i32 11
  store i32 %104, ptr %106, align 4, !tbaa !33
  %107 = getelementptr inbounds %struct.MDBX_env, ptr %12, i32 0, i32 1
  store i32 1082269696, ptr %107, align 4, !tbaa !34
  %108 = getelementptr inbounds %struct.MDBX_env, ptr %12, i32 0, i32 16
  store i8 -1, ptr %108, align 1, !tbaa !35
  %109 = getelementptr inbounds %struct.MDBX_env, ptr %12, i32 0, i32 6
  %110 = getelementptr inbounds %struct.osal_mmap, ptr %109, i32 0, i32 1
  store i32 -1, ptr %110, align 8, !tbaa !36
  %111 = getelementptr inbounds %struct.MDBX_env, ptr %12, i32 0, i32 3
  %112 = getelementptr inbounds %struct.osal_mmap, ptr %111, i32 0, i32 1
  store i32 -1, ptr %112, align 8, !tbaa !37
  %113 = getelementptr inbounds %struct.MDBX_env, ptr %12, i32 0, i32 4
  store i32 -1, ptr %113, align 8, !tbaa !38
  %114 = getelementptr inbounds %struct.MDBX_env, ptr %12, i32 0, i32 5
  store i32 -1, ptr %114, align 4, !tbaa !39
  call void @env_options_init(ptr noundef %12)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #10
  %115 = load ptr, ptr %5, align 8, !tbaa !5
  %116 = call i32 @env_handle_pathname(ptr noundef %12, ptr noundef %115, i32 noundef 0) #12
  store i32 %116, ptr %13, align 4, !tbaa !40
  %117 = load i32, ptr %13, align 4, !tbaa !40
  %118 = icmp ne i32 %117, 0
  %119 = xor i1 %118, true
  %120 = xor i1 %119, true
  %121 = zext i1 %120 to i32
  %122 = sext i32 %121 to i64
  %123 = call i64 @llvm.expect.i64(i64 %122, i64 0)
  %124 = icmp ne i64 %123, 0
  br i1 %124, label %125, label %126

125:                                              ; preds = %103
  br label %246

126:                                              ; preds = %103
  %127 = getelementptr inbounds %struct.MDBX_env, ptr %12, i32 0, i32 22
  %128 = getelementptr inbounds %struct.anon.1, ptr %127, i32 0, i32 1
  %129 = load ptr, ptr %128, align 8, !tbaa !41
  %130 = getelementptr inbounds %struct.MDBX_env, ptr %12, i32 0, i32 3
  %131 = getelementptr inbounds %struct.osal_mmap, ptr %130, i32 0, i32 1
  %132 = call i32 @osal_openfile(i32 noundef 0, ptr noundef %12, ptr noundef %129, ptr noundef %131, i32 noundef 0)
  store i32 %132, ptr %13, align 4, !tbaa !40
  %133 = load i32, ptr %13, align 4, !tbaa !40
  %134 = icmp ne i32 %133, 0
  %135 = xor i1 %134, true
  %136 = xor i1 %135, true
  %137 = zext i1 %136 to i32
  %138 = sext i32 %137 to i64
  %139 = call i64 @llvm.expect.i64(i64 %138, i64 0)
  %140 = icmp ne i64 %139, 0
  br i1 %140, label %141, label %142

141:                                              ; preds = %126
  br label %246

142:                                              ; preds = %126
  %143 = call i32 @dxb_read_header(ptr noundef %12, ptr noundef %14, i32 noundef 0, i32 noundef 0)
  store i32 %143, ptr %13, align 4, !tbaa !40
  %144 = load i32, ptr %13, align 4, !tbaa !40
  %145 = icmp ne i32 %144, 0
  %146 = xor i1 %145, true
  %147 = xor i1 %146, true
  %148 = zext i1 %147 to i32
  %149 = sext i32 %148 to i64
  %150 = call i64 @llvm.expect.i64(i64 %149, i64 0)
  %151 = icmp ne i64 %150, 0
  br i1 %151, label %152, label %153

152:                                              ; preds = %142
  br label %246

153:                                              ; preds = %142
  %154 = getelementptr inbounds %struct.meta, ptr %14, i32 0, i32 6
  %155 = getelementptr inbounds %struct.anon.16, ptr %154, i32 0, i32 2
  %156 = load i32, ptr %155, align 4, !tbaa !11
  %157 = zext i32 %156 to i64
  %158 = call i32 @env_setup_pagesize(ptr noundef %12, i64 noundef %157)
  %159 = load ptr, ptr %6, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.MDBX_envinfo, ptr %159, i32 0, i32 10
  store i32 %158, ptr %160, align 8, !tbaa !42
  %161 = getelementptr inbounds %struct.meta, ptr %14, i32 0, i32 5
  %162 = getelementptr inbounds %struct.geo, ptr %161, i32 0, i32 2
  %163 = load i32, ptr %162, align 4, !tbaa !43
  %164 = zext i32 %163 to i64
  %165 = call i64 @pgno2bytes(ptr noundef %12, i64 noundef %164) #13
  %166 = load ptr, ptr %6, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.MDBX_envinfo, ptr %166, i32 0, i32 0
  %168 = getelementptr inbounds %struct.anon.27, ptr %167, i32 0, i32 0
  store i64 %165, ptr %168, align 8, !tbaa !47
  %169 = getelementptr inbounds %struct.meta, ptr %14, i32 0, i32 5
  %170 = getelementptr inbounds %struct.geo, ptr %169, i32 0, i32 3
  %171 = load i32, ptr %170, align 4, !tbaa !48
  %172 = zext i32 %171 to i64
  %173 = call i64 @pgno2bytes(ptr noundef %12, i64 noundef %172) #13
  %174 = load ptr, ptr %6, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.MDBX_envinfo, ptr %174, i32 0, i32 0
  %176 = getelementptr inbounds %struct.anon.27, ptr %175, i32 0, i32 1
  store i64 %173, ptr %176, align 8, !tbaa !49
  %177 = getelementptr inbounds %struct.meta, ptr %14, i32 0, i32 5
  %178 = getelementptr inbounds %struct.geo, ptr %177, i32 0, i32 1
  %179 = load i16, ptr %178, align 2, !tbaa !50
  %180 = call i32 @pv2pages(i16 noundef zeroext %179) #11
  %181 = zext i32 %180 to i64
  %182 = call i64 @pgno2bytes(ptr noundef %12, i64 noundef %181) #13
  %183 = load ptr, ptr %6, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.MDBX_envinfo, ptr %183, i32 0, i32 0
  %185 = getelementptr inbounds %struct.anon.27, ptr %184, i32 0, i32 3
  store i64 %182, ptr %185, align 8, !tbaa !51
  %186 = getelementptr inbounds %struct.meta, ptr %14, i32 0, i32 5
  %187 = getelementptr inbounds %struct.geo, ptr %186, i32 0, i32 0
  %188 = load i16, ptr %187, align 4, !tbaa !52
  %189 = call i32 @pv2pages(i16 noundef zeroext %188) #11
  %190 = zext i32 %189 to i64
  %191 = call i64 @pgno2bytes(ptr noundef %12, i64 noundef %190) #13
  %192 = load ptr, ptr %6, align 8, !tbaa !5
  %193 = getelementptr inbounds %struct.MDBX_envinfo, ptr %192, i32 0, i32 0
  %194 = getelementptr inbounds %struct.anon.27, ptr %193, i32 0, i32 4
  store i64 %191, ptr %194, align 8, !tbaa !53
  %195 = getelementptr inbounds %struct.meta, ptr %14, i32 0, i32 5
  %196 = getelementptr inbounds %struct.geo, ptr %195, i32 0, i32 4
  %197 = load i32, ptr %196, align 4, !tbaa !11
  %198 = zext i32 %197 to i64
  %199 = call i64 @pgno2bytes(ptr noundef %12, i64 noundef %198) #13
  %200 = load ptr, ptr %6, align 8, !tbaa !5
  %201 = getelementptr inbounds %struct.MDBX_envinfo, ptr %200, i32 0, i32 0
  %202 = getelementptr inbounds %struct.anon.27, ptr %201, i32 0, i32 2
  store i64 %199, ptr %202, align 8, !tbaa !54
  %203 = getelementptr inbounds %struct.meta, ptr %14, i32 0, i32 5
  %204 = getelementptr inbounds %struct.geo, ptr %203, i32 0, i32 5
  %205 = load i32, ptr %204, align 4, !tbaa !11
  %206 = sub i32 %205, 1
  %207 = zext i32 %206 to i64
  %208 = load ptr, ptr %6, align 8, !tbaa !5
  %209 = getelementptr inbounds %struct.MDBX_envinfo, ptr %208, i32 0, i32 2
  store i64 %207, ptr %209, align 8, !tbaa !55
  store i32 0, ptr %15, align 4, !tbaa !40
  %210 = call i64 @constmeta_txnid(ptr noundef %14) #13
  %211 = load ptr, ptr %6, align 8, !tbaa !5
  %212 = getelementptr inbounds %struct.MDBX_envinfo, ptr %211, i32 0, i32 3
  store i64 %210, ptr %212, align 8, !tbaa !56
  %213 = getelementptr inbounds %struct.meta, ptr %14, i32 0, i32 8
  %214 = call i64 @unaligned_peek_u64(i64 noundef 4, ptr noundef %213) #13
  %215 = load ptr, ptr %6, align 8, !tbaa !5
  %216 = getelementptr inbounds %struct.MDBX_envinfo, ptr %215, i32 0, i32 7
  %217 = getelementptr inbounds [3 x i64], ptr %216, i64 0, i64 0
  store i64 %214, ptr %217, align 8, !tbaa !9
  %218 = load i64, ptr %7, align 8, !tbaa !9
  %219 = icmp ugt i64 %218, 144
  %220 = xor i1 %219, true
  %221 = xor i1 %220, true
  %222 = zext i1 %221 to i32
  %223 = sext i32 %222 to i64
  %224 = call i64 @llvm.expect.i64(i64 %223, i64 1)
  %225 = icmp ne i64 %224, 0
  br i1 %225, label %226, label %245

226:                                              ; preds = %153
  %227 = load ptr, ptr %6, align 8, !tbaa !5
  %228 = getelementptr inbounds %struct.MDBX_envinfo, ptr %227, i32 0, i32 12
  %229 = getelementptr inbounds %struct.anon.28, ptr %228, i32 0, i32 1
  %230 = getelementptr inbounds [3 x %struct.anon.29], ptr %229, i64 0, i64 0
  %231 = getelementptr inbounds %struct.meta, ptr %14, i32 0, i32 11
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %230, ptr align 4 %231, i64 16, i1 false)
  %232 = load i64, ptr %7, align 8, !tbaa !9
  %233 = icmp ugt i64 %232, 336
  %234 = xor i1 %233, true
  %235 = xor i1 %234, true
  %236 = zext i1 %235 to i32
  %237 = sext i32 %236 to i64
  %238 = call i64 @llvm.expect.i64(i64 %237, i64 1)
  %239 = icmp ne i64 %238, 0
  br i1 %239, label %240, label %244

240:                                              ; preds = %226
  %241 = load ptr, ptr %6, align 8, !tbaa !5
  %242 = getelementptr inbounds %struct.MDBX_envinfo, ptr %241, i32 0, i32 20
  %243 = getelementptr inbounds %struct.meta, ptr %14, i32 0, i32 12
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %242, ptr align 4 %243, i64 16, i1 false)
  br label %244

244:                                              ; preds = %240, %226
  br label %245

245:                                              ; preds = %244, %153
  br label %246

246:                                              ; preds = %245, %152, %141, %125
  %247 = call i32 @env_close(ptr noundef %12, i1 noundef zeroext false)
  %248 = load i32, ptr %13, align 4, !tbaa !40
  %249 = call i32 @log_if_error(i32 noundef %248, ptr noundef @__func__.mdbx_preopen_snapinfo, i32 noundef 923)
  store i32 %249, ptr %4, align 4
  store i32 1, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #10
  br label %250

250:                                              ; preds = %246, %101
  call void @llvm.lifetime.end.p0(i64 1104, ptr %12) #10
  br label %251

251:                                              ; preds = %250, %45
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #10
  br label %252

252:                                              ; preds = %251, %25
  %253 = load i32, ptr %4, align 4
  ret i32 %253
}

declare i32 @dxb_read_header(ptr noundef, ptr noundef, i32 noundef, i32 noundef) #3

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare hidden i64 @pgno2bytes(ptr noundef, i64 noundef) #5

; Function Attrs: nounwind willreturn memory(none)
declare i32 @pv2pages(i16 noundef zeroext) #9

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #1 = { 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 #2 = { inlinehint nounwind willreturn memory(none) 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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { inlinehint nounwind willreturn memory(read) 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { 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 #9 = { nounwind willreturn memory(none) "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 #10 = { nounwind }
attributes #11 = { nounwind willreturn memory(none) }
attributes #12 = { cold }
attributes #13 = { nounwind willreturn memory(read) }

!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 = !{!"long", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !10, i64 144}
!13 = !{!"MDBX_envinfo", !14, i64 0, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !7, i64 80, !7, i64 104, !15, i64 128, !15, i64 132, !15, i64 136, !15, i64 140, !16, i64 144, !10, i64 208, !10, i64 216, !15, i64 224, !15, i64 228, !15, i64 232, !15, i64 236, !18, i64 240, !17, i64 336}
!14 = !{!"", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!15 = !{!"int", !7, i64 0}
!16 = !{!"", !17, i64 0, !7, i64 16}
!17 = !{!"", !10, i64 0, !10, i64 8}
!18 = !{!"", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88}
!19 = !{!13, !10, i64 152}
!20 = !{!21, !15, i64 140}
!21 = !{!"MDBX_env", !7, i64 0, !15, i64 4, !15, i64 8, !22, i64 16, !15, i64 56, !15, i64 60, !22, i64 64, !6, i64 104, !23, i64 112, !23, i64 114, !23, i64 116, !23, i64 118, !23, i64 120, !23, i64 122, !7, i64 124, !7, i64 128, !7, i64 129, !23, i64 130, !15, i64 132, !15, i64 136, !15, i64 140, !15, i64 144, !24, i64 152, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !15, i64 224, !15, i64 228, !15, i64 232, !6, i64 240, !6, i64 248, !10, i64 256, !25, i64 264, !14, i64 320, !26, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !28, i64 392, !7, i64 400, !15, i64 440, !15, i64 444, !6, i64 448, !29, i64 456, !7, i64 496, !7, i64 536}
!22 = !{!"osal_mmap", !7, i64 0, !15, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!23 = !{!"short", !7, i64 0}
!24 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!25 = !{!"", !15, i64 0, !15, i64 4, !15, i64 8, !15, i64 12, !10, i64 16, !7, i64 24, !7, i64 25, !7, i64 26, !7, i64 27, !15, i64 28, !15, i64 32, !26, i64 36, !26, i64 37, !26, i64 38, !27, i64 40, !7, i64 48}
!26 = !{!"_Bool", !7, i64 0}
!27 = !{!"", !23, i64 0, !23, i64 2, !23, i64 4, !23, i64 6}
!28 = !{!"", !10, i64 0}
!29 = !{!"osal_ioring", !15, i64 0, !15, i64 4, !15, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!30 = !{!31, !15, i64 16}
!31 = !{!"libmdbx_globals", !7, i64 0, !15, i64 16, !15, i64 20, !7, i64 24, !7, i64 25, !7, i64 26, !26, i64 27, !15, i64 28, !7, i64 32, !7, i64 40, !10, i64 80, !6, i64 88}
!32 = !{!31, !7, i64 26}
!33 = !{!13, !15, i64 140}
!34 = !{!21, !15, i64 4}
!35 = !{!21, !7, i64 129}
!36 = !{!21, !15, i64 72}
!37 = !{!21, !15, i64 24}
!38 = !{!21, !15, i64 56}
!39 = !{!21, !15, i64 60}
!40 = !{!15, !15, i64 0}
!41 = !{!21, !6, i64 160}
!42 = !{!13, !15, i64 136}
!43 = !{!44, !15, i64 24}
!44 = !{!"meta", !7, i64 0, !7, i64 8, !23, i64 16, !7, i64 18, !7, i64 19, !45, i64 20, !7, i64 40, !46, i64 136, !7, i64 168, !7, i64 176, !7, i64 184, !7, i64 192, !7, i64 208}
!45 = !{!"geo", !23, i64 0, !23, i64 2, !15, i64 4, !15, i64 8, !7, i64 12, !7, i64 16}
!46 = !{!"MDBX_canary", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!47 = !{!13, !10, i64 0}
!48 = !{!44, !15, i64 28}
!49 = !{!13, !10, i64 8}
!50 = !{!44, !23, i64 22}
!51 = !{!13, !10, i64 24}
!52 = !{!44, !23, i64 20}
!53 = !{!13, !10, i64 32}
!54 = !{!13, !10, i64 16}
!55 = !{!13, !10, i64 48}
!56 = !{!13, !10, i64 56}


; 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 }
%struct.anon = 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_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.1, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, ptr, ptr, i64, %struct.anon.2, %struct.anon.6, i8, ptr, ptr, ptr, %struct.anon.7, %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, i32, i64, i64, i64 }
%union.anon = type { ptr }
%union.mdbx_atomic_uint32_t = type { i32 }
%struct.anon.1 = type { ptr, ptr, ptr, ptr }
%struct.anon.2 = type { i32, i32, i32, i32, i64, i8, i8, i8, i8, i32, i32, i8, i8, i8, %struct.anon.3, %union.anon.4 }
%struct.anon.3 = type { i16, i16, i16, i16 }
%union.anon.4 = type { i32 }
%struct.anon.6 = type { i64, i64, i64, i64, i64 }
%struct.anon.7 = type { i64 }
%struct.osal_ioring = type { i32, i32, i32, ptr, ptr, ptr }
%union.mdbx_atomic_uint64_t = type { i64 }
%struct.meta = type { [2 x i32], %union.anon.11, i16, i8, i8, %struct.geo, %union.anon.14, %struct.MDBX_canary, %union.anon.17, [2 x %union.mdbx_atomic_uint32_t], [2 x i32], %union.bin128, %union.bin128 }
%union.anon.11 = type { i64 }
%struct.geo = type { i16, i16, i32, i32, %union.anon.12, %union.anon.13 }
%union.anon.12 = type { i32 }
%union.anon.13 = type { i32 }
%union.anon.14 = type { %struct.anon.15 }
%struct.anon.15 = type { %struct.tree, %struct.tree }
%struct.tree = type { i16, i16, i32, i32, i32, i32, i32, i64, i64, i64 }
%struct.MDBX_canary = type { i64, i64, i64, i64 }
%union.anon.17 = type { i64 }

@globals = external local_unnamed_addr global %struct.libmdbx_globals, align 8
@.str = external hidden unnamed_addr constant [31 x i8], align 1
@__func__.mdbx_preopen_snapinfo = external hidden unnamed_addr constant [22 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 mustprogress nofree nosync nounwind willreturn memory(none) uwtable
declare hidden zeroext i1 @is_powerof2(i64 noundef) local_unnamed_addr #1

declare void @debug_log(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #2

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

declare void @env_options_init(ptr noundef) local_unnamed_addr #2

declare i32 @env_setup_pagesize(ptr noundef, i64 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) #3

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare hidden i64 @constmeta_txnid(ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress 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) #5

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

; Function Attrs: cold nounwind optsize uwtable
declare hidden i32 @env_handle_pathname(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #7

declare i32 @osal_openfile(i32 noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare hidden i64 @unaligned_peek_u64(i64 noundef, ptr noalias noundef) local_unnamed_addr #4

declare i32 @env_close(ptr noundef, i1 noundef zeroext) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @osal_getpid() local_unnamed_addr #0

; Function Attrs: cold nounwind optsize uwtable
define dso_local i32 @mdbx_preopen_snapinfo(ptr noundef %0, ptr noundef writeonly %1, i64 noundef %2) local_unnamed_addr #7 {
  %4 = alloca %struct.MDBX_env, align 8
  %5 = alloca %struct.meta, align 4
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %6, label %8, !prof !5

6:                                                ; preds = %3
  %7 = tail call i32 @log_if_error(i32 noundef 22, ptr noundef nonnull @__func__.mdbx_preopen_snapinfo, i32 noundef 857)
  br label %96

8:                                                ; preds = %3
  switch i64 %2, label %9 [
    i64 352, label %11
    i64 336, label %11
    i64 240, label %11
    i64 144, label %11
  ], !prof !6

9:                                                ; preds = %8
  %10 = tail call i32 @log_if_error(i32 noundef 22, ptr noundef nonnull @__func__.mdbx_preopen_snapinfo, i32 noundef 864)
  br label %96

11:                                               ; preds = %8, %8, %8, %8
  tail call void @llvm.memset.p0.i64(ptr nonnull align 8 %1, i8 0, i64 %2, i1 false)
  %12 = icmp ugt i64 %2, 144
  br i1 %12, label %13, label %16, !prof !7

13:                                               ; preds = %11
  %14 = getelementptr inbounds i8, ptr %1, i64 144
  %15 = load <2 x i64>, ptr @globals, align 8, !tbaa !8
  store <2 x i64> %15, ptr %14, align 8, !tbaa !11
  br label %16

16:                                               ; preds = %13, %11
  call void @llvm.lifetime.start.p0(i64 1104, ptr nonnull %4) #9
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(1104) %4, i8 0, i64 1104, i1 false)
  %17 = tail call i32 @osal_getpid()
  %18 = getelementptr inbounds i8, ptr %4, i64 140
  store i32 %17, ptr %18, align 4, !tbaa !13
  %19 = load i32, ptr getelementptr inbounds (i8, ptr @globals, i64 16), align 8
  %20 = zext i32 %19 to i64
  %21 = tail call zeroext i1 @is_powerof2(i64 noundef %20) #10
  %22 = icmp ugt i32 %19, 255
  %.not41 = and i1 %22, %21
  br i1 %.not41, label %28, label %23, !prof !7

23:                                               ; preds = %16
  %24 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 26), align 2, !tbaa !26
  %.not45 = icmp eq i8 %24, 0
  br i1 %.not45, label %26, label %25, !prof !7

25:                                               ; preds = %23
  tail call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 1, ptr noundef nonnull @__func__.mdbx_preopen_snapinfo, i32 noundef 876, ptr noundef nonnull @.str, i32 noundef %19) #9
  br label %26

26:                                               ; preds = %25, %23
  %27 = tail call i32 @log_if_error(i32 noundef -30784, ptr noundef nonnull @__func__.mdbx_preopen_snapinfo, i32 noundef 877)
  br label %95

28:                                               ; preds = %16
  %29 = getelementptr inbounds i8, ptr %1, i64 140
  store i32 %19, ptr %29, align 4, !tbaa !28
  %30 = getelementptr inbounds i8, ptr %4, i64 4
  store i32 1082269696, ptr %30, align 4, !tbaa !33
  %31 = getelementptr inbounds i8, ptr %4, i64 129
  store i8 -1, ptr %31, align 1, !tbaa !34
  %32 = getelementptr inbounds i8, ptr %4, i64 72
  store i32 -1, ptr %32, align 8, !tbaa !35
  %33 = getelementptr inbounds i8, ptr %4, i64 24
  store i32 -1, ptr %33, align 8, !tbaa !36
  %34 = getelementptr inbounds i8, ptr %4, i64 56
  store i32 -1, ptr %34, align 8, !tbaa !37
  %35 = getelementptr inbounds i8, ptr %4, i64 60
  store i32 -1, ptr %35, align 4, !tbaa !38
  call void @env_options_init(ptr noundef nonnull %4) #9
  %36 = call i32 @env_handle_pathname(ptr noundef nonnull %4, ptr noundef %0, i32 noundef 0) #11
  %.not42 = icmp eq i32 %36, 0
  br i1 %.not42, label %37, label %92, !prof !7

37:                                               ; preds = %28
  %38 = getelementptr inbounds i8, ptr %4, i64 160
  %39 = load ptr, ptr %38, align 8, !tbaa !39
  %40 = call i32 @osal_openfile(i32 noundef 0, ptr noundef nonnull %4, ptr noundef %39, ptr noundef nonnull %33, i32 noundef 0) #9
  %.not43 = icmp eq i32 %40, 0
  br i1 %.not43, label %41, label %92, !prof !7

41:                                               ; preds = %37
  %42 = call i32 @dxb_read_header(ptr noundef nonnull %4, ptr noundef nonnull %5, i32 noundef 0, i32 noundef 0) #9
  %.not44 = icmp eq i32 %42, 0
  br i1 %.not44, label %43, label %92, !prof !7

43:                                               ; preds = %41
  %44 = getelementptr inbounds i8, ptr %5, i64 44
  %45 = load i32, ptr %44, align 4, !tbaa !8
  %46 = zext i32 %45 to i64
  %47 = call i32 @env_setup_pagesize(ptr noundef nonnull %4, i64 noundef %46) #9
  %48 = getelementptr inbounds i8, ptr %1, i64 136
  store i32 %47, ptr %48, align 8, !tbaa !40
  %49 = getelementptr inbounds i8, ptr %5, i64 20
  %50 = getelementptr inbounds i8, ptr %5, i64 24
  %51 = load i32, ptr %50, align 4, !tbaa !41
  %52 = zext i32 %51 to i64
  %53 = call i64 @pgno2bytes(ptr noundef nonnull %4, i64 noundef %52) #12
  store i64 %53, ptr %1, align 8, !tbaa !45
  %54 = getelementptr inbounds i8, ptr %5, i64 28
  %55 = load i32, ptr %54, align 4, !tbaa !46
  %56 = zext i32 %55 to i64
  %57 = call i64 @pgno2bytes(ptr noundef nonnull %4, i64 noundef %56) #12
  %58 = getelementptr inbounds i8, ptr %1, i64 8
  store i64 %57, ptr %58, align 8, !tbaa !47
  %59 = getelementptr inbounds i8, ptr %5, i64 22
  %60 = load i16, ptr %59, align 2, !tbaa !48
  %61 = call i32 @pv2pages(i16 noundef zeroext %60) #10
  %62 = zext i32 %61 to i64
  %63 = call i64 @pgno2bytes(ptr noundef nonnull %4, i64 noundef %62) #12
  %64 = getelementptr inbounds i8, ptr %1, i64 24
  store i64 %63, ptr %64, align 8, !tbaa !49
  %65 = load i16, ptr %49, align 4, !tbaa !50
  %66 = call i32 @pv2pages(i16 noundef zeroext %65) #10
  %67 = zext i32 %66 to i64
  %68 = call i64 @pgno2bytes(ptr noundef nonnull %4, i64 noundef %67) #12
  %69 = getelementptr inbounds i8, ptr %1, i64 32
  store i64 %68, ptr %69, align 8, !tbaa !51
  %70 = getelementptr inbounds i8, ptr %5, i64 32
  %71 = load i32, ptr %70, align 4, !tbaa !8
  %72 = zext i32 %71 to i64
  %73 = call i64 @pgno2bytes(ptr noundef nonnull %4, i64 noundef %72) #12
  %74 = getelementptr inbounds i8, ptr %1, i64 16
  store i64 %73, ptr %74, align 8, !tbaa !52
  %75 = getelementptr inbounds i8, ptr %5, i64 36
  %76 = load i32, ptr %75, align 4, !tbaa !8
  %77 = add i32 %76, -1
  %78 = zext i32 %77 to i64
  %79 = getelementptr inbounds i8, ptr %1, i64 48
  store i64 %78, ptr %79, align 8, !tbaa !53
  %80 = call i64 @constmeta_txnid(ptr noundef nonnull %5) #12
  %81 = getelementptr inbounds i8, ptr %1, i64 56
  store i64 %80, ptr %81, align 8, !tbaa !54
  %82 = getelementptr inbounds i8, ptr %5, i64 168
  %83 = call i64 @unaligned_peek_u64(i64 noundef 4, ptr noundef nonnull %82) #12
  %84 = getelementptr inbounds i8, ptr %1, i64 104
  store i64 %83, ptr %84, align 8, !tbaa !11
  br i1 %12, label %85, label %92, !prof !7

85:                                               ; preds = %43
  %86 = getelementptr inbounds i8, ptr %1, i64 160
  %87 = getelementptr inbounds i8, ptr %5, i64 192
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %86, ptr noundef nonnull align 4 dereferenceable(16) %87, i64 16, i1 false)
  %88 = icmp ugt i64 %2, 336
  br i1 %88, label %89, label %92, !prof !7

89:                                               ; preds = %85
  %90 = getelementptr inbounds i8, ptr %1, i64 336
  %91 = getelementptr inbounds i8, ptr %5, i64 208
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %90, ptr noundef nonnull align 4 dereferenceable(16) %91, i64 16, i1 false)
  br label %92

92:                                               ; preds = %43, %89, %85, %41, %37, %28
  %.032 = phi i32 [ %36, %28 ], [ %40, %37 ], [ %42, %41 ], [ 0, %89 ], [ 0, %85 ], [ 0, %43 ]
  %93 = call i32 @env_close(ptr noundef nonnull %4, i1 noundef zeroext false) #9
  %94 = call i32 @log_if_error(i32 noundef %.032, ptr noundef nonnull @__func__.mdbx_preopen_snapinfo, i32 noundef 923)
  br label %95

95:                                               ; preds = %92, %26
  %.0 = phi i32 [ %27, %26 ], [ %94, %92 ]
  call void @llvm.lifetime.end.p0(i64 1104, ptr nonnull %4) #9
  br label %96

96:                                               ; preds = %9, %95, %6
  %.2 = phi i32 [ %7, %6 ], [ %10, %9 ], [ %.0, %95 ]
  ret i32 %.2
}

declare i32 @dxb_read_header(ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare hidden i64 @pgno2bytes(ptr noundef, i64 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare i32 @pv2pages(i16 noundef zeroext) local_unnamed_addr #8

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 = { inlinehint mustprogress nofree nosync nounwind willreturn memory(none) 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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { inlinehint mustprogress nofree nounwind willreturn memory(read) 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { 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 #8 = { mustprogress nofree nosync nounwind willreturn memory(none) "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 #9 = { nounwind }
attributes #10 = { nounwind willreturn memory(none) }
attributes #11 = { cold }
attributes #12 = { nounwind willreturn memory(read) }

!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 1, i32 2000}
!6 = !{!"branch_weights", i32 1, i32 8000, i32 1, i32 1, i32 1}
!7 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!8 = !{!9, !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !9, i64 0}
!13 = !{!14, !15, i64 140}
!14 = !{!"MDBX_env", !9, i64 0, !15, i64 4, !15, i64 8, !16, i64 16, !15, i64 56, !15, i64 60, !16, i64 64, !17, i64 104, !18, i64 112, !18, i64 114, !18, i64 116, !18, i64 118, !18, i64 120, !18, i64 122, !9, i64 124, !9, i64 128, !9, i64 129, !18, i64 130, !15, i64 132, !15, i64 136, !15, i64 140, !15, i64 144, !19, i64 152, !17, i64 184, !17, i64 192, !17, i64 200, !17, i64 208, !17, i64 216, !15, i64 224, !15, i64 228, !15, i64 232, !17, i64 240, !17, i64 248, !12, i64 256, !20, i64 264, !23, i64 320, !21, i64 360, !17, i64 368, !17, i64 376, !17, i64 384, !24, i64 392, !9, i64 400, !15, i64 440, !15, i64 444, !17, i64 448, !25, i64 456, !9, i64 496, !9, i64 536}
!15 = !{!"int", !9, i64 0}
!16 = !{!"osal_mmap", !9, i64 0, !15, i64 8, !12, i64 16, !12, i64 24, !12, i64 32}
!17 = !{!"any pointer", !9, i64 0}
!18 = !{!"short", !9, i64 0}
!19 = !{!"", !17, i64 0, !17, i64 8, !17, i64 16, !17, i64 24}
!20 = !{!"", !15, i64 0, !15, i64 4, !15, i64 8, !15, i64 12, !12, i64 16, !9, i64 24, !9, i64 25, !9, i64 26, !9, i64 27, !15, i64 28, !15, i64 32, !21, i64 36, !21, i64 37, !21, i64 38, !22, i64 40, !9, i64 48}
!21 = !{!"_Bool", !9, i64 0}
!22 = !{!"", !18, i64 0, !18, i64 2, !18, i64 4, !18, i64 6}
!23 = !{!"", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32}
!24 = !{!"", !12, i64 0}
!25 = !{!"osal_ioring", !15, i64 0, !15, i64 4, !15, i64 8, !17, i64 16, !17, i64 24, !17, i64 32}
!26 = !{!27, !9, i64 26}
!27 = !{!"libmdbx_globals", !9, i64 0, !15, i64 16, !15, i64 20, !9, i64 24, !9, i64 25, !9, i64 26, !21, i64 27, !15, i64 28, !9, i64 32, !9, i64 40, !12, i64 80, !17, i64 88}
!28 = !{!29, !15, i64 140}
!29 = !{!"MDBX_envinfo", !23, i64 0, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !9, i64 80, !9, i64 104, !15, i64 128, !15, i64 132, !15, i64 136, !15, i64 140, !30, i64 144, !12, i64 208, !12, i64 216, !15, i64 224, !15, i64 228, !15, i64 232, !15, i64 236, !32, i64 240, !31, i64 336}
!30 = !{!"", !31, i64 0, !9, i64 16}
!31 = !{!"", !12, i64 0, !12, i64 8}
!32 = !{!"", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !12, i64 88}
!33 = !{!14, !15, i64 4}
!34 = !{!14, !9, i64 129}
!35 = !{!14, !15, i64 72}
!36 = !{!14, !15, i64 24}
!37 = !{!14, !15, i64 56}
!38 = !{!14, !15, i64 60}
!39 = !{!14, !17, i64 160}
!40 = !{!29, !15, i64 136}
!41 = !{!42, !15, i64 24}
!42 = !{!"meta", !9, i64 0, !9, i64 8, !18, i64 16, !9, i64 18, !9, i64 19, !43, i64 20, !9, i64 40, !44, i64 136, !9, i64 168, !9, i64 176, !9, i64 184, !9, i64 192, !9, i64 208}
!43 = !{!"geo", !18, i64 0, !18, i64 2, !15, i64 4, !15, i64 8, !9, i64 12, !9, i64 16}
!44 = !{!"MDBX_canary", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!45 = !{!29, !12, i64 0}
!46 = !{!42, !15, i64 28}
!47 = !{!29, !12, i64 8}
!48 = !{!42, !18, i64 22}
!49 = !{!29, !12, i64 24}
!50 = !{!42, !18, i64 20}
!51 = !{!29, !12, i64 32}
!52 = !{!29, !12, i64 16}
!53 = !{!29, !12, i64 48}
!54 = !{!29, !12, i64 56}


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