; LLVM IR from erthink/libmdbx :: src/tools (dump)

; 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_version_info = type { i16, i16, i16, i16, ptr, %struct.anon, ptr }
%struct.anon = type { ptr, ptr, ptr, ptr }
%struct.MDBX_build_info = type { ptr, ptr, ptr, ptr, ptr, ptr }
%struct.iovec = type { ptr, i64 }

@quiet = external dso_local global i8, align 1
@rescue = external dso_local global i8, align 1
@prog = external dso_local global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [136 x i8], align 1
@mdbx_version = external constant %struct.MDBX_version_info, align 8
@mdbx_sourcery_MDBX_BUILD_SOURCERY = external constant ptr, align 8
@mdbx_build = external constant %struct.MDBX_build_info, align 8
@optarg = external global ptr, align 8
@.str.8 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8
@stderr = external global ptr, align 8
@.str.9 = external hidden unnamed_addr constant [20 x i8], align 1
@mode = external hidden global i32, align 4
@optind = external global i32, align 4
@.str.10 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [66 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [23 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [19 x i8], align 1
@user_break = external hidden global i32, align 4
@.str.21 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [16 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i8, align 1
  %16 = alloca i8, align 1
  %17 = alloca i8, align 1
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca ptr, align 8
  %21 = alloca i8, align 1
  %22 = alloca i32, align 4
  %23 = alloca %struct.iovec, align 8
  %24 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #10
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #10
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #10
  %25 = load ptr, ptr %5, align 8, !tbaa !9
  %26 = getelementptr inbounds ptr, ptr %25, i64 0
  %27 = load ptr, ptr %26, align 8, !tbaa !9
  store ptr %27, ptr @prog, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #10
  store ptr null, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #10
  store ptr null, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #10
  store i32 0, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %15) #10
  store i8 0, ptr %15, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %16) #10
  store i8 0, ptr %16, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %17) #10
  store i8 0, ptr %17, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #10
  store i32 0, ptr %18, align 4, !tbaa !5
  %28 = load i32, ptr %4, align 4, !tbaa !5
  %29 = icmp slt i32 %28, 2
  br i1 %29, label %30, label %31

30:                                               ; preds = %2
  call void @usage()
  br label %31

31:                                               ; preds = %30, %2
  br label %32

32:                                               ; preds = %96, %31
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = load ptr, ptr %5, align 8, !tbaa !9
  %35 = call i32 @getopt(i32 noundef %33, ptr noundef %34, ptr noundef @.str.6) #10
  store i32 %35, ptr %6, align 4, !tbaa !5
  %36 = icmp ne i32 %35, -1
  br i1 %36, label %37, label %97

37:                                               ; preds = %32
  %38 = load i32, ptr %6, align 4, !tbaa !5
  switch i32 %38, label %95 [
    i32 86, label %39
    i32 108, label %59
    i32 97, label %60
    i32 102, label %65
    i32 110, label %96
    i32 99, label %79
    i32 112, label %82
    i32 115, label %85
    i32 113, label %91
    i32 114, label %92
    i32 117, label %93
    i32 85, label %94
  ]

39:                                               ; preds = %37
  %40 = load i16, ptr @mdbx_version, align 8, !tbaa !13
  %41 = zext i16 %40 to i32
  %42 = load i16, ptr getelementptr inbounds (%struct.MDBX_version_info, ptr @mdbx_version, i32 0, i32 1), align 2, !tbaa !17
  %43 = zext i16 %42 to i32
  %44 = load i16, ptr getelementptr inbounds (%struct.MDBX_version_info, ptr @mdbx_version, i32 0, i32 2), align 4, !tbaa !18
  %45 = zext i16 %44 to i32
  %46 = load i16, ptr getelementptr inbounds (%struct.MDBX_version_info, ptr @mdbx_version, i32 0, i32 3), align 2, !tbaa !19
  %47 = zext i16 %46 to i32
  %48 = load ptr, ptr getelementptr inbounds (%struct.anon, ptr getelementptr inbounds (%struct.MDBX_version_info, ptr @mdbx_version, i32 0, i32 5), i32 0, i32 3), align 8, !tbaa !20
  %49 = load ptr, ptr getelementptr inbounds (%struct.MDBX_version_info, ptr @mdbx_version, i32 0, i32 5), align 8, !tbaa !21
  %50 = load ptr, ptr getelementptr inbounds (%struct.anon, ptr getelementptr inbounds (%struct.MDBX_version_info, ptr @mdbx_version, i32 0, i32 5), i32 0, i32 2), align 8, !tbaa !22
  %51 = load ptr, ptr getelementptr inbounds (%struct.anon, ptr getelementptr inbounds (%struct.MDBX_version_info, ptr @mdbx_version, i32 0, i32 5), i32 0, i32 1), align 8, !tbaa !23
  %52 = load ptr, ptr @mdbx_sourcery_MDBX_BUILD_SOURCERY, align 8, !tbaa !9
  %53 = load ptr, ptr @mdbx_build, align 8, !tbaa !24
  %54 = load ptr, ptr getelementptr inbounds (%struct.MDBX_build_info, ptr @mdbx_build, i32 0, i32 1), align 8, !tbaa !26
  %55 = load ptr, ptr getelementptr inbounds (%struct.MDBX_build_info, ptr @mdbx_build, i32 0, i32 3), align 8, !tbaa !27
  %56 = load ptr, ptr getelementptr inbounds (%struct.MDBX_build_info, ptr @mdbx_build, i32 0, i32 4), align 8, !tbaa !28
  %57 = load ptr, ptr getelementptr inbounds (%struct.MDBX_build_info, ptr @mdbx_build, i32 0, i32 2), align 8, !tbaa !29
  %58 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i32 noundef %41, i32 noundef %43, i32 noundef %45, i32 noundef %47, ptr noundef %48, ptr noundef %49, ptr noundef %50, ptr noundef %51, ptr noundef %52, ptr noundef %53, ptr noundef %54, ptr noundef %55, ptr noundef %56, ptr noundef %57)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %476

59:                                               ; preds = %37
  store i8 1, ptr %16, align 1, !tbaa !11
  br label %60

60:                                               ; preds = %59, %37
  %61 = load ptr, ptr %12, align 8, !tbaa !9
  %62 = icmp ne ptr %61, null
  br i1 %62, label %63, label %64

63:                                               ; preds = %60
  call void @usage()
  br label %64

64:                                               ; preds = %63, %60
  store i8 1, ptr %15, align 1, !tbaa !11
  br label %96

65:                                               ; preds = %37
  %66 = load ptr, ptr @optarg, align 8, !tbaa !9
  %67 = load ptr, ptr @stdout, align 8, !tbaa !9
  %68 = call ptr @freopen64(ptr noundef %66, ptr noundef @.str.8, ptr noundef %67)
  %69 = icmp eq ptr %68, null
  br i1 %69, label %70, label %78

70:                                               ; preds = %65
  %71 = load ptr, ptr @stderr, align 8, !tbaa !9
  %72 = load ptr, ptr @prog, align 8, !tbaa !9
  %73 = load ptr, ptr @optarg, align 8, !tbaa !9
  %74 = call ptr @__errno_location() #11
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = call ptr @mdbx_strerror(i32 noundef %75)
  %77 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %71, ptr noundef @.str.9, ptr noundef %72, ptr noundef %73, ptr noundef %76) #10
  call void @exit(i32 noundef 1) #12
  unreachable

78:                                               ; preds = %65
  br label %96

79:                                               ; preds = %37
  %80 = load i32, ptr @mode, align 4, !tbaa !5
  %81 = or i32 %80, 4
  store i32 %81, ptr @mode, align 4, !tbaa !5
  br label %96

82:                                               ; preds = %37
  %83 = load i32, ptr @mode, align 4, !tbaa !5
  %84 = or i32 %83, 1
  store i32 %84, ptr @mode, align 4, !tbaa !5
  br label %96

85:                                               ; preds = %37
  %86 = load i8, ptr %15, align 1, !tbaa !11, !range !30, !noundef !31
  %87 = trunc i8 %86 to i1
  br i1 %87, label %88, label %89

88:                                               ; preds = %85
  call void @usage()
  br label %89

89:                                               ; preds = %88, %85
  %90 = load ptr, ptr @optarg, align 8, !tbaa !9
  store ptr %90, ptr %12, align 8, !tbaa !9
  br label %96

91:                                               ; preds = %37
  store i8 1, ptr @quiet, align 1, !tbaa !11
  br label %96

92:                                               ; preds = %37
  store i8 1, ptr @rescue, align 1, !tbaa !11
  br label %96

93:                                               ; preds = %37
  store i8 1, ptr %17, align 1, !tbaa !11
  br label %96

94:                                               ; preds = %37
  store i8 1, ptr %17, align 1, !tbaa !11
  store i32 13, ptr %18, align 4, !tbaa !5
  br label %96

95:                                               ; preds = %37
  call void @usage()
  br label %96

96:                                               ; preds = %95, %94, %93, %92, %91, %89, %82, %79, %78, %64, %37
  br label %32, !llvm.loop !32

97:                                               ; preds = %32
  %98 = load i32, ptr @optind, align 4, !tbaa !5
  %99 = load i32, ptr %4, align 4, !tbaa !5
  %100 = sub nsw i32 %99, 1
  %101 = icmp ne i32 %98, %100
  br i1 %101, label %102, label %103

102:                                              ; preds = %97
  call void @usage()
  br label %103

103:                                              ; preds = %102, %97
  %104 = call ptr @signal(i32 noundef 13, ptr noundef @signal_handler) #10
  %105 = call ptr @signal(i32 noundef 1, ptr noundef @signal_handler) #10
  %106 = call ptr @signal(i32 noundef 2, ptr noundef @signal_handler) #10
  %107 = call ptr @signal(i32 noundef 15, ptr noundef @signal_handler) #10
  %108 = load ptr, ptr %5, align 8, !tbaa !9
  %109 = load i32, ptr @optind, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds ptr, ptr %108, i64 %110
  %112 = load ptr, ptr %111, align 8, !tbaa !9
  store ptr %112, ptr %11, align 8, !tbaa !9
  %113 = load i8, ptr @quiet, align 1, !tbaa !11, !range !30, !noundef !31
  %114 = trunc i8 %113 to i1
  br i1 %114, label %124, label %115

115:                                              ; preds = %103
  %116 = load ptr, ptr @stderr, align 8, !tbaa !9
  %117 = load ptr, ptr getelementptr inbounds (%struct.anon, ptr getelementptr inbounds (%struct.MDBX_version_info, ptr @mdbx_version, i32 0, i32 5), i32 0, i32 3), align 8, !tbaa !20
  %118 = load ptr, ptr getelementptr inbounds (%struct.MDBX_version_info, ptr @mdbx_version, i32 0, i32 5), align 8, !tbaa !21
  %119 = load ptr, ptr getelementptr inbounds (%struct.anon, ptr getelementptr inbounds (%struct.MDBX_version_info, ptr @mdbx_version, i32 0, i32 5), i32 0, i32 1), align 8, !tbaa !23
  %120 = load ptr, ptr %11, align 8, !tbaa !9
  %121 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %116, ptr noundef @.str.10, ptr noundef %117, ptr noundef %118, ptr noundef %119, ptr noundef %120) #10
  %122 = call i32 @fflush(ptr noundef null)
  %123 = call i32 @mdbx_setup_debug(i32 noundef 3, i32 noundef -1, ptr noundef @logger)
  br label %124

124:                                              ; preds = %115, %103
  %125 = call i32 @mdbx_env_create(ptr noundef %8)
  store i32 %125, ptr %7, align 4, !tbaa !5
  %126 = load i32, ptr %7, align 4, !tbaa !5
  %127 = icmp ne i32 %126, 0
  %128 = xor i1 %127, true
  %129 = xor i1 %128, true
  %130 = zext i1 %129 to i32
  %131 = sext i32 %130 to i64
  %132 = call i64 @llvm.expect.i64(i64 %131, i64 0)
  %133 = icmp ne i64 %132, 0
  br i1 %133, label %134, label %136

134:                                              ; preds = %124
  %135 = load i32, ptr %7, align 4, !tbaa !5
  call void @error(ptr noundef @.str.11, i32 noundef %135)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %476

136:                                              ; preds = %124
  %137 = load i8, ptr %15, align 1, !tbaa !11, !range !30, !noundef !31
  %138 = trunc i8 %137 to i1
  br i1 %138, label %142, label %139

139:                                              ; preds = %136
  %140 = load ptr, ptr %12, align 8, !tbaa !9
  %141 = icmp ne ptr %140, null
  br i1 %141, label %142, label %156

142:                                              ; preds = %139, %136
  %143 = load ptr, ptr %8, align 8, !tbaa !9
  %144 = call i32 @mdbx_env_set_maxdbs(ptr noundef %143, i32 noundef 2)
  store i32 %144, ptr %7, align 4, !tbaa !5
  %145 = load i32, ptr %7, align 4, !tbaa !5
  %146 = icmp ne i32 %145, 0
  %147 = xor i1 %146, true
  %148 = xor i1 %147, true
  %149 = zext i1 %148 to i32
  %150 = sext i32 %149 to i64
  %151 = call i64 @llvm.expect.i64(i64 %150, i64 0)
  %152 = icmp ne i64 %151, 0
  br i1 %152, label %153, label %155

153:                                              ; preds = %142
  %154 = load i32, ptr %7, align 4, !tbaa !5
  call void @error(ptr noundef @.str.12, i32 noundef %154)
  br label %468

155:                                              ; preds = %142
  br label %156

156:                                              ; preds = %155, %139
  %157 = load ptr, ptr %8, align 8, !tbaa !9
  %158 = load ptr, ptr %11, align 8, !tbaa !9
  %159 = load i32, ptr %14, align 4, !tbaa !5
  %160 = load i8, ptr @rescue, align 1, !tbaa !11, !range !30, !noundef !31
  %161 = trunc i8 %160 to i1
  %162 = zext i1 %161 to i64
  %163 = select i1 %161, i32 4333568, i32 131072
  %164 = or i32 %159, %163
  %165 = call i32 @mdbx_env_open(ptr noundef %157, ptr noundef %158, i32 noundef %164, i32 noundef 0)
  store i32 %165, ptr %7, align 4, !tbaa !5
  %166 = load i32, ptr %7, align 4, !tbaa !5
  %167 = icmp ne i32 %166, 0
  %168 = xor i1 %167, true
  %169 = xor i1 %168, true
  %170 = zext i1 %169 to i32
  %171 = sext i32 %170 to i64
  %172 = call i64 @llvm.expect.i64(i64 %171, i64 0)
  %173 = icmp ne i64 %172, 0
  br i1 %173, label %174, label %176

174:                                              ; preds = %156
  %175 = load i32, ptr %7, align 4, !tbaa !5
  call void @error(ptr noundef @.str.13, i32 noundef %175)
  br label %468

176:                                              ; preds = %156
  %177 = load i8, ptr %17, align 1, !tbaa !11, !range !30, !noundef !31
  %178 = trunc i8 %177 to i1
  br i1 %178, label %179, label %191

179:                                              ; preds = %176
  %180 = load ptr, ptr %8, align 8, !tbaa !9
  %181 = load i32, ptr %18, align 4, !tbaa !5
  %182 = call i32 @mdbx_env_warmup(ptr noundef %180, ptr noundef null, i32 noundef %181, i32 noundef 235929600)
  store i32 %182, ptr %7, align 4, !tbaa !5
  %183 = load i32, ptr %7, align 4, !tbaa !5
  %184 = icmp ne i32 %183, -1
  br i1 %184, label %185, label %190

185:                                              ; preds = %179
  %186 = load i32, ptr %7, align 4, !tbaa !5
  %187 = icmp ne i32 %186, 0
  br i1 %187, label %188, label %190

188:                                              ; preds = %185
  %189 = load i32, ptr %7, align 4, !tbaa !5
  call void @error(ptr noundef @.str.14, i32 noundef %189)
  br label %468

190:                                              ; preds = %185, %179
  br label %191

191:                                              ; preds = %190, %176
  %192 = load ptr, ptr %8, align 8, !tbaa !9
  %193 = call i32 @mdbx_txn_begin(ptr noundef %192, ptr noundef null, i32 noundef 131072, ptr noundef %9)
  store i32 %193, ptr %7, align 4, !tbaa !5
  %194 = load i32, ptr %7, align 4, !tbaa !5
  %195 = icmp ne i32 %194, 0
  %196 = xor i1 %195, true
  %197 = xor i1 %196, true
  %198 = zext i1 %197 to i32
  %199 = sext i32 %198 to i64
  %200 = call i64 @llvm.expect.i64(i64 %199, i64 0)
  %201 = icmp ne i64 %200, 0
  br i1 %201, label %202, label %204

202:                                              ; preds = %191
  %203 = load i32, ptr %7, align 4, !tbaa !5
  call void @error(ptr noundef @.str.15, i32 noundef %203)
  br label %468

204:                                              ; preds = %191
  %205 = load ptr, ptr %9, align 8, !tbaa !9
  %206 = load ptr, ptr %12, align 8, !tbaa !9
  %207 = call i32 @mdbx_dbi_open(ptr noundef %205, ptr noundef %206, i32 noundef 1073741824, ptr noundef %10)
  store i32 %207, ptr %7, align 4, !tbaa !5
  %208 = load i32, ptr %7, align 4, !tbaa !5
  %209 = icmp ne i32 %208, 0
  %210 = xor i1 %209, true
  %211 = xor i1 %210, true
  %212 = zext i1 %211 to i32
  %213 = sext i32 %212 to i64
  %214 = call i64 @llvm.expect.i64(i64 %213, i64 0)
  %215 = icmp ne i64 %214, 0
  br i1 %215, label %216, label %218

216:                                              ; preds = %204
  %217 = load i32, ptr %7, align 4, !tbaa !5
  call void @error(ptr noundef @.str.16, i32 noundef %217)
  br label %465

218:                                              ; preds = %204
  %219 = load i8, ptr %15, align 1, !tbaa !11, !range !30, !noundef !31
  %220 = trunc i8 %219 to i1
  br i1 %220, label %221, label %434

221:                                              ; preds = %218
  %222 = load i32, ptr %10, align 4, !tbaa !5
  %223 = icmp eq i32 %222, 1
  br i1 %223, label %224, label %225

224:                                              ; preds = %221
  br label %226

225:                                              ; preds = %221
  call void @__assert_fail(ptr noundef @.str.17, ptr noundef @.str.18, i32 noundef 388, ptr noundef @__PRETTY_FUNCTION__.main) #12
  unreachable

226:                                              ; preds = %224
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #10
  %227 = load ptr, ptr %9, align 8, !tbaa !9
  %228 = call i32 @mdbx_cursor_open(ptr noundef %227, i32 noundef 1, ptr noundef %20)
  store i32 %228, ptr %7, align 4, !tbaa !5
  %229 = load i32, ptr %7, align 4, !tbaa !5
  %230 = icmp ne i32 %229, 0
  %231 = xor i1 %230, true
  %232 = xor i1 %231, true
  %233 = zext i1 %232 to i32
  %234 = sext i32 %233 to i64
  %235 = call i64 @llvm.expect.i64(i64 %234, i64 0)
  %236 = icmp ne i64 %235, 0
  br i1 %236, label %237, label %239

237:                                              ; preds = %226
  %238 = load i32, ptr %7, align 4, !tbaa !5
  call void @error(ptr noundef @.str.19, i32 noundef %238)
  store i32 6, ptr %19, align 4
  br label %431

239:                                              ; preds = %226
  %240 = load i8, ptr @rescue, align 1, !tbaa !11, !range !30, !noundef !31
  %241 = trunc i8 %240 to i1
  br i1 %241, label %242, label %257

242:                                              ; preds = %239
  %243 = load ptr, ptr %20, align 8, !tbaa !9
  %244 = call i32 @mdbx_cursor_ignord(ptr noundef %243)
  store i32 %244, ptr %7, align 4, !tbaa !5
  %245 = load i32, ptr %7, align 4, !tbaa !5
  %246 = icmp ne i32 %245, 0
  %247 = xor i1 %246, true
  %248 = xor i1 %247, true
  %249 = zext i1 %248 to i32
  %250 = sext i32 %249 to i64
  %251 = call i64 @llvm.expect.i64(i64 %250, i64 0)
  %252 = icmp ne i64 %251, 0
  br i1 %252, label %253, label %256

253:                                              ; preds = %242
  %254 = load i32, ptr %7, align 4, !tbaa !5
  call void @error(ptr noundef @.str.20, i32 noundef %254)
  %255 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %255, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %431

256:                                              ; preds = %242
  br label %257

257:                                              ; preds = %256, %239
  call void @llvm.lifetime.start.p0(i64 1, ptr %21) #10
  store i8 0, ptr %21, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #10
  store i32 0, ptr %22, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %23) #10
  br label %258

258:                                              ; preds = %405, %403, %273, %257
  %259 = load ptr, ptr %20, align 8, !tbaa !9
  %260 = call i32 @mdbx_cursor_get(ptr noundef %259, ptr noundef %23, ptr noundef null, i32 noundef 11)
  store i32 %260, ptr %7, align 4, !tbaa !5
  %261 = icmp eq i32 0, %260
  br i1 %261, label %262, label %406

262:                                              ; preds = %258
  %263 = load volatile i32, ptr @user_break, align 4, !tbaa !5
  %264 = icmp ne i32 %263, 0
  br i1 %264, label %265, label %266

265:                                              ; preds = %262
  store i32 4, ptr %7, align 4, !tbaa !5
  br label %406

266:                                              ; preds = %262
  %267 = getelementptr inbounds %struct.iovec, ptr %23, i32 0, i32 0
  %268 = load ptr, ptr %267, align 8, !tbaa !34
  %269 = getelementptr inbounds %struct.iovec, ptr %23, i32 0, i32 1
  %270 = load i64, ptr %269, align 8, !tbaa !37
  %271 = call ptr @memchr(ptr noundef %268, i32 noundef 0, i64 noundef %270) #13
  %272 = icmp ne ptr %271, null
  br i1 %272, label %273, label %274

273:                                              ; preds = %266
  br label %258, !llvm.loop !38

274:                                              ; preds = %266
  %275 = load ptr, ptr %13, align 8, !tbaa !9
  %276 = getelementptr inbounds %struct.iovec, ptr %23, i32 0, i32 1
  %277 = load i64, ptr %276, align 8, !tbaa !37
  %278 = add i64 %277, 1
  %279 = call ptr @realloc(ptr noundef %275, i64 noundef %278) #14
  store ptr %279, ptr %12, align 8, !tbaa !9
  %280 = load ptr, ptr %12, align 8, !tbaa !9
  %281 = icmp ne ptr %280, null
  br i1 %281, label %283, label %282

282:                                              ; preds = %274
  store i32 12, ptr %7, align 4, !tbaa !5
  br label %406

283:                                              ; preds = %274
  %284 = load ptr, ptr %12, align 8, !tbaa !9
  store ptr %284, ptr %13, align 8, !tbaa !9
  %285 = load ptr, ptr %12, align 8, !tbaa !9
  %286 = getelementptr inbounds %struct.iovec, ptr %23, i32 0, i32 0
  %287 = load ptr, ptr %286, align 8, !tbaa !34
  %288 = getelementptr inbounds %struct.iovec, ptr %23, i32 0, i32 1
  %289 = load i64, ptr %288, align 8, !tbaa !37
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %285, ptr align 1 %287, i64 %289, i1 false)
  %290 = load ptr, ptr %12, align 8, !tbaa !9
  %291 = getelementptr inbounds %struct.iovec, ptr %23, i32 0, i32 1
  %292 = load i64, ptr %291, align 8, !tbaa !37
  %293 = getelementptr inbounds i8, ptr %290, i64 %292
  store i8 0, ptr %293, align 1, !tbaa !39
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #10
  %294 = load ptr, ptr %9, align 8, !tbaa !9
  %295 = load ptr, ptr %12, align 8, !tbaa !9
  %296 = load i8, ptr @rescue, align 1, !tbaa !11, !range !30, !noundef !31
  %297 = trunc i8 %296 to i1
  %298 = zext i1 %297 to i64
  %299 = select i1 %297, ptr @equal_or_greater, ptr null
  %300 = load i8, ptr @rescue, align 1, !tbaa !11, !range !30, !noundef !31
  %301 = trunc i8 %300 to i1
  %302 = zext i1 %301 to i64
  %303 = select i1 %301, ptr @equal_or_greater, ptr null
  %304 = call i32 @mdbx_dbi_open_ex(ptr noundef %294, ptr noundef %295, i32 noundef 1073741824, ptr noundef %24, ptr noundef %299, ptr noundef %303)
  store i32 %304, ptr %7, align 4, !tbaa !5
  %305 = load i32, ptr %7, align 4, !tbaa !5
  %306 = icmp ne i32 %305, 0
  %307 = xor i1 %306, true
  %308 = xor i1 %307, true
  %309 = zext i1 %308 to i32
  %310 = sext i32 %309 to i64
  %311 = call i64 @llvm.expect.i64(i64 %310, i64 0)
  %312 = icmp ne i64 %311, 0
  br i1 %312, label %313, label %323

313:                                              ; preds = %283
  %314 = load i32, ptr %7, align 4, !tbaa !5
  %315 = icmp eq i32 %314, -30784
  br i1 %315, label %316, label %317

316:                                              ; preds = %313
  store i8 1, ptr %21, align 1, !tbaa !11
  store i32 7, ptr %19, align 4
  br label %403, !llvm.loop !38

317:                                              ; preds = %313
  %318 = load i32, ptr %7, align 4, !tbaa !5
  call void @error(ptr noundef @.str.16, i32 noundef %318)
  %319 = load i8, ptr @rescue, align 1, !tbaa !11, !range !30, !noundef !31
  %320 = trunc i8 %319 to i1
  br i1 %320, label %322, label %321

321:                                              ; preds = %317
  store i32 8, ptr %19, align 4
  br label %403

322:                                              ; preds = %317
  br label %402

323:                                              ; preds = %283
  %324 = load i32, ptr %22, align 4, !tbaa !5
  %325 = add nsw i32 %324, 1
  store i32 %325, ptr %22, align 4, !tbaa !5
  %326 = load i8, ptr %16, align 1, !tbaa !11, !range !30, !noundef !31
  %327 = trunc i8 %326 to i1
  br i1 %327, label %328, label %331

328:                                              ; preds = %323
  %329 = load ptr, ptr %12, align 8, !tbaa !9
  %330 = call i32 (ptr, ...) @printf(ptr noundef @.str.21, ptr noundef %329)
  br label %387

331:                                              ; preds = %323
  %332 = load ptr, ptr %9, align 8, !tbaa !9
  %333 = load i32, ptr %24, align 4, !tbaa !5
  %334 = load ptr, ptr %12, align 8, !tbaa !9
  %335 = call i32 @dump_tbl(ptr noundef %332, i32 noundef %333, ptr noundef %334)
  store i32 %335, ptr %7, align 4, !tbaa !5
  %336 = load i32, ptr %7, align 4, !tbaa !5
  %337 = icmp ne i32 %336, 0
  %338 = xor i1 %337, true
  %339 = xor i1 %338, true
  %340 = zext i1 %339 to i32
  %341 = sext i32 %340 to i64
  %342 = call i64 @llvm.expect.i64(i64 %341, i64 0)
  %343 = icmp ne i64 %342, 0
  br i1 %343, label %344, label %386

344:                                              ; preds = %331
  %345 = load i8, ptr @rescue, align 1, !tbaa !11, !range !30, !noundef !31
  %346 = trunc i8 %345 to i1
  br i1 %346, label %348, label %347

347:                                              ; preds = %344
  store i32 8, ptr %19, align 4
  br label %403

348:                                              ; preds = %344
  %349 = load i8, ptr @quiet, align 1, !tbaa !11, !range !30, !noundef !31
  %350 = trunc i8 %349 to i1
  br i1 %350, label %359, label %351

351:                                              ; preds = %348
  %352 = load ptr, ptr @stderr, align 8, !tbaa !9
  %353 = load ptr, ptr @prog, align 8, !tbaa !9
  %354 = load ptr, ptr %11, align 8, !tbaa !9
  %355 = load i32, ptr %7, align 4, !tbaa !5
  %356 = call ptr @mdbx_strerror(i32 noundef %355)
  %357 = load ptr, ptr %12, align 8, !tbaa !9
  %358 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %352, ptr noundef @.str.22, ptr noundef %353, ptr noundef %354, ptr noundef %356, ptr noundef %357) #10
  br label %359

359:                                              ; preds = %351, %348
  %360 = load ptr, ptr %9, align 8, !tbaa !9
  %361 = call i32 @mdbx_txn_reset(ptr noundef %360)
  store i32 %361, ptr %7, align 4, !tbaa !5
  %362 = load i32, ptr %7, align 4, !tbaa !5
  %363 = icmp ne i32 %362, 0
  %364 = xor i1 %363, true
  %365 = xor i1 %364, true
  %366 = zext i1 %365 to i32
  %367 = sext i32 %366 to i64
  %368 = call i64 @llvm.expect.i64(i64 %367, i64 0)
  %369 = icmp ne i64 %368, 0
  br i1 %369, label %370, label %372

370:                                              ; preds = %359
  %371 = load i32, ptr %7, align 4, !tbaa !5
  call void @error(ptr noundef @.str.23, i32 noundef %371)
  store i32 5, ptr %19, align 4
  br label %403

372:                                              ; preds = %359
  %373 = load ptr, ptr %9, align 8, !tbaa !9
  %374 = call i32 @mdbx_txn_renew(ptr noundef %373)
  store i32 %374, ptr %7, align 4, !tbaa !5
  %375 = load i32, ptr %7, align 4, !tbaa !5
  %376 = icmp ne i32 %375, 0
  %377 = xor i1 %376, true
  %378 = xor i1 %377, true
  %379 = zext i1 %378 to i32
  %380 = sext i32 %379 to i64
  %381 = call i64 @llvm.expect.i64(i64 %380, i64 0)
  %382 = icmp ne i64 %381, 0
  br i1 %382, label %383, label %385

383:                                              ; preds = %372
  %384 = load i32, ptr %7, align 4, !tbaa !5
  call void @error(ptr noundef @.str.24, i32 noundef %384)
  store i32 5, ptr %19, align 4
  br label %403

385:                                              ; preds = %372
  br label %386

386:                                              ; preds = %385, %331
  br label %387

387:                                              ; preds = %386, %328
  %388 = load ptr, ptr %8, align 8, !tbaa !9
  %389 = load i32, ptr %24, align 4, !tbaa !5
  %390 = call i32 @mdbx_dbi_close(ptr noundef %388, i32 noundef %389)
  store i32 %390, ptr %7, align 4, !tbaa !5
  %391 = load i32, ptr %7, align 4, !tbaa !5
  %392 = icmp ne i32 %391, 0
  %393 = xor i1 %392, true
  %394 = xor i1 %393, true
  %395 = zext i1 %394 to i32
  %396 = sext i32 %395 to i64
  %397 = call i64 @llvm.expect.i64(i64 %396, i64 0)
  %398 = icmp ne i64 %397, 0
  br i1 %398, label %399, label %401

399:                                              ; preds = %387
  %400 = load i32, ptr %7, align 4, !tbaa !5
  call void @error(ptr noundef @.str.25, i32 noundef %400)
  store i32 8, ptr %19, align 4
  br label %403

401:                                              ; preds = %387
  br label %402

402:                                              ; preds = %401, %322
  store i32 0, ptr %19, align 4
  br label %403

403:                                              ; preds = %402, %399, %383, %370, %347, %321, %316
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #10
  %404 = load i32, ptr %19, align 4
  switch i32 %404, label %430 [
    i32 0, label %405
    i32 7, label %258
    i32 8, label %406
  ]

405:                                              ; preds = %403
  br label %258, !llvm.loop !38

406:                                              ; preds = %403, %282, %265, %258
  %407 = load ptr, ptr %20, align 8, !tbaa !9
  call void @mdbx_cursor_close(ptr noundef %407)
  store ptr null, ptr %20, align 8, !tbaa !9
  %408 = load i8, ptr %21, align 1, !tbaa !11, !range !30, !noundef !31
  %409 = trunc i8 %408 to i1
  br i1 %409, label %410, label %416

410:                                              ; preds = %406
  %411 = load i32, ptr %22, align 4, !tbaa !5
  %412 = icmp ne i32 %411, 0
  br i1 %412, label %416, label %413

413:                                              ; preds = %410
  %414 = load ptr, ptr %9, align 8, !tbaa !9
  %415 = call i32 @dump_tbl(ptr noundef %414, i32 noundef 1, ptr noundef null)
  store i32 %415, ptr %7, align 4, !tbaa !5
  br label %429

416:                                              ; preds = %410, %406
  %417 = load i32, ptr %22, align 4, !tbaa !5
  %418 = icmp ne i32 %417, 0
  br i1 %418, label %428, label %419

419:                                              ; preds = %416
  %420 = load i8, ptr @quiet, align 1, !tbaa !11, !range !30, !noundef !31
  %421 = trunc i8 %420 to i1
  br i1 %421, label %427, label %422

422:                                              ; preds = %419
  %423 = load ptr, ptr @stderr, align 8, !tbaa !9
  %424 = load ptr, ptr @prog, align 8, !tbaa !9
  %425 = load ptr, ptr %11, align 8, !tbaa !9
  %426 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %423, ptr noundef @.str.26, ptr noundef %424, ptr noundef %425) #10
  br label %427

427:                                              ; preds = %422, %419
  store i32 -30798, ptr %7, align 4, !tbaa !5
  br label %428

428:                                              ; preds = %427, %416
  br label %429

429:                                              ; preds = %428, %413
  store i32 0, ptr %19, align 4
  br label %430

430:                                              ; preds = %429, %403
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr %21) #10
  br label %431

431:                                              ; preds = %430, %253, %237
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #10
  %432 = load i32, ptr %19, align 4
  switch i32 %432, label %476 [
    i32 0, label %433
    i32 6, label %465
    i32 5, label %468
  ]

433:                                              ; preds = %431
  br label %439

434:                                              ; preds = %218
  %435 = load ptr, ptr %9, align 8, !tbaa !9
  %436 = load i32, ptr %10, align 4, !tbaa !5
  %437 = load ptr, ptr %12, align 8, !tbaa !9
  %438 = call i32 @dump_tbl(ptr noundef %435, i32 noundef %436, ptr noundef %437)
  store i32 %438, ptr %7, align 4, !tbaa !5
  br label %439

439:                                              ; preds = %434, %433
  %440 = load i32, ptr %7, align 4, !tbaa !5
  switch i32 %440, label %449 [
    i32 -30798, label %441
    i32 0, label %461
    i32 4, label %442
  ]

441:                                              ; preds = %439
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %461

442:                                              ; preds = %439
  %443 = load i8, ptr @quiet, align 1, !tbaa !11, !range !30, !noundef !31
  %444 = trunc i8 %443 to i1
  br i1 %444, label %448, label %445

445:                                              ; preds = %442
  %446 = load ptr, ptr @stderr, align 8, !tbaa !9
  %447 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %446, ptr noundef @.str.27) #10
  br label %448

448:                                              ; preds = %445, %442
  br label %461

449:                                              ; preds = %439
  %450 = load i32, ptr %7, align 4, !tbaa !5
  %451 = icmp ne i32 %450, 0
  %452 = xor i1 %451, true
  %453 = xor i1 %452, true
  %454 = zext i1 %453 to i32
  %455 = sext i32 %454 to i64
  %456 = call i64 @llvm.expect.i64(i64 %455, i64 0)
  %457 = icmp ne i64 %456, 0
  br i1 %457, label %458, label %460

458:                                              ; preds = %449
  %459 = load i32, ptr %7, align 4, !tbaa !5
  call void @error(ptr noundef @.str.28, i32 noundef %459)
  br label %460

460:                                              ; preds = %458, %449
  br label %461

461:                                              ; preds = %460, %448, %441, %439
  %462 = load ptr, ptr %8, align 8, !tbaa !9
  %463 = load i32, ptr %10, align 4, !tbaa !5
  %464 = call i32 @mdbx_dbi_close(ptr noundef %462, i32 noundef %463)
  br label %465

465:                                              ; preds = %461, %431, %216
  %466 = load ptr, ptr %9, align 8, !tbaa !9
  %467 = call i32 @mdbx_txn_abort(ptr noundef %466)
  br label %468

468:                                              ; preds = %465, %431, %202, %188, %174, %153
  %469 = load ptr, ptr %8, align 8, !tbaa !9
  %470 = call i32 @mdbx_env_close(ptr noundef %469)
  %471 = load ptr, ptr %13, align 8, !tbaa !9
  call void @free(ptr noundef %471) #10
  %472 = load i32, ptr %7, align 4, !tbaa !5
  %473 = icmp ne i32 %472, 0
  %474 = zext i1 %473 to i64
  %475 = select i1 %473, i32 1, i32 0
  store i32 %475, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %476

476:                                              ; preds = %468, %431, %134, %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr %16) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #10
  call void @llvm.lifetime.end.p0(i64 4, 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
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #10
  %477 = load i32, ptr %3, align 4
  ret i32 %477
}

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

; Function Attrs: nounwind uwtable
declare hidden void @usage() #0

; Function Attrs: nounwind
declare i32 @getopt(i32 noundef, ptr noundef, ptr noundef) #2

declare i32 @printf(ptr noundef, ...) #3

declare ptr @freopen64(ptr noundef, ptr noundef, ptr noundef) #3

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #2

declare ptr @mdbx_strerror(i32 noundef) #3

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__errno_location() #4

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #5

; Function Attrs: nounwind
declare ptr @signal(i32 noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @signal_handler(i32 noundef) #0

declare i32 @fflush(ptr noundef) #3

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

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

declare i32 @mdbx_env_create(ptr noundef) #3

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

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

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

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

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

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #5

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

declare i32 @mdbx_cursor_ignord(ptr noundef) #3

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

; Function Attrs: nounwind willreturn memory(read)
declare ptr @memchr(ptr noundef, i32 noundef, i64 noundef) #7

; Function Attrs: nounwind allocsize(1)
declare ptr @realloc(ptr noundef, i64 noundef) #8

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #9

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

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

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

declare i32 @mdbx_txn_reset(ptr noundef) #3

declare i32 @mdbx_txn_renew(ptr noundef) #3

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

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

declare void @mdbx_cursor_close(ptr noundef) #3

declare i32 @mdbx_txn_abort(ptr noundef) #3

declare i32 @mdbx_env_close(ptr noundef) #3

; Function Attrs: nounwind
declare void @free(ptr noundef) #2

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 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 #5 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #7 = { nounwind willreturn memory(read) "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 = { nounwind allocsize(1) "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #10 = { nounwind }
attributes #11 = { nounwind willreturn memory(none) }
attributes #12 = { noreturn nounwind }
attributes #13 = { nounwind willreturn memory(read) }
attributes #14 = { nounwind allocsize(1) }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{!14, !15, i64 0}
!14 = !{!"MDBX_version_info", !15, i64 0, !15, i64 2, !15, i64 4, !15, i64 6, !10, i64 8, !16, i64 16, !10, i64 48}
!15 = !{!"short", !7, i64 0}
!16 = !{!"", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!17 = !{!14, !15, i64 2}
!18 = !{!14, !15, i64 4}
!19 = !{!14, !15, i64 6}
!20 = !{!14, !10, i64 40}
!21 = !{!14, !10, i64 16}
!22 = !{!14, !10, i64 32}
!23 = !{!14, !10, i64 24}
!24 = !{!25, !10, i64 0}
!25 = !{!"MDBX_build_info", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40}
!26 = !{!25, !10, i64 8}
!27 = !{!25, !10, i64 24}
!28 = !{!25, !10, i64 32}
!29 = !{!25, !10, i64 16}
!30 = !{i8 0, i8 2}
!31 = !{}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}
!34 = !{!35, !10, i64 0}
!35 = !{!"iovec", !10, i64 0, !36, i64 8}
!36 = !{!"long", !7, i64 0}
!37 = !{!35, !36, i64 8}
!38 = distinct !{!38, !33}
!39 = !{!7, !7, i64 0}


; 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.MDBX_version_info = type { i16, i16, i16, i16, ptr, %struct.anon, ptr }
%struct.anon = type { ptr, ptr, ptr, ptr }
%struct.MDBX_build_info = type { ptr, ptr, ptr, ptr, ptr, ptr }
%struct.iovec = type { ptr, i64 }

@quiet = external dso_local local_unnamed_addr global i8, align 1
@rescue = external dso_local local_unnamed_addr global i8, align 1
@prog = external dso_local local_unnamed_addr global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [136 x i8], align 1
@mdbx_version = external local_unnamed_addr constant %struct.MDBX_version_info, align 8
@mdbx_sourcery_MDBX_BUILD_SOURCERY = external local_unnamed_addr constant ptr, align 8
@mdbx_build = external local_unnamed_addr constant %struct.MDBX_build_info, align 8
@optarg = external local_unnamed_addr global ptr, align 8
@.str.8 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@stderr = external local_unnamed_addr global ptr, align 8
@.str.9 = external hidden unnamed_addr constant [20 x i8], align 1
@mode = external hidden local_unnamed_addr global i32, align 4
@optind = external local_unnamed_addr global i32, align 4
@.str.10 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [66 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [23 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [19 x i8], align 1
@user_break = external hidden global i32, align 4
@.str.21 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [16 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca %struct.iovec, align 8
  %8 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #11
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #11
  %9 = load ptr, ptr %1, align 8, !tbaa !5
  store ptr %9, ptr @prog, align 8, !tbaa !5
  %10 = icmp slt i32 %0, 2
  br i1 %10, label %11, label %.preheader

11:                                               ; preds = %2
  tail call void @usage()
  br label %.preheader

.preheader:                                       ; preds = %11, %2
  br label %12

12:                                               ; preds = %.backedge, %.preheader
  %.097 = phi ptr [ null, %.preheader ], [ %.097.be, %.backedge ]
  %.089 = phi i8 [ 0, %.preheader ], [ %.089.be, %.backedge ]
  %.086 = phi i1 [ false, %.preheader ], [ %.086.be, %.backedge ]
  %.084 = phi i1 [ false, %.preheader ], [ %.084.be, %.backedge ]
  %.082 = phi i32 [ 0, %.preheader ], [ %.082.be, %.backedge ]
  %13 = tail call i32 @getopt(i32 noundef %0, ptr noundef nonnull %1, ptr noundef nonnull @.str.6) #11
  switch i32 %13, label %65 [
    i32 -1, label %66
    i32 86, label %14
    i32 108, label %34
    i32 97, label %35
    i32 102, label %37
    i32 110, label %.backedge
    i32 99, label %50
    i32 112, label %53
    i32 115, label %56
    i32 113, label %61
    i32 114, label %62
    i32 117, label %63
    i32 85, label %64
  ]

14:                                               ; preds = %12
  %15 = load i16, ptr @mdbx_version, align 8, !tbaa !9
  %16 = zext i16 %15 to i32
  %17 = load i16, ptr getelementptr inbounds (i8, ptr @mdbx_version, i64 2), align 2, !tbaa !13
  %18 = zext i16 %17 to i32
  %19 = load i16, ptr getelementptr inbounds (i8, ptr @mdbx_version, i64 4), align 4, !tbaa !14
  %20 = zext i16 %19 to i32
  %21 = load i16, ptr getelementptr inbounds (i8, ptr @mdbx_version, i64 6), align 2, !tbaa !15
  %22 = zext i16 %21 to i32
  %23 = load ptr, ptr getelementptr inbounds (i8, ptr @mdbx_version, i64 40), align 8, !tbaa !16
  %24 = load ptr, ptr getelementptr inbounds (i8, ptr @mdbx_version, i64 16), align 8, !tbaa !17
  %25 = load ptr, ptr getelementptr inbounds (i8, ptr @mdbx_version, i64 32), align 8, !tbaa !18
  %26 = load ptr, ptr getelementptr inbounds (i8, ptr @mdbx_version, i64 24), align 8, !tbaa !19
  %27 = load ptr, ptr @mdbx_sourcery_MDBX_BUILD_SOURCERY, align 8, !tbaa !5
  %28 = load ptr, ptr @mdbx_build, align 8, !tbaa !20
  %29 = load ptr, ptr getelementptr inbounds (i8, ptr @mdbx_build, i64 8), align 8, !tbaa !22
  %30 = load ptr, ptr getelementptr inbounds (i8, ptr @mdbx_build, i64 24), align 8, !tbaa !23
  %31 = load ptr, ptr getelementptr inbounds (i8, ptr @mdbx_build, i64 32), align 8, !tbaa !24
  %32 = load ptr, ptr getelementptr inbounds (i8, ptr @mdbx_build, i64 16), align 8, !tbaa !25
  %33 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %16, i32 noundef %18, i32 noundef %20, i32 noundef %22, ptr noundef %23, ptr noundef %24, ptr noundef %25, ptr noundef %26, ptr noundef %27, ptr noundef %28, ptr noundef %29, ptr noundef %30, ptr noundef %31, ptr noundef %32)
  br label %228

34:                                               ; preds = %12
  br label %35

35:                                               ; preds = %12, %34
  %.187 = phi i1 [ true, %34 ], [ %.086, %12 ]
  %.not142 = icmp eq ptr %.097, null
  br i1 %.not142, label %.backedge, label %36

.backedge:                                        ; preds = %35, %36, %12, %37, %65, %64, %63, %62, %61, %59, %53, %50
  %.097.be = phi ptr [ %.097, %65 ], [ %.097, %64 ], [ %.097, %63 ], [ %.097, %62 ], [ %.097, %61 ], [ %60, %59 ], [ %.097, %53 ], [ %.097, %50 ], [ %.097, %37 ], [ %.097, %12 ], [ %.097, %36 ], [ null, %35 ]
  %.089.be = phi i8 [ %.089, %65 ], [ %.089, %64 ], [ %.089, %63 ], [ %.089, %62 ], [ %.089, %61 ], [ %.089, %59 ], [ %.089, %53 ], [ %.089, %50 ], [ %.089, %37 ], [ %.089, %12 ], [ 1, %36 ], [ 1, %35 ]
  %.086.be = phi i1 [ %.086, %65 ], [ %.086, %64 ], [ %.086, %63 ], [ %.086, %62 ], [ %.086, %61 ], [ %.086, %59 ], [ %.086, %53 ], [ %.086, %50 ], [ %.086, %37 ], [ %.086, %12 ], [ %.187, %36 ], [ %.187, %35 ]
  %.084.be = phi i1 [ %.084, %65 ], [ true, %64 ], [ true, %63 ], [ %.084, %62 ], [ %.084, %61 ], [ %.084, %59 ], [ %.084, %53 ], [ %.084, %50 ], [ %.084, %37 ], [ %.084, %12 ], [ %.084, %36 ], [ %.084, %35 ]
  %.082.be = phi i32 [ %.082, %65 ], [ 13, %64 ], [ %.082, %63 ], [ %.082, %62 ], [ %.082, %61 ], [ %.082, %59 ], [ %.082, %53 ], [ %.082, %50 ], [ %.082, %37 ], [ %.082, %12 ], [ %.082, %36 ], [ %.082, %35 ]
  br label %12, !llvm.loop !26

36:                                               ; preds = %35
  tail call void @usage()
  br label %.backedge

37:                                               ; preds = %12
  %38 = load ptr, ptr @optarg, align 8, !tbaa !5
  %39 = load ptr, ptr @stdout, align 8, !tbaa !5
  %40 = tail call ptr @freopen64(ptr noundef %38, ptr noundef nonnull @.str.8, ptr noundef %39) #11
  %41 = icmp eq ptr %40, null
  br i1 %41, label %42, label %.backedge

42:                                               ; preds = %37
  %43 = load ptr, ptr @stderr, align 8, !tbaa !5
  %44 = load ptr, ptr @prog, align 8, !tbaa !5
  %45 = load ptr, ptr @optarg, align 8, !tbaa !5
  %46 = tail call ptr @__errno_location() #12
  %47 = load i32, ptr %46, align 4, !tbaa !28
  %48 = tail call ptr @mdbx_strerror(i32 noundef %47) #11
  %49 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %43, ptr noundef nonnull @.str.9, ptr noundef %44, ptr noundef %45, ptr noundef %48) #13
  tail call void @exit(i32 noundef 1) #14
  unreachable

50:                                               ; preds = %12
  %51 = load i32, ptr @mode, align 4, !tbaa !28
  %52 = or i32 %51, 4
  store i32 %52, ptr @mode, align 4, !tbaa !28
  br label %.backedge

53:                                               ; preds = %12
  %54 = load i32, ptr @mode, align 4, !tbaa !28
  %55 = or i32 %54, 1
  store i32 %55, ptr @mode, align 4, !tbaa !28
  br label %.backedge

56:                                               ; preds = %12
  %57 = trunc nuw i8 %.089 to i1
  br i1 %57, label %58, label %59

58:                                               ; preds = %56
  tail call void @usage()
  br label %59

59:                                               ; preds = %58, %56
  %60 = load ptr, ptr @optarg, align 8, !tbaa !5
  br label %.backedge

61:                                               ; preds = %12
  store i8 1, ptr @quiet, align 1, !tbaa !30
  br label %.backedge

62:                                               ; preds = %12
  store i8 1, ptr @rescue, align 1, !tbaa !30
  br label %.backedge

63:                                               ; preds = %12
  br label %.backedge

64:                                               ; preds = %12
  br label %.backedge

65:                                               ; preds = %12
  tail call void @usage()
  br label %.backedge

66:                                               ; preds = %12
  %67 = load i32, ptr @optind, align 4, !tbaa !28
  %68 = add nsw i32 %0, -1
  %.not124 = icmp eq i32 %67, %68
  br i1 %.not124, label %70, label %69

69:                                               ; preds = %66
  tail call void @usage()
  br label %70

70:                                               ; preds = %69, %66
  %71 = tail call ptr @signal(i32 noundef 13, ptr noundef nonnull @signal_handler) #11
  %72 = tail call ptr @signal(i32 noundef 1, ptr noundef nonnull @signal_handler) #11
  %73 = tail call ptr @signal(i32 noundef 2, ptr noundef nonnull @signal_handler) #11
  %74 = tail call ptr @signal(i32 noundef 15, ptr noundef nonnull @signal_handler) #11
  %75 = load i32, ptr @optind, align 4, !tbaa !28
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds ptr, ptr %1, i64 %76
  %78 = load ptr, ptr %77, align 8, !tbaa !5
  %79 = load i8, ptr @quiet, align 1, !tbaa !30, !range !32, !noundef !33
  %80 = trunc nuw i8 %79 to i1
  br i1 %80, label %89, label %81

81:                                               ; preds = %70
  %82 = load ptr, ptr @stderr, align 8, !tbaa !5
  %83 = load ptr, ptr getelementptr inbounds (i8, ptr @mdbx_version, i64 40), align 8, !tbaa !16
  %84 = load ptr, ptr getelementptr inbounds (i8, ptr @mdbx_version, i64 16), align 8, !tbaa !17
  %85 = load ptr, ptr getelementptr inbounds (i8, ptr @mdbx_version, i64 24), align 8, !tbaa !19
  %86 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %82, ptr noundef nonnull @.str.10, ptr noundef %83, ptr noundef %84, ptr noundef %85, ptr noundef %78) #13
  %87 = tail call i32 @fflush(ptr noundef null)
  %88 = tail call i32 @mdbx_setup_debug(i32 noundef 3, i32 noundef -1, ptr noundef nonnull @logger) #11
  br label %89

89:                                               ; preds = %81, %70
  %90 = call i32 @mdbx_env_create(ptr noundef nonnull %3) #11
  %.not125 = icmp eq i32 %90, 0
  br i1 %.not125, label %92, label %91, !prof !34

91:                                               ; preds = %89
  call void @error(ptr noundef nonnull @.str.11, i32 noundef %90)
  br label %228

92:                                               ; preds = %89
  %93 = trunc nuw i8 %.089 to i1
  %94 = icmp ne ptr %.097, null
  %or.cond = select i1 %93, i1 true, i1 %94
  br i1 %or.cond, label %95, label %99

95:                                               ; preds = %92
  %96 = load ptr, ptr %3, align 8, !tbaa !5
  %97 = call i32 @mdbx_env_set_maxdbs(ptr noundef %96, i32 noundef 2) #11
  %.not126 = icmp eq i32 %97, 0
  br i1 %.not126, label %99, label %98, !prof !34

98:                                               ; preds = %95
  call void @error(ptr noundef nonnull @.str.12, i32 noundef %97)
  br label %224

99:                                               ; preds = %95, %92
  %100 = load ptr, ptr %3, align 8, !tbaa !5
  %101 = load i8, ptr @rescue, align 1, !tbaa !30, !range !32, !noundef !33
  %102 = trunc nuw i8 %101 to i1
  %103 = select i1 %102, i32 4333568, i32 131072
  %104 = call i32 @mdbx_env_open(ptr noundef %100, ptr noundef %78, i32 noundef %103, i32 noundef 0) #11
  %.not127 = icmp eq i32 %104, 0
  br i1 %.not127, label %106, label %105, !prof !34

105:                                              ; preds = %99
  call void @error(ptr noundef nonnull @.str.13, i32 noundef %104)
  br label %224

106:                                              ; preds = %99
  br i1 %.084, label %107, label %112

107:                                              ; preds = %106
  %108 = load ptr, ptr %3, align 8, !tbaa !5
  %109 = call i32 @mdbx_env_warmup(ptr noundef %108, ptr noundef null, i32 noundef %.082, i32 noundef 235929600) #11
  %110 = add i32 %109, -1
  %or.cond3 = icmp ult i32 %110, -2
  br i1 %or.cond3, label %111, label %112

111:                                              ; preds = %107
  call void @error(ptr noundef nonnull @.str.14, i32 noundef %109)
  br label %224

112:                                              ; preds = %107, %106
  %113 = load ptr, ptr %3, align 8, !tbaa !5
  %114 = call i32 @mdbx_txn_begin(ptr noundef %113, ptr noundef null, i32 noundef 131072, ptr noundef nonnull %4) #11
  %.not128 = icmp eq i32 %114, 0
  br i1 %.not128, label %116, label %115, !prof !34

115:                                              ; preds = %112
  call void @error(ptr noundef nonnull @.str.15, i32 noundef %114)
  br label %224

116:                                              ; preds = %112
  %117 = load ptr, ptr %4, align 8, !tbaa !5
  %118 = call i32 @mdbx_dbi_open(ptr noundef %117, ptr noundef %.097, i32 noundef 1073741824, ptr noundef nonnull %5) #11
  %.not129 = icmp eq i32 %118, 0
  br i1 %.not129, label %120, label %119, !prof !34

119:                                              ; preds = %116
  call void @error(ptr noundef nonnull @.str.16, i32 noundef %118)
  br label %221

120:                                              ; preds = %116
  br i1 %93, label %121, label %205

121:                                              ; preds = %120
  %122 = load i32, ptr %5, align 4, !tbaa !28
  %123 = icmp eq i32 %122, 1
  br i1 %123, label %125, label %124

124:                                              ; preds = %121
  call void @__assert_fail(ptr noundef nonnull @.str.17, ptr noundef nonnull @.str.18, i32 noundef 388, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #14
  unreachable

125:                                              ; preds = %121
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #11
  %126 = load ptr, ptr %4, align 8, !tbaa !5
  %127 = call i32 @mdbx_cursor_open(ptr noundef %126, i32 noundef 1, ptr noundef nonnull %6) #11
  %.not130 = icmp eq i32 %127, 0
  br i1 %.not130, label %128, label %.thread159, !prof !34

.thread159:                                       ; preds = %125
  call void @error(ptr noundef nonnull @.str.19, i32 noundef %127)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #11
  br label %221

128:                                              ; preds = %125
  %129 = load i8, ptr @rescue, align 1, !tbaa !30, !range !32, !noundef !33
  %130 = trunc nuw i8 %129 to i1
  br i1 %130, label %131, label %134

131:                                              ; preds = %128
  %132 = load ptr, ptr %6, align 8, !tbaa !5
  %133 = call i32 @mdbx_cursor_ignord(ptr noundef %132) #11
  %.not131 = icmp eq i32 %133, 0
  br i1 %.not131, label %134, label %.thread154, !prof !34

.thread154:                                       ; preds = %131
  call void @error(ptr noundef nonnull @.str.20, i32 noundef %133)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #11
  br label %228

134:                                              ; preds = %131, %128
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #11
  %135 = getelementptr inbounds i8, ptr %7, i64 8
  br label %.outer

.outer:                                           ; preds = %select.unfold, %134
  %.093.ph = phi ptr [ %148, %select.unfold ], [ null, %134 ]
  %.076.ph = phi i1 [ %.177, %select.unfold ], [ false, %134 ]
  %.0.ph = phi i32 [ %.2, %select.unfold ], [ 0, %134 ]
  br label %136

136:                                              ; preds = %.outer, %142
  %137 = load ptr, ptr %6, align 8, !tbaa !5
  %138 = call i32 @mdbx_cursor_get(ptr noundef %137, ptr noundef nonnull %7, ptr noundef null, i32 noundef 11) #11
  %139 = icmp eq i32 %138, 0
  br i1 %139, label %140, label %.loopexit

140:                                              ; preds = %136
  %141 = load volatile i32, ptr @user_break, align 4, !tbaa !28
  %.not132 = icmp eq i32 %141, 0
  br i1 %.not132, label %142, label %.loopexit

142:                                              ; preds = %140
  %143 = load ptr, ptr %7, align 8, !tbaa !35
  %144 = load i64, ptr %135, align 8, !tbaa !38
  %145 = call ptr @memchr(ptr noundef %143, i32 noundef 0, i64 noundef %144) #15
  %.not133 = icmp eq ptr %145, null
  br i1 %.not133, label %146, label %136, !llvm.loop !39

146:                                              ; preds = %142
  %147 = add i64 %144, 1
  %148 = call ptr @realloc(ptr noundef %.093.ph, i64 noundef %147) #16
  %.not134 = icmp eq ptr %148, null
  br i1 %.not134, label %.loopexit, label %149

149:                                              ; preds = %146
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %148, ptr align 1 %143, i64 %144, i1 false)
  %150 = getelementptr inbounds i8, ptr %148, i64 %144
  store i8 0, ptr %150, align 1, !tbaa !40
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #11
  %151 = load ptr, ptr %4, align 8, !tbaa !5
  %152 = load i8, ptr @rescue, align 1, !tbaa !30, !range !32, !noundef !33
  %153 = trunc nuw i8 %152 to i1
  %154 = select i1 %153, ptr @equal_or_greater, ptr null
  %155 = call i32 @mdbx_dbi_open_ex(ptr noundef %151, ptr noundef nonnull %148, i32 noundef 1073741824, ptr noundef nonnull %8, ptr noundef %154, ptr noundef %154) #11
  switch i32 %155, label %156 [
    i32 0, label %159
    i32 -30784, label %select.unfold
  ], !prof !41, !llvm.loop !39

156:                                              ; preds = %149
  call void @error(ptr noundef nonnull @.str.16, i32 noundef %155)
  %157 = load i8, ptr @rescue, align 1, !tbaa !30, !range !32, !noundef !33
  %158 = trunc nuw i8 %157 to i1
  br i1 %158, label %select.unfold, label %.thread

159:                                              ; preds = %149
  %160 = add nsw i32 %.0.ph, 1
  br i1 %.086, label %161, label %163

161:                                              ; preds = %159
  %162 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.21, ptr noundef nonnull %148)
  br label %186

163:                                              ; preds = %159
  %164 = load ptr, ptr %4, align 8, !tbaa !5
  %165 = load i32, ptr %8, align 4, !tbaa !28
  %166 = call i32 @dump_tbl(ptr noundef %164, i32 noundef %165, ptr noundef nonnull %148)
  %.not136 = icmp eq i32 %166, 0
  br i1 %.not136, label %186, label %167, !prof !34

167:                                              ; preds = %163
  %168 = load i8, ptr @rescue, align 1, !tbaa !30, !range !32, !noundef !33
  %169 = trunc nuw i8 %168 to i1
  br i1 %169, label %170, label %.thread

170:                                              ; preds = %167
  %171 = load i8, ptr @quiet, align 1, !tbaa !30, !range !32, !noundef !33
  %172 = trunc nuw i8 %171 to i1
  br i1 %172, label %178, label %173

173:                                              ; preds = %170
  %174 = load ptr, ptr @stderr, align 8, !tbaa !5
  %175 = load ptr, ptr @prog, align 8, !tbaa !5
  %176 = call ptr @mdbx_strerror(i32 noundef %166) #11
  %177 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %174, ptr noundef nonnull @.str.22, ptr noundef %175, ptr noundef %78, ptr noundef %176, ptr noundef nonnull %148) #13
  br label %178

178:                                              ; preds = %173, %170
  %179 = load ptr, ptr %4, align 8, !tbaa !5
  %180 = call i32 @mdbx_txn_reset(ptr noundef %179) #11
  %.not137 = icmp eq i32 %180, 0
  br i1 %.not137, label %182, label %181, !prof !34

181:                                              ; preds = %178
  call void @error(ptr noundef nonnull @.str.23, i32 noundef %180)
  br label %204

182:                                              ; preds = %178
  %183 = load ptr, ptr %4, align 8, !tbaa !5
  %184 = call i32 @mdbx_txn_renew(ptr noundef %183) #11
  %.not138 = icmp eq i32 %184, 0
  br i1 %.not138, label %186, label %185, !prof !34

185:                                              ; preds = %182
  call void @error(ptr noundef nonnull @.str.24, i32 noundef %184)
  br label %204

186:                                              ; preds = %163, %182, %161
  %187 = load ptr, ptr %3, align 8, !tbaa !5
  %188 = load i32, ptr %8, align 4, !tbaa !28
  %189 = call i32 @mdbx_dbi_close(ptr noundef %187, i32 noundef %188) #11
  %.not139 = icmp eq i32 %189, 0
  br i1 %.not139, label %select.unfold, label %190, !prof !34

190:                                              ; preds = %186
  call void @error(ptr noundef nonnull @.str.25, i32 noundef %189)
  br label %.thread

.thread:                                          ; preds = %167, %156, %190
  %.1100.ph = phi i32 [ %189, %190 ], [ %166, %167 ], [ %155, %156 ]
  %.2.ph = phi i32 [ %160, %190 ], [ %160, %167 ], [ %.0.ph, %156 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #11
  br label %.loopexit

select.unfold:                                    ; preds = %156, %186, %149
  %.177 = phi i1 [ true, %149 ], [ %.076.ph, %186 ], [ %.076.ph, %156 ]
  %.2 = phi i32 [ %.0.ph, %149 ], [ %160, %186 ], [ %.0.ph, %156 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #11
  br label %.outer

.loopexit:                                        ; preds = %146, %140, %136, %.thread
  %.2101 = phi i32 [ %.1100.ph, %.thread ], [ %138, %136 ], [ 4, %140 ], [ 12, %146 ]
  %.194 = phi ptr [ %148, %.thread ], [ %.093.ph, %136 ], [ %.093.ph, %140 ], [ %.093.ph, %146 ]
  %.3 = phi i32 [ %.2.ph, %.thread ], [ %.0.ph, %136 ], [ %.0.ph, %140 ], [ %.0.ph, %146 ]
  %191 = load ptr, ptr %6, align 8, !tbaa !5
  call void @mdbx_cursor_close(ptr noundef %191) #11
  store ptr null, ptr %6, align 8, !tbaa !5
  %192 = icmp eq i32 %.3, 0
  %or.cond5.not = select i1 %.076.ph, i1 %192, i1 false
  br i1 %or.cond5.not, label %193, label %196

193:                                              ; preds = %.loopexit
  %194 = load ptr, ptr %4, align 8, !tbaa !5
  %195 = call i32 @dump_tbl(ptr noundef %194, i32 noundef 1, ptr noundef null)
  br label %.thread165

196:                                              ; preds = %.loopexit
  br i1 %192, label %197, label %.thread165

197:                                              ; preds = %196
  %198 = load i8, ptr @quiet, align 1, !tbaa !30, !range !32, !noundef !33
  %199 = trunc nuw i8 %198 to i1
  br i1 %199, label %.thread165, label %200

200:                                              ; preds = %197
  %201 = load ptr, ptr @stderr, align 8, !tbaa !5
  %202 = load ptr, ptr @prog, align 8, !tbaa !5
  %203 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %201, ptr noundef nonnull @.str.26, ptr noundef %202, ptr noundef %78) #13
  br label %.thread165

.thread165:                                       ; preds = %197, %200, %196, %193
  %.4103.ph = phi i32 [ -30798, %197 ], [ -30798, %200 ], [ %195, %193 ], [ %.2101, %196 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #11
  br label %209

204:                                              ; preds = %181, %185
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #11
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #11
  br label %224

205:                                              ; preds = %120
  %206 = load ptr, ptr %4, align 8, !tbaa !5
  %207 = load i32, ptr %5, align 4, !tbaa !28
  %208 = call i32 @dump_tbl(ptr noundef %206, i32 noundef %207, ptr noundef %.097)
  br label %209

209:                                              ; preds = %.thread165, %205
  %.6105 = phi i32 [ %208, %205 ], [ %.4103.ph, %.thread165 ]
  %.4 = phi ptr [ null, %205 ], [ %.194, %.thread165 ]
  switch i32 %.6105, label %216 [
    i32 -30798, label %217
    i32 0, label %217
    i32 4, label %210
  ]

210:                                              ; preds = %209
  %211 = load i8, ptr @quiet, align 1, !tbaa !30, !range !32, !noundef !33
  %212 = trunc nuw i8 %211 to i1
  br i1 %212, label %217, label %213

213:                                              ; preds = %210
  %214 = load ptr, ptr @stderr, align 8, !tbaa !5
  %215 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %214, ptr noundef nonnull @.str.27) #13
  br label %217

216:                                              ; preds = %209
  call void @error(ptr noundef nonnull @.str.28, i32 noundef %.6105)
  br label %217

217:                                              ; preds = %209, %216, %210, %213, %209
  %.7 = phi i32 [ %.6105, %216 ], [ 4, %210 ], [ 4, %213 ], [ 0, %209 ], [ 0, %209 ]
  %218 = load ptr, ptr %3, align 8, !tbaa !5
  %219 = load i32, ptr %5, align 4, !tbaa !28
  %220 = call i32 @mdbx_dbi_close(ptr noundef %218, i32 noundef %219) #11
  br label %221

221:                                              ; preds = %.thread159, %217, %119
  %.8 = phi i32 [ %118, %119 ], [ %.7, %217 ], [ %127, %.thread159 ]
  %.5 = phi ptr [ null, %119 ], [ %.4, %217 ], [ null, %.thread159 ]
  %222 = load ptr, ptr %4, align 8, !tbaa !5
  %223 = call i32 @mdbx_txn_abort(ptr noundef %222) #11
  br label %224

224:                                              ; preds = %204, %221, %115, %111, %105, %98
  %.9 = phi i32 [ 1, %98 ], [ 1, %105 ], [ %109, %111 ], [ 1, %115 ], [ %.8, %221 ], [ 1, %204 ]
  %.6 = phi ptr [ null, %98 ], [ null, %105 ], [ null, %111 ], [ null, %115 ], [ %.5, %221 ], [ %148, %204 ]
  %225 = load ptr, ptr %3, align 8, !tbaa !5
  %226 = call i32 @mdbx_env_close(ptr noundef %225) #11
  call void @free(ptr noundef %.6) #11
  %.not141 = icmp ne i32 %.9, 0
  %227 = zext i1 %.not141 to i32
  br label %228

228:                                              ; preds = %.thread154, %224, %91, %14
  %.192 = phi i32 [ 0, %14 ], [ 1, %91 ], [ %227, %224 ], [ %133, %.thread154 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #11
  ret i32 %.192
}

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

; Function Attrs: nounwind uwtable
declare hidden void @usage() local_unnamed_addr #0

; Function Attrs: nounwind
declare i32 @getopt(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

declare ptr @freopen64(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #3

declare ptr @mdbx_strerror(i32 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__errno_location() local_unnamed_addr #5

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #6

; Function Attrs: nounwind
declare ptr @signal(i32 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden void @signal_handler(i32 noundef) #0

; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #3

declare i32 @mdbx_setup_debug(i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

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

declare i32 @mdbx_env_create(ptr noundef) local_unnamed_addr #4

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

declare i32 @mdbx_env_set_maxdbs(ptr noundef, i32 noundef) local_unnamed_addr #4

declare i32 @mdbx_env_open(ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #4

declare i32 @mdbx_env_warmup(ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #4

declare i32 @mdbx_txn_begin(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

declare i32 @mdbx_dbi_open(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #6

declare i32 @mdbx_cursor_open(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

declare i32 @mdbx_cursor_ignord(ptr noundef) local_unnamed_addr #4

declare i32 @mdbx_cursor_get(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @memchr(ptr noundef, i32 noundef, i64 noundef) local_unnamed_addr #7

; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #8

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

declare i32 @mdbx_dbi_open_ex(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

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

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

declare i32 @mdbx_txn_reset(ptr noundef) local_unnamed_addr #4

declare i32 @mdbx_txn_renew(ptr noundef) local_unnamed_addr #4

declare i32 @mdbx_dbi_close(ptr noundef, i32 noundef) local_unnamed_addr #4

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

declare void @mdbx_cursor_close(ptr noundef) local_unnamed_addr #4

declare i32 @mdbx_txn_abort(ptr noundef) local_unnamed_addr #4

declare i32 @mdbx_env_close(ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #10

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #6 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #10 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #11 = { nounwind }
attributes #12 = { nounwind willreturn memory(none) }
attributes #13 = { cold nounwind }
attributes #14 = { noreturn nounwind }
attributes #15 = { nounwind willreturn memory(read) }
attributes #16 = { nounwind allocsize(1) }

!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, !11, i64 0}
!10 = !{!"MDBX_version_info", !11, i64 0, !11, i64 2, !11, i64 4, !11, i64 6, !6, i64 8, !12, i64 16, !6, i64 48}
!11 = !{!"short", !7, i64 0}
!12 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!13 = !{!10, !11, i64 2}
!14 = !{!10, !11, i64 4}
!15 = !{!10, !11, i64 6}
!16 = !{!10, !6, i64 40}
!17 = !{!10, !6, i64 16}
!18 = !{!10, !6, i64 32}
!19 = !{!10, !6, i64 24}
!20 = !{!21, !6, i64 0}
!21 = !{!"MDBX_build_info", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!22 = !{!21, !6, i64 8}
!23 = !{!21, !6, i64 24}
!24 = !{!21, !6, i64 32}
!25 = !{!21, !6, i64 16}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!29, !29, i64 0}
!29 = !{!"int", !7, i64 0}
!30 = !{!31, !31, i64 0}
!31 = !{!"_Bool", !7, i64 0}
!32 = !{i8 0, i8 2}
!33 = !{}
!34 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!35 = !{!36, !6, i64 0}
!36 = !{!"iovec", !6, i64 0, !37, i64 8}
!37 = !{!"long", !7, i64 0}
!38 = !{!36, !37, i64 8}
!39 = distinct !{!39, !27}
!40 = !{!7, !7, i64 0}
!41 = !{!"branch_weights", i32 1, i32 4000, i32 1}


; Effective O3 passes: AggressiveInstCombinePass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopSimplifyPass,LoopUnrollPass,LowerExpectIntrinsicPass,SROAPass,SimplifyCFGPass,TailCallElimPass