; LLVM IR from dynexcoin/Dynex :: src/Platform/Posix/System (MemoryMappedFile)

; 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.Tools::ScopeExit" = type <{ %"class.std::function", i8, [7 x i8] }>
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%class.anon.1 = type { ptr, ptr }
%struct.stat = type { i64, i64, i64, i32, i32, i32, i32, i64, i64, i64, i64, %struct.timespec, %struct.timespec, %struct.timespec, [3 x i64] }
%struct.timespec = type { i64, i64 }
%"class.std::error_code" = type { i32, ptr }
%"class.System::MemoryMappedFile" = type { i32, %"class.std::__cxx11::basic_string", i64, 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] }

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6System16MemoryMappedFile5closeERSt10error_code(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK6System16MemoryMappedFile8isOpenedEv(ptr noundef nonnull align 8 dereferenceable(56)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt10error_codecvbEv(ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

declare void @_ZN5Tools9ScopeExitC1EOSt8functionIFvvEE(ptr noundef nonnull align 8 dereferenceable(33), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3

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

declare i32 @open(ptr noundef, i32 noundef, ...) #3

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

; Function Attrs: nounwind
declare ptr @mmap(ptr noundef, i64 noundef, i32 noundef, i32 noundef, i32 noundef, i64 noundef) #4

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSERKS4_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

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

declare void @_ZN5Tools9ScopeExit6cancelEv(ptr noundef nonnull align 8 dereferenceable(33)) #3

; Function Attrs: nounwind
declare void @_ZN5Tools9ScopeExitD1Ev(ptr noundef nonnull align 8 dereferenceable(33)) unnamed_addr #4

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6System16MemoryMappedFile4openERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERSt10error_code(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(16) %2) #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %"class.Tools::ScopeExit", align 8
  %8 = alloca %"class.std::function", align 8
  %9 = alloca %class.anon.1, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %struct.stat, align 8
  %14 = alloca i32, align 4
  %15 = alloca %"class.std::error_code", align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %16 = load ptr, ptr %4, align 8
  %17 = call noundef zeroext i1 @_ZNK6System16MemoryMappedFile8isOpenedEv(ptr noundef nonnull align 8 dereferenceable(56) %16)
  br i1 %17, label %18, label %24

18:                                               ; preds = %3
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN6System16MemoryMappedFile5closeERSt10error_code(ptr noundef nonnull align 8 dereferenceable(56) %16, ptr noundef nonnull align 8 dereferenceable(16) %19)
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = call noundef zeroext i1 @_ZNKSt10error_codecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %20) #6
  br i1 %21, label %22, label %23

22:                                               ; preds = %18
  br label %77

23:                                               ; preds = %18
  br label %24

24:                                               ; preds = %23, %3
  call void @llvm.lifetime.start.p0(i64 40, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #6
  %25 = getelementptr inbounds %class.anon.1, ptr %9, i32 0, i32 0
  store ptr %16, ptr %25, align 8, !tbaa !9
  %26 = getelementptr inbounds %class.anon.1, ptr %9, i32 0, i32 1
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %27, ptr %26, align 8, !tbaa !5
  call void @"_ZNSt8functionIFvvEEC2IZN6System16MemoryMappedFile4openERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERSt10error_codeE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef nonnull align 8 dereferenceable(16) %9) #6
  invoke void @_ZN5Tools9ScopeExitC1EOSt8functionIFvvEE(ptr noundef nonnull align 8 dereferenceable(33) %7, ptr noundef nonnull align 8 dereferenceable(32) %8)
          to label %28 unwind label %38

28:                                               ; preds = %24
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #6
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %29) #6
  %31 = invoke i32 (ptr, i32, ...) @open(ptr noundef %30, i32 noundef 2, i32 noundef 384)
          to label %32 unwind label %42

32:                                               ; preds = %28
  %33 = getelementptr inbounds %"class.System::MemoryMappedFile", ptr %16, i32 0, i32 0
  store i32 %31, ptr %33, align 8, !tbaa !11
  %34 = getelementptr inbounds %"class.System::MemoryMappedFile", ptr %16, i32 0, i32 0
  %35 = load i32, ptr %34, align 8, !tbaa !11
  %36 = icmp eq i32 %35, -1
  br i1 %36, label %37, label %46

37:                                               ; preds = %32
  store i32 1, ptr %12, align 4
  br label %75

38:                                               ; preds = %24
  %39 = landingpad { ptr, i32 }
          cleanup
  %40 = extractvalue { ptr, i32 } %39, 0
  store ptr %40, ptr %10, align 8
  %41 = extractvalue { ptr, i32 } %39, 1
  store i32 %41, ptr %11, align 4
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #6
  br label %83

42:                                               ; preds = %28
  %43 = landingpad { ptr, i32 }
          cleanup
  %44 = extractvalue { ptr, i32 } %43, 0
  store ptr %44, ptr %10, align 8
  %45 = extractvalue { ptr, i32 } %43, 1
  store i32 %45, ptr %11, align 4
  br label %82

46:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 144, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %47 = getelementptr inbounds %"class.System::MemoryMappedFile", ptr %16, i32 0, i32 0
  %48 = load i32, ptr %47, align 8, !tbaa !11
  %49 = call i32 @fstat(i32 noundef %48, ptr noundef %13) #6
  store i32 %49, ptr %14, align 4, !tbaa !17
  %50 = load i32, ptr %14, align 4, !tbaa !17
  %51 = icmp eq i32 %50, -1
  br i1 %51, label %52, label %53

52:                                               ; preds = %46
  store i32 1, ptr %12, align 4
  br label %74

53:                                               ; preds = %46
  %54 = getelementptr inbounds %struct.stat, ptr %13, i32 0, i32 8
  %55 = load i64, ptr %54, align 8, !tbaa !18
  %56 = getelementptr inbounds %"class.System::MemoryMappedFile", ptr %16, i32 0, i32 2
  store i64 %55, ptr %56, align 8, !tbaa !21
  %57 = getelementptr inbounds %"class.System::MemoryMappedFile", ptr %16, i32 0, i32 2
  %58 = load i64, ptr %57, align 8, !tbaa !21
  %59 = getelementptr inbounds %"class.System::MemoryMappedFile", ptr %16, i32 0, i32 0
  %60 = load i32, ptr %59, align 8, !tbaa !11
  %61 = call ptr @mmap(ptr noundef null, i64 noundef %58, i32 noundef 3, i32 noundef 1, i32 noundef %60, i64 noundef 0) #6
  %62 = getelementptr inbounds %"class.System::MemoryMappedFile", ptr %16, i32 0, i32 3
  store ptr %61, ptr %62, align 8, !tbaa !22
  %63 = getelementptr inbounds %"class.System::MemoryMappedFile", ptr %16, i32 0, i32 3
  %64 = load ptr, ptr %63, align 8, !tbaa !22
  %65 = icmp eq ptr %64, inttoptr (i64 -1 to ptr)
  br i1 %65, label %66, label %67

66:                                               ; preds = %53
  store i32 1, ptr %12, align 4
  br label %74

67:                                               ; preds = %53
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = getelementptr inbounds %"class.System::MemoryMappedFile", ptr %16, i32 0, i32 1
  %70 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %69, ptr noundef nonnull align 8 dereferenceable(32) %68)
          to label %71 unwind label %78

71:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #6
  call void @_ZNSt10error_codeC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %15) #6
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %72, ptr align 8 %15, i64 16, i1 false), !tbaa.struct !23
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #6
  invoke void @_ZN5Tools9ScopeExit6cancelEv(ptr noundef nonnull align 8 dereferenceable(33) %7)
          to label %73 unwind label %78

73:                                               ; preds = %71
  store i32 0, ptr %12, align 4
  br label %74

74:                                               ; preds = %73, %66, %52
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 144, ptr %13) #6
  br label %75

75:                                               ; preds = %74, %37
  call void @_ZN5Tools9ScopeExitD1Ev(ptr noundef nonnull align 8 dereferenceable(33) %7) #6
  call void @llvm.lifetime.end.p0(i64 40, ptr %7) #6
  %76 = load i32, ptr %12, align 4
  switch i32 %76, label %89 [
    i32 0, label %77
    i32 1, label %77
  ]

77:                                               ; preds = %75, %75, %22
  ret void

78:                                               ; preds = %71, %67
  %79 = landingpad { ptr, i32 }
          cleanup
  %80 = extractvalue { ptr, i32 } %79, 0
  store ptr %80, ptr %10, align 8
  %81 = extractvalue { ptr, i32 } %79, 1
  store i32 %81, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 144, ptr %13) #6
  br label %82

82:                                               ; preds = %78, %42
  call void @_ZN5Tools9ScopeExitD1Ev(ptr noundef nonnull align 8 dereferenceable(33) %7) #6
  br label %83

83:                                               ; preds = %82, %38
  call void @llvm.lifetime.end.p0(i64 40, ptr %7) #6
  br label %84

84:                                               ; preds = %83
  %85 = load ptr, ptr %10, align 8
  %86 = load i32, ptr %11, align 4
  %87 = insertvalue { ptr, i32 } poison, ptr %85, 0
  %88 = insertvalue { ptr, i32 } %87, i32 %86, 1
  resume { ptr, i32 } %88

89:                                               ; preds = %75
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZNSt8functionIFvvEEC2IZN6System16MemoryMappedFile4openERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERSt10error_codeE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #1 align 2

; Function Attrs: nounwind
declare i32 @fstat(i32 noundef, ptr noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 = { "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 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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, !6, i64 0}
!10 = !{!"_ZTSZN6System16MemoryMappedFile4openERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERSt10error_codeE3$_0", !6, i64 0, !6, i64 8}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTSN6System16MemoryMappedFileE", !13, i64 0, !14, i64 8, !16, i64 40, !6, i64 48}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !15, i64 0, !16, i64 8, !7, i64 16}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = !{!13, !13, i64 0}
!18 = !{!19, !16, i64 48}
!19 = !{!"_ZTS4stat", !16, i64 0, !16, i64 8, !16, i64 16, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !16, i64 40, !16, i64 48, !16, i64 56, !16, i64 64, !20, i64 72, !20, i64 88, !20, i64 104, !7, i64 120}
!20 = !{!"_ZTS8timespec", !16, i64 0, !16, i64 8}
!21 = !{!12, !16, i64 40}
!22 = !{!12, !6, i64 48}
!23 = !{i64 0, i64 4, !17, i64 8, i64 8, !5}


; 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.Tools::ScopeExit" = type <{ %"class.std::function", i8, [7 x i8] }>
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%class.anon.1 = type { ptr, ptr }
%struct.stat = type { i64, i64, i64, i32, i32, i32, i32, i64, i64, i64, i64, %struct.timespec, %struct.timespec, %struct.timespec, [3 x i64] }
%struct.timespec = type { i64, i64 }
%"class.std::error_code" = type { i32, ptr }

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6System16MemoryMappedFile5closeERSt10error_code(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK6System16MemoryMappedFile8isOpenedEv(ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt10error_codecvbEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

declare void @_ZN5Tools9ScopeExitC1EOSt8functionIFvvEE(ptr noundef nonnull align 8 dereferenceable(33), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3

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

; Function Attrs: nofree
declare noundef i32 @open(ptr nocapture noundef readonly, i32 noundef, ...) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

; Function Attrs: nounwind
declare ptr @mmap(ptr noundef, i64 noundef, i32 noundef, i32 noundef, i32 noundef, i64 noundef) local_unnamed_addr #5

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

; Function Attrs: mustprogress 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) #6

declare void @_ZN5Tools9ScopeExit6cancelEv(ptr noundef nonnull align 8 dereferenceable(33)) local_unnamed_addr #3

; Function Attrs: nounwind
declare void @_ZN5Tools9ScopeExitD1Ev(ptr noundef nonnull align 8 dereferenceable(33)) unnamed_addr #5

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6System16MemoryMappedFile4openERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERSt10error_code(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(16) %2) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.Tools::ScopeExit", align 8
  %5 = alloca %"class.std::function", align 8
  %6 = alloca %class.anon.1, align 8
  %7 = alloca %struct.stat, align 8
  %8 = alloca %"class.std::error_code", align 8
  %9 = tail call noundef zeroext i1 @_ZNK6System16MemoryMappedFile8isOpenedEv(ptr noundef nonnull align 8 dereferenceable(56) %0)
  br i1 %9, label %10, label %12

10:                                               ; preds = %3
  tail call void @_ZN6System16MemoryMappedFile5closeERSt10error_code(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr noundef nonnull align 8 dereferenceable(16) %2)
  %11 = tail call noundef zeroext i1 @_ZNKSt10error_codecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %2) #8
  br i1 %11, label %40, label %12

12:                                               ; preds = %10, %3
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %4) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #8
  store ptr %0, ptr %6, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %6, i64 8
  store ptr %2, ptr %13, align 8, !tbaa !10
  call void @"_ZNSt8functionIFvvEEC2IZN6System16MemoryMappedFile4openERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERSt10error_codeE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef nonnull align 8 dereferenceable(16) %6) #8
  invoke void @_ZN5Tools9ScopeExitC1EOSt8functionIFvvEE(ptr noundef nonnull align 8 dereferenceable(33) %4, ptr noundef nonnull align 8 dereferenceable(32) %5)
          to label %14 unwind label %19

14:                                               ; preds = %12
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #8
  %15 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %1) #8
  %16 = invoke i32 (ptr, i32, ...) @open(ptr noundef %15, i32 noundef 2, i32 noundef 384)
          to label %17 unwind label %21

17:                                               ; preds = %14
  store i32 %16, ptr %0, align 8, !tbaa !11
  %18 = icmp eq i32 %16, -1
  br i1 %18, label %39, label %23

19:                                               ; preds = %12
  %20 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #8
  br label %44

21:                                               ; preds = %14
  %22 = landingpad { ptr, i32 }
          cleanup
  br label %43

23:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %7) #8
  %24 = call i32 @fstat(i32 noundef %16, ptr noundef nonnull %7) #8
  %25 = icmp eq i32 %24, -1
  br i1 %25, label %38, label %26

26:                                               ; preds = %23
  %27 = getelementptr inbounds i8, ptr %7, i64 48
  %28 = load i64, ptr %27, align 8, !tbaa !17
  %29 = getelementptr inbounds i8, ptr %0, i64 40
  store i64 %28, ptr %29, align 8, !tbaa !20
  %30 = load i32, ptr %0, align 8, !tbaa !11
  %31 = call ptr @mmap(ptr noundef null, i64 noundef %28, i32 noundef 3, i32 noundef 1, i32 noundef %30, i64 noundef 0) #8
  %32 = getelementptr inbounds i8, ptr %0, i64 48
  store ptr %31, ptr %32, align 8, !tbaa !21
  %33 = icmp eq ptr %31, inttoptr (i64 -1 to ptr)
  br i1 %33, label %38, label %34

34:                                               ; preds = %26
  %35 = getelementptr inbounds i8, ptr %0, i64 8
  %36 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %35, ptr noundef nonnull align 8 dereferenceable(32) %1)
          to label %37 unwind label %41

37:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #8
  call void @_ZNSt10error_codeC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(16) %8, i64 16, i1 false), !tbaa.struct !22
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #8
  invoke void @_ZN5Tools9ScopeExit6cancelEv(ptr noundef nonnull align 8 dereferenceable(33) %4)
          to label %38 unwind label %41

38:                                               ; preds = %37, %26, %23
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %7) #8
  br label %39

39:                                               ; preds = %17, %38
  call void @_ZN5Tools9ScopeExitD1Ev(ptr noundef nonnull align 8 dereferenceable(33) %4) #8
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #8
  br label %40

40:                                               ; preds = %10, %39
  ret void

41:                                               ; preds = %37, %34
  %42 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %7) #8
  br label %43

43:                                               ; preds = %41, %21
  %.pn = phi { ptr, i32 } [ %42, %41 ], [ %22, %21 ]
  call void @_ZN5Tools9ScopeExitD1Ev(ptr noundef nonnull align 8 dereferenceable(33) %4) #8
  br label %44

44:                                               ; preds = %43, %19
  %.pn.pn = phi { ptr, i32 } [ %.pn, %43 ], [ %20, %19 ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #8
  resume { ptr, i32 } %.pn.pn
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZNSt8functionIFvvEEC2IZN6System16MemoryMappedFile4openERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERSt10error_codeE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #1 align 2

; Function Attrs: nofree nounwind
declare noundef i32 @fstat(i32 noundef, ptr nocapture noundef) local_unnamed_addr #7

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree "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 "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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { 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 #8 = { 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 0}
!6 = !{!"_ZTSZN6System16MemoryMappedFile4openERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERSt10error_codeE3$_0", !7, i64 0, !7, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!7, !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTSN6System16MemoryMappedFileE", !13, i64 0, !14, i64 8, !16, i64 40, !7, i64 48}
!13 = !{!"int", !8, i64 0}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !15, i64 0, !16, i64 8, !8, i64 16}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !7, i64 0}
!16 = !{!"long", !8, i64 0}
!17 = !{!18, !16, i64 48}
!18 = !{!"_ZTS4stat", !16, i64 0, !16, i64 8, !16, i64 16, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !16, i64 40, !16, i64 48, !16, i64 56, !16, i64 64, !19, i64 72, !19, i64 88, !19, i64 104, !8, i64 120}
!19 = !{!"_ZTS8timespec", !16, i64 0, !16, i64 8}
!20 = !{!12, !16, i64 40}
!21 = !{!12, !7, i64 48}
!22 = !{i64 0, i64 4, !23, i64 8, i64 8, !10}
!23 = !{!13, !13, i64 0}


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