; LLVM IR from ROCm/aomp :: test/smoke-fails/clang-298140/NPB_LU/MG (randdp)

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

; Function Attrs: nounwind uwtable
define dso_local double @randlc(ptr noundef %0, double noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca double, align 8
  %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
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca double, align 8
  %18 = alloca double, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store double %1, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  store double 0x3E80000000000000, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  store double 0x3D10000000000000, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  store double 0x4160000000000000, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  store double 0x42D0000000000000, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  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
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  %19 = load double, ptr %4, align 8, !tbaa !9
  %20 = fmul double 0x3E80000000000000, %19
  store double %20, ptr %9, align 8, !tbaa !9
  %21 = load double, ptr %9, align 8, !tbaa !9
  %22 = fptosi double %21 to i32
  %23 = sitofp i32 %22 to double
  store double %23, ptr %13, align 8, !tbaa !9
  %24 = load double, ptr %4, align 8, !tbaa !9
  %25 = load double, ptr %13, align 8, !tbaa !9
  %26 = call double @llvm.fmuladd.f64(double 0xC160000000000000, double %25, double %24)
  store double %26, ptr %14, align 8, !tbaa !9
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = load double, ptr %27, align 8, !tbaa !9
  %29 = fmul double 0x3E80000000000000, %28
  store double %29, ptr %9, align 8, !tbaa !9
  %30 = load double, ptr %9, align 8, !tbaa !9
  %31 = fptosi double %30 to i32
  %32 = sitofp i32 %31 to double
  store double %32, ptr %15, align 8, !tbaa !9
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = load double, ptr %33, align 8, !tbaa !9
  %35 = load double, ptr %15, align 8, !tbaa !9
  %36 = call double @llvm.fmuladd.f64(double 0xC160000000000000, double %35, double %34)
  store double %36, ptr %16, align 8, !tbaa !9
  %37 = load double, ptr %13, align 8, !tbaa !9
  %38 = load double, ptr %16, align 8, !tbaa !9
  %39 = load double, ptr %14, align 8, !tbaa !9
  %40 = load double, ptr %15, align 8, !tbaa !9
  %41 = fmul double %39, %40
  %42 = call double @llvm.fmuladd.f64(double %37, double %38, double %41)
  store double %42, ptr %9, align 8, !tbaa !9
  %43 = load double, ptr %9, align 8, !tbaa !9
  %44 = fmul double 0x3E80000000000000, %43
  %45 = fptosi double %44 to i32
  %46 = sitofp i32 %45 to double
  store double %46, ptr %10, align 8, !tbaa !9
  %47 = load double, ptr %9, align 8, !tbaa !9
  %48 = load double, ptr %10, align 8, !tbaa !9
  %49 = call double @llvm.fmuladd.f64(double 0xC160000000000000, double %48, double %47)
  store double %49, ptr %17, align 8, !tbaa !9
  %50 = load double, ptr %17, align 8, !tbaa !9
  %51 = load double, ptr %14, align 8, !tbaa !9
  %52 = load double, ptr %16, align 8, !tbaa !9
  %53 = fmul double %51, %52
  %54 = call double @llvm.fmuladd.f64(double 0x4160000000000000, double %50, double %53)
  store double %54, ptr %11, align 8, !tbaa !9
  %55 = load double, ptr %11, align 8, !tbaa !9
  %56 = fmul double 0x3D10000000000000, %55
  %57 = fptosi double %56 to i32
  %58 = sitofp i32 %57 to double
  store double %58, ptr %12, align 8, !tbaa !9
  %59 = load double, ptr %11, align 8, !tbaa !9
  %60 = load double, ptr %12, align 8, !tbaa !9
  %61 = call double @llvm.fmuladd.f64(double 0xC2D0000000000000, double %60, double %59)
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  store double %61, ptr %62, align 8, !tbaa !9
  %63 = load ptr, ptr %3, align 8, !tbaa !5
  %64 = load double, ptr %63, align 8, !tbaa !9
  %65 = fmul double 0x3D10000000000000, %64
  store double %65, ptr %18, align 8, !tbaa !9
  %66 = load double, ptr %18, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  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 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
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  ret double %66
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"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"

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local double @randlc(ptr nocapture noundef %0, double noundef %1) local_unnamed_addr #0 {
  %3 = load double, ptr %0, align 8, !tbaa !5
  %4 = insertelement <2 x double> poison, double %1, i64 0
  %5 = insertelement <2 x double> %4, double %3, i64 1
  %6 = fmul <2 x double> %5, <double 0x3E80000000000000, double 0x3E80000000000000>
  %7 = fptosi <2 x double> %6 to <2 x i32>
  %8 = sitofp <2 x i32> %7 to <2 x double>
  %9 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %8, <2 x double> <double 0xC160000000000000, double 0xC160000000000000>, <2 x double> %5)
  %10 = extractelement <2 x double> %9, i64 0
  %shift = shufflevector <2 x double> %8, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
  %11 = fmul <2 x double> %9, %shift
  %12 = extractelement <2 x double> %11, i64 0
  %13 = extractelement <2 x double> %9, i64 1
  %14 = extractelement <2 x double> %8, i64 0
  %15 = tail call double @llvm.fmuladd.f64(double %14, double %13, double %12)
  %16 = fmul double %15, 0x3E80000000000000
  %17 = fptosi double %16 to i32
  %18 = sitofp i32 %17 to double
  %19 = tail call double @llvm.fmuladd.f64(double %18, double 0xC160000000000000, double %15)
  %20 = fmul double %10, %13
  %21 = tail call double @llvm.fmuladd.f64(double %19, double 0x4160000000000000, double %20)
  %22 = fmul double %21, 0x3D10000000000000
  %23 = fptosi double %22 to i32
  %24 = sitofp i32 %23 to double
  %25 = tail call double @llvm.fmuladd.f64(double %24, double 0xC2D0000000000000, double %21)
  store double %25, ptr %0, align 8, !tbaa !5
  %26 = fmul double %25, 0x3D10000000000000
  ret double %26
}

; 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(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 #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/C++ TBAA"}


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