; LLVM IR from GPUOpen-LibrariesAndSDKs/TAN :: amf/public/common/DataStreamFile.ll (ZN3amf21AMFDataStreamFileImpl5WriteEPKvmPm)

; 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<wchar_t, std::char_traits<wchar_t>, amf::amf_allocator<wchar_t>>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, amf::amf_allocator<wchar_t>>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.amf::AMFDataStreamFileImpl" = type { %"class.amf::AMFInterfaceImpl", i32, %"class.std::__cxx11::basic_string" }
%"class.amf::AMFInterfaceImpl" = type { %"class.amf::AMFDataStream", %"class.amf::AMFInterfaceBase" }
%"class.amf::AMFDataStream" = type { %"class.amf::AMFInterface" }
%"class.amf::AMFInterface" = type { ptr }
%"class.amf::AMFInterfaceBase" = type { ptr, i64 }

@.str = external hidden unnamed_addr constant [24 x i32], align 4
@.str.2 = external hidden unnamed_addr constant [99 x i32], align 4
@.str.3 = external hidden unnamed_addr constant [22 x i32], align 4
@.str.4 = external hidden unnamed_addr constant [24 x i32], align 4

declare i32 @__gxx_personality_v0(...)

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

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN3amf18AMFCheckExpressionEi(i32 noundef) #2

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

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

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

declare void @AMFTraceW(ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) #4

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN3amf21AMFDataStreamFileImpl5WriteEPKvmPm(ptr noundef nonnull align 8 dereferenceable(64) %0, ptr noundef %1, i64 noundef %2, ptr noundef %3) unnamed_addr #5 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca %"class.std::__cxx11::basic_string", align 8
  %12 = alloca %"class.std::__cxx11::basic_string", align 8
  %13 = alloca %"class.std::__cxx11::basic_string", align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i64 %2, ptr %8, align 8, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !5
  %19 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %20 = getelementptr inbounds %"class.amf::AMFDataStreamFileImpl", ptr %19, i32 0, i32 1
  %21 = load i32, ptr %20, align 8, !tbaa !11
  %22 = icmp ne i32 %21, -1
  %23 = zext i1 %22 to i32
  store i32 %23, ptr %10, align 4, !tbaa !20
  %24 = load i32, ptr %10, align 4, !tbaa !20
  %25 = call noundef zeroext i1 @_ZN3amf18AMFCheckExpressionEi(i32 noundef %24)
  br i1 %25, label %46, label %26

26:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 32, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %12) #6
  %27 = load i32, ptr %10, align 4, !tbaa !20
  call void @_ZN3amf15AMFFormatAssertB5cxx11Ei(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %12, i32 noundef %27)
  call void @llvm.lifetime.start.p0(i64 32, ptr %13) #6
  invoke void (ptr, i32, ptr, ptr, ...) @_ZN3amf15__FormatMessageB5cxx11EiPKwS1_z(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %13, i32 noundef 0, ptr noundef @.str, ptr noundef @.str.4)
          to label %28 unwind label %32

28:                                               ; preds = %26
  invoke void @_ZStplIwSt11char_traitsIwEN3amf13amf_allocatorIwEEENSt7__cxx1112basic_stringIT_T0_T1_EEOSA_SB_(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %11, ptr noundef nonnull align 8 dereferenceable(32) %12, ptr noundef nonnull align 8 dereferenceable(32) %13)
          to label %29 unwind label %36

29:                                               ; preds = %28
  call void @_ZNSt7__cxx1112basic_stringIwSt11char_traitsIwEN3amf13amf_allocatorIwEEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #6
  call void @_ZNSt7__cxx1112basic_stringIwSt11char_traitsIwEN3amf13amf_allocatorIwEEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %12) #6
  %30 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIwSt11char_traitsIwEN3amf13amf_allocatorIwEEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %11) #6
  invoke void (ptr, i32, i32, ptr, i32, ptr, ...) @AMFTraceW(ptr noundef @.str.2, i32 noundef 117, i32 noundef 0, ptr noundef @.str.3, i32 noundef 0, ptr noundef %30)
          to label %31 unwind label %41

31:                                               ; preds = %29
  store i32 16, ptr %5, align 4
  store i32 1, ptr %16, align 4
  call void @_ZNSt7__cxx1112basic_stringIwSt11char_traitsIwEN3amf13amf_allocatorIwEEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #6
  br label %47

32:                                               ; preds = %26
  %33 = landingpad { ptr, i32 }
          cleanup
  %34 = extractvalue { ptr, i32 } %33, 0
  store ptr %34, ptr %14, align 8
  %35 = extractvalue { ptr, i32 } %33, 1
  store i32 %35, ptr %15, align 4
  br label %40

36:                                               ; preds = %28
  %37 = landingpad { ptr, i32 }
          cleanup
  %38 = extractvalue { ptr, i32 } %37, 0
  store ptr %38, ptr %14, align 8
  %39 = extractvalue { ptr, i32 } %37, 1
  store i32 %39, ptr %15, align 4
  call void @_ZNSt7__cxx1112basic_stringIwSt11char_traitsIwEN3amf13amf_allocatorIwEEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13) #6
  br label %40

40:                                               ; preds = %36, %32
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #6
  call void @_ZNSt7__cxx1112basic_stringIwSt11char_traitsIwEN3amf13amf_allocatorIwEEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %12) #6
  br label %45

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

45:                                               ; preds = %41, %40
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %74

46:                                               ; preds = %4
  store i32 0, ptr %16, align 4
  br label %47

47:                                               ; preds = %46, %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  %48 = load i32, ptr %16, align 4
  switch i32 %48, label %79 [
    i32 0, label %49
    i32 1, label %72
  ]

49:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  store i32 0, ptr %17, align 4, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %50 = getelementptr inbounds %"class.amf::AMFDataStreamFileImpl", ptr %19, i32 0, i32 1
  %51 = load i32, ptr %50, align 8, !tbaa !11
  %52 = load ptr, ptr %7, align 8, !tbaa !5
  %53 = load i64, ptr %8, align 8, !tbaa !9
  %54 = trunc i64 %53 to i32
  %55 = zext i32 %54 to i64
  %56 = call i64 @write(i32 noundef %51, ptr noundef %52, i64 noundef %55)
  %57 = trunc i64 %56 to i32
  store i32 %57, ptr %18, align 4, !tbaa !20
  %58 = load ptr, ptr %9, align 8, !tbaa !5
  %59 = icmp ne ptr %58, null
  br i1 %59, label %60, label %64

60:                                               ; preds = %49
  %61 = load i32, ptr %18, align 4, !tbaa !20
  %62 = zext i32 %61 to i64
  %63 = load ptr, ptr %9, align 8, !tbaa !5
  store i64 %62, ptr %63, align 8, !tbaa !9
  br label %64

64:                                               ; preds = %60, %49
  %65 = load i32, ptr %18, align 4, !tbaa !20
  %66 = zext i32 %65 to i64
  %67 = load i64, ptr %8, align 8, !tbaa !9
  %68 = icmp ne i64 %66, %67
  br i1 %68, label %69, label %70

69:                                               ; preds = %64
  store i32 1, ptr %17, align 4, !tbaa !21
  br label %70

70:                                               ; preds = %69, %64
  %71 = load i32, ptr %17, align 4, !tbaa !21
  store i32 %71, ptr %5, align 4
  store i32 1, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %72

72:                                               ; preds = %70, %47
  %73 = load i32, ptr %5, align 4
  ret i32 %73

74:                                               ; preds = %45
  %75 = load ptr, ptr %14, align 8
  %76 = load i32, ptr %15, align 4
  %77 = insertvalue { ptr, i32 } poison, ptr %75, 0
  %78 = insertvalue { ptr, i32 } %77, i32 %76, 1
  resume { ptr, i32 } %78

79:                                               ; preds = %47
  unreachable
}

declare i64 @write(i32 noundef, ptr noundef, i64 noundef) #4

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 = { 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 #3 = { 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 #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !17, i64 24}
!12 = !{!"_ZTSN3amf21AMFDataStreamFileImplE", !13, i64 0, !17, i64 24, !18, i64 32}
!13 = !{!"_ZTSN3amf16AMFInterfaceImplINS_13AMFDataStreamEiiiEE", !14, i64 0, !16, i64 8}
!14 = !{!"_ZTSN3amf13AMFDataStreamE", !15, i64 0}
!15 = !{!"_ZTSN3amf12AMFInterfaceE"}
!16 = !{!"_ZTSN3amf16AMFInterfaceBaseE", !10, i64 8}
!17 = !{!"int", !7, i64 0}
!18 = !{!"_ZTSNSt7__cxx1112basic_stringIwSt11char_traitsIwEN3amf13amf_allocatorIwEEEE", !19, i64 0, !10, i64 8, !7, i64 16}
!19 = !{!"_ZTSNSt7__cxx1112basic_stringIwSt11char_traitsIwEN3amf13amf_allocatorIwEEE12_Alloc_hiderE", !6, i64 0}
!20 = !{!17, !17, i64 0}
!21 = !{!22, !22, i64 0}
!22 = !{!"_ZTS10AMF_RESULT", !7, i64 0}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, amf::amf_allocator<wchar_t>>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, amf::amf_allocator<wchar_t>>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

@.str = external hidden unnamed_addr constant [24 x i32], align 4
@.str.2 = external hidden unnamed_addr constant [99 x i32], align 4
@.str.3 = external hidden unnamed_addr constant [22 x i32], align 4
@.str.4 = external hidden unnamed_addr constant [24 x i32], align 4

declare i32 @__gxx_personality_v0(...)

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

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN3amf18AMFCheckExpressionEi(i32 noundef) local_unnamed_addr #2

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

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

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

declare void @AMFTraceW(ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #4

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

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 17) i32 @_ZN3amf21AMFDataStreamFileImpl5WriteEPKvmPm(ptr nocapture noundef nonnull readonly align 8 dereferenceable(64) %0, ptr nocapture noundef readonly %1, i64 noundef %2, ptr noundef writeonly %3) unnamed_addr #5 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca %"class.std::__cxx11::basic_string", align 8
  %6 = alloca %"class.std::__cxx11::basic_string", align 8
  %7 = alloca %"class.std::__cxx11::basic_string", align 8
  %8 = getelementptr inbounds i8, ptr %0, i64 24
  %9 = load i32, ptr %8, align 8, !tbaa !5
  %10 = icmp ne i32 %9, -1
  %11 = zext i1 %10 to i32
  %12 = tail call noundef zeroext i1 @_ZN3amf18AMFCheckExpressionEi(i32 noundef %11)
  br i1 %12, label %26, label %13

13:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #7
  call void @_ZN3amf15AMFFormatAssertB5cxx11Ei(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %6, i32 noundef %11)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #7
  invoke void (ptr, i32, ptr, ptr, ...) @_ZN3amf15__FormatMessageB5cxx11EiPKwS1_z(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %7, i32 noundef 0, ptr noundef nonnull @.str, ptr noundef nonnull @.str.4)
          to label %14 unwind label %17

14:                                               ; preds = %13
  invoke void @_ZStplIwSt11char_traitsIwEN3amf13amf_allocatorIwEEENSt7__cxx1112basic_stringIT_T0_T1_EEOSA_SB_(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %5, ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef nonnull align 8 dereferenceable(32) %7)
          to label %15 unwind label %19

15:                                               ; preds = %14
  call void @_ZNSt7__cxx1112basic_stringIwSt11char_traitsIwEN3amf13amf_allocatorIwEEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #7
  call void @_ZNSt7__cxx1112basic_stringIwSt11char_traitsIwEN3amf13amf_allocatorIwEEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #7
  %16 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIwSt11char_traitsIwEN3amf13amf_allocatorIwEEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %5) #7
  invoke void (ptr, i32, i32, ptr, i32, ptr, ...) @AMFTraceW(ptr noundef nonnull @.str.2, i32 noundef 117, i32 noundef 0, ptr noundef nonnull @.str.3, i32 noundef 0, ptr noundef %16)
          to label %25 unwind label %22

17:                                               ; preds = %13
  %18 = landingpad { ptr, i32 }
          cleanup
  br label %21

19:                                               ; preds = %14
  %20 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIwSt11char_traitsIwEN3amf13amf_allocatorIwEEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #7
  br label %21

21:                                               ; preds = %19, %17
  %.pn = phi { ptr, i32 } [ %20, %19 ], [ %18, %17 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #7
  call void @_ZNSt7__cxx1112basic_stringIwSt11char_traitsIwEN3amf13amf_allocatorIwEEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #7
  br label %24

22:                                               ; preds = %15
  %23 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIwSt11char_traitsIwEN3amf13amf_allocatorIwEEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #7
  br label %24

24:                                               ; preds = %22, %21
  %.pn21 = phi { ptr, i32 } [ %23, %22 ], [ %.pn, %21 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #7
  resume { ptr, i32 } %.pn21

25:                                               ; preds = %15
  call void @_ZNSt7__cxx1112basic_stringIwSt11char_traitsIwEN3amf13amf_allocatorIwEEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #7
  br label %31

26:                                               ; preds = %4
  %27 = load i32, ptr %8, align 8, !tbaa !5
  %28 = and i64 %2, 4294967295
  %29 = tail call i64 @write(i32 noundef %27, ptr noundef %1, i64 noundef %28)
  %.not = icmp eq ptr %3, null
  %.pre = and i64 %29, 4294967295
  br i1 %.not, label %._crit_edge, label %30

30:                                               ; preds = %26
  store i64 %.pre, ptr %3, align 8, !tbaa !18
  br label %._crit_edge

._crit_edge:                                      ; preds = %26, %30
  %.not23 = icmp ne i64 %.pre, %2
  %spec.select = zext i1 %.not23 to i32
  br label %31

31:                                               ; preds = %25, %._crit_edge
  %.1 = phi i32 [ 16, %25 ], [ %spec.select, %._crit_edge ]
  ret i32 %.1
}

; Function Attrs: nofree
declare noundef i64 @write(i32 noundef, ptr nocapture noundef readonly, i64 noundef) local_unnamed_addr #6

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 = { 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 #3 = { 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 #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress 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 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !14, i64 24}
!6 = !{!"_ZTSN3amf21AMFDataStreamFileImplE", !7, i64 0, !14, i64 24, !15, i64 32}
!7 = !{!"_ZTSN3amf16AMFInterfaceImplINS_13AMFDataStreamEiiiEE", !8, i64 0, !10, i64 8}
!8 = !{!"_ZTSN3amf13AMFDataStreamE", !9, i64 0}
!9 = !{!"_ZTSN3amf12AMFInterfaceE"}
!10 = !{!"_ZTSN3amf16AMFInterfaceBaseE", !11, i64 8}
!11 = !{!"long", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C++ TBAA"}
!14 = !{!"int", !12, i64 0}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIwSt11char_traitsIwEN3amf13amf_allocatorIwEEEE", !16, i64 0, !11, i64 8, !12, i64 16}
!16 = !{!"_ZTSNSt7__cxx1112basic_stringIwSt11char_traitsIwEN3amf13amf_allocatorIwEEE12_Alloc_hiderE", !17, i64 0}
!17 = !{!"any pointer", !12, i64 0}
!18 = !{!11, !11, i64 0}


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