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

; 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.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" }
%"class.dali::ShmHandle" = type { %"class.dali::UniqueHandle" }
%"class.dali::UniqueHandle" = type { i32 }

@.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
@_ZTISt11logic_error = external constant ptr
@.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.28 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [79 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [52 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 nounwind uwtable
declare dso_local noundef i32 @_ZNKR4dali12UniqueHandleIiNS_9ShmHandleEEcviEv(ptr noundef nonnull align 4 dereferenceable(4)) #0 align 2

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

declare void @_ZNSt11logic_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #6

; Function Attrs: nounwind
declare void @_ZNSt11logic_errorD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #7

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

; 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

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

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

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

27:                                               ; preds = %3
  %28 = getelementptr inbounds %"class.dali::SharedMem", ptr %21, i32 0, i32 1
  %29 = call noundef zeroext i1 @_ZNK4dali12UniqueHandleIiNS_9ShmHandleEEcvbEv(ptr noundef nonnull align 4 dereferenceable(4) %28) #8
  br i1 %29, label %37, label %30

30:                                               ; preds = %27
  %31 = call ptr @__cxa_allocate_exception(i64 16) #8
  invoke void @_ZNSt11logic_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %31, ptr noundef @.str.28)
          to label %32 unwind label %33

32:                                               ; preds = %30
  call void @__cxa_throw(ptr %31, ptr @_ZTISt11logic_error, ptr @_ZNSt11logic_errorD1Ev) #9
  unreachable

33:                                               ; preds = %30
  %34 = landingpad { ptr, i32 }
          cleanup
  %35 = extractvalue { ptr, i32 } %34, 0
  store ptr %35, ptr %7, align 8
  %36 = extractvalue { ptr, i32 } %34, 1
  store i32 %36, ptr %8, align 4
  call void @__cxa_free_exception(ptr %31) #8
  br label %132

37:                                               ; preds = %27
  br label %38

38:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  %39 = getelementptr inbounds %"class.dali::SharedMem", ptr %21, i32 0, i32 1
  %40 = call noundef i32 @_ZNKR4dali12UniqueHandleIiNS_9ShmHandleEEcviEv(ptr noundef nonnull align 4 dereferenceable(4) %39) #8
  %41 = getelementptr inbounds %"class.dali::SharedMem", ptr %21, i32 0, i32 0
  %42 = load i64, ptr %41, align 8, !tbaa !13
  %43 = call i32 @ftruncate(i32 noundef %40, i64 noundef %42) #8
  store i32 %43, ptr %9, align 4, !tbaa !23
  br label %44

44:                                               ; preds = %38
  %45 = load i32, ptr %9, align 4, !tbaa !23
  %46 = icmp eq i32 %45, -1
  br i1 %46, label %47, label %98

47:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #8
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #8
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEmcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %10, i64 noundef 256, i8 noundef signext 0, ptr noundef nonnull align 1 dereferenceable(1) %11)
          to label %48 unwind label %61

48:                                               ; preds = %47
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  %49 = call ptr @__errno_location() #10
  %50 = load i32, ptr %49, align 4, !tbaa !23
  store i32 %50, ptr %12, align 4, !tbaa !23
  %51 = load i32, ptr %12, align 4, !tbaa !23
  %52 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %10, i64 noundef 0)
          to label %53 unwind label %65

53:                                               ; preds = %48
  %54 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %10) #8
  call void @_ZN4dali15handle_strerrorEiPcm(i32 noundef %51, ptr noundef %52, i64 noundef %54)
  store i1 true, ptr %18, align 1
  %55 = call ptr @__cxa_allocate_exception(i64 80) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr %13) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr %14) #8
  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 %14, 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) %10, ptr noundef nonnull align 1 dereferenceable(2) @.str.3, ptr noundef nonnull align 1 dereferenceable(32) @.str.26)
          to label %56 unwind label %69

56:                                               ; preds = %53
  invoke void @_ZN4dali11make_stringIJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEES6_DpRKT_(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %13, ptr noundef nonnull align 8 dereferenceable(32) %14)
          to label %57 unwind label %73

57:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 1, ptr %16) #8
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %16) #8
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %15, ptr noundef @.str.29, ptr noundef nonnull align 1 dereferenceable(1) %16)
          to label %58 unwind label %77

58:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 32, ptr %17) #8
  invoke void @_ZN4dali13GetStacktraceB5cxx11Ev(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %17)
          to label %59 unwind label %81

59:                                               ; preds = %58
  invoke void @_ZN4dali13DALIExceptionC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_S8_(ptr noundef nonnull align 8 dereferenceable(80) %55, ptr noundef nonnull align 8 dereferenceable(32) %13, ptr noundef %15, ptr noundef nonnull align 8 dereferenceable(32) %17)
          to label %60 unwind label %85

60:                                               ; preds = %59
  store i1 false, ptr %18, align 1
  invoke void @__cxa_throw(ptr %55, ptr @_ZTIN4dali13DALIExceptionE, ptr @_ZN4dali13DALIExceptionD2Ev) #9
          to label %137 unwind label %85

61:                                               ; preds = %47
  %62 = landingpad { ptr, i32 }
          cleanup
  %63 = extractvalue { ptr, i32 } %62, 0
  store ptr %63, ptr %7, align 8
  %64 = extractvalue { ptr, i32 } %62, 1
  store i32 %64, ptr %8, align 4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #8
  br label %97

65:                                               ; preds = %48
  %66 = landingpad { ptr, i32 }
          cleanup
  %67 = extractvalue { ptr, i32 } %66, 0
  store ptr %67, ptr %7, align 8
  %68 = extractvalue { ptr, i32 } %66, 1
  store i32 %68, ptr %8, align 4
  br label %96

69:                                               ; preds = %53
  %70 = landingpad { ptr, i32 }
          cleanup
  %71 = extractvalue { ptr, i32 } %70, 0
  store ptr %71, ptr %7, align 8
  %72 = extractvalue { ptr, i32 } %70, 1
  store i32 %72, ptr %8, align 4
  br label %92

73:                                               ; preds = %56
  %74 = landingpad { ptr, i32 }
          cleanup
  %75 = extractvalue { ptr, i32 } %74, 0
  store ptr %75, ptr %7, align 8
  %76 = extractvalue { ptr, i32 } %74, 1
  store i32 %76, ptr %8, align 4
  br label %91

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

81:                                               ; preds = %58
  %82 = landingpad { ptr, i32 }
          cleanup
  %83 = extractvalue { ptr, i32 } %82, 0
  store ptr %83, ptr %7, align 8
  %84 = extractvalue { ptr, i32 } %82, 1
  store i32 %84, ptr %8, align 4
  br label %89

85:                                               ; preds = %60, %59
  %86 = landingpad { ptr, i32 }
          cleanup
  %87 = extractvalue { ptr, i32 } %86, 0
  store ptr %87, ptr %7, align 8
  %88 = extractvalue { ptr, i32 } %86, 1
  store i32 %88, ptr %8, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %17) #8
  br label %89

89:                                               ; preds = %85, %81
  call void @llvm.lifetime.end.p0(i64 32, ptr %17) #8
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %15) #8
  br label %90

90:                                               ; preds = %89, %77
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %16) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %16) #8
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13) #8
  br label %91

91:                                               ; preds = %90, %73
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %14) #8
  br label %92

92:                                               ; preds = %91, %69
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #8
  %93 = load i1, ptr %18, align 1
  br i1 %93, label %94, label %95

94:                                               ; preds = %92
  call void @__cxa_free_exception(ptr %55) #8
  br label %95

95:                                               ; preds = %94, %92
  br label %96

96:                                               ; preds = %95, %65
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #8
  br label %97

97:                                               ; preds = %96, %61
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %132

98:                                               ; preds = %44
  br label %99

99:                                               ; preds = %98
  br label %100

100:                                              ; preds = %99
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %101

101:                                              ; preds = %100
  br label %102

102:                                              ; preds = %101, %3
  %103 = getelementptr inbounds %"class.dali::SharedMem", ptr %21, i32 0, i32 2
  %104 = call noundef zeroext i1 @_ZNK4dali12UniqueHandleINS_17MappedMemoryChunkENS_13MemoryMappingEEcvbEv(ptr noundef nonnull align 8 dereferenceable(16) %103) #8
  br i1 %104, label %105, label %109

105:                                              ; preds = %102
  %106 = getelementptr inbounds %"class.dali::SharedMem", ptr %21, i32 0, i32 2
  %107 = getelementptr inbounds %"class.dali::SharedMem", ptr %21, i32 0, i32 0
  %108 = load i64, ptr %107, align 8, !tbaa !13
  call void @_ZN4dali13MemoryMapping6resizeEm(ptr noundef nonnull align 8 dereferenceable(16) %106, i64 noundef %108)
  br label %131

109:                                              ; preds = %102
  %110 = getelementptr inbounds %"class.dali::SharedMem", ptr %21, i32 0, i32 1
  %111 = call noundef zeroext i1 @_ZNK4dali12UniqueHandleIiNS_9ShmHandleEEcvbEv(ptr noundef nonnull align 4 dereferenceable(4) %110) #8
  br i1 %111, label %119, label %112

112:                                              ; preds = %109
  %113 = call ptr @__cxa_allocate_exception(i64 16) #8
  invoke void @_ZNSt11logic_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %113, ptr noundef @.str.30)
          to label %114 unwind label %115

114:                                              ; preds = %112
  call void @__cxa_throw(ptr %113, ptr @_ZTISt11logic_error, ptr @_ZNSt11logic_errorD1Ev) #9
  unreachable

115:                                              ; preds = %112
  %116 = landingpad { ptr, i32 }
          cleanup
  %117 = extractvalue { ptr, i32 } %116, 0
  store ptr %117, ptr %7, align 8
  %118 = extractvalue { ptr, i32 } %116, 1
  store i32 %118, ptr %8, align 4
  call void @__cxa_free_exception(ptr %113) #8
  br label %132

119:                                              ; preds = %109
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #8
  %120 = getelementptr inbounds %"class.dali::SharedMem", ptr %21, i32 0, i32 1
  %121 = call noundef i32 @_ZNKR4dali12UniqueHandleIiNS_9ShmHandleEEcviEv(ptr noundef nonnull align 4 dereferenceable(4) %120) #8
  %122 = getelementptr inbounds %"class.dali::SharedMem", ptr %21, i32 0, i32 0
  %123 = load i64, ptr %122, align 8, !tbaa !13
  call void @_ZN4dali13MemoryMappingC1Eim(ptr noundef nonnull align 8 dereferenceable(16) %19, i32 noundef %121, i64 noundef %123)
  %124 = getelementptr inbounds %"class.dali::SharedMem", ptr %21, i32 0, i32 2
  %125 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN4dali13MemoryMappingaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) %124, ptr noundef nonnull align 8 dereferenceable(16) %19)
          to label %126 unwind label %127

126:                                              ; preds = %119
  call void @_ZN4dali12UniqueHandleINS_17MappedMemoryChunkENS_13MemoryMappingEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %19) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #8
  br label %131

127:                                              ; preds = %119
  %128 = landingpad { ptr, i32 }
          cleanup
  %129 = extractvalue { ptr, i32 } %128, 0
  store ptr %129, ptr %7, align 8
  %130 = extractvalue { ptr, i32 } %128, 1
  store i32 %130, ptr %8, align 4
  call void @_ZN4dali12UniqueHandleINS_17MappedMemoryChunkENS_13MemoryMappingEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %19) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #8
  br label %132

131:                                              ; preds = %126, %105
  ret void

132:                                              ; preds = %127, %115, %97, %33
  %133 = load ptr, ptr %7, align 8
  %134 = load i32, ptr %8, align 4
  %135 = insertvalue { ptr, i32 } poison, ptr %133, 0
  %136 = insertvalue { ptr, i32 } %135, i32 %134, 1
  resume { ptr, i32 } %136

137:                                              ; preds = %60
  unreachable
}

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 = { "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 "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 }
attributes #9 = { noreturn }
attributes #10 = { nounwind willreturn memory(none) }

!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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!14, !10, i64 0}
!14 = !{!"_ZTSN4dali9SharedMemE", !10, i64 0, !15, i64 8, !18, i64 16}
!15 = !{!"_ZTSN4dali9ShmHandleE", !16, i64 0}
!16 = !{!"_ZTSN4dali12UniqueHandleIiNS_9ShmHandleEEE", !17, i64 0}
!17 = !{!"int", !7, i64 0}
!18 = !{!"_ZTSN4dali13MemoryMappingE", !19, i64 0}
!19 = !{!"_ZTSN4dali12UniqueHandleINS_17MappedMemoryChunkENS_13MemoryMappingEEE", !20, i64 0}
!20 = !{!"_ZTSN4dali17MappedMemoryChunkE", !10, i64 0, !6, i64 8}
!21 = !{i8 0, i8 2}
!22 = !{}
!23 = !{!17, !17, 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.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::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
@_ZTISt11logic_error = external constant ptr
@.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.28 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [79 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [52 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 nounwind uwtable
declare dso_local noundef i32 @_ZNKR4dali12UniqueHandleIiNS_9ShmHandleEEcviEv(ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 align 2

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

declare void @_ZNSt11logic_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #6

; Function Attrs: nounwind
declare void @_ZNSt11logic_errorD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #7

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

; 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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4dali9SharedMem6resizeEmb(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %1, i1 noundef zeroext %2) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.std::__cxx11::basic_string", align 8
  %5 = alloca %"class.std::allocator", align 1
  %6 = alloca %"class.std::__cxx11::basic_string", align 8
  %7 = alloca %"class.std::__cxx11::basic_string", align 8
  %8 = alloca %"class.std::__cxx11::basic_string", align 8
  %9 = alloca %"class.std::allocator", align 1
  %10 = alloca %"class.std::__cxx11::basic_string", align 8
  %11 = alloca %"class.dali::MemoryMapping", align 8
  store i64 %1, ptr %0, align 8, !tbaa !5
  br i1 %2, label %12, label %52

12:                                               ; preds = %3
  %13 = getelementptr inbounds i8, ptr %0, i64 8
  %14 = tail call noundef zeroext i1 @_ZNK4dali12UniqueHandleIiNS_9ShmHandleEEcvbEv(ptr noundef nonnull align 4 dereferenceable(4) %13) #8
  br i1 %14, label %20, label %15

15:                                               ; preds = %12
  %16 = tail call ptr @__cxa_allocate_exception(i64 16) #8
  invoke void @_ZNSt11logic_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef nonnull @.str.28)
          to label %17 unwind label %18

17:                                               ; preds = %15
  tail call void @__cxa_throw(ptr nonnull %16, ptr nonnull @_ZTISt11logic_error, ptr nonnull @_ZNSt11logic_errorD1Ev) #9
  unreachable

18:                                               ; preds = %15
  %19 = landingpad { ptr, i32 }
          cleanup
  tail call void @__cxa_free_exception(ptr %16) #8
  br label %73

20:                                               ; preds = %12
  %21 = tail call noundef i32 @_ZNKR4dali12UniqueHandleIiNS_9ShmHandleEEcviEv(ptr noundef nonnull align 4 dereferenceable(4) %13) #8
  %22 = load i64, ptr %0, align 8, !tbaa !5
  %23 = tail call i32 @ftruncate(i32 noundef %21, i64 noundef %22) #8
  %24 = icmp eq i32 %23, -1
  br i1 %24, label %25, label %52

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

26:                                               ; preds = %25
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #8
  %27 = tail call ptr @__errno_location() #10
  %28 = load i32, ptr %27, align 4, !tbaa !17
  %29 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %4, i64 noundef 0)
  %30 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %4) #8
  call void @_ZN4dali15handle_strerrorEiPcm(i32 noundef %28, ptr noundef nonnull %29, i64 noundef %30)
  %31 = call ptr @__cxa_allocate_exception(i64 80) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #8
  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 %7, 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) %4, ptr noundef nonnull align 1 dereferenceable(2) @.str.3, ptr noundef nonnull align 1 dereferenceable(32) @.str.26)
          to label %32 unwind label %.thread

32:                                               ; preds = %26
  invoke void @_ZN4dali11make_stringIJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEES6_DpRKT_(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %6, ptr noundef nonnull align 8 dereferenceable(32) %7)
          to label %33 unwind label %.thread28

33:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %9) #8
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #8
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef nonnull @.str.29, ptr noundef nonnull align 1 dereferenceable(1) %9)
          to label %34 unwind label %41

34:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %10) #8
  invoke void @_ZN4dali13GetStacktraceB5cxx11Ev(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %10)
          to label %35 unwind label %43

35:                                               ; preds = %34
  invoke void @_ZN4dali13DALIExceptionC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_S8_(ptr noundef nonnull align 8 dereferenceable(80) %31, ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef nonnull %8, ptr noundef nonnull align 8 dereferenceable(32) %10)
          to label %36 unwind label %45

36:                                               ; preds = %35
  invoke void @__cxa_throw(ptr nonnull %31, ptr nonnull @_ZTIN4dali13DALIExceptionE, ptr nonnull @_ZN4dali13DALIExceptionD2Ev) #9
          to label %74 unwind label %45

37:                                               ; preds = %25
  %38 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #8
  br label %51

.thread:                                          ; preds = %26
  %39 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #8
  br label %49

.thread28:                                        ; preds = %32
  %40 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #8
  br label %49

41:                                               ; preds = %33
  %42 = landingpad { ptr, i32 }
          cleanup
  br label %48

43:                                               ; preds = %34
  %44 = landingpad { ptr, i32 }
          cleanup
  br label %47

45:                                               ; preds = %36, %35
  %.0 = phi i1 [ false, %36 ], [ true, %35 ]
  %46 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #8
  br label %47

47:                                               ; preds = %45, %43
  %.pn = phi { ptr, i32 } [ %46, %45 ], [ %44, %43 ]
  %.1 = phi i1 [ %.0, %45 ], [ true, %43 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %10) #8
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #8
  br label %48

48:                                               ; preds = %41, %47
  %.pn.pn = phi { ptr, i32 } [ %.pn, %47 ], [ %42, %41 ]
  %.2 = phi i1 [ %.1, %47 ], [ true, %41 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %9) #8
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #8
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #8
  br i1 %.2, label %49, label %50

49:                                               ; preds = %.thread28, %.thread, %48
  %.pn.pn.pn.pn27 = phi { ptr, i32 } [ %39, %.thread ], [ %.pn.pn, %48 ], [ %40, %.thread28 ]
  call void @__cxa_free_exception(ptr %31) #8
  br label %50

50:                                               ; preds = %48, %49
  %.pn.pn.pn.pn26 = phi { ptr, i32 } [ %.pn.pn, %48 ], [ %.pn.pn.pn.pn27, %49 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #8
  br label %51

51:                                               ; preds = %50, %37
  %.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn.pn26, %50 ], [ %38, %37 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #8
  br label %73

52:                                               ; preds = %20, %3
  %53 = getelementptr inbounds i8, ptr %0, i64 16
  %54 = tail call noundef zeroext i1 @_ZNK4dali12UniqueHandleINS_17MappedMemoryChunkENS_13MemoryMappingEEcvbEv(ptr noundef nonnull align 8 dereferenceable(16) %53) #8
  br i1 %54, label %55, label %57

55:                                               ; preds = %52
  %56 = load i64, ptr %0, align 8, !tbaa !5
  tail call void @_ZN4dali13MemoryMapping6resizeEm(ptr noundef nonnull align 8 dereferenceable(16) %53, i64 noundef %56)
  br label %72

57:                                               ; preds = %52
  %58 = getelementptr inbounds i8, ptr %0, i64 8
  %59 = tail call noundef zeroext i1 @_ZNK4dali12UniqueHandleIiNS_9ShmHandleEEcvbEv(ptr noundef nonnull align 4 dereferenceable(4) %58) #8
  br i1 %59, label %65, label %60

60:                                               ; preds = %57
  %61 = tail call ptr @__cxa_allocate_exception(i64 16) #8
  invoke void @_ZNSt11logic_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %61, ptr noundef nonnull @.str.30)
          to label %62 unwind label %63

62:                                               ; preds = %60
  tail call void @__cxa_throw(ptr nonnull %61, ptr nonnull @_ZTISt11logic_error, ptr nonnull @_ZNSt11logic_errorD1Ev) #9
  unreachable

63:                                               ; preds = %60
  %64 = landingpad { ptr, i32 }
          cleanup
  tail call void @__cxa_free_exception(ptr %61) #8
  br label %73

65:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %11) #8
  %66 = tail call noundef i32 @_ZNKR4dali12UniqueHandleIiNS_9ShmHandleEEcviEv(ptr noundef nonnull align 4 dereferenceable(4) %58) #8
  %67 = load i64, ptr %0, align 8, !tbaa !5
  call void @_ZN4dali13MemoryMappingC1Eim(ptr noundef nonnull align 8 dereferenceable(16) %11, i32 noundef %66, i64 noundef %67)
  %68 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN4dali13MemoryMappingaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) %53, ptr noundef nonnull align 8 dereferenceable(16) %11)
          to label %69 unwind label %70

69:                                               ; preds = %65
  call void @_ZN4dali12UniqueHandleINS_17MappedMemoryChunkENS_13MemoryMappingEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %11) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %11) #8
  br label %72

70:                                               ; preds = %65
  %71 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN4dali12UniqueHandleINS_17MappedMemoryChunkENS_13MemoryMappingEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %11) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %11) #8
  br label %73

72:                                               ; preds = %69, %55
  ret void

73:                                               ; preds = %70, %63, %51, %18
  %.pn.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn.pn.pn, %51 ], [ %71, %70 ], [ %64, %63 ], [ %19, %18 ]
  resume { ptr, i32 } %.pn.pn.pn.pn.pn.pn

74:                                               ; preds = %36
  unreachable
}

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 = { "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 "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 }
attributes #9 = { noreturn }
attributes #10 = { nounwind willreturn memory(none) }

!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