; LLVM IR from doyubkim/fluid-engine-dev :: src/jet (collocated_vector_grid3)

; 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::Size3" = type { i64, i64, i64 }
%class.anon.10 = type { ptr, ptr }
%"class.jet::CollocatedVectorGrid3" = type { %"class.jet::VectorGrid3", %"class.jet::Array", %"class.jet::LinearArraySampler", %"class.std::function" }
%"class.jet::VectorGrid3" = type { %"class.jet::VectorField3", %"class.jet::Grid3" }
%"class.jet::VectorField3" = type { %"class.jet::Field3" }
%"class.jet::Field3" = type { ptr }
%"class.jet::Grid3" = type { %"class.jet::Serializable", %"class.jet::Size3", %"class.jet::Vector", %"class.jet::Vector", %"class.jet::BoundingBox" }
%"class.jet::Serializable" = type { ptr }
%"class.jet::Vector" = type { double, double, double }
%"class.jet::BoundingBox" = type { %"class.jet::Vector", %"class.jet::Vector" }
%"class.jet::Array" = type { %"class.jet::Size3", %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<jet::Vector<double, 3>, std::allocator<jet::Vector<double, 3>>>::_Vector_impl" }
%"struct.std::_Vector_base<jet::Vector<double, 3>, std::allocator<jet::Vector<double, 3>>>::_Vector_impl" = type { %"struct.std::_Vector_base<jet::Vector<double, 3>, std::allocator<jet::Vector<double, 3>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<jet::Vector<double, 3>, std::allocator<jet::Vector<double, 3>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.jet::LinearArraySampler" = type { %"class.jet::Vector", %"class.jet::Vector", %"class.jet::Vector", %"class.jet::ConstArrayAccessor" }
%"class.jet::ConstArrayAccessor" = type { %"class.jet::Size3", 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
define dso_local void @_ZNK3jet21CollocatedVectorGrid37getDataEPSt6vectorIdSaIdEE(ptr noundef nonnull align 8 dereferenceable(320) %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::Size3", align 8
  %7 = alloca %"class.jet::Size3", align 8
  %8 = alloca %"class.jet::Size3", align 8
  %9 = alloca i64, align 8
  %10 = alloca %class.anon.10, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %11 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #2
  call void @llvm.lifetime.start.p0(i64 24, ptr %6) #2
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  %13 = getelementptr inbounds ptr, ptr %12, i64 12
  %14 = load ptr, ptr %13, align 8
  call void %14(ptr dead_on_unwind writable sret(%"class.jet::Size3") align 8 %6, ptr noundef nonnull align 8 dereferenceable(320) %11)
  %15 = getelementptr inbounds %"class.jet::Size3", ptr %6, i32 0, i32 0
  %16 = load i64, ptr %15, align 8, !tbaa !11
  %17 = mul i64 3, %16
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #2
  %18 = load ptr, ptr %11, align 8, !tbaa !9
  %19 = getelementptr inbounds ptr, ptr %18, i64 12
  %20 = load ptr, ptr %19, align 8
  call void %20(ptr dead_on_unwind writable sret(%"class.jet::Size3") align 8 %7, ptr noundef nonnull align 8 dereferenceable(320) %11)
  %21 = getelementptr inbounds %"class.jet::Size3", ptr %7, i32 0, i32 1
  %22 = load i64, ptr %21, align 8, !tbaa !14
  %23 = mul i64 %17, %22
  call void @llvm.lifetime.start.p0(i64 24, ptr %8) #2
  %24 = load ptr, ptr %11, align 8, !tbaa !9
  %25 = getelementptr inbounds ptr, ptr %24, i64 12
  %26 = load ptr, ptr %25, align 8
  call void %26(ptr dead_on_unwind writable sret(%"class.jet::Size3") align 8 %8, ptr noundef nonnull align 8 dereferenceable(320) %11)
  %27 = getelementptr inbounds %"class.jet::Size3", ptr %8, i32 0, i32 2
  %28 = load i64, ptr %27, align 8, !tbaa !15
  %29 = mul i64 %23, %28
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #2
  store i64 %29, ptr %5, align 8, !tbaa !16
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = load i64, ptr %5, align 8, !tbaa !16
  call void @_ZNSt6vectorIdSaIdEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %30, i64 noundef %31)
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #2
  store i64 0, ptr %9, align 8, !tbaa !16
  %32 = getelementptr inbounds %"class.jet::CollocatedVectorGrid3", ptr %11, i32 0, i32 1
  %33 = getelementptr inbounds %class.anon.10, ptr %10, i32 0, i32 0
  store ptr %4, ptr %33, align 8, !tbaa !5
  %34 = getelementptr inbounds %class.anon.10, ptr %10, i32 0, i32 1
  store ptr %9, ptr %34, align 8, !tbaa !5
  %35 = getelementptr inbounds { ptr, ptr }, ptr %10, i32 0, i32 0
  %36 = load ptr, ptr %35, align 8
  %37 = getelementptr inbounds { ptr, ptr }, ptr %10, i32 0, i32 1
  %38 = load ptr, ptr %37, align 8
  call void @"_ZNK3jet5ArrayINS_6VectorIdLm3EEELm3EE7forEachIZNKS_21CollocatedVectorGrid37getDataEPSt6vectorIdSaIdEEE3$_0EEvT_"(ptr noundef nonnull align 8 dereferenceable(48) %32, ptr %36, ptr %38)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #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 @"_ZNK3jet5ArrayINS_6VectorIdLm3EEELm3EE7forEachIZNKS_21CollocatedVectorGrid37getDataEPSt6vectorIdSaIdEEE3$_0EEvT_"(ptr noundef nonnull align 8 dereferenceable(48), 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, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTSN3jet5Size3E", !13, i64 0, !13, i64 8, !13, i64 16}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !13, i64 8}
!15 = !{!12, !13, i64 16}
!16 = !{!13, !13, 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::Size3" = type { i64, 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
define dso_local void @_ZNK3jet21CollocatedVectorGrid37getDataEPSt6vectorIdSaIdEE(ptr noundef nonnull align 8 dereferenceable(320) %0, ptr noundef %1) unnamed_addr #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca %"class.jet::Size3", align 8
  %5 = alloca %"class.jet::Size3", align 8
  %6 = alloca %"class.jet::Size3", align 8
  %7 = alloca i64, align 8
  store ptr %1, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #2
  %8 = load ptr, ptr %0, align 8, !tbaa !9
  %9 = getelementptr inbounds i8, ptr %8, i64 96
  %10 = load ptr, ptr %9, align 8
  call void %10(ptr dead_on_unwind nonnull writable sret(%"class.jet::Size3") align 8 %4, ptr noundef nonnull align 8 dereferenceable(320) %0)
  %11 = load i64, ptr %4, align 8, !tbaa !11
  %12 = mul i64 %11, 3
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #2
  %13 = load ptr, ptr %0, align 8, !tbaa !9
  %14 = getelementptr inbounds i8, ptr %13, i64 96
  %15 = load ptr, ptr %14, align 8
  call void %15(ptr dead_on_unwind nonnull writable sret(%"class.jet::Size3") align 8 %5, ptr noundef nonnull align 8 dereferenceable(320) %0)
  %16 = getelementptr inbounds i8, ptr %5, i64 8
  %17 = load i64, ptr %16, align 8, !tbaa !14
  %18 = mul i64 %12, %17
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #2
  %19 = load ptr, ptr %0, align 8, !tbaa !9
  %20 = getelementptr inbounds i8, ptr %19, i64 96
  %21 = load ptr, ptr %20, align 8
  call void %21(ptr dead_on_unwind nonnull writable sret(%"class.jet::Size3") align 8 %6, ptr noundef nonnull align 8 dereferenceable(320) %0)
  %22 = getelementptr inbounds i8, ptr %6, i64 16
  %23 = load i64, ptr %22, align 8, !tbaa !15
  %24 = mul i64 %18, %23
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #2
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #2
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #2
  call void @_ZNSt6vectorIdSaIdEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %24)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #2
  store i64 0, ptr %7, align 8, !tbaa !16
  %25 = getelementptr inbounds i8, ptr %0, i64 136
  call void @"_ZNK3jet5ArrayINS_6VectorIdLm3EEELm3EE7forEachIZNKS_21CollocatedVectorGrid37getDataEPSt6vectorIdSaIdEEE3$_0EEvT_"(ptr noundef nonnull align 8 dereferenceable(48) %25, ptr nonnull %3, ptr nonnull %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #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 @"_ZNK3jet5ArrayINS_6VectorIdLm3EEELm3EE7forEachIZNKS_21CollocatedVectorGrid37getDataEPSt6vectorIdSaIdEEE3$_0EEvT_"(ptr noundef nonnull align 8 dereferenceable(48), 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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTSN3jet5Size3E", !13, i64 0, !13, i64 8, !13, i64 16}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !13, i64 8}
!15 = !{!12, !13, i64 16}
!16 = !{!13, !13, i64 0}


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