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

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

@betavalues = external dso_local constant [8 x [11 x double]], 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: nounwind
declare double @pow(double noundef, double noundef) #2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @_Z9beta_perpdi(double noundef %0, i32 noundef %1) #3 {
  %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 [11 x double]], ptr @betavalues, i64 0, i64 %12
  %14 = getelementptr inbounds [11 x double], ptr %13, i64 0, i64 1
  %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 [11 x double]], ptr @betavalues, i64 0, i64 %18
  %20 = getelementptr inbounds [11 x double], ptr %19, i64 0, i64 2
  %21 = load double, ptr %20, align 8, !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 [11 x double]], ptr @betavalues, i64 0, i64 %24
  %26 = getelementptr inbounds [11 x double], ptr %25, i64 0, i64 3
  %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 [11 x double]], ptr @betavalues, i64 0, i64 %30
  %32 = getelementptr inbounds [11 x double], ptr %31, i64 0, i64 4
  %33 = load double, ptr %32, align 8, !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 [11 x double]], ptr @betavalues, i64 0, i64 %36
  %38 = getelementptr inbounds [11 x double], ptr %37, i64 0, i64 5
  %39 = load double, ptr %38, align 8, !tbaa !5
  store double %39, ptr %9, align 8, !tbaa !5
  %40 = load double, ptr %6, align 8, !tbaa !5
  %41 = load double, ptr %3, align 8, !tbaa !5
  %42 = load double, ptr %5, align 8, !tbaa !5
  %43 = call double @llvm.fmuladd.f64(double %40, double %41, double %42)
  %44 = load double, ptr %3, align 8, !tbaa !5
  %45 = load double, ptr %3, align 8, !tbaa !5
  %46 = fmul double %44, %45
  %47 = load double, ptr %3, align 8, !tbaa !5
  %48 = load double, ptr %9, align 8, !tbaa !5
  %49 = load double, ptr %3, align 8, !tbaa !5
  %50 = fmul double %48, %49
  %51 = load double, ptr %3, align 8, !tbaa !5
  %52 = fmul double %50, %51
  %53 = call double @llvm.fmuladd.f64(double %46, double %47, double %52)
  %54 = load double, ptr %8, align 8, !tbaa !5
  %55 = load double, ptr %3, align 8, !tbaa !5
  %56 = call double @llvm.fmuladd.f64(double %54, double %55, double %53)
  %57 = load double, ptr %7, align 8, !tbaa !5
  %58 = fadd double %56, %57
  %59 = call double @pow(double noundef %58, double noundef 0x3FEC71C71C71C71C) #4
  %60 = fdiv double %43, %59
  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 %60
}

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

@betavalues = external dso_local local_unnamed_addr constant [8 x [11 x double]], 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 nounwind willreturn memory(write)
declare double @pow(double noundef, double noundef) local_unnamed_addr #1

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

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