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

; 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.ScalarField = type { i32, i32, i32, double, double, double, double, double, double, double, double, i8, [7 x i8], %class.Array3d, %class.Array3d.0, %class.Array3d, %class.Array3d.0, i8, %"class.vmath::vec3" }
%class.Array3d = type <{ i32, i32, i32, [4 x i8], ptr, i8, [3 x i8], float, i32, [4 x i8] }>
%class.Array3d.0 = type { i32, i32, i32, ptr, i8, i8, i32 }
%"class.vmath::vec3" = type { float, float, float }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11ScalarFieldC2Ev(ptr noundef nonnull align 8 dereferenceable(248) %0) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8
  %6 = getelementptr inbounds %class.ScalarField, ptr %5, i32 0, i32 0
  store i32 0, ptr %6, align 8, !tbaa !9
  %7 = getelementptr inbounds %class.ScalarField, ptr %5, i32 0, i32 1
  store i32 0, ptr %7, align 4, !tbaa !18
  %8 = getelementptr inbounds %class.ScalarField, ptr %5, i32 0, i32 2
  store i32 0, ptr %8, align 8, !tbaa !19
  %9 = getelementptr inbounds %class.ScalarField, ptr %5, i32 0, i32 3
  store double 0.000000e+00, ptr %9, align 8, !tbaa !20
  %10 = getelementptr inbounds %class.ScalarField, ptr %5, i32 0, i32 4
  store double 0.000000e+00, ptr %10, align 8, !tbaa !21
  %11 = getelementptr inbounds %class.ScalarField, ptr %5, i32 0, i32 5
  store double 1.000000e+00, ptr %11, align 8, !tbaa !22
  %12 = getelementptr inbounds %class.ScalarField, ptr %5, i32 0, i32 6
  store double 0.000000e+00, ptr %12, align 8, !tbaa !23
  %13 = getelementptr inbounds %class.ScalarField, ptr %5, i32 0, i32 7
  store double 0.000000e+00, ptr %13, align 8, !tbaa !24
  %14 = getelementptr inbounds %class.ScalarField, ptr %5, i32 0, i32 8
  store double 0.000000e+00, ptr %14, align 8, !tbaa !25
  %15 = getelementptr inbounds %class.ScalarField, ptr %5, i32 0, i32 9
  store double 5.000000e-01, ptr %15, align 8, !tbaa !26
  %16 = getelementptr inbounds %class.ScalarField, ptr %5, i32 0, i32 10
  store double 0.000000e+00, ptr %16, align 8, !tbaa !27
  %17 = getelementptr inbounds %class.ScalarField, ptr %5, i32 0, i32 11
  store i8 0, ptr %17, align 8, !tbaa !28
  %18 = getelementptr inbounds %class.ScalarField, ptr %5, i32 0, i32 13
  call void @_ZN7Array3dIfEC2Ev(ptr noundef nonnull align 8 dereferenceable(36) %18)
  %19 = getelementptr inbounds %class.ScalarField, ptr %5, i32 0, i32 14
  invoke void @_ZN7Array3dIbEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %19)
          to label %20 unwind label %28

20:                                               ; preds = %1
  %21 = getelementptr inbounds %class.ScalarField, ptr %5, i32 0, i32 15
  invoke void @_ZN7Array3dIfEC2Ev(ptr noundef nonnull align 8 dereferenceable(36) %21)
          to label %22 unwind label %32

22:                                               ; preds = %20
  %23 = getelementptr inbounds %class.ScalarField, ptr %5, i32 0, i32 16
  invoke void @_ZN7Array3dIbEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %23)
          to label %24 unwind label %36

24:                                               ; preds = %22
  %25 = getelementptr inbounds %class.ScalarField, ptr %5, i32 0, i32 17
  store i8 0, ptr %25, align 8, !tbaa !29
  %26 = getelementptr inbounds %class.ScalarField, ptr %5, i32 0, i32 18
  invoke void @_ZN5vmath4vec3C1Ev(ptr noundef nonnull align 4 dereferenceable(12) %26)
          to label %27 unwind label %40

27:                                               ; preds = %24
  ret void

28:                                               ; preds = %1
  %29 = landingpad { ptr, i32 }
          cleanup
  %30 = extractvalue { ptr, i32 } %29, 0
  store ptr %30, ptr %3, align 8
  %31 = extractvalue { ptr, i32 } %29, 1
  store i32 %31, ptr %4, align 4
  br label %46

32:                                               ; preds = %20
  %33 = landingpad { ptr, i32 }
          cleanup
  %34 = extractvalue { ptr, i32 } %33, 0
  store ptr %34, ptr %3, align 8
  %35 = extractvalue { ptr, i32 } %33, 1
  store i32 %35, ptr %4, align 4
  br label %45

36:                                               ; preds = %22
  %37 = landingpad { ptr, i32 }
          cleanup
  %38 = extractvalue { ptr, i32 } %37, 0
  store ptr %38, ptr %3, align 8
  %39 = extractvalue { ptr, i32 } %37, 1
  store i32 %39, ptr %4, align 4
  br label %44

40:                                               ; preds = %24
  %41 = landingpad { ptr, i32 }
          cleanup
  %42 = extractvalue { ptr, i32 } %41, 0
  store ptr %42, ptr %3, align 8
  %43 = extractvalue { ptr, i32 } %41, 1
  store i32 %43, ptr %4, align 4
  call void @_ZN7Array3dIbED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %23) #3
  br label %44

44:                                               ; preds = %40, %36
  call void @_ZN7Array3dIfED2Ev(ptr noundef nonnull align 8 dereferenceable(36) %21) #3
  br label %45

45:                                               ; preds = %44, %32
  call void @_ZN7Array3dIbED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %19) #3
  br label %46

46:                                               ; preds = %45, %28
  call void @_ZN7Array3dIfED2Ev(ptr noundef nonnull align 8 dereferenceable(36) %18) #3
  br label %47

47:                                               ; preds = %46
  %48 = load ptr, ptr %3, align 8
  %49 = load i32, ptr %4, align 4
  %50 = insertvalue { ptr, i32 } poison, ptr %48, 0
  %51 = insertvalue { ptr, i32 } %50, i32 %49, 1
  resume { ptr, i32 } %51
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Array3dIfEC2Ev(ptr noundef nonnull align 8 dereferenceable(36)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Array3dIbEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

declare void @_ZN5vmath4vec3C1Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7Array3dIbED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7Array3dIfED2Ev(ptr noundef nonnull align 8 dereferenceable(36)) unnamed_addr #2 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 = { "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 = { 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 #3 = { 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, !11, i64 0}
!10 = !{!"_ZTS11ScalarField", !11, i64 0, !11, i64 4, !11, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !13, i64 80, !14, i64 88, !16, i64 128, !14, i64 160, !16, i64 200, !13, i64 232, !17, i64 236}
!11 = !{!"int", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"_ZTS7Array3dIfE", !11, i64 0, !11, i64 4, !11, i64 8, !6, i64 16, !13, i64 24, !15, i64 28, !11, i64 32}
!15 = !{!"float", !7, i64 0}
!16 = !{!"_ZTS7Array3dIbE", !11, i64 0, !11, i64 4, !11, i64 8, !6, i64 16, !13, i64 24, !13, i64 25, !11, i64 28}
!17 = !{!"_ZTSN5vmath4vec3E", !15, i64 0, !15, i64 4, !15, i64 8}
!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, !12, i64 40}
!24 = !{!10, !12, i64 48}
!25 = !{!10, !12, i64 56}
!26 = !{!10, !12, i64 64}
!27 = !{!10, !12, i64 72}
!28 = !{!10, !13, i64 80}
!29 = !{!10, !13, i64 232}


; 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 @_ZN11ScalarFieldC2Ev(ptr noundef nonnull align 8 dereferenceable(248) %0) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  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 32
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %4, i8 0, i64 16, i1 false)
  store double 1.000000e+00, ptr %5, align 8, !tbaa !19
  %6 = getelementptr inbounds i8, ptr %0, i64 40
  %7 = getelementptr inbounds i8, ptr %0, i64 64
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %6, i8 0, i64 24, i1 false)
  store <2 x double> <double 5.000000e-01, double 0.000000e+00>, ptr %7, align 8, !tbaa !20
  %8 = getelementptr inbounds i8, ptr %0, i64 80
  store i8 0, ptr %8, align 8, !tbaa !21
  %9 = getelementptr inbounds i8, ptr %0, i64 88
  tail call void @_ZN7Array3dIfEC2Ev(ptr noundef nonnull align 8 dereferenceable(36) %9)
  %10 = getelementptr inbounds i8, ptr %0, i64 128
  invoke void @_ZN7Array3dIbEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10)
          to label %11 unwind label %19

11:                                               ; preds = %1
  %12 = getelementptr inbounds i8, ptr %0, i64 160
  invoke void @_ZN7Array3dIfEC2Ev(ptr noundef nonnull align 8 dereferenceable(36) %12)
          to label %13 unwind label %21

13:                                               ; preds = %11
  %14 = getelementptr inbounds i8, ptr %0, i64 200
  invoke void @_ZN7Array3dIbEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %14)
          to label %15 unwind label %23

15:                                               ; preds = %13
  %16 = getelementptr inbounds i8, ptr %0, i64 232
  store i8 0, ptr %16, align 8, !tbaa !22
  %17 = getelementptr inbounds i8, ptr %0, i64 236
  invoke void @_ZN5vmath4vec3C1Ev(ptr noundef nonnull align 4 dereferenceable(12) %17)
          to label %18 unwind label %25

18:                                               ; preds = %15
  ret void

19:                                               ; preds = %1
  %20 = landingpad { ptr, i32 }
          cleanup
  br label %29

21:                                               ; preds = %11
  %22 = landingpad { ptr, i32 }
          cleanup
  br label %28

23:                                               ; preds = %13
  %24 = landingpad { ptr, i32 }
          cleanup
  br label %27

25:                                               ; preds = %15
  %26 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN7Array3dIbED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %14) #4
  br label %27

27:                                               ; preds = %25, %23
  %.pn = phi { ptr, i32 } [ %26, %25 ], [ %24, %23 ]
  tail call void @_ZN7Array3dIfED2Ev(ptr noundef nonnull align 8 dereferenceable(36) %12) #4
  br label %28

28:                                               ; preds = %27, %21
  %.pn.pn = phi { ptr, i32 } [ %.pn, %27 ], [ %22, %21 ]
  tail call void @_ZN7Array3dIbED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #4
  br label %29

29:                                               ; preds = %28, %19
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %28 ], [ %20, %19 ]
  tail call void @_ZN7Array3dIfED2Ev(ptr noundef nonnull align 8 dereferenceable(36) %9) #4
  resume { ptr, i32 } %.pn.pn.pn
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Array3dIfEC2Ev(ptr noundef nonnull align 8 dereferenceable(36)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Array3dIbEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

declare void @_ZN5vmath4vec3C1Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7Array3dIbED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7Array3dIfED2Ev(ptr noundef nonnull align 8 dereferenceable(36)) unnamed_addr #2 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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, !7, i64 0}
!6 = !{!"_ZTS11ScalarField", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !11, i64 80, !12, i64 88, !15, i64 128, !12, i64 160, !15, i64 200, !11, i64 232, !16, i64 236}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!"bool", !8, i64 0}
!12 = !{!"_ZTS7Array3dIfE", !7, i64 0, !7, i64 4, !7, i64 8, !13, i64 16, !11, i64 24, !14, i64 28, !7, i64 32}
!13 = !{!"any pointer", !8, i64 0}
!14 = !{!"float", !8, i64 0}
!15 = !{!"_ZTS7Array3dIbE", !7, i64 0, !7, i64 4, !7, i64 8, !13, i64 16, !11, i64 24, !11, i64 25, !7, i64 28}
!16 = !{!"_ZTSN5vmath4vec3E", !14, i64 0, !14, i64 4, !14, i64 8}
!17 = !{!6, !7, i64 4}
!18 = !{!6, !7, i64 8}
!19 = !{!6, !10, i64 32}
!20 = !{!10, !10, i64 0}
!21 = !{!6, !11, i64 80}
!22 = !{!6, !11, i64 232}


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