; LLVM IR from goldest-star/seawave-animation :: src/vcl/shape/curve/curve_dynamic_drawable (curve_dynamic_drawable)

; 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.vcl::curve_dynamic_drawable" = type <{ %"struct.vcl::curve_drawable", [4 x i8], %"class.std::vector", i64, i8, i8, [6 x i8] }>
%"struct.vcl::curve_drawable" = type { %"struct.vcl::segments_drawable_uniform", %"struct.vcl::curve_gpu", i32 }
%"struct.vcl::segments_drawable_uniform" = type { %"struct.vcl::affine_transform", %"struct.vcl::buffer_stack" }
%"struct.vcl::affine_transform" = type { %"struct.vcl::buffer_stack", %"struct.vcl::mat", float, %"struct.vcl::buffer_stack" }
%"struct.vcl::mat" = type { float, float, float, float, float, float, float, float, float }
%"struct.vcl::buffer_stack" = type { float, float, float }
%"struct.vcl::curve_gpu" = type { i32, i32, i32 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<vcl::buffer_stack<float, 3>, std::allocator<vcl::buffer_stack<float, 3>>>::_Vector_impl" }
%"struct.std::_Vector_base<vcl::buffer_stack<float, 3>, std::allocator<vcl::buffer_stack<float, 3>>>::_Vector_impl" = type { %"struct.std::_Vector_base<vcl::buffer_stack<float, 3>, std::allocator<vcl::buffer_stack<float, 3>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<vcl::buffer_stack<float, 3>, std::allocator<vcl::buffer_stack<float, 3>>>::_Vector_impl_data" = type { ptr, ptr, ptr }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3vcl22curve_dynamic_drawable9add_pointERKNS_12buffer_stackIfLm3EEE(ptr noundef nonnull align 8 dereferenceable(130) %0, ptr noundef nonnull align 4 dereferenceable(12) %1) #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %6 = load ptr, ptr %3, align 8
  %7 = getelementptr inbounds %"class.vcl::curve_dynamic_drawable", ptr %6, i32 0, i32 4
  store i8 1, ptr %7, align 8, !tbaa !9
  %8 = getelementptr inbounds %"class.vcl::curve_dynamic_drawable", ptr %6, i32 0, i32 2
  %9 = call noundef i64 @_ZNKSt6vectorIN3vcl12buffer_stackIfLm3EEESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #4
  %10 = getelementptr inbounds %"class.vcl::curve_dynamic_drawable", ptr %6, i32 0, i32 3
  %11 = load i64, ptr %10, align 8, !tbaa !25
  %12 = icmp ult i64 %9, %11
  br i1 %12, label %13, label %16

13:                                               ; preds = %2
  %14 = getelementptr inbounds %"class.vcl::curve_dynamic_drawable", ptr %6, i32 0, i32 2
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZNSt6vectorIN3vcl12buffer_stackIfLm3EEESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %14, ptr noundef nonnull align 4 dereferenceable(12) %15)
  br label %42

16:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  store i64 0, ptr %5, align 8, !tbaa !26
  br label %17

17:                                               ; preds = %32, %16
  %18 = load i64, ptr %5, align 8, !tbaa !26
  %19 = getelementptr inbounds %"class.vcl::curve_dynamic_drawable", ptr %6, i32 0, i32 3
  %20 = load i64, ptr %19, align 8, !tbaa !25
  %21 = sub i64 %20, 1
  %22 = icmp ult i64 %18, %21
  br i1 %22, label %24, label %23

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

24:                                               ; preds = %17
  %25 = getelementptr inbounds %"class.vcl::curve_dynamic_drawable", ptr %6, i32 0, i32 2
  %26 = load i64, ptr %5, align 8, !tbaa !26
  %27 = add i64 %26, 1
  %28 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorIN3vcl12buffer_stackIfLm3EEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %25, i64 noundef %27) #4
  %29 = getelementptr inbounds %"class.vcl::curve_dynamic_drawable", ptr %6, i32 0, i32 2
  %30 = load i64, ptr %5, align 8, !tbaa !26
  %31 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorIN3vcl12buffer_stackIfLm3EEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %29, i64 noundef %30) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %31, ptr align 4 %28, i64 12, i1 false), !tbaa.struct !27
  br label %32

32:                                               ; preds = %24
  %33 = load i64, ptr %5, align 8, !tbaa !26
  %34 = add i64 %33, 1
  store i64 %34, ptr %5, align 8, !tbaa !26
  br label %17, !llvm.loop !29

35:                                               ; preds = %23
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = getelementptr inbounds %"class.vcl::curve_dynamic_drawable", ptr %6, i32 0, i32 2
  %38 = getelementptr inbounds %"class.vcl::curve_dynamic_drawable", ptr %6, i32 0, i32 3
  %39 = load i64, ptr %38, align 8, !tbaa !25
  %40 = sub i64 %39, 1
  %41 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorIN3vcl12buffer_stackIfLm3EEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %37, i64 noundef %40) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %41, ptr align 4 %36, i64 12, i1 false), !tbaa.struct !27
  br label %42

42:                                               ; preds = %35, %13
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIN3vcl12buffer_stackIfLm3EEESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIN3vcl12buffer_stackIfLm3EEESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(12)) #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorIN3vcl12buffer_stackIfLm3EEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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, !24, i64 128}
!10 = !{!"_ZTSN3vcl22curve_dynamic_drawableE", !11, i64 0, !19, i64 96, !23, i64 120, !24, i64 128, !24, i64 129}
!11 = !{!"_ZTSN3vcl14curve_drawableE", !12, i64 0, !17, i64 76, !18, i64 88}
!12 = !{!"_ZTSN3vcl25segments_drawable_uniformE", !13, i64 0, !14, i64 64}
!13 = !{!"_ZTSN3vcl16affine_transformE", !14, i64 0, !16, i64 12, !15, i64 48, !14, i64 52}
!14 = !{!"_ZTSN3vcl12buffer_stackIfLm3EEE", !15, i64 0, !15, i64 4, !15, i64 8}
!15 = !{!"float", !7, i64 0}
!16 = !{!"_ZTSN3vcl3matILm3ELm3EEE", !15, i64 0, !15, i64 4, !15, i64 8, !15, i64 12, !15, i64 16, !15, i64 20, !15, i64 24, !15, i64 28, !15, i64 32}
!17 = !{!"_ZTSN3vcl9curve_gpuE", !18, i64 0, !18, i64 4, !18, i64 8}
!18 = !{!"int", !7, i64 0}
!19 = !{!"_ZTSSt6vectorIN3vcl12buffer_stackIfLm3EEESaIS2_EE", !20, i64 0}
!20 = !{!"_ZTSSt12_Vector_baseIN3vcl12buffer_stackIfLm3EEESaIS2_EE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIN3vcl12buffer_stackIfLm3EEESaIS2_EE12_Vector_implE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseIN3vcl12buffer_stackIfLm3EEESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!23 = !{!"long", !7, i64 0}
!24 = !{!"bool", !7, i64 0}
!25 = !{!10, !23, i64 120}
!26 = !{!23, !23, i64 0}
!27 = !{i64 0, i64 4, !28, i64 4, i64 4, !28, i64 8, i64 4, !28}
!28 = !{!15, !15, i64 0}
!29 = distinct !{!29, !30}
!30 = !{!"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"

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3vcl22curve_dynamic_drawable9add_pointERKNS_12buffer_stackIfLm3EEE(ptr noundef nonnull align 8 dereferenceable(130) %0, ptr noundef nonnull align 4 dereferenceable(12) %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 128
  store i8 1, ptr %3, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 96
  %5 = tail call noundef i64 @_ZNKSt6vectorIN3vcl12buffer_stackIfLm3EEESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #3
  %6 = getelementptr inbounds i8, ptr %0, i64 120
  %7 = load i64, ptr %6, align 8, !tbaa !24
  %8 = icmp ult i64 %5, %7
  br i1 %8, label %9, label %.preheader

.preheader:                                       ; preds = %2
  %.not = icmp eq i64 %7, 1
  br i1 %.not, label %._crit_edge, label %.lr.ph

9:                                                ; preds = %2
  tail call void @_ZNSt6vectorIN3vcl12buffer_stackIfLm3EEESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 4 dereferenceable(12) %1)
  br label %17

._crit_edge:                                      ; preds = %.lr.ph, %.preheader
  %.lcssa = phi i64 [ 0, %.preheader ], [ %15, %.lr.ph ]
  %10 = tail call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorIN3vcl12buffer_stackIfLm3EEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %.lcssa) #3
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %10, ptr noundef nonnull align 4 dereferenceable(12) %1, i64 12, i1 false), !tbaa.struct !25
  br label %17

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %.07 = phi i64 [ %11, %.lr.ph ], [ 0, %.preheader ]
  %11 = add nuw i64 %.07, 1
  %12 = tail call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorIN3vcl12buffer_stackIfLm3EEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %11) #3
  %13 = tail call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorIN3vcl12buffer_stackIfLm3EEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %.07) #3
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %13, ptr noundef nonnull align 4 dereferenceable(12) %12, i64 12, i1 false), !tbaa.struct !25
  %14 = load i64, ptr %6, align 8, !tbaa !24
  %15 = add i64 %14, -1
  %16 = icmp ult i64 %11, %15
  br i1 %16, label %.lr.ph, label %._crit_edge, !llvm.loop !27

17:                                               ; preds = %._crit_edge, %9
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIN3vcl12buffer_stackIfLm3EEESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorIN3vcl12buffer_stackIfLm3EEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #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 = { 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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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, !23, i64 128}
!6 = !{!"_ZTSN3vcl22curve_dynamic_drawableE", !7, i64 0, !17, i64 96, !22, i64 120, !23, i64 128, !23, i64 129}
!7 = !{!"_ZTSN3vcl14curve_drawableE", !8, i64 0, !15, i64 76, !16, i64 88}
!8 = !{!"_ZTSN3vcl25segments_drawable_uniformE", !9, i64 0, !10, i64 64}
!9 = !{!"_ZTSN3vcl16affine_transformE", !10, i64 0, !14, i64 12, !11, i64 48, !10, i64 52}
!10 = !{!"_ZTSN3vcl12buffer_stackIfLm3EEE", !11, i64 0, !11, i64 4, !11, i64 8}
!11 = !{!"float", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C++ TBAA"}
!14 = !{!"_ZTSN3vcl3matILm3ELm3EEE", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32}
!15 = !{!"_ZTSN3vcl9curve_gpuE", !16, i64 0, !16, i64 4, !16, i64 8}
!16 = !{!"int", !12, i64 0}
!17 = !{!"_ZTSSt6vectorIN3vcl12buffer_stackIfLm3EEESaIS2_EE", !18, i64 0}
!18 = !{!"_ZTSSt12_Vector_baseIN3vcl12buffer_stackIfLm3EEESaIS2_EE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIN3vcl12buffer_stackIfLm3EEESaIS2_EE12_Vector_implE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIN3vcl12buffer_stackIfLm3EEESaIS2_EE17_Vector_impl_dataE", !21, i64 0, !21, i64 8, !21, i64 16}
!21 = !{!"any pointer", !12, i64 0}
!22 = !{!"long", !12, i64 0}
!23 = !{!"bool", !12, i64 0}
!24 = !{!6, !22, i64 120}
!25 = !{i64 0, i64 4, !26, i64 4, i64 4, !26, i64 8, i64 4, !26}
!26 = !{!11, !11, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass