; LLVM IR from kdrag0n/fxdsp :: external/oboe/src/fifo/FifoBuffer.ll (ZN4oboe10FifoBuffer5writeEPKvi)

; 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.oboe::FifoBuffer" = type { i32, ptr, i8, %"class.std::unique_ptr", i64, i64 }
%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Head_base.1" }
%"struct.std::_Head_base.1" = type { ptr }

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4oboe10FifoBuffer20convertFramesToBytesEi(ptr noundef nonnull align 8 dereferenceable(48), i32 noundef) #1 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4oboe18FifoControllerBase16getFrameCapacityEv(ptr noundef nonnull align 8 dereferenceable(12)) #1 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN4oboe10FifoBuffer5writeEPKvi(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef %1, i32 noundef %2) #4 align 2 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  %19 = load ptr, ptr %5, align 8
  %20 = load i32, ptr %7, align 4, !tbaa !9
  %21 = icmp sle i32 %20, 0
  br i1 %21, label %22, label %23

22:                                               ; preds = %3
  store i32 0, ptr %4, align 4
  br label %109

23:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %24 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %24, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %25 = getelementptr inbounds %"class.oboe::FifoBuffer", ptr %19, i32 0, i32 3
  %26 = call noundef ptr @_ZNKSt10unique_ptrIN4oboe18FifoControllerBaseESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %25) #6
  %27 = call noundef i32 @_ZNK4oboe18FifoControllerBase23getEmptyFramesAvailableEv(ptr noundef nonnull align 8 dereferenceable(12) %26)
  store i32 %27, ptr %9, align 4, !tbaa !9
  %28 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIjERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %29 = load i32, ptr %28, align 4, !tbaa !9
  store i32 %29, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %30 = getelementptr inbounds %"class.oboe::FifoBuffer", ptr %19, i32 0, i32 3
  %31 = call noundef ptr @_ZNKSt10unique_ptrIN4oboe18FifoControllerBaseESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %30) #6
  %32 = call noundef i32 @_ZNK4oboe18FifoControllerBase13getWriteIndexEv(ptr noundef nonnull align 8 dereferenceable(12) %31)
  store i32 %32, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %33 = load i32, ptr %10, align 4, !tbaa !9
  %34 = call noundef i32 @_ZN4oboe10FifoBuffer20convertFramesToBytesEi(ptr noundef nonnull align 8 dereferenceable(48) %19, i32 noundef %33)
  store i32 %34, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %35, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %36 = getelementptr inbounds %"class.oboe::FifoBuffer", ptr %19, i32 0, i32 1
  %37 = load ptr, ptr %36, align 8, !tbaa !11
  %38 = load i32, ptr %11, align 4, !tbaa !9
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds i8, ptr %37, i64 %39
  store ptr %40, ptr %13, align 8, !tbaa !5
  %41 = load i32, ptr %10, align 4, !tbaa !9
  %42 = load i32, ptr %8, align 4, !tbaa !9
  %43 = add i32 %41, %42
  %44 = getelementptr inbounds %"class.oboe::FifoBuffer", ptr %19, i32 0, i32 3
  %45 = call noundef ptr @_ZNKSt10unique_ptrIN4oboe18FifoControllerBaseESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %44) #6
  %46 = call noundef i32 @_ZNK4oboe18FifoControllerBase16getFrameCapacityEv(ptr noundef nonnull align 8 dereferenceable(12) %45)
  %47 = icmp ugt i32 %43, %46
  br i1 %47, label %48, label %89

48:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %49 = getelementptr inbounds %"class.oboe::FifoBuffer", ptr %19, i32 0, i32 3
  %50 = call noundef ptr @_ZNKSt10unique_ptrIN4oboe18FifoControllerBaseESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %49) #6
  %51 = call noundef i32 @_ZNK4oboe18FifoControllerBase16getFrameCapacityEv(ptr noundef nonnull align 8 dereferenceable(12) %50)
  %52 = load i32, ptr %10, align 4, !tbaa !9
  %53 = sub i32 %51, %52
  store i32 %53, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %54 = load i32, ptr %14, align 4, !tbaa !9
  %55 = call noundef i32 @_ZN4oboe10FifoBuffer20convertFramesToBytesEi(ptr noundef nonnull align 8 dereferenceable(48) %19, i32 noundef %54)
  store i32 %55, ptr %15, align 4, !tbaa !9
  %56 = load i32, ptr %15, align 4, !tbaa !9
  %57 = icmp slt i32 %56, 0
  br i1 %57, label %58, label %59

58:                                               ; preds = %48
  store i32 -882, ptr %4, align 4
  store i32 1, ptr %16, align 4
  br label %86

59:                                               ; preds = %48
  %60 = load ptr, ptr %13, align 8, !tbaa !5
  %61 = load ptr, ptr %12, align 8, !tbaa !5
  %62 = load i32, ptr %15, align 4, !tbaa !9
  %63 = sext i32 %62 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %60, ptr align 1 %61, i64 %63, i1 false)
  %64 = load i32, ptr %14, align 4, !tbaa !9
  %65 = call noundef i32 @_ZN4oboe10FifoBuffer20convertFramesToBytesEi(ptr noundef nonnull align 8 dereferenceable(48) %19, i32 noundef %64)
  %66 = load ptr, ptr %12, align 8, !tbaa !5
  %67 = sext i32 %65 to i64
  %68 = getelementptr inbounds i8, ptr %66, i64 %67
  store ptr %68, ptr %12, align 8, !tbaa !5
  %69 = getelementptr inbounds %"class.oboe::FifoBuffer", ptr %19, i32 0, i32 1
  %70 = load ptr, ptr %69, align 8, !tbaa !11
  %71 = getelementptr inbounds i8, ptr %70, i64 0
  store ptr %71, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  %72 = load i32, ptr %8, align 4, !tbaa !9
  %73 = load i32, ptr %14, align 4, !tbaa !9
  %74 = sub i32 %72, %73
  store i32 %74, ptr %17, align 4, !tbaa !9
  %75 = load i32, ptr %17, align 4, !tbaa !9
  %76 = call noundef i32 @_ZN4oboe10FifoBuffer20convertFramesToBytesEi(ptr noundef nonnull align 8 dereferenceable(48) %19, i32 noundef %75)
  store i32 %76, ptr %15, align 4, !tbaa !9
  %77 = load i32, ptr %15, align 4, !tbaa !9
  %78 = icmp slt i32 %77, 0
  br i1 %78, label %79, label %80

79:                                               ; preds = %59
  store i32 -882, ptr %4, align 4
  store i32 1, ptr %16, align 4
  br label %85

80:                                               ; preds = %59
  %81 = load ptr, ptr %13, align 8, !tbaa !5
  %82 = load ptr, ptr %12, align 8, !tbaa !5
  %83 = load i32, ptr %15, align 4, !tbaa !9
  %84 = sext i32 %83 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %81, ptr align 1 %82, i64 %84, i1 false)
  store i32 0, ptr %16, align 4
  br label %85

85:                                               ; preds = %80, %79
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %86

86:                                               ; preds = %85, %58
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  %87 = load i32, ptr %16, align 4
  switch i32 %87, label %108 [
    i32 0, label %88
  ]

88:                                               ; preds = %86
  br label %103

89:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %90 = load i32, ptr %8, align 4, !tbaa !9
  %91 = call noundef i32 @_ZN4oboe10FifoBuffer20convertFramesToBytesEi(ptr noundef nonnull align 8 dereferenceable(48) %19, i32 noundef %90)
  store i32 %91, ptr %18, align 4, !tbaa !9
  %92 = load i32, ptr %18, align 4, !tbaa !9
  %93 = icmp slt i32 %92, 0
  br i1 %93, label %94, label %95

94:                                               ; preds = %89
  store i32 -882, ptr %4, align 4
  store i32 1, ptr %16, align 4
  br label %100

95:                                               ; preds = %89
  %96 = load ptr, ptr %13, align 8, !tbaa !5
  %97 = load ptr, ptr %12, align 8, !tbaa !5
  %98 = load i32, ptr %18, align 4, !tbaa !9
  %99 = sext i32 %98 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %96, ptr align 1 %97, i64 %99, i1 false)
  store i32 0, ptr %16, align 4
  br label %100

100:                                              ; preds = %95, %94
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  %101 = load i32, ptr %16, align 4
  switch i32 %101, label %108 [
    i32 0, label %102
  ]

102:                                              ; preds = %100
  br label %103

103:                                              ; preds = %102, %88
  %104 = getelementptr inbounds %"class.oboe::FifoBuffer", ptr %19, i32 0, i32 3
  %105 = call noundef ptr @_ZNKSt10unique_ptrIN4oboe18FifoControllerBaseESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %104) #6
  %106 = load i32, ptr %8, align 4, !tbaa !9
  call void @_ZN4oboe18FifoControllerBase17advanceWriteIndexEj(ptr noundef nonnull align 8 dereferenceable(12) %105, i32 noundef %106)
  %107 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %107, ptr %4, align 4
  store i32 1, ptr %16, align 4
  br label %108

108:                                              ; preds = %103, %100, %86
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %109

109:                                              ; preds = %108, %22
  %110 = load i32, ptr %4, align 4
  ret i32 %110
}

declare noundef i32 @_ZNK4oboe18FifoControllerBase23getEmptyFramesAvailableEv(ptr noundef nonnull align 8 dereferenceable(12)) #5

declare noundef i32 @_ZNK4oboe18FifoControllerBase13getWriteIndexEv(ptr noundef nonnull align 8 dereferenceable(12)) #5

declare void @_ZN4oboe18FifoControllerBase17advanceWriteIndexEj(ptr noundef nonnull align 8 dereferenceable(12), i32 noundef) #5

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 8}
!12 = !{!"_ZTSN4oboe10FifoBufferE", !10, i64 0, !6, i64 8, !13, i64 16, !14, i64 24, !20, i64 32, !20, i64 40}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"_ZTSSt10unique_ptrIN4oboe18FifoControllerBaseESt14default_deleteIS1_EE", !15, i64 0}
!15 = !{!"_ZTSSt15__uniq_ptr_dataIN4oboe18FifoControllerBaseESt14default_deleteIS1_ELb1ELb1EE", !16, i64 0}
!16 = !{!"_ZTSSt15__uniq_ptr_implIN4oboe18FifoControllerBaseESt14default_deleteIS1_EE", !17, i64 0}
!17 = !{!"_ZTSSt5tupleIJPN4oboe18FifoControllerBaseESt14default_deleteIS1_EEE", !18, i64 0}
!18 = !{!"_ZTSSt11_Tuple_implILm0EJPN4oboe18FifoControllerBaseESt14default_deleteIS1_EEE", !19, i64 0}
!19 = !{!"_ZTSSt10_Head_baseILm0EPN4oboe18FifoControllerBaseELb0EE", !6, i64 0}
!20 = !{!"long", !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"

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4oboe10FifoBuffer20convertFramesToBytesEi(ptr noundef nonnull align 8 dereferenceable(48), i32 noundef) local_unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4oboe18FifoControllerBase16getFrameCapacityEv(ptr noundef nonnull align 8 dereferenceable(12)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN4oboe10FifoBuffer5writeEPKvi(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr nocapture noundef readonly %1, i32 noundef %2) local_unnamed_addr #4 align 2 {
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = icmp slt i32 %2, 1
  br i1 %6, label %53, label %7

7:                                                ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  store i32 %2, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  %8 = getelementptr inbounds i8, ptr %0, i64 24
  %9 = tail call noundef ptr @_ZNKSt10unique_ptrIN4oboe18FifoControllerBaseESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  %10 = tail call noundef i32 @_ZNK4oboe18FifoControllerBase23getEmptyFramesAvailableEv(ptr noundef nonnull align 8 dereferenceable(12) %9)
  store i32 %10, ptr %5, align 4, !tbaa !5
  %11 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIjERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %12 = load i32, ptr %11, align 4, !tbaa !5
  store i32 %12, ptr %4, align 4, !tbaa !5
  %13 = call noundef ptr @_ZNKSt10unique_ptrIN4oboe18FifoControllerBaseESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  %14 = call noundef i32 @_ZNK4oboe18FifoControllerBase13getWriteIndexEv(ptr noundef nonnull align 8 dereferenceable(12) %13)
  %15 = call noundef i32 @_ZN4oboe10FifoBuffer20convertFramesToBytesEi(ptr noundef nonnull align 8 dereferenceable(48) %0, i32 noundef %14)
  %16 = getelementptr inbounds i8, ptr %0, i64 8
  %17 = load ptr, ptr %16, align 8, !tbaa !9
  %18 = sext i32 %15 to i64
  %19 = getelementptr inbounds i8, ptr %17, i64 %18
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = add i32 %20, %14
  %22 = call noundef ptr @_ZNKSt10unique_ptrIN4oboe18FifoControllerBaseESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  %23 = call noundef i32 @_ZNK4oboe18FifoControllerBase16getFrameCapacityEv(ptr noundef nonnull align 8 dereferenceable(12) %22)
  %24 = icmp ugt i32 %21, %23
  br i1 %24, label %25, label %43

25:                                               ; preds = %7
  %26 = call noundef ptr @_ZNKSt10unique_ptrIN4oboe18FifoControllerBaseESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  %27 = call noundef i32 @_ZNK4oboe18FifoControllerBase16getFrameCapacityEv(ptr noundef nonnull align 8 dereferenceable(12) %26)
  %28 = sub i32 %27, %14
  %29 = call noundef i32 @_ZN4oboe10FifoBuffer20convertFramesToBytesEi(ptr noundef nonnull align 8 dereferenceable(48) %0, i32 noundef %28)
  %30 = icmp slt i32 %29, 0
  br i1 %30, label %.critedge, label %31

31:                                               ; preds = %25
  %32 = zext nneg i32 %29 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %19, ptr align 1 %1, i64 %32, i1 false)
  %33 = call noundef i32 @_ZN4oboe10FifoBuffer20convertFramesToBytesEi(ptr noundef nonnull align 8 dereferenceable(48) %0, i32 noundef %28)
  %34 = load ptr, ptr %16, align 8, !tbaa !9
  %35 = load i32, ptr %4, align 4, !tbaa !5
  %36 = sub i32 %35, %28
  %37 = call noundef i32 @_ZN4oboe10FifoBuffer20convertFramesToBytesEi(ptr noundef nonnull align 8 dereferenceable(48) %0, i32 noundef %36)
  %38 = icmp sgt i32 %37, -1
  br i1 %38, label %39, label %.critedge

39:                                               ; preds = %31
  %40 = sext i32 %33 to i64
  %41 = getelementptr inbounds i8, ptr %1, i64 %40
  %42 = zext nneg i32 %37 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %34, ptr align 1 %41, i64 %42, i1 false)
  br label %49

43:                                               ; preds = %7
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = call noundef i32 @_ZN4oboe10FifoBuffer20convertFramesToBytesEi(ptr noundef nonnull align 8 dereferenceable(48) %0, i32 noundef %44)
  %46 = icmp sgt i32 %45, -1
  br i1 %46, label %47, label %.critedge

47:                                               ; preds = %43
  %48 = zext nneg i32 %45 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %19, ptr align 1 %1, i64 %48, i1 false)
  br label %49

49:                                               ; preds = %47, %39
  %50 = call noundef ptr @_ZNKSt10unique_ptrIN4oboe18FifoControllerBaseESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  %51 = load i32, ptr %4, align 4, !tbaa !5
  call void @_ZN4oboe18FifoControllerBase17advanceWriteIndexEj(ptr noundef nonnull align 8 dereferenceable(12) %50, i32 noundef %51)
  %52 = load i32, ptr %4, align 4, !tbaa !5
  br label %.critedge

.critedge:                                        ; preds = %43, %31, %25, %49
  %.3 = phi i32 [ %52, %49 ], [ -882, %25 ], [ -882, %31 ], [ -882, %43 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  br label %53

53:                                               ; preds = %3, %.critedge
  %.4 = phi i32 [ %.3, %.critedge ], [ 0, %3 ]
  ret i32 %.4
}

declare noundef i32 @_ZNK4oboe18FifoControllerBase23getEmptyFramesAvailableEv(ptr noundef nonnull align 8 dereferenceable(12)) local_unnamed_addr #5

declare noundef i32 @_ZNK4oboe18FifoControllerBase13getWriteIndexEv(ptr noundef nonnull align 8 dereferenceable(12)) local_unnamed_addr #5

declare void @_ZN4oboe18FifoControllerBase17advanceWriteIndexEj(ptr noundef nonnull align 8 dereferenceable(12), i32 noundef) local_unnamed_addr #5

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 = { "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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 8}
!10 = !{!"_ZTSN4oboe10FifoBufferE", !6, i64 0, !11, i64 8, !12, i64 16, !13, i64 24, !19, i64 32, !19, i64 40}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!"_ZTSSt10unique_ptrIN4oboe18FifoControllerBaseESt14default_deleteIS1_EE", !14, i64 0}
!14 = !{!"_ZTSSt15__uniq_ptr_dataIN4oboe18FifoControllerBaseESt14default_deleteIS1_ELb1ELb1EE", !15, i64 0}
!15 = !{!"_ZTSSt15__uniq_ptr_implIN4oboe18FifoControllerBaseESt14default_deleteIS1_EE", !16, i64 0}
!16 = !{!"_ZTSSt5tupleIJPN4oboe18FifoControllerBaseESt14default_deleteIS1_EEE", !17, i64 0}
!17 = !{!"_ZTSSt11_Tuple_implILm0EJPN4oboe18FifoControllerBaseESt14default_deleteIS1_EEE", !18, i64 0}
!18 = !{!"_ZTSSt10_Head_baseILm0EPN4oboe18FifoControllerBaseELb0EE", !11, i64 0}
!19 = !{!"long", !7, i64 0}


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