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

; 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
declare dso_local void @_ZN7Array3dIfEC2Ev(ptr noundef nonnull align 8 dereferenceable(36)) 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: mustprogress uwtable
define dso_local void @_ZN11ScalarFieldC2Eiiid(ptr noundef nonnull align 8 dereferenceable(248) %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, double noundef %4) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca double, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store i32 %2, ptr %8, align 4, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !9
  store double %4, ptr %10, align 8, !tbaa !11
  %13 = load ptr, ptr %6, align 8
  %14 = getelementptr inbounds %class.ScalarField, ptr %13, i32 0, i32 0
  %15 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %15, ptr %14, align 8, !tbaa !13
  %16 = getelementptr inbounds %class.ScalarField, ptr %13, i32 0, i32 1
  %17 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %17, ptr %16, align 4, !tbaa !20
  %18 = getelementptr inbounds %class.ScalarField, ptr %13, i32 0, i32 2
  %19 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %19, ptr %18, align 8, !tbaa !21
  %20 = getelementptr inbounds %class.ScalarField, ptr %13, i32 0, i32 3
  %21 = load double, ptr %10, align 8, !tbaa !11
  store double %21, ptr %20, align 8, !tbaa !22
  %22 = getelementptr inbounds %class.ScalarField, ptr %13, i32 0, i32 4
  store double 0.000000e+00, ptr %22, align 8, !tbaa !23
  %23 = getelementptr inbounds %class.ScalarField, ptr %13, i32 0, i32 5
  store double 1.000000e+00, ptr %23, align 8, !tbaa !24
  %24 = getelementptr inbounds %class.ScalarField, ptr %13, i32 0, i32 6
  store double 0.000000e+00, ptr %24, align 8, !tbaa !25
  %25 = getelementptr inbounds %class.ScalarField, ptr %13, i32 0, i32 7
  store double 0.000000e+00, ptr %25, align 8, !tbaa !26
  %26 = getelementptr inbounds %class.ScalarField, ptr %13, i32 0, i32 8
  store double 0.000000e+00, ptr %26, align 8, !tbaa !27
  %27 = getelementptr inbounds %class.ScalarField, ptr %13, i32 0, i32 9
  store double 5.000000e-01, ptr %27, align 8, !tbaa !28
  %28 = getelementptr inbounds %class.ScalarField, ptr %13, i32 0, i32 10
  store double 0.000000e+00, ptr %28, align 8, !tbaa !29
  %29 = getelementptr inbounds %class.ScalarField, ptr %13, i32 0, i32 11
  store i8 0, ptr %29, align 8, !tbaa !30
  %30 = getelementptr inbounds %class.ScalarField, ptr %13, i32 0, i32 13
  %31 = load i32, ptr %7, align 4, !tbaa !9
  %32 = load i32, ptr %8, align 4, !tbaa !9
  %33 = load i32, ptr %9, align 4, !tbaa !9
  call void @_ZN7Array3dIfEC2Eiiif(ptr noundef nonnull align 8 dereferenceable(36) %30, i32 noundef %31, i32 noundef %32, i32 noundef %33, float noundef 0.000000e+00)
  %34 = getelementptr inbounds %class.ScalarField, ptr %13, i32 0, i32 14
  %35 = load i32, ptr %7, align 4, !tbaa !9
  %36 = load i32, ptr %8, align 4, !tbaa !9
  %37 = load i32, ptr %9, align 4, !tbaa !9
  invoke void @_ZN7Array3dIbEC2Eiiib(ptr noundef nonnull align 8 dereferenceable(32) %34, i32 noundef %35, i32 noundef %36, i32 noundef %37, i1 noundef zeroext false)
          to label %38 unwind label %49

38:                                               ; preds = %5
  %39 = getelementptr inbounds %class.ScalarField, ptr %13, i32 0, i32 15
  invoke void @_ZN7Array3dIfEC2Ev(ptr noundef nonnull align 8 dereferenceable(36) %39)
          to label %40 unwind label %53

40:                                               ; preds = %38
  %41 = getelementptr inbounds %class.ScalarField, ptr %13, i32 0, i32 16
  %42 = load i32, ptr %7, align 4, !tbaa !9
  %43 = load i32, ptr %8, align 4, !tbaa !9
  %44 = load i32, ptr %9, align 4, !tbaa !9
  invoke void @_ZN7Array3dIbEC2Eiiib(ptr noundef nonnull align 8 dereferenceable(32) %41, i32 noundef %42, i32 noundef %43, i32 noundef %44, i1 noundef zeroext false)
          to label %45 unwind label %57

45:                                               ; preds = %40
  %46 = getelementptr inbounds %class.ScalarField, ptr %13, i32 0, i32 17
  store i8 0, ptr %46, align 8, !tbaa !31
  %47 = getelementptr inbounds %class.ScalarField, ptr %13, i32 0, i32 18
  invoke void @_ZN5vmath4vec3C1Ev(ptr noundef nonnull align 4 dereferenceable(12) %47)
          to label %48 unwind label %61

48:                                               ; preds = %45
  ret void

49:                                               ; preds = %5
  %50 = landingpad { ptr, i32 }
          cleanup
  %51 = extractvalue { ptr, i32 } %50, 0
  store ptr %51, ptr %11, align 8
  %52 = extractvalue { ptr, i32 } %50, 1
  store i32 %52, ptr %12, align 4
  br label %67

53:                                               ; preds = %38
  %54 = landingpad { ptr, i32 }
          cleanup
  %55 = extractvalue { ptr, i32 } %54, 0
  store ptr %55, ptr %11, align 8
  %56 = extractvalue { ptr, i32 } %54, 1
  store i32 %56, ptr %12, align 4
  br label %66

57:                                               ; preds = %40
  %58 = landingpad { ptr, i32 }
          cleanup
  %59 = extractvalue { ptr, i32 } %58, 0
  store ptr %59, ptr %11, align 8
  %60 = extractvalue { ptr, i32 } %58, 1
  store i32 %60, ptr %12, align 4
  br label %65

61:                                               ; preds = %45
  %62 = landingpad { ptr, i32 }
          cleanup
  %63 = extractvalue { ptr, i32 } %62, 0
  store ptr %63, ptr %11, align 8
  %64 = extractvalue { ptr, i32 } %62, 1
  store i32 %64, ptr %12, align 4
  call void @_ZN7Array3dIbED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %41) #3
  br label %65

65:                                               ; preds = %61, %57
  call void @_ZN7Array3dIfED2Ev(ptr noundef nonnull align 8 dereferenceable(36) %39) #3
  br label %66

66:                                               ; preds = %65, %53
  call void @_ZN7Array3dIbED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %34) #3
  br label %67

67:                                               ; preds = %66, %49
  call void @_ZN7Array3dIfED2Ev(ptr noundef nonnull align 8 dereferenceable(36) %30) #3
  br label %68

68:                                               ; preds = %67
  %69 = load ptr, ptr %11, align 8
  %70 = load i32, ptr %12, align 4
  %71 = insertvalue { ptr, i32 } poison, ptr %69, 0
  %72 = insertvalue { ptr, i32 } %71, i32 %70, 1
  resume { ptr, i32 } %72
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Array3dIbEC2Eiiib(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i32 noundef, i32 noundef, i1 noundef zeroext) 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" }
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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !10, i64 0}
!14 = !{!"_ZTS11ScalarField", !10, i64 0, !10, i64 4, !10, 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, !15, i64 80, !16, i64 88, !18, i64 128, !16, i64 160, !18, i64 200, !15, i64 232, !19, i64 236}
!15 = !{!"bool", !7, i64 0}
!16 = !{!"_ZTS7Array3dIfE", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16, !15, i64 24, !17, i64 28, !10, i64 32}
!17 = !{!"float", !7, i64 0}
!18 = !{!"_ZTS7Array3dIbE", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16, !15, i64 24, !15, i64 25, !10, i64 28}
!19 = !{!"_ZTSN5vmath4vec3E", !17, i64 0, !17, i64 4, !17, i64 8}
!20 = !{!14, !10, i64 4}
!21 = !{!14, !10, i64 8}
!22 = !{!14, !12, i64 16}
!23 = !{!14, !12, i64 24}
!24 = !{!14, !12, i64 32}
!25 = !{!14, !12, i64 40}
!26 = !{!14, !12, i64 48}
!27 = !{!14, !12, i64 56}
!28 = !{!14, !12, i64 64}
!29 = !{!14, !12, i64 72}
!30 = !{!14, !15, i64 80}
!31 = !{!14, !15, 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
declare dso_local void @_ZN7Array3dIfEC2Ev(ptr noundef nonnull align 8 dereferenceable(36)) 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: mustprogress uwtable
define dso_local void @_ZN11ScalarFieldC2Eiiid(ptr noundef nonnull align 8 dereferenceable(248) %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, double noundef %4) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  store i32 %1, ptr %0, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 %2, ptr %6, align 4, !tbaa !17
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %3, ptr %7, align 8, !tbaa !18
  %8 = getelementptr inbounds i8, ptr %0, i64 16
  store double %4, ptr %8, align 8, !tbaa !19
  %9 = getelementptr inbounds i8, ptr %0, i64 24
  store <2 x double> <double 0.000000e+00, double 1.000000e+00>, ptr %9, align 8, !tbaa !20
  %10 = getelementptr inbounds i8, ptr %0, i64 40
  %11 = getelementptr inbounds i8, ptr %0, i64 64
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %10, i8 0, i64 24, i1 false)
  store <2 x double> <double 5.000000e-01, double 0.000000e+00>, ptr %11, align 8, !tbaa !20
  %12 = getelementptr inbounds i8, ptr %0, i64 80
  store i8 0, ptr %12, align 8, !tbaa !21
  %13 = getelementptr inbounds i8, ptr %0, i64 88
  tail call void @_ZN7Array3dIfEC2Eiiif(ptr noundef nonnull align 8 dereferenceable(36) %13, i32 noundef %1, i32 noundef %2, i32 noundef %3, float noundef 0.000000e+00)
  %14 = getelementptr inbounds i8, ptr %0, i64 128
  invoke void @_ZN7Array3dIbEC2Eiiib(ptr noundef nonnull align 8 dereferenceable(32) %14, i32 noundef %1, i32 noundef %2, i32 noundef %3, i1 noundef zeroext false)
          to label %15 unwind label %23

15:                                               ; preds = %5
  %16 = getelementptr inbounds i8, ptr %0, i64 160
  invoke void @_ZN7Array3dIfEC2Ev(ptr noundef nonnull align 8 dereferenceable(36) %16)
          to label %17 unwind label %25

17:                                               ; preds = %15
  %18 = getelementptr inbounds i8, ptr %0, i64 200
  invoke void @_ZN7Array3dIbEC2Eiiib(ptr noundef nonnull align 8 dereferenceable(32) %18, i32 noundef %1, i32 noundef %2, i32 noundef %3, i1 noundef zeroext false)
          to label %19 unwind label %27

19:                                               ; preds = %17
  %20 = getelementptr inbounds i8, ptr %0, i64 232
  store i8 0, ptr %20, align 8, !tbaa !22
  %21 = getelementptr inbounds i8, ptr %0, i64 236
  invoke void @_ZN5vmath4vec3C1Ev(ptr noundef nonnull align 4 dereferenceable(12) %21)
          to label %22 unwind label %29

22:                                               ; preds = %19
  ret void

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

25:                                               ; preds = %15
  %26 = landingpad { ptr, i32 }
          cleanup
  br label %32

27:                                               ; preds = %17
  %28 = landingpad { ptr, i32 }
          cleanup
  br label %31

29:                                               ; preds = %19
  %30 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN7Array3dIbED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %18) #4
  br label %31

31:                                               ; preds = %29, %27
  %.pn = phi { ptr, i32 } [ %30, %29 ], [ %28, %27 ]
  tail call void @_ZN7Array3dIfED2Ev(ptr noundef nonnull align 8 dereferenceable(36) %16) #4
  br label %32

32:                                               ; preds = %31, %25
  %.pn.pn = phi { ptr, i32 } [ %.pn, %31 ], [ %26, %25 ]
  tail call void @_ZN7Array3dIbED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %14) #4
  br label %33

33:                                               ; preds = %32, %23
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %32 ], [ %24, %23 ]
  tail call void @_ZN7Array3dIfED2Ev(ptr noundef nonnull align 8 dereferenceable(36) %13) #4
  resume { ptr, i32 } %.pn.pn.pn
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Array3dIbEC2Eiiib(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i32 noundef, i32 noundef, i1 noundef zeroext) unnamed_addr #0 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 16}
!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