; LLVM IR from clangen/musikcube :: src/plugins/ffmpegdecoder (FfmpegDecoder)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator.5" = type { i8 }
%class.FfmpegDecoder = type <{ %"class.musik::core::sdk::IDecoder", ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i8, [3 x i8], i32, i32, i32, i32, double, i8, i8, [6 x i8] }>
%"class.musik::core::sdk::IDecoder" = type { ptr }
%struct.AVCodecContext = type { ptr, i32, i32, ptr, i32, i32, ptr, ptr, ptr, i64, i32, i32, ptr, i32, %struct.AVRational, %struct.AVRational, %struct.AVRational, i32, i32, i32, i32, i32, i32, %struct.AVRational, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, i32, float, float, float, float, float, float, float, float, float, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.AVChannelLayout, i32, i32, i32, i32, i32, i32, i32, i32, ptr, i32, i32, i32, float, float, i32, i32, i32, i32, i32, ptr, i64, i64, float, float, i32, i32, ptr, ptr, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, i32, i32, [8 x i64], i32, i32, i32, i32, i32, i32, i32, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, i32, i32, ptr, ptr, ptr, ptr, i32, i32, i64, i32, i32, i64, ptr, i64, ptr, i32, ptr, i32 }
%struct.AVRational = type { i32, i32 }
%struct.AVChannelLayout = type { i32, i32, %union.anon.8, ptr }
%union.anon.8 = type { i64 }
%struct.AVFrame = type { [8 x ptr], [8 x i32], ptr, i32, i32, i32, i32, i32, i32, %struct.AVRational, i64, i64, %struct.AVRational, i32, ptr, i32, i32, i32, i32, i32, [8 x ptr], ptr, i32, ptr, i32, i32, i32, i32, i32, i32, i32, i64, i64, ptr, i32, i32, ptr, ptr, i64, i64, i64, i64, ptr, %struct.AVChannelLayout, i64 }

@.str.15 = external hidden unnamed_addr constant [20 x i8], align 1

; 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 nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN13FfmpegDecoder25DrainResamplerToFifoQueueEv(ptr noundef nonnull align 8 dereferenceable(106) %0) #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %"class.std::__cxx11::basic_string", align 8
  %9 = alloca %"class.std::allocator.5", align 1
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %13 = load ptr, ptr %3, align 8
  %14 = getelementptr inbounds %class.FfmpegDecoder, ptr %13, i32 0, i32 8
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  %16 = icmp ne ptr %15, null
  br i1 %16, label %18, label %17

17:                                               ; preds = %1
  store i1 false, ptr %2, align 1
  br label %127

18:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %19 = getelementptr inbounds %class.FfmpegDecoder, ptr %13, i32 0, i32 9
  %20 = load i32, ptr %19, align 8, !tbaa !15
  %21 = icmp sgt i32 %20, 0
  br i1 %21, label %22, label %25

22:                                               ; preds = %18
  %23 = getelementptr inbounds %class.FfmpegDecoder, ptr %13, i32 0, i32 9
  %24 = load i32, ptr %23, align 8, !tbaa !15
  br label %52

25:                                               ; preds = %18
  %26 = getelementptr inbounds %class.FfmpegDecoder, ptr %13, i32 0, i32 12
  %27 = load i32, ptr %26, align 8, !tbaa !16
  %28 = getelementptr inbounds %class.FfmpegDecoder, ptr %13, i32 0, i32 5
  %29 = load ptr, ptr %28, align 8, !tbaa !17
  %30 = getelementptr inbounds %struct.AVCodecContext, ptr %29, i32 0, i32 70
  %31 = load i32, ptr %30, align 8, !tbaa !18
  %32 = icmp sgt i32 %27, %31
  br i1 %32, label %33, label %45

33:                                               ; preds = %25
  %34 = getelementptr inbounds %class.FfmpegDecoder, ptr %13, i32 0, i32 9
  %35 = load i32, ptr %34, align 8, !tbaa !15
  %36 = icmp sgt i32 %35, 0
  br i1 %36, label %37, label %40

37:                                               ; preds = %33
  %38 = getelementptr inbounds %class.FfmpegDecoder, ptr %13, i32 0, i32 9
  %39 = load i32, ptr %38, align 8, !tbaa !15
  br label %43

40:                                               ; preds = %33
  %41 = getelementptr inbounds %class.FfmpegDecoder, ptr %13, i32 0, i32 12
  %42 = load i32, ptr %41, align 8, !tbaa !16
  br label %43

43:                                               ; preds = %40, %37
  %44 = phi i32 [ %39, %37 ], [ %42, %40 ]
  br label %50

45:                                               ; preds = %25
  %46 = getelementptr inbounds %class.FfmpegDecoder, ptr %13, i32 0, i32 5
  %47 = load ptr, ptr %46, align 8, !tbaa !17
  %48 = getelementptr inbounds %struct.AVCodecContext, ptr %47, i32 0, i32 70
  %49 = load i32, ptr %48, align 8, !tbaa !18
  br label %50

50:                                               ; preds = %45, %43
  %51 = phi i32 [ %44, %43 ], [ %49, %45 ]
  br label %52

52:                                               ; preds = %50, %22
  %53 = phi i32 [ %24, %22 ], [ %51, %50 ]
  %54 = sext i32 %53 to i64
  store i64 %54, ptr %4, align 8, !tbaa !37
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %55 = getelementptr inbounds %class.FfmpegDecoder, ptr %13, i32 0, i32 8
  %56 = load ptr, ptr %55, align 8, !tbaa !9
  %57 = load i64, ptr %4, align 8, !tbaa !37
  %58 = call i64 @swr_get_delay(ptr noundef %56, i64 noundef %57)
  store i64 %58, ptr %5, align 8, !tbaa !37
  br label %59

59:                                               ; preds = %124, %52
  %60 = load i64, ptr %5, align 8, !tbaa !37
  %61 = icmp sgt i64 %60, 0
  br i1 %61, label %62, label %125

62:                                               ; preds = %59
  %63 = getelementptr inbounds %class.FfmpegDecoder, ptr %13, i32 0, i32 7
  %64 = load ptr, ptr %63, align 8, !tbaa !38
  %65 = getelementptr inbounds %class.FfmpegDecoder, ptr %13, i32 0, i32 5
  %66 = load ptr, ptr %65, align 8, !tbaa !17
  %67 = getelementptr inbounds %struct.AVCodecContext, ptr %66, i32 0, i32 71
  %68 = load i32, ptr %67, align 4, !tbaa !39
  %69 = getelementptr inbounds %class.FfmpegDecoder, ptr %13, i32 0, i32 5
  %70 = load ptr, ptr %69, align 8, !tbaa !17
  %71 = getelementptr inbounds %struct.AVCodecContext, ptr %70, i32 0, i32 70
  %72 = load i32, ptr %71, align 8, !tbaa !18
  %73 = call noundef ptr @_ZN13FfmpegDecoder10AllocFrameEP7AVFrame14AVSampleFormatii(ptr noundef nonnull align 8 dereferenceable(106) %13, ptr noundef %64, i32 noundef %68, i32 noundef %72, i32 noundef -1)
  %74 = getelementptr inbounds %class.FfmpegDecoder, ptr %13, i32 0, i32 7
  store ptr %73, ptr %74, align 8, !tbaa !38
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %75 = getelementptr inbounds %class.FfmpegDecoder, ptr %13, i32 0, i32 8
  %76 = load ptr, ptr %75, align 8, !tbaa !9
  %77 = getelementptr inbounds %class.FfmpegDecoder, ptr %13, i32 0, i32 7
  %78 = load ptr, ptr %77, align 8, !tbaa !38
  %79 = getelementptr inbounds %struct.AVFrame, ptr %78, i32 0, i32 2
  %80 = load ptr, ptr %79, align 8, !tbaa !40
  %81 = getelementptr inbounds %class.FfmpegDecoder, ptr %13, i32 0, i32 7
  %82 = load ptr, ptr %81, align 8, !tbaa !38
  %83 = getelementptr inbounds %struct.AVFrame, ptr %82, i32 0, i32 5
  %84 = load i32, ptr %83, align 8, !tbaa !43
  %85 = call i32 @swr_convert(ptr noundef %76, ptr noundef %80, i32 noundef %84, ptr noundef null, i32 noundef 0)
  store i32 %85, ptr %6, align 4, !tbaa !44
  %86 = load i32, ptr %6, align 4, !tbaa !44
  %87 = icmp sgt i32 %86, 0
  br i1 %87, label %88, label %120

88:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %89 = getelementptr inbounds %class.FfmpegDecoder, ptr %13, i32 0, i32 3
  %90 = load ptr, ptr %89, align 8, !tbaa !45
  %91 = getelementptr inbounds %class.FfmpegDecoder, ptr %13, i32 0, i32 7
  %92 = load ptr, ptr %91, align 8, !tbaa !38
  %93 = getelementptr inbounds %struct.AVFrame, ptr %92, i32 0, i32 2
  %94 = load ptr, ptr %93, align 8, !tbaa !40
  %95 = load i32, ptr %6, align 4, !tbaa !44
  %96 = call i32 @av_audio_fifo_write(ptr noundef %90, ptr noundef %94, i32 noundef %95)
  store i32 %96, ptr %7, align 4, !tbaa !44
  %97 = load i32, ptr %7, align 4, !tbaa !44
  %98 = icmp slt i32 %97, 0
  br i1 %98, label %99, label %112

99:                                               ; preds = %88
  call void @llvm.lifetime.start.p0(i64 32, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #4
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #4
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef @.str.15, ptr noundef nonnull align 1 dereferenceable(1) %9)
          to label %100 unwind label %103

100:                                              ; preds = %99
  %101 = load i32, ptr %7, align 4, !tbaa !44
  invoke void @_ZL10logAvErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi(ptr noundef nonnull align 8 dereferenceable(32) %8, i32 noundef %101)
          to label %102 unwind label %107

102:                                              ; preds = %100
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #4
  store i1 false, ptr %2, align 1
  store i32 1, ptr %12, align 4
  br label %117

103:                                              ; preds = %99
  %104 = landingpad { ptr, i32 }
          cleanup
  %105 = extractvalue { ptr, i32 } %104, 0
  store ptr %105, ptr %10, align 8
  %106 = extractvalue { ptr, i32 } %104, 1
  store i32 %106, ptr %11, align 4
  br label %111

107:                                              ; preds = %100
  %108 = landingpad { ptr, i32 }
          cleanup
  %109 = extractvalue { ptr, i32 } %108, 0
  store ptr %109, ptr %10, align 8
  %110 = extractvalue { ptr, i32 } %108, 1
  store i32 %110, ptr %11, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #4
  br label %111

111:                                              ; preds = %107, %103
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  br label %129

112:                                              ; preds = %88
  %113 = load i32, ptr %6, align 4, !tbaa !44
  %114 = sext i32 %113 to i64
  %115 = load i64, ptr %5, align 8, !tbaa !37
  %116 = sub nsw i64 %115, %114
  store i64 %116, ptr %5, align 8, !tbaa !37
  store i32 0, ptr %12, align 4
  br label %117

117:                                              ; preds = %112, %102
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  %118 = load i32, ptr %12, align 4
  switch i32 %118, label %122 [
    i32 0, label %119
  ]

119:                                              ; preds = %117
  br label %121

120:                                              ; preds = %62
  store i32 3, ptr %12, align 4
  br label %122

121:                                              ; preds = %119
  store i32 0, ptr %12, align 4
  br label %122

122:                                              ; preds = %121, %120, %117
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  %123 = load i32, ptr %12, align 4
  switch i32 %123, label %126 [
    i32 0, label %124
    i32 3, label %125
  ]

124:                                              ; preds = %122
  br label %59, !llvm.loop !46

125:                                              ; preds = %122, %59
  store i1 true, ptr %2, align 1
  store i32 1, ptr %12, align 4
  br label %126

126:                                              ; preds = %125, %122
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  br label %127

127:                                              ; preds = %126, %17
  %128 = load i1, ptr %2, align 1
  ret i1 %128

129:                                              ; preds = %111
  %130 = load ptr, ptr %10, align 8
  %131 = load i32, ptr %11, align 4
  %132 = insertvalue { ptr, i32 } poison, ptr %130, 0
  %133 = insertvalue { ptr, i32 } %132, i32 %131, 1
  resume { ptr, i32 } %133
}

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL10logAvErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN13FfmpegDecoder10AllocFrameEP7AVFrame14AVSampleFormatii(ptr noundef nonnull align 8 dereferenceable(106), ptr noundef, i32 noundef, i32 noundef, i32 noundef) #2 align 2

declare i32 @av_audio_fifo_write(ptr noundef, ptr noundef, i32 noundef) #3

declare i64 @swr_get_delay(ptr noundef, i64 noundef) #3

declare i32 @swr_convert(ptr noundef, ptr noundef, i32 noundef, ptr noundef, 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 = { 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 64}
!10 = !{!"_ZTS13FfmpegDecoder", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !12, i64 72, !13, i64 76, !12, i64 80, !12, i64 84, !12, i64 88, !12, i64 92, !14, i64 96, !13, i64 104, !13, i64 105}
!11 = !{!"_ZTSN5musik4core3sdk8IDecoderE"}
!12 = !{!"int", !7, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = !{!10, !12, i64 72}
!16 = !{!10, !12, i64 80}
!17 = !{!10, !6, i64 40}
!18 = !{!19, !12, i64 344}
!19 = !{!"_ZTS14AVCodecContext", !6, i64 0, !12, i64 8, !20, i64 12, !6, i64 16, !21, i64 24, !12, i64 28, !6, i64 32, !6, i64 40, !6, i64 48, !22, i64 56, !12, i64 64, !12, i64 68, !6, i64 72, !12, i64 80, !23, i64 84, !23, i64 92, !23, i64 100, !12, i64 108, !12, i64 112, !12, i64 116, !12, i64 120, !12, i64 124, !12, i64 128, !23, i64 132, !24, i64 140, !24, i64 144, !25, i64 148, !26, i64 152, !27, i64 156, !28, i64 160, !29, i64 164, !30, i64 168, !12, i64 172, !12, i64 176, !12, i64 180, !6, i64 184, !6, i64 192, !12, i64 200, !31, i64 204, !31, i64 208, !31, i64 212, !31, i64 216, !31, i64 220, !31, i64 224, !31, i64 228, !31, i64 232, !31, i64 236, !12, i64 240, !12, i64 244, !12, i64 248, !12, i64 252, !12, i64 256, !12, i64 260, !12, i64 264, !12, i64 268, !12, i64 272, !12, i64 276, !12, i64 280, !12, i64 284, !6, i64 288, !6, i64 296, !6, i64 304, !12, i64 312, !12, i64 316, !12, i64 320, !12, i64 324, !12, i64 328, !12, i64 332, !12, i64 336, !12, i64 340, !12, i64 344, !32, i64 348, !33, i64 352, !12, i64 376, !12, i64 380, !12, i64 384, !35, i64 388, !32, i64 392, !12, i64 396, !12, i64 400, !12, i64 404, !6, i64 408, !12, i64 416, !12, i64 420, !12, i64 424, !31, i64 428, !31, i64 432, !12, i64 436, !12, i64 440, !12, i64 444, !12, i64 448, !12, i64 452, !6, i64 456, !22, i64 464, !22, i64 472, !31, i64 480, !31, i64 484, !12, i64 488, !12, i64 492, !6, i64 496, !6, i64 504, !12, i64 512, !12, i64 516, !12, i64 520, !12, i64 524, !12, i64 528, !6, i64 536, !6, i64 544, !6, i64 552, !6, i64 560, !12, i64 568, !12, i64 572, !7, i64 576, !12, i64 640, !12, i64 644, !12, i64 648, !12, i64 652, !12, i64 656, !12, i64 660, !12, i64 664, !6, i64 672, !6, i64 680, !12, i64 688, !12, i64 692, !12, i64 696, !36, i64 700, !36, i64 704, !36, i64 708, !12, i64 712, !12, i64 716, !12, i64 720, !12, i64 724, !6, i64 728, !6, i64 736, !12, i64 744, !12, i64 748, !6, i64 752, !6, i64 760, !6, i64 768, !6, i64 776, !12, i64 784, !12, i64 788, !22, i64 792, !12, i64 800, !12, i64 804, !22, i64 808, !6, i64 816, !22, i64 824, !6, i64 832, !12, i64 840, !6, i64 848, !12, i64 856}
!20 = !{!"_ZTS11AVMediaType", !7, i64 0}
!21 = !{!"_ZTS9AVCodecID", !7, i64 0}
!22 = !{!"long", !7, i64 0}
!23 = !{!"_ZTS10AVRational", !12, i64 0, !12, i64 4}
!24 = !{!"_ZTS13AVPixelFormat", !7, i64 0}
!25 = !{!"_ZTS16AVColorPrimaries", !7, i64 0}
!26 = !{!"_ZTS29AVColorTransferCharacteristic", !7, i64 0}
!27 = !{!"_ZTS12AVColorSpace", !7, i64 0}
!28 = !{!"_ZTS12AVColorRange", !7, i64 0}
!29 = !{!"_ZTS16AVChromaLocation", !7, i64 0}
!30 = !{!"_ZTS12AVFieldOrder", !7, i64 0}
!31 = !{!"float", !7, i64 0}
!32 = !{!"_ZTS14AVSampleFormat", !7, i64 0}
!33 = !{!"_ZTS15AVChannelLayout", !34, i64 0, !12, i64 4, !7, i64 8, !6, i64 16}
!34 = !{!"_ZTS14AVChannelOrder", !7, i64 0}
!35 = !{!"_ZTS18AVAudioServiceType", !7, i64 0}
!36 = !{!"_ZTS9AVDiscard", !7, i64 0}
!37 = !{!22, !22, i64 0}
!38 = !{!10, !6, i64 56}
!39 = !{!19, !32, i64 348}
!40 = !{!41, !6, i64 96}
!41 = !{!"_ZTS7AVFrame", !7, i64 0, !7, i64 64, !6, i64 96, !12, i64 104, !12, i64 108, !12, i64 112, !12, i64 116, !12, i64 120, !42, i64 124, !23, i64 128, !22, i64 136, !22, i64 144, !23, i64 152, !12, i64 160, !6, i64 168, !12, i64 176, !12, i64 180, !12, i64 184, !12, i64 188, !12, i64 192, !7, i64 200, !6, i64 264, !12, i64 272, !6, i64 280, !12, i64 288, !12, i64 292, !28, i64 296, !25, i64 300, !26, i64 304, !27, i64 308, !29, i64 312, !22, i64 320, !22, i64 328, !6, i64 336, !12, i64 344, !12, i64 348, !6, i64 352, !6, i64 360, !22, i64 368, !22, i64 376, !22, i64 384, !22, i64 392, !6, i64 400, !33, i64 408, !22, i64 432}
!42 = !{!"_ZTS13AVPictureType", !7, i64 0}
!43 = !{!41, !12, i64 112}
!44 = !{!12, !12, i64 0}
!45 = !{!10, !6, i64 24}
!46 = distinct !{!46, !47}
!47 = !{!"llvm.loop.mustprogress"}


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

%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator.5" = type { i8 }

@.str.15 = external hidden unnamed_addr constant [20 x i8], align 1

; 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 nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN13FfmpegDecoder25DrainResamplerToFifoQueueEv(ptr noundef nonnull align 8 dereferenceable(106) %0) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.std::__cxx11::basic_string", align 8
  %3 = alloca %"class.std::allocator.5", align 1
  %4 = getelementptr inbounds i8, ptr %0, i64 64
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %.not = icmp eq ptr %5, null
  br i1 %.not, label %.thread29, label %6

6:                                                ; preds = %1
  %7 = getelementptr inbounds i8, ptr %0, i64 72
  %8 = load i32, ptr %7, align 8, !tbaa !14
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %17, label %10

10:                                               ; preds = %6
  %11 = getelementptr inbounds i8, ptr %0, i64 80
  %12 = load i32, ptr %11, align 8, !tbaa !15
  %13 = getelementptr inbounds i8, ptr %0, i64 40
  %14 = load ptr, ptr %13, align 8, !tbaa !16
  %15 = getelementptr inbounds i8, ptr %14, i64 344
  %16 = load i32, ptr %15, align 8, !tbaa !17
  %spec.select = tail call i32 @llvm.smax.i32(i32 %12, i32 %16)
  br label %17

17:                                               ; preds = %10, %6
  %18 = phi i32 [ %8, %6 ], [ %spec.select, %10 ]
  %19 = sext i32 %18 to i64
  %20 = tail call i64 @swr_get_delay(ptr noundef nonnull %5, i64 noundef %19)
  %21 = icmp sgt i64 %20, 0
  br i1 %21, label %.lr.ph, label %.thread29

.lr.ph:                                           ; preds = %17
  %22 = getelementptr inbounds i8, ptr %0, i64 56
  %23 = getelementptr inbounds i8, ptr %0, i64 40
  %24 = getelementptr inbounds i8, ptr %0, i64 24
  br label %29

25:                                               ; preds = %44
  %26 = zext nneg i32 %42 to i64
  %27 = sub nsw i64 %.01732, %26
  %28 = icmp sgt i64 %27, 0
  br i1 %28, label %29, label %.thread29

29:                                               ; preds = %.lr.ph, %25
  %.01732 = phi i64 [ %20, %.lr.ph ], [ %27, %25 ]
  %30 = load ptr, ptr %22, align 8, !tbaa !36
  %31 = load ptr, ptr %23, align 8, !tbaa !16
  %32 = getelementptr inbounds i8, ptr %31, i64 348
  %33 = load i32, ptr %32, align 4, !tbaa !37
  %34 = getelementptr inbounds i8, ptr %31, i64 344
  %35 = load i32, ptr %34, align 8, !tbaa !17
  %36 = tail call noundef ptr @_ZN13FfmpegDecoder10AllocFrameEP7AVFrame14AVSampleFormatii(ptr noundef nonnull align 8 dereferenceable(106) %0, ptr noundef %30, i32 noundef %33, i32 noundef %35, i32 noundef -1)
  store ptr %36, ptr %22, align 8, !tbaa !36
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds i8, ptr %36, i64 96
  %39 = load ptr, ptr %38, align 8, !tbaa !38
  %40 = getelementptr inbounds i8, ptr %36, i64 112
  %41 = load i32, ptr %40, align 8, !tbaa !41
  %42 = tail call i32 @swr_convert(ptr noundef %37, ptr noundef %39, i32 noundef %41, ptr noundef null, i32 noundef 0)
  %43 = icmp sgt i32 %42, 0
  br i1 %43, label %44, label %.thread29

44:                                               ; preds = %29
  %45 = load ptr, ptr %24, align 8, !tbaa !42
  %46 = load ptr, ptr %22, align 8, !tbaa !36
  %47 = getelementptr inbounds i8, ptr %46, i64 96
  %48 = load ptr, ptr %47, align 8, !tbaa !38
  %49 = tail call i32 @av_audio_fifo_write(ptr noundef %45, ptr noundef %48, i32 noundef %42)
  %50 = icmp slt i32 %49, 0
  br i1 %50, label %51, label %25

51:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %3) #5
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %2, ptr noundef nonnull @.str.15, ptr noundef nonnull align 1 dereferenceable(1) %3)
          to label %52 unwind label %53

52:                                               ; preds = %51
  invoke void @_ZL10logAvErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi(ptr noundef nonnull align 8 dereferenceable(32) %2, i32 noundef %49)
          to label %.thread unwind label %55

.thread:                                          ; preds = %52
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #5
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #5
  br label %.thread29

53:                                               ; preds = %51
  %54 = landingpad { ptr, i32 }
          cleanup
  br label %57

55:                                               ; preds = %52
  %56 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #5
  br label %57

57:                                               ; preds = %55, %53
  %.pn = phi { ptr, i32 } [ %56, %55 ], [ %54, %53 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #5
  resume { ptr, i32 } %.pn

.thread29:                                        ; preds = %25, %29, %17, %.thread, %1
  %.4 = phi i1 [ false, %1 ], [ false, %.thread ], [ true, %17 ], [ true, %29 ], [ true, %25 ]
  ret i1 %.4
}

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL10logAvErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN13FfmpegDecoder10AllocFrameEP7AVFrame14AVSampleFormatii(ptr noundef nonnull align 8 dereferenceable(106), ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2 align 2

declare i32 @av_audio_fifo_write(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

declare i64 @swr_get_delay(ptr noundef, i64 noundef) local_unnamed_addr #3

declare i32 @swr_convert(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !8, i64 64}
!6 = !{!"_ZTS13FfmpegDecoder", !7, i64 0, !8, i64 8, !8, i64 16, !8, i64 24, !8, i64 32, !8, i64 40, !8, i64 48, !8, i64 56, !8, i64 64, !11, i64 72, !12, i64 76, !11, i64 80, !11, i64 84, !11, i64 88, !11, i64 92, !13, i64 96, !12, i64 104, !12, i64 105}
!7 = !{!"_ZTSN5musik4core3sdk8IDecoderE"}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!"bool", !9, i64 0}
!13 = !{!"double", !9, i64 0}
!14 = !{!6, !11, i64 72}
!15 = !{!6, !11, i64 80}
!16 = !{!6, !8, i64 40}
!17 = !{!18, !11, i64 344}
!18 = !{!"_ZTS14AVCodecContext", !8, i64 0, !11, i64 8, !19, i64 12, !8, i64 16, !20, i64 24, !11, i64 28, !8, i64 32, !8, i64 40, !8, i64 48, !21, i64 56, !11, i64 64, !11, i64 68, !8, i64 72, !11, i64 80, !22, i64 84, !22, i64 92, !22, i64 100, !11, i64 108, !11, i64 112, !11, i64 116, !11, i64 120, !11, i64 124, !11, i64 128, !22, i64 132, !23, i64 140, !23, i64 144, !24, i64 148, !25, i64 152, !26, i64 156, !27, i64 160, !28, i64 164, !29, i64 168, !11, i64 172, !11, i64 176, !11, i64 180, !8, i64 184, !8, i64 192, !11, i64 200, !30, i64 204, !30, i64 208, !30, i64 212, !30, i64 216, !30, i64 220, !30, i64 224, !30, i64 228, !30, i64 232, !30, i64 236, !11, i64 240, !11, i64 244, !11, i64 248, !11, i64 252, !11, i64 256, !11, i64 260, !11, i64 264, !11, i64 268, !11, i64 272, !11, i64 276, !11, i64 280, !11, i64 284, !8, i64 288, !8, i64 296, !8, i64 304, !11, i64 312, !11, i64 316, !11, i64 320, !11, i64 324, !11, i64 328, !11, i64 332, !11, i64 336, !11, i64 340, !11, i64 344, !31, i64 348, !32, i64 352, !11, i64 376, !11, i64 380, !11, i64 384, !34, i64 388, !31, i64 392, !11, i64 396, !11, i64 400, !11, i64 404, !8, i64 408, !11, i64 416, !11, i64 420, !11, i64 424, !30, i64 428, !30, i64 432, !11, i64 436, !11, i64 440, !11, i64 444, !11, i64 448, !11, i64 452, !8, i64 456, !21, i64 464, !21, i64 472, !30, i64 480, !30, i64 484, !11, i64 488, !11, i64 492, !8, i64 496, !8, i64 504, !11, i64 512, !11, i64 516, !11, i64 520, !11, i64 524, !11, i64 528, !8, i64 536, !8, i64 544, !8, i64 552, !8, i64 560, !11, i64 568, !11, i64 572, !9, i64 576, !11, i64 640, !11, i64 644, !11, i64 648, !11, i64 652, !11, i64 656, !11, i64 660, !11, i64 664, !8, i64 672, !8, i64 680, !11, i64 688, !11, i64 692, !11, i64 696, !35, i64 700, !35, i64 704, !35, i64 708, !11, i64 712, !11, i64 716, !11, i64 720, !11, i64 724, !8, i64 728, !8, i64 736, !11, i64 744, !11, i64 748, !8, i64 752, !8, i64 760, !8, i64 768, !8, i64 776, !11, i64 784, !11, i64 788, !21, i64 792, !11, i64 800, !11, i64 804, !21, i64 808, !8, i64 816, !21, i64 824, !8, i64 832, !11, i64 840, !8, i64 848, !11, i64 856}
!19 = !{!"_ZTS11AVMediaType", !9, i64 0}
!20 = !{!"_ZTS9AVCodecID", !9, i64 0}
!21 = !{!"long", !9, i64 0}
!22 = !{!"_ZTS10AVRational", !11, i64 0, !11, i64 4}
!23 = !{!"_ZTS13AVPixelFormat", !9, i64 0}
!24 = !{!"_ZTS16AVColorPrimaries", !9, i64 0}
!25 = !{!"_ZTS29AVColorTransferCharacteristic", !9, i64 0}
!26 = !{!"_ZTS12AVColorSpace", !9, i64 0}
!27 = !{!"_ZTS12AVColorRange", !9, i64 0}
!28 = !{!"_ZTS16AVChromaLocation", !9, i64 0}
!29 = !{!"_ZTS12AVFieldOrder", !9, i64 0}
!30 = !{!"float", !9, i64 0}
!31 = !{!"_ZTS14AVSampleFormat", !9, i64 0}
!32 = !{!"_ZTS15AVChannelLayout", !33, i64 0, !11, i64 4, !9, i64 8, !8, i64 16}
!33 = !{!"_ZTS14AVChannelOrder", !9, i64 0}
!34 = !{!"_ZTS18AVAudioServiceType", !9, i64 0}
!35 = !{!"_ZTS9AVDiscard", !9, i64 0}
!36 = !{!6, !8, i64 56}
!37 = !{!18, !31, i64 348}
!38 = !{!39, !8, i64 96}
!39 = !{!"_ZTS7AVFrame", !9, i64 0, !9, i64 64, !8, i64 96, !11, i64 104, !11, i64 108, !11, i64 112, !11, i64 116, !11, i64 120, !40, i64 124, !22, i64 128, !21, i64 136, !21, i64 144, !22, i64 152, !11, i64 160, !8, i64 168, !11, i64 176, !11, i64 180, !11, i64 184, !11, i64 188, !11, i64 192, !9, i64 200, !8, i64 264, !11, i64 272, !8, i64 280, !11, i64 288, !11, i64 292, !27, i64 296, !24, i64 300, !25, i64 304, !26, i64 308, !28, i64 312, !21, i64 320, !21, i64 328, !8, i64 336, !11, i64 344, !11, i64 348, !8, i64 352, !8, i64 360, !21, i64 368, !21, i64 376, !21, i64 384, !21, i64 392, !8, i64 400, !32, i64 408, !21, i64 432}
!40 = !{!"_ZTS13AVPictureType", !9, i64 0}
!41 = !{!39, !11, i64 112}
!42 = !{!6, !8, i64 24}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass