; LLVM IR from Lut1n/ImpGears :: src/ImpGears/Geometry/Geometry.ll (ZNK3imp8Geometry10fillBufferERSt6vectorIfSaIfEE)

; 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.imp::Geometry" = type <{ %"class.imp::Object", i32, [4 x i8], %"class.std::vector", %"class.std::vector.0", %"class.std::vector.0", %"class.std::vector.0", %"class.std::vector.5", i8, i8, i8, i8, [4 x i8] }>
%"class.imp::Object" = type { ptr, %"class.std::shared_ptr" }
%"class.std::shared_ptr" = type { %"class.std::__shared_ptr" }
%"class.std::__shared_ptr" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<imp::Vec3, std::allocator<imp::Vec3>>::_Vector_impl" }
%"struct.std::_Vector_base<imp::Vec3, std::allocator<imp::Vec3>>::_Vector_impl" = type { %"struct.std::_Vector_base<imp::Vec3, std::allocator<imp::Vec3>>::_Vector_impl_data" }
%"struct.std::_Vector_base<imp::Vec3, std::allocator<imp::Vec3>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = type { %"struct.std::_Vector_base<imp::Vec<2, float>, std::allocator<imp::Vec<2, float>>>::_Vector_impl" }
%"struct.std::_Vector_base<imp::Vec<2, float>, std::allocator<imp::Vec<2, float>>>::_Vector_impl" = type { %"struct.std::_Vector_base<imp::Vec<2, float>, std::allocator<imp::Vec<2, float>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<imp::Vec<2, float>, std::allocator<imp::Vec<2, float>>>::_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 @_ZNKSt6vectorIN3imp4Vec3ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 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: mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK3imp4Vec31xEv(ptr noundef nonnull align 8 dereferenceable(36)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK3imp4Vec31yEv(ptr noundef nonnull align 8 dereferenceable(36)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK3imp4Vec31zEv(ptr noundef nonnull align 8 dereferenceable(36)) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3imp8Geometry10fillBufferERSt6vectorIfSaIfEE(ptr noundef nonnull align 8 dereferenceable(156) %0, ptr noundef nonnull align 8 dereferenceable(24) %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  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 = load ptr, ptr %4, align 8, !tbaa !5
  %8 = getelementptr inbounds %"class.imp::Geometry", ptr %6, i32 0, i32 4
  %9 = call noundef i64 @_ZNKSt6vectorIN3imp4Vec3ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #3
  %10 = mul i64 %9, 3
  call void @_ZNSt6vectorIfSaIfEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %10)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %11

11:                                               ; preds = %52, %2
  %12 = load i32, ptr %5, align 4, !tbaa !9
  %13 = zext i32 %12 to i64
  %14 = getelementptr inbounds %"class.imp::Geometry", ptr %6, i32 0, i32 4
  %15 = call noundef i64 @_ZNKSt6vectorIN3imp4Vec3ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %14) #3
  %16 = icmp ult i64 %13, %15
  br i1 %16, label %18, label %17

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

18:                                               ; preds = %11
  %19 = getelementptr inbounds %"class.imp::Geometry", ptr %6, i32 0, i32 4
  %20 = load i32, ptr %5, align 4, !tbaa !9
  %21 = zext i32 %20 to i64
  %22 = call noundef nonnull align 8 dereferenceable(36) ptr @_ZNKSt6vectorIN3imp4Vec3ESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %19, i64 noundef %21) #3
  %23 = call noundef float @_ZNK3imp4Vec31xEv(ptr noundef nonnull align 8 dereferenceable(36) %22)
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = load i32, ptr %5, align 4, !tbaa !9
  %26 = mul i32 3, %25
  %27 = add i32 %26, 0
  %28 = zext i32 %27 to i64
  %29 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIfSaIfEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %24, i64 noundef %28) #3
  store float %23, ptr %29, align 4, !tbaa !11
  %30 = getelementptr inbounds %"class.imp::Geometry", ptr %6, i32 0, i32 4
  %31 = load i32, ptr %5, align 4, !tbaa !9
  %32 = zext i32 %31 to i64
  %33 = call noundef nonnull align 8 dereferenceable(36) ptr @_ZNKSt6vectorIN3imp4Vec3ESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %30, i64 noundef %32) #3
  %34 = call noundef float @_ZNK3imp4Vec31yEv(ptr noundef nonnull align 8 dereferenceable(36) %33)
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = load i32, ptr %5, align 4, !tbaa !9
  %37 = mul i32 3, %36
  %38 = add i32 %37, 1
  %39 = zext i32 %38 to i64
  %40 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIfSaIfEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %35, i64 noundef %39) #3
  store float %34, ptr %40, align 4, !tbaa !11
  %41 = getelementptr inbounds %"class.imp::Geometry", ptr %6, i32 0, i32 4
  %42 = load i32, ptr %5, align 4, !tbaa !9
  %43 = zext i32 %42 to i64
  %44 = call noundef nonnull align 8 dereferenceable(36) ptr @_ZNKSt6vectorIN3imp4Vec3ESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %41, i64 noundef %43) #3
  %45 = call noundef float @_ZNK3imp4Vec31zEv(ptr noundef nonnull align 8 dereferenceable(36) %44)
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = load i32, ptr %5, align 4, !tbaa !9
  %48 = mul i32 3, %47
  %49 = add i32 %48, 2
  %50 = zext i32 %49 to i64
  %51 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIfSaIfEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %46, i64 noundef %50) #3
  store float %45, ptr %51, align 4, !tbaa !11
  br label %52

52:                                               ; preds = %18
  %53 = load i32, ptr %5, align 4, !tbaa !9
  %54 = add i32 %53, 1
  store i32 %54, ptr %5, align 4, !tbaa !9
  br label %11, !llvm.loop !13

55:                                               ; preds = %17
  ret void
}

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

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

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

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 = { 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 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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 @_ZNKSt6vectorIN3imp4Vec3ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK3imp4Vec31xEv(ptr noundef nonnull align 8 dereferenceable(36)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK3imp4Vec31yEv(ptr noundef nonnull align 8 dereferenceable(36)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK3imp4Vec31zEv(ptr noundef nonnull align 8 dereferenceable(36)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3imp8Geometry10fillBufferERSt6vectorIfSaIfEE(ptr noundef nonnull align 8 dereferenceable(156) %0, ptr noundef nonnull align 8 dereferenceable(24) %1) local_unnamed_addr #1 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 56
  %4 = tail call noundef i64 @_ZNKSt6vectorIN3imp4Vec3ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #2
  %5 = mul i64 %4, 3
  tail call void @_ZNSt6vectorIfSaIfEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %5)
  %6 = tail call noundef i64 @_ZNKSt6vectorIN3imp4Vec3ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #2
  %.not = icmp eq i64 %6, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

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

.lr.ph:                                           ; preds = %2, %.lr.ph
  %7 = phi i64 [ %24, %.lr.ph ], [ 0, %2 ]
  %.013 = phi i32 [ %23, %.lr.ph ], [ 0, %2 ]
  %8 = tail call noundef nonnull align 8 dereferenceable(36) ptr @_ZNKSt6vectorIN3imp4Vec3ESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %7) #2
  %9 = tail call noundef float @_ZNK3imp4Vec31xEv(ptr noundef nonnull align 8 dereferenceable(36) %8)
  %10 = mul i32 %.013, 3
  %11 = zext i32 %10 to i64
  %12 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIfSaIfEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %11) #2
  store float %9, ptr %12, align 4, !tbaa !5
  %13 = tail call noundef nonnull align 8 dereferenceable(36) ptr @_ZNKSt6vectorIN3imp4Vec3ESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %7) #2
  %14 = tail call noundef float @_ZNK3imp4Vec31yEv(ptr noundef nonnull align 8 dereferenceable(36) %13)
  %15 = add i32 %10, 1
  %16 = zext i32 %15 to i64
  %17 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIfSaIfEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %16) #2
  store float %14, ptr %17, align 4, !tbaa !5
  %18 = tail call noundef nonnull align 8 dereferenceable(36) ptr @_ZNKSt6vectorIN3imp4Vec3ESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %7) #2
  %19 = tail call noundef float @_ZNK3imp4Vec31zEv(ptr noundef nonnull align 8 dereferenceable(36) %18)
  %20 = add i32 %10, 2
  %21 = zext i32 %20 to i64
  %22 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIfSaIfEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %21) #2
  store float %19, ptr %22, align 4, !tbaa !5
  %23 = add i32 %.013, 1
  %24 = zext i32 %23 to i64
  %25 = tail call noundef i64 @_ZNKSt6vectorIN3imp4Vec3ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #2
  %26 = icmp ugt i64 %25, %24
  br i1 %26, label %.lr.ph, label %._crit_edge, !llvm.loop !9
}

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

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

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

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


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