; LLVM IR from doyubkim/fluid-engine-dev :: src/jet/face_centered_grid2.ll (ZNK3jet17FaceCenteredGrid27getDataEPSt6vectorIdSaIdEE)

; 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.jet::Size2" = type { i64, i64 }
%class.anon.16 = type { ptr, ptr }
%class.anon.17 = type { ptr, ptr }
%"class.jet::FaceCenteredGrid2" = type { %"class.jet::VectorGrid2", %"class.jet::Array", %"class.jet::Array", %"class.jet::Vector", %"class.jet::Vector", %"class.jet::LinearArraySampler", %"class.jet::LinearArraySampler", %"class.std::function" }
%"class.jet::VectorGrid2" = type { %"class.jet::VectorField2", %"class.jet::Grid2" }
%"class.jet::VectorField2" = type { %"class.jet::Field2" }
%"class.jet::Field2" = type { ptr }
%"class.jet::Grid2" = type { %"class.jet::Serializable", %"class.jet::Size2", %"class.jet::Vector", %"class.jet::Vector", %"class.jet::BoundingBox" }
%"class.jet::Serializable" = type { ptr }
%"class.jet::BoundingBox" = type { %"class.jet::Vector", %"class.jet::Vector" }
%"class.jet::Array" = type { %"class.jet::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 }
%"class.jet::Vector" = type { double, double }
%"class.jet::LinearArraySampler" = type { %"class.jet::Vector", %"class.jet::Vector", %"class.jet::Vector", %"class.jet::ConstArrayAccessor" }
%"class.jet::ConstArrayAccessor" = type { %"class.jet::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 void @_ZNK3jet17FaceCenteredGrid25uSizeEv(ptr dead_on_unwind noalias writable sret(%"class.jet::Size2") align 8, ptr noundef nonnull align 8 dereferenceable(384)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3jet17FaceCenteredGrid25vSizeEv(ptr dead_on_unwind noalias writable sret(%"class.jet::Size2") align 8, ptr noundef nonnull align 8 dereferenceable(384)) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3jet17FaceCenteredGrid27getDataEPSt6vectorIdSaIdEE(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 %"class.jet::Size2", align 8
  %7 = alloca %"class.jet::Size2", align 8
  %8 = alloca %"class.jet::Size2", align 8
  %9 = alloca %"class.jet::Size2", align 8
  %10 = alloca i64, align 8
  %11 = alloca %class.anon.16, align 8
  %12 = alloca %class.anon.17, 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
  call void @_ZNK3jet17FaceCenteredGrid25uSizeEv(ptr dead_on_unwind writable sret(%"class.jet::Size2") align 8 %6, ptr noundef nonnull align 8 dereferenceable(384) %13)
  %14 = getelementptr inbounds %"class.jet::Size2", ptr %6, i32 0, i32 0
  %15 = load i64, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #2
  call void @_ZNK3jet17FaceCenteredGrid25uSizeEv(ptr dead_on_unwind writable sret(%"class.jet::Size2") align 8 %7, ptr noundef nonnull align 8 dereferenceable(384) %13)
  %16 = getelementptr inbounds %"class.jet::Size2", ptr %7, i32 0, i32 1
  %17 = load i64, ptr %16, align 8, !tbaa !12
  %18 = mul i64 %15, %17
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #2
  call void @_ZNK3jet17FaceCenteredGrid25vSizeEv(ptr dead_on_unwind writable sret(%"class.jet::Size2") align 8 %8, ptr noundef nonnull align 8 dereferenceable(384) %13)
  %19 = getelementptr inbounds %"class.jet::Size2", ptr %8, i32 0, i32 0
  %20 = load i64, ptr %19, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #2
  call void @_ZNK3jet17FaceCenteredGrid25vSizeEv(ptr dead_on_unwind writable sret(%"class.jet::Size2") align 8 %9, ptr noundef nonnull align 8 dereferenceable(384) %13)
  %21 = getelementptr inbounds %"class.jet::Size2", ptr %9, i32 0, i32 1
  %22 = load i64, ptr %21, align 8, !tbaa !12
  %23 = mul i64 %20, %22
  %24 = add i64 %18, %23
  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 %24, ptr %5, align 8, !tbaa !13
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = load i64, ptr %5, align 8, !tbaa !13
  call void @_ZNSt6vectorIdSaIdEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %25, i64 noundef %26)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #2
  store i64 0, ptr %10, align 8, !tbaa !13
  %27 = getelementptr inbounds %"class.jet::FaceCenteredGrid2", ptr %13, i32 0, i32 1
  %28 = getelementptr inbounds %class.anon.16, ptr %11, i32 0, i32 0
  store ptr %4, ptr %28, align 8, !tbaa !5
  %29 = getelementptr inbounds %class.anon.16, ptr %11, i32 0, i32 1
  store ptr %10, ptr %29, align 8, !tbaa !5
  %30 = getelementptr inbounds { ptr, ptr }, ptr %11, i32 0, i32 0
  %31 = load ptr, ptr %30, align 8
  %32 = getelementptr inbounds { ptr, ptr }, ptr %11, i32 0, i32 1
  %33 = load ptr, ptr %32, align 8
  call void @"_ZNK3jet5ArrayIdLm2EE7forEachIZNKS_17FaceCenteredGrid27getDataEPSt6vectorIdSaIdEEE3$_0EEvT_"(ptr noundef nonnull align 8 dereferenceable(40) %27, ptr %31, ptr %33)
  %34 = getelementptr inbounds %"class.jet::FaceCenteredGrid2", ptr %13, i32 0, i32 2
  %35 = getelementptr inbounds %class.anon.17, ptr %12, i32 0, i32 0
  store ptr %4, ptr %35, align 8, !tbaa !5
  %36 = getelementptr inbounds %class.anon.17, ptr %12, i32 0, i32 1
  store ptr %10, ptr %36, align 8, !tbaa !5
  %37 = getelementptr inbounds { ptr, ptr }, ptr %12, i32 0, i32 0
  %38 = load ptr, ptr %37, align 8
  %39 = getelementptr inbounds { ptr, ptr }, ptr %12, i32 0, i32 1
  %40 = load ptr, ptr %39, align 8
  call void @"_ZNK3jet5ArrayIdLm2EE7forEachIZNKS_17FaceCenteredGrid27getDataEPSt6vectorIdSaIdEEE3$_1EEvT_"(ptr noundef nonnull align 8 dereferenceable(40) %34, ptr %38, ptr %40)
  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 @"_ZNK3jet5ArrayIdLm2EE7forEachIZNKS_17FaceCenteredGrid27getDataEPSt6vectorIdSaIdEEE3$_0EEvT_"(ptr noundef nonnull align 8 dereferenceable(40), ptr, ptr) #1 align 2

; Function Attrs: mustprogress uwtable
declare hidden void @"_ZNK3jet5ArrayIdLm2EE7forEachIZNKS_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 = !{!"_ZTSN3jet5Size2E", !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"

%"class.jet::Size2" = type { i64, i64 }

; 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 void @_ZNK3jet17FaceCenteredGrid25uSizeEv(ptr dead_on_unwind noalias writable sret(%"class.jet::Size2") align 8, ptr noundef nonnull align 8 dereferenceable(384)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3jet17FaceCenteredGrid25vSizeEv(ptr dead_on_unwind noalias writable sret(%"class.jet::Size2") align 8, ptr noundef nonnull align 8 dereferenceable(384)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3jet17FaceCenteredGrid27getDataEPSt6vectorIdSaIdEE(ptr noundef nonnull align 8 dereferenceable(384) %0, ptr noundef %1) unnamed_addr #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca %"class.jet::Size2", align 8
  %5 = alloca %"class.jet::Size2", align 8
  %6 = alloca %"class.jet::Size2", align 8
  %7 = alloca %"class.jet::Size2", align 8
  %8 = alloca i64, align 8
  store ptr %1, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #2
  call void @_ZNK3jet17FaceCenteredGrid25uSizeEv(ptr dead_on_unwind nonnull writable sret(%"class.jet::Size2") align 8 %4, ptr noundef nonnull align 8 dereferenceable(384) %0)
  %9 = load i64, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #2
  call void @_ZNK3jet17FaceCenteredGrid25uSizeEv(ptr dead_on_unwind nonnull writable sret(%"class.jet::Size2") align 8 %5, ptr noundef nonnull align 8 dereferenceable(384) %0)
  %10 = getelementptr inbounds i8, ptr %5, i64 8
  %11 = load i64, ptr %10, align 8, !tbaa !12
  %12 = mul i64 %11, %9
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #2
  call void @_ZNK3jet17FaceCenteredGrid25vSizeEv(ptr dead_on_unwind nonnull writable sret(%"class.jet::Size2") align 8 %6, ptr noundef nonnull align 8 dereferenceable(384) %0)
  %13 = load i64, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #2
  call void @_ZNK3jet17FaceCenteredGrid25vSizeEv(ptr dead_on_unwind nonnull writable sret(%"class.jet::Size2") align 8 %7, ptr noundef nonnull align 8 dereferenceable(384) %0)
  %14 = getelementptr inbounds i8, ptr %7, i64 8
  %15 = load i64, ptr %14, align 8, !tbaa !12
  %16 = mul i64 %15, %13
  %17 = add i64 %16, %12
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #2
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #2
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #2
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #2
  call void @_ZNSt6vectorIdSaIdEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %17)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #2
  store i64 0, ptr %8, align 8, !tbaa !13
  %18 = getelementptr inbounds i8, ptr %0, i64 96
  call void @"_ZNK3jet5ArrayIdLm2EE7forEachIZNKS_17FaceCenteredGrid27getDataEPSt6vectorIdSaIdEEE3$_0EEvT_"(ptr noundef nonnull align 8 dereferenceable(40) %18, ptr nonnull %3, ptr nonnull %8)
  %19 = getelementptr inbounds i8, ptr %0, i64 136
  call void @"_ZNK3jet5ArrayIdLm2EE7forEachIZNKS_17FaceCenteredGrid27getDataEPSt6vectorIdSaIdEEE3$_1EEvT_"(ptr noundef nonnull align 8 dereferenceable(40) %19, ptr nonnull %3, ptr nonnull %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #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 @"_ZNK3jet5ArrayIdLm2EE7forEachIZNKS_17FaceCenteredGrid27getDataEPSt6vectorIdSaIdEEE3$_0EEvT_"(ptr noundef nonnull align 8 dereferenceable(40), ptr, ptr) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare hidden void @"_ZNK3jet5ArrayIdLm2EE7forEachIZNKS_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, !11, i64 0}
!10 = !{!"_ZTSN3jet5Size2E", !11, i64 0, !11, i64 8}
!11 = !{!"long", !7, i64 0}
!12 = !{!10, !11, i64 8}
!13 = !{!11, !11, i64 0}


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