; LLVM IR from yangfengzzz/DigitalVox3 :: vox.geometry (fdm_utils)

; 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.vox::geometry::Matrix.0" = type { i64, i64 }
%"class.vox::geometry::Matrix" = type { double, double }

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNK3vox8geometry9ArrayBaseIKdLm2ENS0_9ArrayViewIS2_Lm2EEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNK3vox8geometry9ArrayBaseIKdLm2ENS0_9ArrayViewIS2_Lm2EEEEclIJmEEERS2_mDpT_(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef, i64 noundef) #2 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN3vox8geometry10laplacian2ERKNS0_9ArrayViewIKdLm2EEERKNS0_6MatrixIdLm2ELm1EEEmm(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(16) %1, i64 noundef %2, i64 noundef %3) #2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca double, align 8
  %10 = alloca ptr, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i64 %2, ptr %7, align 8, !tbaa !9
  store i64 %3, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = load i64, ptr %7, align 8, !tbaa !9
  %17 = load i64, ptr %8, align 8, !tbaa !9
  %18 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK3vox8geometry9ArrayBaseIKdLm2ENS0_9ArrayViewIS2_Lm2EEEEclIJmEEERS2_mDpT_(ptr noundef nonnull align 8 dereferenceable(32) %15, i64 noundef %16, i64 noundef %17)
  %19 = load double, ptr %18, align 8, !tbaa !11
  store double %19, ptr %9, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK3vox8geometry9ArrayBaseIKdLm2ENS0_9ArrayViewIS2_Lm2EEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %20)
  store ptr %21, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  store double 0.000000e+00, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  store double 0.000000e+00, ptr %12, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  store double 0.000000e+00, ptr %13, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  store double 0.000000e+00, ptr %14, align 8, !tbaa !11
  %22 = load i64, ptr %7, align 8, !tbaa !9
  %23 = icmp ugt i64 %22, 0
  br i1 %23, label %24, label %33

24:                                               ; preds = %4
  %25 = load double, ptr %9, align 8, !tbaa !11
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = load i64, ptr %7, align 8, !tbaa !9
  %28 = sub i64 %27, 1
  %29 = load i64, ptr %8, align 8, !tbaa !9
  %30 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK3vox8geometry9ArrayBaseIKdLm2ENS0_9ArrayViewIS2_Lm2EEEEclIJmEEERS2_mDpT_(ptr noundef nonnull align 8 dereferenceable(32) %26, i64 noundef %28, i64 noundef %29)
  %31 = load double, ptr %30, align 8, !tbaa !11
  %32 = fsub double %25, %31
  store double %32, ptr %11, align 8, !tbaa !11
  br label %33

33:                                               ; preds = %24, %4
  %34 = load i64, ptr %7, align 8, !tbaa !9
  %35 = add i64 %34, 1
  %36 = load ptr, ptr %10, align 8, !tbaa !5
  %37 = getelementptr inbounds %"class.vox::geometry::Matrix.0", ptr %36, i32 0, i32 0
  %38 = load i64, ptr %37, align 8, !tbaa !13
  %39 = icmp ult i64 %35, %38
  br i1 %39, label %40, label %49

40:                                               ; preds = %33
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = load i64, ptr %7, align 8, !tbaa !9
  %43 = add i64 %42, 1
  %44 = load i64, ptr %8, align 8, !tbaa !9
  %45 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK3vox8geometry9ArrayBaseIKdLm2ENS0_9ArrayViewIS2_Lm2EEEEclIJmEEERS2_mDpT_(ptr noundef nonnull align 8 dereferenceable(32) %41, i64 noundef %43, i64 noundef %44)
  %46 = load double, ptr %45, align 8, !tbaa !11
  %47 = load double, ptr %9, align 8, !tbaa !11
  %48 = fsub double %46, %47
  store double %48, ptr %12, align 8, !tbaa !11
  br label %49

49:                                               ; preds = %40, %33
  %50 = load i64, ptr %8, align 8, !tbaa !9
  %51 = icmp ugt i64 %50, 0
  br i1 %51, label %52, label %61

52:                                               ; preds = %49
  %53 = load double, ptr %9, align 8, !tbaa !11
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = load i64, ptr %7, align 8, !tbaa !9
  %56 = load i64, ptr %8, align 8, !tbaa !9
  %57 = sub i64 %56, 1
  %58 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK3vox8geometry9ArrayBaseIKdLm2ENS0_9ArrayViewIS2_Lm2EEEEclIJmEEERS2_mDpT_(ptr noundef nonnull align 8 dereferenceable(32) %54, i64 noundef %55, i64 noundef %57)
  %59 = load double, ptr %58, align 8, !tbaa !11
  %60 = fsub double %53, %59
  store double %60, ptr %13, align 8, !tbaa !11
  br label %61

61:                                               ; preds = %52, %49
  %62 = load i64, ptr %8, align 8, !tbaa !9
  %63 = add i64 %62, 1
  %64 = load ptr, ptr %10, align 8, !tbaa !5
  %65 = getelementptr inbounds %"class.vox::geometry::Matrix.0", ptr %64, i32 0, i32 1
  %66 = load i64, ptr %65, align 8, !tbaa !15
  %67 = icmp ult i64 %63, %66
  br i1 %67, label %68, label %77

68:                                               ; preds = %61
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = load i64, ptr %7, align 8, !tbaa !9
  %71 = load i64, ptr %8, align 8, !tbaa !9
  %72 = add i64 %71, 1
  %73 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK3vox8geometry9ArrayBaseIKdLm2ENS0_9ArrayViewIS2_Lm2EEEEclIJmEEERS2_mDpT_(ptr noundef nonnull align 8 dereferenceable(32) %69, i64 noundef %70, i64 noundef %72)
  %74 = load double, ptr %73, align 8, !tbaa !11
  %75 = load double, ptr %9, align 8, !tbaa !11
  %76 = fsub double %74, %75
  store double %76, ptr %14, align 8, !tbaa !11
  br label %77

77:                                               ; preds = %68, %61
  %78 = load double, ptr %12, align 8, !tbaa !11
  %79 = load double, ptr %11, align 8, !tbaa !11
  %80 = fsub double %78, %79
  %81 = load ptr, ptr %6, align 8, !tbaa !5
  %82 = getelementptr inbounds %"class.vox::geometry::Matrix", ptr %81, i32 0, i32 0
  %83 = load double, ptr %82, align 8, !tbaa !16
  %84 = call noundef double @_ZN3vox8geometry6squareIdEENSt9enable_ifIXsr3std13is_arithmeticIT_EE5valueES3_E4typeES3_(double noundef %83)
  %85 = fdiv double %80, %84
  %86 = load double, ptr %14, align 8, !tbaa !11
  %87 = load double, ptr %13, align 8, !tbaa !11
  %88 = fsub double %86, %87
  %89 = load ptr, ptr %6, align 8, !tbaa !5
  %90 = getelementptr inbounds %"class.vox::geometry::Matrix", ptr %89, i32 0, i32 1
  %91 = load double, ptr %90, align 8, !tbaa !18
  %92 = call noundef double @_ZN3vox8geometry6squareIdEENSt9enable_ifIXsr3std13is_arithmeticIT_EE5valueES3_E4typeES3_(double noundef %91)
  %93 = fdiv double %88, %92
  %94 = fadd double %85, %93
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  ret double %94
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZN3vox8geometry6squareIdEENSt9enable_ifIXsr3std13is_arithmeticIT_EE5valueES3_E4typeES3_(double noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !10, i64 0}
!14 = !{!"_ZTSN3vox8geometry6MatrixImLm2ELm1EEE", !10, i64 0, !10, i64 8}
!15 = !{!14, !10, i64 8}
!16 = !{!17, !12, i64 0}
!17 = !{!"_ZTSN3vox8geometry6MatrixIdLm2ELm1EEE", !12, i64 0, !12, i64 8}
!18 = !{!17, !12, 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 nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNK3vox8geometry9ArrayBaseIKdLm2ENS0_9ArrayViewIS2_Lm2EEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNK3vox8geometry9ArrayBaseIKdLm2ENS0_9ArrayViewIS2_Lm2EEEEclIJmEEERS2_mDpT_(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef, i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN3vox8geometry10laplacian2ERKNS0_9ArrayViewIKdLm2EEERKNS0_6MatrixIdLm2ELm1EEEmm(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(16) %1, i64 noundef %2, i64 noundef %3) local_unnamed_addr #1 {
  %5 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK3vox8geometry9ArrayBaseIKdLm2ENS0_9ArrayViewIS2_Lm2EEEEclIJmEEERS2_mDpT_(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %2, i64 noundef %3)
  %6 = load double, ptr %5, align 8, !tbaa !5
  %7 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK3vox8geometry9ArrayBaseIKdLm2ENS0_9ArrayViewIS2_Lm2EEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %.not = icmp eq i64 %2, 0
  br i1 %.not, label %13, label %8

8:                                                ; preds = %4
  %9 = add i64 %2, -1
  %10 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK3vox8geometry9ArrayBaseIKdLm2ENS0_9ArrayViewIS2_Lm2EEEEclIJmEEERS2_mDpT_(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %9, i64 noundef %3)
  %11 = load double, ptr %10, align 8, !tbaa !5
  %12 = fsub double %6, %11
  br label %13

13:                                               ; preds = %8, %4
  %.033 = phi double [ %12, %8 ], [ 0.000000e+00, %4 ]
  %14 = add i64 %2, 1
  %15 = load i64, ptr %7, align 8, !tbaa !9
  %16 = icmp ult i64 %14, %15
  br i1 %16, label %17, label %21

17:                                               ; preds = %13
  %18 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK3vox8geometry9ArrayBaseIKdLm2ENS0_9ArrayViewIS2_Lm2EEEEclIJmEEERS2_mDpT_(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %14, i64 noundef %3)
  %19 = load double, ptr %18, align 8, !tbaa !5
  %20 = fsub double %19, %6
  br label %21

21:                                               ; preds = %17, %13
  %.032 = phi double [ %20, %17 ], [ 0.000000e+00, %13 ]
  %.not38 = icmp eq i64 %3, 0
  br i1 %.not38, label %27, label %22

22:                                               ; preds = %21
  %23 = add i64 %3, -1
  %24 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK3vox8geometry9ArrayBaseIKdLm2ENS0_9ArrayViewIS2_Lm2EEEEclIJmEEERS2_mDpT_(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %2, i64 noundef %23)
  %25 = load double, ptr %24, align 8, !tbaa !5
  %26 = fsub double %6, %25
  br label %27

27:                                               ; preds = %22, %21
  %.031 = phi double [ %26, %22 ], [ 0.000000e+00, %21 ]
  %28 = add i64 %3, 1
  %29 = getelementptr inbounds i8, ptr %7, i64 8
  %30 = load i64, ptr %29, align 8, !tbaa !12
  %31 = icmp ult i64 %28, %30
  br i1 %31, label %32, label %36

32:                                               ; preds = %27
  %33 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK3vox8geometry9ArrayBaseIKdLm2ENS0_9ArrayViewIS2_Lm2EEEEclIJmEEERS2_mDpT_(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %2, i64 noundef %28)
  %34 = load double, ptr %33, align 8, !tbaa !5
  %35 = fsub double %34, %6
  br label %36

36:                                               ; preds = %32, %27
  %.0 = phi double [ %35, %32 ], [ 0.000000e+00, %27 ]
  %37 = insertelement <2 x double> poison, double %.032, i64 0
  %38 = insertelement <2 x double> %37, double %.0, i64 1
  %39 = insertelement <2 x double> poison, double %.033, i64 0
  %40 = insertelement <2 x double> %39, double %.031, i64 1
  %41 = fsub <2 x double> %38, %40
  %42 = load double, ptr %1, align 8, !tbaa !13
  %43 = tail call noundef double @_ZN3vox8geometry6squareIdEENSt9enable_ifIXsr3std13is_arithmeticIT_EE5valueES3_E4typeES3_(double noundef %42)
  %44 = getelementptr inbounds i8, ptr %1, i64 8
  %45 = load double, ptr %44, align 8, !tbaa !15
  %46 = tail call noundef double @_ZN3vox8geometry6squareIdEENSt9enable_ifIXsr3std13is_arithmeticIT_EE5valueES3_E4typeES3_(double noundef %45)
  %47 = insertelement <2 x double> poison, double %43, i64 0
  %48 = insertelement <2 x double> %47, double %46, i64 1
  %49 = fdiv <2 x double> %41, %48
  %shift = shufflevector <2 x double> %49, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
  %50 = fadd <2 x double> %49, %shift
  %51 = extractelement <2 x double> %50, i64 0
  ret double %51
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZN3vox8geometry6squareIdEENSt9enable_ifIXsr3std13is_arithmeticIT_EE5valueES3_E4typeES3_(double noundef) local_unnamed_addr #0

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 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"_ZTSN3vox8geometry6MatrixImLm2ELm1EEE", !11, i64 0, !11, i64 8}
!11 = !{!"long", !7, i64 0}
!12 = !{!10, !11, i64 8}
!13 = !{!14, !6, i64 0}
!14 = !{!"_ZTSN3vox8geometry6MatrixIdLm2ELm1EEE", !6, i64 0, !6, i64 8}
!15 = !{!14, !6, i64 8}


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