; LLVM IR from erwincoumans/tiny-differentiable-simulator :: third_party/tiny_audio/b3SoundSource.ll (ZN13b3SoundSource14computeSamplesEPdid)

; 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.b3SoundSource = type { ptr, ptr }
%struct.b3SoundSourceInternalData = type { [2 x %struct.b3SoundOscillator], %class.b3ADSR, ptr, ptr }
%struct.b3SoundOscillator = type { i32, double, double, double, %struct.b3WavTicker }
%struct.b3WavTicker = type <{ %"class.std::vector", i8, [7 x i8], double, double, double, double, double, i32, [4 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.b3ADSR = type <{ ptr, i32, [4 x i8], double, double, double, double, double, double, double, i8, [7 x i8] }>

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN13b3SoundSource14computeSamplesEPdid(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef %1, i32 noundef %2, double noundef %3) unnamed_addr #0 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca double, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca [2 x double], align 16
  %14 = alloca double, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca double, align 8
  %18 = alloca double, align 8
  %19 = alloca i32, align 4
  %20 = alloca double, align 8
  %21 = alloca double, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  store double %3, ptr %8, align 8, !tbaa !11
  %22 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %23, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %24

24:                                               ; preds = %164, %4
  %25 = load i32, ptr %11, align 4, !tbaa !9
  %26 = load i32, ptr %7, align 4, !tbaa !9
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %29, label %28

28:                                               ; preds = %24
  store i32 2, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %167

29:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #6
  call void @llvm.memset.p0.i64(ptr align 16 %13, i8 0, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %30 = getelementptr inbounds %class.b3SoundSource, ptr %22, i32 0, i32 1
  %31 = load ptr, ptr %30, align 8, !tbaa !13
  %32 = getelementptr inbounds %struct.b3SoundSourceInternalData, ptr %31, i32 0, i32 1
  %33 = call noundef double @_ZN6b3ADSR4tickEv(ptr noundef nonnull align 8 dereferenceable(73) %32)
  store double %33, ptr %14, align 8, !tbaa !11
  %34 = load double, ptr %14, align 8, !tbaa !11
  %35 = fcmp une double %34, 0.000000e+00
  br i1 %35, label %36, label %119

36:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %37

37:                                               ; preds = %115, %36
  %38 = load i32, ptr %15, align 4, !tbaa !9
  %39 = icmp slt i32 %38, 2
  br i1 %39, label %41, label %40

40:                                               ; preds = %37
  store i32 5, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %118

41:                                               ; preds = %37
  %42 = getelementptr inbounds %class.b3SoundSource, ptr %22, i32 0, i32 1
  %43 = load ptr, ptr %42, align 8, !tbaa !13
  %44 = getelementptr inbounds %struct.b3SoundSourceInternalData, ptr %43, i32 0, i32 0
  %45 = load i32, ptr %15, align 4, !tbaa !9
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [2 x %struct.b3SoundOscillator], ptr %44, i64 0, i64 %46
  %48 = getelementptr inbounds %struct.b3SoundOscillator, ptr %47, i32 0, i32 0
  %49 = load i32, ptr %48, align 8, !tbaa !15
  %50 = icmp eq i32 %49, 0
  br i1 %50, label %51, label %68

51:                                               ; preds = %41
  %52 = load double, ptr %14, align 8, !tbaa !11
  %53 = getelementptr inbounds %class.b3SoundSource, ptr %22, i32 0, i32 1
  %54 = load ptr, ptr %53, align 8, !tbaa !13
  %55 = getelementptr inbounds %struct.b3SoundSourceInternalData, ptr %54, i32 0, i32 0
  %56 = load i32, ptr %15, align 4, !tbaa !9
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [2 x %struct.b3SoundOscillator], ptr %55, i64 0, i64 %57
  %59 = load double, ptr %8, align 8, !tbaa !11
  %60 = call noundef double @_ZN17b3SoundOscillator18sampleSineWaveFormEd(ptr noundef nonnull align 8 dereferenceable(112) %58, double noundef %59)
  %61 = load i32, ptr %15, align 4, !tbaa !9
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [2 x double], ptr %13, i64 0, i64 %62
  %64 = load double, ptr %63, align 8, !tbaa !11
  %65 = call double @llvm.fmuladd.f64(double %52, double %60, double %64)
  store double %65, ptr %63, align 8, !tbaa !11
  %66 = load i32, ptr %10, align 4, !tbaa !9
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %10, align 4, !tbaa !9
  br label %68

68:                                               ; preds = %51, %41
  %69 = getelementptr inbounds %class.b3SoundSource, ptr %22, i32 0, i32 1
  %70 = load ptr, ptr %69, align 8, !tbaa !13
  %71 = getelementptr inbounds %struct.b3SoundSourceInternalData, ptr %70, i32 0, i32 0
  %72 = load i32, ptr %15, align 4, !tbaa !9
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [2 x %struct.b3SoundOscillator], ptr %71, i64 0, i64 %73
  %75 = getelementptr inbounds %struct.b3SoundOscillator, ptr %74, i32 0, i32 0
  %76 = load i32, ptr %75, align 8, !tbaa !15
  %77 = icmp eq i32 %76, 1
  br i1 %77, label %78, label %95

78:                                               ; preds = %68
  %79 = load double, ptr %14, align 8, !tbaa !11
  %80 = getelementptr inbounds %class.b3SoundSource, ptr %22, i32 0, i32 1
  %81 = load ptr, ptr %80, align 8, !tbaa !13
  %82 = getelementptr inbounds %struct.b3SoundSourceInternalData, ptr %81, i32 0, i32 0
  %83 = load i32, ptr %15, align 4, !tbaa !9
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [2 x %struct.b3SoundOscillator], ptr %82, i64 0, i64 %84
  %86 = load double, ptr %8, align 8, !tbaa !11
  %87 = call noundef double @_ZN17b3SoundOscillator17sampleSawWaveFormEd(ptr noundef nonnull align 8 dereferenceable(112) %85, double noundef %86)
  %88 = load i32, ptr %15, align 4, !tbaa !9
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [2 x double], ptr %13, i64 0, i64 %89
  %91 = load double, ptr %90, align 8, !tbaa !11
  %92 = call double @llvm.fmuladd.f64(double %79, double %87, double %91)
  store double %92, ptr %90, align 8, !tbaa !11
  %93 = load i32, ptr %10, align 4, !tbaa !9
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %10, align 4, !tbaa !9
  br label %95

95:                                               ; preds = %78, %68
  %96 = getelementptr inbounds %class.b3SoundSource, ptr %22, i32 0, i32 1
  %97 = load ptr, ptr %96, align 8, !tbaa !13
  %98 = getelementptr inbounds %struct.b3SoundSourceInternalData, ptr %97, i32 0, i32 0
  %99 = load i32, ptr %15, align 4, !tbaa !9
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [2 x %struct.b3SoundOscillator], ptr %98, i64 0, i64 %100
  %102 = getelementptr inbounds %struct.b3SoundOscillator, ptr %101, i32 0, i32 0
  %103 = load i32, ptr %102, align 8, !tbaa !15
  %104 = icmp eq i32 %103, 128
  br i1 %104, label %105, label %114

105:                                              ; preds = %95
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 0, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  store double 1.000000e+00, ptr %17, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  store double 0.000000e+00, ptr %18, align 8, !tbaa !11
  %106 = load double, ptr %18, align 8, !tbaa !11
  %107 = load i32, ptr %15, align 4, !tbaa !9
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [2 x double], ptr %13, i64 0, i64 %108
  %110 = load double, ptr %109, align 8, !tbaa !11
  %111 = fadd double %110, %106
  store double %111, ptr %109, align 8, !tbaa !11
  %112 = load i32, ptr %10, align 4, !tbaa !9
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %114

114:                                              ; preds = %105, %95
  br label %115

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

118:                                              ; preds = %40
  br label %148

119:                                              ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %120

120:                                              ; preds = %144, %119
  %121 = load i32, ptr %19, align 4, !tbaa !9
  %122 = icmp slt i32 %121, 2
  br i1 %122, label %124, label %123

123:                                              ; preds = %120
  store i32 8, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %147

124:                                              ; preds = %120
  %125 = getelementptr inbounds %class.b3SoundSource, ptr %22, i32 0, i32 1
  %126 = load ptr, ptr %125, align 8, !tbaa !13
  %127 = getelementptr inbounds %struct.b3SoundSourceInternalData, ptr %126, i32 0, i32 0
  %128 = load i32, ptr %19, align 4, !tbaa !9
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [2 x %struct.b3SoundOscillator], ptr %127, i64 0, i64 %129
  %131 = getelementptr inbounds %struct.b3SoundOscillator, ptr %130, i32 0, i32 0
  %132 = load i32, ptr %131, align 8, !tbaa !15
  %133 = icmp eq i32 %132, 128
  br i1 %133, label %134, label %143

134:                                              ; preds = %124
  %135 = getelementptr inbounds %class.b3SoundSource, ptr %22, i32 0, i32 1
  %136 = load ptr, ptr %135, align 8, !tbaa !13
  %137 = getelementptr inbounds %struct.b3SoundSourceInternalData, ptr %136, i32 0, i32 0
  %138 = load i32, ptr %19, align 4, !tbaa !9
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [2 x %struct.b3SoundOscillator], ptr %137, i64 0, i64 %139
  %141 = getelementptr inbounds %struct.b3SoundOscillator, ptr %140, i32 0, i32 4
  %142 = getelementptr inbounds %struct.b3WavTicker, ptr %141, i32 0, i32 1
  store i8 1, ptr %142, align 8, !tbaa !25
  br label %143

143:                                              ; preds = %134, %124
  br label %144

144:                                              ; preds = %143
  %145 = load i32, ptr %19, align 4, !tbaa !9
  %146 = add nsw i32 %145, 1
  store i32 %146, ptr %19, align 4, !tbaa !9
  br label %120, !llvm.loop !26

147:                                              ; preds = %123
  br label %148

148:                                              ; preds = %147, %118
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  %149 = getelementptr inbounds [2 x double], ptr %13, i64 0, i64 0
  %150 = load double, ptr %149, align 16, !tbaa !11
  store double %150, ptr %20, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %151 = getelementptr inbounds [2 x double], ptr %13, i64 0, i64 1
  %152 = load double, ptr %151, align 8, !tbaa !11
  store double %152, ptr %21, align 8, !tbaa !11
  %153 = load double, ptr %20, align 8, !tbaa !11
  %154 = load double, ptr %21, align 8, !tbaa !11
  %155 = fcmp une double %153, %154
  br i1 %155, label %156, label %157

156:                                              ; preds = %148
  br label %157

157:                                              ; preds = %156, %148
  %158 = load double, ptr %21, align 8, !tbaa !11
  %159 = load ptr, ptr %9, align 8, !tbaa !5
  %160 = getelementptr inbounds double, ptr %159, i32 1
  store ptr %160, ptr %9, align 8, !tbaa !5
  store double %158, ptr %159, align 8, !tbaa !11
  %161 = load double, ptr %20, align 8, !tbaa !11
  %162 = load ptr, ptr %9, align 8, !tbaa !5
  %163 = getelementptr inbounds double, ptr %162, i32 1
  store ptr %163, ptr %9, align 8, !tbaa !5
  store double %161, ptr %162, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #6
  br label %164

164:                                              ; preds = %157
  %165 = load i32, ptr %11, align 4, !tbaa !9
  %166 = add nsw i32 %165, 1
  store i32 %166, ptr %11, align 4, !tbaa !9
  br label %24, !llvm.loop !27

167:                                              ; preds = %28
  %168 = load i32, ptr %10, align 4, !tbaa !9
  %169 = icmp sgt i32 %168, 0
  store i32 1, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  ret i1 %169
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

declare noundef double @_ZN6b3ADSR4tickEv(ptr noundef nonnull align 8 dereferenceable(73)) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZN17b3SoundOscillator18sampleSineWaveFormEd(ptr noundef nonnull align 8 dereferenceable(112), double noundef) #4 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZN17b3SoundOscillator17sampleSawWaveFormEd(ptr noundef nonnull align 8 dereferenceable(112), double noundef) #4 align 2

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !6, i64 8}
!14 = !{!"_ZTS13b3SoundSource", !6, i64 8}
!15 = !{!16, !10, i64 0}
!16 = !{!"_ZTS17b3SoundOscillator", !10, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !17, i64 32}
!17 = !{!"_ZTS11b3WavTicker", !18, i64 0, !22, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !10, i64 72}
!18 = !{!"_ZTSSt6vectorIdSaIdEE", !19, i64 0}
!19 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!22 = !{!"bool", !7, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!16, !22, i64 56}
!26 = distinct !{!26, !24}
!27 = distinct !{!27, !24}


; 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"

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN13b3SoundSource14computeSamplesEPdid(ptr nocapture noundef nonnull readonly align 8 dereferenceable(16) %0, ptr nocapture noundef writeonly %1, i32 noundef %2, double noundef %3) unnamed_addr #0 align 2 {
  %5 = icmp sgt i32 %2, 0
  br i1 %5, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %4
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %.pre = load ptr, ptr %6, align 8, !tbaa !5
  br label %8

._crit_edge.loopexit:                             ; preds = %.loopexit
  %7 = icmp sgt i32 %.5, 0
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %4
  %.034.lcssa = phi i1 [ false, %4 ], [ %7, %._crit_edge.loopexit ]
  ret i1 %.034.lcssa

8:                                                ; preds = %.lr.ph, %.loopexit
  %9 = phi ptr [ %.pre, %.lr.ph ], [ %65, %.loopexit ]
  %.046 = phi ptr [ %1, %.lr.ph ], [ %67, %.loopexit ]
  %.03445 = phi i32 [ 0, %.lr.ph ], [ %.5, %.loopexit ]
  %.03644 = phi i32 [ 0, %.lr.ph ], [ %68, %.loopexit ]
  %10 = getelementptr inbounds i8, ptr %9, i64 224
  %11 = tail call noundef double @_ZN6b3ADSR4tickEv(ptr noundef nonnull align 8 dereferenceable(73) %10)
  %12 = fcmp une double %11, 0.000000e+00
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = load i32, ptr %13, align 8, !tbaa !10
  br i1 %12, label %.preheader.preheader, label %.preheader39

.preheader.preheader:                             ; preds = %8
  %15 = icmp eq i32 %14, 0
  br i1 %15, label %17, label %21

.preheader39:                                     ; preds = %8
  %16 = icmp eq i32 %14, 128
  br i1 %16, label %57, label %59

17:                                               ; preds = %.preheader.preheader
  %18 = tail call noundef double @_ZN17b3SoundOscillator18sampleSineWaveFormEd(ptr noundef nonnull align 8 dereferenceable(112) %13, double noundef %3)
  %19 = tail call double @llvm.fmuladd.f64(double %11, double %18, double 0.000000e+00)
  %20 = add nsw i32 %.03445, 1
  %.pre56 = load ptr, ptr %6, align 8, !tbaa !5
  %.pre57 = load i32, ptr %.pre56, align 8, !tbaa !10
  br label %21

21:                                               ; preds = %17, %.preheader.preheader
  %22 = phi i32 [ %.pre57, %17 ], [ %14, %.preheader.preheader ]
  %23 = phi ptr [ %.pre56, %17 ], [ %13, %.preheader.preheader ]
  %.sroa.0.1 = phi double [ %19, %17 ], [ 0.000000e+00, %.preheader.preheader ]
  %.2 = phi i32 [ %20, %17 ], [ %.03445, %.preheader.preheader ]
  %24 = icmp eq i32 %22, 1
  br i1 %24, label %25, label %.preheader.1

25:                                               ; preds = %21
  %26 = tail call noundef double @_ZN17b3SoundOscillator17sampleSawWaveFormEd(ptr noundef nonnull align 8 dereferenceable(112) %23, double noundef %3)
  %27 = tail call double @llvm.fmuladd.f64(double %11, double %26, double %.sroa.0.1)
  %28 = add nsw i32 %.2, 1
  %.pre58 = load ptr, ptr %6, align 8, !tbaa !5
  %.pre59 = load i32, ptr %.pre58, align 8, !tbaa !10
  br label %.preheader.1

.preheader.1:                                     ; preds = %25, %21
  %29 = phi i32 [ %.pre59, %25 ], [ %22, %21 ]
  %30 = phi ptr [ %.pre58, %25 ], [ %23, %21 ]
  %.sroa.0.2 = phi double [ %27, %25 ], [ %.sroa.0.1, %21 ]
  %.3 = phi i32 [ %28, %25 ], [ %.2, %21 ]
  %31 = icmp eq i32 %29, 128
  %32 = fadd double %.sroa.0.2, 0.000000e+00
  %.sroa.0.3 = select i1 %31, double %32, double %.sroa.0.2
  %33 = zext i1 %31 to i32
  %.4 = add nsw i32 %.3, %33
  %34 = getelementptr inbounds i8, ptr %30, i64 112
  %35 = load i32, ptr %34, align 8, !tbaa !10
  %36 = icmp eq i32 %35, 0
  br i1 %36, label %37, label %41

37:                                               ; preds = %.preheader.1
  %38 = tail call noundef double @_ZN17b3SoundOscillator18sampleSineWaveFormEd(ptr noundef nonnull align 8 dereferenceable(112) %34, double noundef %3)
  %39 = tail call double @llvm.fmuladd.f64(double %11, double %38, double 0.000000e+00)
  %40 = add nsw i32 %.4, 1
  %.pre60 = load ptr, ptr %6, align 8, !tbaa !5
  %.phi.trans.insert = getelementptr inbounds i8, ptr %.pre60, i64 112
  %.pre61 = load i32, ptr %.phi.trans.insert, align 8, !tbaa !10
  br label %41

41:                                               ; preds = %37, %.preheader.1
  %42 = phi i32 [ %.pre61, %37 ], [ %35, %.preheader.1 ]
  %43 = phi ptr [ %.pre60, %37 ], [ %30, %.preheader.1 ]
  %.sroa.10.1 = phi double [ %39, %37 ], [ 0.000000e+00, %.preheader.1 ]
  %.2.1 = phi i32 [ %40, %37 ], [ %.4, %.preheader.1 ]
  %44 = icmp eq i32 %42, 1
  br i1 %44, label %45, label %50

45:                                               ; preds = %41
  %46 = getelementptr inbounds i8, ptr %43, i64 112
  %47 = tail call noundef double @_ZN17b3SoundOscillator17sampleSawWaveFormEd(ptr noundef nonnull align 8 dereferenceable(112) %46, double noundef %3)
  %48 = tail call double @llvm.fmuladd.f64(double %11, double %47, double %.sroa.10.1)
  %49 = add nsw i32 %.2.1, 1
  %.pre62 = load ptr, ptr %6, align 8, !tbaa !5
  %.phi.trans.insert63 = getelementptr inbounds i8, ptr %.pre62, i64 112
  %.pre64 = load i32, ptr %.phi.trans.insert63, align 8, !tbaa !10
  br label %50

50:                                               ; preds = %45, %41
  %51 = phi i32 [ %.pre64, %45 ], [ %42, %41 ]
  %52 = phi ptr [ %.pre62, %45 ], [ %43, %41 ]
  %.sroa.10.2 = phi double [ %48, %45 ], [ %.sroa.10.1, %41 ]
  %.3.1 = phi i32 [ %49, %45 ], [ %.2.1, %41 ]
  %53 = icmp eq i32 %51, 128
  br i1 %53, label %54, label %.loopexit

54:                                               ; preds = %50
  %55 = fadd double %.sroa.10.2, 0.000000e+00
  %56 = add nsw i32 %.3.1, 1
  br label %.loopexit

57:                                               ; preds = %.preheader39
  %58 = getelementptr inbounds i8, ptr %13, i64 56
  store i8 1, ptr %58, align 8, !tbaa !20
  br label %59

59:                                               ; preds = %.preheader39, %57
  %60 = getelementptr inbounds i8, ptr %13, i64 112
  %61 = load i32, ptr %60, align 8, !tbaa !10
  %62 = icmp eq i32 %61, 128
  br i1 %62, label %63, label %.loopexit

63:                                               ; preds = %59
  %64 = getelementptr inbounds i8, ptr %13, i64 168
  store i8 1, ptr %64, align 8, !tbaa !20
  br label %.loopexit

.loopexit:                                        ; preds = %59, %63, %50, %54
  %65 = phi ptr [ %52, %54 ], [ %52, %50 ], [ %13, %63 ], [ %13, %59 ]
  %.sroa.0.4 = phi double [ %.sroa.0.3, %54 ], [ %.sroa.0.3, %50 ], [ 0.000000e+00, %63 ], [ 0.000000e+00, %59 ]
  %.sroa.10.4 = phi double [ %55, %54 ], [ %.sroa.10.2, %50 ], [ 0.000000e+00, %63 ], [ 0.000000e+00, %59 ]
  %.5 = phi i32 [ %56, %54 ], [ %.3.1, %50 ], [ %.03445, %63 ], [ %.03445, %59 ]
  %66 = getelementptr inbounds i8, ptr %.046, i64 8
  store double %.sroa.10.4, ptr %.046, align 8, !tbaa !21
  %67 = getelementptr inbounds i8, ptr %.046, i64 16
  store double %.sroa.0.4, ptr %66, align 8, !tbaa !21
  %68 = add nuw nsw i32 %.03644, 1
  %exitcond.not = icmp eq i32 %68, %2
  br i1 %exitcond.not, label %._crit_edge.loopexit, label %8, !llvm.loop !22
}

declare noundef double @_ZN6b3ADSR4tickEv(ptr noundef nonnull align 8 dereferenceable(73)) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZN17b3SoundOscillator18sampleSineWaveFormEd(ptr noundef nonnull align 8 dereferenceable(112), double noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZN17b3SoundOscillator17sampleSawWaveFormEd(ptr noundef nonnull align 8 dereferenceable(112), double noundef) local_unnamed_addr #2 align 2

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 8}
!6 = !{!"_ZTS13b3SoundSource", !7, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !12, i64 0}
!11 = !{!"_ZTS17b3SoundOscillator", !12, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !14, i64 32}
!12 = !{!"int", !8, i64 0}
!13 = !{!"double", !8, i64 0}
!14 = !{!"_ZTS11b3WavTicker", !15, i64 0, !19, i64 24, !13, i64 32, !13, i64 40, !13, i64 48, !13, i64 56, !13, i64 64, !12, i64 72}
!15 = !{!"_ZTSSt6vectorIdSaIdEE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!19 = !{!"bool", !8, i64 0}
!20 = !{!11, !19, i64 56}
!21 = !{!13, !13, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}


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