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

; 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.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 @_ZN14PressureSolverC2Ev(ptr noundef nonnull align 8 dereferenceable(144) %0) unnamed_addr #0 align 2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  %4 = getelementptr inbounds %class.PressureSolver, ptr %3, i32 0, i32 0
  store i32 0, ptr %4, align 8, !tbaa !9
  %5 = getelementptr inbounds %class.PressureSolver, ptr %3, i32 0, i32 1
  store i32 0, ptr %5, align 4, !tbaa !18
  %6 = getelementptr inbounds %class.PressureSolver, ptr %3, i32 0, i32 2
  store i32 0, ptr %6, align 8, !tbaa !19
  %7 = getelementptr inbounds %class.PressureSolver, ptr %3, i32 0, i32 3
  store double 0.000000e+00, ptr %7, align 8, !tbaa !20
  %8 = getelementptr inbounds %class.PressureSolver, ptr %3, i32 0, i32 4
  store double 0.000000e+00, ptr %8, align 8, !tbaa !21
  %9 = getelementptr inbounds %class.PressureSolver, ptr %3, i32 0, i32 5
  store double 0.000000e+00, ptr %9, align 8, !tbaa !22
  %10 = getelementptr inbounds %class.PressureSolver, ptr %3, i32 0, i32 6
  store i32 0, ptr %10, align 8, !tbaa !23
  %11 = getelementptr inbounds %class.PressureSolver, ptr %3, i32 0, i32 7
  store double 0x3EB0C6F7A0B5ED8D, ptr %11, align 8, !tbaa !24
  %12 = getelementptr inbounds %class.PressureSolver, ptr %3, i32 0, i32 8
  store i32 200, ptr %12, align 8, !tbaa !25
  %13 = getelementptr inbounds %class.PressureSolver, ptr %3, i32 0, i32 13
  call void @_ZN15GridIndexKeyMapC1Ev(ptr noundef nonnull align 8 dereferenceable(44) %13)
  ret void
}

declare void @_ZN15GridIndexKeyMapC1Ev(ptr noundef nonnull align 8 dereferenceable(44)) unnamed_addr #1

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 = { "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, !11, i64 0}
!10 = !{!"_ZTS14PressureSolver", !11, i64 0, !11, i64 4, !11, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !11, i64 40, !12, i64 48, !11, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !13, i64 96}
!11 = !{!"int", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!"_ZTS15GridIndexKeyMap", !11, i64 0, !11, i64 4, !11, i64 8, !14, i64 16, !11, i64 40}
!14 = !{!"_ZTSSt6vectorIiSaIiEE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!18 = !{!10, !11, i64 4}
!19 = !{!10, !11, i64 8}
!20 = !{!10, !12, i64 16}
!21 = !{!10, !12, i64 24}
!22 = !{!10, !12, i64 32}
!23 = !{!10, !11, i64 40}
!24 = !{!10, !12, i64 48}
!25 = !{!10, !11, i64 56}


; 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 uwtable
define dso_local void @_ZN14PressureSolverC2Ev(ptr noundef nonnull align 8 dereferenceable(144) %0) unnamed_addr #0 align 2 {
  store i32 0, ptr %0, align 8, !tbaa !5
  %2 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 0, ptr %2, align 4, !tbaa !17
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 0, ptr %3, align 8, !tbaa !18
  %4 = getelementptr inbounds i8, ptr %0, i64 16
  %5 = getelementptr inbounds i8, ptr %0, i64 48
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(28) %4, i8 0, i64 28, i1 false)
  store double 0x3EB0C6F7A0B5ED8D, ptr %5, align 8, !tbaa !19
  %6 = getelementptr inbounds i8, ptr %0, i64 56
  store i32 200, ptr %6, align 8, !tbaa !20
  %7 = getelementptr inbounds i8, ptr %0, i64 96
  tail call void @_ZN15GridIndexKeyMapC1Ev(ptr noundef nonnull align 8 dereferenceable(44) %7)
  ret void
}

declare void @_ZN15GridIndexKeyMapC1Ev(ptr noundef nonnull align 8 dereferenceable(44)) unnamed_addr #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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, !7, i64 0}
!6 = !{!"_ZTS14PressureSolver", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !7, i64 40, !10, i64 48, !7, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !11, i64 88, !12, i64 96}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"_ZTS15GridIndexKeyMap", !7, i64 0, !7, i64 4, !7, i64 8, !13, i64 16, !7, i64 40}
!13 = !{!"_ZTSSt6vectorIiSaIiEE", !14, i64 0}
!14 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!17 = !{!6, !7, i64 4}
!18 = !{!6, !7, i64 8}
!19 = !{!6, !10, i64 48}
!20 = !{!6, !7, i64 56}


; Effective O3 passes: EarlyCSEPass,InstCombinePass,MemCpyOptPass,SROAPass,TailCallElimPass