; LLVM IR from SourangshuGhosh/Fluid-Simulation-for-Computer-Graphics :: src/pressuresolver.ll (ZN14PressureSolver11_initializeE24PressureSolverParameters)

; 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.PressureSolverParameters = type { double, double, double, ptr, ptr, ptr, ptr }
%class.FluidMaterialGrid = type { i32, i32, i32, %class.SubdividedArray3d }
%class.SubdividedArray3d = type { i32, i32, i32, i32, i32, i32, %class.Array3d, i32, double }
%class.Array3d = type { i32, i32, i32, ptr, i8, i8, i32 }
%class.PressureSolver = type { i32, i32, i32, double, double, double, i32, double, i32, ptr, ptr, ptr, ptr, %class.GridIndexKeyMap }
%class.GridIndexKeyMap = type <{ i32, i32, i32, [4 x i8], %"class.std::vector.5", i32, [4 x i8] }>
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN14PressureSolver11_initializeE24PressureSolverParameters(ptr noundef nonnull align 8 dereferenceable(144) %0, ptr noundef byval(%struct.PressureSolverParameters) align 8 %1) #0 align 2 {
  %3 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %4 = load ptr, ptr %3, align 8
  %5 = getelementptr inbounds %struct.PressureSolverParameters, ptr %1, i32 0, i32 4
  %6 = load ptr, ptr %5, align 8, !tbaa !9
  %7 = getelementptr inbounds %class.FluidMaterialGrid, ptr %6, i32 0, i32 0
  %8 = load i32, ptr %7, align 8, !tbaa !12
  %9 = getelementptr inbounds %class.PressureSolver, ptr %4, i32 0, i32 0
  store i32 %8, ptr %9, align 8, !tbaa !19
  %10 = getelementptr inbounds %struct.PressureSolverParameters, ptr %1, i32 0, i32 4
  %11 = load ptr, ptr %10, align 8, !tbaa !9
  %12 = getelementptr inbounds %class.FluidMaterialGrid, ptr %11, i32 0, i32 1
  %13 = load i32, ptr %12, align 4, !tbaa !26
  %14 = getelementptr inbounds %class.PressureSolver, ptr %4, i32 0, i32 1
  store i32 %13, ptr %14, align 4, !tbaa !27
  %15 = getelementptr inbounds %struct.PressureSolverParameters, ptr %1, i32 0, i32 4
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  %17 = getelementptr inbounds %class.FluidMaterialGrid, ptr %16, i32 0, i32 2
  %18 = load i32, ptr %17, align 8, !tbaa !28
  %19 = getelementptr inbounds %class.PressureSolver, ptr %4, i32 0, i32 2
  store i32 %18, ptr %19, align 8, !tbaa !29
  %20 = getelementptr inbounds %struct.PressureSolverParameters, ptr %1, i32 0, i32 0
  %21 = load double, ptr %20, align 8, !tbaa !30
  %22 = getelementptr inbounds %class.PressureSolver, ptr %4, i32 0, i32 3
  store double %21, ptr %22, align 8, !tbaa !31
  %23 = getelementptr inbounds %struct.PressureSolverParameters, ptr %1, i32 0, i32 1
  %24 = load double, ptr %23, align 8, !tbaa !32
  %25 = getelementptr inbounds %class.PressureSolver, ptr %4, i32 0, i32 4
  store double %24, ptr %25, align 8, !tbaa !33
  %26 = getelementptr inbounds %struct.PressureSolverParameters, ptr %1, i32 0, i32 2
  %27 = load double, ptr %26, align 8, !tbaa !34
  %28 = getelementptr inbounds %class.PressureSolver, ptr %4, i32 0, i32 5
  store double %27, ptr %28, align 8, !tbaa !35
  %29 = getelementptr inbounds %struct.PressureSolverParameters, ptr %1, i32 0, i32 3
  %30 = load ptr, ptr %29, align 8, !tbaa !36
  %31 = getelementptr inbounds %class.PressureSolver, ptr %4, i32 0, i32 9
  store ptr %30, ptr %31, align 8, !tbaa !37
  %32 = getelementptr inbounds %struct.PressureSolverParameters, ptr %1, i32 0, i32 4
  %33 = load ptr, ptr %32, align 8, !tbaa !9
  %34 = getelementptr inbounds %class.PressureSolver, ptr %4, i32 0, i32 10
  store ptr %33, ptr %34, align 8, !tbaa !38
  %35 = getelementptr inbounds %struct.PressureSolverParameters, ptr %1, i32 0, i32 5
  %36 = load ptr, ptr %35, align 8, !tbaa !39
  %37 = getelementptr inbounds %class.PressureSolver, ptr %4, i32 0, i32 11
  store ptr %36, ptr %37, align 8, !tbaa !40
  %38 = getelementptr inbounds %struct.PressureSolverParameters, ptr %1, i32 0, i32 6
  %39 = load ptr, ptr %38, align 8, !tbaa !41
  %40 = getelementptr inbounds %class.PressureSolver, ptr %4, i32 0, i32 12
  store ptr %39, ptr %40, align 8, !tbaa !42
  %41 = getelementptr inbounds %class.PressureSolver, ptr %4, i32 0, i32 9
  %42 = load ptr, ptr %41, align 8, !tbaa !37
  %43 = call noundef i64 @_ZN15GridIndexVector4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %42)
  %44 = trunc i64 %43 to i32
  %45 = getelementptr inbounds %class.PressureSolver, ptr %4, i32 0, i32 6
  store i32 %44, ptr %45, align 8, !tbaa !43
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN15GridIndexVector4sizeEv(ptr noundef nonnull align 8 dereferenceable(40)) #1 align 2

attributes #0 = { 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 #1 = { inlinehint 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" }

!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, !6, i64 32}
!10 = !{!"_ZTS24PressureSolverParameters", !11, i64 0, !11, i64 8, !11, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}
!11 = !{!"double", !7, i64 0}
!12 = !{!13, !14, i64 0}
!13 = !{!"_ZTS17FluidMaterialGrid", !14, i64 0, !14, i64 4, !14, i64 8, !15, i64 16}
!14 = !{!"int", !7, i64 0}
!15 = !{!"_ZTS17SubdividedArray3dI8MaterialE", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12, !14, i64 16, !14, i64 20, !16, i64 24, !14, i64 56, !11, i64 64}
!16 = !{!"_ZTS7Array3dI8MaterialE", !14, i64 0, !14, i64 4, !14, i64 8, !6, i64 16, !17, i64 24, !18, i64 25, !14, i64 28}
!17 = !{!"bool", !7, i64 0}
!18 = !{!"_ZTS8Material", !7, i64 0}
!19 = !{!20, !14, i64 0}
!20 = !{!"_ZTS14PressureSolver", !14, i64 0, !14, i64 4, !14, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !14, i64 40, !11, i64 48, !14, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !21, i64 96}
!21 = !{!"_ZTS15GridIndexKeyMap", !14, i64 0, !14, i64 4, !14, i64 8, !22, i64 16, !14, i64 40}
!22 = !{!"_ZTSSt6vectorIiSaIiEE", !23, i64 0}
!23 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!26 = !{!13, !14, i64 4}
!27 = !{!20, !14, i64 4}
!28 = !{!13, !14, i64 8}
!29 = !{!20, !14, i64 8}
!30 = !{!10, !11, i64 0}
!31 = !{!20, !11, i64 16}
!32 = !{!10, !11, i64 8}
!33 = !{!20, !11, i64 24}
!34 = !{!10, !11, i64 16}
!35 = !{!20, !11, i64 32}
!36 = !{!10, !6, i64 24}
!37 = !{!20, !6, i64 64}
!38 = !{!20, !6, i64 72}
!39 = !{!10, !6, i64 40}
!40 = !{!20, !6, i64 80}
!41 = !{!10, !6, i64 48}
!42 = !{!20, !6, i64 88}
!43 = !{!20, !14, i64 40}


; 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"

%struct.PressureSolverParameters = type { double, double, double, ptr, ptr, ptr, ptr }

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN14PressureSolver11_initializeE24PressureSolverParameters(ptr nocapture noundef nonnull writeonly align 8 dereferenceable(144) %0, ptr nocapture noundef readonly byval(%struct.PressureSolverParameters) align 8 %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %1, i64 32
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = load <2 x i32>, ptr %4, align 8, !tbaa !11
  store <2 x i32> %5, ptr %0, align 8, !tbaa !11
  %6 = getelementptr inbounds i8, ptr %4, i64 8
  %7 = load i32, ptr %6, align 8, !tbaa !13
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %7, ptr %8, align 8, !tbaa !19
  %9 = getelementptr inbounds i8, ptr %0, i64 16
  %10 = load <2 x double>, ptr %1, align 8, !tbaa !26
  store <2 x double> %10, ptr %9, align 8, !tbaa !26
  %11 = getelementptr inbounds i8, ptr %1, i64 16
  %12 = load double, ptr %11, align 8, !tbaa !27
  %13 = getelementptr inbounds i8, ptr %0, i64 32
  store double %12, ptr %13, align 8, !tbaa !28
  %14 = getelementptr inbounds i8, ptr %1, i64 24
  %15 = load ptr, ptr %14, align 8, !tbaa !29
  %16 = getelementptr inbounds i8, ptr %0, i64 64
  store ptr %15, ptr %16, align 8, !tbaa !30
  %17 = getelementptr inbounds i8, ptr %0, i64 72
  store ptr %4, ptr %17, align 8, !tbaa !31
  %18 = getelementptr inbounds i8, ptr %1, i64 40
  %19 = getelementptr inbounds i8, ptr %0, i64 80
  %20 = load <2 x ptr>, ptr %18, align 8, !tbaa !32
  store <2 x ptr> %20, ptr %19, align 8, !tbaa !32
  %21 = tail call noundef i64 @_ZN15GridIndexVector4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %15)
  %22 = trunc i64 %21 to i32
  %23 = getelementptr inbounds i8, ptr %0, i64 40
  store i32 %22, ptr %23, align 8, !tbaa !33
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN15GridIndexVector4sizeEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #1 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 = { inlinehint 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" }

!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, !10, i64 32}
!6 = !{!"_ZTS24PressureSolverParameters", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!14, !12, i64 8}
!14 = !{!"_ZTS17FluidMaterialGrid", !12, i64 0, !12, i64 4, !12, i64 8, !15, i64 16}
!15 = !{!"_ZTS17SubdividedArray3dI8MaterialE", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !16, i64 24, !12, i64 56, !7, i64 64}
!16 = !{!"_ZTS7Array3dI8MaterialE", !12, i64 0, !12, i64 4, !12, i64 8, !10, i64 16, !17, i64 24, !18, i64 25, !12, i64 28}
!17 = !{!"bool", !8, i64 0}
!18 = !{!"_ZTS8Material", !8, i64 0}
!19 = !{!20, !12, i64 8}
!20 = !{!"_ZTS14PressureSolver", !12, i64 0, !12, i64 4, !12, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !12, i64 40, !7, i64 48, !12, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !21, i64 96}
!21 = !{!"_ZTS15GridIndexKeyMap", !12, i64 0, !12, i64 4, !12, i64 8, !22, i64 16, !12, i64 40}
!22 = !{!"_ZTSSt6vectorIiSaIiEE", !23, i64 0}
!23 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !10, i64 0, !10, i64 8, !10, i64 16}
!26 = !{!7, !7, i64 0}
!27 = !{!6, !7, i64 16}
!28 = !{!20, !7, i64 32}
!29 = !{!6, !10, i64 24}
!30 = !{!20, !10, i64 64}
!31 = !{!20, !10, i64 72}
!32 = !{!10, !10, i64 0}
!33 = !{!20, !12, i64 40}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,TailCallElimPass