; LLVM IR from weicao/cascadb :: src/serialize/layout.ll (ZN7cascadb6Layout10read_blockERKNS_9BlockMetaEjjPPNS_5BlockE)

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

%"class.cascadb::Slice" = type <{ ptr, i32, [4 x i8] }>
%"class.cascadb::LoggerFormat" = type { ptr, %"class.std::__cxx11::basic_ostringstream" }
%"class.std::__cxx11::basic_ostringstream" = type { %"class.std::basic_ostream.base", %"class.std::__cxx11::basic_stringbuf", %"class.std::basic_ios" }
%"class.std::basic_ostream.base" = type { ptr }
%"class.std::__cxx11::basic_stringbuf" = type { %"class.std::basic_streambuf", i32, %"class.std::__cxx11::basic_string" }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"struct.cascadb::BlockMeta" = type { i64, i32, i32, i16, i16 }

@.str.1 = external hidden unnamed_addr constant [73 x i8], align 1
@_ZN7cascadb14g_logger_levelE = external global i32, align 4
@_ZN7cascadb8g_loggerE = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [34 x i8], align 1

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7cascadb12LoggerFormatC2EPNS_6LoggerE(ptr noundef nonnull align 8 dereferenceable(384), ptr noundef) unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN7cascadb12LoggerFormat3getENS_11LoggerLevelE(ptr noundef nonnull align 8 dereferenceable(384), i32 noundef) #5 align 2

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #7

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7cascadb12LoggerFormatD2Ev(ptr noundef nonnull align 8 dereferenceable(384)) unnamed_addr #8 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN7cascadb6Layout10read_blockERKNS_9BlockMetaEjjPPNS_5BlockE(ptr noundef nonnull align 8 dereferenceable(600) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, i32 noundef %2, i32 noundef %3, ptr noundef %4) #5 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca i1, align 1
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %"class.cascadb::Slice", align 8
  %15 = alloca { ptr, i32 }, align 8
  %16 = alloca %"class.cascadb::LoggerFormat", align 8
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca %"class.cascadb::Slice", align 8
  %21 = alloca %"class.cascadb::Slice", align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store i32 %2, ptr %9, align 4, !tbaa !9
  store i32 %3, ptr %10, align 4, !tbaa !9
  store ptr %4, ptr %11, align 8, !tbaa !5
  %22 = load ptr, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #9
  %23 = load i32, ptr %9, align 4, !tbaa !9
  %24 = and i32 %23, -4096
  store i32 %24, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #9
  %25 = load i32, ptr %9, align 4, !tbaa !9
  %26 = load i32, ptr %12, align 4, !tbaa !9
  %27 = sub i32 %25, %26
  %28 = load i32, ptr %10, align 4, !tbaa !9
  %29 = add i32 %27, %28
  store i32 %29, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #9
  %30 = load i32, ptr %13, align 4, !tbaa !9
  %31 = zext i32 %30 to i64
  %32 = call { ptr, i32 } @_ZN7cascadb6Layout20alloc_aligned_bufferEm(ptr noundef nonnull align 8 dereferenceable(600) %22, i64 noundef %31)
  store { ptr, i32 } %32, ptr %15, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %14, ptr align 8 %15, i64 12, i1 false)
  %33 = call noundef i64 @_ZNK7cascadb5Slice4sizeEv(ptr noundef nonnull align 8 dereferenceable(12) %14)
  %34 = icmp ne i64 %33, 0
  br i1 %34, label %70, label %35

35:                                               ; preds = %5
  %36 = load i32, ptr @_ZN7cascadb14g_logger_levelE, align 4, !tbaa !11
  %37 = icmp sge i32 3, %36
  br i1 %37, label %38, label %69

38:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 384, ptr %16) #9
  %39 = load ptr, ptr @_ZN7cascadb8g_loggerE, align 8, !tbaa !5
  call void @_ZN7cascadb12LoggerFormatC2EPNS_6LoggerE(ptr noundef nonnull align 8 dereferenceable(384) %16, ptr noundef %39)
  %40 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7cascadb12LoggerFormat3getENS_11LoggerLevelE(ptr noundef nonnull align 8 dereferenceable(384) %16, i32 noundef 3)
          to label %41 unwind label %65

41:                                               ; preds = %38
  %42 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %40, ptr noundef @.str.2)
          to label %43 unwind label %65

43:                                               ; preds = %41
  %44 = call noundef ptr @strrchr(ptr noundef @.str.1, i32 noundef 47) #10
  %45 = icmp ne ptr %44, null
  br i1 %45, label %46, label %49

46:                                               ; preds = %43
  %47 = call noundef ptr @strrchr(ptr noundef @.str.1, i32 noundef 47) #10
  %48 = getelementptr inbounds i8, ptr %47, i64 1
  br label %50

49:                                               ; preds = %43
  br label %50

50:                                               ; preds = %49, %46
  %51 = phi ptr [ %48, %46 ], [ @.str.1, %49 ]
  %52 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %42, ptr noundef %51)
          to label %53 unwind label %65

53:                                               ; preds = %50
  %54 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %52, ptr noundef @.str.3)
          to label %55 unwind label %65

55:                                               ; preds = %53
  %56 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %54, i32 noundef 679)
          to label %57 unwind label %65

57:                                               ; preds = %55
  %58 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %56, ptr noundef @.str.2)
          to label %59 unwind label %65

59:                                               ; preds = %57
  %60 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %58, ptr noundef @.str.32)
          to label %61 unwind label %65

61:                                               ; preds = %59
  %62 = load i32, ptr %13, align 4, !tbaa !9
  %63 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEj(ptr noundef nonnull align 8 dereferenceable(8) %60, i32 noundef %62)
          to label %64 unwind label %65

64:                                               ; preds = %61
  call void @_ZN7cascadb12LoggerFormatD2Ev(ptr noundef nonnull align 8 dereferenceable(384) %16) #9
  call void @llvm.lifetime.end.p0(i64 384, ptr %16) #9
  br label %69

65:                                               ; preds = %61, %59, %57, %55, %53, %50, %41, %38
  %66 = landingpad { ptr, i32 }
          cleanup
  %67 = extractvalue { ptr, i32 } %66, 0
  store ptr %67, ptr %17, align 8
  %68 = extractvalue { ptr, i32 } %66, 1
  store i32 %68, ptr %18, align 4
  call void @_ZN7cascadb12LoggerFormatD2Ev(ptr noundef nonnull align 8 dereferenceable(384) %16) #9
  call void @llvm.lifetime.end.p0(i64 384, ptr %16) #9
  br label %103

69:                                               ; preds = %64, %35
  store i1 false, ptr %6, align 1
  store i32 1, ptr %19, align 4
  br label %101

70:                                               ; preds = %5
  %71 = load ptr, ptr %8, align 8, !tbaa !5
  %72 = getelementptr inbounds %"struct.cascadb::BlockMeta", ptr %71, i32 0, i32 0
  %73 = load i64, ptr %72, align 8, !tbaa !13
  %74 = load i32, ptr %12, align 4, !tbaa !9
  %75 = zext i32 %74 to i64
  %76 = add i64 %73, %75
  %77 = call noundef zeroext i1 @_ZN7cascadb6Layout9read_dataEmRNS_5SliceE(ptr noundef nonnull align 8 dereferenceable(600) %22, i64 noundef %76, ptr noundef nonnull align 8 dereferenceable(12) %14)
  br i1 %77, label %83, label %78

78:                                               ; preds = %70
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %20, ptr align 8 %14, i64 16, i1 false), !tbaa.struct !17
  %79 = getelementptr inbounds { ptr, i32 }, ptr %20, i32 0, i32 0
  %80 = load ptr, ptr %79, align 8
  %81 = getelementptr inbounds { ptr, i32 }, ptr %20, i32 0, i32 1
  %82 = load i32, ptr %81, align 8
  call void @_ZN7cascadb6Layout11free_bufferENS_5SliceE(ptr noundef nonnull align 8 dereferenceable(600) %22, ptr %80, i32 %82)
  store i1 false, ptr %6, align 1
  store i32 1, ptr %19, align 4
  br label %101

83:                                               ; preds = %70
  %84 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 32) #11
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %21, ptr align 8 %14, i64 16, i1 false), !tbaa.struct !17
  %85 = load i32, ptr %9, align 4, !tbaa !9
  %86 = load i32, ptr %12, align 4, !tbaa !9
  %87 = sub i32 %85, %86
  %88 = zext i32 %87 to i64
  %89 = load i32, ptr %10, align 4, !tbaa !9
  %90 = zext i32 %89 to i64
  %91 = getelementptr inbounds { ptr, i32 }, ptr %21, i32 0, i32 0
  %92 = load ptr, ptr %91, align 8
  %93 = getelementptr inbounds { ptr, i32 }, ptr %21, i32 0, i32 1
  %94 = load i32, ptr %93, align 8
  invoke void @_ZN7cascadb5BlockC2ENS_5SliceEmm(ptr noundef nonnull align 8 dereferenceable(32) %84, ptr %92, i32 %94, i64 noundef %88, i64 noundef %90)
          to label %95 unwind label %97

95:                                               ; preds = %83
  %96 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %84, ptr %96, align 8, !tbaa !5
  store i1 true, ptr %6, align 1
  store i32 1, ptr %19, align 4
  br label %101

97:                                               ; preds = %83
  %98 = landingpad { ptr, i32 }
          cleanup
  %99 = extractvalue { ptr, i32 } %98, 0
  store ptr %99, ptr %17, align 8
  %100 = extractvalue { ptr, i32 } %98, 1
  store i32 %100, ptr %18, align 4
  call void @_ZdlPvm(ptr noundef %84, i64 noundef 32) #12
  br label %103

101:                                              ; preds = %95, %78, %69
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  %102 = load i1, ptr %6, align 1
  ret i1 %102

103:                                              ; preds = %97, %65
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  br label %104

104:                                              ; preds = %103
  %105 = load ptr, ptr %17, align 8
  %106 = load i32, ptr %18, align 4
  %107 = insertvalue { ptr, i32 } poison, ptr %105, 0
  %108 = insertvalue { ptr, i32 } %107, i32 %106, 1
  resume { ptr, i32 } %108
}

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEj(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK7cascadb5Slice4sizeEv(ptr noundef nonnull align 8 dereferenceable(12)) #8 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i32 } @_ZN7cascadb6Layout20alloc_aligned_bufferEm(ptr noundef nonnull align 8 dereferenceable(600), i64 noundef) #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7cascadb5BlockC2ENS_5SliceEmm(ptr noundef nonnull align 8 dereferenceable(32), ptr, i32, i64 noundef, i64 noundef) unnamed_addr #8 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7cascadb6Layout11free_bufferENS_5SliceE(ptr noundef nonnull align 8 dereferenceable(600), ptr, i32) #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7cascadb6Layout9read_dataEmRNS_5SliceE(ptr noundef nonnull align 8 dereferenceable(600), i64 noundef, ptr noundef nonnull align 8 dereferenceable(12)) #5 align 2

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nobuiltin allocsize(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 = { nobuiltin 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { inlinehint mustprogress 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 #5 = { mustprogress 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 #6 = { 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 #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 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 #9 = { nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { builtin allocsize(0) }
attributes #12 = { builtin 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"_ZTSN7cascadb11LoggerLevelE", !7, i64 0}
!13 = !{!14, !15, i64 0}
!14 = !{!"_ZTSN7cascadb9BlockMetaE", !15, i64 0, !10, i64 8, !10, i64 12, !16, i64 16, !16, i64 18}
!15 = !{!"long", !7, i64 0}
!16 = !{!"short", !7, i64 0}
!17 = !{i64 0, i64 8, !5, i64 8, i64 4, !9}


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

%"class.cascadb::Slice" = type <{ ptr, i32, [4 x i8] }>
%"class.cascadb::LoggerFormat" = type { ptr, %"class.std::__cxx11::basic_ostringstream" }
%"class.std::__cxx11::basic_ostringstream" = type { %"class.std::basic_ostream.base", %"class.std::__cxx11::basic_stringbuf", %"class.std::basic_ios" }
%"class.std::basic_ostream.base" = type { ptr }
%"class.std::__cxx11::basic_stringbuf" = type { %"class.std::basic_streambuf", i32, %"class.std::__cxx11::basic_string" }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }

@.str.1 = external hidden unnamed_addr constant [73 x i8], align 1
@_ZN7cascadb14g_logger_levelE = external local_unnamed_addr global i32, align 4
@_ZN7cascadb8g_loggerE = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [34 x i8], align 1

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #0

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7cascadb12LoggerFormatC2EPNS_6LoggerE(ptr noundef nonnull align 8 dereferenceable(384), ptr noundef) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN7cascadb12LoggerFormat3getENS_11LoggerLevelE(ptr noundef nonnull align 8 dereferenceable(384), i32 noundef) local_unnamed_addr #3 align 2

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7cascadb12LoggerFormatD2Ev(ptr noundef nonnull align 8 dereferenceable(384)) unnamed_addr #6 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN7cascadb6Layout10read_blockERKNS_9BlockMetaEjjPPNS_5BlockE(ptr noundef nonnull align 8 dereferenceable(600) %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(24) %1, i32 noundef %2, i32 noundef %3, ptr nocapture noundef writeonly %4) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca %"class.cascadb::Slice", align 8
  %7 = alloca %"class.cascadb::LoggerFormat", align 8
  %8 = and i32 %2, 4095
  %9 = add i32 %8, %3
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #7
  %10 = zext i32 %9 to i64
  %11 = tail call { ptr, i32 } @_ZN7cascadb6Layout20alloc_aligned_bufferEm(ptr noundef nonnull align 8 dereferenceable(600) %0, i64 noundef %10)
  %.fca.0.extract = extractvalue { ptr, i32 } %11, 0
  %.fca.1.extract = extractvalue { ptr, i32 } %11, 1
  store ptr %.fca.0.extract, ptr %6, align 8
  %.sroa.25.0..sroa_idx = getelementptr inbounds i8, ptr %6, i64 8
  store i32 %.fca.1.extract, ptr %.sroa.25.0..sroa_idx, align 8
  %12 = call noundef i64 @_ZNK7cascadb5Slice4sizeEv(ptr noundef nonnull align 8 dereferenceable(12) %6)
  %.not = icmp eq i64 %12, 0
  br i1 %.not, label %13, label %38

13:                                               ; preds = %5
  %14 = load i32, ptr @_ZN7cascadb14g_logger_levelE, align 4, !tbaa !5
  %15 = icmp slt i32 %14, 4
  br i1 %15, label %16, label %49

16:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 384, ptr nonnull %7) #7
  %17 = load ptr, ptr @_ZN7cascadb8g_loggerE, align 8, !tbaa !9
  call void @_ZN7cascadb12LoggerFormatC2EPNS_6LoggerE(ptr noundef nonnull align 8 dereferenceable(384) %7, ptr noundef %17)
  %18 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7cascadb12LoggerFormat3getENS_11LoggerLevelE(ptr noundef nonnull align 8 dereferenceable(384) %7, i32 noundef 3)
          to label %19 unwind label %36

19:                                               ; preds = %16
  %20 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %18, ptr noundef nonnull @.str.2)
          to label %21 unwind label %36

21:                                               ; preds = %19
  %22 = call noundef ptr @strrchr(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 47) #8
  %.not21 = icmp eq ptr %22, null
  %23 = getelementptr inbounds i8, ptr %22, i64 1
  %spec.select = select i1 %.not21, ptr @.str.1, ptr %23
  %24 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %20, ptr noundef nonnull %spec.select)
          to label %25 unwind label %36

25:                                               ; preds = %21
  %26 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %24, ptr noundef nonnull @.str.3)
          to label %27 unwind label %36

27:                                               ; preds = %25
  %28 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %26, i32 noundef 679)
          to label %29 unwind label %36

29:                                               ; preds = %27
  %30 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %28, ptr noundef nonnull @.str.2)
          to label %31 unwind label %36

31:                                               ; preds = %29
  %32 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %30, ptr noundef nonnull @.str.32)
          to label %33 unwind label %36

33:                                               ; preds = %31
  %34 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEj(ptr noundef nonnull align 8 dereferenceable(8) %32, i32 noundef %9)
          to label %35 unwind label %36

35:                                               ; preds = %33
  call void @_ZN7cascadb12LoggerFormatD2Ev(ptr noundef nonnull align 8 dereferenceable(384) %7) #7
  call void @llvm.lifetime.end.p0(i64 384, ptr nonnull %7) #7
  br label %49

36:                                               ; preds = %33, %31, %29, %27, %25, %21, %19, %16
  %37 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7cascadb12LoggerFormatD2Ev(ptr noundef nonnull align 8 dereferenceable(384) %7) #7
  call void @llvm.lifetime.end.p0(i64 384, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #7
  resume { ptr, i32 } %37

38:                                               ; preds = %5
  %39 = and i32 %2, -4096
  %40 = load i64, ptr %1, align 8, !tbaa !11
  %41 = zext i32 %39 to i64
  %42 = add i64 %40, %41
  %43 = call noundef zeroext i1 @_ZN7cascadb6Layout9read_dataEmRNS_5SliceE(ptr noundef nonnull align 8 dereferenceable(600) %0, i64 noundef %42, ptr noundef nonnull align 8 dereferenceable(12) %6)
  br i1 %43, label %45, label %44

44:                                               ; preds = %38
  %.sroa.01.0.copyload = load ptr, ptr %6, align 8, !tbaa !9
  %.sroa.22.0.copyload = load i32, ptr %.sroa.25.0..sroa_idx, align 8, !tbaa !16
  call void @_ZN7cascadb6Layout11free_bufferENS_5SliceE(ptr noundef nonnull align 8 dereferenceable(600) %0, ptr %.sroa.01.0.copyload, i32 %.sroa.22.0.copyload)
  br label %49

45:                                               ; preds = %38
  %46 = call noalias noundef nonnull dereferenceable(32) ptr @_Znwm(i64 noundef 32) #9
  %.sroa.0.0.copyload = load ptr, ptr %6, align 8, !tbaa !9
  %.sroa.2.0.copyload = load i32, ptr %.sroa.25.0..sroa_idx, align 8, !tbaa !16
  %47 = zext nneg i32 %8 to i64
  %48 = zext i32 %3 to i64
  call void @_ZN7cascadb5BlockC2ENS_5SliceEmm(ptr noundef nonnull align 8 dereferenceable(32) %46, ptr %.sroa.0.0.copyload, i32 %.sroa.2.0.copyload, i64 noundef %47, i64 noundef %48)
  store ptr %46, ptr %4, align 8, !tbaa !9
  br label %49

49:                                               ; preds = %13, %35, %45, %44
  %.0 = phi i1 [ true, %45 ], [ false, %44 ], [ false, %35 ], [ false, %13 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #7
  ret i1 %.0
}

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEj(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK7cascadb5Slice4sizeEv(ptr noundef nonnull align 8 dereferenceable(12)) local_unnamed_addr #6 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i32 } @_ZN7cascadb6Layout20alloc_aligned_bufferEm(ptr noundef nonnull align 8 dereferenceable(600), i64 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7cascadb5BlockC2ENS_5SliceEmm(ptr noundef nonnull align 8 dereferenceable(32), ptr, i32, i64 noundef, i64 noundef) unnamed_addr #6 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7cascadb6Layout11free_bufferENS_5SliceE(ptr noundef nonnull align 8 dereferenceable(600), ptr, i32) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7cascadb6Layout9read_dataEmRNS_5SliceE(ptr noundef nonnull align 8 dereferenceable(600), i64 noundef, ptr noundef nonnull align 8 dereferenceable(12)) local_unnamed_addr #3 align 2

attributes #0 = { nobuiltin allocsize(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 = { inlinehint mustprogress 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 #3 = { mustprogress 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 = { 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 #5 = { "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 = { mustprogress 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 #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { builtin allocsize(0) }

!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 = !{!"_ZTSN7cascadb11LoggerLevelE", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTSN7cascadb9BlockMetaE", !13, i64 0, !14, i64 8, !14, i64 12, !15, i64 16, !15, i64 18}
!13 = !{!"long", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!"short", !7, i64 0}
!16 = !{!14, !14, i64 0}


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