; LLVM IR from pdeljanov/Ayane :: src (Stage)

; 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::unique_lock" = type <{ ptr, i8, [7 x i8] }>
%"class.Ayane::Stage::Sink" = type <{ ptr, ptr, i32, [4 x i8], ptr, %"class.Ayane::BufferFormat", i8, [3 x i8] }>
%"class.Ayane::BufferFormat" = type { i32, i32, i32 }
%"class.Ayane::Stage::SourceSinkPrivate" = type { i32, %"class.Ayane::BufferQueue", %"class.std::mutex", %"class.std::condition_variable" }
%"class.Ayane::BufferQueue" = type { i32, %"struct.std::atomic", %"struct.std::atomic", %"class.std::vector" }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::unique_ptr<Ayane::Buffer, Ayane::ManagedBufferDeallocator>, std::allocator<std::unique_ptr<Ayane::Buffer, Ayane::ManagedBufferDeallocator>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::unique_ptr<Ayane::Buffer, Ayane::ManagedBufferDeallocator>, std::allocator<std::unique_ptr<Ayane::Buffer, Ayane::ManagedBufferDeallocator>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::unique_ptr<Ayane::Buffer, Ayane::ManagedBufferDeallocator>, std::allocator<std::unique_ptr<Ayane::Buffer, Ayane::ManagedBufferDeallocator>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::unique_ptr<Ayane::Buffer, Ayane::ManagedBufferDeallocator>, std::allocator<std::unique_ptr<Ayane::Buffer, Ayane::ManagedBufferDeallocator>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::mutex" = type { %"class.std::__mutex_base" }
%"class.std::__mutex_base" = type { %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::condition_variable" = type { %"class.std::__condvar" }
%"class.std::__condvar" = type { %union.pthread_cond_t }
%union.pthread_cond_t = type { %struct.__pthread_cond_s }
%struct.__pthread_cond_s = type { %union.__atomic_wide_counter, %union.__atomic_wide_counter, [2 x i32], [2 x i32], i32, i32, [2 x i32] }
%union.__atomic_wide_counter = type { i64 }
%"class.Ayane::Stage::Source" = type { ptr, ptr, %"class.std::unique_ptr.21" }
%"class.std::unique_ptr.21" = type { %"struct.std::__uniq_ptr_data.22" }
%"struct.std::__uniq_ptr_data.22" = type { %"class.std::__uniq_ptr_impl.23" }
%"class.std::__uniq_ptr_impl.23" = type { %"class.std::tuple.24" }
%"class.std::tuple.24" = type { %"struct.std::_Tuple_impl.25" }
%"struct.std::_Tuple_impl.25" = type { %"struct.std::_Head_base.28" }
%"struct.std::_Head_base.28" = type { ptr }
%"class.Ayane::StagePrivate" = type { ptr, %"class.std::mutex", i32, %"class.std::thread", i8, ptr, i32, ptr }
%"class.std::thread" = type { %"class.std::thread::id" }
%"class.std::thread::id" = type { i64 }

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

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN5Ayane5Stage4pullEPNS0_4SinkEPSt10unique_ptrINS_6BufferENS_24ManagedBufferDeallocatorEE(ptr noundef nonnull align 8 dereferenceable(128) %0, ptr noundef %1, ptr noundef %2) #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca %"class.std::unique_lock", align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %14 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  %16 = getelementptr inbounds %"class.Ayane::Stage::Sink", ptr %15, i32 0, i32 4
  %17 = load ptr, ptr %16, align 8, !tbaa !9
  store ptr %17, ptr %8, align 8, !tbaa !5
  %18 = load ptr, ptr %8, align 8, !tbaa !5
  %19 = getelementptr inbounds %"class.Ayane::Stage::SourceSinkPrivate", ptr %18, i32 0, i32 0
  %20 = load i32, ptr %19, align 8, !tbaa !15
  switch i32 %20, label %59 [
    i32 0, label %21
    i32 1, label %49
  ]

21:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #5
  %22 = load ptr, ptr %8, align 8, !tbaa !5
  %23 = getelementptr inbounds %"class.Ayane::Stage::SourceSinkPrivate", ptr %22, i32 0, i32 2
  call void @_ZNSt11unique_lockISt5mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(9) %9, ptr noundef nonnull align 8 dereferenceable(40) %23)
  br label %24

24:                                               ; preds = %44, %21
  %25 = load ptr, ptr %8, align 8, !tbaa !5
  %26 = getelementptr inbounds %"class.Ayane::Stage::SourceSinkPrivate", ptr %25, i32 0, i32 1
  %27 = invoke noundef zeroext i1 @_ZNK5Ayane11BufferQueue5emptyEv(ptr noundef nonnull align 8 dereferenceable(40) %26)
          to label %28 unwind label %40

28:                                               ; preds = %24
  br i1 %27, label %29, label %45

29:                                               ; preds = %28
  %30 = load ptr, ptr %8, align 8, !tbaa !5
  %31 = getelementptr inbounds %"class.Ayane::Stage::SourceSinkPrivate", ptr %30, i32 0, i32 3
  invoke void @_ZNSt18condition_variable4waitERSt11unique_lockISt5mutexE(ptr noundef nonnull align 8 dereferenceable(48) %31, ptr noundef nonnull align 8 dereferenceable(9) %9)
          to label %32 unwind label %40

32:                                               ; preds = %29
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = getelementptr inbounds %"class.Ayane::Stage::Sink", ptr %33, i32 0, i32 6
  %35 = load volatile i8, ptr %34, align 4, !tbaa !29, !range !30, !noundef !31
  %36 = trunc i8 %35 to i1
  br i1 %36, label %37, label %44

37:                                               ; preds = %32
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = getelementptr inbounds %"class.Ayane::Stage::Sink", ptr %38, i32 0, i32 6
  store volatile i8 0, ptr %39, align 4, !tbaa !29
  store i32 1, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %46

40:                                               ; preds = %29, %24
  %41 = landingpad { ptr, i32 }
          cleanup
  %42 = extractvalue { ptr, i32 } %41, 0
  store ptr %42, ptr %10, align 8
  %43 = extractvalue { ptr, i32 } %41, 1
  store i32 %43, ptr %11, align 4
  call void @_ZNSt11unique_lockISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %9) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %92

44:                                               ; preds = %32
  br label %24, !llvm.loop !32

45:                                               ; preds = %28
  store i32 0, ptr %12, align 4
  br label %46

46:                                               ; preds = %45, %37
  call void @_ZNSt11unique_lockISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %9) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #5
  %47 = load i32, ptr %12, align 4
  switch i32 %47, label %90 [
    i32 0, label %48
  ]

48:                                               ; preds = %46
  br label %49

49:                                               ; preds = %48, %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %50 = call noundef ptr @_ZN5Ayane5Stage7_d_funcEv(ptr noundef nonnull align 8 dereferenceable(128) %14)
  store ptr %50, ptr %13, align 8, !tbaa !5
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  %52 = getelementptr inbounds %"class.Ayane::Stage::Sink", ptr %51, i32 0, i32 1
  %53 = load ptr, ptr %52, align 8, !tbaa !34
  %54 = getelementptr inbounds %"class.Ayane::Stage::Source", ptr %53, i32 0, i32 0
  %55 = load ptr, ptr %54, align 8, !tbaa !35
  %56 = load ptr, ptr %13, align 8, !tbaa !5
  %57 = getelementptr inbounds %"class.Ayane::StagePrivate", ptr %56, i32 0, i32 5
  %58 = load ptr, ptr %57, align 8, !tbaa !43
  call void @_ZN5Ayane12StagePrivate15syncProcessLoopEPNS_5ClockE(ptr noundef nonnull align 8 dereferenceable(96) %55, ptr noundef %58)
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %59

59:                                               ; preds = %49, %3
  %60 = load ptr, ptr %8, align 8, !tbaa !5
  %61 = getelementptr inbounds %"class.Ayane::Stage::SourceSinkPrivate", ptr %60, i32 0, i32 1
  %62 = load ptr, ptr %7, align 8, !tbaa !5
  %63 = call noundef zeroext i1 @_ZN5Ayane11BufferQueue3popEPSt10unique_ptrINS_6BufferENS_24ManagedBufferDeallocatorEE(ptr noundef nonnull align 8 dereferenceable(40) %61, ptr noundef %62)
  br i1 %63, label %65, label %64

64:                                               ; preds = %59
  store i32 3, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %90

65:                                               ; preds = %59
  %66 = load ptr, ptr %7, align 8, !tbaa !5
  %67 = call noundef ptr @_ZNKSt10unique_ptrIN5Ayane6BufferENS0_24ManagedBufferDeallocatorEEptEv(ptr noundef nonnull align 8 dereferenceable(24) %66) #5
  %68 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNK5Ayane6Buffer6formatEv(ptr noundef nonnull align 8 dereferenceable(68) %67)
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  %70 = getelementptr inbounds %"class.Ayane::Stage::Sink", ptr %69, i32 0, i32 5
  %71 = call noundef zeroext i1 @_ZNK5Ayane12BufferFormatneERKS0_(ptr noundef nonnull align 4 dereferenceable(12) %68, ptr noundef nonnull align 4 dereferenceable(12) %70)
  br i1 %71, label %72, label %89

72:                                               ; preds = %65
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  %74 = load ptr, ptr %7, align 8, !tbaa !5
  %75 = call noundef ptr @_ZNKSt10unique_ptrIN5Ayane6BufferENS0_24ManagedBufferDeallocatorEEptEv(ptr noundef nonnull align 8 dereferenceable(24) %74) #5
  %76 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNK5Ayane6Buffer6formatEv(ptr noundef nonnull align 8 dereferenceable(68) %75)
  %77 = load ptr, ptr %14, align 8, !tbaa !49
  %78 = getelementptr inbounds ptr, ptr %77, i64 4
  %79 = load ptr, ptr %78, align 8
  %80 = call noundef zeroext i1 %79(ptr noundef nonnull align 8 dereferenceable(128) %14, ptr noundef nonnull align 8 dereferenceable(45) %73, ptr noundef nonnull align 4 dereferenceable(12) %76)
  br i1 %80, label %82, label %81

81:                                               ; preds = %72
  store i32 2, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %90

82:                                               ; preds = %72
  %83 = load ptr, ptr %7, align 8, !tbaa !5
  %84 = call noundef ptr @_ZNKSt10unique_ptrIN5Ayane6BufferENS0_24ManagedBufferDeallocatorEEptEv(ptr noundef nonnull align 8 dereferenceable(24) %83) #5
  %85 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNK5Ayane6Buffer6formatEv(ptr noundef nonnull align 8 dereferenceable(68) %84)
  %86 = load ptr, ptr %6, align 8, !tbaa !5
  %87 = getelementptr inbounds %"class.Ayane::Stage::Sink", ptr %86, i32 0, i32 5
  %88 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN5Ayane12BufferFormataSERKS0_(ptr noundef nonnull align 4 dereferenceable(12) %87, ptr noundef nonnull align 4 dereferenceable(12) %85)
  br label %89

89:                                               ; preds = %82, %65
  store i32 0, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %90

90:                                               ; preds = %89, %81, %64, %46
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  %91 = load i32, ptr %4, align 4
  ret i32 %91

92:                                               ; preds = %40
  %93 = load ptr, ptr %10, align 8
  %94 = load i32, ptr %11, align 4
  %95 = insertvalue { ptr, i32 } poison, ptr %93, 0
  %96 = insertvalue { ptr, i32 } %95, i32 %94, 1
  resume { ptr, i32 } %96
}

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

declare noundef zeroext i1 @_ZNK5Ayane11BufferQueue5emptyEv(ptr noundef nonnull align 8 dereferenceable(40)) #3

declare void @_ZNSt18condition_variable4waitERSt11unique_lockISt5mutexE(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(9)) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt11unique_lockISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(9)) unnamed_addr #4 align 2

declare noundef zeroext i1 @_ZN5Ayane11BufferQueue3popEPSt10unique_ptrINS_6BufferENS_24ManagedBufferDeallocatorEE(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef) #3

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

declare noundef nonnull align 4 dereferenceable(12) ptr @_ZNK5Ayane6Buffer6formatEv(ptr noundef nonnull align 8 dereferenceable(68)) #3

declare noundef zeroext i1 @_ZNK5Ayane12BufferFormatneERKS0_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #3

declare noundef nonnull align 4 dereferenceable(12) ptr @_ZN5Ayane12BufferFormataSERKS0_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { "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 = { 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 = { 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, !6, i64 24}
!10 = !{!"_ZTSN5Ayane5Stage4SinkE", !6, i64 0, !6, i64 8, !11, i64 16, !6, i64 24, !12, i64 32, !14, i64 44}
!11 = !{!"_ZTSN5Ayane5Stage4Sink14SchedulingModeE", !7, i64 0}
!12 = !{!"_ZTSN5Ayane12BufferFormatE", !13, i64 0, !13, i64 4, !13, i64 8}
!13 = !{!"int", !7, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{!16, !17, i64 0}
!16 = !{!"_ZTSN5Ayane5Stage17SourceSinkPrivateE", !17, i64 0, !18, i64 8, !25, i64 48, !27, i64 88}
!17 = !{!"_ZTSN5Ayane5Stage17SynchronicityModeE", !7, i64 0}
!18 = !{!"_ZTSN5Ayane11BufferQueueE", !13, i64 0, !19, i64 4, !19, i64 8, !21, i64 16}
!19 = !{!"_ZTSSt6atomicIjE", !20, i64 0}
!20 = !{!"_ZTSSt13__atomic_baseIjE", !13, i64 0}
!21 = !{!"_ZTSSt6vectorISt10unique_ptrIN5Ayane6BufferENS1_24ManagedBufferDeallocatorEESaIS4_EE", !22, i64 0}
!22 = !{!"_ZTSSt12_Vector_baseISt10unique_ptrIN5Ayane6BufferENS1_24ManagedBufferDeallocatorEESaIS4_EE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseISt10unique_ptrIN5Ayane6BufferENS1_24ManagedBufferDeallocatorEESaIS4_EE12_Vector_implE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseISt10unique_ptrIN5Ayane6BufferENS1_24ManagedBufferDeallocatorEESaIS4_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!25 = !{!"_ZTSSt5mutex", !26, i64 0}
!26 = !{!"_ZTSSt12__mutex_base", !7, i64 0}
!27 = !{!"_ZTSSt18condition_variable", !28, i64 0}
!28 = !{!"_ZTSSt9__condvar", !7, i64 0}
!29 = !{!10, !14, i64 44}
!30 = !{i8 0, i8 2}
!31 = !{}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}
!34 = !{!10, !6, i64 8}
!35 = !{!36, !6, i64 0}
!36 = !{!"_ZTSN5Ayane5Stage6SourceE", !6, i64 0, !6, i64 8, !37, i64 16}
!37 = !{!"_ZTSSt10unique_ptrIN5Ayane5Stage17SourceSinkPrivateESt14default_deleteIS2_EE", !38, i64 0}
!38 = !{!"_ZTSSt15__uniq_ptr_dataIN5Ayane5Stage17SourceSinkPrivateESt14default_deleteIS2_ELb1ELb1EE", !39, i64 0}
!39 = !{!"_ZTSSt15__uniq_ptr_implIN5Ayane5Stage17SourceSinkPrivateESt14default_deleteIS2_EE", !40, i64 0}
!40 = !{!"_ZTSSt5tupleIJPN5Ayane5Stage17SourceSinkPrivateESt14default_deleteIS2_EEE", !41, i64 0}
!41 = !{!"_ZTSSt11_Tuple_implILm0EJPN5Ayane5Stage17SourceSinkPrivateESt14default_deleteIS2_EEE", !42, i64 0}
!42 = !{!"_ZTSSt10_Head_baseILm0EPN5Ayane5Stage17SourceSinkPrivateELb0EE", !6, i64 0}
!43 = !{!44, !6, i64 72}
!44 = !{!"_ZTSN5Ayane12StagePrivateE", !6, i64 0, !25, i64 8, !45, i64 48, !46, i64 56, !14, i64 64, !6, i64 72, !13, i64 80, !6, i64 88}
!45 = !{!"_ZTSN5Ayane5Stage5StateE", !7, i64 0}
!46 = !{!"_ZTSSt6thread", !47, i64 0}
!47 = !{!"_ZTSNSt6thread2idE", !48, i64 0}
!48 = !{!"long", !7, i64 0}
!49 = !{!50, !50, i64 0}
!50 = !{!"vtable pointer", !8, 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::unique_lock" = type <{ ptr, i8, [7 x i8] }>

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

declare i32 @__gxx_personality_v0(...)

; 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 uwtable
declare dso_local void @_ZN5Ayane12StagePrivate15syncProcessLoopEPNS_5ClockE(ptr noundef nonnull align 8 dereferenceable(96), ptr noundef) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 4) i32 @_ZN5Ayane5Stage4pullEPNS0_4SinkEPSt10unique_ptrINS_6BufferENS_24ManagedBufferDeallocatorEE(ptr noundef nonnull align 8 dereferenceable(128) %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.std::unique_lock", align 8
  %5 = getelementptr inbounds i8, ptr %1, i64 24
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %7 = load i32, ptr %6, align 8, !tbaa !14
  switch i32 %7, label %30 [
    i32 0, label %8
    i32 1, label %23
  ]

8:                                                ; preds = %3
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #5
  %9 = getelementptr inbounds i8, ptr %6, i64 48
  call void @_ZNSt11unique_lockISt5mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(9) %4, ptr noundef nonnull align 8 dereferenceable(40) %9)
  %10 = getelementptr inbounds i8, ptr %6, i64 8
  %11 = getelementptr inbounds i8, ptr %6, i64 88
  %12 = getelementptr inbounds i8, ptr %1, i64 44
  br label %13

13:                                               ; preds = %17, %8
  %14 = invoke noundef zeroext i1 @_ZNK5Ayane11BufferQueue5emptyEv(ptr noundef nonnull align 8 dereferenceable(40) %10)
          to label %15 unwind label %21

15:                                               ; preds = %13
  br i1 %14, label %16, label %.critedge

16:                                               ; preds = %15
  invoke void @_ZNSt18condition_variable4waitERSt11unique_lockISt5mutexE(ptr noundef nonnull align 8 dereferenceable(48) %11, ptr noundef nonnull align 8 dereferenceable(9) %4)
          to label %17 unwind label %21

17:                                               ; preds = %16
  %18 = load volatile i8, ptr %12, align 4, !tbaa !28, !range !29, !noundef !30
  %19 = trunc nuw i8 %18 to i1
  br i1 %19, label %20, label %13, !llvm.loop !31

20:                                               ; preds = %17
  store volatile i8 0, ptr %12, align 4, !tbaa !28
  call void @_ZNSt11unique_lockISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %4) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #5
  br label %49

21:                                               ; preds = %16, %13
  %22 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt11unique_lockISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %4) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #5
  resume { ptr, i32 } %22

.critedge:                                        ; preds = %15
  call void @_ZNSt11unique_lockISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %4) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #5
  br label %23

23:                                               ; preds = %.critedge, %3
  %24 = call noundef ptr @_ZN5Ayane5Stage7_d_funcEv(ptr noundef nonnull align 8 dereferenceable(128) %0)
  %25 = getelementptr inbounds i8, ptr %1, i64 8
  %26 = load ptr, ptr %25, align 8, !tbaa !33
  %27 = load ptr, ptr %26, align 8, !tbaa !34
  %28 = getelementptr inbounds i8, ptr %24, i64 72
  %29 = load ptr, ptr %28, align 8, !tbaa !42
  call void @_ZN5Ayane12StagePrivate15syncProcessLoopEPNS_5ClockE(ptr noundef nonnull align 8 dereferenceable(96) %27, ptr noundef %29)
  br label %30

30:                                               ; preds = %23, %3
  %31 = getelementptr inbounds i8, ptr %6, i64 8
  %32 = call noundef zeroext i1 @_ZN5Ayane11BufferQueue3popEPSt10unique_ptrINS_6BufferENS_24ManagedBufferDeallocatorEE(ptr noundef nonnull align 8 dereferenceable(40) %31, ptr noundef %2)
  br i1 %32, label %33, label %49

33:                                               ; preds = %30
  %34 = call noundef ptr @_ZNKSt10unique_ptrIN5Ayane6BufferENS0_24ManagedBufferDeallocatorEEptEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #5
  %35 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNK5Ayane6Buffer6formatEv(ptr noundef nonnull align 8 dereferenceable(68) %34)
  %36 = getelementptr inbounds i8, ptr %1, i64 32
  %37 = call noundef zeroext i1 @_ZNK5Ayane12BufferFormatneERKS0_(ptr noundef nonnull align 4 dereferenceable(12) %35, ptr noundef nonnull align 4 dereferenceable(12) %36)
  br i1 %37, label %38, label %49

38:                                               ; preds = %33
  %39 = call noundef ptr @_ZNKSt10unique_ptrIN5Ayane6BufferENS0_24ManagedBufferDeallocatorEEptEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #5
  %40 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNK5Ayane6Buffer6formatEv(ptr noundef nonnull align 8 dereferenceable(68) %39)
  %41 = load ptr, ptr %0, align 8, !tbaa !48
  %42 = getelementptr inbounds i8, ptr %41, i64 32
  %43 = load ptr, ptr %42, align 8
  %44 = call noundef zeroext i1 %43(ptr noundef nonnull align 8 dereferenceable(128) %0, ptr noundef nonnull align 8 dereferenceable(45) %1, ptr noundef nonnull align 4 dereferenceable(12) %40)
  br i1 %44, label %45, label %49

45:                                               ; preds = %38
  %46 = call noundef ptr @_ZNKSt10unique_ptrIN5Ayane6BufferENS0_24ManagedBufferDeallocatorEEptEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #5
  %47 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNK5Ayane6Buffer6formatEv(ptr noundef nonnull align 8 dereferenceable(68) %46)
  %48 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN5Ayane12BufferFormataSERKS0_(ptr noundef nonnull align 4 dereferenceable(12) %36, ptr noundef nonnull align 4 dereferenceable(12) %47)
  br label %49

49:                                               ; preds = %20, %33, %45, %38, %30
  %.1 = phi i32 [ 1, %20 ], [ 3, %30 ], [ 2, %38 ], [ 0, %45 ], [ 0, %33 ]
  ret i32 %.1
}

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

declare noundef zeroext i1 @_ZNK5Ayane11BufferQueue5emptyEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #3

declare void @_ZNSt18condition_variable4waitERSt11unique_lockISt5mutexE(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(9)) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt11unique_lockISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(9)) unnamed_addr #4 align 2

declare noundef zeroext i1 @_ZN5Ayane11BufferQueue3popEPSt10unique_ptrINS_6BufferENS_24ManagedBufferDeallocatorEE(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef) local_unnamed_addr #3

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

declare noundef nonnull align 4 dereferenceable(12) ptr @_ZNK5Ayane6Buffer6formatEv(ptr noundef nonnull align 8 dereferenceable(68)) local_unnamed_addr #3

declare noundef zeroext i1 @_ZNK5Ayane12BufferFormatneERKS0_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #3

declare noundef nonnull align 4 dereferenceable(12) ptr @_ZN5Ayane12BufferFormataSERKS0_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { "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 = { 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 = { 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, !7, i64 24}
!6 = !{!"_ZTSN5Ayane5Stage4SinkE", !7, i64 0, !7, i64 8, !10, i64 16, !7, i64 24, !11, i64 32, !13, i64 44}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN5Ayane5Stage4Sink14SchedulingModeE", !8, i64 0}
!11 = !{!"_ZTSN5Ayane12BufferFormatE", !12, i64 0, !12, i64 4, !12, i64 8}
!12 = !{!"int", !8, i64 0}
!13 = !{!"bool", !8, i64 0}
!14 = !{!15, !16, i64 0}
!15 = !{!"_ZTSN5Ayane5Stage17SourceSinkPrivateE", !16, i64 0, !17, i64 8, !24, i64 48, !26, i64 88}
!16 = !{!"_ZTSN5Ayane5Stage17SynchronicityModeE", !8, i64 0}
!17 = !{!"_ZTSN5Ayane11BufferQueueE", !12, i64 0, !18, i64 4, !18, i64 8, !20, i64 16}
!18 = !{!"_ZTSSt6atomicIjE", !19, i64 0}
!19 = !{!"_ZTSSt13__atomic_baseIjE", !12, i64 0}
!20 = !{!"_ZTSSt6vectorISt10unique_ptrIN5Ayane6BufferENS1_24ManagedBufferDeallocatorEESaIS4_EE", !21, i64 0}
!21 = !{!"_ZTSSt12_Vector_baseISt10unique_ptrIN5Ayane6BufferENS1_24ManagedBufferDeallocatorEESaIS4_EE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseISt10unique_ptrIN5Ayane6BufferENS1_24ManagedBufferDeallocatorEESaIS4_EE12_Vector_implE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseISt10unique_ptrIN5Ayane6BufferENS1_24ManagedBufferDeallocatorEESaIS4_EE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!24 = !{!"_ZTSSt5mutex", !25, i64 0}
!25 = !{!"_ZTSSt12__mutex_base", !8, i64 0}
!26 = !{!"_ZTSSt18condition_variable", !27, i64 0}
!27 = !{!"_ZTSSt9__condvar", !8, i64 0}
!28 = !{!6, !13, i64 44}
!29 = !{i8 0, i8 2}
!30 = !{}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}
!33 = !{!6, !7, i64 8}
!34 = !{!35, !7, i64 0}
!35 = !{!"_ZTSN5Ayane5Stage6SourceE", !7, i64 0, !7, i64 8, !36, i64 16}
!36 = !{!"_ZTSSt10unique_ptrIN5Ayane5Stage17SourceSinkPrivateESt14default_deleteIS2_EE", !37, i64 0}
!37 = !{!"_ZTSSt15__uniq_ptr_dataIN5Ayane5Stage17SourceSinkPrivateESt14default_deleteIS2_ELb1ELb1EE", !38, i64 0}
!38 = !{!"_ZTSSt15__uniq_ptr_implIN5Ayane5Stage17SourceSinkPrivateESt14default_deleteIS2_EE", !39, i64 0}
!39 = !{!"_ZTSSt5tupleIJPN5Ayane5Stage17SourceSinkPrivateESt14default_deleteIS2_EEE", !40, i64 0}
!40 = !{!"_ZTSSt11_Tuple_implILm0EJPN5Ayane5Stage17SourceSinkPrivateESt14default_deleteIS2_EEE", !41, i64 0}
!41 = !{!"_ZTSSt10_Head_baseILm0EPN5Ayane5Stage17SourceSinkPrivateELb0EE", !7, i64 0}
!42 = !{!43, !7, i64 72}
!43 = !{!"_ZTSN5Ayane12StagePrivateE", !7, i64 0, !24, i64 8, !44, i64 48, !45, i64 56, !13, i64 64, !7, i64 72, !12, i64 80, !7, i64 88}
!44 = !{!"_ZTSN5Ayane5Stage5StateE", !8, i64 0}
!45 = !{!"_ZTSSt6thread", !46, i64 0}
!46 = !{!"_ZTSNSt6thread2idE", !47, i64 0}
!47 = !{!"long", !8, i64 0}
!48 = !{!49, !49, i64 0}
!49 = !{!"vtable pointer", !9, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,SROAPass,SimplifyCFGPass