; LLVM IR from NVIDIA/DALI :: dali/core/os/shared_mem.ll (ZN4dali9SharedMemC2Eim)

; 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.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.dali::ShmHandle" = type { %"class.dali::UniqueHandle" }
%"class.dali::UniqueHandle" = type { i32 }
%"class.std::allocator" = type { i8 }
%"class.dali::MemoryMapping" = type { %"class.dali::UniqueHandle.2" }
%"class.dali::UniqueHandle.2" = type { %"struct.dali::MappedMemoryChunk" }
%"struct.dali::MappedMemoryChunk" = type { i64, ptr }
%"class.dali::SharedMem" = type { i64, %"class.dali::ShmHandle", %"class.dali::MemoryMapping" }

@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@_ZTIN4dali13DALIExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8
@.str.25 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [79 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4dali15handle_strerrorEiPcm(i32 noundef, ptr noundef, i64 noundef) #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEmcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef, i8 noundef signext, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__errno_location() #3

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

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

declare ptr @__cxa_allocate_exception(i64)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4dali11make_stringIJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEES6_DpRKT_(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(32)) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN4dali13GetStacktraceB5cxx11Ev(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8) #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4dali13DALIExceptionC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_S8_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4dali13DALIExceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #5 align 2

declare void @__cxa_throw(ptr, ptr, ptr)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

declare void @__cxa_free_exception(ptr)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4dali9ShmHandle12CreateHandleEv(ptr dead_on_unwind noalias writable sret(%"class.dali::ShmHandle") align 4) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN4dali9ShmHandleCI2NS_12UniqueHandleIiS0_EEEi(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNKR4dali12UniqueHandleIiNS_9ShmHandleEEcviEv(ptr noundef nonnull align 4 dereferenceable(4)) #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4dali12UniqueHandleIiNS_9ShmHandleEED2Ev(ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4dali9SharedMemC2Eim(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef %1, i64 noundef %2) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca %"class.dali::ShmHandle", align 4
  %10 = alloca %"class.dali::ShmHandle", align 4
  %11 = alloca i32, align 4
  %12 = alloca %"class.std::__cxx11::basic_string", align 8
  %13 = alloca %"class.std::allocator", align 1
  %14 = alloca i32, align 4
  %15 = alloca %"class.std::__cxx11::basic_string", align 8
  %16 = alloca %"class.std::__cxx11::basic_string", align 8
  %17 = alloca %"class.std::__cxx11::basic_string", align 8
  %18 = alloca %"class.std::allocator", align 1
  %19 = alloca %"class.std::__cxx11::basic_string", align 8
  %20 = alloca i1, align 1
  %21 = alloca %"class.dali::MemoryMapping", align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store i64 %2, ptr %6, align 8, !tbaa !11
  %22 = load ptr, ptr %4, align 8
  %23 = getelementptr inbounds %"class.dali::SharedMem", ptr %22, i32 0, i32 0
  %24 = load i64, ptr %6, align 8, !tbaa !11
  %25 = mul i64 %24, 1
  store i64 %25, ptr %23, align 8, !tbaa !13
  %26 = getelementptr inbounds %"class.dali::SharedMem", ptr %22, i32 0, i32 1
  call void @_ZN4dali9ShmHandleC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %26)
  %27 = getelementptr inbounds %"class.dali::SharedMem", ptr %22, i32 0, i32 2
  invoke void @_ZN4dali13MemoryMappingC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %27)
          to label %28 unwind label %37

28:                                               ; preds = %3
  %29 = load i32, ptr %5, align 4, !tbaa !9
  %30 = icmp sge i32 %29, 0
  br i1 %30, label %31, label %50

31:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %32 = load i32, ptr %5, align 4, !tbaa !9
  invoke void @_ZN4dali9ShmHandleCI2NS_12UniqueHandleIiS0_EEEi(ptr noundef nonnull align 4 dereferenceable(4) %9, i32 noundef %32)
          to label %33 unwind label %41

33:                                               ; preds = %31
  %34 = getelementptr inbounds %"class.dali::SharedMem", ptr %22, i32 0, i32 1
  %35 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN4dali9ShmHandleaSEOS0_(ptr noundef nonnull align 4 dereferenceable(4) %34, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %36 unwind label %45

36:                                               ; preds = %33
  call void @_ZN4dali12UniqueHandleIiNS_9ShmHandleEED2Ev(ptr noundef nonnull align 4 dereferenceable(4) %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %129

37:                                               ; preds = %3
  %38 = landingpad { ptr, i32 }
          cleanup
  %39 = extractvalue { ptr, i32 } %38, 0
  store ptr %39, ptr %7, align 8
  %40 = extractvalue { ptr, i32 } %38, 1
  store i32 %40, ptr %8, align 4
  br label %148

41:                                               ; preds = %31
  %42 = landingpad { ptr, i32 }
          cleanup
  %43 = extractvalue { ptr, i32 } %42, 0
  store ptr %43, ptr %7, align 8
  %44 = extractvalue { ptr, i32 } %42, 1
  store i32 %44, ptr %8, align 4
  br label %49

45:                                               ; preds = %33
  %46 = landingpad { ptr, i32 }
          cleanup
  %47 = extractvalue { ptr, i32 } %46, 0
  store ptr %47, ptr %7, align 8
  %48 = extractvalue { ptr, i32 } %46, 1
  store i32 %48, ptr %8, align 4
  call void @_ZN4dali12UniqueHandleIiNS_9ShmHandleEED2Ev(ptr noundef nonnull align 4 dereferenceable(4) %9) #7
  br label %49

49:                                               ; preds = %45, %41
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %147

50:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  invoke void @_ZN4dali9ShmHandle12CreateHandleEv(ptr dead_on_unwind writable sret(%"class.dali::ShmHandle") align 4 %10)
          to label %51 unwind label %78

51:                                               ; preds = %50
  %52 = getelementptr inbounds %"class.dali::SharedMem", ptr %22, i32 0, i32 1
  %53 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN4dali9ShmHandleaSEOS0_(ptr noundef nonnull align 4 dereferenceable(4) %52, ptr noundef nonnull align 4 dereferenceable(4) %10)
          to label %54 unwind label %82

54:                                               ; preds = %51
  call void @_ZN4dali12UniqueHandleIiNS_9ShmHandleEED2Ev(ptr noundef nonnull align 4 dereferenceable(4) %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %55

55:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %56 = getelementptr inbounds %"class.dali::SharedMem", ptr %22, i32 0, i32 1
  %57 = call noundef i32 @_ZNKR4dali12UniqueHandleIiNS_9ShmHandleEEcviEv(ptr noundef nonnull align 4 dereferenceable(4) %56) #7
  %58 = getelementptr inbounds %"class.dali::SharedMem", ptr %22, i32 0, i32 0
  %59 = load i64, ptr %58, align 8, !tbaa !13
  %60 = call i32 @ftruncate(i32 noundef %57, i64 noundef %59) #7
  store i32 %60, ptr %11, align 4, !tbaa !9
  br label %61

61:                                               ; preds = %55
  %62 = load i32, ptr %11, align 4, !tbaa !9
  %63 = icmp eq i32 %62, -1
  br i1 %63, label %64, label %124

64:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 32, ptr %12) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #7
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #7
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEmcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %12, i64 noundef 256, i8 noundef signext 0, ptr noundef nonnull align 1 dereferenceable(1) %13)
          to label %65 unwind label %87

65:                                               ; preds = %64
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %66 = call ptr @__errno_location() #8
  %67 = load i32, ptr %66, align 4, !tbaa !9
  store i32 %67, ptr %14, align 4, !tbaa !9
  %68 = load i32, ptr %14, align 4, !tbaa !9
  %69 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %12, i64 noundef 0)
          to label %70 unwind label %91

70:                                               ; preds = %65
  %71 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %12) #7
  call void @_ZN4dali15handle_strerrorEiPcm(i32 noundef %68, ptr noundef %69, i64 noundef %71)
  store i1 true, ptr %20, align 1
  %72 = call ptr @__cxa_allocate_exception(i64 80) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr %15) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr %16) #7
  invoke void @_ZN4dali11make_stringIJA9_cA30_cA10_cNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEA2_cA32_cEEES9_DpRKT_(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %16, ptr noundef nonnull align 1 dereferenceable(9) @.str, ptr noundef nonnull align 1 dereferenceable(30) @.str.25, ptr noundef nonnull align 1 dereferenceable(10) @.str.2, ptr noundef nonnull align 8 dereferenceable(32) %12, ptr noundef nonnull align 1 dereferenceable(2) @.str.3, ptr noundef nonnull align 1 dereferenceable(32) @.str.26)
          to label %73 unwind label %95

73:                                               ; preds = %70
  invoke void @_ZN4dali11make_stringIJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEES6_DpRKT_(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %15, ptr noundef nonnull align 8 dereferenceable(32) %16)
          to label %74 unwind label %99

74:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 1, ptr %18) #7
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %18) #7
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %17, ptr noundef @.str.27, ptr noundef nonnull align 1 dereferenceable(1) %18)
          to label %75 unwind label %103

75:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 32, ptr %19) #7
  invoke void @_ZN4dali13GetStacktraceB5cxx11Ev(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %19)
          to label %76 unwind label %107

76:                                               ; preds = %75
  invoke void @_ZN4dali13DALIExceptionC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_S8_(ptr noundef nonnull align 8 dereferenceable(80) %72, ptr noundef nonnull align 8 dereferenceable(32) %15, ptr noundef %17, ptr noundef nonnull align 8 dereferenceable(32) %19)
          to label %77 unwind label %111

77:                                               ; preds = %76
  store i1 false, ptr %20, align 1
  invoke void @__cxa_throw(ptr %72, ptr @_ZTIN4dali13DALIExceptionE, ptr @_ZN4dali13DALIExceptionD2Ev) #9
          to label %154 unwind label %111

78:                                               ; preds = %50
  %79 = landingpad { ptr, i32 }
          cleanup
  %80 = extractvalue { ptr, i32 } %79, 0
  store ptr %80, ptr %7, align 8
  %81 = extractvalue { ptr, i32 } %79, 1
  store i32 %81, ptr %8, align 4
  br label %86

82:                                               ; preds = %51
  %83 = landingpad { ptr, i32 }
          cleanup
  %84 = extractvalue { ptr, i32 } %83, 0
  store ptr %84, ptr %7, align 8
  %85 = extractvalue { ptr, i32 } %83, 1
  store i32 %85, ptr %8, align 4
  call void @_ZN4dali12UniqueHandleIiNS_9ShmHandleEED2Ev(ptr noundef nonnull align 4 dereferenceable(4) %10) #7
  br label %86

86:                                               ; preds = %82, %78
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %147

87:                                               ; preds = %64
  %88 = landingpad { ptr, i32 }
          cleanup
  %89 = extractvalue { ptr, i32 } %88, 0
  store ptr %89, ptr %7, align 8
  %90 = extractvalue { ptr, i32 } %88, 1
  store i32 %90, ptr %8, align 4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #7
  br label %123

91:                                               ; preds = %65
  %92 = landingpad { ptr, i32 }
          cleanup
  %93 = extractvalue { ptr, i32 } %92, 0
  store ptr %93, ptr %7, align 8
  %94 = extractvalue { ptr, i32 } %92, 1
  store i32 %94, ptr %8, align 4
  br label %122

95:                                               ; preds = %70
  %96 = landingpad { ptr, i32 }
          cleanup
  %97 = extractvalue { ptr, i32 } %96, 0
  store ptr %97, ptr %7, align 8
  %98 = extractvalue { ptr, i32 } %96, 1
  store i32 %98, ptr %8, align 4
  br label %118

99:                                               ; preds = %73
  %100 = landingpad { ptr, i32 }
          cleanup
  %101 = extractvalue { ptr, i32 } %100, 0
  store ptr %101, ptr %7, align 8
  %102 = extractvalue { ptr, i32 } %100, 1
  store i32 %102, ptr %8, align 4
  br label %117

103:                                              ; preds = %74
  %104 = landingpad { ptr, i32 }
          cleanup
  %105 = extractvalue { ptr, i32 } %104, 0
  store ptr %105, ptr %7, align 8
  %106 = extractvalue { ptr, i32 } %104, 1
  store i32 %106, ptr %8, align 4
  br label %116

107:                                              ; preds = %75
  %108 = landingpad { ptr, i32 }
          cleanup
  %109 = extractvalue { ptr, i32 } %108, 0
  store ptr %109, ptr %7, align 8
  %110 = extractvalue { ptr, i32 } %108, 1
  store i32 %110, ptr %8, align 4
  br label %115

111:                                              ; preds = %77, %76
  %112 = landingpad { ptr, i32 }
          cleanup
  %113 = extractvalue { ptr, i32 } %112, 0
  store ptr %113, ptr %7, align 8
  %114 = extractvalue { ptr, i32 } %112, 1
  store i32 %114, ptr %8, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %19) #7
  br label %115

115:                                              ; preds = %111, %107
  call void @llvm.lifetime.end.p0(i64 32, ptr %19) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %17) #7
  br label %116

116:                                              ; preds = %115, %103
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %18) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %15) #7
  br label %117

117:                                              ; preds = %116, %99
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %16) #7
  br label %118

118:                                              ; preds = %117, %95
  call void @llvm.lifetime.end.p0(i64 32, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %15) #7
  %119 = load i1, ptr %20, align 1
  br i1 %119, label %120, label %121

120:                                              ; preds = %118
  call void @__cxa_free_exception(ptr %72) #7
  br label %121

121:                                              ; preds = %120, %118
  br label %122

122:                                              ; preds = %121, %91
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #7
  br label %123

123:                                              ; preds = %122, %87
  call void @llvm.lifetime.end.p0(i64 32, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %147

124:                                              ; preds = %61
  br label %125

125:                                              ; preds = %124
  br label %126

126:                                              ; preds = %125
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %127

127:                                              ; preds = %126
  br label %128

128:                                              ; preds = %127
  br label %129

129:                                              ; preds = %128, %36
  call void @llvm.lifetime.start.p0(i64 16, ptr %21) #7
  %130 = getelementptr inbounds %"class.dali::SharedMem", ptr %22, i32 0, i32 1
  %131 = call noundef i32 @_ZNKR4dali12UniqueHandleIiNS_9ShmHandleEEcviEv(ptr noundef nonnull align 4 dereferenceable(4) %130) #7
  %132 = getelementptr inbounds %"class.dali::SharedMem", ptr %22, i32 0, i32 0
  %133 = load i64, ptr %132, align 8, !tbaa !13
  invoke void @_ZN4dali13MemoryMappingC1Eim(ptr noundef nonnull align 8 dereferenceable(16) %21, i32 noundef %131, i64 noundef %133)
          to label %134 unwind label %138

134:                                              ; preds = %129
  %135 = getelementptr inbounds %"class.dali::SharedMem", ptr %22, i32 0, i32 2
  %136 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN4dali13MemoryMappingaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) %135, ptr noundef nonnull align 8 dereferenceable(16) %21)
          to label %137 unwind label %142

137:                                              ; preds = %134
  call void @_ZN4dali12UniqueHandleINS_17MappedMemoryChunkENS_13MemoryMappingEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %21) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %21) #7
  ret void

138:                                              ; preds = %129
  %139 = landingpad { ptr, i32 }
          cleanup
  %140 = extractvalue { ptr, i32 } %139, 0
  store ptr %140, ptr %7, align 8
  %141 = extractvalue { ptr, i32 } %139, 1
  store i32 %141, ptr %8, align 4
  br label %146

142:                                              ; preds = %134
  %143 = landingpad { ptr, i32 }
          cleanup
  %144 = extractvalue { ptr, i32 } %143, 0
  store ptr %144, ptr %7, align 8
  %145 = extractvalue { ptr, i32 } %143, 1
  store i32 %145, ptr %8, align 4
  call void @_ZN4dali12UniqueHandleINS_17MappedMemoryChunkENS_13MemoryMappingEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %21) #7
  br label %146

146:                                              ; preds = %142, %138
  call void @llvm.lifetime.end.p0(i64 16, ptr %21) #7
  br label %147

147:                                              ; preds = %146, %123, %86, %49
  call void @_ZN4dali12UniqueHandleINS_17MappedMemoryChunkENS_13MemoryMappingEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %27) #7
  br label %148

148:                                              ; preds = %147, %37
  call void @_ZN4dali12UniqueHandleIiNS_9ShmHandleEED2Ev(ptr noundef nonnull align 4 dereferenceable(4) %26) #7
  br label %149

149:                                              ; preds = %148
  %150 = load ptr, ptr %7, align 8
  %151 = load i32, ptr %8, align 4
  %152 = insertvalue { ptr, i32 } poison, ptr %150, 0
  %153 = insertvalue { ptr, i32 } %152, i32 %151, 1
  resume { ptr, i32 } %153

154:                                              ; preds = %77
  unreachable
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN4dali9ShmHandleC2Ev(ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN4dali13MemoryMappingC2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN4dali9ShmHandleaSEOS0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #4 align 2

; Function Attrs: nounwind
declare i32 @ftruncate(i32 noundef, i64 noundef) #6

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4dali11make_stringIJA9_cA30_cA10_cNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEA2_cA32_cEEES9_DpRKT_(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 1 dereferenceable(9), ptr noundef nonnull align 1 dereferenceable(30), ptr noundef nonnull align 1 dereferenceable(10), ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 1 dereferenceable(2), ptr noundef nonnull align 1 dereferenceable(32)) #2

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

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

declare void @_ZN4dali13MemoryMappingC1Eim(ptr, i32, i64)

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nounwind willreturn memory(none) "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 = { inlinehint 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 "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(none) }
attributes #9 = { noreturn }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !12, i64 0}
!14 = !{!"_ZTSN4dali9SharedMemE", !12, i64 0, !15, i64 8, !17, i64 16}
!15 = !{!"_ZTSN4dali9ShmHandleE", !16, i64 0}
!16 = !{!"_ZTSN4dali12UniqueHandleIiNS_9ShmHandleEEE", !10, i64 0}
!17 = !{!"_ZTSN4dali13MemoryMappingE", !18, i64 0}
!18 = !{!"_ZTSN4dali12UniqueHandleINS_17MappedMemoryChunkENS_13MemoryMappingEEE", !19, i64 0}
!19 = !{!"_ZTSN4dali17MappedMemoryChunkE", !12, i64 0, !6, i64 8}


; 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.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.dali::ShmHandle" = type { %"class.dali::UniqueHandle" }
%"class.dali::UniqueHandle" = type { i32 }
%"class.std::allocator" = type { i8 }
%"class.dali::MemoryMapping" = type { %"class.dali::UniqueHandle.2" }
%"class.dali::UniqueHandle.2" = type { %"struct.dali::MappedMemoryChunk" }
%"struct.dali::MappedMemoryChunk" = type { i64, ptr }

@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@_ZTIN4dali13DALIExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8
@.str.25 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [79 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4dali15handle_strerrorEiPcm(i32 noundef, ptr noundef, i64 noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEmcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef, i8 noundef signext, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__errno_location() local_unnamed_addr #3

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

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

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4dali11make_stringIJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEES6_DpRKT_(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN4dali13GetStacktraceB5cxx11Ev(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4dali13DALIExceptionC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_S8_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4dali13DALIExceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #5 align 2

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

declare void @__cxa_free_exception(ptr) local_unnamed_addr

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4dali9ShmHandle12CreateHandleEv(ptr dead_on_unwind noalias writable sret(%"class.dali::ShmHandle") align 4) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN4dali9ShmHandleCI2NS_12UniqueHandleIiS0_EEEi(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNKR4dali12UniqueHandleIiNS_9ShmHandleEEcviEv(ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4dali12UniqueHandleIiNS_9ShmHandleEED2Ev(ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4dali9SharedMemC2Eim(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef %1, i64 noundef %2) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.dali::ShmHandle", align 4
  %5 = alloca %"class.dali::ShmHandle", align 4
  %6 = alloca %"class.std::__cxx11::basic_string", align 8
  %7 = alloca %"class.std::allocator", align 1
  %8 = alloca %"class.std::__cxx11::basic_string", align 8
  %9 = alloca %"class.std::__cxx11::basic_string", align 8
  %10 = alloca %"class.std::__cxx11::basic_string", align 8
  %11 = alloca %"class.std::allocator", align 1
  %12 = alloca %"class.std::__cxx11::basic_string", align 8
  %13 = alloca %"class.dali::MemoryMapping", align 8
  store i64 %2, ptr %0, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %0, i64 8
  tail call void @_ZN4dali9ShmHandleC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %14)
  %15 = getelementptr inbounds i8, ptr %0, i64 16
  invoke void @_ZN4dali13MemoryMappingC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %15)
          to label %16 unwind label %22

16:                                               ; preds = %3
  %17 = icmp sgt i32 %1, -1
  br i1 %17, label %18, label %29

18:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  invoke void @_ZN4dali9ShmHandleCI2NS_12UniqueHandleIiS0_EEEi(ptr noundef nonnull align 4 dereferenceable(4) %4, i32 noundef %1)
          to label %19 unwind label %24

19:                                               ; preds = %18
  %20 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN4dali9ShmHandleaSEOS0_(ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %21 unwind label %26

21:                                               ; preds = %19
  call void @_ZN4dali12UniqueHandleIiNS_9ShmHandleEED2Ev(ptr noundef nonnull align 4 dereferenceable(4) %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  br label %69

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

24:                                               ; preds = %18
  %25 = landingpad { ptr, i32 }
          cleanup
  br label %28

26:                                               ; preds = %19
  %27 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN4dali12UniqueHandleIiNS_9ShmHandleEED2Ev(ptr noundef nonnull align 4 dereferenceable(4) %4) #7
  br label %28

28:                                               ; preds = %26, %24
  %.pn31 = phi { ptr, i32 } [ %27, %26 ], [ %25, %24 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  br label %80

29:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  invoke void @_ZN4dali9ShmHandle12CreateHandleEv(ptr dead_on_unwind nonnull writable sret(%"class.dali::ShmHandle") align 4 %5)
          to label %30 unwind label %49

30:                                               ; preds = %29
  %31 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN4dali9ShmHandleaSEOS0_(ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 4 dereferenceable(4) %5)
          to label %32 unwind label %51

32:                                               ; preds = %30
  call void @_ZN4dali12UniqueHandleIiNS_9ShmHandleEED2Ev(ptr noundef nonnull align 4 dereferenceable(4) %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  %33 = call noundef i32 @_ZNKR4dali12UniqueHandleIiNS_9ShmHandleEEcviEv(ptr noundef nonnull align 4 dereferenceable(4) %14) #7
  %34 = load i64, ptr %0, align 8, !tbaa !5
  %35 = call i32 @ftruncate(i32 noundef %33, i64 noundef %34) #7
  %36 = icmp eq i32 %35, -1
  br i1 %36, label %37, label %69

37:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %7) #7
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #7
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEmcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %6, i64 noundef 256, i8 noundef signext 0, ptr noundef nonnull align 1 dereferenceable(1) %7)
          to label %38 unwind label %54

38:                                               ; preds = %37
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %7) #7
  %39 = tail call ptr @__errno_location() #8
  %40 = load i32, ptr %39, align 4, !tbaa !17
  %41 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %6, i64 noundef 0)
  %42 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %6) #7
  call void @_ZN4dali15handle_strerrorEiPcm(i32 noundef %40, ptr noundef nonnull %41, i64 noundef %42)
  %43 = call ptr @__cxa_allocate_exception(i64 80) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #7
  invoke void @_ZN4dali11make_stringIJA9_cA30_cA10_cNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEA2_cA32_cEEES9_DpRKT_(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %9, ptr noundef nonnull align 1 dereferenceable(9) @.str, ptr noundef nonnull align 1 dereferenceable(30) @.str.25, ptr noundef nonnull align 1 dereferenceable(10) @.str.2, ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef nonnull align 1 dereferenceable(2) @.str.3, ptr noundef nonnull align 1 dereferenceable(32) @.str.26)
          to label %44 unwind label %.thread

44:                                               ; preds = %38
  invoke void @_ZN4dali11make_stringIJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEES6_DpRKT_(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %8, ptr noundef nonnull align 8 dereferenceable(32) %9)
          to label %45 unwind label %.thread41

45:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %11) #7
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #7
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %10, ptr noundef nonnull @.str.27, ptr noundef nonnull align 1 dereferenceable(1) %11)
          to label %46 unwind label %58

46:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %12) #7
  invoke void @_ZN4dali13GetStacktraceB5cxx11Ev(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %12)
          to label %47 unwind label %60

47:                                               ; preds = %46
  invoke void @_ZN4dali13DALIExceptionC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_S8_(ptr noundef nonnull align 8 dereferenceable(80) %43, ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef nonnull %10, ptr noundef nonnull align 8 dereferenceable(32) %12)
          to label %48 unwind label %62

48:                                               ; preds = %47
  invoke void @__cxa_throw(ptr nonnull %43, ptr nonnull @_ZTIN4dali13DALIExceptionE, ptr nonnull @_ZN4dali13DALIExceptionD2Ev) #9
          to label %82 unwind label %62

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

51:                                               ; preds = %30
  %52 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN4dali12UniqueHandleIiNS_9ShmHandleEED2Ev(ptr noundef nonnull align 4 dereferenceable(4) %5) #7
  br label %53

53:                                               ; preds = %51, %49
  %.pn = phi { ptr, i32 } [ %52, %51 ], [ %50, %49 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  br label %80

54:                                               ; preds = %37
  %55 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %7) #7
  br label %68

.thread:                                          ; preds = %38
  %56 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #7
  br label %66

.thread41:                                        ; preds = %44
  %57 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #7
  br label %66

58:                                               ; preds = %45
  %59 = landingpad { ptr, i32 }
          cleanup
  br label %65

60:                                               ; preds = %46
  %61 = landingpad { ptr, i32 }
          cleanup
  br label %64

62:                                               ; preds = %48, %47
  %.0 = phi i1 [ false, %48 ], [ true, %47 ]
  %63 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #7
  br label %64

64:                                               ; preds = %62, %60
  %.pn25 = phi { ptr, i32 } [ %63, %62 ], [ %61, %60 ]
  %.1 = phi i1 [ %.0, %62 ], [ true, %60 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %12) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #7
  br label %65

65:                                               ; preds = %58, %64
  %.pn25.pn = phi { ptr, i32 } [ %.pn25, %64 ], [ %59, %58 ]
  %.2 = phi i1 [ %.1, %64 ], [ true, %58 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %11) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #7
  br i1 %.2, label %66, label %67

66:                                               ; preds = %.thread41, %.thread, %65
  %.pn25.pn.pn.pn40 = phi { ptr, i32 } [ %56, %.thread ], [ %.pn25.pn, %65 ], [ %57, %.thread41 ]
  call void @__cxa_free_exception(ptr %43) #7
  br label %67

67:                                               ; preds = %65, %66
  %.pn25.pn.pn.pn39 = phi { ptr, i32 } [ %.pn25.pn, %65 ], [ %.pn25.pn.pn.pn40, %66 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #7
  br label %68

68:                                               ; preds = %67, %54
  %.pn25.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn25.pn.pn.pn39, %67 ], [ %55, %54 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #7
  br label %80

69:                                               ; preds = %32, %21
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %13) #7
  %70 = call noundef i32 @_ZNKR4dali12UniqueHandleIiNS_9ShmHandleEEcviEv(ptr noundef nonnull align 4 dereferenceable(4) %14) #7
  %71 = load i64, ptr %0, align 8, !tbaa !5
  invoke void @_ZN4dali13MemoryMappingC1Eim(ptr noundef nonnull align 8 dereferenceable(16) %13, i32 noundef %70, i64 noundef %71)
          to label %72 unwind label %75

72:                                               ; preds = %69
  %73 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN4dali13MemoryMappingaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 8 dereferenceable(16) %13)
          to label %74 unwind label %77

74:                                               ; preds = %72
  call void @_ZN4dali12UniqueHandleINS_17MappedMemoryChunkENS_13MemoryMappingEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %13) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %13) #7
  ret void

75:                                               ; preds = %69
  %76 = landingpad { ptr, i32 }
          cleanup
  br label %79

77:                                               ; preds = %72
  %78 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN4dali12UniqueHandleINS_17MappedMemoryChunkENS_13MemoryMappingEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %13) #7
  br label %79

79:                                               ; preds = %77, %75
  %.pn33 = phi { ptr, i32 } [ %78, %77 ], [ %76, %75 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %13) #7
  br label %80

80:                                               ; preds = %79, %68, %53, %28
  %.pn33.pn = phi { ptr, i32 } [ %.pn33, %79 ], [ %.pn31, %28 ], [ %.pn25.pn.pn.pn.pn, %68 ], [ %.pn, %53 ]
  call void @_ZN4dali12UniqueHandleINS_17MappedMemoryChunkENS_13MemoryMappingEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %15) #7
  br label %81

81:                                               ; preds = %80, %22
  %.pn33.pn.pn = phi { ptr, i32 } [ %.pn33.pn, %80 ], [ %23, %22 ]
  call void @_ZN4dali12UniqueHandleIiNS_9ShmHandleEED2Ev(ptr noundef nonnull align 4 dereferenceable(4) %14) #7
  resume { ptr, i32 } %.pn33.pn.pn

82:                                               ; preds = %48
  unreachable
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN4dali9ShmHandleC2Ev(ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN4dali13MemoryMappingC2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #4 align 2

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

; Function Attrs: nounwind
declare i32 @ftruncate(i32 noundef, i64 noundef) local_unnamed_addr #6

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4dali11make_stringIJA9_cA30_cA10_cNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEA2_cA32_cEEES9_DpRKT_(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 1 dereferenceable(9), ptr noundef nonnull align 1 dereferenceable(30), ptr noundef nonnull align 1 dereferenceable(10), ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 1 dereferenceable(2), ptr noundef nonnull align 1 dereferenceable(32)) local_unnamed_addr #2

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

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

declare void @_ZN4dali13MemoryMappingC1Eim(ptr, i32, i64) local_unnamed_addr

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { mustprogress nofree nosync nounwind willreturn memory(none) "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 = { inlinehint 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 "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(none) }
attributes #9 = { noreturn }

!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 = !{!"_ZTSN4dali9SharedMemE", !7, i64 0, !10, i64 8, !13, i64 16}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN4dali9ShmHandleE", !11, i64 0}
!11 = !{!"_ZTSN4dali12UniqueHandleIiNS_9ShmHandleEEE", !12, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!"_ZTSN4dali13MemoryMappingE", !14, i64 0}
!14 = !{!"_ZTSN4dali12UniqueHandleINS_17MappedMemoryChunkENS_13MemoryMappingEEE", !15, i64 0}
!15 = !{!"_ZTSN4dali17MappedMemoryChunkE", !7, i64 0, !16, i64 8}
!16 = !{!"any pointer", !8, i64 0}
!17 = !{!12, !12, i64 0}


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