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

; 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.11 = type { ptr, ptr }
%"class.jet::CollocatedVectorGrid2" = type { %"class.jet::VectorGrid2", %"class.jet::Array", %"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::Vector" = type { double, double }
%"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<jet::Vector<double, 2>, std::allocator<jet::Vector<double, 2>>>::_Vector_impl" }
%"struct.std::_Vector_base<jet::Vector<double, 2>, std::allocator<jet::Vector<double, 2>>>::_Vector_impl" = type { %"struct.std::_Vector_base<jet::Vector<double, 2>, std::allocator<jet::Vector<double, 2>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<jet::Vector<double, 2>, std::allocator<jet::Vector<double, 2>>>::_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::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
define dso_local void @_ZNK3jet21CollocatedVectorGrid27getDataEPSt6vectorIdSaIdEE(ptr noundef nonnull align 8 dereferenceable(240) %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 i64, align 8
  %9 = alloca %class.anon.11, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %10 = 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
  %11 = load ptr, ptr %10, align 8, !tbaa !9
  %12 = getelementptr inbounds ptr, ptr %11, i64 12
  %13 = load ptr, ptr %12, align 8
  call void %13(ptr dead_on_unwind writable sret(%"class.jet::Size2") align 8 %6, ptr noundef nonnull align 8 dereferenceable(240) %10)
  %14 = getelementptr inbounds %"class.jet::Size2", ptr %6, i32 0, i32 0
  %15 = load i64, ptr %14, align 8, !tbaa !11
  %16 = mul i64 2, %15
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #2
  %17 = load ptr, ptr %10, align 8, !tbaa !9
  %18 = getelementptr inbounds ptr, ptr %17, i64 12
  %19 = load ptr, ptr %18, align 8
  call void %19(ptr dead_on_unwind writable sret(%"class.jet::Size2") align 8 %7, ptr noundef nonnull align 8 dereferenceable(240) %10)
  %20 = getelementptr inbounds %"class.jet::Size2", ptr %7, i32 0, i32 1
  %21 = load i64, ptr %20, align 8, !tbaa !14
  %22 = mul i64 %16, %21
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #2
  store i64 %22, ptr %5, align 8, !tbaa !15
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = load i64, ptr %5, align 8, !tbaa !15
  call void @_ZNSt6vectorIdSaIdEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %23, i64 noundef %24)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  store i64 0, ptr %8, align 8, !tbaa !15
  %25 = getelementptr inbounds %"class.jet::CollocatedVectorGrid2", ptr %10, i32 0, i32 1
  %26 = getelementptr inbounds %class.anon.11, ptr %9, i32 0, i32 0
  store ptr %4, ptr %26, align 8, !tbaa !5
  %27 = getelementptr inbounds %class.anon.11, ptr %9, i32 0, i32 1
  store ptr %8, ptr %27, align 8, !tbaa !5
  %28 = getelementptr inbounds { ptr, ptr }, ptr %9, i32 0, i32 0
  %29 = load ptr, ptr %28, align 8
  %30 = getelementptr inbounds { ptr, ptr }, ptr %9, i32 0, i32 1
  %31 = load ptr, ptr %30, align 8
  call void @"_ZNK3jet5ArrayINS_6VectorIdLm2EEELm2EE7forEachIZNKS_21CollocatedVectorGrid27getDataEPSt6vectorIdSaIdEEE3$_0EEvT_"(ptr noundef nonnull align 8 dereferenceable(40) %25, ptr %29, ptr %31)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #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_6VectorIdLm2EEELm2EE7forEachIZNKS_21CollocatedVectorGrid27getDataEPSt6vectorIdSaIdEEE3$_0EEvT_"(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, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTSN3jet5Size2E", !13, i64 0, !13, i64 8}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !13, i64 8}
!15 = !{!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::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
define dso_local void @_ZNK3jet21CollocatedVectorGrid27getDataEPSt6vectorIdSaIdEE(ptr noundef nonnull align 8 dereferenceable(240) %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 i64, align 8
  store ptr %1, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #2
  %7 = load ptr, ptr %0, align 8, !tbaa !9
  %8 = getelementptr inbounds i8, ptr %7, i64 96
  %9 = load ptr, ptr %8, align 8
  call void %9(ptr dead_on_unwind nonnull writable sret(%"class.jet::Size2") align 8 %4, ptr noundef nonnull align 8 dereferenceable(240) %0)
  %10 = load i64, ptr %4, align 8, !tbaa !11
  %11 = shl i64 %10, 1
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #2
  %12 = load ptr, ptr %0, align 8, !tbaa !9
  %13 = getelementptr inbounds i8, ptr %12, i64 96
  %14 = load ptr, ptr %13, align 8
  call void %14(ptr dead_on_unwind nonnull writable sret(%"class.jet::Size2") align 8 %5, ptr noundef nonnull align 8 dereferenceable(240) %0)
  %15 = getelementptr inbounds i8, ptr %5, i64 8
  %16 = load i64, ptr %15, align 8, !tbaa !14
  %17 = mul i64 %11, %16
  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 %6) #2
  store i64 0, ptr %6, align 8, !tbaa !15
  %18 = getelementptr inbounds i8, ptr %0, i64 96
  call void @"_ZNK3jet5ArrayINS_6VectorIdLm2EEELm2EE7forEachIZNKS_21CollocatedVectorGrid27getDataEPSt6vectorIdSaIdEEE3$_0EEvT_"(ptr noundef nonnull align 8 dereferenceable(40) %18, ptr nonnull %3, ptr nonnull %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #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_6VectorIdLm2EEELm2EE7forEachIZNKS_21CollocatedVectorGrid27getDataEPSt6vectorIdSaIdEEE3$_0EEvT_"(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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTSN3jet5Size2E", !13, i64 0, !13, i64 8}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !13, i64 8}
!15 = !{!13, !13, i64 0}


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