; LLVM IR from SanLiWuXun/2phase-LBM-DNS :: LBMDNS.ll (Z8EsInterpdd)

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

@ESMatrix = external dso_local global [121 x [121 x double]], align 16
@ESMatrixInterval = external dso_local global double, align 8

; 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 nounwind uwtable
define dso_local noundef double @_Z8EsInterpdd(double noundef %0, double noundef %1) #1 {
  %3 = alloca double, align 8
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  store double %0, ptr %3, align 8, !tbaa !5
  store double %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %16 = load double, ptr %3, align 8, !tbaa !5
  %17 = load double, ptr @ESMatrixInterval, align 8, !tbaa !5
  %18 = fdiv double %16, %17
  %19 = fptosi double %18 to i32
  store i32 %19, ptr %6, align 4, !tbaa !9
  %20 = load double, ptr %4, align 8, !tbaa !5
  %21 = load double, ptr @ESMatrixInterval, align 8, !tbaa !5
  %22 = fdiv double %20, %21
  %23 = fptosi double %22 to i32
  store i32 %23, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %24 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %24, ptr %8, align 4, !tbaa !9
  %25 = load i32, ptr %6, align 4, !tbaa !9
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr %9, align 4, !tbaa !9
  %27 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %27, ptr %10, align 4, !tbaa !9
  %28 = load i32, ptr %7, align 4, !tbaa !9
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  %30 = load i32, ptr %9, align 4, !tbaa !9
  %31 = sitofp i32 %30 to double
  %32 = load double, ptr %3, align 8, !tbaa !5
  %33 = fneg double %32
  %34 = call double @llvm.fmuladd.f64(double %31, double 1.000000e-02, double %33)
  %35 = load i32, ptr %11, align 4, !tbaa !9
  %36 = sitofp i32 %35 to double
  %37 = load double, ptr %4, align 8, !tbaa !5
  %38 = fneg double %37
  %39 = call double @llvm.fmuladd.f64(double %36, double 1.000000e-02, double %38)
  %40 = fmul double %34, %39
  %41 = fdiv double %40, 1.000000e-02
  %42 = fdiv double %41, 1.000000e-02
  %43 = load i32, ptr %8, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [121 x [121 x double]], ptr @ESMatrix, i64 0, i64 %44
  %46 = load i32, ptr %10, align 4, !tbaa !9
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [121 x double], ptr %45, i64 0, i64 %47
  %49 = load double, ptr %48, align 8, !tbaa !5
  %50 = fmul double %42, %49
  store double %50, ptr %12, align 8, !tbaa !5
  %51 = load double, ptr %3, align 8, !tbaa !5
  %52 = load i32, ptr %8, align 4, !tbaa !9
  %53 = sitofp i32 %52 to double
  %54 = fneg double %53
  %55 = call double @llvm.fmuladd.f64(double %54, double 1.000000e-02, double %51)
  %56 = load i32, ptr %11, align 4, !tbaa !9
  %57 = sitofp i32 %56 to double
  %58 = load double, ptr %4, align 8, !tbaa !5
  %59 = fneg double %58
  %60 = call double @llvm.fmuladd.f64(double %57, double 1.000000e-02, double %59)
  %61 = fmul double %55, %60
  %62 = fdiv double %61, 1.000000e-02
  %63 = fdiv double %62, 1.000000e-02
  %64 = load i32, ptr %9, align 4, !tbaa !9
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [121 x [121 x double]], ptr @ESMatrix, i64 0, i64 %65
  %67 = load i32, ptr %10, align 4, !tbaa !9
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [121 x double], ptr %66, i64 0, i64 %68
  %70 = load double, ptr %69, align 8, !tbaa !5
  %71 = fmul double %63, %70
  store double %71, ptr %13, align 8, !tbaa !5
  %72 = load i32, ptr %9, align 4, !tbaa !9
  %73 = sitofp i32 %72 to double
  %74 = load double, ptr %3, align 8, !tbaa !5
  %75 = fneg double %74
  %76 = call double @llvm.fmuladd.f64(double %73, double 1.000000e-02, double %75)
  %77 = load double, ptr %4, align 8, !tbaa !5
  %78 = load i32, ptr %10, align 4, !tbaa !9
  %79 = sitofp i32 %78 to double
  %80 = fneg double %79
  %81 = call double @llvm.fmuladd.f64(double %80, double 1.000000e-02, double %77)
  %82 = fmul double %76, %81
  %83 = fdiv double %82, 1.000000e-02
  %84 = fdiv double %83, 1.000000e-02
  %85 = load i32, ptr %8, align 4, !tbaa !9
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [121 x [121 x double]], ptr @ESMatrix, i64 0, i64 %86
  %88 = load i32, ptr %11, align 4, !tbaa !9
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [121 x double], ptr %87, i64 0, i64 %89
  %91 = load double, ptr %90, align 8, !tbaa !5
  %92 = fmul double %84, %91
  store double %92, ptr %14, align 8, !tbaa !5
  %93 = load double, ptr %3, align 8, !tbaa !5
  %94 = load i32, ptr %8, align 4, !tbaa !9
  %95 = sitofp i32 %94 to double
  %96 = fneg double %95
  %97 = call double @llvm.fmuladd.f64(double %96, double 1.000000e-02, double %93)
  %98 = load double, ptr %4, align 8, !tbaa !5
  %99 = load i32, ptr %10, align 4, !tbaa !9
  %100 = sitofp i32 %99 to double
  %101 = fneg double %100
  %102 = call double @llvm.fmuladd.f64(double %101, double 1.000000e-02, double %98)
  %103 = fmul double %97, %102
  %104 = fdiv double %103, 1.000000e-02
  %105 = fdiv double %104, 1.000000e-02
  %106 = load i32, ptr %9, align 4, !tbaa !9
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [121 x [121 x double]], ptr @ESMatrix, i64 0, i64 %107
  %109 = load i32, ptr %11, align 4, !tbaa !9
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [121 x double], ptr %108, i64 0, i64 %110
  %112 = load double, ptr %111, align 8, !tbaa !5
  %113 = fmul double %105, %112
  store double %113, ptr %15, align 8, !tbaa !5
  %114 = load double, ptr %12, align 8, !tbaa !5
  %115 = load double, ptr %13, align 8, !tbaa !5
  %116 = fadd double %114, %115
  %117 = load double, ptr %14, align 8, !tbaa !5
  %118 = fadd double %116, %117
  %119 = load double, ptr %15, align 8, !tbaa !5
  %120 = fadd double %118, %119
  store double %120, ptr %5, align 8, !tbaa !5
  %121 = load double, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  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 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  ret double %121
}

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

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}


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

@ESMatrix = external dso_local local_unnamed_addr global [121 x [121 x double]], align 16
@ESMatrixInterval = external dso_local local_unnamed_addr global double, align 8

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local noundef double @_Z8EsInterpdd(double noundef %0, double noundef %1) local_unnamed_addr #0 {
  %3 = load double, ptr @ESMatrixInterval, align 8, !tbaa !5
  %4 = fdiv double %0, %3
  %5 = fptosi double %4 to i32
  %6 = fdiv double %1, %3
  %7 = fptosi double %6 to i32
  %8 = add nsw i32 %5, 1
  %9 = add nsw i32 %7, 1
  %10 = sitofp i32 %8 to double
  %11 = fneg double %0
  %12 = sitofp i32 %9 to double
  %13 = fneg double %1
  %14 = tail call double @llvm.fmuladd.f64(double %12, double 1.000000e-02, double %13)
  %15 = sext i32 %5 to i64
  %16 = sext i32 %7 to i64
  %17 = getelementptr inbounds [121 x [121 x double]], ptr @ESMatrix, i64 0, i64 %15, i64 %16
  %18 = load double, ptr %17, align 8, !tbaa !5
  %19 = sitofp i32 %5 to double
  %20 = fneg double %19
  %21 = sext i32 %8 to i64
  %22 = getelementptr inbounds [121 x [121 x double]], ptr @ESMatrix, i64 0, i64 %21, i64 %16
  %23 = load double, ptr %22, align 8, !tbaa !5
  %24 = sitofp i32 %7 to double
  %25 = fneg double %24
  %26 = tail call double @llvm.fmuladd.f64(double %25, double 1.000000e-02, double %1)
  %27 = sext i32 %9 to i64
  %28 = getelementptr inbounds [121 x [121 x double]], ptr @ESMatrix, i64 0, i64 %15, i64 %27
  %29 = load double, ptr %28, align 8, !tbaa !5
  %30 = getelementptr inbounds [121 x [121 x double]], ptr @ESMatrix, i64 0, i64 %21, i64 %27
  %31 = load double, ptr %30, align 8, !tbaa !5
  %32 = insertelement <2 x double> poison, double %20, i64 0
  %33 = insertelement <2 x double> %32, double %10, i64 1
  %34 = insertelement <2 x double> poison, double %0, i64 0
  %35 = insertelement <2 x double> %34, double %11, i64 1
  %36 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %33, <2 x double> <double 1.000000e-02, double 1.000000e-02>, <2 x double> %35)
  %37 = insertelement <2 x double> poison, double %14, i64 0
  %38 = shufflevector <2 x double> %37, <2 x double> poison, <2 x i32> zeroinitializer
  %39 = fmul <2 x double> %36, %38
  %40 = fdiv <2 x double> %39, <double 1.000000e-02, double 1.000000e-02>
  %41 = fdiv <2 x double> %40, <double 1.000000e-02, double 1.000000e-02>
  %42 = insertelement <2 x double> poison, double %23, i64 0
  %43 = insertelement <2 x double> %42, double %18, i64 1
  %44 = fmul <2 x double> %43, %41
  %45 = insertelement <2 x double> poison, double %26, i64 0
  %46 = shufflevector <2 x double> %45, <2 x double> poison, <2 x i32> zeroinitializer
  %47 = fmul <2 x double> %46, %36
  %48 = fdiv <2 x double> %47, <double 1.000000e-02, double 1.000000e-02>
  %49 = fdiv <2 x double> %48, <double 1.000000e-02, double 1.000000e-02>
  %50 = insertelement <2 x double> poison, double %31, i64 0
  %51 = insertelement <2 x double> %50, double %29, i64 1
  %52 = fmul <2 x double> %51, %49
  %shift = shufflevector <2 x double> %44, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
  %53 = fadd <2 x double> %shift, %44
  %shift34 = shufflevector <2 x double> %52, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
  %54 = fadd <2 x double> %shift34, %53
  %55 = fadd <2 x double> %52, %54
  %56 = extractelement <2 x double> %55, i64 0
  ret double %56
}

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #2

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) 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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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"}


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