; LLVM IR from awawa-dev/HyperHDR :: sources/effects/Animation4Music_WavesPulse.ll (ZN26Animation4Music_WavesPulseC2Ev)

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

%struct.ColorRgb = type { i8, i8, i8 }
%class.Animation4Music_WavesPulse = type { %class.AnimationBaseMusic.base, i32, i32, %"class.std::vector" }
%class.AnimationBaseMusic.base = type <{ %class.AnimationBase.base, [3 x i8], %"class.std::function", %struct.MovingTarget }>
%class.AnimationBase.base = type <{ ptr, i32, i8 }>
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%struct.MovingTarget = type { %struct.ColorRgb, %struct.ColorRgb, %struct.ColorRgb, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<ColorRgb, std::allocator<ColorRgb>>::_Vector_impl" }
%"struct.std::_Vector_base<ColorRgb, std::allocator<ColorRgb>>::_Vector_impl" = type { %"struct.std::_Vector_base<ColorRgb, std::allocator<ColorRgb>>::_Vector_impl_data" }
%"struct.std::_Vector_base<ColorRgb, std::allocator<ColorRgb>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@_ZTV26Animation4Music_WavesPulse = external dso_local unnamed_addr constant { [10 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN26Animation4Music_WavesPulseC2Ev(ptr noundef nonnull align 8 dereferenceable(144) %0) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca %struct.ColorRgb, align 1
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %7 = load ptr, ptr %2, align 8
  call void @_ZN18AnimationBaseMusicC2Ev(ptr noundef nonnull align 8 dereferenceable(108) %7)
  store ptr getelementptr inbounds inrange(-16, 64) ({ [10 x ptr] }, ptr @_ZTV26Animation4Music_WavesPulse, i32 0, i32 0, i32 2), ptr %7, align 8, !tbaa !9
  %8 = getelementptr inbounds %class.Animation4Music_WavesPulse, ptr %7, i32 0, i32 1
  store i32 0, ptr %8, align 4, !tbaa !11
  %9 = getelementptr inbounds %class.Animation4Music_WavesPulse, ptr %7, i32 0, i32 2
  store i32 0, ptr %9, align 8, !tbaa !25
  %10 = getelementptr inbounds %class.Animation4Music_WavesPulse, ptr %7, i32 0, i32 3
  call void @_ZNSt6vectorI8ColorRgbSaIS0_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 0, ptr %3, align 4, !tbaa !26
  br label %11

11:                                               ; preds = %19, %1
  %12 = load i32, ptr %3, align 4, !tbaa !26
  %13 = icmp slt i32 %12, 5
  br i1 %13, label %15, label %14

14:                                               ; preds = %11
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %26

15:                                               ; preds = %11
  %16 = getelementptr inbounds %class.Animation4Music_WavesPulse, ptr %7, i32 0, i32 3
  call void @llvm.lifetime.start.p0(i64 3, ptr %4) #5
  invoke void @_ZN8ColorRgbC2Ehhh(ptr noundef nonnull align 1 dereferenceable(3) %4, i8 noundef zeroext 0, i8 noundef zeroext 0, i8 noundef zeroext 0)
          to label %17 unwind label %22

17:                                               ; preds = %15
  invoke void @_ZNSt6vectorI8ColorRgbSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(24) %16, ptr noundef nonnull align 1 dereferenceable(3) %4)
          to label %18 unwind label %22

18:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 3, ptr %4) #5
  br label %19

19:                                               ; preds = %18
  %20 = load i32, ptr %3, align 4, !tbaa !26
  %21 = add nsw i32 %20, 1
  store i32 %21, ptr %3, align 4, !tbaa !26
  br label %11, !llvm.loop !27

22:                                               ; preds = %17, %15
  %23 = landingpad { ptr, i32 }
          cleanup
  %24 = extractvalue { ptr, i32 } %23, 0
  store ptr %24, ptr %5, align 8
  %25 = extractvalue { ptr, i32 } %23, 1
  store i32 %25, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 3, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @_ZNSt6vectorI8ColorRgbSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #5
  call void @_ZN18AnimationBaseMusicD2Ev(ptr noundef nonnull align 8 dereferenceable(108) %7) #5
  br label %27

26:                                               ; preds = %14
  ret void

27:                                               ; preds = %22
  %28 = load ptr, ptr %5, align 8
  %29 = load i32, ptr %6, align 4
  %30 = insertvalue { ptr, i32 } poison, ptr %28, 0
  %31 = insertvalue { ptr, i32 } %30, i32 %29, 1
  resume { ptr, i32 } %31
}

declare void @_ZN18AnimationBaseMusicC2Ev(ptr noundef nonnull align 8 dereferenceable(108)) unnamed_addr #1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI8ColorRgbSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 1 dereferenceable(3)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8ColorRgbC2Ehhh(ptr noundef nonnull align 1 dereferenceable(3), i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext) unnamed_addr #2 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) #3

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

; Function Attrs: nounwind
declare void @_ZN18AnimationBaseMusicD2Ev(ptr noundef nonnull align 8 dereferenceable(108)) unnamed_addr #4

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !15, i64 108}
!12 = !{!"_ZTS26Animation4Music_WavesPulse", !13, i64 0, !15, i64 108, !15, i64 112, !21, i64 120}
!13 = !{!"_ZTS18AnimationBaseMusic", !14, i64 0, !17, i64 16, !19, i64 48}
!14 = !{!"_ZTS13AnimationBase", !15, i64 8, !16, i64 12}
!15 = !{!"int", !7, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{!"_ZTSSt8functionIFP18SoundCaptureResultP18AnimationBaseMusicRjPbS5_S5_PiEE", !18, i64 0, !6, i64 24}
!18 = !{!"_ZTSSt14_Function_base", !7, i64 0, !6, i64 16}
!19 = !{!"_ZTS12MovingTarget", !20, i64 0, !20, i64 3, !20, i64 6, !15, i64 12, !15, i64 16, !15, i64 20, !15, i64 24, !15, i64 28, !15, i64 32, !15, i64 36, !15, i64 40, !15, i64 44, !15, i64 48, !15, i64 52, !15, i64 56}
!20 = !{!"_ZTS8ColorRgb", !7, i64 0, !7, i64 1, !7, i64 2}
!21 = !{!"_ZTSSt6vectorI8ColorRgbSaIS0_EE", !22, i64 0}
!22 = !{!"_ZTSSt12_Vector_baseI8ColorRgbSaIS0_EE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseI8ColorRgbSaIS0_EE12_Vector_implE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseI8ColorRgbSaIS0_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!25 = !{!12, !15, i64 112}
!26 = !{!15, !15, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}


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

%struct.ColorRgb = type { i8, i8, i8 }

@_ZTV26Animation4Music_WavesPulse = external dso_local unnamed_addr constant { [10 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN26Animation4Music_WavesPulseC2Ev(ptr noundef nonnull align 8 dereferenceable(144) %0) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %struct.ColorRgb, align 1
  tail call void @_ZN18AnimationBaseMusicC2Ev(ptr noundef nonnull align 8 dereferenceable(108) %0)
  store ptr getelementptr inbounds inrange(-16, 64) (i8, ptr @_ZTV26Animation4Music_WavesPulse, i64 16), ptr %0, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 108
  store i32 0, ptr %3, align 4, !tbaa !8
  %4 = getelementptr inbounds i8, ptr %0, i64 112
  store i32 0, ptr %4, align 8, !tbaa !24
  %5 = getelementptr inbounds i8, ptr %0, i64 120
  tail call void @_ZNSt6vectorI8ColorRgbSaIS0_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #5
  call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %2) #5
  call void @_ZN8ColorRgbC2Ehhh(ptr noundef nonnull align 1 dereferenceable(3) %2, i8 noundef zeroext 0, i8 noundef zeroext 0, i8 noundef zeroext 0)
  invoke void @_ZNSt6vectorI8ColorRgbSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 1 dereferenceable(3) %2)
          to label %6 unwind label %11

6:                                                ; preds = %1
  call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %2) #5
  call void @_ZN8ColorRgbC2Ehhh(ptr noundef nonnull align 1 dereferenceable(3) %2, i8 noundef zeroext 0, i8 noundef zeroext 0, i8 noundef zeroext 0)
  invoke void @_ZNSt6vectorI8ColorRgbSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 1 dereferenceable(3) %2)
          to label %7 unwind label %11

7:                                                ; preds = %6
  call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %2) #5
  call void @_ZN8ColorRgbC2Ehhh(ptr noundef nonnull align 1 dereferenceable(3) %2, i8 noundef zeroext 0, i8 noundef zeroext 0, i8 noundef zeroext 0)
  invoke void @_ZNSt6vectorI8ColorRgbSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 1 dereferenceable(3) %2)
          to label %8 unwind label %11

8:                                                ; preds = %7
  call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %2) #5
  call void @_ZN8ColorRgbC2Ehhh(ptr noundef nonnull align 1 dereferenceable(3) %2, i8 noundef zeroext 0, i8 noundef zeroext 0, i8 noundef zeroext 0)
  invoke void @_ZNSt6vectorI8ColorRgbSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 1 dereferenceable(3) %2)
          to label %9 unwind label %11

9:                                                ; preds = %8
  call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %2) #5
  call void @_ZN8ColorRgbC2Ehhh(ptr noundef nonnull align 1 dereferenceable(3) %2, i8 noundef zeroext 0, i8 noundef zeroext 0, i8 noundef zeroext 0)
  invoke void @_ZNSt6vectorI8ColorRgbSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 1 dereferenceable(3) %2)
          to label %10 unwind label %11

10:                                               ; preds = %9
  call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %2) #5
  ret void

11:                                               ; preds = %9, %8, %7, %6, %1
  %12 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %2) #5
  call void @_ZNSt6vectorI8ColorRgbSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #5
  call void @_ZN18AnimationBaseMusicD2Ev(ptr noundef nonnull align 8 dereferenceable(108) %0) #5
  resume { ptr, i32 } %12
}

declare void @_ZN18AnimationBaseMusicC2Ev(ptr noundef nonnull align 8 dereferenceable(108)) unnamed_addr #1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI8ColorRgbSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 1 dereferenceable(3)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8ColorRgbC2Ehhh(ptr noundef nonnull align 1 dereferenceable(3), i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext) unnamed_addr #2 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) #3

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

; Function Attrs: nounwind
declare void @_ZN18AnimationBaseMusicD2Ev(ptr noundef nonnull align 8 dereferenceable(108)) unnamed_addr #4

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 willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #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, !12, i64 108}
!9 = !{!"_ZTS26Animation4Music_WavesPulse", !10, i64 0, !12, i64 108, !12, i64 112, !20, i64 120}
!10 = !{!"_ZTS18AnimationBaseMusic", !11, i64 0, !15, i64 16, !18, i64 48}
!11 = !{!"_ZTS13AnimationBase", !12, i64 8, !14, i64 12}
!12 = !{!"int", !13, i64 0}
!13 = !{!"omnipotent char", !7, i64 0}
!14 = !{!"bool", !13, i64 0}
!15 = !{!"_ZTSSt8functionIFP18SoundCaptureResultP18AnimationBaseMusicRjPbS5_S5_PiEE", !16, i64 0, !17, i64 24}
!16 = !{!"_ZTSSt14_Function_base", !13, i64 0, !17, i64 16}
!17 = !{!"any pointer", !13, i64 0}
!18 = !{!"_ZTS12MovingTarget", !19, i64 0, !19, i64 3, !19, i64 6, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 40, !12, i64 44, !12, i64 48, !12, i64 52, !12, i64 56}
!19 = !{!"_ZTS8ColorRgb", !13, i64 0, !13, i64 1, !13, i64 2}
!20 = !{!"_ZTSSt6vectorI8ColorRgbSaIS0_EE", !21, i64 0}
!21 = !{!"_ZTSSt12_Vector_baseI8ColorRgbSaIS0_EE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseI8ColorRgbSaIS0_EE12_Vector_implE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseI8ColorRgbSaIS0_EE17_Vector_impl_dataE", !17, i64 0, !17, i64 8, !17, i64 16}
!24 = !{!9, !12, i64 112}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,SROAPass,SimplifyCFGPass,TailCallElimPass