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

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

@w = external dso_local global [9 x double], align 16
@e_x = external dso_local global [9 x i32], align 16
@e_y = external dso_local global [9 x i32], align 16

; 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @_Z5f_equdddi(double noundef %0, double noundef %1, double noundef %2, i32 noundef %3) #2 {
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca i32, align 4
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  store double %0, ptr %5, align 8, !tbaa !5
  store double %1, ptr %6, align 8, !tbaa !5
  store double %2, ptr %7, align 8, !tbaa !5
  store i32 %3, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %12 = load i32, ptr %8, align 4, !tbaa !9
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds [9 x i32], ptr @e_x, i64 0, i64 %13
  %15 = load i32, ptr %14, align 4, !tbaa !9
  %16 = sitofp i32 %15 to double
  %17 = load double, ptr %5, align 8, !tbaa !5
  %18 = load i32, ptr %8, align 4, !tbaa !9
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [9 x i32], ptr @e_y, i64 0, i64 %19
  %21 = load i32, ptr %20, align 4, !tbaa !9
  %22 = sitofp i32 %21 to double
  %23 = load double, ptr %6, align 8, !tbaa !5
  %24 = fmul double %22, %23
  %25 = call double @llvm.fmuladd.f64(double %16, double %17, double %24)
  store double %25, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %26 = load double, ptr %5, align 8, !tbaa !5
  %27 = load double, ptr %5, align 8, !tbaa !5
  %28 = load double, ptr %6, align 8, !tbaa !5
  %29 = load double, ptr %6, align 8, !tbaa !5
  %30 = fmul double %28, %29
  %31 = call double @llvm.fmuladd.f64(double %26, double %27, double %30)
  store double %31, ptr %11, align 8, !tbaa !5
  %32 = load i32, ptr %8, align 4, !tbaa !9
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [9 x double], ptr @w, i64 0, i64 %33
  %35 = load double, ptr %34, align 8, !tbaa !5
  %36 = load double, ptr %7, align 8, !tbaa !5
  %37 = fmul double %35, %36
  %38 = load double, ptr %10, align 8, !tbaa !5
  %39 = call double @llvm.fmuladd.f64(double 3.000000e+00, double %38, double 1.000000e+00)
  %40 = load double, ptr %10, align 8, !tbaa !5
  %41 = fmul double 4.500000e+00, %40
  %42 = load double, ptr %10, align 8, !tbaa !5
  %43 = call double @llvm.fmuladd.f64(double %41, double %42, double %39)
  %44 = load double, ptr %11, align 8, !tbaa !5
  %45 = call double @llvm.fmuladd.f64(double -1.500000e+00, double %44, double %43)
  %46 = fmul double %37, %45
  store double %46, ptr %9, align 8, !tbaa !5
  %47 = load double, ptr %9, align 8, !tbaa !5
  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 %47
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"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"

@w = external dso_local local_unnamed_addr global [9 x double], align 16
@e_x = external dso_local local_unnamed_addr global [9 x i32], align 16
@e_y = external dso_local local_unnamed_addr global [9 x i32], align 16

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

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local noundef double @_Z5f_equdddi(double noundef %0, double noundef %1, double noundef %2, i32 noundef %3) local_unnamed_addr #1 {
  %5 = sext i32 %3 to i64
  %6 = getelementptr inbounds [9 x i32], ptr @e_x, i64 0, i64 %5
  %7 = load i32, ptr %6, align 4, !tbaa !5
  %8 = sitofp i32 %7 to double
  %9 = getelementptr inbounds [9 x i32], ptr @e_y, i64 0, i64 %5
  %10 = load i32, ptr %9, align 4, !tbaa !5
  %11 = sitofp i32 %10 to double
  %12 = fmul double %11, %1
  %13 = tail call double @llvm.fmuladd.f64(double %8, double %0, double %12)
  %14 = fmul double %1, %1
  %15 = tail call double @llvm.fmuladd.f64(double %0, double %0, double %14)
  %16 = getelementptr inbounds [9 x double], ptr @w, i64 0, i64 %5
  %17 = load double, ptr %16, align 8, !tbaa !9
  %18 = fmul double %17, %2
  %19 = tail call double @llvm.fmuladd.f64(double %13, double 3.000000e+00, double 1.000000e+00)
  %20 = fmul double %13, 4.500000e+00
  %21 = tail call double @llvm.fmuladd.f64(double %20, double %13, double %19)
  %22 = tail call double @llvm.fmuladd.f64(double %15, double -1.500000e+00, double %21)
  %23 = fmul double %18, %22
  ret double %23
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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" }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}


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