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

; 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::BufferingAudioSource" = type <{ %"class.juce::PositionableAudioSource", %"class.juce::TimeSliceClient", %"class.juce::OptionalScopedPointer", ptr, i32, i32, %"class.juce::AudioBuffer", %"class.juce::CriticalSection", %"class.juce::WaitableEvent", i64, i64, i64, double, i8, i8, i8, [5 x i8] }>
%"class.juce::PositionableAudioSource" = type { %"class.juce::AudioSource" }
%"class.juce::AudioSource" = type { ptr }
%"class.juce::TimeSliceClient" = type { ptr, %"class.juce::Time" }
%"class.juce::Time" = type { i64 }
%"class.juce::OptionalScopedPointer" = type <{ %"class.juce::ScopedPointer.79", i8, [7 x i8] }>
%"class.juce::ScopedPointer.79" = type { ptr }
%"class.juce::AudioBuffer" = type <{ i32, i32, i64, ptr, %"class.juce::HeapBlock.0", [32 x ptr], i8, [7 x i8] }>
%"class.juce::HeapBlock.0" = 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 }
%"class.juce::WaitableEvent" = type <{ %union.pthread_cond_t, %union.pthread_mutex_t, i8, i8, [6 x i8] }>
%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 }

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.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

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_15CriticalSectionEED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4juce20BufferingAudioSource19readNextBufferChunkEv(ptr noundef nonnull align 8 dereferenceable(523) %0) #3 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 i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca %"class.juce::GenericScopedLock", align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca %"class.juce::GenericScopedLock", align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %17 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %18 = getelementptr inbounds %"class.juce::BufferingAudioSource", ptr %17, i32 0, i32 7
  call void @_ZN4juce17GenericScopedLockINS_15CriticalSectionEEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(40) %18) #6
  %19 = getelementptr inbounds %"class.juce::BufferingAudioSource", ptr %17, i32 0, i32 13
  %20 = load i8, ptr %19, align 8, !tbaa !9, !range !26, !noundef !27
  %21 = trunc i8 %20 to i1
  %22 = zext i1 %21 to i32
  %23 = load ptr, ptr %17, align 8, !tbaa !28
  %24 = getelementptr inbounds ptr, ptr %23, i64 8
  %25 = load ptr, ptr %24, align 8
  %26 = invoke noundef zeroext i1 %25(ptr noundef nonnull align 8 dereferenceable(523) %17)
          to label %27 unwind label %40

27:                                               ; preds = %1
  %28 = zext i1 %26 to i32
  %29 = icmp ne i32 %22, %28
  br i1 %29, label %30, label %44

30:                                               ; preds = %27
  %31 = load ptr, ptr %17, align 8, !tbaa !28
  %32 = getelementptr inbounds ptr, ptr %31, i64 8
  %33 = load ptr, ptr %32, align 8
  %34 = invoke noundef zeroext i1 %33(ptr noundef nonnull align 8 dereferenceable(523) %17)
          to label %35 unwind label %40

35:                                               ; preds = %30
  %36 = getelementptr inbounds %"class.juce::BufferingAudioSource", ptr %17, i32 0, i32 13
  %37 = zext i1 %34 to i8
  store i8 %37, ptr %36, align 8, !tbaa !9
  %38 = getelementptr inbounds %"class.juce::BufferingAudioSource", ptr %17, i32 0, i32 9
  store volatile i64 0, ptr %38, align 8, !tbaa !30
  %39 = getelementptr inbounds %"class.juce::BufferingAudioSource", ptr %17, i32 0, i32 10
  store volatile i64 0, ptr %39, align 8, !tbaa !31
  br label %44

40:                                               ; preds = %44, %30, %1
  %41 = landingpad { ptr, i32 }
          cleanup
  %42 = extractvalue { ptr, i32 } %41, 0
  store ptr %42, ptr %9, align 8
  %43 = extractvalue { ptr, i32 } %41, 1
  store i32 %43, ptr %10, align 4
  br label %118

44:                                               ; preds = %35, %27
  %45 = getelementptr inbounds %"class.juce::BufferingAudioSource", ptr %17, i32 0, i32 11
  %46 = load volatile i64, ptr %45, align 8, !tbaa !32
  %47 = invoke noundef i64 @_ZN4juce4jmaxIxEET_S1_S1_(i64 noundef 0, i64 noundef %46)
          to label %48 unwind label %40

48:                                               ; preds = %44
  store i64 %47, ptr %4, align 8, !tbaa !33
  %49 = load i64, ptr %4, align 8, !tbaa !33
  %50 = getelementptr inbounds %"class.juce::BufferingAudioSource", ptr %17, i32 0, i32 6
  %51 = call noundef i32 @_ZNK4juce11AudioBufferIfE13getNumSamplesEv(ptr noundef nonnull align 8 dereferenceable(289) %50) #6
  %52 = sext i32 %51 to i64
  %53 = add nsw i64 %49, %52
  %54 = sub nsw i64 %53, 4
  store i64 %54, ptr %5, align 8, !tbaa !33
  store i64 0, ptr %6, align 8, !tbaa !33
  store i64 0, ptr %7, align 8, !tbaa !33
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 2048, ptr %11, align 4, !tbaa !34
  %55 = load i64, ptr %4, align 8, !tbaa !33
  %56 = getelementptr inbounds %"class.juce::BufferingAudioSource", ptr %17, i32 0, i32 9
  %57 = load volatile i64, ptr %56, align 8, !tbaa !30
  %58 = icmp slt i64 %55, %57
  br i1 %58, label %64, label %59

59:                                               ; preds = %48
  %60 = load i64, ptr %4, align 8, !tbaa !33
  %61 = getelementptr inbounds %"class.juce::BufferingAudioSource", ptr %17, i32 0, i32 10
  %62 = load volatile i64, ptr %61, align 8, !tbaa !31
  %63 = icmp sge i64 %60, %62
  br i1 %63, label %64, label %78

64:                                               ; preds = %59, %48
  %65 = load i64, ptr %5, align 8, !tbaa !33
  %66 = load i64, ptr %4, align 8, !tbaa !33
  %67 = add nsw i64 %66, 2048
  %68 = invoke noundef i64 @_ZN4juce4jminIxEET_S1_S1_(i64 noundef %65, i64 noundef %67)
          to label %69 unwind label %74

69:                                               ; preds = %64
  store i64 %68, ptr %5, align 8, !tbaa !33
  %70 = load i64, ptr %4, align 8, !tbaa !33
  store i64 %70, ptr %6, align 8, !tbaa !33
  %71 = load i64, ptr %5, align 8, !tbaa !33
  store i64 %71, ptr %7, align 8, !tbaa !33
  %72 = getelementptr inbounds %"class.juce::BufferingAudioSource", ptr %17, i32 0, i32 9
  store volatile i64 0, ptr %72, align 8, !tbaa !30
  %73 = getelementptr inbounds %"class.juce::BufferingAudioSource", ptr %17, i32 0, i32 10
  store volatile i64 0, ptr %73, align 8, !tbaa !31
  br label %113

74:                                               ; preds = %100, %94, %64
  %75 = landingpad { ptr, i32 }
          cleanup
  %76 = extractvalue { ptr, i32 } %75, 0
  store ptr %76, ptr %9, align 8
  %77 = extractvalue { ptr, i32 } %75, 1
  store i32 %77, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %118

78:                                               ; preds = %59
  %79 = load i64, ptr %4, align 8, !tbaa !33
  %80 = getelementptr inbounds %"class.juce::BufferingAudioSource", ptr %17, i32 0, i32 9
  %81 = load volatile i64, ptr %80, align 8, !tbaa !30
  %82 = sub nsw i64 %79, %81
  %83 = trunc i64 %82 to i32
  %84 = call i32 @llvm.abs.i32(i32 %83, i1 true)
  %85 = icmp sgt i32 %84, 512
  br i1 %85, label %94, label %86

86:                                               ; preds = %78
  %87 = load i64, ptr %5, align 8, !tbaa !33
  %88 = getelementptr inbounds %"class.juce::BufferingAudioSource", ptr %17, i32 0, i32 10
  %89 = load volatile i64, ptr %88, align 8, !tbaa !31
  %90 = sub nsw i64 %87, %89
  %91 = trunc i64 %90 to i32
  %92 = call i32 @llvm.abs.i32(i32 %91, i1 true)
  %93 = icmp sgt i32 %92, 512
  br i1 %93, label %94, label %112

94:                                               ; preds = %86, %78
  %95 = load i64, ptr %5, align 8, !tbaa !33
  %96 = getelementptr inbounds %"class.juce::BufferingAudioSource", ptr %17, i32 0, i32 10
  %97 = load volatile i64, ptr %96, align 8, !tbaa !31
  %98 = add nsw i64 %97, 2048
  %99 = invoke noundef i64 @_ZN4juce4jminIxEET_S1_S1_(i64 noundef %95, i64 noundef %98)
          to label %100 unwind label %74

100:                                              ; preds = %94
  store i64 %99, ptr %5, align 8, !tbaa !33
  %101 = getelementptr inbounds %"class.juce::BufferingAudioSource", ptr %17, i32 0, i32 10
  %102 = load volatile i64, ptr %101, align 8, !tbaa !31
  store i64 %102, ptr %6, align 8, !tbaa !33
  %103 = load i64, ptr %5, align 8, !tbaa !33
  store i64 %103, ptr %7, align 8, !tbaa !33
  %104 = load i64, ptr %4, align 8, !tbaa !33
  %105 = getelementptr inbounds %"class.juce::BufferingAudioSource", ptr %17, i32 0, i32 9
  store volatile i64 %104, ptr %105, align 8, !tbaa !30
  %106 = getelementptr inbounds %"class.juce::BufferingAudioSource", ptr %17, i32 0, i32 10
  %107 = load volatile i64, ptr %106, align 8, !tbaa !31
  %108 = load i64, ptr %5, align 8, !tbaa !33
  %109 = invoke noundef i64 @_ZN4juce4jminIxEET_S1_S1_(i64 noundef %107, i64 noundef %108)
          to label %110 unwind label %74

110:                                              ; preds = %100
  %111 = getelementptr inbounds %"class.juce::BufferingAudioSource", ptr %17, i32 0, i32 10
  store volatile i64 %109, ptr %111, align 8, !tbaa !31
  br label %112

112:                                              ; preds = %110, %86
  br label %113

113:                                              ; preds = %112, %69
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @_ZN4juce17GenericScopedLockINS_15CriticalSectionEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  %114 = load i64, ptr %6, align 8, !tbaa !33
  %115 = load i64, ptr %7, align 8, !tbaa !33
  %116 = icmp eq i64 %114, %115
  br i1 %116, label %117, label %119

117:                                              ; preds = %113
  store i1 false, ptr %2, align 1
  store i32 1, ptr %12, align 4
  br label %170

118:                                              ; preds = %74, %40
  call void @_ZN4juce17GenericScopedLockINS_15CriticalSectionEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  br label %172

119:                                              ; preds = %113
  br label %120

120:                                              ; preds = %119
  br label %121

121:                                              ; preds = %120
  br label %122

122:                                              ; preds = %121
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %123 = load i64, ptr %6, align 8, !tbaa !33
  %124 = getelementptr inbounds %"class.juce::BufferingAudioSource", ptr %17, i32 0, i32 6
  %125 = call noundef i32 @_ZNK4juce11AudioBufferIfE13getNumSamplesEv(ptr noundef nonnull align 8 dereferenceable(289) %124) #6
  %126 = sext i32 %125 to i64
  %127 = srem i64 %123, %126
  %128 = trunc i64 %127 to i32
  store i32 %128, ptr %13, align 4, !tbaa !34
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %129 = load i64, ptr %7, align 8, !tbaa !33
  %130 = getelementptr inbounds %"class.juce::BufferingAudioSource", ptr %17, i32 0, i32 6
  %131 = call noundef i32 @_ZNK4juce11AudioBufferIfE13getNumSamplesEv(ptr noundef nonnull align 8 dereferenceable(289) %130) #6
  %132 = sext i32 %131 to i64
  %133 = srem i64 %129, %132
  %134 = trunc i64 %133 to i32
  store i32 %134, ptr %14, align 4, !tbaa !34
  %135 = load i32, ptr %13, align 4, !tbaa !34
  %136 = load i32, ptr %14, align 4, !tbaa !34
  %137 = icmp slt i32 %135, %136
  br i1 %137, label %138, label %145

138:                                              ; preds = %122
  %139 = load i64, ptr %6, align 8, !tbaa !33
  %140 = load i64, ptr %7, align 8, !tbaa !33
  %141 = load i64, ptr %6, align 8, !tbaa !33
  %142 = sub nsw i64 %140, %141
  %143 = trunc i64 %142 to i32
  %144 = load i32, ptr %13, align 4, !tbaa !34
  call void @_ZN4juce20BufferingAudioSource17readBufferSectionExii(ptr noundef nonnull align 8 dereferenceable(523) %17, i64 noundef %139, i32 noundef %143, i32 noundef %144)
  br label %163

145:                                              ; preds = %122
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %146 = getelementptr inbounds %"class.juce::BufferingAudioSource", ptr %17, i32 0, i32 6
  %147 = call noundef i32 @_ZNK4juce11AudioBufferIfE13getNumSamplesEv(ptr noundef nonnull align 8 dereferenceable(289) %146) #6
  %148 = load i32, ptr %13, align 4, !tbaa !34
  %149 = sub nsw i32 %147, %148
  store i32 %149, ptr %15, align 4, !tbaa !34
  %150 = load i64, ptr %6, align 8, !tbaa !33
  %151 = load i32, ptr %15, align 4, !tbaa !34
  %152 = load i32, ptr %13, align 4, !tbaa !34
  call void @_ZN4juce20BufferingAudioSource17readBufferSectionExii(ptr noundef nonnull align 8 dereferenceable(523) %17, i64 noundef %150, i32 noundef %151, i32 noundef %152)
  %153 = load i64, ptr %6, align 8, !tbaa !33
  %154 = load i32, ptr %15, align 4, !tbaa !34
  %155 = sext i32 %154 to i64
  %156 = add nsw i64 %153, %155
  %157 = load i64, ptr %7, align 8, !tbaa !33
  %158 = load i64, ptr %6, align 8, !tbaa !33
  %159 = sub nsw i64 %157, %158
  %160 = trunc i64 %159 to i32
  %161 = load i32, ptr %15, align 4, !tbaa !34
  %162 = sub nsw i32 %160, %161
  call void @_ZN4juce20BufferingAudioSource17readBufferSectionExii(ptr noundef nonnull align 8 dereferenceable(523) %17, i64 noundef %156, i32 noundef %162, i32 noundef 0)
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %163

163:                                              ; preds = %145, %138
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %164 = getelementptr inbounds %"class.juce::BufferingAudioSource", ptr %17, i32 0, i32 7
  call void @_ZN4juce17GenericScopedLockINS_15CriticalSectionEEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(40) %164) #6
  %165 = load i64, ptr %4, align 8, !tbaa !33
  %166 = getelementptr inbounds %"class.juce::BufferingAudioSource", ptr %17, i32 0, i32 9
  store volatile i64 %165, ptr %166, align 8, !tbaa !30
  %167 = load i64, ptr %5, align 8, !tbaa !33
  %168 = getelementptr inbounds %"class.juce::BufferingAudioSource", ptr %17, i32 0, i32 10
  store volatile i64 %167, ptr %168, align 8, !tbaa !31
  call void @_ZN4juce17GenericScopedLockINS_15CriticalSectionEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  %169 = getelementptr inbounds %"class.juce::BufferingAudioSource", ptr %17, i32 0, i32 8
  call void @_ZNK4juce13WaitableEvent6signalEv(ptr noundef nonnull align 8 dereferenceable(90) %169) #6
  store i1 true, ptr %2, align 1
  store i32 1, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %170

170:                                              ; preds = %163, %117
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  %171 = load i1, ptr %2, align 1
  ret i1 %171

172:                                              ; preds = %118
  %173 = load ptr, ptr %9, align 8
  %174 = load i32, ptr %10, align 4
  %175 = insertvalue { ptr, i32 } poison, ptr %173, 0
  %176 = insertvalue { ptr, i32 } %175, i32 %174, 1
  resume { ptr, i32 } %176
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN4juce4jmaxIxEET_S1_S1_(i64 noundef, i64 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN4juce4jminIxEET_S1_S1_(i64 noundef, i64 noundef) #2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce20BufferingAudioSource17readBufferSectionExii(ptr noundef nonnull align 8 dereferenceable(523), i64 noundef, i32 noundef, i32 noundef) #3 align 2

; Function Attrs: nounwind
declare void @_ZNK4juce13WaitableEvent6signalEv(ptr noundef nonnull align 8 dereferenceable(90)) #5

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 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 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind "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 #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !18, i64 520}
!10 = !{!"_ZTSN4juce20BufferingAudioSourceE", !11, i64 0, !13, i64 8, !16, i64 24, !6, i64 40, !19, i64 48, !19, i64 52, !20, i64 56, !23, i64 352, !24, i64 392, !15, i64 488, !15, i64 496, !15, i64 504, !25, i64 512, !18, i64 520, !18, i64 521, !18, i64 522}
!11 = !{!"_ZTSN4juce23PositionableAudioSourceE", !12, i64 0}
!12 = !{!"_ZTSN4juce11AudioSourceE"}
!13 = !{!"_ZTSN4juce15TimeSliceClientE", !14, i64 8}
!14 = !{!"_ZTSN4juce4TimeE", !15, i64 0}
!15 = !{!"long long", !7, i64 0}
!16 = !{!"_ZTSN4juce21OptionalScopedPointerINS_23PositionableAudioSourceEEE", !17, i64 0, !18, i64 8}
!17 = !{!"_ZTSN4juce13ScopedPointerINS_23PositionableAudioSourceEEE", !6, i64 0}
!18 = !{!"bool", !7, i64 0}
!19 = !{!"int", !7, i64 0}
!20 = !{!"_ZTSN4juce11AudioBufferIfEE", !19, i64 0, !19, i64 4, !21, i64 8, !6, i64 16, !22, i64 24, !7, i64 32, !18, i64 288}
!21 = !{!"long", !7, i64 0}
!22 = !{!"_ZTSN4juce9HeapBlockIcLb1EEE", !6, i64 0}
!23 = !{!"_ZTSN4juce15CriticalSectionE", !7, i64 0}
!24 = !{!"_ZTSN4juce13WaitableEventE", !7, i64 0, !7, i64 48, !18, i64 88, !18, i64 89}
!25 = !{!"double", !7, i64 0}
!26 = !{i8 0, i8 2}
!27 = !{}
!28 = !{!29, !29, i64 0}
!29 = !{!"vtable pointer", !8, i64 0}
!30 = !{!10, !15, i64 488}
!31 = !{!10, !15, i64 496}
!32 = !{!10, !15, i64 504}
!33 = !{!15, !15, i64 0}
!34 = !{!19, !19, 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.juce::GenericScopedLock" = type { ptr }

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.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

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_15CriticalSectionEED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4juce20BufferingAudioSource19readNextBufferChunkEv(ptr noundef nonnull align 8 dereferenceable(523) %0) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.juce::GenericScopedLock", align 8
  %3 = alloca %"class.juce::GenericScopedLock", align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %4 = getelementptr inbounds i8, ptr %0, i64 352
  call void @_ZN4juce17GenericScopedLockINS_15CriticalSectionEEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(40) %4) #6
  %5 = getelementptr inbounds i8, ptr %0, i64 520
  %6 = load i8, ptr %5, align 8, !tbaa !5, !range !25, !noundef !26
  %7 = load ptr, ptr %0, align 8, !tbaa !27
  %8 = getelementptr inbounds i8, ptr %7, i64 64
  %9 = load ptr, ptr %8, align 8
  %10 = invoke noundef zeroext i1 %9(ptr noundef nonnull align 8 dereferenceable(523) %0)
          to label %11 unwind label %22

11:                                               ; preds = %1
  %12 = zext i1 %10 to i8
  %.not = icmp eq i8 %6, %12
  br i1 %.not, label %24, label %13

13:                                               ; preds = %11
  %14 = load ptr, ptr %0, align 8, !tbaa !27
  %15 = getelementptr inbounds i8, ptr %14, i64 64
  %16 = load ptr, ptr %15, align 8
  %17 = invoke noundef zeroext i1 %16(ptr noundef nonnull align 8 dereferenceable(523) %0)
          to label %18 unwind label %22

18:                                               ; preds = %13
  %19 = zext i1 %17 to i8
  store i8 %19, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %0, i64 488
  store volatile i64 0, ptr %20, align 8, !tbaa !29
  %21 = getelementptr inbounds i8, ptr %0, i64 496
  store volatile i64 0, ptr %21, align 8, !tbaa !30
  br label %24

22:                                               ; preds = %13, %1
  %23 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN4juce17GenericScopedLockINS_15CriticalSectionEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  resume { ptr, i32 } %23

24:                                               ; preds = %18, %11
  %25 = getelementptr inbounds i8, ptr %0, i64 504
  %26 = load volatile i64, ptr %25, align 8, !tbaa !31
  %27 = call noundef i64 @_ZN4juce4jmaxIxEET_S1_S1_(i64 noundef 0, i64 noundef %26)
  %28 = getelementptr inbounds i8, ptr %0, i64 56
  %29 = call noundef i32 @_ZNK4juce11AudioBufferIfE13getNumSamplesEv(ptr noundef nonnull align 8 dereferenceable(289) %28) #6
  %30 = sext i32 %29 to i64
  %31 = add i64 %27, -4
  %32 = add i64 %31, %30
  %33 = getelementptr inbounds i8, ptr %0, i64 488
  %34 = load volatile i64, ptr %33, align 8, !tbaa !29
  %35 = icmp slt i64 %27, %34
  br i1 %35, label %39, label %36

36:                                               ; preds = %24
  %37 = getelementptr inbounds i8, ptr %0, i64 496
  %38 = load volatile i64, ptr %37, align 8, !tbaa !30
  %.not42 = icmp slt i64 %27, %38
  br i1 %.not42, label %43, label %39

39:                                               ; preds = %36, %24
  %40 = add nsw i64 %27, 2048
  %41 = call noundef i64 @_ZN4juce4jminIxEET_S1_S1_(i64 noundef %32, i64 noundef %40)
  store volatile i64 0, ptr %33, align 8, !tbaa !29
  %42 = getelementptr inbounds i8, ptr %0, i64 496
  store volatile i64 0, ptr %42, align 8, !tbaa !30
  br label %62

43:                                               ; preds = %36
  %44 = load volatile i64, ptr %33, align 8, !tbaa !29
  %45 = sub nsw i64 %27, %44
  %46 = trunc i64 %45 to i32
  %47 = call i32 @llvm.abs.i32(i32 %46, i1 true)
  %48 = icmp ugt i32 %47, 512
  br i1 %48, label %55, label %49

49:                                               ; preds = %43
  %50 = load volatile i64, ptr %37, align 8, !tbaa !30
  %51 = sub nsw i64 %32, %50
  %52 = trunc i64 %51 to i32
  %53 = call i32 @llvm.abs.i32(i32 %52, i1 true)
  %54 = icmp ugt i32 %53, 512
  br i1 %54, label %55, label %.thread

.thread:                                          ; preds = %49
  call void @_ZN4juce17GenericScopedLockINS_15CriticalSectionEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  br label %86

55:                                               ; preds = %49, %43
  %56 = load volatile i64, ptr %37, align 8, !tbaa !30
  %57 = add nsw i64 %56, 2048
  %58 = call noundef i64 @_ZN4juce4jminIxEET_S1_S1_(i64 noundef %32, i64 noundef %57)
  %59 = load volatile i64, ptr %37, align 8, !tbaa !30
  store volatile i64 %27, ptr %33, align 8, !tbaa !29
  %60 = load volatile i64, ptr %37, align 8, !tbaa !30
  %61 = call noundef i64 @_ZN4juce4jminIxEET_S1_S1_(i64 noundef %60, i64 noundef %58)
  store volatile i64 %61, ptr %37, align 8, !tbaa !30
  br label %62

62:                                               ; preds = %55, %39
  %.039 = phi i64 [ %41, %39 ], [ %58, %55 ]
  %.038 = phi i64 [ %27, %39 ], [ %59, %55 ]
  call void @_ZN4juce17GenericScopedLockINS_15CriticalSectionEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  %.not46 = icmp eq i64 %.038, %.039
  br i1 %.not46, label %86, label %63

63:                                               ; preds = %62
  %64 = call noundef i32 @_ZNK4juce11AudioBufferIfE13getNumSamplesEv(ptr noundef nonnull align 8 dereferenceable(289) %28) #6
  %65 = sext i32 %64 to i64
  %66 = srem i64 %.038, %65
  %67 = trunc nsw i64 %66 to i32
  %68 = call noundef i32 @_ZNK4juce11AudioBufferIfE13getNumSamplesEv(ptr noundef nonnull align 8 dereferenceable(289) %28) #6
  %69 = sext i32 %68 to i64
  %70 = srem i64 %.039, %69
  %71 = icmp slt i64 %66, %70
  br i1 %71, label %72, label %75

72:                                               ; preds = %63
  %73 = sub nsw i64 %.039, %.038
  %74 = trunc i64 %73 to i32
  call void @_ZN4juce20BufferingAudioSource17readBufferSectionExii(ptr noundef nonnull align 8 dereferenceable(523) %0, i64 noundef %.038, i32 noundef %74, i32 noundef %67)
  br label %83

75:                                               ; preds = %63
  %76 = call noundef i32 @_ZNK4juce11AudioBufferIfE13getNumSamplesEv(ptr noundef nonnull align 8 dereferenceable(289) %28) #6
  %77 = sub nsw i32 %76, %67
  call void @_ZN4juce20BufferingAudioSource17readBufferSectionExii(ptr noundef nonnull align 8 dereferenceable(523) %0, i64 noundef %.038, i32 noundef %77, i32 noundef %67)
  %78 = sext i32 %77 to i64
  %79 = add nsw i64 %.038, %78
  %80 = sub nsw i64 %.039, %.038
  %81 = trunc i64 %80 to i32
  %82 = sub nsw i32 %81, %77
  call void @_ZN4juce20BufferingAudioSource17readBufferSectionExii(ptr noundef nonnull align 8 dereferenceable(523) %0, i64 noundef %79, i32 noundef %82, i32 noundef 0)
  br label %83

83:                                               ; preds = %75, %72
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  call void @_ZN4juce17GenericScopedLockINS_15CriticalSectionEEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(40) %4) #6
  store volatile i64 %27, ptr %33, align 8, !tbaa !29
  %84 = getelementptr inbounds i8, ptr %0, i64 496
  store volatile i64 %.039, ptr %84, align 8, !tbaa !30
  call void @_ZN4juce17GenericScopedLockINS_15CriticalSectionEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  %85 = getelementptr inbounds i8, ptr %0, i64 392
  call void @_ZNK4juce13WaitableEvent6signalEv(ptr noundef nonnull align 8 dereferenceable(90) %85) #6
  br label %86

86:                                               ; preds = %.thread, %62, %83
  %87 = phi i1 [ false, %.thread ], [ false, %62 ], [ true, %83 ]
  ret i1 %87
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN4juce4jmaxIxEET_S1_S1_(i64 noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN4juce4jminIxEET_S1_S1_(i64 noundef, i64 noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4juce20BufferingAudioSource17readBufferSectionExii(ptr noundef nonnull align 8 dereferenceable(523), i64 noundef, i32 noundef, i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: nounwind
declare void @_ZNK4juce13WaitableEvent6signalEv(ptr noundef nonnull align 8 dereferenceable(90)) local_unnamed_addr #5

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 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 = { 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 #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind "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 #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !17, i64 520}
!6 = !{!"_ZTSN4juce20BufferingAudioSourceE", !7, i64 0, !9, i64 8, !14, i64 24, !16, i64 40, !18, i64 48, !18, i64 52, !19, i64 56, !22, i64 352, !23, i64 392, !11, i64 488, !11, i64 496, !11, i64 504, !24, i64 512, !17, i64 520, !17, i64 521, !17, i64 522}
!7 = !{!"_ZTSN4juce23PositionableAudioSourceE", !8, i64 0}
!8 = !{!"_ZTSN4juce11AudioSourceE"}
!9 = !{!"_ZTSN4juce15TimeSliceClientE", !10, i64 8}
!10 = !{!"_ZTSN4juce4TimeE", !11, i64 0}
!11 = !{!"long long", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C++ TBAA"}
!14 = !{!"_ZTSN4juce21OptionalScopedPointerINS_23PositionableAudioSourceEEE", !15, i64 0, !17, i64 8}
!15 = !{!"_ZTSN4juce13ScopedPointerINS_23PositionableAudioSourceEEE", !16, i64 0}
!16 = !{!"any pointer", !12, i64 0}
!17 = !{!"bool", !12, i64 0}
!18 = !{!"int", !12, i64 0}
!19 = !{!"_ZTSN4juce11AudioBufferIfEE", !18, i64 0, !18, i64 4, !20, i64 8, !16, i64 16, !21, i64 24, !12, i64 32, !17, i64 288}
!20 = !{!"long", !12, i64 0}
!21 = !{!"_ZTSN4juce9HeapBlockIcLb1EEE", !16, i64 0}
!22 = !{!"_ZTSN4juce15CriticalSectionE", !12, i64 0}
!23 = !{!"_ZTSN4juce13WaitableEventE", !12, i64 0, !12, i64 48, !17, i64 88, !17, i64 89}
!24 = !{!"double", !12, i64 0}
!25 = !{i8 0, i8 2}
!26 = !{}
!27 = !{!28, !28, i64 0}
!28 = !{!"vtable pointer", !13, i64 0}
!29 = !{!6, !11, i64 488}
!30 = !{!6, !11, i64 496}
!31 = !{!6, !11, i64 504}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,ReassociatePass,SROAPass,SimplifyCFGPass