; LLVM IR from XiaoMi/mace :: mace/port/posix (file_system)

; 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.mace::MaceStatus" = type { %"class.std::unique_ptr" }
%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Head_base.1" }
%"struct.std::_Head_base.1" = type { 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::unique_ptr.2" = type { %"struct.std::__uniq_ptr_data.3" }
%"struct.std::__uniq_ptr_data.3" = type { %"class.std::__uniq_ptr_impl.4" }
%"class.std::__uniq_ptr_impl.4" = type { %"class.std::tuple.5" }
%"class.std::tuple.5" = type { %"struct.std::_Tuple_impl.6" }
%"struct.std::_Tuple_impl.6" = type { %"struct.std::_Head_base.9" }
%"struct.std::_Head_base.9" = type { ptr }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4mace4port15PosixFileSystem31NewReadOnlyMemoryRegionFromFileEPKcPSt10unique_ptrINS0_20ReadOnlyMemoryRegionESt14default_deleteIS5_EE(ptr dead_on_unwind noalias writable sret(%"class.mace::MaceStatus") align 8 %0, ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef %2, ptr noundef %3) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i1, align 1
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca %"class.mace::MaceStatus", align 8
  %14 = alloca %struct.stat, align 8
  %15 = alloca ptr, align 8
  %16 = alloca %"class.mace::MaceStatus", align 8
  %17 = alloca %"class.std::unique_ptr.2", align 8
  %18 = alloca %"class.std::unique_ptr.2", align 8
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  store ptr %0, ptr %5, align 8
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  %21 = load ptr, ptr %6, align 8
  store i1 false, ptr %9, align 1
  call void @_ZN4mace10MaceStatusC1ENS0_4CodeE(ptr noundef nonnull align 8 dereferenceable(8) %0, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  %23 = invoke i32 (ptr, i32, ...) @open(ptr noundef %22, i32 noundef 0)
          to label %24 unwind label %31

24:                                               ; preds = %4
  store i32 %23, ptr %10, align 4, !tbaa !9
  %25 = load i32, ptr %10, align 4, !tbaa !9
  %26 = icmp slt i32 %25, 0
  br i1 %26, label %27, label %44

27:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  invoke void @_ZN4mace10MaceStatusC1ENS0_4CodeE(ptr noundef nonnull align 8 dereferenceable(8) %13, i32 noundef 4)
          to label %28 unwind label %35

28:                                               ; preds = %27
  %29 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN4mace10MaceStatusaSEOKS0_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(8) %13)
          to label %30 unwind label %39

30:                                               ; preds = %28
  call void @_ZN4mace10MaceStatusD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %98

31:                                               ; preds = %4
  %32 = landingpad { ptr, i32 }
          cleanup
  %33 = extractvalue { ptr, i32 } %32, 0
  store ptr %33, ptr %11, align 8
  %34 = extractvalue { ptr, i32 } %32, 1
  store i32 %34, ptr %12, align 4
  br label %100

35:                                               ; preds = %27
  %36 = landingpad { ptr, i32 }
          cleanup
  %37 = extractvalue { ptr, i32 } %36, 0
  store ptr %37, ptr %11, align 8
  %38 = extractvalue { ptr, i32 } %36, 1
  store i32 %38, ptr %12, align 4
  br label %43

39:                                               ; preds = %28
  %40 = landingpad { ptr, i32 }
          cleanup
  %41 = extractvalue { ptr, i32 } %40, 0
  store ptr %41, ptr %11, align 8
  %42 = extractvalue { ptr, i32 } %40, 1
  store i32 %42, ptr %12, align 4
  call void @_ZN4mace10MaceStatusD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %13) #6
  br label %43

43:                                               ; preds = %39, %35
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %100

44:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 144, ptr %14) #6
  %45 = load i32, ptr %10, align 4, !tbaa !9
  %46 = call i32 @fstat(i32 noundef %45, ptr noundef %14) #6
  %47 = getelementptr inbounds %struct.stat, ptr %14, i32 0, i32 8
  %48 = load i64, ptr %47, align 8, !tbaa !11
  %49 = icmp sgt i64 %48, 0
  br i1 %49, label %50, label %88

50:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %51 = getelementptr inbounds %struct.stat, ptr %14, i32 0, i32 8
  %52 = load i64, ptr %51, align 8, !tbaa !11
  %53 = load i32, ptr %10, align 4, !tbaa !9
  %54 = call ptr @mmap(ptr noundef null, i64 noundef %52, i32 noundef 1, i32 noundef 2, i32 noundef %53, i64 noundef 0) #6
  store ptr %54, ptr %15, align 8, !tbaa !5
  %55 = load ptr, ptr %15, align 8, !tbaa !5
  %56 = icmp eq ptr %55, inttoptr (i64 -1 to ptr)
  br i1 %56, label %57, label %70

57:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  invoke void @_ZN4mace10MaceStatusC1ENS0_4CodeE(ptr noundef nonnull align 8 dereferenceable(8) %16, i32 noundef 4)
          to label %58 unwind label %61

58:                                               ; preds = %57
  %59 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN4mace10MaceStatusaSEOKS0_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(8) %16)
          to label %60 unwind label %65

60:                                               ; preds = %58
  call void @_ZN4mace10MaceStatusD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  br label %79

61:                                               ; preds = %57
  %62 = landingpad { ptr, i32 }
          cleanup
  %63 = extractvalue { ptr, i32 } %62, 0
  store ptr %63, ptr %11, align 8
  %64 = extractvalue { ptr, i32 } %62, 1
  store i32 %64, ptr %12, align 4
  br label %69

65:                                               ; preds = %58
  %66 = landingpad { ptr, i32 }
          cleanup
  %67 = extractvalue { ptr, i32 } %66, 0
  store ptr %67, ptr %11, align 8
  %68 = extractvalue { ptr, i32 } %66, 1
  store i32 %68, ptr %12, align 4
  call void @_ZN4mace10MaceStatusD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %16) #6
  br label %69

69:                                               ; preds = %65, %61
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  br label %87

70:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %71 = getelementptr inbounds %struct.stat, ptr %14, i32 0, i32 8
  invoke void @_ZSt11make_uniqueIN4mace4port12_GLOBAL__N_125PosixReadOnlyMemoryRegionEJRPKvRlEENSt8__detail9_MakeUniqIT_E15__single_objectEDpOT0_(ptr dead_on_unwind writable sret(%"class.std::unique_ptr.2") align 8 %17, ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef nonnull align 8 dereferenceable(8) %71)
          to label %72 unwind label %75

72:                                               ; preds = %70
  %73 = load ptr, ptr %8, align 8, !tbaa !5
  %74 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt10unique_ptrIN4mace4port20ReadOnlyMemoryRegionESt14default_deleteIS2_EEaSINS1_12_GLOBAL__N_125PosixReadOnlyMemoryRegionES3_IS8_EEENSt9enable_ifIXsr6__and_ISt6__and_IJSt14is_convertibleINS_IT_T0_E7pointerEPS2_ESt6__not_ISt8is_arrayISD_EEEESt13is_assignableIRS4_OSE_EEE5valueERS5_E4typeEOSF_(ptr noundef nonnull align 8 dereferenceable(8) %73, ptr noundef nonnull align 8 dereferenceable(8) %17) #6
  call void @_ZNSt10unique_ptrIN4mace4port12_GLOBAL__N_125PosixReadOnlyMemoryRegionESt14default_deleteIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  br label %79

75:                                               ; preds = %70
  %76 = landingpad { ptr, i32 }
          cleanup
  %77 = extractvalue { ptr, i32 } %76, 0
  store ptr %77, ptr %11, align 8
  %78 = extractvalue { ptr, i32 } %76, 1
  store i32 %78, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  br label %87

79:                                               ; preds = %72, %60
  %80 = load i32, ptr %10, align 4, !tbaa !9
  %81 = invoke i32 @close(i32 noundef %80)
          to label %82 unwind label %83

82:                                               ; preds = %79
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %96

83:                                               ; preds = %79
  %84 = landingpad { ptr, i32 }
          cleanup
  %85 = extractvalue { ptr, i32 } %84, 0
  store ptr %85, ptr %11, align 8
  %86 = extractvalue { ptr, i32 } %84, 1
  store i32 %86, ptr %12, align 4
  br label %87

87:                                               ; preds = %83, %75, %69
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %97

88:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  store ptr null, ptr %19, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  store i32 0, ptr %20, align 4, !tbaa !9
  invoke void @_ZSt11make_uniqueIN4mace4port12_GLOBAL__N_125PosixReadOnlyMemoryRegionEJDniEENSt8__detail9_MakeUniqIT_E15__single_objectEDpOT0_(ptr dead_on_unwind writable sret(%"class.std::unique_ptr.2") align 8 %18, ptr noundef nonnull align 8 dereferenceable(8) %19, ptr noundef nonnull align 4 dereferenceable(4) %20)
          to label %89 unwind label %92

89:                                               ; preds = %88
  %90 = load ptr, ptr %8, align 8, !tbaa !5
  %91 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt10unique_ptrIN4mace4port20ReadOnlyMemoryRegionESt14default_deleteIS2_EEaSINS1_12_GLOBAL__N_125PosixReadOnlyMemoryRegionES3_IS8_EEENSt9enable_ifIXsr6__and_ISt6__and_IJSt14is_convertibleINS_IT_T0_E7pointerEPS2_ESt6__not_ISt8is_arrayISD_EEEESt13is_assignableIRS4_OSE_EEE5valueERS5_E4typeEOSF_(ptr noundef nonnull align 8 dereferenceable(8) %90, ptr noundef nonnull align 8 dereferenceable(8) %18) #6
  call void @_ZNSt10unique_ptrIN4mace4port12_GLOBAL__N_125PosixReadOnlyMemoryRegionESt14default_deleteIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  br label %96

92:                                               ; preds = %88
  %93 = landingpad { ptr, i32 }
          cleanup
  %94 = extractvalue { ptr, i32 } %93, 0
  store ptr %94, ptr %11, align 8
  %95 = extractvalue { ptr, i32 } %93, 1
  store i32 %95, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  br label %97

96:                                               ; preds = %89, %82
  call void @llvm.lifetime.end.p0(i64 144, ptr %14) #6
  br label %98

97:                                               ; preds = %92, %87
  call void @llvm.lifetime.end.p0(i64 144, ptr %14) #6
  br label %100

98:                                               ; preds = %96, %30
  store i1 true, ptr %9, align 1
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  %99 = load i1, ptr %9, align 1
  br i1 %99, label %102, label %101

100:                                              ; preds = %97, %43, %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @_ZN4mace10MaceStatusD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #6
  br label %103

101:                                              ; preds = %98
  call void @_ZN4mace10MaceStatusD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #6
  br label %102

102:                                              ; preds = %101, %98
  ret void

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

declare void @_ZN4mace10MaceStatusC1ENS0_4CodeE(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) unnamed_addr #1

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

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

declare i32 @__gxx_personality_v0(...)

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZN4mace10MaceStatusaSEOKS0_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #1

; Function Attrs: nounwind
declare void @_ZN4mace10MaceStatusD1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @_ZSt11make_uniqueIN4mace4port12_GLOBAL__N_125PosixReadOnlyMemoryRegionEJRPKvRlEENSt8__detail9_MakeUniqIT_E15__single_objectEDpOT0_(ptr dead_on_unwind noalias writable sret(%"class.std::unique_ptr.2") align 8, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZNSt10unique_ptrIN4mace4port12_GLOBAL__N_125PosixReadOnlyMemoryRegionESt14default_deleteIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #5 align 2

declare i32 @close(i32 noundef) #1

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @_ZSt11make_uniqueIN4mace4port12_GLOBAL__N_125PosixReadOnlyMemoryRegionEJDniEENSt8__detail9_MakeUniqIT_E15__single_objectEDpOT0_(ptr dead_on_unwind noalias writable sret(%"class.std::unique_ptr.2") align 8, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) #4

attributes #0 = { 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 #1 = { "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 "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 = { 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 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 #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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !13, i64 48}
!12 = !{!"_ZTS4stat", !13, i64 0, !13, i64 8, !13, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !13, i64 40, !13, i64 48, !13, i64 56, !13, i64 64, !14, i64 72, !14, i64 88, !14, i64 104, !7, i64 120}
!13 = !{!"long", !7, i64 0}
!14 = !{!"_ZTS8timespec", !13, i64 0, !13, i64 8}
!15 = !{!16, !16, i64 0}
!16 = !{!"std::nullptr_t", !7, 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"

%"class.mace::MaceStatus" = type { %"class.std::unique_ptr" }
%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Head_base.1" }
%"struct.std::_Head_base.1" = type { 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::unique_ptr.2" = type { %"struct.std::__uniq_ptr_data.3" }
%"struct.std::__uniq_ptr_data.3" = type { %"class.std::__uniq_ptr_impl.4" }
%"class.std::__uniq_ptr_impl.4" = type { %"class.std::tuple.5" }
%"class.std::tuple.5" = type { %"struct.std::_Tuple_impl.6" }
%"struct.std::_Tuple_impl.6" = type { %"struct.std::_Head_base.9" }
%"struct.std::_Head_base.9" = type { ptr }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4mace4port15PosixFileSystem31NewReadOnlyMemoryRegionFromFileEPKcPSt10unique_ptrINS0_20ReadOnlyMemoryRegionESt14default_deleteIS5_EE(ptr dead_on_unwind noalias nonnull writable sret(%"class.mace::MaceStatus") align 8 %0, ptr nocapture noundef nonnull readnone align 8 dereferenceable(8) %1, ptr nocapture noundef readonly %2, ptr noundef %3) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca %"class.mace::MaceStatus", align 8
  %6 = alloca %struct.stat, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %"class.mace::MaceStatus", align 8
  %9 = alloca %"class.std::unique_ptr.2", align 8
  %10 = alloca %"class.std::unique_ptr.2", align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  tail call void @_ZN4mace10MaceStatusC1ENS0_4CodeE(ptr noundef nonnull align 8 dereferenceable(8) %0, i32 noundef 0)
  %13 = invoke i32 (ptr, i32, ...) @open(ptr noundef %2, i32 noundef 0)
          to label %14 unwind label %20

14:                                               ; preds = %4
  %15 = icmp slt i32 %13, 0
  br i1 %15, label %16, label %27

16:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #8
  invoke void @_ZN4mace10MaceStatusC1ENS0_4CodeE(ptr noundef nonnull align 8 dereferenceable(8) %5, i32 noundef 4)
          to label %17 unwind label %22

17:                                               ; preds = %16
  %18 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN4mace10MaceStatusaSEOKS0_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(8) %5)
          to label %19 unwind label %24

19:                                               ; preds = %17
  call void @_ZN4mace10MaceStatusD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  br label %63

20:                                               ; preds = %4
  %21 = landingpad { ptr, i32 }
          cleanup
  br label %62

22:                                               ; preds = %16
  %23 = landingpad { ptr, i32 }
          cleanup
  br label %26

24:                                               ; preds = %17
  %25 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN4mace10MaceStatusD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #8
  br label %26

26:                                               ; preds = %24, %22
  %.pn20 = phi { ptr, i32 } [ %25, %24 ], [ %23, %22 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  br label %62

27:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %6) #8
  %28 = call i32 @fstat(i32 noundef %13, ptr noundef nonnull %6) #8
  %29 = getelementptr inbounds i8, ptr %6, i64 48
  %30 = load i64, ptr %29, align 8, !tbaa !5
  %31 = icmp sgt i64 %30, 0
  br i1 %31, label %32, label %55

32:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  %33 = tail call ptr @mmap(ptr noundef null, i64 noundef %30, i32 noundef 1, i32 noundef 2, i32 noundef %13, i64 noundef 0) #8
  store ptr %33, ptr %7, align 8, !tbaa !12
  %34 = icmp eq ptr %33, inttoptr (i64 -1 to ptr)
  br i1 %34, label %35, label %44

35:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  invoke void @_ZN4mace10MaceStatusC1ENS0_4CodeE(ptr noundef nonnull align 8 dereferenceable(8) %8, i32 noundef 4)
          to label %36 unwind label %39

36:                                               ; preds = %35
  %37 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN4mace10MaceStatusaSEOKS0_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(8) %8)
          to label %38 unwind label %41

38:                                               ; preds = %36
  call void @_ZN4mace10MaceStatusD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  br label %49

39:                                               ; preds = %35
  %40 = landingpad { ptr, i32 }
          cleanup
  br label %43

41:                                               ; preds = %36
  %42 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN4mace10MaceStatusD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #8
  br label %43

43:                                               ; preds = %41, %39
  %.pn = phi { ptr, i32 } [ %42, %41 ], [ %40, %39 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  br label %54

44:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #8
  invoke void @_ZSt11make_uniqueIN4mace4port12_GLOBAL__N_125PosixReadOnlyMemoryRegionEJRPKvRlEENSt8__detail9_MakeUniqIT_E15__single_objectEDpOT0_(ptr dead_on_unwind nonnull writable sret(%"class.std::unique_ptr.2") align 8 %9, ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %29)
          to label %45 unwind label %47

45:                                               ; preds = %44
  %46 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt10unique_ptrIN4mace4port20ReadOnlyMemoryRegionESt14default_deleteIS2_EEaSINS1_12_GLOBAL__N_125PosixReadOnlyMemoryRegionES3_IS8_EEENSt9enable_ifIXsr6__and_ISt6__and_IJSt14is_convertibleINS_IT_T0_E7pointerEPS2_ESt6__not_ISt8is_arrayISD_EEEESt13is_assignableIRS4_OSE_EEE5valueERS5_E4typeEOSF_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %9) #8
  call void @_ZNSt10unique_ptrIN4mace4port12_GLOBAL__N_125PosixReadOnlyMemoryRegionESt14default_deleteIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #8
  br label %49

47:                                               ; preds = %44
  %48 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #8
  br label %54

49:                                               ; preds = %45, %38
  %50 = invoke i32 @close(i32 noundef %13)
          to label %51 unwind label %52

51:                                               ; preds = %49
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  br label %60

52:                                               ; preds = %49
  %53 = landingpad { ptr, i32 }
          cleanup
  br label %54

54:                                               ; preds = %52, %47, %43
  %.pn17 = phi { ptr, i32 } [ %53, %52 ], [ %.pn, %43 ], [ %48, %47 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  br label %61

55:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #8
  store ptr null, ptr %11, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #8
  store i32 0, ptr %12, align 4, !tbaa !16
  invoke void @_ZSt11make_uniqueIN4mace4port12_GLOBAL__N_125PosixReadOnlyMemoryRegionEJDniEENSt8__detail9_MakeUniqIT_E15__single_objectEDpOT0_(ptr dead_on_unwind nonnull writable sret(%"class.std::unique_ptr.2") align 8 %10, ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 4 dereferenceable(4) %12)
          to label %56 unwind label %58

56:                                               ; preds = %55
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt10unique_ptrIN4mace4port20ReadOnlyMemoryRegionESt14default_deleteIS2_EEaSINS1_12_GLOBAL__N_125PosixReadOnlyMemoryRegionES3_IS8_EEENSt9enable_ifIXsr6__and_ISt6__and_IJSt14is_convertibleINS_IT_T0_E7pointerEPS2_ESt6__not_ISt8is_arrayISD_EEEESt13is_assignableIRS4_OSE_EEE5valueERS5_E4typeEOSF_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %10) #8
  call void @_ZNSt10unique_ptrIN4mace4port12_GLOBAL__N_125PosixReadOnlyMemoryRegionESt14default_deleteIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #8
  br label %60

58:                                               ; preds = %55
  %59 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #8
  br label %61

60:                                               ; preds = %56, %51
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %6) #8
  br label %63

61:                                               ; preds = %58, %54
  %.pn17.pn = phi { ptr, i32 } [ %.pn17, %54 ], [ %59, %58 ]
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %6) #8
  br label %62

62:                                               ; preds = %61, %26, %20
  %.pn20.pn = phi { ptr, i32 } [ %.pn20, %26 ], [ %.pn17.pn, %61 ], [ %21, %20 ]
  call void @_ZN4mace10MaceStatusD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #8
  resume { ptr, i32 } %.pn20.pn

63:                                               ; preds = %19, %60
  ret void
}

declare void @_ZN4mace10MaceStatusC1ENS0_4CodeE(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) unnamed_addr #1

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

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

declare i32 @__gxx_personality_v0(...)

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZN4mace10MaceStatusaSEOKS0_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @_ZSt11make_uniqueIN4mace4port12_GLOBAL__N_125PosixReadOnlyMemoryRegionEJRPKvRlEENSt8__detail9_MakeUniqIT_E15__single_objectEDpOT0_(ptr dead_on_unwind noalias writable sret(%"class.std::unique_ptr.2") align 8, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #6

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt10unique_ptrIN4mace4port20ReadOnlyMemoryRegionESt14default_deleteIS2_EEaSINS1_12_GLOBAL__N_125PosixReadOnlyMemoryRegionES3_IS8_EEENSt9enable_ifIXsr6__and_ISt6__and_IJSt14is_convertibleINS_IT_T0_E7pointerEPS2_ESt6__not_ISt8is_arrayISD_EEEESt13is_assignableIRS4_OSE_EEE5valueERS5_E4typeEOSF_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #7 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZNSt10unique_ptrIN4mace4port12_GLOBAL__N_125PosixReadOnlyMemoryRegionESt14default_deleteIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #7 align 2

declare i32 @close(i32 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @_ZSt11make_uniqueIN4mace4port12_GLOBAL__N_125PosixReadOnlyMemoryRegionEJDniEENSt8__detail9_MakeUniqIT_E15__single_objectEDpOT0_(ptr dead_on_unwind noalias writable sret(%"class.std::unique_ptr.2") align 8, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #6

attributes #0 = { 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 #1 = { "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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #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 = { 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 #6 = { 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 #7 = { 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 #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 48}
!6 = !{!"_ZTS4stat", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !11, i64 72, !11, i64 88, !11, i64 104, !8, i64 120}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"_ZTS8timespec", !7, i64 0, !7, i64 8}
!12 = !{!13, !13, i64 0}
!13 = !{!"any pointer", !8, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"std::nullptr_t", !8, i64 0}
!16 = !{!10, !10, i64 0}


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