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

; 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.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 }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN17FluidMaterialGrid19setSubdivisionLevelEi(ptr noundef nonnull align 8 dereferenceable(88) %0, i32 noundef %1) #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %5 = load ptr, ptr %3, align 8
  %6 = getelementptr inbounds %class.FluidMaterialGrid, ptr %5, i32 0, i32 3
  %7 = load i32, ptr %4, align 4, !tbaa !9
  call void @_ZN17SubdividedArray3dI8MaterialE19setSubdivisionLevelEi(ptr noundef nonnull align 8 dereferenceable(72) %6, i32 noundef %7)
  %8 = getelementptr inbounds %class.FluidMaterialGrid, ptr %5, i32 0, i32 3
  %9 = getelementptr inbounds %class.SubdividedArray3d, ptr %8, i32 0, i32 0
  %10 = load i32, ptr %9, align 8, !tbaa !11
  %11 = getelementptr inbounds %class.FluidMaterialGrid, ptr %5, i32 0, i32 0
  store i32 %10, ptr %11, align 8, !tbaa !18
  %12 = getelementptr inbounds %class.FluidMaterialGrid, ptr %5, i32 0, i32 3
  %13 = getelementptr inbounds %class.SubdividedArray3d, ptr %12, i32 0, i32 1
  %14 = load i32, ptr %13, align 4, !tbaa !19
  %15 = getelementptr inbounds %class.FluidMaterialGrid, ptr %5, i32 0, i32 1
  store i32 %14, ptr %15, align 4, !tbaa !20
  %16 = getelementptr inbounds %class.FluidMaterialGrid, ptr %5, i32 0, i32 3
  %17 = getelementptr inbounds %class.SubdividedArray3d, ptr %16, i32 0, i32 2
  %18 = load i32, ptr %17, align 8, !tbaa !21
  %19 = getelementptr inbounds %class.FluidMaterialGrid, ptr %5, i32 0, i32 2
  store i32 %18, ptr %19, align 8, !tbaa !22
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN17SubdividedArray3dI8MaterialE19setSubdivisionLevelEi(ptr noundef nonnull align 8 dereferenceable(72), i32 noundef) #0 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" }

!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 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 16}
!12 = !{!"_ZTS17FluidMaterialGrid", !10, i64 0, !10, i64 4, !10, i64 8, !13, i64 16}
!13 = !{!"_ZTS17SubdividedArray3dI8MaterialE", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !14, i64 24, !10, i64 56, !17, i64 64}
!14 = !{!"_ZTS7Array3dI8MaterialE", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16, !15, i64 24, !16, i64 25, !10, i64 28}
!15 = !{!"bool", !7, i64 0}
!16 = !{!"_ZTS8Material", !7, i64 0}
!17 = !{!"double", !7, i64 0}
!18 = !{!12, !10, i64 0}
!19 = !{!12, !10, i64 20}
!20 = !{!12, !10, i64 4}
!21 = !{!12, !10, i64 24}
!22 = !{!12, !10, i64 8}


; 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 @_ZN17FluidMaterialGrid19setSubdivisionLevelEi(ptr noundef nonnull align 8 dereferenceable(88) %0, i32 noundef %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  tail call void @_ZN17SubdividedArray3dI8MaterialE19setSubdivisionLevelEi(ptr noundef nonnull align 8 dereferenceable(72) %3, i32 noundef %1)
  %4 = load <2 x i32>, ptr %3, align 8, !tbaa !5
  store <2 x i32> %4, ptr %0, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 24
  %6 = load i32, ptr %5, align 8, !tbaa !9
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %6, ptr %7, align 8, !tbaa !17
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN17SubdividedArray3dI8MaterialE19setSubdivisionLevelEi(ptr noundef nonnull align 8 dereferenceable(72), i32 noundef) local_unnamed_addr #0 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" }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 24}
!10 = !{!"_ZTS17FluidMaterialGrid", !6, i64 0, !6, i64 4, !6, i64 8, !11, i64 16}
!11 = !{!"_ZTS17SubdividedArray3dI8MaterialE", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !12, i64 24, !6, i64 56, !16, i64 64}
!12 = !{!"_ZTS7Array3dI8MaterialE", !6, i64 0, !6, i64 4, !6, i64 8, !13, i64 16, !14, i64 24, !15, i64 25, !6, i64 28}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{!"_ZTS8Material", !7, i64 0}
!16 = !{!"double", !7, i64 0}
!17 = !{!10, !6, i64 8}


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