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

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

; Function Attrs: nounwind uwtable
define dso_local void @vranlc(i32 noundef %0, ptr noundef %1, double noundef %2, ptr noundef %3) #2 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca double, align 8
  %8 = alloca ptr, 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
  %19 = alloca double, align 8
  %20 = alloca double, align 8
  %21 = alloca double, align 8
  %22 = alloca i32, align 4
  store i32 %0, ptr %5, align 4, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !9
  store double %2, ptr %7, align 8, !tbaa !11
  store ptr %3, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  store double 0x3E80000000000000, ptr %9, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  store double 0x3D10000000000000, ptr %10, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  store double 0x4160000000000000, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  store double 0x42D0000000000000, ptr %12, align 8, !tbaa !11
  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
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #3
  %23 = load double, ptr %7, align 8, !tbaa !11
  %24 = fmul double 0x3E80000000000000, %23
  store double %24, ptr %13, align 8, !tbaa !11
  %25 = load double, ptr %13, align 8, !tbaa !11
  %26 = fptosi double %25 to i32
  %27 = sitofp i32 %26 to double
  store double %27, ptr %17, align 8, !tbaa !11
  %28 = load double, ptr %7, align 8, !tbaa !11
  %29 = load double, ptr %17, align 8, !tbaa !11
  %30 = call double @llvm.fmuladd.f64(double 0xC160000000000000, double %29, double %28)
  store double %30, ptr %18, align 8, !tbaa !11
  store i32 0, ptr %22, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %79, %4
  %32 = load i32, ptr %22, align 4, !tbaa !5
  %33 = load i32, ptr %5, align 4, !tbaa !5
  %34 = icmp slt i32 %32, %33
  br i1 %34, label %35, label %82

35:                                               ; preds = %31
  %36 = load ptr, ptr %6, align 8, !tbaa !9
  %37 = load double, ptr %36, align 8, !tbaa !11
  %38 = fmul double 0x3E80000000000000, %37
  store double %38, ptr %13, align 8, !tbaa !11
  %39 = load double, ptr %13, align 8, !tbaa !11
  %40 = fptosi double %39 to i32
  %41 = sitofp i32 %40 to double
  store double %41, ptr %19, align 8, !tbaa !11
  %42 = load ptr, ptr %6, align 8, !tbaa !9
  %43 = load double, ptr %42, align 8, !tbaa !11
  %44 = load double, ptr %19, align 8, !tbaa !11
  %45 = call double @llvm.fmuladd.f64(double 0xC160000000000000, double %44, double %43)
  store double %45, ptr %20, align 8, !tbaa !11
  %46 = load double, ptr %17, align 8, !tbaa !11
  %47 = load double, ptr %20, align 8, !tbaa !11
  %48 = load double, ptr %18, align 8, !tbaa !11
  %49 = load double, ptr %19, align 8, !tbaa !11
  %50 = fmul double %48, %49
  %51 = call double @llvm.fmuladd.f64(double %46, double %47, double %50)
  store double %51, ptr %13, align 8, !tbaa !11
  %52 = load double, ptr %13, align 8, !tbaa !11
  %53 = fmul double 0x3E80000000000000, %52
  %54 = fptosi double %53 to i32
  %55 = sitofp i32 %54 to double
  store double %55, ptr %14, align 8, !tbaa !11
  %56 = load double, ptr %13, align 8, !tbaa !11
  %57 = load double, ptr %14, align 8, !tbaa !11
  %58 = call double @llvm.fmuladd.f64(double 0xC160000000000000, double %57, double %56)
  store double %58, ptr %21, align 8, !tbaa !11
  %59 = load double, ptr %21, align 8, !tbaa !11
  %60 = load double, ptr %18, align 8, !tbaa !11
  %61 = load double, ptr %20, align 8, !tbaa !11
  %62 = fmul double %60, %61
  %63 = call double @llvm.fmuladd.f64(double 0x4160000000000000, double %59, double %62)
  store double %63, ptr %15, align 8, !tbaa !11
  %64 = load double, ptr %15, align 8, !tbaa !11
  %65 = fmul double 0x3D10000000000000, %64
  %66 = fptosi double %65 to i32
  %67 = sitofp i32 %66 to double
  store double %67, ptr %16, align 8, !tbaa !11
  %68 = load double, ptr %15, align 8, !tbaa !11
  %69 = load double, ptr %16, align 8, !tbaa !11
  %70 = call double @llvm.fmuladd.f64(double 0xC2D0000000000000, double %69, double %68)
  %71 = load ptr, ptr %6, align 8, !tbaa !9
  store double %70, ptr %71, align 8, !tbaa !11
  %72 = load ptr, ptr %6, align 8, !tbaa !9
  %73 = load double, ptr %72, align 8, !tbaa !11
  %74 = fmul double 0x3D10000000000000, %73
  %75 = load ptr, ptr %8, align 8, !tbaa !9
  %76 = load i32, ptr %22, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds double, ptr %75, i64 %77
  store double %74, ptr %78, align 8, !tbaa !11
  br label %79

79:                                               ; preds = %35
  %80 = load i32, ptr %22, align 4, !tbaa !5
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr %22, align 4, !tbaa !5
  br label %31, !llvm.loop !13

82:                                               ; preds = %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  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
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


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

; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @vranlc(i32 noundef %0, ptr nocapture noundef %1, double noundef %2, ptr nocapture noundef writeonly %3) local_unnamed_addr #1 {
  %5 = fmul double %2, 0x3E80000000000000
  %6 = fptosi double %5 to i32
  %7 = sitofp i32 %6 to double
  %8 = tail call double @llvm.fmuladd.f64(double %7, double 0xC160000000000000, double %2)
  %9 = icmp sgt i32 %0, 0
  br i1 %9, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %4
  %wide.trip.count = zext nneg i32 %0 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %10 = load double, ptr %1, align 8, !tbaa !5
  %11 = fmul double %10, 0x3E80000000000000
  %12 = fptosi double %11 to i32
  %13 = sitofp i32 %12 to double
  %14 = tail call double @llvm.fmuladd.f64(double %13, double 0xC160000000000000, double %10)
  %15 = fmul double %8, %13
  %16 = tail call double @llvm.fmuladd.f64(double %7, double %14, double %15)
  %17 = fmul double %16, 0x3E80000000000000
  %18 = fptosi double %17 to i32
  %19 = sitofp i32 %18 to double
  %20 = tail call double @llvm.fmuladd.f64(double %19, double 0xC160000000000000, double %16)
  %21 = fmul double %8, %14
  %22 = tail call double @llvm.fmuladd.f64(double %20, double 0x4160000000000000, double %21)
  %23 = fmul double %22, 0x3D10000000000000
  %24 = fptosi double %23 to i32
  %25 = sitofp i32 %24 to double
  %26 = tail call double @llvm.fmuladd.f64(double %25, double 0xC2D0000000000000, double %22)
  store double %26, ptr %1, align 8, !tbaa !5
  %27 = fmul double %26, 0x3D10000000000000
  %28 = getelementptr inbounds double, ptr %3, i64 %indvars.iv
  store double %27, ptr %28, align 8, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %4
  ret void
}

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

!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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass