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

; 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 uwtable
define dso_local noundef i32 @_ZN4oboe10FifoBuffer4readEPvi(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef %1, i32 noundef %2) #2 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 ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = 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
  %18 = load ptr, ptr %5, align 8
  %19 = load i32, ptr %7, align 4, !tbaa !9
  %20 = icmp sle i32 %19, 0
  br i1 %20, label %21, label %22

21:                                               ; preds = %3
  store i32 0, ptr %4, align 4
  br label %106

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

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

56:                                               ; preds = %46
  store i32 -882, ptr %4, align 4
  store i32 1, ptr %15, align 4
  br label %83

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

76:                                               ; preds = %57
  store i32 -882, ptr %4, align 4
  store i32 1, ptr %15, align 4
  br label %82

77:                                               ; preds = %57
  %78 = load ptr, ptr %11, align 8, !tbaa !5
  %79 = load ptr, ptr %12, align 8, !tbaa !5
  %80 = load i32, ptr %14, align 4, !tbaa !9
  %81 = sext i32 %80 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %78, ptr align 1 %79, i64 %81, i1 false)
  store i32 0, ptr %15, align 4
  br label %82

82:                                               ; preds = %77, %76
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %83

83:                                               ; preds = %82, %56
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  %84 = load i32, ptr %15, align 4
  switch i32 %84, label %105 [
    i32 0, label %85
  ]

85:                                               ; preds = %83
  br label %100

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

91:                                               ; preds = %86
  store i32 -882, ptr %4, align 4
  store i32 1, ptr %15, align 4
  br label %97

92:                                               ; preds = %86
  %93 = load ptr, ptr %11, align 8, !tbaa !5
  %94 = load ptr, ptr %12, align 8, !tbaa !5
  %95 = load i32, ptr %17, align 4, !tbaa !9
  %96 = sext i32 %95 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %93, ptr align 1 %94, i64 %96, i1 false)
  store i32 0, ptr %15, align 4
  br label %97

97:                                               ; preds = %92, %91
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  %98 = load i32, ptr %15, align 4
  switch i32 %98, label %105 [
    i32 0, label %99
  ]

99:                                               ; preds = %97
  br label %100

100:                                              ; preds = %99, %85
  %101 = getelementptr inbounds %"class.oboe::FifoBuffer", ptr %18, i32 0, i32 3
  %102 = call noundef ptr @_ZNKSt10unique_ptrIN4oboe18FifoControllerBaseESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %101) #6
  %103 = load i32, ptr %8, align 4, !tbaa !9
  call void @_ZN4oboe18FifoControllerBase16advanceReadIndexEj(ptr noundef nonnull align 8 dereferenceable(12) %102, i32 noundef %103)
  %104 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %104, ptr %4, align 4
  store i32 1, ptr %15, align 4
  br label %105

105:                                              ; preds = %100, %97, %83
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, 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 %106

106:                                              ; preds = %105, %21
  %107 = load i32, ptr %4, align 4
  ret i32 %107
}

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

declare noundef i32 @_ZNK4oboe18FifoControllerBase22getFullFramesAvailableEv(ptr noundef nonnull align 8 dereferenceable(12)) #3

; 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)) #4

declare noundef i32 @_ZNK4oboe18FifoControllerBase12getReadIndexEv(ptr noundef nonnull align 8 dereferenceable(12)) #3

; 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) #5

declare void @_ZN4oboe18FifoControllerBase16advanceReadIndexEj(ptr noundef nonnull align 8 dereferenceable(12), i32 noundef) #3

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 = { 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 = { "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 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 uwtable
define dso_local noundef i32 @_ZN4oboe10FifoBuffer4readEPvi(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr nocapture noundef writeonly %1, i32 noundef %2) local_unnamed_addr #2 align 2 {
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = icmp slt i32 %2, 1
  br i1 %6, label %51, 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 @_ZNK4oboe18FifoControllerBase22getFullFramesAvailableEv(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 @_ZNK4oboe18FifoControllerBase12getReadIndexEv(ptr noundef nonnull align 8 dereferenceable(12) %13)
  %15 = getelementptr inbounds i8, ptr %0, i64 8
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  %17 = call noundef i32 @_ZN4oboe10FifoBuffer20convertFramesToBytesEi(ptr noundef nonnull align 8 dereferenceable(48) %0, i32 noundef %14)
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds i8, ptr %16, 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 %41

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 %1, ptr align 1 %19, i64 %32, i1 false)
  %33 = load ptr, ptr %15, align 8, !tbaa !9
  %34 = load i32, ptr %4, align 4, !tbaa !5
  %35 = sub i32 %34, %28
  %36 = call noundef i32 @_ZN4oboe10FifoBuffer20convertFramesToBytesEi(ptr noundef nonnull align 8 dereferenceable(48) %0, i32 noundef %35)
  %37 = icmp sgt i32 %36, -1
  br i1 %37, label %38, label %.critedge

38:                                               ; preds = %31
  %39 = getelementptr inbounds i8, ptr %1, i64 %32
  %40 = zext nneg i32 %36 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %39, ptr align 1 %33, i64 %40, i1 false)
  br label %47

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

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

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

.critedge:                                        ; preds = %41, %31, %25, %47
  %.3 = phi i32 [ %50, %47 ], [ -882, %25 ], [ -882, %31 ], [ -882, %41 ]
  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 %51

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

; 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

declare noundef i32 @_ZNK4oboe18FifoControllerBase22getFullFramesAvailableEv(ptr noundef nonnull align 8 dereferenceable(12)) local_unnamed_addr #3

; 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 #4

declare noundef i32 @_ZNK4oboe18FifoControllerBase12getReadIndexEv(ptr noundef nonnull align 8 dereferenceable(12)) local_unnamed_addr #3

; 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) #5

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

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 = { 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 = { "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 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 #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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