; LLVM IR from henrywatkins/PARAMAGNET :: src/TransportCoeff.ll (Z10alpha_wedgdi)

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

@alphavalues = external dso_local constant [8 x [10 x double]], align 16
@brag = external constant 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: 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 @_Z10alpha_wedgdi(double noundef %0, i32 noundef %1) #2 {
  %3 = alloca double, align 8
  %4 = alloca i32, align 4
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  store double %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %10 = load i32, ptr %4, align 4, !tbaa !9
  %11 = sub nsw i32 %10, 1
  %12 = sext i32 %11 to i64
  %13 = getelementptr inbounds [8 x [10 x double]], ptr @alphavalues, i64 0, i64 %12
  %14 = getelementptr inbounds [10 x double], ptr %13, i64 0, i64 5
  %15 = load double, ptr %14, align 8, !tbaa !5
  store double %15, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %16 = load i32, ptr %4, align 4, !tbaa !9
  %17 = sub nsw i32 %16, 1
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [8 x [10 x double]], ptr @alphavalues, i64 0, i64 %18
  %20 = getelementptr inbounds [10 x double], ptr %19, i64 0, i64 6
  %21 = load double, ptr %20, align 16, !tbaa !5
  store double %21, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %22 = load i32, ptr %4, align 4, !tbaa !9
  %23 = sub nsw i32 %22, 1
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [8 x [10 x double]], ptr @alphavalues, i64 0, i64 %24
  %26 = getelementptr inbounds [10 x double], ptr %25, i64 0, i64 7
  %27 = load double, ptr %26, align 8, !tbaa !5
  store double %27, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %28 = load i32, ptr %4, align 4, !tbaa !9
  %29 = sub nsw i32 %28, 1
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [8 x [10 x double]], ptr @alphavalues, i64 0, i64 %30
  %32 = getelementptr inbounds [10 x double], ptr %31, i64 0, i64 8
  %33 = load double, ptr %32, align 16, !tbaa !5
  store double %33, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %34 = load i32, ptr %4, align 4, !tbaa !9
  %35 = sub nsw i32 %34, 1
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [8 x [10 x double]], ptr @alphavalues, i64 0, i64 %36
  %38 = getelementptr inbounds [10 x double], ptr %37, i64 0, i64 9
  %39 = load double, ptr %38, align 8, !tbaa !5
  store double %39, ptr %9, align 8, !tbaa !5
  %40 = load double, ptr %3, align 8, !tbaa !5
  %41 = fneg double %40
  %42 = load double, ptr %6, align 8, !tbaa !5
  %43 = load double, ptr %3, align 8, !tbaa !5
  %44 = load double, ptr %5, align 8, !tbaa !5
  %45 = call double @llvm.fmuladd.f64(double %42, double %43, double %44)
  %46 = fmul double %41, %45
  %47 = load double, ptr %3, align 8, !tbaa !5
  %48 = load double, ptr %3, align 8, !tbaa !5
  %49 = fmul double %47, %48
  %50 = load double, ptr %3, align 8, !tbaa !5
  %51 = load double, ptr %9, align 8, !tbaa !5
  %52 = load double, ptr %3, align 8, !tbaa !5
  %53 = fmul double %51, %52
  %54 = load double, ptr %3, align 8, !tbaa !5
  %55 = fmul double %53, %54
  %56 = call double @llvm.fmuladd.f64(double %49, double %50, double %55)
  %57 = load double, ptr %8, align 8, !tbaa !5
  %58 = load double, ptr %3, align 8, !tbaa !5
  %59 = call double @llvm.fmuladd.f64(double %57, double %58, double %56)
  %60 = load double, ptr %7, align 8, !tbaa !5
  %61 = fadd double %59, %60
  %62 = call double @pow(double noundef %61, double noundef 0x3FEC71C71C71C71C) #4
  %63 = fdiv double %46, %62
  %64 = load double, ptr @brag, align 8, !tbaa !5
  %65 = fdiv double %63, %64
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  ret double %65
}

; Function Attrs: nounwind
declare double @pow(double noundef, double noundef) #3

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 "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 = { 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"

@alphavalues = external dso_local local_unnamed_addr constant [8 x [10 x double]], align 16
@brag = external local_unnamed_addr constant double, align 8

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write) uwtable
define dso_local noundef double @_Z10alpha_wedgdi(double noundef %0, i32 noundef %1) local_unnamed_addr #1 {
  %3 = add nsw i32 %1, -1
  %4 = sext i32 %3 to i64
  %5 = getelementptr inbounds [8 x [10 x double]], ptr @alphavalues, i64 0, i64 %4
  %6 = getelementptr inbounds i8, ptr %5, i64 40
  %7 = load double, ptr %6, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %5, i64 48
  %9 = load double, ptr %8, align 16, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %5, i64 56
  %11 = load double, ptr %10, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %5, i64 64
  %13 = load double, ptr %12, align 16, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %5, i64 72
  %15 = load double, ptr %14, align 8, !tbaa !5
  %16 = fneg double %0
  %17 = tail call double @llvm.fmuladd.f64(double %9, double %0, double %7)
  %18 = fmul double %17, %16
  %19 = fmul double %0, %0
  %20 = fmul double %15, %0
  %21 = fmul double %20, %0
  %22 = tail call double @llvm.fmuladd.f64(double %19, double %0, double %21)
  %23 = tail call double @llvm.fmuladd.f64(double %13, double %0, double %22)
  %24 = fadd double %11, %23
  %25 = tail call double @pow(double noundef %24, double noundef 0x3FEC71C71C71C71C) #3
  %26 = fdiv double %18, %25
  %27 = load double, ptr @brag, align 8, !tbaa !5
  %28 = fdiv double %26, %27
  ret double %28
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @pow(double noundef, double noundef) local_unnamed_addr #2

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


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