; LLVM IR from clangen/musikcube :: src/plugins/stockencoders (FfmpegEncoder)

; 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.0" = type { i8 }
%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 }
%struct.AVRational = type { i32, i32 }
%struct.AVChannelLayout = type { i32, i32, %union.anon.6, ptr }
%union.anon.6 = type { i64 }
%class.FfmpegEncoder = type { %"class.musik::core::sdk::IBlockingEncoder", i8, ptr, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i64, %"class.std::__cxx11::basic_string", i32, i32 }
%"class.musik::core::sdk::IBlockingEncoder" = type { %"class.musik::core::sdk::IEncoder" }
%"class.musik::core::sdk::IEncoder" = 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 }

@.str.35 = 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 @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

; 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 uwtable
declare hidden void @_ZL10logAvErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) #2

declare void @av_frame_free(ptr noundef) #3

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

21:                                               ; preds = %5
  %22 = load ptr, ptr %8, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.AVFrame, ptr %22, i32 0, i32 5
  %24 = load i32, ptr %23, align 8, !tbaa !13
  %25 = load i32, ptr %10, align 4, !tbaa !11
  %26 = icmp ne i32 %24, %25
  br i1 %26, label %27, label %68

27:                                               ; preds = %21, %5
  %28 = load ptr, ptr %8, align 8, !tbaa !5
  %29 = icmp ne ptr %28, null
  br i1 %29, label %30, label %31

30:                                               ; preds = %27
  call void @av_frame_free(ptr noundef %8)
  br label %31

31:                                               ; preds = %30, %27
  %32 = call ptr @av_frame_alloc()
  store ptr %32, ptr %8, align 8, !tbaa !5
  %33 = load i32, ptr %10, align 4, !tbaa !11
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.AVFrame, ptr %34, i32 0, i32 5
  store i32 %33, ptr %35, align 8, !tbaa !13
  %36 = load i32, ptr %9, align 4, !tbaa !9
  %37 = load ptr, ptr %8, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.AVFrame, ptr %37, i32 0, i32 6
  store i32 %36, ptr %38, align 4, !tbaa !25
  %39 = load i32, ptr %11, align 4, !tbaa !11
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.AVFrame, ptr %40, i32 0, i32 19
  store i32 %39, ptr %41, align 8, !tbaa !26
  %42 = getelementptr inbounds %class.FfmpegEncoder, ptr %18, i32 0, i32 6
  %43 = load ptr, ptr %42, align 8, !tbaa !27
  %44 = getelementptr inbounds %struct.AVCodecContext, ptr %43, i32 0, i32 72
  %45 = load ptr, ptr %8, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.AVFrame, ptr %45, i32 0, i32 43
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %46, ptr align 8 %44, i64 24, i1 false), !tbaa.struct !34
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %47 = load ptr, ptr %8, align 8, !tbaa !5
  %48 = call i32 @av_frame_get_buffer(ptr noundef %47, i32 noundef 0)
  store i32 %48, ptr %12, align 4, !tbaa !11
  %49 = load i32, ptr %12, align 4, !tbaa !11
  %50 = icmp slt i32 %49, 0
  br i1 %50, label %51, label %64

51:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 32, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #5
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %14) #5
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %13, ptr noundef @.str.35, ptr noundef nonnull align 1 dereferenceable(1) %14)
          to label %52 unwind label %55

52:                                               ; preds = %51
  %53 = load i32, ptr %12, align 4, !tbaa !11
  invoke void @_ZL10logAvErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi(ptr noundef nonnull align 8 dereferenceable(32) %13, i32 noundef %53)
          to label %54 unwind label %59

54:                                               ; preds = %52
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13) #5
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %14) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #5
  store ptr null, ptr %6, align 8
  store i32 1, ptr %17, align 4
  br label %65

55:                                               ; preds = %51
  %56 = landingpad { ptr, i32 }
          cleanup
  %57 = extractvalue { ptr, i32 } %56, 0
  store ptr %57, ptr %15, align 8
  %58 = extractvalue { ptr, i32 } %56, 1
  store i32 %58, ptr %16, align 4
  br label %63

59:                                               ; preds = %52
  %60 = landingpad { ptr, i32 }
          cleanup
  %61 = extractvalue { ptr, i32 } %60, 0
  store ptr %61, ptr %15, align 8
  %62 = extractvalue { ptr, i32 } %60, 1
  store i32 %62, ptr %16, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13) #5
  br label %63

63:                                               ; preds = %59, %55
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %14) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %72

64:                                               ; preds = %31
  store i32 0, ptr %17, align 4
  br label %65

65:                                               ; preds = %64, %54
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  %66 = load i32, ptr %17, align 4
  switch i32 %66, label %77 [
    i32 0, label %67
    i32 1, label %70
  ]

67:                                               ; preds = %65
  br label %68

68:                                               ; preds = %67, %21
  %69 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %69, ptr %6, align 8
  br label %70

70:                                               ; preds = %68, %65
  %71 = load ptr, ptr %6, align 8
  ret ptr %71

72:                                               ; preds = %63
  %73 = load ptr, ptr %15, align 8
  %74 = load i32, ptr %16, align 4
  %75 = insertvalue { ptr, i32 } poison, ptr %73, 0
  %76 = insertvalue { ptr, i32 } %75, i32 %74, 1
  resume { ptr, i32 } %76

77:                                               ; preds = %65
  unreachable
}

declare ptr @av_frame_alloc() #3

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

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

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

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !10, i64 0}
!10 = !{!"_ZTS14AVSampleFormat", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 112}
!14 = !{!"_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, !15, i64 124, !16, i64 128, !17, i64 136, !17, i64 144, !16, 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, !18, i64 296, !19, i64 300, !20, i64 304, !21, i64 308, !22, i64 312, !17, i64 320, !17, i64 328, !6, i64 336, !12, i64 344, !12, i64 348, !6, i64 352, !6, i64 360, !17, i64 368, !17, i64 376, !17, i64 384, !17, i64 392, !6, i64 400, !23, i64 408, !17, i64 432}
!15 = !{!"_ZTS13AVPictureType", !7, i64 0}
!16 = !{!"_ZTS10AVRational", !12, i64 0, !12, i64 4}
!17 = !{!"long", !7, i64 0}
!18 = !{!"_ZTS12AVColorRange", !7, i64 0}
!19 = !{!"_ZTS16AVColorPrimaries", !7, i64 0}
!20 = !{!"_ZTS29AVColorTransferCharacteristic", !7, i64 0}
!21 = !{!"_ZTS12AVColorSpace", !7, i64 0}
!22 = !{!"_ZTS16AVChromaLocation", !7, i64 0}
!23 = !{!"_ZTS15AVChannelLayout", !24, i64 0, !12, i64 4, !7, i64 8, !6, i64 16}
!24 = !{!"_ZTS14AVChannelOrder", !7, i64 0}
!25 = !{!14, !12, i64 116}
!26 = !{!14, !12, i64 192}
!27 = !{!28, !6, i64 48}
!28 = !{!"_ZTS13FfmpegEncoder", !29, i64 0, !31, i64 8, !6, i64 16, !12, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !17, i64 104, !32, i64 112, !12, i64 144, !12, i64 148}
!29 = !{!"_ZTSN5musik4core3sdk16IBlockingEncoderE", !30, i64 0}
!30 = !{!"_ZTSN5musik4core3sdk8IEncoderE"}
!31 = !{!"bool", !7, i64 0}
!32 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !33, i64 0, !17, i64 8, !7, i64 16}
!33 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!34 = !{i64 0, i64 4, !35, i64 4, i64 4, !11, i64 8, i64 8, !36, i64 16, i64 8, !5}
!35 = !{!24, !24, i64 0}
!36 = !{!7, !7, i64 0}


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

%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<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.0" = type { i8 }

@.str.35 = 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 @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

; 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 uwtable
declare hidden void @_ZL10logAvErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) local_unnamed_addr #2

declare void @av_frame_free(ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN13FfmpegEncoder12ReallocFrameEP7AVFrame14AVSampleFormatii(ptr nocapture noundef nonnull readonly align 8 dereferenceable(152) %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca ptr, align 8
  %7 = alloca %"class.std::__cxx11::basic_string", align 8
  %8 = alloca %"class.std::allocator.0", align 1
  store ptr %1, ptr %6, align 8, !tbaa !5
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %.thread, label %9

9:                                                ; preds = %5
  %10 = getelementptr inbounds i8, ptr %1, i64 112
  %11 = load i32, ptr %10, align 8, !tbaa !9
  %.not15 = icmp eq i32 %11, %3
  br i1 %.not15, label %.thread18, label %12

12:                                               ; preds = %9
  call void @av_frame_free(ptr noundef nonnull %6)
  br label %.thread

.thread:                                          ; preds = %5, %12
  %13 = call ptr @av_frame_alloc()
  store ptr %13, ptr %6, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %13, i64 112
  store i32 %3, ptr %14, align 8, !tbaa !9
  %15 = getelementptr inbounds i8, ptr %13, i64 116
  store i32 %2, ptr %15, align 4, !tbaa !22
  %16 = getelementptr inbounds i8, ptr %13, i64 192
  store i32 %4, ptr %16, align 8, !tbaa !23
  %17 = getelementptr inbounds i8, ptr %0, i64 48
  %18 = load ptr, ptr %17, align 8, !tbaa !24
  %19 = getelementptr inbounds i8, ptr %18, i64 352
  %20 = getelementptr inbounds i8, ptr %13, i64 408
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %20, ptr noundef nonnull align 8 dereferenceable(24) %19, i64 24, i1 false), !tbaa.struct !31
  %21 = call i32 @av_frame_get_buffer(ptr noundef %13, i32 noundef 0)
  %22 = icmp slt i32 %21, 0
  br i1 %22, label %23, label %.thread..thread18_crit_edge

.thread..thread18_crit_edge:                      ; preds = %.thread
  %.pre = load ptr, ptr %6, align 8, !tbaa !5
  br label %.thread18

23:                                               ; preds = %.thread
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %8) #5
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #5
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef nonnull @.str.35, ptr noundef nonnull align 1 dereferenceable(1) %8)
          to label %24 unwind label %25

24:                                               ; preds = %23
  invoke void @_ZL10logAvErrorRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi(ptr noundef nonnull align 8 dereferenceable(32) %7, i32 noundef %21)
          to label %30 unwind label %27

25:                                               ; preds = %23
  %26 = landingpad { ptr, i32 }
          cleanup
  br label %29

27:                                               ; preds = %24
  %28 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #5
  br label %29

29:                                               ; preds = %27, %25
  %.pn = phi { ptr, i32 } [ %28, %27 ], [ %26, %25 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #5
  resume { ptr, i32 } %.pn

30:                                               ; preds = %24
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #5
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #5
  br label %.thread18

.thread18:                                        ; preds = %9, %.thread..thread18_crit_edge, %30
  %.1 = phi ptr [ null, %30 ], [ %.pre, %.thread..thread18_crit_edge ], [ %1, %9 ]
  ret ptr %.1
}

declare ptr @av_frame_alloc() local_unnamed_addr #3

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

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

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

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !11, i64 112}
!10 = !{!"_ZTS7AVFrame", !7, i64 0, !7, i64 64, !6, i64 96, !11, i64 104, !11, i64 108, !11, i64 112, !11, i64 116, !11, i64 120, !12, i64 124, !13, i64 128, !14, i64 136, !14, i64 144, !13, i64 152, !11, i64 160, !6, i64 168, !11, i64 176, !11, i64 180, !11, i64 184, !11, i64 188, !11, i64 192, !7, i64 200, !6, i64 264, !11, i64 272, !6, i64 280, !11, i64 288, !11, i64 292, !15, i64 296, !16, i64 300, !17, i64 304, !18, i64 308, !19, i64 312, !14, i64 320, !14, i64 328, !6, i64 336, !11, i64 344, !11, i64 348, !6, i64 352, !6, i64 360, !14, i64 368, !14, i64 376, !14, i64 384, !14, i64 392, !6, i64 400, !20, i64 408, !14, i64 432}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTS13AVPictureType", !7, i64 0}
!13 = !{!"_ZTS10AVRational", !11, i64 0, !11, i64 4}
!14 = !{!"long", !7, i64 0}
!15 = !{!"_ZTS12AVColorRange", !7, i64 0}
!16 = !{!"_ZTS16AVColorPrimaries", !7, i64 0}
!17 = !{!"_ZTS29AVColorTransferCharacteristic", !7, i64 0}
!18 = !{!"_ZTS12AVColorSpace", !7, i64 0}
!19 = !{!"_ZTS16AVChromaLocation", !7, i64 0}
!20 = !{!"_ZTS15AVChannelLayout", !21, i64 0, !11, i64 4, !7, i64 8, !6, i64 16}
!21 = !{!"_ZTS14AVChannelOrder", !7, i64 0}
!22 = !{!10, !11, i64 116}
!23 = !{!10, !11, i64 192}
!24 = !{!25, !6, i64 48}
!25 = !{!"_ZTS13FfmpegEncoder", !26, i64 0, !28, i64 8, !6, i64 16, !11, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !14, i64 104, !29, i64 112, !11, i64 144, !11, i64 148}
!26 = !{!"_ZTSN5musik4core3sdk16IBlockingEncoderE", !27, i64 0}
!27 = !{!"_ZTSN5musik4core3sdk8IEncoderE"}
!28 = !{!"bool", !7, i64 0}
!29 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !30, i64 0, !14, i64 8, !7, i64 16}
!30 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!31 = !{i64 0, i64 4, !32, i64 4, i64 4, !33, i64 8, i64 8, !34, i64 16, i64 8, !5}
!32 = !{!21, !21, i64 0}
!33 = !{!11, !11, i64 0}
!34 = !{!7, !7, i64 0}


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