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

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

@quiet = external dso_local global i8, align 1
@prog = external hidden global ptr, align 8
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = 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
@optind = external global i32, align 4
@.str.2 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.10 = 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 i32, align 4
  %14 = alloca i8, align 1
  %15 = 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) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  store ptr null, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  store ptr null, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 1073741824, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #5
  store i8 0, ptr %14, align 1, !tbaa !11
  %16 = load ptr, ptr %5, align 8, !tbaa !9
  %17 = getelementptr inbounds ptr, ptr %16, i64 0
  %18 = load ptr, ptr %17, align 8, !tbaa !9
  store ptr %18, ptr @prog, align 8, !tbaa !9
  %19 = load i32, ptr %4, align 4, !tbaa !5
  %20 = icmp slt i32 %19, 2
  br i1 %20, label %21, label %22

21:                                               ; preds = %2
  call void @usage()
  br label %22

22:                                               ; preds = %21, %2
  br label %23

23:                                               ; preds = %55, %22
  %24 = load i32, ptr %4, align 4, !tbaa !5
  %25 = load ptr, ptr %5, align 8, !tbaa !9
  %26 = call i32 @getopt(i32 noundef %24, ptr noundef %25, ptr noundef @.str) #5
  store i32 %26, ptr %6, align 4, !tbaa !5
  %27 = icmp ne i32 %26, -1
  br i1 %27, label %28, label %56

28:                                               ; preds = %23
  %29 = load i32, ptr %6, align 4, !tbaa !5
  switch i32 %29, label %54 [
    i32 86, label %30
    i32 113, label %50
    i32 100, label %51
    i32 110, label %55
    i32 115, label %52
  ]

30:                                               ; preds = %28
  %31 = load i16, ptr @mdbx_version, align 8, !tbaa !13
  %32 = zext i16 %31 to i32
  %33 = load i16, ptr getelementptr inbounds (%struct.MDBX_version_info, ptr @mdbx_version, i32 0, i32 1), align 2, !tbaa !17
  %34 = zext i16 %33 to i32
  %35 = load i16, ptr getelementptr inbounds (%struct.MDBX_version_info, ptr @mdbx_version, i32 0, i32 2), align 4, !tbaa !18
  %36 = zext i16 %35 to i32
  %37 = load i16, ptr getelementptr inbounds (%struct.MDBX_version_info, ptr @mdbx_version, i32 0, i32 3), align 2, !tbaa !19
  %38 = zext i16 %37 to i32
  %39 = 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
  %40 = load ptr, ptr getelementptr inbounds (%struct.MDBX_version_info, ptr @mdbx_version, i32 0, i32 5), align 8, !tbaa !21
  %41 = 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
  %42 = 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
  %43 = load ptr, ptr @mdbx_sourcery_MDBX_BUILD_SOURCERY, align 8, !tbaa !9
  %44 = load ptr, ptr @mdbx_build, align 8, !tbaa !24
  %45 = load ptr, ptr getelementptr inbounds (%struct.MDBX_build_info, ptr @mdbx_build, i32 0, i32 1), align 8, !tbaa !26
  %46 = load ptr, ptr getelementptr inbounds (%struct.MDBX_build_info, ptr @mdbx_build, i32 0, i32 3), align 8, !tbaa !27
  %47 = load ptr, ptr getelementptr inbounds (%struct.MDBX_build_info, ptr @mdbx_build, i32 0, i32 4), align 8, !tbaa !28
  %48 = load ptr, ptr getelementptr inbounds (%struct.MDBX_build_info, ptr @mdbx_build, i32 0, i32 2), align 8, !tbaa !29
  %49 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %32, i32 noundef %34, i32 noundef %36, i32 noundef %38, ptr noundef %39, ptr noundef %40, ptr noundef %41, ptr noundef %42, ptr noundef %43, ptr noundef %44, ptr noundef %45, ptr noundef %46, ptr noundef %47, ptr noundef %48)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %204

50:                                               ; preds = %28
  store i8 1, ptr @quiet, align 1, !tbaa !11
  br label %55

51:                                               ; preds = %28
  store i8 1, ptr %14, align 1, !tbaa !11
  br label %55

52:                                               ; preds = %28
  %53 = load ptr, ptr @optarg, align 8, !tbaa !9
  store ptr %53, ptr %12, align 8, !tbaa !9
  br label %55

54:                                               ; preds = %28
  call void @usage()
  br label %55

55:                                               ; preds = %54, %52, %51, %50, %28
  br label %23, !llvm.loop !30

56:                                               ; preds = %23
  %57 = load i32, ptr @optind, align 4, !tbaa !5
  %58 = load i32, ptr %4, align 4, !tbaa !5
  %59 = sub nsw i32 %58, 1
  %60 = icmp ne i32 %57, %59
  br i1 %60, label %61, label %62

61:                                               ; preds = %56
  call void @usage()
  br label %62

62:                                               ; preds = %61, %56
  %63 = call ptr @signal(i32 noundef 13, ptr noundef @signal_handler) #5
  %64 = call ptr @signal(i32 noundef 1, ptr noundef @signal_handler) #5
  %65 = call ptr @signal(i32 noundef 2, ptr noundef @signal_handler) #5
  %66 = call ptr @signal(i32 noundef 15, ptr noundef @signal_handler) #5
  %67 = load ptr, ptr %5, align 8, !tbaa !9
  %68 = load i32, ptr @optind, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds ptr, ptr %67, i64 %69
  %71 = load ptr, ptr %70, align 8, !tbaa !9
  store ptr %71, ptr %11, align 8, !tbaa !9
  %72 = load i8, ptr @quiet, align 1, !tbaa !11, !range !32, !noundef !33
  %73 = trunc i8 %72 to i1
  br i1 %73, label %89, label %74

74:                                               ; preds = %62
  %75 = 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
  %76 = load ptr, ptr getelementptr inbounds (%struct.MDBX_version_info, ptr @mdbx_version, i32 0, i32 5), align 8, !tbaa !21
  %77 = 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
  %78 = load ptr, ptr %11, align 8, !tbaa !9
  %79 = load ptr, ptr %12, align 8, !tbaa !9
  %80 = icmp ne ptr %79, null
  br i1 %80, label %81, label %83

81:                                               ; preds = %74
  %82 = load ptr, ptr %12, align 8, !tbaa !9
  br label %84

83:                                               ; preds = %74
  br label %84

84:                                               ; preds = %83, %81
  %85 = phi ptr [ %82, %81 ], [ @.str.3, %83 ]
  %86 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, ptr noundef %75, ptr noundef %76, ptr noundef %77, ptr noundef %78, ptr noundef %85)
  %87 = call i32 @fflush(ptr noundef null)
  %88 = call i32 @mdbx_setup_debug(i32 noundef 3, i32 noundef -1, ptr noundef @logger)
  br label %89

89:                                               ; preds = %84, %62
  %90 = call i32 @mdbx_env_create(ptr noundef %8)
  store i32 %90, ptr %7, align 4, !tbaa !5
  %91 = load i32, ptr %7, align 4, !tbaa !5
  %92 = icmp ne i32 %91, 0
  %93 = xor i1 %92, true
  %94 = xor i1 %93, true
  %95 = zext i1 %94 to i32
  %96 = sext i32 %95 to i64
  %97 = call i64 @llvm.expect.i64(i64 %96, i64 0)
  %98 = icmp ne i64 %97, 0
  br i1 %98, label %99, label %101

99:                                               ; preds = %89
  %100 = load i32, ptr %7, align 4, !tbaa !5
  call void @error(ptr noundef @.str.4, i32 noundef %100)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %204

101:                                              ; preds = %89
  %102 = load ptr, ptr %12, align 8, !tbaa !9
  %103 = icmp ne ptr %102, null
  br i1 %103, label %104, label %118

104:                                              ; preds = %101
  %105 = load ptr, ptr %8, align 8, !tbaa !9
  %106 = call i32 @mdbx_env_set_maxdbs(ptr noundef %105, i32 noundef 2)
  store i32 %106, ptr %7, align 4, !tbaa !5
  %107 = load i32, ptr %7, align 4, !tbaa !5
  %108 = icmp ne i32 %107, 0
  %109 = xor i1 %108, true
  %110 = xor i1 %109, true
  %111 = zext i1 %110 to i32
  %112 = sext i32 %111 to i64
  %113 = call i64 @llvm.expect.i64(i64 %112, i64 0)
  %114 = icmp ne i64 %113, 0
  br i1 %114, label %115, label %117

115:                                              ; preds = %104
  %116 = load i32, ptr %7, align 4, !tbaa !5
  call void @error(ptr noundef @.str.5, i32 noundef %116)
  br label %197

117:                                              ; preds = %104
  br label %118

118:                                              ; preds = %117, %101
  %119 = load ptr, ptr %8, align 8, !tbaa !9
  %120 = load ptr, ptr %11, align 8, !tbaa !9
  %121 = load i32, ptr %13, align 4, !tbaa !5
  %122 = call i32 @mdbx_env_open(ptr noundef %119, ptr noundef %120, i32 noundef %121, i32 noundef 0)
  store i32 %122, ptr %7, align 4, !tbaa !5
  %123 = load i32, ptr %7, align 4, !tbaa !5
  %124 = icmp ne i32 %123, 0
  %125 = xor i1 %124, true
  %126 = xor i1 %125, true
  %127 = zext i1 %126 to i32
  %128 = sext i32 %127 to i64
  %129 = call i64 @llvm.expect.i64(i64 %128, i64 0)
  %130 = icmp ne i64 %129, 0
  br i1 %130, label %131, label %133

131:                                              ; preds = %118
  %132 = load i32, ptr %7, align 4, !tbaa !5
  call void @error(ptr noundef @.str.6, i32 noundef %132)
  br label %197

133:                                              ; preds = %118
  %134 = load ptr, ptr %8, align 8, !tbaa !9
  %135 = call i32 @mdbx_txn_begin(ptr noundef %134, ptr noundef null, i32 noundef 0, ptr noundef %9)
  store i32 %135, ptr %7, align 4, !tbaa !5
  %136 = load i32, ptr %7, align 4, !tbaa !5
  %137 = icmp ne i32 %136, 0
  %138 = xor i1 %137, true
  %139 = xor i1 %138, true
  %140 = zext i1 %139 to i32
  %141 = sext i32 %140 to i64
  %142 = call i64 @llvm.expect.i64(i64 %141, i64 0)
  %143 = icmp ne i64 %142, 0
  br i1 %143, label %144, label %146

144:                                              ; preds = %133
  %145 = load i32, ptr %7, align 4, !tbaa !5
  call void @error(ptr noundef @.str.7, i32 noundef %145)
  br label %197

146:                                              ; preds = %133
  %147 = load ptr, ptr %9, align 8, !tbaa !9
  %148 = load ptr, ptr %12, align 8, !tbaa !9
  %149 = call i32 @mdbx_dbi_open(ptr noundef %147, ptr noundef %148, i32 noundef 1073741824, ptr noundef %10)
  store i32 %149, ptr %7, align 4, !tbaa !5
  %150 = load i32, ptr %7, align 4, !tbaa !5
  %151 = icmp ne i32 %150, 0
  %152 = xor i1 %151, true
  %153 = xor i1 %152, true
  %154 = zext i1 %153 to i32
  %155 = sext i32 %154 to i64
  %156 = call i64 @llvm.expect.i64(i64 %155, i64 0)
  %157 = icmp ne i64 %156, 0
  br i1 %157, label %158, label %160

158:                                              ; preds = %146
  %159 = load i32, ptr %7, align 4, !tbaa !5
  call void @error(ptr noundef @.str.8, i32 noundef %159)
  br label %190

160:                                              ; preds = %146
  %161 = load ptr, ptr %9, align 8, !tbaa !9
  %162 = load i32, ptr %10, align 4, !tbaa !5
  %163 = load i8, ptr %14, align 1, !tbaa !11, !range !32, !noundef !33
  %164 = trunc i8 %163 to i1
  %165 = call i32 @mdbx_drop(ptr noundef %161, i32 noundef %162, i1 noundef zeroext %164)
  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 = %160
  %175 = load i32, ptr %7, align 4, !tbaa !5
  call void @error(ptr noundef @.str.9, i32 noundef %175)
  br label %190

176:                                              ; preds = %160
  %177 = load ptr, ptr %9, align 8, !tbaa !9
  %178 = call i32 @mdbx_txn_commit(ptr noundef %177)
  store i32 %178, ptr %7, align 4, !tbaa !5
  %179 = load i32, ptr %7, align 4, !tbaa !5
  %180 = icmp ne i32 %179, 0
  %181 = xor i1 %180, true
  %182 = xor i1 %181, true
  %183 = zext i1 %182 to i32
  %184 = sext i32 %183 to i64
  %185 = call i64 @llvm.expect.i64(i64 %184, i64 0)
  %186 = icmp ne i64 %185, 0
  br i1 %186, label %187, label %189

187:                                              ; preds = %176
  %188 = load i32, ptr %7, align 4, !tbaa !5
  call void @error(ptr noundef @.str.10, i32 noundef %188)
  br label %190

189:                                              ; preds = %176
  store ptr null, ptr %9, align 8, !tbaa !9
  br label %190

190:                                              ; preds = %189, %187, %174, %158
  %191 = load ptr, ptr %9, align 8, !tbaa !9
  %192 = icmp ne ptr %191, null
  br i1 %192, label %193, label %196

193:                                              ; preds = %190
  %194 = load ptr, ptr %9, align 8, !tbaa !9
  %195 = call i32 @mdbx_txn_abort(ptr noundef %194)
  br label %196

196:                                              ; preds = %193, %190
  br label %197

197:                                              ; preds = %196, %144, %131, %115
  %198 = load ptr, ptr %8, align 8, !tbaa !9
  %199 = call i32 @mdbx_env_close(ptr noundef %198)
  %200 = load i32, ptr %7, align 4, !tbaa !5
  %201 = icmp ne i32 %200, 0
  %202 = zext i1 %201 to i64
  %203 = select i1 %201, i32 1, i32 0
  store i32 %203, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %204

204:                                              ; preds = %197, %99, %30
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  %205 = load i32, ptr %3, align 4
  ret i32 %205
}

; 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

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

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

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

declare i32 @mdbx_txn_commit(ptr noundef) #3

declare i32 @mdbx_txn_abort(ptr noundef) #3

declare i32 @mdbx_env_close(ptr noundef) #3

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

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 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #5 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!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 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}
!32 = !{i8 0, i8 2}
!33 = !{}


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

@quiet = external dso_local local_unnamed_addr global i8, align 1
@prog = external hidden local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = 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
@optind = external local_unnamed_addr global i32, align 4
@.str.2 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [16 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) 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
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  %6 = load ptr, ptr %1, align 8, !tbaa !5
  store ptr %6, ptr @prog, align 8, !tbaa !5
  %7 = icmp slt i32 %0, 2
  br i1 %7, label %8, label %.preheader

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

.preheader:                                       ; preds = %8, %2
  br label %.outer

.outer:                                           ; preds = %.preheader, %32
  %.031.ph = phi ptr [ null, %.preheader ], [ %33, %32 ]
  %.0.ph = phi i1 [ false, %.preheader ], [ %.0.ph68, %32 ]
  br label %.outer67

.outer67:                                         ; preds = %9, %.outer
  %.0.ph68 = phi i1 [ %.0.ph, %.outer ], [ true, %9 ]
  br label %9

9:                                                ; preds = %.backedge, %.outer67
  %10 = tail call i32 @getopt(i32 noundef %0, ptr noundef nonnull %1, ptr noundef nonnull @.str) #5
  switch i32 %10, label %34 [
    i32 -1, label %35
    i32 86, label %11
    i32 113, label %31
    i32 100, label %.outer67
    i32 110, label %.backedge
    i32 115, label %32
  ], !llvm.loop !9

.backedge:                                        ; preds = %9, %34, %31
  br label %9, !llvm.loop !9

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

31:                                               ; preds = %9
  store i8 1, ptr @quiet, align 1, !tbaa !28
  br label %.backedge

32:                                               ; preds = %9
  %33 = load ptr, ptr @optarg, align 8, !tbaa !5
  br label %.outer, !llvm.loop !9

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

35:                                               ; preds = %9
  %36 = load i32, ptr @optind, align 4, !tbaa !30
  %37 = add nsw i32 %0, -1
  %.not45 = icmp eq i32 %36, %37
  br i1 %.not45, label %39, label %38

38:                                               ; preds = %35
  tail call void @usage()
  br label %39

39:                                               ; preds = %38, %35
  %40 = tail call ptr @signal(i32 noundef 13, ptr noundef nonnull @signal_handler) #5
  %41 = tail call ptr @signal(i32 noundef 1, ptr noundef nonnull @signal_handler) #5
  %42 = tail call ptr @signal(i32 noundef 2, ptr noundef nonnull @signal_handler) #5
  %43 = tail call ptr @signal(i32 noundef 15, ptr noundef nonnull @signal_handler) #5
  %44 = load i32, ptr @optind, align 4, !tbaa !30
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds ptr, ptr %1, i64 %45
  %47 = load ptr, ptr %46, align 8, !tbaa !5
  %48 = load i8, ptr @quiet, align 1, !tbaa !28, !range !32, !noundef !33
  %49 = trunc nuw i8 %48 to i1
  br i1 %49, label %58, label %50

50:                                               ; preds = %39
  %51 = load ptr, ptr getelementptr inbounds (i8, ptr @mdbx_version, i64 40), align 8, !tbaa !18
  %52 = load ptr, ptr getelementptr inbounds (i8, ptr @mdbx_version, i64 16), align 8, !tbaa !19
  %53 = load ptr, ptr getelementptr inbounds (i8, ptr @mdbx_version, i64 24), align 8, !tbaa !21
  %.not46 = icmp eq ptr %.031.ph, null
  %54 = select i1 %.not46, ptr @.str.3, ptr %.031.ph
  %55 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef %51, ptr noundef %52, ptr noundef %53, ptr noundef %47, ptr noundef nonnull %54)
  %56 = tail call i32 @fflush(ptr noundef null)
  %57 = tail call i32 @mdbx_setup_debug(i32 noundef 3, i32 noundef -1, ptr noundef nonnull @logger) #5
  br label %58

58:                                               ; preds = %50, %39
  %59 = call i32 @mdbx_env_create(ptr noundef nonnull %3) #5
  %.not47 = icmp eq i32 %59, 0
  br i1 %.not47, label %61, label %60, !prof !34

60:                                               ; preds = %58
  call void @error(ptr noundef nonnull @.str.4, i32 noundef %59)
  br label %93

61:                                               ; preds = %58
  %.not48 = icmp eq ptr %.031.ph, null
  br i1 %.not48, label %66, label %62

62:                                               ; preds = %61
  %63 = load ptr, ptr %3, align 8, !tbaa !5
  %64 = call i32 @mdbx_env_set_maxdbs(ptr noundef %63, i32 noundef 2) #5
  %.not49 = icmp eq i32 %64, 0
  br i1 %.not49, label %66, label %65, !prof !34

65:                                               ; preds = %62
  call void @error(ptr noundef nonnull @.str.5, i32 noundef %64)
  br label %90

66:                                               ; preds = %62, %61
  %67 = load ptr, ptr %3, align 8, !tbaa !5
  %68 = call i32 @mdbx_env_open(ptr noundef %67, ptr noundef %47, i32 noundef 1073741824, i32 noundef 0) #5
  %.not50 = icmp eq i32 %68, 0
  br i1 %.not50, label %70, label %69, !prof !34

69:                                               ; preds = %66
  call void @error(ptr noundef nonnull @.str.6, i32 noundef %68)
  br label %90

70:                                               ; preds = %66
  %71 = load ptr, ptr %3, align 8, !tbaa !5
  %72 = call i32 @mdbx_txn_begin(ptr noundef %71, ptr noundef null, i32 noundef 0, ptr noundef nonnull %4) #5
  %.not51 = icmp eq i32 %72, 0
  br i1 %.not51, label %74, label %73, !prof !34

73:                                               ; preds = %70
  call void @error(ptr noundef nonnull @.str.7, i32 noundef %72)
  br label %90

74:                                               ; preds = %70
  %75 = load ptr, ptr %4, align 8, !tbaa !5
  %76 = call i32 @mdbx_dbi_open(ptr noundef %75, ptr noundef %.031.ph, i32 noundef 1073741824, ptr noundef nonnull %5) #5
  %.not52 = icmp eq i32 %76, 0
  br i1 %.not52, label %78, label %77, !prof !34

77:                                               ; preds = %74
  call void @error(ptr noundef nonnull @.str.8, i32 noundef %76)
  br label %87

78:                                               ; preds = %74
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  %80 = load i32, ptr %5, align 4, !tbaa !30
  %81 = call i32 @mdbx_drop(ptr noundef %79, i32 noundef %80, i1 noundef zeroext %.0.ph68) #5
  %.not53 = icmp eq i32 %81, 0
  br i1 %.not53, label %83, label %82, !prof !34

82:                                               ; preds = %78
  call void @error(ptr noundef nonnull @.str.9, i32 noundef %81)
  br label %87

83:                                               ; preds = %78
  %84 = load ptr, ptr %4, align 8, !tbaa !5
  %85 = call i32 @mdbx_txn_commit(ptr noundef %84) #5
  %.not54 = icmp eq i32 %85, 0
  br i1 %.not54, label %.thread, label %86, !prof !34

86:                                               ; preds = %83
  call void @error(ptr noundef nonnull @.str.10, i32 noundef %85)
  br label %87

.thread:                                          ; preds = %83
  store ptr null, ptr %4, align 8, !tbaa !5
  br label %90

87:                                               ; preds = %86, %82, %77
  %.pr = load ptr, ptr %4, align 8, !tbaa !5
  %.not55 = icmp eq ptr %.pr, null
  br i1 %.not55, label %90, label %88

88:                                               ; preds = %87
  %89 = call i32 @mdbx_txn_abort(ptr noundef nonnull %.pr) #5
  br label %90

90:                                               ; preds = %.thread, %87, %88, %73, %69, %65
  %.not56 = phi i32 [ 1, %65 ], [ 1, %69 ], [ 1, %73 ], [ 1, %88 ], [ 1, %87 ], [ 0, %.thread ]
  %91 = load ptr, ptr %3, align 8, !tbaa !5
  %92 = call i32 @mdbx_env_close(ptr noundef %91) #5
  br label %93

93:                                               ; preds = %90, %60, %11
  %.030 = phi i32 [ 0, %11 ], [ 1, %60 ], [ %.not56, %90 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  ret i32 %.030
}

; 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

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

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

declare i32 @mdbx_txn_commit(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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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


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