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

; 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.vcl::mesh" = type { %"struct.vcl::buffer", %"struct.vcl::buffer", %"struct.vcl::buffer.0", %"struct.vcl::buffer.6", %"struct.vcl::buffer.12" }
%"struct.vcl::buffer" = type { %"class.std::vector" }
%"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 }
%"struct.vcl::buffer.0" = type { %"class.std::vector.1" }
%"class.std::vector.1" = type { %"struct.std::_Vector_base.2" }
%"struct.std::_Vector_base.2" = type { %"struct.std::_Vector_base<vcl::buffer_stack<float, 4>, std::allocator<vcl::buffer_stack<float, 4>>>::_Vector_impl" }
%"struct.std::_Vector_base<vcl::buffer_stack<float, 4>, std::allocator<vcl::buffer_stack<float, 4>>>::_Vector_impl" = type { %"struct.std::_Vector_base<vcl::buffer_stack<float, 4>, std::allocator<vcl::buffer_stack<float, 4>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<vcl::buffer_stack<float, 4>, std::allocator<vcl::buffer_stack<float, 4>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.vcl::buffer.6" = type { %"class.std::vector.7" }
%"class.std::vector.7" = type { %"struct.std::_Vector_base.8" }
%"struct.std::_Vector_base.8" = type { %"struct.std::_Vector_base<vcl::buffer_stack<float, 2>, std::allocator<vcl::buffer_stack<float, 2>>>::_Vector_impl" }
%"struct.std::_Vector_base<vcl::buffer_stack<float, 2>, std::allocator<vcl::buffer_stack<float, 2>>>::_Vector_impl" = type { %"struct.std::_Vector_base<vcl::buffer_stack<float, 2>, std::allocator<vcl::buffer_stack<float, 2>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<vcl::buffer_stack<float, 2>, std::allocator<vcl::buffer_stack<float, 2>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.vcl::buffer.12" = type { %"class.std::vector.13" }
%"class.std::vector.13" = type { %"struct.std::_Vector_base.14" }
%"struct.std::_Vector_base.14" = type { %"struct.std::_Vector_base<std::array<unsigned int, 3>, std::allocator<std::array<unsigned int, 3>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::array<unsigned int, 3>, std::allocator<std::array<unsigned int, 3>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::array<unsigned int, 3>, std::allocator<std::array<unsigned int, 3>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::array<unsigned int, 3>, std::allocator<std::array<unsigned int, 3>>>::_Vector_impl_data" = type { ptr, ptr, ptr }

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(16) ptr @_ZN3vcl6bufferINS_12buffer_stackIfLm4EEEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 align 2

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

; 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: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK3vcl6bufferINS_12buffer_stackIfLm4EEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3vcl6bufferINS_12buffer_stackIfLm4EEEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3vcl4mesh18fill_color_uniformERKNS_12buffer_stackIfLm4EEE(ptr noundef nonnull align 8 dereferenceable(120) %0, ptr noundef nonnull align 4 dereferenceable(16) %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %7 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %8 = getelementptr inbounds %"struct.vcl::mesh", ptr %7, i32 0, i32 0
  %9 = call noundef i64 @_ZNK3vcl6bufferINS_12buffer_stackIfLm3EEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %8)
  store i64 %9, ptr %5, align 8, !tbaa !9
  %10 = getelementptr inbounds %"struct.vcl::mesh", ptr %7, i32 0, i32 2
  %11 = call noundef i64 @_ZNK3vcl6bufferINS_12buffer_stackIfLm4EEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %10)
  %12 = load i64, ptr %5, align 8, !tbaa !9
  %13 = icmp ne i64 %11, %12
  br i1 %13, label %14, label %17

14:                                               ; preds = %2
  %15 = getelementptr inbounds %"struct.vcl::mesh", ptr %7, i32 0, i32 2
  %16 = load i64, ptr %5, align 8, !tbaa !9
  call void @_ZN3vcl6bufferINS_12buffer_stackIfLm4EEEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %15, i64 noundef %16)
  br label %17

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

18:                                               ; preds = %28, %17
  %19 = load i64, ptr %6, align 8, !tbaa !9
  %20 = load i64, ptr %5, align 8, !tbaa !9
  %21 = icmp ult i64 %19, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  br label %31

23:                                               ; preds = %18
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %"struct.vcl::mesh", ptr %7, i32 0, i32 2
  %26 = load i64, ptr %6, align 8, !tbaa !9
  %27 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN3vcl6bufferINS_12buffer_stackIfLm4EEEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %25, i64 noundef %26)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %27, ptr align 4 %24, i64 16, i1 false), !tbaa.struct !11
  br label %28

28:                                               ; preds = %23
  %29 = load i64, ptr %6, align 8, !tbaa !9
  %30 = add i64 %29, 1
  store i64 %30, ptr %6, align 8, !tbaa !9
  br label %18, !llvm.loop !14

31:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 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, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{i64 0, i64 4, !12, i64 4, i64 4, !12, i64 8, i64 4, !12, i64 12, i64 4, !12}
!12 = !{!13, !13, i64 0}
!13 = !{!"float", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"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 nounwind uwtable
declare dso_local noundef i64 @_ZNK3vcl6bufferINS_12buffer_stackIfLm3EEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(16) ptr @_ZN3vcl6bufferINS_12buffer_stackIfLm4EEEEixEm(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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3vcl4mesh18fill_color_uniformERKNS_12buffer_stackIfLm4EEE(ptr noundef nonnull align 8 dereferenceable(120) %0, ptr nocapture noundef nonnull readonly align 4 dereferenceable(16) %1) local_unnamed_addr #1 align 2 {
  %3 = tail call noundef i64 @_ZNK3vcl6bufferINS_12buffer_stackIfLm3EEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0)
  %4 = getelementptr inbounds i8, ptr %0, i64 48
  %5 = tail call noundef i64 @_ZNK3vcl6bufferINS_12buffer_stackIfLm4EEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  %.not = icmp eq i64 %5, %3
  br i1 %.not, label %7, label %6

6:                                                ; preds = %2
  tail call void @_ZN3vcl6bufferINS_12buffer_stackIfLm4EEEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %3)
  br label %7

7:                                                ; preds = %6, %2
  %.not9 = icmp eq i64 %3, 0
  br i1 %.not9, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %7
  ret void

.lr.ph:                                           ; preds = %7, %.lr.ph
  %.08 = phi i64 [ %9, %.lr.ph ], [ 0, %7 ]
  %8 = tail call noundef nonnull align 4 dereferenceable(16) ptr @_ZN3vcl6bufferINS_12buffer_stackIfLm4EEEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %.08)
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %8, ptr noundef nonnull align 4 dereferenceable(16) %1, i64 16, i1 false), !tbaa.struct !5
  %9 = add nuw i64 %.08, 1
  %exitcond.not = icmp eq i64 %9, %3
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !10
}

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }

!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 = !{i64 0, i64 4, !6, i64 4, i64 4, !6, i64 8, i64 4, !6, i64 12, i64 4, !6}
!6 = !{!7, !7, i64 0}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass