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

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

@.str.14 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [13 x i8], align 1

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

; Function Attrs: cold nounwind optsize uwtable
define dso_local ptr @pagetype_caption(i8 noundef zeroext %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca i8, align 1
  %5 = alloca ptr, align 8
  store i8 %0, ptr %4, align 1, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !8
  %6 = load i8, ptr %4, align 1, !tbaa !5
  %7 = zext i8 %6 to i32
  switch i32 %7, label %15 [
    i32 1, label %8
    i32 2, label %9
    i32 66, label %10
    i32 34, label %11
    i32 98, label %12
    i32 114, label %13
    i32 4, label %14
  ]

8:                                                ; preds = %2
  store ptr @.str.14, ptr %3, align 8
  br label %21

9:                                                ; preds = %2
  store ptr @.str.15, ptr %3, align 8
  br label %21

10:                                               ; preds = %2
  store ptr @.str.16, ptr %3, align 8
  br label %21

11:                                               ; preds = %2
  store ptr @.str.17, ptr %3, align 8
  br label %21

12:                                               ; preds = %2
  store ptr @.str.18, ptr %3, align 8
  br label %21

13:                                               ; preds = %2
  store ptr @.str.19, ptr %3, align 8
  br label %21

14:                                               ; preds = %2
  store ptr @.str.20, ptr %3, align 8
  br label %21

15:                                               ; preds = %2
  %16 = load ptr, ptr %5, align 8, !tbaa !8
  %17 = load i8, ptr %4, align 1, !tbaa !5
  %18 = zext i8 %17 to i32
  %19 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %16, i64 noundef 16, ptr noundef @.str.21, i32 noundef %18) #2
  %20 = load ptr, ptr %5, align 8, !tbaa !8
  store ptr %20, ptr %3, align 8
  br label %21

21:                                               ; preds = %15, %14, %13, %12, %11, %10, %9, %8
  %22 = load ptr, ptr %3, align 8
  ret ptr %22
}

attributes #0 = { 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 #1 = { cold nounwind optsize uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}


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

@.str.14 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [13 x i8], align 1

; Function Attrs: nofree nounwind
declare noundef i32 @snprintf(ptr noalias nocapture noundef writeonly, i64 noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #0

; Function Attrs: cold nofree nounwind optsize uwtable
define dso_local noundef ptr @pagetype_caption(i8 noundef zeroext %0, ptr noundef writeonly %1) local_unnamed_addr #1 {
  switch i8 %0, label %9 [
    i8 1, label %12
    i8 2, label %3
    i8 66, label %4
    i8 34, label %5
    i8 98, label %6
    i8 114, label %7
    i8 4, label %8
  ]

3:                                                ; preds = %2
  br label %12

4:                                                ; preds = %2
  br label %12

5:                                                ; preds = %2
  br label %12

6:                                                ; preds = %2
  br label %12

7:                                                ; preds = %2
  br label %12

8:                                                ; preds = %2
  br label %12

9:                                                ; preds = %2
  %10 = zext i8 %0 to i32
  %11 = tail call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %1, i64 noundef 16, ptr noundef nonnull @.str.21, i32 noundef %10) #2
  br label %12

12:                                               ; preds = %2, %9, %8, %7, %6, %5, %4, %3
  %.0 = phi ptr [ %1, %9 ], [ @.str.20, %8 ], [ @.str.19, %7 ], [ @.str.18, %6 ], [ @.str.17, %5 ], [ @.str.16, %4 ], [ @.str.15, %3 ], [ @.str.14, %2 ]
  ret ptr %.0
}

attributes #0 = { 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 #1 = { cold nofree nounwind optsize uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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)"}


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