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

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

@brag = external constant double, align 8

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @_Z4halliPdi(i32 noundef %0, ptr noundef %1, i32 noundef %2) #2 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !5
  %7 = load double, ptr @brag, align 8, !tbaa !11
  %8 = load ptr, ptr %5, align 8, !tbaa !9
  %9 = load i32, ptr %6, align 4, !tbaa !5
  %10 = add nsw i32 %9, 8
  %11 = sext i32 %10 to i64
  %12 = getelementptr inbounds double, ptr %8, i64 %11
  %13 = load double, ptr %12, align 8, !tbaa !11
  %14 = load ptr, ptr %5, align 8, !tbaa !9
  %15 = load i32, ptr %6, align 4, !tbaa !5
  %16 = add nsw i32 %15, 8
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds double, ptr %14, i64 %17
  %19 = load double, ptr %18, align 8, !tbaa !11
  %20 = load ptr, ptr %5, align 8, !tbaa !9
  %21 = load i32, ptr %6, align 4, !tbaa !5
  %22 = add nsw i32 %21, 9
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds double, ptr %20, i64 %23
  %25 = load double, ptr %24, align 8, !tbaa !11
  %26 = load ptr, ptr %5, align 8, !tbaa !9
  %27 = load i32, ptr %6, align 4, !tbaa !5
  %28 = add nsw i32 %27, 9
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds double, ptr %26, i64 %29
  %31 = load double, ptr %30, align 8, !tbaa !11
  %32 = fmul double %25, %31
  %33 = call double @llvm.fmuladd.f64(double %13, double %19, double %32)
  %34 = load ptr, ptr %5, align 8, !tbaa !9
  %35 = load i32, ptr %6, align 4, !tbaa !5
  %36 = add nsw i32 %35, 10
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds double, ptr %34, i64 %37
  %39 = load double, ptr %38, align 8, !tbaa !11
  %40 = load ptr, ptr %5, align 8, !tbaa !9
  %41 = load i32, ptr %6, align 4, !tbaa !5
  %42 = add nsw i32 %41, 10
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds double, ptr %40, i64 %43
  %45 = load double, ptr %44, align 8, !tbaa !11
  %46 = call double @llvm.fmuladd.f64(double %39, double %45, double %33)
  %47 = call double @sqrt(double noundef %46) #3
  %48 = fmul double %7, %47
  %49 = load ptr, ptr %5, align 8, !tbaa !9
  %50 = load i32, ptr %6, align 4, !tbaa !5
  %51 = add nsw i32 %50, 4
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds double, ptr %49, i64 %52
  %54 = load double, ptr %53, align 8, !tbaa !11
  %55 = call double @pow(double noundef %54, double noundef 1.500000e+00) #3
  %56 = load ptr, ptr %5, align 8, !tbaa !9
  %57 = load i32, ptr %6, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds double, ptr %56, i64 %58
  %60 = load double, ptr %59, align 8, !tbaa !11
  %61 = fdiv double %55, %60
  %62 = fmul double %48, %61
  ret double %62
}

; Function Attrs: nounwind
declare double @sqrt(double noundef) #1

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

@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)
declare double @pow(double noundef, double noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(write, argmem: readwrite) uwtable
define dso_local noundef double @_Z4halliPdi(i32 noundef %0, ptr nocapture noundef readonly %1, i32 noundef %2) local_unnamed_addr #2 {
  %4 = load double, ptr @brag, align 8, !tbaa !5
  %5 = sext i32 %2 to i64
  %6 = getelementptr double, ptr %1, i64 %5
  %7 = getelementptr i8, ptr %6, i64 64
  %8 = load double, ptr %7, align 8, !tbaa !5
  %9 = getelementptr i8, ptr %6, i64 72
  %10 = load double, ptr %9, align 8, !tbaa !5
  %11 = fmul double %10, %10
  %12 = tail call double @llvm.fmuladd.f64(double %8, double %8, double %11)
  %13 = getelementptr i8, ptr %6, i64 80
  %14 = load double, ptr %13, align 8, !tbaa !5
  %15 = tail call double @llvm.fmuladd.f64(double %14, double %14, double %12)
  %sqrt = tail call double @llvm.sqrt.f64(double %15)
  %16 = fmul double %4, %sqrt
  %17 = getelementptr i8, ptr %6, i64 32
  %18 = load double, ptr %17, align 8, !tbaa !5
  %19 = tail call double @pow(double noundef %18, double noundef 1.500000e+00) #4
  %20 = load double, ptr %6, align 8, !tbaa !5
  %21 = fdiv double %19, %20
  %22 = fmul double %16, %21
  ret double %22
}

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

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


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