; LLVM IR from modlfo/AudioEngine :: AudioEngine/JuceLibraryCode (juce_audio_utils)

; 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.juce::GenericScopedLock" = type { ptr }
%"class.juce::AudioThumbnail" = type { %"class.juce::AudioThumbnailBase", ptr, ptr, %"class.juce::ScopedPointer.115", %"class.juce::ScopedPointer.116", %"class.juce::OwnedArray.117", i32, i64, i64, i32, double, %"class.juce::CriticalSection" }
%"class.juce::AudioThumbnailBase" = type { %"class.juce::ChangeBroadcaster", %"class.juce::AudioFormatWriter::ThreadedWriter::IncomingDataReceiver" }
%"class.juce::ChangeBroadcaster" = type { ptr, %"class.juce::ChangeBroadcaster::ChangeBroadcasterCallback", %"class.juce::ListenerList.20" }
%"class.juce::ChangeBroadcaster::ChangeBroadcasterCallback" = type { %"class.juce::AsyncUpdater", ptr }
%"class.juce::AsyncUpdater" = type { ptr, %"class.juce::ReferenceCountedObjectPtr.19" }
%"class.juce::ReferenceCountedObjectPtr.19" = type { ptr }
%"class.juce::ListenerList.20" = type { %"class.juce::Array.21" }
%"class.juce::Array.21" = type { %"class.juce::ArrayAllocationBase.22", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.22" = type <{ %"class.juce::HeapBlock.23", i32, [4 x i8] }>
%"class.juce::HeapBlock.23" = type { ptr }
%"class.juce::AudioFormatWriter::ThreadedWriter::IncomingDataReceiver" = type { ptr }
%"class.juce::ScopedPointer.115" = type { ptr }
%"class.juce::ScopedPointer.116" = type { ptr }
%"class.juce::OwnedArray.117" = type { %"class.juce::ArrayAllocationBase.118", i32, [4 x i8] }
%"class.juce::ArrayAllocationBase.118" = type <{ %"class.juce::HeapBlock.119", i32, [4 x i8] }>
%"class.juce::HeapBlock.119" = type { ptr }
%"class.juce::CriticalSection" = 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 }

@.str.10 = external hidden unnamed_addr constant [5 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: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4juce17GenericScopedLockINS_15CriticalSectionEEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #1 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK4juce14AudioThumbnail6saveToERNS_12OutputStreamE(ptr noundef nonnull align 8 dereferenceable(200) %0, ptr noundef nonnull align 8 dereferenceable(16) %1) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"class.juce::GenericScopedLock", align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %12 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %13 = getelementptr inbounds %"class.juce::AudioThumbnail", ptr %12, i32 0, i32 11
  call void @_ZN4juce17GenericScopedLockINS_15CriticalSectionEEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(40) %13) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %14 = getelementptr inbounds %"class.juce::AudioThumbnail", ptr %12, i32 0, i32 5
  %15 = call noundef i32 @_ZNK4juce10OwnedArrayINS_14AudioThumbnail9ThumbDataENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %14) #5
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %17, label %18

17:                                               ; preds = %2
  br label %22

18:                                               ; preds = %2
  %19 = getelementptr inbounds %"class.juce::AudioThumbnail", ptr %12, i32 0, i32 5
  %20 = call noundef ptr @_ZNK4juce10OwnedArrayINS_14AudioThumbnail9ThumbDataENS_20DummyCriticalSectionEE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20) %19, i32 noundef 0) #5
  %21 = call noundef i32 @_ZNK4juce14AudioThumbnail9ThumbData7getSizeEv(ptr noundef nonnull align 8 dereferenceable(28) %20) #5
  br label %22

22:                                               ; preds = %18, %17
  %23 = phi i32 [ 0, %17 ], [ %21, %18 ]
  store i32 %23, ptr %6, align 4, !tbaa !9
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = load ptr, ptr %24, align 8, !tbaa !11
  %26 = getelementptr inbounds ptr, ptr %25, i64 5
  %27 = load ptr, ptr %26, align 8
  %28 = invoke noundef zeroext i1 %27(ptr noundef nonnull align 8 dereferenceable(16) %24, ptr noundef @.str.10, i64 noundef 4)
          to label %29 unwind label %95

29:                                               ; preds = %22
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %"class.juce::AudioThumbnail", ptr %12, i32 0, i32 6
  %32 = load i32, ptr %31, align 8, !tbaa !13
  %33 = load ptr, ptr %30, align 8, !tbaa !11
  %34 = getelementptr inbounds ptr, ptr %33, i64 10
  %35 = load ptr, ptr %34, align 8
  %36 = invoke noundef zeroext i1 %35(ptr noundef nonnull align 8 dereferenceable(16) %30, i32 noundef %32)
          to label %37 unwind label %95

37:                                               ; preds = %29
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %"class.juce::AudioThumbnail", ptr %12, i32 0, i32 7
  %40 = load i64, ptr %39, align 8, !tbaa !33
  %41 = load ptr, ptr %38, align 8, !tbaa !11
  %42 = getelementptr inbounds ptr, ptr %41, i64 12
  %43 = load ptr, ptr %42, align 8
  %44 = invoke noundef zeroext i1 %43(ptr noundef nonnull align 8 dereferenceable(16) %38, i64 noundef %40)
          to label %45 unwind label %95

45:                                               ; preds = %37
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds %"class.juce::AudioThumbnail", ptr %12, i32 0, i32 8
  %48 = load i64, ptr %47, align 8, !tbaa !34
  %49 = load ptr, ptr %46, align 8, !tbaa !11
  %50 = getelementptr inbounds ptr, ptr %49, i64 12
  %51 = load ptr, ptr %50, align 8
  %52 = invoke noundef zeroext i1 %51(ptr noundef nonnull align 8 dereferenceable(16) %46, i64 noundef %48)
          to label %53 unwind label %95

53:                                               ; preds = %45
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = load i32, ptr %6, align 4, !tbaa !9
  %56 = load ptr, ptr %54, align 8, !tbaa !11
  %57 = getelementptr inbounds ptr, ptr %56, i64 10
  %58 = load ptr, ptr %57, align 8
  %59 = invoke noundef zeroext i1 %58(ptr noundef nonnull align 8 dereferenceable(16) %54, i32 noundef %55)
          to label %60 unwind label %95

60:                                               ; preds = %53
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = getelementptr inbounds %"class.juce::AudioThumbnail", ptr %12, i32 0, i32 9
  %63 = load i32, ptr %62, align 8, !tbaa !35
  %64 = load ptr, ptr %61, align 8, !tbaa !11
  %65 = getelementptr inbounds ptr, ptr %64, i64 10
  %66 = load ptr, ptr %65, align 8
  %67 = invoke noundef zeroext i1 %66(ptr noundef nonnull align 8 dereferenceable(16) %61, i32 noundef %63)
          to label %68 unwind label %95

68:                                               ; preds = %60
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = getelementptr inbounds %"class.juce::AudioThumbnail", ptr %12, i32 0, i32 10
  %71 = load double, ptr %70, align 8, !tbaa !36
  %72 = fptosi double %71 to i32
  %73 = load ptr, ptr %69, align 8, !tbaa !11
  %74 = getelementptr inbounds ptr, ptr %73, i64 10
  %75 = load ptr, ptr %74, align 8
  %76 = invoke noundef zeroext i1 %75(ptr noundef nonnull align 8 dereferenceable(16) %69, i32 noundef %72)
          to label %77 unwind label %95

77:                                               ; preds = %68
  %78 = load ptr, ptr %4, align 8, !tbaa !5
  %79 = load ptr, ptr %78, align 8, !tbaa !11
  %80 = getelementptr inbounds ptr, ptr %79, i64 12
  %81 = load ptr, ptr %80, align 8
  %82 = invoke noundef zeroext i1 %81(ptr noundef nonnull align 8 dereferenceable(16) %78, i64 noundef 0)
          to label %83 unwind label %95

83:                                               ; preds = %77
  %84 = load ptr, ptr %4, align 8, !tbaa !5
  %85 = load ptr, ptr %84, align 8, !tbaa !11
  %86 = getelementptr inbounds ptr, ptr %85, i64 12
  %87 = load ptr, ptr %86, align 8
  %88 = invoke noundef zeroext i1 %87(ptr noundef nonnull align 8 dereferenceable(16) %84, i64 noundef 0)
          to label %89 unwind label %95

89:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %90

90:                                               ; preds = %122, %89
  %91 = load i32, ptr %9, align 4, !tbaa !9
  %92 = load i32, ptr %6, align 4, !tbaa !9
  %93 = icmp slt i32 %91, %92
  br i1 %93, label %99, label %94

94:                                               ; preds = %90
  store i32 2, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %125

95:                                               ; preds = %83, %77, %68, %60, %53, %45, %37, %29, %22
  %96 = landingpad { ptr, i32 }
          cleanup
  %97 = extractvalue { ptr, i32 } %96, 0
  store ptr %97, ptr %7, align 8
  %98 = extractvalue { ptr, i32 } %96, 1
  store i32 %98, ptr %8, align 4
  br label %126

99:                                               ; preds = %90
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %100

100:                                              ; preds = %114, %99
  %101 = load i32, ptr %11, align 4, !tbaa !9
  %102 = getelementptr inbounds %"class.juce::AudioThumbnail", ptr %12, i32 0, i32 9
  %103 = load i32, ptr %102, align 8, !tbaa !35
  %104 = icmp slt i32 %101, %103
  br i1 %104, label %106, label %105

105:                                              ; preds = %100
  store i32 5, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %121

106:                                              ; preds = %100
  %107 = getelementptr inbounds %"class.juce::AudioThumbnail", ptr %12, i32 0, i32 5
  %108 = load i32, ptr %11, align 4, !tbaa !9
  %109 = call noundef ptr @_ZNK4juce10OwnedArrayINS_14AudioThumbnail9ThumbDataENS_20DummyCriticalSectionEE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20) %107, i32 noundef %108) #5
  %110 = load i32, ptr %9, align 4, !tbaa !9
  %111 = call noundef ptr @_ZN4juce14AudioThumbnail9ThumbData7getDataEi(ptr noundef nonnull align 8 dereferenceable(28) %109, i32 noundef %110) #5
  %112 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN4juce14AudioThumbnail11MinMaxValue5writeERNS_12OutputStreamE(ptr noundef nonnull align 1 dereferenceable(2) %111, ptr noundef nonnull align 8 dereferenceable(16) %112)
          to label %113 unwind label %117

113:                                              ; preds = %106
  br label %114

114:                                              ; preds = %113
  %115 = load i32, ptr %11, align 4, !tbaa !9
  %116 = add nsw i32 %115, 1
  store i32 %116, ptr %11, align 4, !tbaa !9
  br label %100, !llvm.loop !37

117:                                              ; preds = %106
  %118 = landingpad { ptr, i32 }
          cleanup
  %119 = extractvalue { ptr, i32 } %118, 0
  store ptr %119, ptr %7, align 8
  %120 = extractvalue { ptr, i32 } %118, 1
  store i32 %120, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %126

121:                                              ; preds = %105
  br label %122

122:                                              ; preds = %121
  %123 = load i32, ptr %9, align 4, !tbaa !9
  %124 = add nsw i32 %123, 1
  store i32 %124, ptr %9, align 4, !tbaa !9
  br label %90, !llvm.loop !39

125:                                              ; preds = %94
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @_ZN4juce17GenericScopedLockINS_15CriticalSectionEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  ret void

126:                                              ; preds = %117, %95
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @_ZN4juce17GenericScopedLockINS_15CriticalSectionEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  br label %127

127:                                              ; preds = %126
  %128 = load ptr, ptr %7, align 8
  %129 = load i32, ptr %8, align 4
  %130 = insertvalue { ptr, i32 } poison, ptr %128, 0
  %131 = insertvalue { ptr, i32 } %130, i32 %129, 1
  resume { ptr, i32 } %131
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4juce14AudioThumbnail9ThumbData7getSizeEv(ptr noundef nonnull align 8 dereferenceable(28)) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN4juce14AudioThumbnail11MinMaxValue5writeERNS_12OutputStreamE(ptr noundef nonnull align 1 dereferenceable(2), ptr noundef nonnull align 8 dereferenceable(16)) #4 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 #4 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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, !12, i64 0}
!12 = !{!"vtable pointer", !8, i64 0}
!13 = !{!14, !10, i64 120}
!14 = !{!"_ZTSN4juce14AudioThumbnailE", !15, i64 0, !6, i64 64, !6, i64 72, !25, i64 80, !26, i64 88, !27, i64 96, !10, i64 120, !30, i64 128, !30, i64 136, !10, i64 144, !31, i64 152, !32, i64 160}
!15 = !{!"_ZTSN4juce18AudioThumbnailBaseE", !16, i64 0, !24, i64 56}
!16 = !{!"_ZTSN4juce17ChangeBroadcasterE", !17, i64 8, !20, i64 32}
!17 = !{!"_ZTSN4juce17ChangeBroadcaster25ChangeBroadcasterCallbackE", !18, i64 0, !6, i64 16}
!18 = !{!"_ZTSN4juce12AsyncUpdaterE", !19, i64 8}
!19 = !{!"_ZTSN4juce25ReferenceCountedObjectPtrINS_12AsyncUpdater19AsyncUpdaterMessageEEE", !6, i64 0}
!20 = !{!"_ZTSN4juce12ListenerListINS_14ChangeListenerENS_5ArrayIPS1_NS_20DummyCriticalSectionELi0EEEEE", !21, i64 0}
!21 = !{!"_ZTSN4juce5ArrayIPNS_14ChangeListenerENS_20DummyCriticalSectionELi0EEE", !22, i64 0, !10, i64 16}
!22 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_14ChangeListenerENS_20DummyCriticalSectionEEE", !23, i64 0, !10, i64 8}
!23 = !{!"_ZTSN4juce9HeapBlockIPNS_14ChangeListenerELb0EEE", !6, i64 0}
!24 = !{!"_ZTSN4juce17AudioFormatWriter14ThreadedWriter20IncomingDataReceiverE"}
!25 = !{!"_ZTSN4juce13ScopedPointerINS_14AudioThumbnail15LevelDataSourceEEE", !6, i64 0}
!26 = !{!"_ZTSN4juce13ScopedPointerINS_14AudioThumbnail12CachedWindowEEE", !6, i64 0}
!27 = !{!"_ZTSN4juce10OwnedArrayINS_14AudioThumbnail9ThumbDataENS_20DummyCriticalSectionEEE", !28, i64 0, !10, i64 16}
!28 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_14AudioThumbnail9ThumbDataENS_20DummyCriticalSectionEEE", !29, i64 0, !10, i64 8}
!29 = !{!"_ZTSN4juce9HeapBlockIPNS_14AudioThumbnail9ThumbDataELb0EEE", !6, i64 0}
!30 = !{!"long long", !7, i64 0}
!31 = !{!"double", !7, i64 0}
!32 = !{!"_ZTSN4juce15CriticalSectionE", !7, i64 0}
!33 = !{!14, !30, i64 128}
!34 = !{!14, !30, i64 136}
!35 = !{!14, !10, i64 144}
!36 = !{!14, !31, i64 152}
!37 = distinct !{!37, !38}
!38 = !{!"llvm.loop.mustprogress"}
!39 = distinct !{!39, !38}


; 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.juce::GenericScopedLock" = type { ptr }

@.str.10 = external hidden unnamed_addr constant [5 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: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4juce17GenericScopedLockINS_15CriticalSectionEEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #1 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK4juce14AudioThumbnail6saveToERNS_12OutputStreamE(ptr noundef nonnull align 8 dereferenceable(200) %0, ptr noundef nonnull align 8 dereferenceable(16) %1) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.juce::GenericScopedLock", align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %4 = getelementptr inbounds i8, ptr %0, i64 160
  call void @_ZN4juce17GenericScopedLockINS_15CriticalSectionEEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(40) %4) #5
  %5 = getelementptr inbounds i8, ptr %0, i64 96
  %6 = call noundef i32 @_ZNK4juce10OwnedArrayINS_14AudioThumbnail9ThumbDataENS_20DummyCriticalSectionEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(20) %5) #5
  %7 = icmp eq i32 %6, 0
  br i1 %7, label %11, label %8

8:                                                ; preds = %2
  %9 = call noundef ptr @_ZNK4juce10OwnedArrayINS_14AudioThumbnail9ThumbDataENS_20DummyCriticalSectionEE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20) %5, i32 noundef 0) #5
  %10 = call noundef i32 @_ZNK4juce14AudioThumbnail9ThumbData7getSizeEv(ptr noundef nonnull align 8 dereferenceable(28) %9) #5
  br label %11

11:                                               ; preds = %2, %8
  %12 = phi i32 [ %10, %8 ], [ 0, %2 ]
  %13 = load ptr, ptr %1, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %13, i64 40
  %15 = load ptr, ptr %14, align 8
  %16 = invoke noundef zeroext i1 %15(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull @.str.10, i64 noundef 4)
          to label %17 unwind label %73

17:                                               ; preds = %11
  %18 = getelementptr inbounds i8, ptr %0, i64 120
  %19 = load i32, ptr %18, align 8, !tbaa !8
  %20 = load ptr, ptr %1, align 8, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %20, i64 80
  %22 = load ptr, ptr %21, align 8
  %23 = invoke noundef zeroext i1 %22(ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef %19)
          to label %24 unwind label %73

24:                                               ; preds = %17
  %25 = getelementptr inbounds i8, ptr %0, i64 128
  %26 = load i64, ptr %25, align 8, !tbaa !31
  %27 = load ptr, ptr %1, align 8, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %27, i64 96
  %29 = load ptr, ptr %28, align 8
  %30 = invoke noundef zeroext i1 %29(ptr noundef nonnull align 8 dereferenceable(16) %1, i64 noundef %26)
          to label %31 unwind label %73

31:                                               ; preds = %24
  %32 = getelementptr inbounds i8, ptr %0, i64 136
  %33 = load i64, ptr %32, align 8, !tbaa !32
  %34 = load ptr, ptr %1, align 8, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %34, i64 96
  %36 = load ptr, ptr %35, align 8
  %37 = invoke noundef zeroext i1 %36(ptr noundef nonnull align 8 dereferenceable(16) %1, i64 noundef %33)
          to label %38 unwind label %73

38:                                               ; preds = %31
  %39 = load ptr, ptr %1, align 8, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %39, i64 80
  %41 = load ptr, ptr %40, align 8
  %42 = invoke noundef zeroext i1 %41(ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef %12)
          to label %43 unwind label %73

43:                                               ; preds = %38
  %44 = getelementptr inbounds i8, ptr %0, i64 144
  %45 = load i32, ptr %44, align 8, !tbaa !33
  %46 = load ptr, ptr %1, align 8, !tbaa !5
  %47 = getelementptr inbounds i8, ptr %46, i64 80
  %48 = load ptr, ptr %47, align 8
  %49 = invoke noundef zeroext i1 %48(ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef %45)
          to label %50 unwind label %73

50:                                               ; preds = %43
  %51 = getelementptr inbounds i8, ptr %0, i64 152
  %52 = load double, ptr %51, align 8, !tbaa !34
  %53 = fptosi double %52 to i32
  %54 = load ptr, ptr %1, align 8, !tbaa !5
  %55 = getelementptr inbounds i8, ptr %54, i64 80
  %56 = load ptr, ptr %55, align 8
  %57 = invoke noundef zeroext i1 %56(ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef %53)
          to label %58 unwind label %73

58:                                               ; preds = %50
  %59 = load ptr, ptr %1, align 8, !tbaa !5
  %60 = getelementptr inbounds i8, ptr %59, i64 96
  %61 = load ptr, ptr %60, align 8
  %62 = invoke noundef zeroext i1 %61(ptr noundef nonnull align 8 dereferenceable(16) %1, i64 noundef 0)
          to label %63 unwind label %73

63:                                               ; preds = %58
  %64 = load ptr, ptr %1, align 8, !tbaa !5
  %65 = getelementptr inbounds i8, ptr %64, i64 96
  %66 = load ptr, ptr %65, align 8
  %67 = invoke noundef zeroext i1 %66(ptr noundef nonnull align 8 dereferenceable(16) %1, i64 noundef 0)
          to label %.preheader24 unwind label %73

.preheader24:                                     ; preds = %63
  %68 = icmp sgt i32 %12, 0
  %69 = load i32, ptr %44, align 8
  %70 = icmp sgt i32 %69, 0
  %or.cond = select i1 %68, i1 %70, i1 false
  br i1 %or.cond, label %.preheader, label %._crit_edge27

.preheader:                                       ; preds = %.preheader24, %._crit_edge
  %71 = phi i32 [ %75, %._crit_edge ], [ %69, %.preheader24 ]
  %.02026 = phi i32 [ %76, %._crit_edge ], [ 0, %.preheader24 ]
  %72 = icmp sgt i32 %71, 0
  br i1 %72, label %.lr.ph, label %._crit_edge

._crit_edge27:                                    ; preds = %._crit_edge, %.preheader24
  call void @_ZN4juce17GenericScopedLockINS_15CriticalSectionEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  ret void

73:                                               ; preds = %63, %58, %50, %43, %38, %31, %24, %17, %11
  %74 = landingpad { ptr, i32 }
          cleanup
  br label %85

._crit_edge:                                      ; preds = %79, %.preheader
  %75 = phi i32 [ %71, %.preheader ], [ %81, %79 ]
  %76 = add nuw nsw i32 %.02026, 1
  %exitcond.not = icmp eq i32 %76, %12
  br i1 %exitcond.not, label %._crit_edge27, label %.preheader, !llvm.loop !35

.lr.ph:                                           ; preds = %.preheader, %79
  %.025 = phi i32 [ %80, %79 ], [ 0, %.preheader ]
  %77 = call noundef ptr @_ZNK4juce10OwnedArrayINS_14AudioThumbnail9ThumbDataENS_20DummyCriticalSectionEE12getUncheckedEi(ptr noundef nonnull align 8 dereferenceable(20) %5, i32 noundef %.025) #5
  %78 = call noundef ptr @_ZN4juce14AudioThumbnail9ThumbData7getDataEi(ptr noundef nonnull align 8 dereferenceable(28) %77, i32 noundef %.02026) #5
  invoke void @_ZN4juce14AudioThumbnail11MinMaxValue5writeERNS_12OutputStreamE(ptr noundef nonnull align 1 dereferenceable(2) %78, ptr noundef nonnull align 8 dereferenceable(16) %1)
          to label %79 unwind label %83

79:                                               ; preds = %.lr.ph
  %80 = add nuw nsw i32 %.025, 1
  %81 = load i32, ptr %44, align 8, !tbaa !33
  %82 = icmp slt i32 %80, %81
  br i1 %82, label %.lr.ph, label %._crit_edge, !llvm.loop !38

83:                                               ; preds = %.lr.ph
  %84 = landingpad { ptr, i32 }
          cleanup
  br label %85

85:                                               ; preds = %83, %73
  %.pn = phi { ptr, i32 } [ %84, %83 ], [ %74, %73 ]
  call void @_ZN4juce17GenericScopedLockINS_15CriticalSectionEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  resume { ptr, i32 } %.pn
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4juce14AudioThumbnail9ThumbData7getSizeEv(ptr noundef nonnull align 8 dereferenceable(28)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN4juce14AudioThumbnail11MinMaxValue5writeERNS_12OutputStreamE(ptr noundef nonnull align 1 dereferenceable(2), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 #4 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !21, i64 120}
!9 = !{!"_ZTSN4juce14AudioThumbnailE", !10, i64 0, !15, i64 64, !15, i64 72, !23, i64 80, !24, i64 88, !25, i64 96, !21, i64 120, !28, i64 128, !28, i64 136, !21, i64 144, !29, i64 152, !30, i64 160}
!10 = !{!"_ZTSN4juce18AudioThumbnailBaseE", !11, i64 0, !22, i64 56}
!11 = !{!"_ZTSN4juce17ChangeBroadcasterE", !12, i64 8, !17, i64 32}
!12 = !{!"_ZTSN4juce17ChangeBroadcaster25ChangeBroadcasterCallbackE", !13, i64 0, !15, i64 16}
!13 = !{!"_ZTSN4juce12AsyncUpdaterE", !14, i64 8}
!14 = !{!"_ZTSN4juce25ReferenceCountedObjectPtrINS_12AsyncUpdater19AsyncUpdaterMessageEEE", !15, i64 0}
!15 = !{!"any pointer", !16, i64 0}
!16 = !{!"omnipotent char", !7, i64 0}
!17 = !{!"_ZTSN4juce12ListenerListINS_14ChangeListenerENS_5ArrayIPS1_NS_20DummyCriticalSectionELi0EEEEE", !18, i64 0}
!18 = !{!"_ZTSN4juce5ArrayIPNS_14ChangeListenerENS_20DummyCriticalSectionELi0EEE", !19, i64 0, !21, i64 16}
!19 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_14ChangeListenerENS_20DummyCriticalSectionEEE", !20, i64 0, !21, i64 8}
!20 = !{!"_ZTSN4juce9HeapBlockIPNS_14ChangeListenerELb0EEE", !15, i64 0}
!21 = !{!"int", !16, i64 0}
!22 = !{!"_ZTSN4juce17AudioFormatWriter14ThreadedWriter20IncomingDataReceiverE"}
!23 = !{!"_ZTSN4juce13ScopedPointerINS_14AudioThumbnail15LevelDataSourceEEE", !15, i64 0}
!24 = !{!"_ZTSN4juce13ScopedPointerINS_14AudioThumbnail12CachedWindowEEE", !15, i64 0}
!25 = !{!"_ZTSN4juce10OwnedArrayINS_14AudioThumbnail9ThumbDataENS_20DummyCriticalSectionEEE", !26, i64 0, !21, i64 16}
!26 = !{!"_ZTSN4juce19ArrayAllocationBaseIPNS_14AudioThumbnail9ThumbDataENS_20DummyCriticalSectionEEE", !27, i64 0, !21, i64 8}
!27 = !{!"_ZTSN4juce9HeapBlockIPNS_14AudioThumbnail9ThumbDataELb0EEE", !15, i64 0}
!28 = !{!"long long", !16, i64 0}
!29 = !{!"double", !16, i64 0}
!30 = !{!"_ZTSN4juce15CriticalSectionE", !16, i64 0}
!31 = !{!9, !28, i64 128}
!32 = !{!9, !28, i64 136}
!33 = !{!9, !21, i64 144}
!34 = !{!9, !29, i64 152}
!35 = distinct !{!35, !36, !37}
!36 = !{!"llvm.loop.mustprogress"}
!37 = !{!"llvm.loop.unswitch.partial.disable"}
!38 = distinct !{!38, !36}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass