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

; 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 }
%struct.MDBX_chk_callbacks = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.MDBX_chk_context = type { ptr, ptr, ptr, ptr, i8, %struct.anon.0 }
%struct.anon.0 = type { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, ptr }
%struct.timespec = type { i64, i64 }

@env_flags = external dso_local global i32, align 4
@verbose = external dso_local global i32, align 4
@stuck_meta = external dso_local global i32, align 4
@turn_meta = external dso_local global i8, align 1
@force_turn_meta = external dso_local global i8, align 1
@chk_flags = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [14 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [135 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
@.str.3 = external hidden unnamed_addr constant [117 x i8], align 1
@quiet = external dso_local global i8, align 1
@only_table = external dso_local global %struct.iovec, align 8
@optarg = external global ptr, align 8
@optind = external global i32, align 4
@.str.4 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [69 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [95 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [8 x i8], align 1
@env = external dso_local global ptr, align 8
@.str.13 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [14 x i8], align 1
@anchor_lineno = external hidden global i64, align 8
@.str.21 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [5 x i8], align 1
@cb = external hidden constant %struct.MDBX_chk_callbacks, align 8
@chk = external dso_local global %struct.MDBX_chk_context, align 8
@.str.24 = external hidden unnamed_addr constant [13 x i8], align 1
@user_break = external hidden global i32, align 4
@.str.25 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [44 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 ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i8, align 1
  %10 = alloca i32, align 4
  %11 = alloca double, align 8
  %12 = alloca %struct.timespec, align 8
  %13 = alloca %struct.timespec, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i8, align 1
  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) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  %17 = load ptr, ptr %5, align 8, !tbaa !9
  %18 = getelementptr inbounds ptr, ptr %17, i64 0
  %19 = load ptr, ptr %18, align 8, !tbaa !9
  store ptr %19, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #8
  store i8 0, ptr %9, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  store i32 0, ptr %10, align 4, !tbaa !5
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = icmp slt i32 %20, 2
  br i1 %21, label %22, label %24

22:                                               ; preds = %2
  %23 = load ptr, ptr %7, align 8, !tbaa !9
  call void @usage(ptr noundef %23)
  br label %24

24:                                               ; preds = %22, %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #8
  %25 = call i32 @clock_gettime(i32 noundef 1, ptr noundef %12) #8
  %26 = icmp ne i32 %25, 0
  br i1 %26, label %27, label %31

27:                                               ; preds = %24
  %28 = call ptr @__errno_location() #9
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = call i32 @error_fn(ptr noundef @.str, i32 noundef %29)
  store i32 4, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %403

31:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  br label %32

32:                                               ; preds = %117, %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.1) #8
  store i32 %35, ptr %15, align 4, !tbaa !5
  %36 = icmp ne i32 %35, -1
  br i1 %36, label %38, label %37

37:                                               ; preds = %32
  store i32 2, ptr %14, align 4
  br label %118

38:                                               ; preds = %32
  %39 = load i32, ptr %15, align 4, !tbaa !5
  switch i32 %39, label %115 [
    i32 86, label %40
    i32 118, label %60
    i32 48, label %77
    i32 49, label %78
    i32 50, label %79
    i32 116, label %80
    i32 84, label %81
    i32 113, label %82
    i32 110, label %117
    i32 119, label %83
    i32 99, label %88
    i32 100, label %92
    i32 115, label %95
    i32 105, label %110
    i32 117, label %113
    i32 85, label %114
  ]

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

60:                                               ; preds = %38
  %61 = load i32, ptr @verbose, align 4, !tbaa !5
  %62 = icmp uge i32 %61, 9
  br i1 %62, label %63, label %66

63:                                               ; preds = %60
  br i1 false, label %64, label %66

64:                                               ; preds = %63
  %65 = load ptr, ptr %7, align 8, !tbaa !9
  call void @usage(ptr noundef %65)
  br label %76

66:                                               ; preds = %63, %60
  %67 = load i32, ptr @verbose, align 4, !tbaa !5
  %68 = add i32 %67, 1
  store i32 %68, ptr @verbose, align 4, !tbaa !5
  %69 = load i32, ptr @verbose, align 4, !tbaa !5
  %70 = icmp eq i32 %69, 0
  br i1 %70, label %71, label %75

71:                                               ; preds = %66
  br i1 true, label %75, label %72

72:                                               ; preds = %71
  %73 = load i32, ptr @verbose, align 4, !tbaa !5
  %74 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %73)
  br label %75

75:                                               ; preds = %72, %71, %66
  br label %76

76:                                               ; preds = %75, %64
  br label %117

77:                                               ; preds = %38
  store i32 0, ptr @stuck_meta, align 4, !tbaa !5
  br label %117

78:                                               ; preds = %38
  store i32 1, ptr @stuck_meta, align 4, !tbaa !5
  br label %117

79:                                               ; preds = %38
  store i32 2, ptr @stuck_meta, align 4, !tbaa !5
  br label %117

80:                                               ; preds = %38
  store i8 1, ptr @turn_meta, align 1, !tbaa !11
  br label %117

81:                                               ; preds = %38
  store i8 1, ptr @force_turn_meta, align 1, !tbaa !11
  store i8 1, ptr @turn_meta, align 1, !tbaa !11
  store i8 0, ptr @quiet, align 1, !tbaa !11
  br label %117

82:                                               ; preds = %38
  store i8 1, ptr @quiet, align 1, !tbaa !11
  br label %117

83:                                               ; preds = %38
  %84 = load i32, ptr @env_flags, align 4, !tbaa !5
  %85 = and i32 %84, -131073
  store i32 %85, ptr @env_flags, align 4, !tbaa !5
  %86 = load i32, ptr @chk_flags, align 4, !tbaa !5
  %87 = or i32 %86, 1
  store i32 %87, ptr @chk_flags, align 4, !tbaa !5
  br label %117

88:                                               ; preds = %38
  %89 = load i32, ptr @env_flags, align 4, !tbaa !5
  %90 = and i32 %89, -4194305
  %91 = or i32 %90, 1073741824
  store i32 %91, ptr @env_flags, align 4, !tbaa !5
  br label %117

92:                                               ; preds = %38
  %93 = load i32, ptr @chk_flags, align 4, !tbaa !5
  %94 = or i32 %93, 2
  store i32 %94, ptr @chk_flags, align 4, !tbaa !5
  br label %117

95:                                               ; preds = %38
  %96 = load ptr, ptr @only_table, align 8, !tbaa !30
  %97 = icmp ne ptr %96, null
  br i1 %97, label %98, label %105

98:                                               ; preds = %95
  %99 = load ptr, ptr @only_table, align 8, !tbaa !30
  %100 = load ptr, ptr @optarg, align 8, !tbaa !9
  %101 = call i32 @strcmp(ptr noundef %99, ptr noundef %100) #10
  %102 = icmp ne i32 %101, 0
  br i1 %102, label %103, label %105

103:                                              ; preds = %98
  %104 = load ptr, ptr %7, align 8, !tbaa !9
  call void @usage(ptr noundef %104)
  br label %109

105:                                              ; preds = %98, %95
  %106 = load ptr, ptr @optarg, align 8, !tbaa !9
  store ptr %106, ptr @only_table, align 8, !tbaa !30
  %107 = load ptr, ptr @optarg, align 8, !tbaa !9
  %108 = call i64 @strlen(ptr noundef %107) #10
  store i64 %108, ptr getelementptr inbounds (%struct.iovec, ptr @only_table, i32 0, i32 1), align 8, !tbaa !33
  br label %109

109:                                              ; preds = %105, %103
  br label %117

110:                                              ; preds = %38
  %111 = load i32, ptr @chk_flags, align 4, !tbaa !5
  %112 = or i32 %111, 8
  store i32 %112, ptr @chk_flags, align 4, !tbaa !5
  br label %117

113:                                              ; preds = %38
  store i8 1, ptr %9, align 1, !tbaa !11
  br label %117

114:                                              ; preds = %38
  store i8 1, ptr %9, align 1, !tbaa !11
  store i32 13, ptr %10, align 4, !tbaa !5
  br label %117

115:                                              ; preds = %38
  %116 = load ptr, ptr %7, align 8, !tbaa !9
  call void @usage(ptr noundef %116)
  br label %117

117:                                              ; preds = %115, %114, %113, %110, %109, %92, %88, %83, %82, %81, %80, %79, %78, %77, %76, %38
  br label %32, !llvm.loop !34

118:                                              ; preds = %40, %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  %119 = load i32, ptr %14, align 4
  switch i32 %119, label %403 [
    i32 2, label %120
  ]

120:                                              ; preds = %118
  %121 = load i32, ptr @optind, align 4, !tbaa !5
  %122 = load i32, ptr %4, align 4, !tbaa !5
  %123 = sub nsw i32 %122, 1
  %124 = icmp ne i32 %121, %123
  br i1 %124, label %125, label %127

125:                                              ; preds = %120
  %126 = load ptr, ptr %7, align 8, !tbaa !9
  call void @usage(ptr noundef %126)
  br label %127

127:                                              ; preds = %125, %120
  store i32 0, ptr %6, align 4, !tbaa !5
  %128 = load i32, ptr @stuck_meta, align 4, !tbaa !5
  %129 = icmp sge i32 %128, 0
  br i1 %129, label %130, label %136

130:                                              ; preds = %127
  %131 = load i32, ptr @env_flags, align 4, !tbaa !5
  %132 = and i32 %131, 4194304
  %133 = icmp eq i32 %132, 0
  br i1 %133, label %134, label %136

134:                                              ; preds = %130
  %135 = load i32, ptr @stuck_meta, align 4, !tbaa !5
  call void (ptr, ...) @error_fmt(ptr noundef @.str.4, i32 noundef %135)
  store i32 5, ptr %6, align 4, !tbaa !5
  br label %136

136:                                              ; preds = %134, %130, %127
  %137 = load i8, ptr @turn_meta, align 1, !tbaa !11, !range !36, !noundef !37
  %138 = trunc i8 %137 to i1
  br i1 %138, label %139, label %157

139:                                              ; preds = %136
  %140 = load i32, ptr @stuck_meta, align 4, !tbaa !5
  %141 = icmp slt i32 %140, 0
  br i1 %141, label %142, label %143

142:                                              ; preds = %139
  call void (ptr, ...) @error_fmt(ptr noundef @.str.5)
  store i32 5, ptr %6, align 4, !tbaa !5
  br label %143

143:                                              ; preds = %142, %139
  %144 = load i32, ptr @env_flags, align 4, !tbaa !5
  %145 = and i32 %144, 131072
  %146 = icmp ne i32 %145, 0
  br i1 %146, label %147, label %148

147:                                              ; preds = %143
  call void (ptr, ...) @error_fmt(ptr noundef @.str.6)
  store i32 5, ptr %6, align 4, !tbaa !5
  br label %148

148:                                              ; preds = %147, %143
  %149 = load ptr, ptr @only_table, align 8, !tbaa !30
  %150 = icmp ne ptr %149, null
  br i1 %150, label %155, label %151

151:                                              ; preds = %148
  %152 = load i32, ptr @chk_flags, align 4, !tbaa !5
  %153 = and i32 %152, 6
  %154 = icmp ne i32 %153, 0
  br i1 %154, label %155, label %156

155:                                              ; preds = %151, %148
  call void (ptr, ...) @error_fmt(ptr noundef @.str.7)
  store i32 5, ptr %6, align 4, !tbaa !5
  br label %156

156:                                              ; preds = %155, %151
  br label %157

157:                                              ; preds = %156, %136
  %158 = load i32, ptr %6, align 4, !tbaa !5
  %159 = icmp ne i32 %158, 0
  br i1 %159, label %160, label %162

160:                                              ; preds = %157
  %161 = load i32, ptr %6, align 4, !tbaa !5
  call void @exit(i32 noundef %161) #11
  unreachable

162:                                              ; preds = %157
  %163 = call ptr @signal(i32 noundef 13, ptr noundef @signal_handler) #8
  %164 = call ptr @signal(i32 noundef 1, ptr noundef @signal_handler) #8
  %165 = call ptr @signal(i32 noundef 2, ptr noundef @signal_handler) #8
  %166 = call ptr @signal(i32 noundef 15, ptr noundef @signal_handler) #8
  %167 = load ptr, ptr %5, align 8, !tbaa !9
  %168 = load i32, ptr @optind, align 4, !tbaa !5
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds ptr, ptr %167, i64 %169
  %171 = load ptr, ptr %170, align 8, !tbaa !9
  store ptr %171, ptr %8, align 8, !tbaa !9
  %172 = 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
  %173 = load ptr, ptr getelementptr inbounds (%struct.MDBX_version_info, ptr @mdbx_version, i32 0, i32 5), align 8, !tbaa !21
  %174 = 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
  %175 = load ptr, ptr %8, align 8, !tbaa !9
  %176 = load i32, ptr @env_flags, align 4, !tbaa !5
  %177 = and i32 %176, 131072
  %178 = icmp ne i32 %177, 0
  %179 = zext i1 %178 to i64
  %180 = select i1 %178, ptr @.str.9, ptr @.str.10
  %181 = load i32, ptr @verbose, align 4, !tbaa !5
  %182 = load i32, ptr @verbose, align 4, !tbaa !5
  %183 = icmp ugt i32 %182, 8
  %184 = zext i1 %183 to i64
  %185 = select i1 %183, ptr @.str.11, ptr @.str.12
  %186 = call i64 (i32, ptr, ...) @print(i32 noundef 68, ptr noundef @.str.8, ptr noundef %172, ptr noundef %173, ptr noundef %174, ptr noundef %175, ptr noundef %180, i32 noundef %181, ptr noundef %185)
  call void @lf_flush()
  %187 = load i32, ptr @verbose, align 4, !tbaa !5
  %188 = add i32 %187, 2
  %189 = icmp ult i32 %188, 6
  br i1 %189, label %190, label %193

190:                                              ; preds = %162
  %191 = load i32, ptr @verbose, align 4, !tbaa !5
  %192 = add i32 %191, 2
  br label %194

193:                                              ; preds = %162
  br label %194

194:                                              ; preds = %193, %190
  %195 = phi i32 [ %192, %190 ], [ 6, %193 ]
  %196 = call i32 @mdbx_setup_debug(i32 noundef %195, i32 noundef 107, ptr noundef @logger)
  %197 = call i32 @mdbx_env_create(ptr noundef @env)
  store i32 %197, ptr %6, align 4, !tbaa !5
  %198 = load i32, ptr %6, align 4, !tbaa !5
  %199 = icmp ne i32 %198, 0
  br i1 %199, label %200, label %207

200:                                              ; preds = %194
  %201 = load i32, ptr %6, align 4, !tbaa !5
  %202 = call i32 @error_fn(ptr noundef @.str.13, i32 noundef %201)
  %203 = load i32, ptr %6, align 4, !tbaa !5
  %204 = icmp slt i32 %203, 0
  %205 = zext i1 %204 to i64
  %206 = select i1 %204, i32 3, i32 4
  store i32 %206, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %403

207:                                              ; preds = %194
  %208 = load ptr, ptr @env, align 8, !tbaa !9
  %209 = call i32 @mdbx_env_set_maxdbs(ptr noundef %208, i32 noundef 2)
  store i32 %209, ptr %6, align 4, !tbaa !5
  %210 = load i32, ptr %6, align 4, !tbaa !5
  %211 = icmp ne i32 %210, 0
  br i1 %211, label %212, label %215

212:                                              ; preds = %207
  %213 = load i32, ptr %6, align 4, !tbaa !5
  %214 = call i32 @error_fn(ptr noundef @.str.14, i32 noundef %213)
  br label %327

215:                                              ; preds = %207
  %216 = load i32, ptr @stuck_meta, align 4, !tbaa !5
  %217 = icmp sge i32 %216, 0
  br i1 %217, label %218, label %229

218:                                              ; preds = %215
  %219 = load ptr, ptr @env, align 8, !tbaa !9
  %220 = load ptr, ptr %8, align 8, !tbaa !9
  %221 = load i32, ptr @stuck_meta, align 4, !tbaa !5
  %222 = load i32, ptr @env_flags, align 4, !tbaa !5
  %223 = and i32 %222, 131072
  %224 = icmp ne i32 %223, 0
  %225 = zext i1 %224 to i64
  %226 = select i1 %224, i32 0, i32 1
  %227 = icmp ne i32 %226, 0
  %228 = call i32 @mdbx_env_open_for_recovery(ptr noundef %219, ptr noundef %220, i32 noundef %221, i1 noundef zeroext %227)
  store i32 %228, ptr %6, align 4, !tbaa !5
  br label %255

229:                                              ; preds = %215
  %230 = load ptr, ptr @env, align 8, !tbaa !9
  %231 = load ptr, ptr %8, align 8, !tbaa !9
  %232 = load i32, ptr @env_flags, align 4, !tbaa !5
  %233 = call i32 @mdbx_env_open(ptr noundef %230, ptr noundef %231, i32 noundef %232, i32 noundef 0)
  store i32 %233, ptr %6, align 4, !tbaa !5
  %234 = load i32, ptr @env_flags, align 4, !tbaa !5
  %235 = and i32 %234, 4194304
  %236 = icmp ne i32 %235, 0
  br i1 %236, label %237, label %254

237:                                              ; preds = %229
  %238 = load i32, ptr %6, align 4, !tbaa !5
  %239 = icmp eq i32 %238, -30778
  br i1 %239, label %246, label %240

240:                                              ; preds = %237
  %241 = load i32, ptr %6, align 4, !tbaa !5
  %242 = icmp eq i32 %241, 16
  br i1 %242, label %246, label %243

243:                                              ; preds = %240
  %244 = load i32, ptr %6, align 4, !tbaa !5
  %245 = icmp eq i32 %244, 11
  br i1 %245, label %246, label %254

246:                                              ; preds = %243, %240, %237
  %247 = load i32, ptr @env_flags, align 4, !tbaa !5
  %248 = and i32 %247, -4194305
  store i32 %248, ptr @env_flags, align 4, !tbaa !5
  %249 = load ptr, ptr @env, align 8, !tbaa !9
  %250 = load ptr, ptr %8, align 8, !tbaa !9
  %251 = load i32, ptr @env_flags, align 4, !tbaa !5
  %252 = or i32 %251, 1073741824
  %253 = call i32 @mdbx_env_open(ptr noundef %249, ptr noundef %250, i32 noundef %252, i32 noundef 0)
  store i32 %253, ptr %6, align 4, !tbaa !5
  br label %254

254:                                              ; preds = %246, %243, %229
  br label %255

255:                                              ; preds = %254, %218
  %256 = load i32, ptr %6, align 4, !tbaa !5
  %257 = icmp ne i32 %256, 0
  br i1 %257, label %258, label %271

258:                                              ; preds = %255
  %259 = load i32, ptr %6, align 4, !tbaa !5
  %260 = call i32 @error_fn(ptr noundef @.str.15, i32 noundef %259)
  %261 = load i32, ptr %6, align 4, !tbaa !5
  %262 = icmp eq i32 %261, -30419
  br i1 %262, label %263, label %270

263:                                              ; preds = %258
  %264 = load i32, ptr @env_flags, align 4, !tbaa !5
  %265 = and i32 %264, 131072
  %266 = icmp ne i32 %265, 0
  br i1 %266, label %267, label %270

267:                                              ; preds = %263
  %268 = load ptr, ptr %7, align 8, !tbaa !9
  %269 = call ptr (i32, ptr, ...) @print_ln(i32 noundef 68, ptr noundef @.str.16, ptr noundef %268)
  br label %270

270:                                              ; preds = %267, %263, %258
  br label %327

271:                                              ; preds = %255
  %272 = load i32, ptr @env_flags, align 4, !tbaa !5
  %273 = and i32 %272, 4194304
  %274 = icmp ne i32 %273, 0
  %275 = zext i1 %274 to i64
  %276 = select i1 %274, ptr @.str.18, ptr @.str.19
  %277 = call ptr (i32, ptr, ...) @print_ln(i32 noundef 120, ptr noundef @.str.17, ptr noundef %276)
  %278 = load i8, ptr %9, align 1, !tbaa !11, !range !36, !noundef !37
  %279 = trunc i8 %278 to i1
  br i1 %279, label %280, label %299

280:                                              ; preds = %271
  %281 = call i64 (i32, ptr, ...) @print(i32 noundef 120, ptr noundef @.str.20)
  store i64 %281, ptr @anchor_lineno, align 8, !tbaa !38
  call void @flush()
  %282 = load ptr, ptr @env, align 8, !tbaa !9
  %283 = load i32, ptr %10, align 4, !tbaa !5
  %284 = call i32 @mdbx_env_warmup(ptr noundef %282, ptr noundef null, i32 noundef %283, i32 noundef 235929600)
  store i32 %284, ptr %6, align 4, !tbaa !5
  %285 = load i32, ptr %6, align 4, !tbaa !5
  %286 = icmp ne i32 %285, -1
  br i1 %286, label %287, label %293

287:                                              ; preds = %280
  %288 = load i32, ptr %6, align 4, !tbaa !5
  %289 = icmp ne i32 %288, 0
  br i1 %289, label %290, label %293

290:                                              ; preds = %287
  %291 = load i32, ptr %6, align 4, !tbaa !5
  %292 = call i32 @error_fn(ptr noundef @.str.21, i32 noundef %291)
  br label %327

293:                                              ; preds = %287, %280
  %294 = load i64, ptr @anchor_lineno, align 8, !tbaa !38
  %295 = load i32, ptr %6, align 4, !tbaa !5
  %296 = icmp ne i32 %295, 0
  %297 = zext i1 %296 to i64
  %298 = select i1 %296, ptr @.str.22, ptr @.str.23
  call void @suffix(i64 noundef %294, ptr noundef %298)
  br label %299

299:                                              ; preds = %293, %271
  %300 = load ptr, ptr @env, align 8, !tbaa !9
  %301 = load i32, ptr @chk_flags, align 4, !tbaa !5
  %302 = load i32, ptr @verbose, align 4, !tbaa !5
  %303 = shl i32 %302, 4
  %304 = add i32 68, %303
  %305 = call i32 @mdbx_env_chk(ptr noundef %300, ptr noundef @cb, ptr noundef @chk, i32 noundef %301, i32 noundef %304, i32 noundef 0)
  store i32 %305, ptr %6, align 4, !tbaa !5
  %306 = load i32, ptr %6, align 4, !tbaa !5
  %307 = icmp ne i32 %306, 0
  br i1 %307, label %308, label %326

308:                                              ; preds = %299
  %309 = load i64, ptr getelementptr inbounds (%struct.anon.0, ptr getelementptr inbounds (%struct.MDBX_chk_context, ptr @chk, i32 0, i32 5), i32 0, i32 16), align 8, !tbaa !39
  %310 = icmp eq i64 %309, 0
  br i1 %310, label %311, label %314

311:                                              ; preds = %308
  %312 = load i32, ptr %6, align 4, !tbaa !5
  %313 = call i32 @error_fn(ptr noundef @.str.24, i32 noundef %312)
  br label %325

314:                                              ; preds = %308
  %315 = load i32, ptr %6, align 4, !tbaa !5
  %316 = icmp ne i32 %315, 4
  br i1 %316, label %317, label %324

317:                                              ; preds = %314
  %318 = load i32, ptr %6, align 4, !tbaa !5
  %319 = icmp ne i32 %318, -1
  br i1 %319, label %320, label %324

320:                                              ; preds = %317
  %321 = load volatile i32, ptr @user_break, align 4, !tbaa !5
  %322 = icmp ne i32 %321, 0
  br i1 %322, label %324, label %323

323:                                              ; preds = %320
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %324

324:                                              ; preds = %323, %320, %317, %314
  br label %325

325:                                              ; preds = %324, %311
  br label %326

326:                                              ; preds = %325, %299
  br label %327

327:                                              ; preds = %326, %290, %270, %212
  %328 = load ptr, ptr @env, align 8, !tbaa !9
  %329 = icmp ne ptr %328, null
  br i1 %329, label %330, label %347

330:                                              ; preds = %327
  call void @llvm.lifetime.start.p0(i64 1, ptr %16) #8
  %331 = load i32, ptr %6, align 4, !tbaa !5
  %332 = icmp ne i32 %331, 0
  br i1 %332, label %340, label %333

333:                                              ; preds = %330
  %334 = load i64, ptr getelementptr inbounds (%struct.anon.0, ptr getelementptr inbounds (%struct.MDBX_chk_context, ptr @chk, i32 0, i32 5), i32 0, i32 16), align 8, !tbaa !39
  %335 = icmp ne i64 %334, 0
  br i1 %335, label %340, label %336

336:                                              ; preds = %333
  %337 = load i32, ptr @chk_flags, align 4, !tbaa !5
  %338 = and i32 %337, 1
  %339 = icmp eq i32 %338, 0
  br label %340

340:                                              ; preds = %336, %333, %330
  %341 = phi i1 [ true, %333 ], [ true, %330 ], [ %339, %336 ]
  %342 = zext i1 %341 to i8
  store i8 %342, ptr %16, align 1, !tbaa !11
  %343 = load ptr, ptr @env, align 8, !tbaa !9
  %344 = load i8, ptr %16, align 1, !tbaa !11, !range !36, !noundef !37
  %345 = trunc i8 %344 to i1
  %346 = call i32 @mdbx_env_close_ex(ptr noundef %343, i1 noundef zeroext %345)
  call void @llvm.lifetime.end.p0(i64 1, ptr %16) #8
  br label %347

347:                                              ; preds = %340, %327
  call void @flush()
  %348 = load i32, ptr %6, align 4, !tbaa !5
  %349 = icmp ne i32 %348, 0
  br i1 %349, label %350, label %359

350:                                              ; preds = %347
  %351 = load i32, ptr %6, align 4, !tbaa !5
  %352 = icmp sgt i32 %351, 0
  br i1 %352, label %353, label %358

353:                                              ; preds = %350
  %354 = load volatile i32, ptr @user_break, align 4, !tbaa !5
  %355 = icmp ne i32 %354, 0
  %356 = zext i1 %355 to i64
  %357 = select i1 %355, i32 5, i32 4
  store i32 %357, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %403

358:                                              ; preds = %350
  store i32 3, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %403

359:                                              ; preds = %347
  %360 = call i32 @clock_gettime(i32 noundef 1, ptr noundef %13) #8
  %361 = icmp ne i32 %360, 0
  br i1 %361, label %362, label %366

362:                                              ; preds = %359
  %363 = call ptr @__errno_location() #9
  %364 = load i32, ptr %363, align 4, !tbaa !5
  %365 = call i32 @error_fn(ptr noundef @.str, i32 noundef %364)
  store i32 4, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %403

366:                                              ; preds = %359
  %367 = getelementptr inbounds %struct.timespec, ptr %13, i32 0, i32 0
  %368 = load i64, ptr %367, align 8, !tbaa !42
  %369 = getelementptr inbounds %struct.timespec, ptr %12, i32 0, i32 0
  %370 = load i64, ptr %369, align 8, !tbaa !42
  %371 = sub nsw i64 %368, %370
  %372 = sitofp i64 %371 to double
  %373 = getelementptr inbounds %struct.timespec, ptr %13, i32 0, i32 1
  %374 = load i64, ptr %373, align 8, !tbaa !44
  %375 = getelementptr inbounds %struct.timespec, ptr %12, i32 0, i32 1
  %376 = load i64, ptr %375, align 8, !tbaa !44
  %377 = sub nsw i64 %374, %376
  %378 = sitofp i64 %377 to double
  %379 = call double @llvm.fmuladd.f64(double %378, double 1.000000e-09, double %372)
  store double %379, ptr %11, align 8, !tbaa !45
  %380 = load i64, ptr getelementptr inbounds (%struct.anon.0, ptr getelementptr inbounds (%struct.MDBX_chk_context, ptr @chk, i32 0, i32 5), i32 0, i32 16), align 8, !tbaa !39
  %381 = icmp ne i64 %380, 0
  br i1 %381, label %382, label %400

382:                                              ; preds = %366
  %383 = load i64, ptr getelementptr inbounds (%struct.anon.0, ptr getelementptr inbounds (%struct.MDBX_chk_context, ptr @chk, i32 0, i32 5), i32 0, i32 16), align 8, !tbaa !39
  %384 = load i64, ptr getelementptr inbounds (%struct.anon.0, ptr getelementptr inbounds (%struct.MDBX_chk_context, ptr @chk, i32 0, i32 5), i32 0, i32 16), align 8, !tbaa !39
  %385 = icmp ugt i64 %384, 1
  %386 = zext i1 %385 to i64
  %387 = select i1 %385, ptr @.str.26, ptr @.str.27
  %388 = load double, ptr %11, align 8, !tbaa !45
  %389 = call ptr (i32, ptr, ...) @print_ln(i32 noundef 68, ptr noundef @.str.25, i64 noundef %383, ptr noundef %387, double noundef %388)
  %390 = load i64, ptr getelementptr inbounds (%struct.anon.0, ptr getelementptr inbounds (%struct.MDBX_chk_context, ptr @chk, i32 0, i32 5), i32 0, i32 10), align 8, !tbaa !47
  %391 = icmp ne i64 %390, 0
  br i1 %391, label %398, label %392

392:                                              ; preds = %382
  %393 = load i64, ptr getelementptr inbounds (%struct.anon.0, ptr getelementptr inbounds (%struct.MDBX_chk_context, ptr @chk, i32 0, i32 5), i32 0, i32 15), align 8, !tbaa !48
  %394 = icmp ne i64 %393, 0
  br i1 %394, label %398, label %395

395:                                              ; preds = %392
  %396 = load i64, ptr getelementptr inbounds (%struct.anon.0, ptr getelementptr inbounds (%struct.MDBX_chk_context, ptr @chk, i32 0, i32 5), i32 0, i32 14), align 8, !tbaa !49
  %397 = icmp ne i64 %396, 0
  br i1 %397, label %398, label %399

398:                                              ; preds = %395, %392, %382
  store i32 2, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %403

399:                                              ; preds = %395
  store i32 1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %403

400:                                              ; preds = %366
  %401 = load double, ptr %11, align 8, !tbaa !45
  %402 = call ptr (i32, ptr, ...) @print_ln(i32 noundef 68, ptr noundef @.str.28, double noundef %401)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %403

403:                                              ; preds = %400, %399, %398, %362, %358, %353, %200, %118, %27
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  %404 = load i32, ptr %3, align 4
  ret i32 %404
}

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

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

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

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

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

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

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #5

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #5

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

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

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

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

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

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

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

declare i32 @mdbx_setup_debug(i32 noundef, i32 noundef, ptr noundef) #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) #4

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

declare i32 @mdbx_env_open_for_recovery(ptr noundef, ptr noundef, i32 noundef, i1 noundef zeroext) #4

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

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

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

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

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

declare i32 @mdbx_env_chk(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef) #4

declare i32 @mdbx_env_close_ex(ptr noundef, i1 noundef zeroext) #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #7

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 = { 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 #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 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
attributes #9 = { nounwind willreturn memory(none) }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { noreturn nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !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 = !{!31, !10, i64 0}
!31 = !{!"iovec", !10, i64 0, !32, i64 8}
!32 = !{!"long", !7, i64 0}
!33 = !{!31, !32, i64 8}
!34 = distinct !{!34, !35}
!35 = !{!"llvm.loop.mustprogress"}
!36 = !{i8 0, i8 2}
!37 = !{}
!38 = !{!32, !32, i64 0}
!39 = !{!40, !32, i64 168}
!40 = !{!"MDBX_chk_context", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !7, i64 32, !41, i64 40}
!41 = !{!"", !32, i64 0, !32, i64 8, !32, i64 16, !32, i64 24, !32, i64 32, !32, i64 40, !32, i64 48, !32, i64 56, !32, i64 64, !32, i64 72, !32, i64 80, !32, i64 88, !32, i64 96, !32, i64 104, !32, i64 112, !32, i64 120, !32, i64 128, !32, i64 136, !32, i64 144, !10, i64 152}
!42 = !{!43, !32, i64 0}
!43 = !{!"timespec", !32, i64 0, !32, i64 8}
!44 = !{!43, !32, i64 8}
!45 = !{!46, !46, i64 0}
!46 = !{!"double", !7, i64 0}
!47 = !{!40, !32, i64 120}
!48 = !{!40, !32, i64 160}
!49 = !{!40, !32, i64 152}


; 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 }
%struct.MDBX_chk_callbacks = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.MDBX_chk_context = type { ptr, ptr, ptr, ptr, i8, %struct.anon.0 }
%struct.anon.0 = type { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, ptr }
%struct.timespec = type { i64, i64 }

@env_flags = external dso_local local_unnamed_addr global i32, align 4
@verbose = external dso_local local_unnamed_addr global i32, align 4
@stuck_meta = external dso_local local_unnamed_addr global i32, align 4
@turn_meta = external dso_local local_unnamed_addr global i8, align 1
@force_turn_meta = external dso_local local_unnamed_addr global i8, align 1
@chk_flags = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [14 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [135 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
@quiet = external dso_local local_unnamed_addr global i8, align 1
@only_table = external dso_local local_unnamed_addr global %struct.iovec, align 8
@optarg = external local_unnamed_addr global ptr, align 8
@optind = external local_unnamed_addr global i32, align 4
@.str.4 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [69 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [95 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [8 x i8], align 1
@env = external dso_local global ptr, align 8
@.str.13 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [14 x i8], align 1
@anchor_lineno = external hidden local_unnamed_addr global i64, align 8
@.str.21 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [5 x i8], align 1
@cb = external hidden constant %struct.MDBX_chk_callbacks, align 8
@chk = external dso_local global %struct.MDBX_chk_context, align 8
@.str.24 = external hidden unnamed_addr constant [13 x i8], align 1
@user_break = external hidden global i32, align 4
@.str.25 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [44 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 6) i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca %struct.timespec, align 8
  %4 = alloca %struct.timespec, align 8
  %5 = load ptr, ptr %1, align 8, !tbaa !5
  %6 = icmp slt i32 %0, 2
  br i1 %6, label %7, label %8

7:                                                ; preds = %2
  tail call void @usage(ptr noundef %5)
  br label %8

8:                                                ; preds = %7, %2
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #10
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #10
  %9 = call i32 @clock_gettime(i32 noundef 1, ptr noundef nonnull %3) #10
  %.not = icmp eq i32 %9, 0
  br i1 %.not, label %.preheader, label %10

10:                                               ; preds = %8
  %11 = tail call ptr @__errno_location() #11
  %12 = load i32, ptr %11, align 4, !tbaa !9
  %13 = call i32 @error_fn(ptr noundef nonnull @.str, i32 noundef %12)
  br label %238

.preheader:                                       ; preds = %8, %.preheader.backedge
  %.064 = phi i32 [ %.064.be, %.preheader.backedge ], [ 0, %8 ]
  %.062 = phi i1 [ %.062.be, %.preheader.backedge ], [ false, %8 ]
  %14 = call i32 @getopt(i32 noundef %0, ptr noundef nonnull %1, ptr noundef nonnull @.str.1) #10
  switch i32 %14, label %68 [
    i32 -1, label %.critedge
    i32 86, label %15
    i32 118, label %35
    i32 48, label %38
    i32 49, label %39
    i32 50, label %40
    i32 116, label %41
    i32 84, label %42
    i32 113, label %43
    i32 110, label %.preheader.backedge
    i32 119, label %44
    i32 99, label %49
    i32 100, label %53
    i32 115, label %56
    i32 105, label %63
    i32 117, label %66
    i32 85, label %67
  ]

.preheader.backedge:                              ; preds = %.preheader, %60, %61, %68, %67, %66, %63, %53, %49, %44, %43, %42, %41, %40, %39, %38, %35
  %.064.be = phi i32 [ %.064, %68 ], [ 13, %67 ], [ %.064, %66 ], [ %.064, %63 ], [ %.064, %60 ], [ %.064, %61 ], [ %.064, %53 ], [ %.064, %49 ], [ %.064, %44 ], [ %.064, %43 ], [ %.064, %42 ], [ %.064, %41 ], [ %.064, %40 ], [ %.064, %39 ], [ %.064, %38 ], [ %.064, %35 ], [ %.064, %.preheader ]
  %.062.be = phi i1 [ %.062, %68 ], [ true, %67 ], [ true, %66 ], [ %.062, %63 ], [ %.062, %60 ], [ %.062, %61 ], [ %.062, %53 ], [ %.062, %49 ], [ %.062, %44 ], [ %.062, %43 ], [ %.062, %42 ], [ %.062, %41 ], [ %.062, %40 ], [ %.062, %39 ], [ %.062, %38 ], [ %.062, %35 ], [ %.062, %.preheader ]
  br label %.preheader, !llvm.loop !11

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

35:                                               ; preds = %.preheader
  %36 = load i32, ptr @verbose, align 4, !tbaa !9
  %37 = add i32 %36, 1
  store i32 %37, ptr @verbose, align 4, !tbaa !9
  br label %.preheader.backedge

38:                                               ; preds = %.preheader
  store i32 0, ptr @stuck_meta, align 4, !tbaa !9
  br label %.preheader.backedge

39:                                               ; preds = %.preheader
  store i32 1, ptr @stuck_meta, align 4, !tbaa !9
  br label %.preheader.backedge

40:                                               ; preds = %.preheader
  store i32 2, ptr @stuck_meta, align 4, !tbaa !9
  br label %.preheader.backedge

41:                                               ; preds = %.preheader
  store i8 1, ptr @turn_meta, align 1, !tbaa !30
  br label %.preheader.backedge

42:                                               ; preds = %.preheader
  store i8 1, ptr @force_turn_meta, align 1, !tbaa !30
  store i8 1, ptr @turn_meta, align 1, !tbaa !30
  store i8 0, ptr @quiet, align 1, !tbaa !30
  br label %.preheader.backedge

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

44:                                               ; preds = %.preheader
  %45 = load i32, ptr @env_flags, align 4, !tbaa !9
  %46 = and i32 %45, -131073
  store i32 %46, ptr @env_flags, align 4, !tbaa !9
  %47 = load i32, ptr @chk_flags, align 4, !tbaa !9
  %48 = or i32 %47, 1
  store i32 %48, ptr @chk_flags, align 4, !tbaa !9
  br label %.preheader.backedge

49:                                               ; preds = %.preheader
  %50 = load i32, ptr @env_flags, align 4, !tbaa !9
  %51 = and i32 %50, -1077936129
  %52 = or disjoint i32 %51, 1073741824
  store i32 %52, ptr @env_flags, align 4, !tbaa !9
  br label %.preheader.backedge

53:                                               ; preds = %.preheader
  %54 = load i32, ptr @chk_flags, align 4, !tbaa !9
  %55 = or i32 %54, 2
  store i32 %55, ptr @chk_flags, align 4, !tbaa !9
  br label %.preheader.backedge

56:                                               ; preds = %.preheader
  %57 = load ptr, ptr @only_table, align 8, !tbaa !32
  %.not77 = icmp eq ptr %57, null
  %.pre = load ptr, ptr @optarg, align 8, !tbaa !5
  br i1 %.not77, label %61, label %58

58:                                               ; preds = %56
  %59 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %57, ptr noundef nonnull dereferenceable(1) %.pre) #12
  %.not78 = icmp eq i32 %59, 0
  br i1 %.not78, label %61, label %60

60:                                               ; preds = %58
  call void @usage(ptr noundef %5)
  br label %.preheader.backedge

61:                                               ; preds = %58, %56
  store ptr %.pre, ptr @only_table, align 8, !tbaa !32
  %62 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %.pre) #12
  store i64 %62, ptr getelementptr inbounds (i8, ptr @only_table, i64 8), align 8, !tbaa !35
  br label %.preheader.backedge

63:                                               ; preds = %.preheader
  %64 = load i32, ptr @chk_flags, align 4, !tbaa !9
  %65 = or i32 %64, 8
  store i32 %65, ptr @chk_flags, align 4, !tbaa !9
  br label %.preheader.backedge

66:                                               ; preds = %.preheader
  br label %.preheader.backedge

67:                                               ; preds = %.preheader
  br label %.preheader.backedge

68:                                               ; preds = %.preheader
  call void @usage(ptr noundef %5)
  br label %.preheader.backedge

.critedge:                                        ; preds = %.preheader
  %69 = load i32, ptr @optind, align 4, !tbaa !9
  %70 = add nsw i32 %0, -1
  %.not79 = icmp eq i32 %69, %70
  br i1 %.not79, label %72, label %71

71:                                               ; preds = %.critedge
  call void @usage(ptr noundef %5)
  br label %72

72:                                               ; preds = %71, %.critedge
  %73 = load i32, ptr @stuck_meta, align 4, !tbaa !9
  %74 = icmp sgt i32 %73, -1
  br i1 %74, label %75, label %80

75:                                               ; preds = %72
  %76 = load i32, ptr @env_flags, align 4, !tbaa !9
  %77 = and i32 %76, 4194304
  %78 = icmp eq i32 %77, 0
  br i1 %78, label %79, label %80

79:                                               ; preds = %75
  call void (ptr, ...) @error_fmt(ptr noundef nonnull @.str.4, i32 noundef %73)
  br label %80

80:                                               ; preds = %79, %75, %72
  %.059 = phi i32 [ 5, %79 ], [ 0, %75 ], [ 0, %72 ]
  %81 = load i8, ptr @turn_meta, align 1, !tbaa !30, !range !36, !noundef !37
  %82 = trunc nuw i8 %81 to i1
  br i1 %82, label %83, label %96

83:                                               ; preds = %80
  %84 = load i32, ptr @stuck_meta, align 4, !tbaa !9
  %85 = icmp slt i32 %84, 0
  br i1 %85, label %86, label %87

86:                                               ; preds = %83
  call void (ptr, ...) @error_fmt(ptr noundef nonnull @.str.5)
  br label %87

87:                                               ; preds = %86, %83
  %.160 = phi i32 [ 5, %86 ], [ %.059, %83 ]
  %88 = load i32, ptr @env_flags, align 4, !tbaa !9
  %89 = and i32 %88, 131072
  %.not80 = icmp eq i32 %89, 0
  br i1 %.not80, label %91, label %90

90:                                               ; preds = %87
  call void (ptr, ...) @error_fmt(ptr noundef nonnull @.str.6)
  br label %91

91:                                               ; preds = %90, %87
  %.2 = phi i32 [ 5, %90 ], [ %.160, %87 ]
  %92 = load ptr, ptr @only_table, align 8, !tbaa !32
  %.not81 = icmp eq ptr %92, null
  br i1 %.not81, label %93, label %.thread

93:                                               ; preds = %91
  %94 = load i32, ptr @chk_flags, align 4, !tbaa !9
  %95 = and i32 %94, 6
  %.not82 = icmp eq i32 %95, 0
  br i1 %.not82, label %96, label %.thread

.thread:                                          ; preds = %91, %93
  call void (ptr, ...) @error_fmt(ptr noundef nonnull @.str.7)
  br label %97

96:                                               ; preds = %93, %80
  %.3 = phi i32 [ %.2, %93 ], [ %.059, %80 ]
  %.not83 = icmp eq i32 %.3, 0
  br i1 %.not83, label %98, label %97

97:                                               ; preds = %.thread, %96
  %.3103 = phi i32 [ 5, %.thread ], [ %.3, %96 ]
  call void @exit(i32 noundef %.3103) #13
  unreachable

98:                                               ; preds = %96
  %99 = call ptr @signal(i32 noundef 13, ptr noundef nonnull @signal_handler) #10
  %100 = call ptr @signal(i32 noundef 1, ptr noundef nonnull @signal_handler) #10
  %101 = call ptr @signal(i32 noundef 2, ptr noundef nonnull @signal_handler) #10
  %102 = call ptr @signal(i32 noundef 15, ptr noundef nonnull @signal_handler) #10
  %103 = load i32, ptr @optind, align 4, !tbaa !9
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds ptr, ptr %1, i64 %104
  %106 = load ptr, ptr %105, align 8, !tbaa !5
  %107 = load ptr, ptr getelementptr inbounds (i8, ptr @mdbx_version, i64 40), align 8, !tbaa !20
  %108 = load ptr, ptr getelementptr inbounds (i8, ptr @mdbx_version, i64 16), align 8, !tbaa !21
  %109 = load ptr, ptr getelementptr inbounds (i8, ptr @mdbx_version, i64 24), align 8, !tbaa !23
  %110 = load i32, ptr @env_flags, align 4, !tbaa !9
  %111 = and i32 %110, 131072
  %.not84 = icmp eq i32 %111, 0
  %112 = select i1 %.not84, ptr @.str.10, ptr @.str.9
  %113 = load i32, ptr @verbose, align 4, !tbaa !9
  %114 = icmp ugt i32 %113, 8
  %115 = select i1 %114, ptr @.str.11, ptr @.str.12
  %116 = call i64 (i32, ptr, ...) @print(i32 noundef 68, ptr noundef nonnull @.str.8, ptr noundef %107, ptr noundef %108, ptr noundef %109, ptr noundef %106, ptr noundef nonnull %112, i32 noundef %113, ptr noundef nonnull %115)
  call void @lf_flush()
  %117 = load i32, ptr @verbose, align 4
  %118 = add i32 %117, 2
  %119 = call i32 @llvm.umin.i32(i32 %118, i32 6)
  %120 = call i32 @mdbx_setup_debug(i32 noundef %119, i32 noundef 107, ptr noundef nonnull @logger) #10
  %121 = call i32 @mdbx_env_create(ptr noundef nonnull @env) #10
  %.not85 = icmp eq i32 %121, 0
  br i1 %.not85, label %126, label %122

122:                                              ; preds = %98
  %123 = call i32 @error_fn(ptr noundef nonnull @.str.13, i32 noundef %121)
  %124 = icmp slt i32 %121, 0
  %125 = select i1 %124, i32 3, i32 4
  br label %238

126:                                              ; preds = %98
  %127 = load ptr, ptr @env, align 8, !tbaa !5
  %128 = call i32 @mdbx_env_set_maxdbs(ptr noundef %127, i32 noundef 2) #10
  %.not86 = icmp eq i32 %128, 0
  br i1 %.not86, label %131, label %129

129:                                              ; preds = %126
  %130 = call i32 @error_fn(ptr noundef nonnull @.str.14, i32 noundef %128)
  br label %189

131:                                              ; preds = %126
  %132 = load i32, ptr @stuck_meta, align 4, !tbaa !9
  %133 = icmp sgt i32 %132, -1
  %134 = load ptr, ptr @env, align 8, !tbaa !5
  %135 = load i32, ptr @env_flags, align 4, !tbaa !9
  br i1 %133, label %136, label %140

136:                                              ; preds = %131
  %137 = and i32 %135, 131072
  %138 = icmp eq i32 %137, 0
  %139 = call i32 @mdbx_env_open_for_recovery(ptr noundef %134, ptr noundef %106, i32 noundef %132, i1 noundef zeroext %138) #10
  br label %150

140:                                              ; preds = %131
  %141 = call i32 @mdbx_env_open(ptr noundef %134, ptr noundef %106, i32 noundef %135, i32 noundef 0) #10
  %142 = load i32, ptr @env_flags, align 4, !tbaa !9
  %143 = and i32 %142, 4194304
  %.not87 = icmp eq i32 %143, 0
  br i1 %.not87, label %150, label %144

144:                                              ; preds = %140
  switch i32 %141, label %150 [
    i32 -30778, label %145
    i32 16, label %145
    i32 11, label %145
  ]

145:                                              ; preds = %144, %144, %144
  %146 = and i32 %142, -4194305
  store i32 %146, ptr @env_flags, align 4, !tbaa !9
  %147 = load ptr, ptr @env, align 8, !tbaa !5
  %148 = or i32 %146, 1073741824
  %149 = call i32 @mdbx_env_open(ptr noundef %147, ptr noundef %106, i32 noundef %148, i32 noundef 0) #10
  br label %150

150:                                              ; preds = %144, %140, %145, %136
  %.4 = phi i32 [ %139, %136 ], [ %149, %145 ], [ %141, %144 ], [ %141, %140 ]
  %.not89 = icmp eq i32 %.4, 0
  br i1 %.not89, label %159, label %151

151:                                              ; preds = %150
  %152 = call i32 @error_fn(ptr noundef nonnull @.str.15, i32 noundef %.4)
  %153 = icmp eq i32 %.4, -30419
  br i1 %153, label %154, label %189

154:                                              ; preds = %151
  %155 = load i32, ptr @env_flags, align 4, !tbaa !9
  %156 = and i32 %155, 131072
  %.not94 = icmp eq i32 %156, 0
  br i1 %.not94, label %189, label %157

157:                                              ; preds = %154
  %158 = call ptr (i32, ptr, ...) @print_ln(i32 noundef 68, ptr noundef nonnull @.str.16, ptr noundef %5)
  br label %189

159:                                              ; preds = %150
  %160 = load i32, ptr @env_flags, align 4, !tbaa !9
  %161 = and i32 %160, 4194304
  %.not90 = icmp eq i32 %161, 0
  %162 = select i1 %.not90, ptr @.str.19, ptr @.str.18
  %163 = call ptr (i32, ptr, ...) @print_ln(i32 noundef 120, ptr noundef nonnull @.str.17, ptr noundef nonnull %162)
  br i1 %.062, label %164, label %174

164:                                              ; preds = %159
  %165 = call i64 (i32, ptr, ...) @print(i32 noundef 120, ptr noundef nonnull @.str.20)
  store i64 %165, ptr @anchor_lineno, align 8, !tbaa !38
  call void @flush()
  %166 = load ptr, ptr @env, align 8, !tbaa !5
  %167 = call i32 @mdbx_env_warmup(ptr noundef %166, ptr noundef null, i32 noundef %.064, i32 noundef 235929600) #10
  %168 = add i32 %167, -1
  %or.cond5 = icmp ult i32 %168, -2
  br i1 %or.cond5, label %169, label %171

169:                                              ; preds = %164
  %170 = call i32 @error_fn(ptr noundef nonnull @.str.21, i32 noundef %167)
  br label %189

171:                                              ; preds = %164
  %.not91 = icmp eq i32 %167, 0
  %172 = load i64, ptr @anchor_lineno, align 8, !tbaa !38
  %173 = select i1 %.not91, ptr @.str.23, ptr @.str.22
  call void @suffix(i64 noundef %172, ptr noundef nonnull %173)
  br label %174

174:                                              ; preds = %171, %159
  %175 = load ptr, ptr @env, align 8, !tbaa !5
  %176 = load i32, ptr @chk_flags, align 4, !tbaa !9
  %177 = load i32, ptr @verbose, align 4, !tbaa !9
  %178 = shl i32 %177, 4
  %179 = add i32 %178, 68
  %180 = call i32 @mdbx_env_chk(ptr noundef %175, ptr noundef nonnull @cb, ptr noundef nonnull @chk, i32 noundef %176, i32 noundef %179, i32 noundef 0) #10
  %.not92 = icmp eq i32 %180, 0
  br i1 %.not92, label %189, label %181

181:                                              ; preds = %174
  %182 = load i64, ptr getelementptr inbounds (i8, ptr @chk, i64 168), align 8, !tbaa !39
  %183 = icmp eq i64 %182, 0
  br i1 %183, label %184, label %186

184:                                              ; preds = %181
  %185 = call i32 @error_fn(ptr noundef nonnull @.str.24, i32 noundef %180)
  br label %189

186:                                              ; preds = %181
  switch i32 %180, label %187 [
    i32 -1, label %189
    i32 4, label %189
  ]

187:                                              ; preds = %186
  %188 = load volatile i32, ptr @user_break, align 4, !tbaa !9
  %.not93 = icmp eq i32 %188, 0
  %spec.select = select i1 %.not93, i32 0, i32 %180
  br label %189

189:                                              ; preds = %187, %186, %186, %174, %184, %151, %154, %157, %169, %129
  %.5 = phi i32 [ %128, %129 ], [ -30419, %157 ], [ -30419, %154 ], [ %.4, %151 ], [ %167, %169 ], [ %180, %184 ], [ %180, %186 ], [ 0, %174 ], [ %180, %186 ], [ %spec.select, %187 ]
  %190 = load ptr, ptr @env, align 8, !tbaa !5
  %.not95 = icmp eq ptr %190, null
  br i1 %.not95, label %202, label %191

191:                                              ; preds = %189
  %192 = icmp ne i32 %.5, 0
  %193 = load i64, ptr getelementptr inbounds (i8, ptr @chk, i64 168), align 8
  %194 = icmp ne i64 %193, 0
  %or.cond9 = select i1 %192, i1 true, i1 %194
  br i1 %or.cond9, label %199, label %195

195:                                              ; preds = %191
  %196 = load i32, ptr @chk_flags, align 4, !tbaa !9
  %197 = and i32 %196, 1
  %198 = icmp eq i32 %197, 0
  br label %199

199:                                              ; preds = %195, %191
  %200 = phi i1 [ true, %191 ], [ %198, %195 ]
  %201 = call i32 @mdbx_env_close_ex(ptr noundef nonnull %190, i1 noundef zeroext %200) #10
  br label %202

202:                                              ; preds = %199, %189
  call void @flush()
  %.not96 = icmp eq i32 %.5, 0
  br i1 %.not96, label %208, label %203

203:                                              ; preds = %202
  %204 = icmp sgt i32 %.5, 0
  br i1 %204, label %205, label %238

205:                                              ; preds = %203
  %206 = load volatile i32, ptr @user_break, align 4, !tbaa !9
  %.not100 = icmp eq i32 %206, 0
  %207 = select i1 %.not100, i32 4, i32 5
  br label %238

208:                                              ; preds = %202
  %209 = call i32 @clock_gettime(i32 noundef 1, ptr noundef nonnull %4) #10
  %.not97 = icmp eq i32 %209, 0
  br i1 %.not97, label %214, label %210

210:                                              ; preds = %208
  %211 = tail call ptr @__errno_location() #11
  %212 = load i32, ptr %211, align 4, !tbaa !9
  %213 = call i32 @error_fn(ptr noundef nonnull @.str, i32 noundef %212)
  br label %238

214:                                              ; preds = %208
  %215 = load i64, ptr %4, align 8, !tbaa !42
  %216 = load i64, ptr %3, align 8, !tbaa !42
  %217 = sub nsw i64 %215, %216
  %218 = sitofp i64 %217 to double
  %219 = getelementptr inbounds i8, ptr %4, i64 8
  %220 = load i64, ptr %219, align 8, !tbaa !44
  %221 = getelementptr inbounds i8, ptr %3, i64 8
  %222 = load i64, ptr %221, align 8, !tbaa !44
  %223 = sub nsw i64 %220, %222
  %224 = sitofp i64 %223 to double
  %225 = call double @llvm.fmuladd.f64(double %224, double 1.000000e-09, double %218)
  %226 = load i64, ptr getelementptr inbounds (i8, ptr @chk, i64 168), align 8, !tbaa !39
  %.not98 = icmp eq i64 %226, 0
  br i1 %.not98, label %236, label %227

227:                                              ; preds = %214
  %.not99 = icmp eq i64 %226, 1
  %228 = select i1 %.not99, ptr @.str.27, ptr @.str.26
  %229 = call ptr (i32, ptr, ...) @print_ln(i32 noundef 68, ptr noundef nonnull @.str.25, i64 noundef %226, ptr noundef nonnull %228, double noundef %225)
  %230 = load i64, ptr getelementptr inbounds (i8, ptr @chk, i64 120), align 8, !tbaa !45
  %231 = icmp ne i64 %230, 0
  %232 = load i64, ptr getelementptr inbounds (i8, ptr @chk, i64 160), align 8
  %233 = icmp ne i64 %232, 0
  %or.cond11 = select i1 %231, i1 true, i1 %233
  %234 = load i64, ptr getelementptr inbounds (i8, ptr @chk, i64 152), align 8
  %235 = icmp ne i64 %234, 0
  %or.cond13 = select i1 %or.cond11, i1 true, i1 %235
  %. = select i1 %or.cond13, i32 2, i32 1
  br label %238

236:                                              ; preds = %214
  %237 = call ptr (i32, ptr, ...) @print_ln(i32 noundef 68, ptr noundef nonnull @.str.28, double noundef %225)
  br label %238

238:                                              ; preds = %15, %227, %203, %236, %210, %205, %122, %10
  %.1 = phi i32 [ 4, %10 ], [ %125, %122 ], [ %207, %205 ], [ 4, %210 ], [ 0, %236 ], [ 0, %15 ], [ 3, %203 ], [ %., %227 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #10
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #10
  ret i32 %.1
}

; 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(ptr noundef) local_unnamed_addr #0

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

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

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

; 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 #4

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #5

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

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

; 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: nounwind uwtable
declare hidden i64 @print(i32 noundef, ptr noundef, ...) local_unnamed_addr #0

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

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

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

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

declare i32 @mdbx_env_open_for_recovery(ptr noundef, ptr noundef, i32 noundef, i1 noundef zeroext) local_unnamed_addr #7

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

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

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

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

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

declare i32 @mdbx_env_chk(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #7

declare i32 @mdbx_env_close_ex(ptr noundef, i1 noundef zeroext) local_unnamed_addr #7

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #8

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

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 = { 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 #4 = { 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 #5 = { 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 #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 = { "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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #10 = { nounwind }
attributes #11 = { nounwind willreturn memory(none) }
attributes #12 = { nounwind willreturn memory(read) }
attributes #13 = { noreturn nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !15, i64 0}
!14 = !{!"MDBX_version_info", !15, i64 0, !15, i64 2, !15, i64 4, !15, i64 6, !6, i64 8, !16, i64 16, !6, i64 48}
!15 = !{!"short", !7, i64 0}
!16 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!17 = !{!14, !15, i64 2}
!18 = !{!14, !15, i64 4}
!19 = !{!14, !15, i64 6}
!20 = !{!14, !6, i64 40}
!21 = !{!14, !6, i64 16}
!22 = !{!14, !6, i64 32}
!23 = !{!14, !6, i64 24}
!24 = !{!25, !6, i64 0}
!25 = !{!"MDBX_build_info", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!26 = !{!25, !6, i64 8}
!27 = !{!25, !6, i64 24}
!28 = !{!25, !6, i64 32}
!29 = !{!25, !6, i64 16}
!30 = !{!31, !31, i64 0}
!31 = !{!"_Bool", !7, i64 0}
!32 = !{!33, !6, i64 0}
!33 = !{!"iovec", !6, i64 0, !34, i64 8}
!34 = !{!"long", !7, i64 0}
!35 = !{!33, !34, i64 8}
!36 = !{i8 0, i8 2}
!37 = !{}
!38 = !{!34, !34, i64 0}
!39 = !{!40, !34, i64 168}
!40 = !{!"MDBX_chk_context", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !7, i64 32, !41, i64 40}
!41 = !{!"", !34, i64 0, !34, i64 8, !34, i64 16, !34, i64 24, !34, i64 32, !34, i64 40, !34, i64 48, !34, i64 56, !34, i64 64, !34, i64 72, !34, i64 80, !34, i64 88, !34, i64 96, !34, i64 104, !34, i64 112, !34, i64 120, !34, i64 128, !34, i64 136, !34, i64 144, !6, i64 152}
!42 = !{!43, !34, i64 0}
!43 = !{!"timespec", !34, i64 0, !34, i64 8}
!44 = !{!43, !34, i64 8}
!45 = !{!40, !34, i64 120}


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