; LLVM IR from erthink/libmdbx :: src (cursor)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.libmdbx_globals = type { %union.bin128, i32, i32, i8, i8, i8, i8, i32, %union.logger_union, %union.pthread_mutex_t, i64, ptr }
%union.bin128 = type { %struct.anon.8 }
%struct.anon.8 = type { i64, i64 }
%union.logger_union = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%struct.MDBX_cursor = type { i32, %union.anon, i8, i8, ptr, ptr, ptr, ptr, ptr, [32 x ptr], [32 x i16], ptr, ptr }
%union.anon = type { i16 }
%struct.MDBX_txn = type { i32, i32, i64, i64, ptr, ptr, %struct.geo, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, %struct.MDBX_canary, ptr, %union.anon.2 }
%struct.geo = type { i16, i16, i32, i32, %union.anon.0, %union.anon.1 }
%union.anon.0 = type { i32 }
%union.anon.1 = type { i32 }
%struct.MDBX_canary = type { i64, i64, i64, i64 }
%union.anon.2 = type { %struct.anon.4 }
%struct.anon.4 = type { %struct.troika, ptr, %struct.anon.5, i8, i32, i32, i64, ptr, ptr, ptr, i64, %union.anon.6 }
%struct.troika = type { i8, i8, i8, i8, i32, [3 x i64] }
%struct.anon.5 = type { %struct.MDBX_rkl, i64, %struct.MDBX_rkl }
%struct.MDBX_rkl = type { i64, i64, i32, i32, ptr, [12 x i64] }
%union.anon.6 = type { %struct.anon.7 }
%struct.anon.7 = type { i64, ptr }
%struct.anon = type { i8, i8 }

@globals = external global %struct.libmdbx_globals, align 8
@.str.38 = external hidden unnamed_addr constant [23 x i8], align 1
@__func__.cursor_cpstk = external hidden unnamed_addr constant [13 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [35 x i8], align 1

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

; Function Attrs: noreturn
declare void @mdbx_assert_fail(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #1

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @cursor_cpstk(ptr noundef %0, ptr noundef %1) #3 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  br label %6

6:                                                ; preds = %2
  %7 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !9
  %8 = zext i8 %7 to i32
  %9 = and i32 %8, 1
  %10 = icmp ne i32 %9, 0
  %11 = xor i1 %10, true
  %12 = xor i1 %11, true
  %13 = zext i1 %12 to i32
  %14 = sext i32 %13 to i64
  %15 = call i64 @llvm.expect.i64(i64 %14, i64 1)
  %16 = icmp ne i64 %15, 0
  br i1 %16, label %17, label %41

17:                                               ; preds = %6
  br label %18

18:                                               ; preds = %17
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.MDBX_cursor, ptr %19, i32 0, i32 5
  %21 = load ptr, ptr %20, align 8, !tbaa !14
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.MDBX_cursor, ptr %22, i32 0, i32 5
  %24 = load ptr, ptr %23, align 8, !tbaa !14
  %25 = icmp eq ptr %21, %24
  %26 = xor i1 %25, true
  %27 = xor i1 %26, true
  %28 = xor i1 %27, true
  %29 = zext i1 %28 to i32
  %30 = sext i32 %29 to i64
  %31 = call i64 @llvm.expect.i64(i64 %30, i64 0)
  %32 = icmp ne i64 %31, 0
  br i1 %32, label %33, label %39

33:                                               ; preds = %18
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.MDBX_cursor, ptr %34, i32 0, i32 5
  %36 = load ptr, ptr %35, align 8, !tbaa !14
  %37 = getelementptr inbounds %struct.MDBX_txn, ptr %36, i32 0, i32 9
  %38 = load ptr, ptr %37, align 8, !tbaa !16
  call void @mdbx_assert_fail(ptr noundef %38, ptr noundef @.str.38, ptr noundef @__func__.cursor_cpstk, i32 noundef 398) #4
  unreachable

39:                                               ; preds = %18
  br label %40

40:                                               ; preds = %39
  br label %41

41:                                               ; preds = %40, %6
  br label %42

42:                                               ; preds = %41
  br label %43

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

54:                                               ; preds = %43
  br label %55

55:                                               ; preds = %54
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.MDBX_cursor, ptr %56, i32 0, i32 6
  %58 = load ptr, ptr %57, align 8, !tbaa !21
  %59 = load ptr, ptr %3, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.MDBX_cursor, ptr %59, i32 0, i32 6
  %61 = load ptr, ptr %60, align 8, !tbaa !21
  %62 = icmp eq ptr %58, %61
  %63 = xor i1 %62, true
  %64 = xor i1 %63, true
  %65 = xor i1 %64, true
  %66 = zext i1 %65 to i32
  %67 = sext i32 %66 to i64
  %68 = call i64 @llvm.expect.i64(i64 %67, i64 0)
  %69 = icmp ne i64 %68, 0
  br i1 %69, label %70, label %76

70:                                               ; preds = %55
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.MDBX_cursor, ptr %71, i32 0, i32 5
  %73 = load ptr, ptr %72, align 8, !tbaa !14
  %74 = getelementptr inbounds %struct.MDBX_txn, ptr %73, i32 0, i32 9
  %75 = load ptr, ptr %74, align 8, !tbaa !16
  call void @mdbx_assert_fail(ptr noundef %75, ptr noundef @.str.39, ptr noundef @__func__.cursor_cpstk, i32 noundef 399) #4
  unreachable

76:                                               ; preds = %55
  br label %77

77:                                               ; preds = %76
  br label %78

78:                                               ; preds = %77, %43
  br label %79

79:                                               ; preds = %78
  br label %80

80:                                               ; preds = %79
  %81 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !9
  %82 = zext i8 %81 to i32
  %83 = and i32 %82, 1
  %84 = icmp ne i32 %83, 0
  %85 = xor i1 %84, true
  %86 = xor i1 %85, true
  %87 = zext i1 %86 to i32
  %88 = sext i32 %87 to i64
  %89 = call i64 @llvm.expect.i64(i64 %88, i64 1)
  %90 = icmp ne i64 %89, 0
  br i1 %90, label %91, label %115

91:                                               ; preds = %80
  br label %92

92:                                               ; preds = %91
  %93 = load ptr, ptr %4, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.MDBX_cursor, ptr %93, i32 0, i32 7
  %95 = load ptr, ptr %94, align 8, !tbaa !22
  %96 = load ptr, ptr %3, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.MDBX_cursor, ptr %96, i32 0, i32 7
  %98 = load ptr, ptr %97, align 8, !tbaa !22
  %99 = icmp eq ptr %95, %98
  %100 = xor i1 %99, true
  %101 = xor i1 %100, true
  %102 = xor i1 %101, true
  %103 = zext i1 %102 to i32
  %104 = sext i32 %103 to i64
  %105 = call i64 @llvm.expect.i64(i64 %104, i64 0)
  %106 = icmp ne i64 %105, 0
  br i1 %106, label %107, label %113

107:                                              ; preds = %92
  %108 = load ptr, ptr %4, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.MDBX_cursor, ptr %108, i32 0, i32 5
  %110 = load ptr, ptr %109, align 8, !tbaa !14
  %111 = getelementptr inbounds %struct.MDBX_txn, ptr %110, i32 0, i32 9
  %112 = load ptr, ptr %111, align 8, !tbaa !16
  call void @mdbx_assert_fail(ptr noundef %112, ptr noundef @.str.40, ptr noundef @__func__.cursor_cpstk, i32 noundef 400) #4
  unreachable

113:                                              ; preds = %92
  br label %114

114:                                              ; preds = %113
  br label %115

115:                                              ; preds = %114, %80
  br label %116

116:                                              ; preds = %115
  br label %117

117:                                              ; preds = %116
  %118 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !9
  %119 = zext i8 %118 to i32
  %120 = and i32 %119, 1
  %121 = icmp ne i32 %120, 0
  %122 = xor i1 %121, true
  %123 = xor i1 %122, true
  %124 = zext i1 %123 to i32
  %125 = sext i32 %124 to i64
  %126 = call i64 @llvm.expect.i64(i64 %125, i64 1)
  %127 = icmp ne i64 %126, 0
  br i1 %127, label %128, label %152

128:                                              ; preds = %117
  br label %129

129:                                              ; preds = %128
  %130 = load ptr, ptr %4, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.MDBX_cursor, ptr %130, i32 0, i32 4
  %132 = load ptr, ptr %131, align 8, !tbaa !23
  %133 = load ptr, ptr %3, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.MDBX_cursor, ptr %133, i32 0, i32 4
  %135 = load ptr, ptr %134, align 8, !tbaa !23
  %136 = icmp eq ptr %132, %135
  %137 = xor i1 %136, true
  %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 %150

144:                                              ; preds = %129
  %145 = load ptr, ptr %4, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.MDBX_cursor, ptr %145, i32 0, i32 5
  %147 = load ptr, ptr %146, align 8, !tbaa !14
  %148 = getelementptr inbounds %struct.MDBX_txn, ptr %147, i32 0, i32 9
  %149 = load ptr, ptr %148, align 8, !tbaa !16
  call void @mdbx_assert_fail(ptr noundef %149, ptr noundef @.str.41, ptr noundef @__func__.cursor_cpstk, i32 noundef 401) #4
  unreachable

150:                                              ; preds = %129
  br label %151

151:                                              ; preds = %150
  br label %152

152:                                              ; preds = %151, %117
  br label %153

153:                                              ; preds = %152
  %154 = load ptr, ptr %3, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.MDBX_cursor, ptr %154, i32 0, i32 1
  %156 = load i16, ptr %155, align 4, !tbaa !24
  %157 = load ptr, ptr %4, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.MDBX_cursor, ptr %157, i32 0, i32 1
  store i16 %156, ptr %158, align 4, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  store i64 0, ptr %5, align 8, !tbaa !25
  br label %159

159:                                              ; preds = %187, %153
  %160 = load i64, ptr %5, align 8, !tbaa !25
  %161 = load ptr, ptr %3, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.MDBX_cursor, ptr %161, i32 0, i32 1
  %163 = getelementptr inbounds %struct.anon, ptr %162, i32 0, i32 1
  %164 = load i8, ptr %163, align 1, !tbaa !24
  %165 = sext i8 %164 to i64
  %166 = icmp sle i64 %160, %165
  br i1 %166, label %168, label %167

167:                                              ; preds = %159
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  br label %190

168:                                              ; preds = %159
  %169 = load ptr, ptr %3, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.MDBX_cursor, ptr %169, i32 0, i32 9
  %171 = load i64, ptr %5, align 8, !tbaa !25
  %172 = getelementptr inbounds [32 x ptr], ptr %170, i64 0, i64 %171
  %173 = load ptr, ptr %172, align 8, !tbaa !5
  %174 = load ptr, ptr %4, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.MDBX_cursor, ptr %174, i32 0, i32 9
  %176 = load i64, ptr %5, align 8, !tbaa !25
  %177 = getelementptr inbounds [32 x ptr], ptr %175, i64 0, i64 %176
  store ptr %173, ptr %177, align 8, !tbaa !5
  %178 = load ptr, ptr %3, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct.MDBX_cursor, ptr %178, i32 0, i32 10
  %180 = load i64, ptr %5, align 8, !tbaa !25
  %181 = getelementptr inbounds [32 x i16], ptr %179, i64 0, i64 %180
  %182 = load i16, ptr %181, align 2, !tbaa !26
  %183 = load ptr, ptr %4, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.MDBX_cursor, ptr %183, i32 0, i32 10
  %185 = load i64, ptr %5, align 8, !tbaa !25
  %186 = getelementptr inbounds [32 x i16], ptr %184, i64 0, i64 %185
  store i16 %182, ptr %186, align 2, !tbaa !26
  br label %187

187:                                              ; preds = %168
  %188 = load i64, ptr %5, align 8, !tbaa !25
  %189 = add nsw i64 %188, 1
  store i64 %189, ptr %5, align 8, !tbaa !25
  br label %159, !llvm.loop !27

190:                                              ; preds = %167
  %191 = load ptr, ptr %4, align 8, !tbaa !5
  ret ptr %191
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #1 = { noreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { noreturn }
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 = !{!10, !7, i64 25}
!10 = !{!"libmdbx_globals", !7, i64 0, !11, i64 16, !11, i64 20, !7, i64 24, !7, i64 25, !7, i64 26, !12, i64 27, !11, i64 28, !7, i64 32, !7, i64 40, !13, i64 80, !6, i64 88}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!15, !6, i64 16}
!15 = !{!"MDBX_cursor", !11, i64 0, !7, i64 4, !7, i64 6, !7, i64 7, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !7, i64 48, !7, i64 304, !6, i64 368, !6, i64 376}
!16 = !{!17, !6, i64 80}
!17 = !{!"MDBX_txn", !11, i64 0, !11, i64 4, !13, i64 8, !13, i64 16, !6, i64 24, !6, i64 32, !18, i64 40, !13, i64 64, !13, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !20, i64 128, !6, i64 160, !7, i64 168}
!18 = !{!"geo", !19, i64 0, !19, i64 2, !11, i64 4, !11, i64 8, !7, i64 12, !7, i64 16}
!19 = !{!"short", !7, i64 0}
!20 = !{!"MDBX_canary", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24}
!21 = !{!15, !6, i64 24}
!22 = !{!15, !6, i64 32}
!23 = !{!15, !6, i64 8}
!24 = !{!7, !7, i64 0}
!25 = !{!13, !13, i64 0}
!26 = !{!19, !19, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.libmdbx_globals = type { %union.bin128, i32, i32, i8, i8, i8, i8, i32, %union.logger_union, %union.pthread_mutex_t, i64, ptr }
%union.bin128 = type { %struct.anon.8 }
%struct.anon.8 = type { i64, i64 }
%union.logger_union = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }

@globals = external local_unnamed_addr global %struct.libmdbx_globals, align 8
@.str.38 = external hidden unnamed_addr constant [23 x i8], align 1
@__func__.cursor_cpstk = external hidden unnamed_addr constant [13 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [35 x i8], align 1

; Function Attrs: noreturn
declare void @mdbx_assert_fail(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef ptr @cursor_cpstk(ptr nocapture noundef readonly %0, ptr noundef returned %1) local_unnamed_addr #1 {
  %3 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !5
  %4 = and i8 %3, 1
  %.not = icmp eq i8 %4, 0
  br i1 %.not, label %.thread34, label %5, !prof !13

5:                                                ; preds = %2
  %6 = getelementptr inbounds i8, ptr %1, i64 16
  %7 = load ptr, ptr %6, align 8, !tbaa !14
  %8 = getelementptr inbounds i8, ptr %0, i64 16
  %9 = load ptr, ptr %8, align 8, !tbaa !14
  %.not25 = icmp eq ptr %7, %9
  br i1 %.not25, label %13, label %10, !prof !16

10:                                               ; preds = %5
  %11 = getelementptr inbounds i8, ptr %7, i64 80
  %12 = load ptr, ptr %11, align 8, !tbaa !17
  tail call void @mdbx_assert_fail(ptr noundef %12, ptr noundef nonnull @.str.38, ptr noundef nonnull @__func__.cursor_cpstk, i32 noundef 398) #2
  unreachable

13:                                               ; preds = %5
  %14 = getelementptr inbounds i8, ptr %1, i64 24
  %15 = load ptr, ptr %14, align 8, !tbaa !22
  %16 = getelementptr inbounds i8, ptr %0, i64 24
  %17 = load ptr, ptr %16, align 8, !tbaa !22
  %.not27 = icmp eq ptr %15, %17
  br i1 %.not27, label %21, label %18, !prof !16

18:                                               ; preds = %13
  %19 = getelementptr inbounds i8, ptr %7, i64 80
  %20 = load ptr, ptr %19, align 8, !tbaa !17
  tail call void @mdbx_assert_fail(ptr noundef %20, ptr noundef nonnull @.str.39, ptr noundef nonnull @__func__.cursor_cpstk, i32 noundef 399) #2
  unreachable

21:                                               ; preds = %13
  %22 = getelementptr inbounds i8, ptr %1, i64 32
  %23 = load ptr, ptr %22, align 8, !tbaa !23
  %24 = getelementptr inbounds i8, ptr %0, i64 32
  %25 = load ptr, ptr %24, align 8, !tbaa !23
  %.not29 = icmp eq ptr %23, %25
  br i1 %.not29, label %29, label %26, !prof !16

26:                                               ; preds = %21
  %27 = getelementptr inbounds i8, ptr %7, i64 80
  %28 = load ptr, ptr %27, align 8, !tbaa !17
  tail call void @mdbx_assert_fail(ptr noundef %28, ptr noundef nonnull @.str.40, ptr noundef nonnull @__func__.cursor_cpstk, i32 noundef 400) #2
  unreachable

29:                                               ; preds = %21
  %30 = getelementptr inbounds i8, ptr %1, i64 8
  %31 = load ptr, ptr %30, align 8, !tbaa !24
  %32 = getelementptr inbounds i8, ptr %0, i64 8
  %33 = load ptr, ptr %32, align 8, !tbaa !24
  %.not31 = icmp eq ptr %31, %33
  br i1 %.not31, label %.thread34, label %34, !prof !16

34:                                               ; preds = %29
  %35 = getelementptr inbounds i8, ptr %7, i64 80
  %36 = load ptr, ptr %35, align 8, !tbaa !17
  tail call void @mdbx_assert_fail(ptr noundef %36, ptr noundef nonnull @.str.41, ptr noundef nonnull @__func__.cursor_cpstk, i32 noundef 401) #2
  unreachable

.thread34:                                        ; preds = %2, %29
  %37 = getelementptr inbounds i8, ptr %0, i64 4
  %38 = load i16, ptr %37, align 4, !tbaa !25
  %39 = getelementptr inbounds i8, ptr %1, i64 4
  store i16 %38, ptr %39, align 4, !tbaa !25
  %40 = getelementptr inbounds i8, ptr %0, i64 5
  %41 = load i8, ptr %40, align 1, !tbaa !25
  %.not3235 = icmp slt i8 %41, 0
  br i1 %.not3235, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.thread34
  %42 = getelementptr inbounds i8, ptr %0, i64 48
  %43 = getelementptr inbounds i8, ptr %1, i64 48
  %44 = getelementptr inbounds i8, ptr %0, i64 304
  %45 = getelementptr inbounds i8, ptr %1, i64 304
  br label %46

._crit_edge:                                      ; preds = %46, %.thread34
  ret ptr %1

46:                                               ; preds = %.lr.ph, %46
  %.036 = phi i64 [ 0, %.lr.ph ], [ %53, %46 ]
  %47 = getelementptr inbounds [32 x ptr], ptr %42, i64 0, i64 %.036
  %48 = load ptr, ptr %47, align 8, !tbaa !26
  %49 = getelementptr inbounds [32 x ptr], ptr %43, i64 0, i64 %.036
  store ptr %48, ptr %49, align 8, !tbaa !26
  %50 = getelementptr inbounds [32 x i16], ptr %44, i64 0, i64 %.036
  %51 = load i16, ptr %50, align 2, !tbaa !27
  %52 = getelementptr inbounds [32 x i16], ptr %45, i64 0, i64 %.036
  store i16 %51, ptr %52, align 2, !tbaa !27
  %53 = add nuw nsw i64 %.036, 1
  %54 = load i8, ptr %40, align 1, !tbaa !25
  %55 = sext i8 %54 to i64
  %.not32.not = icmp slt i64 %.036, %55
  br i1 %.not32.not, label %46, label %._crit_edge, !llvm.loop !28
}

attributes #0 = { noreturn "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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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, !7, i64 25}
!6 = !{!"libmdbx_globals", !7, i64 0, !9, i64 16, !9, i64 20, !7, i64 24, !7, i64 25, !7, i64 26, !10, i64 27, !9, i64 28, !7, i64 32, !7, i64 40, !11, i64 80, !12, i64 88}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!"_Bool", !7, i64 0}
!11 = !{!"long", !7, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!14 = !{!15, !12, i64 16}
!15 = !{!"MDBX_cursor", !9, i64 0, !7, i64 4, !7, i64 6, !7, i64 7, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !7, i64 48, !7, i64 304, !12, i64 368, !12, i64 376}
!16 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!17 = !{!18, !12, i64 80}
!18 = !{!"MDBX_txn", !9, i64 0, !9, i64 4, !11, i64 8, !11, i64 16, !12, i64 24, !12, i64 32, !19, i64 40, !11, i64 64, !11, i64 72, !12, i64 80, !12, i64 88, !12, i64 96, !12, i64 104, !12, i64 112, !12, i64 120, !21, i64 128, !12, i64 160, !7, i64 168}
!19 = !{!"geo", !20, i64 0, !20, i64 2, !9, i64 4, !9, i64 8, !7, i64 12, !7, i64 16}
!20 = !{!"short", !7, i64 0}
!21 = !{!"MDBX_canary", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!22 = !{!15, !12, i64 24}
!23 = !{!15, !12, i64 32}
!24 = !{!15, !12, i64 8}
!25 = !{!7, !7, i64 0}
!26 = !{!12, !12, i64 0}
!27 = !{!20, !20, i64 0}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LowerExpectIntrinsicPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass