; LLVM IR from yangfengzzz/Arche-webgpu :: vox.geometry/face_centered_grid2.ll (ZNK3vox17FaceCenteredGrid27getDataEPSt6vectorIdSaIdEE)

; 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.vox::Size2" = type { i64, i64 }
%class.anon.17 = type { ptr, ptr }
%class.anon.18 = type { ptr, ptr }
%"class.vox::FaceCenteredGrid2" = type { %"class.vox::VectorGrid2", %"class.vox::Array", %"class.vox::Array", %"struct.vox::Point", %"struct.vox::Point", %"class.vox::LinearArraySampler", %"class.vox::LinearArraySampler", %"class.std::function" }
%"class.vox::VectorGrid2" = type { %"class.vox::VectorField2", %"class.vox::Grid2" }
%"class.vox::VectorField2" = type { %"class.vox::Field2" }
%"class.vox::Field2" = type { ptr }
%"class.vox::Grid2" = type { ptr, %"struct.vox::Size2", %"struct.vox::Vector", %"struct.vox::Point", %"struct.vox::BoundingBox" }
%"struct.vox::Vector" = type { double, double }
%"struct.vox::BoundingBox" = type { %"struct.vox::Point", %"struct.vox::Point" }
%"class.vox::Array" = type { %"struct.vox::Size2", %"class.std::vector" }
%"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 }
%"struct.vox::Point" = type { double, double }
%"class.vox::LinearArraySampler" = type { %"struct.vox::Vector", %"struct.vox::Vector", %"struct.vox::Point", %"class.vox::ConstArrayAccessor" }
%"class.vox::ConstArrayAccessor" = type { %"struct.vox::Size2", ptr }
%"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 } }

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_ZNK3vox17FaceCenteredGrid25uSizeEv(ptr noundef nonnull align 8 dereferenceable(384)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_ZNK3vox17FaceCenteredGrid25vSizeEv(ptr noundef nonnull align 8 dereferenceable(384)) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3vox17FaceCenteredGrid27getDataEPSt6vectorIdSaIdEE(ptr noundef nonnull align 8 dereferenceable(384) %0, ptr noundef %1) unnamed_addr #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca %"struct.vox::Size2", align 8
  %7 = alloca %"struct.vox::Size2", align 8
  %8 = alloca %"struct.vox::Size2", align 8
  %9 = alloca %"struct.vox::Size2", align 8
  %10 = alloca i64, align 8
  %11 = alloca %class.anon.17, align 8
  %12 = alloca %class.anon.18, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %13 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #2
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #2
  %14 = call { i64, i64 } @_ZNK3vox17FaceCenteredGrid25uSizeEv(ptr noundef nonnull align 8 dereferenceable(384) %13)
  %15 = getelementptr inbounds { i64, i64 }, ptr %6, i32 0, i32 0
  %16 = extractvalue { i64, i64 } %14, 0
  store i64 %16, ptr %15, align 8
  %17 = getelementptr inbounds { i64, i64 }, ptr %6, i32 0, i32 1
  %18 = extractvalue { i64, i64 } %14, 1
  store i64 %18, ptr %17, align 8
  %19 = getelementptr inbounds %"struct.vox::Size2", ptr %6, i32 0, i32 0
  %20 = load i64, ptr %19, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #2
  %21 = call { i64, i64 } @_ZNK3vox17FaceCenteredGrid25uSizeEv(ptr noundef nonnull align 8 dereferenceable(384) %13)
  %22 = getelementptr inbounds { i64, i64 }, ptr %7, i32 0, i32 0
  %23 = extractvalue { i64, i64 } %21, 0
  store i64 %23, ptr %22, align 8
  %24 = getelementptr inbounds { i64, i64 }, ptr %7, i32 0, i32 1
  %25 = extractvalue { i64, i64 } %21, 1
  store i64 %25, ptr %24, align 8
  %26 = getelementptr inbounds %"struct.vox::Size2", ptr %7, i32 0, i32 1
  %27 = load i64, ptr %26, align 8, !tbaa !12
  %28 = mul i64 %20, %27
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #2
  %29 = call { i64, i64 } @_ZNK3vox17FaceCenteredGrid25vSizeEv(ptr noundef nonnull align 8 dereferenceable(384) %13)
  %30 = getelementptr inbounds { i64, i64 }, ptr %8, i32 0, i32 0
  %31 = extractvalue { i64, i64 } %29, 0
  store i64 %31, ptr %30, align 8
  %32 = getelementptr inbounds { i64, i64 }, ptr %8, i32 0, i32 1
  %33 = extractvalue { i64, i64 } %29, 1
  store i64 %33, ptr %32, align 8
  %34 = getelementptr inbounds %"struct.vox::Size2", ptr %8, i32 0, i32 0
  %35 = load i64, ptr %34, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #2
  %36 = call { i64, i64 } @_ZNK3vox17FaceCenteredGrid25vSizeEv(ptr noundef nonnull align 8 dereferenceable(384) %13)
  %37 = getelementptr inbounds { i64, i64 }, ptr %9, i32 0, i32 0
  %38 = extractvalue { i64, i64 } %36, 0
  store i64 %38, ptr %37, align 8
  %39 = getelementptr inbounds { i64, i64 }, ptr %9, i32 0, i32 1
  %40 = extractvalue { i64, i64 } %36, 1
  store i64 %40, ptr %39, align 8
  %41 = getelementptr inbounds %"struct.vox::Size2", ptr %9, i32 0, i32 1
  %42 = load i64, ptr %41, align 8, !tbaa !12
  %43 = mul i64 %35, %42
  %44 = add i64 %28, %43
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #2
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #2
  store i64 %44, ptr %5, align 8, !tbaa !13
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = load i64, ptr %5, align 8, !tbaa !13
  call void @_ZNSt6vectorIdSaIdEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %45, i64 noundef %46)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #2
  store i64 0, ptr %10, align 8, !tbaa !13
  %47 = getelementptr inbounds %"class.vox::FaceCenteredGrid2", ptr %13, i32 0, i32 1
  %48 = getelementptr inbounds %class.anon.17, ptr %11, i32 0, i32 0
  store ptr %4, ptr %48, align 8, !tbaa !5
  %49 = getelementptr inbounds %class.anon.17, ptr %11, i32 0, i32 1
  store ptr %10, ptr %49, align 8, !tbaa !5
  %50 = getelementptr inbounds { ptr, ptr }, ptr %11, i32 0, i32 0
  %51 = load ptr, ptr %50, align 8
  %52 = getelementptr inbounds { ptr, ptr }, ptr %11, i32 0, i32 1
  %53 = load ptr, ptr %52, align 8
  call void @"_ZNK3vox5ArrayIdLm2EE7forEachIZNKS_17FaceCenteredGrid27getDataEPSt6vectorIdSaIdEEE3$_0EEvT_"(ptr noundef nonnull align 8 dereferenceable(40) %47, ptr %51, ptr %53)
  %54 = getelementptr inbounds %"class.vox::FaceCenteredGrid2", ptr %13, i32 0, i32 2
  %55 = getelementptr inbounds %class.anon.18, ptr %12, i32 0, i32 0
  store ptr %4, ptr %55, align 8, !tbaa !5
  %56 = getelementptr inbounds %class.anon.18, ptr %12, i32 0, i32 1
  store ptr %10, ptr %56, align 8, !tbaa !5
  %57 = getelementptr inbounds { ptr, ptr }, ptr %12, i32 0, i32 0
  %58 = load ptr, ptr %57, align 8
  %59 = getelementptr inbounds { ptr, ptr }, ptr %12, i32 0, i32 1
  %60 = load ptr, ptr %59, align 8
  call void @"_ZNK3vox5ArrayIdLm2EE7forEachIZNKS_17FaceCenteredGrid27getDataEPSt6vectorIdSaIdEEE3$_1EEvT_"(ptr noundef nonnull align 8 dereferenceable(40) %54, ptr %58, ptr %60)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #2
  ret void
}

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

; Function Attrs: mustprogress uwtable
declare hidden void @"_ZNK3vox5ArrayIdLm2EE7forEachIZNKS_17FaceCenteredGrid27getDataEPSt6vectorIdSaIdEEE3$_0EEvT_"(ptr noundef nonnull align 8 dereferenceable(40), ptr, ptr) #1 align 2

; Function Attrs: mustprogress uwtable
declare hidden void @"_ZNK3vox5ArrayIdLm2EE7forEachIZNKS_17FaceCenteredGrid27getDataEPSt6vectorIdSaIdEEE3$_1EEvT_"(ptr noundef nonnull align 8 dereferenceable(40), ptr, ptr) #1 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"_ZTSN3vox5Size2E", !11, i64 0, !11, i64 8}
!11 = !{!"long", !7, i64 0}
!12 = !{!10, !11, i64 8}
!13 = !{!11, !11, i64 0}


; 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_ZNK3vox17FaceCenteredGrid25uSizeEv(ptr noundef nonnull align 8 dereferenceable(384)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_ZNK3vox17FaceCenteredGrid25vSizeEv(ptr noundef nonnull align 8 dereferenceable(384)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3vox17FaceCenteredGrid27getDataEPSt6vectorIdSaIdEE(ptr noundef nonnull align 8 dereferenceable(384) %0, ptr noundef %1) unnamed_addr #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  store ptr %1, ptr %3, align 8, !tbaa !5
  %5 = tail call { i64, i64 } @_ZNK3vox17FaceCenteredGrid25uSizeEv(ptr noundef nonnull align 8 dereferenceable(384) %0)
  %6 = extractvalue { i64, i64 } %5, 0
  %7 = tail call { i64, i64 } @_ZNK3vox17FaceCenteredGrid25uSizeEv(ptr noundef nonnull align 8 dereferenceable(384) %0)
  %8 = extractvalue { i64, i64 } %7, 1
  %9 = mul i64 %8, %6
  %10 = tail call { i64, i64 } @_ZNK3vox17FaceCenteredGrid25vSizeEv(ptr noundef nonnull align 8 dereferenceable(384) %0)
  %11 = extractvalue { i64, i64 } %10, 0
  %12 = tail call { i64, i64 } @_ZNK3vox17FaceCenteredGrid25vSizeEv(ptr noundef nonnull align 8 dereferenceable(384) %0)
  %13 = extractvalue { i64, i64 } %12, 1
  %14 = mul i64 %13, %11
  %15 = add i64 %14, %9
  tail call void @_ZNSt6vectorIdSaIdEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %15)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #2
  store i64 0, ptr %4, align 8, !tbaa !9
  %16 = getelementptr inbounds i8, ptr %0, i64 96
  call void @"_ZNK3vox5ArrayIdLm2EE7forEachIZNKS_17FaceCenteredGrid27getDataEPSt6vectorIdSaIdEEE3$_0EEvT_"(ptr noundef nonnull align 8 dereferenceable(40) %16, ptr nonnull %3, ptr nonnull %4)
  %17 = getelementptr inbounds i8, ptr %0, i64 136
  call void @"_ZNK3vox5ArrayIdLm2EE7forEachIZNKS_17FaceCenteredGrid27getDataEPSt6vectorIdSaIdEEE3$_1EEvT_"(ptr noundef nonnull align 8 dereferenceable(40) %17, ptr nonnull %3, ptr nonnull %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #2
  ret void
}

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

; Function Attrs: mustprogress uwtable
declare hidden void @"_ZNK3vox5ArrayIdLm2EE7forEachIZNKS_17FaceCenteredGrid27getDataEPSt6vectorIdSaIdEEE3$_0EEvT_"(ptr noundef nonnull align 8 dereferenceable(40), ptr, ptr) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare hidden void @"_ZNK3vox5ArrayIdLm2EE7forEachIZNKS_17FaceCenteredGrid27getDataEPSt6vectorIdSaIdEEE3$_1EEvT_"(ptr noundef nonnull align 8 dereferenceable(40), ptr, ptr) local_unnamed_addr #1 align 2

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,TailCallElimPass