; LLVM IR from XiaoMi/mobile-ai-bench :: aibench/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.aibench::Status" = 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 @_ZN7aibench4port15PosixFileSystem31NewReadOnlyMemoryRegionFromFileEPKcPSt10unique_ptrINS0_20ReadOnlyMemoryRegionESt14default_deleteIS5_EE(ptr dead_on_unwind noalias writable sret(%"class.aibench::Status") 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.aibench::Status", align 8
  %14 = alloca %struct.stat, align 8
  %15 = alloca ptr, align 8
  %16 = alloca %"class.aibench::Status", 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
  %21 = alloca %"class.aibench::Status", align 8
  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
  %22 = load ptr, ptr %6, align 8
  store i1 false, ptr %9, align 1
  call void @_ZN7aibench6StatusC1ENS0_4CodeE(ptr noundef nonnull align 8 dereferenceable(8) %0, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = invoke i32 (ptr, i32, ...) @open(ptr noundef %23, i32 noundef 0)
          to label %25 unwind label %32

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

28:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  invoke void @_ZN7aibench6StatusC1ENS0_4CodeE(ptr noundef nonnull align 8 dereferenceable(8) %13, i32 noundef 1)
          to label %29 unwind label %36

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

31:                                               ; preds = %29
  call void @_ZN7aibench6StatusD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %111

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

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

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

44:                                               ; preds = %40, %36
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %113

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

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

58:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  invoke void @_ZN7aibench6StatusC1ENS0_4CodeE(ptr noundef nonnull align 8 dereferenceable(8) %16, i32 noundef 1)
          to label %59 unwind label %62

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

61:                                               ; preds = %59
  call void @_ZN7aibench6StatusD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  br label %80

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

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

70:                                               ; preds = %66, %62
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  br label %88

71:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %72 = getelementptr inbounds %struct.stat, ptr %14, i32 0, i32 8
  invoke void @_ZSt11make_uniqueIN7aibench4port12_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) %72)
          to label %73 unwind label %76

73:                                               ; preds = %71
  %74 = load ptr, ptr %8, align 8, !tbaa !5
  %75 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt10unique_ptrIN7aibench4port20ReadOnlyMemoryRegionESt14default_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) %74, ptr noundef nonnull align 8 dereferenceable(8) %17) #6
  call void @_ZNSt10unique_ptrIN7aibench4port12_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 %80

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

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

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

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

88:                                               ; preds = %84, %76, %70
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %110

89:                                               ; preds = %45
  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_uniqueIN7aibench4port12_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 %90 unwind label %96

90:                                               ; preds = %89
  %91 = load ptr, ptr %8, align 8, !tbaa !5
  %92 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt10unique_ptrIN7aibench4port20ReadOnlyMemoryRegionESt14default_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) %91, ptr noundef nonnull align 8 dereferenceable(8) %18) #6
  call void @_ZNSt10unique_ptrIN7aibench4port12_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
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  invoke void @_ZN7aibench6StatusC1ENS0_4CodeE(ptr noundef nonnull align 8 dereferenceable(8) %21, i32 noundef 1)
          to label %93 unwind label %100

93:                                               ; preds = %90
  %94 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7aibench6StatusaSEOKS0_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(8) %21)
          to label %95 unwind label %104

95:                                               ; preds = %93
  call void @_ZN7aibench6StatusD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %21) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  br label %109

96:                                               ; preds = %89
  %97 = landingpad { ptr, i32 }
          cleanup
  %98 = extractvalue { ptr, i32 } %97, 0
  store ptr %98, ptr %11, align 8
  %99 = extractvalue { ptr, i32 } %97, 1
  store i32 %99, 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 %110

100:                                              ; preds = %90
  %101 = landingpad { ptr, i32 }
          cleanup
  %102 = extractvalue { ptr, i32 } %101, 0
  store ptr %102, ptr %11, align 8
  %103 = extractvalue { ptr, i32 } %101, 1
  store i32 %103, ptr %12, align 4
  br label %108

104:                                              ; preds = %93
  %105 = landingpad { ptr, i32 }
          cleanup
  %106 = extractvalue { ptr, i32 } %105, 0
  store ptr %106, ptr %11, align 8
  %107 = extractvalue { ptr, i32 } %105, 1
  store i32 %107, ptr %12, align 4
  call void @_ZN7aibench6StatusD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %21) #6
  br label %108

108:                                              ; preds = %104, %100
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  br label %110

109:                                              ; preds = %95, %83
  call void @llvm.lifetime.end.p0(i64 144, ptr %14) #6
  br label %111

110:                                              ; preds = %108, %96, %88
  call void @llvm.lifetime.end.p0(i64 144, ptr %14) #6
  br label %113

111:                                              ; preds = %109, %31
  store i1 true, ptr %9, align 1
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  %112 = load i1, ptr %9, align 1
  br i1 %112, label %115, label %114

113:                                              ; preds = %110, %44, %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @_ZN7aibench6StatusD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #6
  br label %116

114:                                              ; preds = %111
  call void @_ZN7aibench6StatusD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #6
  br label %115

115:                                              ; preds = %114, %111
  ret void

116:                                              ; preds = %113
  %117 = load ptr, ptr %11, align 8
  %118 = load i32, ptr %12, align 4
  %119 = insertvalue { ptr, i32 } poison, ptr %117, 0
  %120 = insertvalue { ptr, i32 } %119, i32 %118, 1
  resume { ptr, i32 } %120
}

declare void @_ZN7aibench6StatusC1ENS0_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 @_ZN7aibench6StatusaSEOKS0_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #1

; Function Attrs: nounwind
declare void @_ZN7aibench6StatusD1Ev(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_uniqueIN7aibench4port12_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_ptrIN7aibench4port20ReadOnlyMemoryRegionESt14default_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_ptrIN7aibench4port12_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_uniqueIN7aibench4port12_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.aibench::Status" = 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 @_ZN7aibench4port15PosixFileSystem31NewReadOnlyMemoryRegionFromFileEPKcPSt10unique_ptrINS0_20ReadOnlyMemoryRegionESt14default_deleteIS5_EE(ptr dead_on_unwind noalias nonnull writable sret(%"class.aibench::Status") 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.aibench::Status", align 8
  %6 = alloca %struct.stat, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %"class.aibench::Status", 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
  %13 = alloca %"class.aibench::Status", align 8
  tail call void @_ZN7aibench6StatusC1ENS0_4CodeE(ptr noundef nonnull align 8 dereferenceable(8) %0, i32 noundef 0)
  %14 = invoke i32 (ptr, i32, ...) @open(ptr noundef %2, i32 noundef 0)
          to label %15 unwind label %21

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

17:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #8
  invoke void @_ZN7aibench6StatusC1ENS0_4CodeE(ptr noundef nonnull align 8 dereferenceable(8) %5, i32 noundef 1)
          to label %18 unwind label %23

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

20:                                               ; preds = %18
  call void @_ZN7aibench6StatusD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  br label %72

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

23:                                               ; preds = %17
  %24 = landingpad { ptr, i32 }
          cleanup
  br label %27

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

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

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

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

36:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  invoke void @_ZN7aibench6StatusC1ENS0_4CodeE(ptr noundef nonnull align 8 dereferenceable(8) %8, i32 noundef 1)
          to label %37 unwind label %40

37:                                               ; preds = %36
  %38 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7aibench6StatusaSEOKS0_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(8) %8)
          to label %39 unwind label %42

39:                                               ; preds = %37
  call void @_ZN7aibench6StatusD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  br label %50

40:                                               ; preds = %36
  %41 = landingpad { ptr, i32 }
          cleanup
  br label %44

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

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

45:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #8
  invoke void @_ZSt11make_uniqueIN7aibench4port12_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) %30)
          to label %46 unwind label %48

46:                                               ; preds = %45
  %47 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt10unique_ptrIN7aibench4port20ReadOnlyMemoryRegionESt14default_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_ptrIN7aibench4port12_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 %50

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

50:                                               ; preds = %46, %39
  %51 = invoke i32 @close(i32 noundef %14)
          to label %52 unwind label %53

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

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

55:                                               ; preds = %53, %48, %44
  %.pn20 = phi { ptr, i32 } [ %54, %53 ], [ %.pn18, %44 ], [ %49, %48 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  br label %70

56:                                               ; preds = %28
  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_uniqueIN7aibench4port12_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 %57 unwind label %62

57:                                               ; preds = %56
  %58 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt10unique_ptrIN7aibench4port20ReadOnlyMemoryRegionESt14default_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_ptrIN7aibench4port12_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
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #8
  invoke void @_ZN7aibench6StatusC1ENS0_4CodeE(ptr noundef nonnull align 8 dereferenceable(8) %13, i32 noundef 1)
          to label %59 unwind label %64

59:                                               ; preds = %57
  %60 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7aibench6StatusaSEOKS0_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(8) %13)
          to label %61 unwind label %66

61:                                               ; preds = %59
  call void @_ZN7aibench6StatusD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #8
  br label %69

62:                                               ; preds = %56
  %63 = 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 %70

64:                                               ; preds = %57
  %65 = landingpad { ptr, i32 }
          cleanup
  br label %68

66:                                               ; preds = %59
  %67 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7aibench6StatusD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %13) #8
  br label %68

68:                                               ; preds = %66, %64
  %.pn = phi { ptr, i32 } [ %67, %66 ], [ %65, %64 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #8
  br label %70

69:                                               ; preds = %61, %52
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %6) #8
  br label %72

70:                                               ; preds = %68, %62, %55
  %.pn20.pn = phi { ptr, i32 } [ %.pn20, %55 ], [ %.pn, %68 ], [ %63, %62 ]
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %6) #8
  br label %71

71:                                               ; preds = %70, %27, %21
  %.pn23.pn = phi { ptr, i32 } [ %.pn23, %27 ], [ %.pn20.pn, %70 ], [ %22, %21 ]
  call void @_ZN7aibench6StatusD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #8
  resume { ptr, i32 } %.pn23.pn

72:                                               ; preds = %20, %69
  ret void
}

declare void @_ZN7aibench6StatusC1ENS0_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 @_ZN7aibench6StatusaSEOKS0_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1

; Function Attrs: nounwind
declare void @_ZN7aibench6StatusD1Ev(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_uniqueIN7aibench4port12_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_ptrIN7aibench4port20ReadOnlyMemoryRegionESt14default_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_ptrIN7aibench4port12_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_uniqueIN7aibench4port12_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