; LLVM IR from doyubkim/fluid-engine-dev :: src/jet (collocated_vector_grid2)

; 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"

%"struct.std::array" = type { [4 x %"class.jet::Point"] }
%"class.jet::Point" = type { i64, i64 }
%"struct.std::array.0" = type { [4 x double] }
%"class.jet::CollocatedVectorGrid2" = type { %"class.jet::VectorGrid2", %"class.jet::Array", %"class.jet::LinearArraySampler", %"class.std::function" }
%"class.jet::VectorGrid2" = type { %"class.jet::VectorField2", %"class.jet::Grid2" }
%"class.jet::VectorField2" = type { %"class.jet::Field2" }
%"class.jet::Field2" = type { ptr }
%"class.jet::Grid2" = type { %"class.jet::Serializable", %"class.jet::Size2", %"class.jet::Vector", %"class.jet::Vector", %"class.jet::BoundingBox" }
%"class.jet::Serializable" = type { ptr }
%"class.jet::Size2" = type { i64, i64 }
%"class.jet::Vector" = type { double, double }
%"class.jet::BoundingBox" = type { %"class.jet::Vector", %"class.jet::Vector" }
%"class.jet::Array" = type { %"class.jet::Size2", %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<jet::Vector<double, 2>, std::allocator<jet::Vector<double, 2>>>::_Vector_impl" }
%"struct.std::_Vector_base<jet::Vector<double, 2>, std::allocator<jet::Vector<double, 2>>>::_Vector_impl" = type { %"struct.std::_Vector_base<jet::Vector<double, 2>, std::allocator<jet::Vector<double, 2>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<jet::Vector<double, 2>, std::allocator<jet::Vector<double, 2>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.jet::LinearArraySampler" = type { %"class.jet::Vector", %"class.jet::Vector", %"class.jet::Vector", %"class.jet::ConstArrayAccessor" }
%"class.jet::ConstArrayAccessor" = type { %"class.jet::Size2", ptr }
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }

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

; 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
declare dso_local noundef double @_ZNK3jet21CollocatedVectorGrid221divergenceAtDataPointEmm(ptr noundef nonnull align 8 dereferenceable(240), i64 noundef, i64 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZNK3jet21CollocatedVectorGrid210divergenceERKNS_6VectorIdLm2EEE(ptr noundef nonnull align 8 dereferenceable(240) %0, ptr noundef nonnull align 8 dereferenceable(16) %1) unnamed_addr #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"struct.std::array", align 8
  %6 = alloca %"struct.std::array.0", align 8
  %7 = alloca double, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %9 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 64, ptr %5) #5
  call void @_ZNSt5arrayIN3jet5PointImLm2EEELm4EEC2Ev(ptr noundef nonnull align 8 dereferenceable(64) %5)
  call void @llvm.lifetime.start.p0(i64 32, ptr %6) #5
  %10 = getelementptr inbounds %"class.jet::CollocatedVectorGrid2", ptr %9, i32 0, i32 2
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZNK3jet18LinearArraySamplerINS_6VectorIdLm2EEEdLm2EE24getCoordinatesAndWeightsERKS2_PSt5arrayINS_5PointImLm2EEELm4EEPS6_IdLm4EE(ptr noundef nonnull align 8 dereferenceable(72) %10, ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef %5, ptr noundef %6)
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store double 0.000000e+00, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !11
  br label %12

12:                                               ; preds = %34, %2
  %13 = load i32, ptr %8, align 4, !tbaa !11
  %14 = icmp slt i32 %13, 4
  br i1 %14, label %16, label %15

15:                                               ; preds = %12
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %37

16:                                               ; preds = %12
  %17 = load i32, ptr %8, align 4, !tbaa !11
  %18 = sext i32 %17 to i64
  %19 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm4EEixEm(ptr noundef nonnull align 8 dereferenceable(32) %6, i64 noundef %18) #5
  %20 = load double, ptr %19, align 8, !tbaa !9
  %21 = load i32, ptr %8, align 4, !tbaa !11
  %22 = sext i32 %21 to i64
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt5arrayIN3jet5PointImLm2EEELm4EEixEm(ptr noundef nonnull align 8 dereferenceable(64) %5, i64 noundef %22) #5
  %24 = getelementptr inbounds %"class.jet::Point", ptr %23, i32 0, i32 0
  %25 = load i64, ptr %24, align 8, !tbaa !13
  %26 = load i32, ptr %8, align 4, !tbaa !11
  %27 = sext i32 %26 to i64
  %28 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt5arrayIN3jet5PointImLm2EEELm4EEixEm(ptr noundef nonnull align 8 dereferenceable(64) %5, i64 noundef %27) #5
  %29 = getelementptr inbounds %"class.jet::Point", ptr %28, i32 0, i32 1
  %30 = load i64, ptr %29, align 8, !tbaa !16
  %31 = call noundef double @_ZNK3jet21CollocatedVectorGrid221divergenceAtDataPointEmm(ptr noundef nonnull align 8 dereferenceable(240) %9, i64 noundef %25, i64 noundef %30)
  %32 = load double, ptr %7, align 8, !tbaa !9
  %33 = call double @llvm.fmuladd.f64(double %20, double %31, double %32)
  store double %33, ptr %7, align 8, !tbaa !9
  br label %34

34:                                               ; preds = %16
  %35 = load i32, ptr %8, align 4, !tbaa !11
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %8, align 4, !tbaa !11
  br label %12, !llvm.loop !17

37:                                               ; preds = %15
  %38 = load double, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr %5) #5
  ret double %38
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNSt5arrayIN3jet5PointImLm2EEELm4EEC2Ev(ptr noundef nonnull align 8 dereferenceable(64)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3jet18LinearArraySamplerINS_6VectorIdLm2EEEdLm2EE24getCoordinatesAndWeightsERKS2_PSt5arrayINS_5PointImLm2EEELm4EEPS6_IdLm4EE(ptr noundef nonnull align 8 dereferenceable(72), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, ptr noundef) #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt5arrayIN3jet5PointImLm2EEELm4EEixEm(ptr noundef nonnull align 8 dereferenceable(64), i64 noundef) #3 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
attributes #2 = { inlinehint 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 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !15, i64 0}
!14 = !{!"_ZTSN3jet5PointImLm2EEE", !15, i64 0, !15, i64 8}
!15 = !{!"long", !7, i64 0}
!16 = !{!14, !15, i64 8}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}


; 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"

%"struct.std::array" = type { [4 x %"class.jet::Point"] }
%"class.jet::Point" = type { i64, i64 }
%"struct.std::array.0" = type { [4 x double] }

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZNK3jet21CollocatedVectorGrid210divergenceERKNS_6VectorIdLm2EEE(ptr noundef nonnull align 8 dereferenceable(240) %0, ptr noundef nonnull align 8 dereferenceable(16) %1) unnamed_addr #1 align 2 {
  %3 = alloca %"struct.std::array", align 8
  %4 = alloca %"struct.std::array.0", align 8
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %3) #5
  call void @_ZNSt5arrayIN3jet5PointImLm2EEELm4EEC2Ev(ptr noundef nonnull align 8 dereferenceable(64) %3)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #5
  %5 = getelementptr inbounds i8, ptr %0, i64 136
  call void @_ZNK3jet18LinearArraySamplerINS_6VectorIdLm2EEEdLm2EE24getCoordinatesAndWeightsERKS2_PSt5arrayINS_5PointImLm2EEELm4EEPS6_IdLm4EE(ptr noundef nonnull align 8 dereferenceable(72) %5, ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull %3, ptr noundef nonnull %4)
  %6 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm4EEixEm(ptr noundef nonnull align 8 dereferenceable(32) %4, i64 noundef 0) #5
  %7 = load double, ptr %6, align 8, !tbaa !5
  %8 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt5arrayIN3jet5PointImLm2EEELm4EEixEm(ptr noundef nonnull align 8 dereferenceable(64) %3, i64 noundef 0) #5
  %9 = load i64, ptr %8, align 8, !tbaa !9
  %10 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt5arrayIN3jet5PointImLm2EEELm4EEixEm(ptr noundef nonnull align 8 dereferenceable(64) %3, i64 noundef 0) #5
  %11 = getelementptr inbounds i8, ptr %10, i64 8
  %12 = load i64, ptr %11, align 8, !tbaa !12
  %13 = call noundef double @_ZNK3jet21CollocatedVectorGrid221divergenceAtDataPointEmm(ptr noundef nonnull align 8 dereferenceable(240) %0, i64 noundef %9, i64 noundef %12)
  %14 = call double @llvm.fmuladd.f64(double %7, double %13, double 0.000000e+00)
  %15 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm4EEixEm(ptr noundef nonnull align 8 dereferenceable(32) %4, i64 noundef 1) #5
  %16 = load double, ptr %15, align 8, !tbaa !5
  %17 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt5arrayIN3jet5PointImLm2EEELm4EEixEm(ptr noundef nonnull align 8 dereferenceable(64) %3, i64 noundef 1) #5
  %18 = load i64, ptr %17, align 8, !tbaa !9
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt5arrayIN3jet5PointImLm2EEELm4EEixEm(ptr noundef nonnull align 8 dereferenceable(64) %3, i64 noundef 1) #5
  %20 = getelementptr inbounds i8, ptr %19, i64 8
  %21 = load i64, ptr %20, align 8, !tbaa !12
  %22 = call noundef double @_ZNK3jet21CollocatedVectorGrid221divergenceAtDataPointEmm(ptr noundef nonnull align 8 dereferenceable(240) %0, i64 noundef %18, i64 noundef %21)
  %23 = call double @llvm.fmuladd.f64(double %16, double %22, double %14)
  %24 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm4EEixEm(ptr noundef nonnull align 8 dereferenceable(32) %4, i64 noundef 2) #5
  %25 = load double, ptr %24, align 8, !tbaa !5
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt5arrayIN3jet5PointImLm2EEELm4EEixEm(ptr noundef nonnull align 8 dereferenceable(64) %3, i64 noundef 2) #5
  %27 = load i64, ptr %26, align 8, !tbaa !9
  %28 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt5arrayIN3jet5PointImLm2EEELm4EEixEm(ptr noundef nonnull align 8 dereferenceable(64) %3, i64 noundef 2) #5
  %29 = getelementptr inbounds i8, ptr %28, i64 8
  %30 = load i64, ptr %29, align 8, !tbaa !12
  %31 = call noundef double @_ZNK3jet21CollocatedVectorGrid221divergenceAtDataPointEmm(ptr noundef nonnull align 8 dereferenceable(240) %0, i64 noundef %27, i64 noundef %30)
  %32 = call double @llvm.fmuladd.f64(double %25, double %31, double %23)
  %33 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm4EEixEm(ptr noundef nonnull align 8 dereferenceable(32) %4, i64 noundef 3) #5
  %34 = load double, ptr %33, align 8, !tbaa !5
  %35 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt5arrayIN3jet5PointImLm2EEELm4EEixEm(ptr noundef nonnull align 8 dereferenceable(64) %3, i64 noundef 3) #5
  %36 = load i64, ptr %35, align 8, !tbaa !9
  %37 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt5arrayIN3jet5PointImLm2EEELm4EEixEm(ptr noundef nonnull align 8 dereferenceable(64) %3, i64 noundef 3) #5
  %38 = getelementptr inbounds i8, ptr %37, i64 8
  %39 = load i64, ptr %38, align 8, !tbaa !12
  %40 = call noundef double @_ZNK3jet21CollocatedVectorGrid221divergenceAtDataPointEmm(ptr noundef nonnull align 8 dereferenceable(240) %0, i64 noundef %36, i64 noundef %39)
  %41 = call double @llvm.fmuladd.f64(double %34, double %40, double %32)
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %3) #5
  ret double %41
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNSt5arrayIN3jet5PointImLm2EEELm4EEC2Ev(ptr noundef nonnull align 8 dereferenceable(64)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3jet18LinearArraySamplerINS_6VectorIdLm2EEEdLm2EE24getCoordinatesAndWeightsERKS2_PSt5arrayINS_5PointImLm2EEELm4EEPS6_IdLm4EE(ptr noundef nonnull align 8 dereferenceable(72), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, ptr noundef) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt5arrayIN3jet5PointImLm2EEELm4EEixEm(ptr noundef nonnull align 8 dereferenceable(64), i64 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
attributes #2 = { inlinehint 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 = { 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 #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"_ZTSN3jet5PointImLm2EEE", !11, i64 0, !11, i64 8}
!11 = !{!"long", !7, i64 0}
!12 = !{!10, !11, i64 8}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LoopRotatePass,SROAPass,SimplifyCFGPass