; LLVM IR from bohanwang/libpgo :: src/core/perlinNoise (perlinWind)

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

%"class.pgo::PerlinNoise::PerlinWind" = type { ptr, double, [3 x double], [4 x ptr] }

; 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 uwtable
declare dso_local noundef double @_ZN3pgo11PerlinNoise10PerlinWind16GetPerlinNoise4DEPdiid(ptr noundef nonnull align 8 dereferenceable(72), ptr noundef, i32 noundef, i32 noundef, double noundef) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3pgo11PerlinNoise10PerlinWind13GetPerlinWindEddddidPd(ptr noundef nonnull align 8 dereferenceable(72) %0, double noundef %1, double noundef %2, double noundef %3, double noundef %4, i32 noundef %5, double noundef %6, ptr noundef %7) #2 align 2 {
  %9 = alloca ptr, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca i32, align 4
  %15 = alloca double, align 8
  %16 = alloca ptr, align 8
  %17 = alloca [4 x double], align 16
  store ptr %0, ptr %9, align 8, !tbaa !5
  store double %1, ptr %10, align 8, !tbaa !9
  store double %2, ptr %11, align 8, !tbaa !9
  store double %3, ptr %12, align 8, !tbaa !9
  store double %4, ptr %13, align 8, !tbaa !9
  store i32 %5, ptr %14, align 4, !tbaa !11
  store double %6, ptr %15, align 8, !tbaa !9
  store ptr %7, ptr %16, align 8, !tbaa !5
  %18 = load ptr, ptr %9, align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr %17) #3
  %19 = load double, ptr %10, align 8, !tbaa !9
  store double %19, ptr %17, align 8, !tbaa !9
  %20 = getelementptr inbounds double, ptr %17, i64 1
  %21 = load double, ptr %11, align 8, !tbaa !9
  store double %21, ptr %20, align 8, !tbaa !9
  %22 = getelementptr inbounds double, ptr %17, i64 2
  %23 = load double, ptr %12, align 8, !tbaa !9
  store double %23, ptr %22, align 8, !tbaa !9
  %24 = getelementptr inbounds double, ptr %17, i64 3
  %25 = load double, ptr %13, align 8, !tbaa !9
  store double %25, ptr %24, align 8, !tbaa !9
  %26 = getelementptr inbounds %"class.pgo::PerlinNoise::PerlinWind", ptr %18, i32 0, i32 2
  %27 = getelementptr inbounds [3 x double], ptr %26, i64 0, i64 0
  %28 = load double, ptr %27, align 8, !tbaa !9
  %29 = getelementptr inbounds %"class.pgo::PerlinNoise::PerlinWind", ptr %18, i32 0, i32 1
  %30 = load double, ptr %29, align 8, !tbaa !13
  %31 = getelementptr inbounds [4 x double], ptr %17, i64 0, i64 0
  %32 = load i32, ptr %14, align 4, !tbaa !11
  %33 = load double, ptr %15, align 8, !tbaa !9
  %34 = call noundef double @_ZN3pgo11PerlinNoise10PerlinWind16GetPerlinNoise4DEPdiid(ptr noundef nonnull align 8 dereferenceable(72) %18, ptr noundef %31, i32 noundef 0, i32 noundef %32, double noundef %33)
  %35 = call double @llvm.fmuladd.f64(double %30, double %34, double %28)
  %36 = load ptr, ptr %16, align 8, !tbaa !5
  %37 = getelementptr inbounds double, ptr %36, i64 0
  store double %35, ptr %37, align 8, !tbaa !9
  %38 = getelementptr inbounds %"class.pgo::PerlinNoise::PerlinWind", ptr %18, i32 0, i32 2
  %39 = getelementptr inbounds [3 x double], ptr %38, i64 0, i64 1
  %40 = load double, ptr %39, align 8, !tbaa !9
  %41 = getelementptr inbounds %"class.pgo::PerlinNoise::PerlinWind", ptr %18, i32 0, i32 1
  %42 = load double, ptr %41, align 8, !tbaa !13
  %43 = getelementptr inbounds [4 x double], ptr %17, i64 0, i64 0
  %44 = load i32, ptr %14, align 4, !tbaa !11
  %45 = load double, ptr %15, align 8, !tbaa !9
  %46 = call noundef double @_ZN3pgo11PerlinNoise10PerlinWind16GetPerlinNoise4DEPdiid(ptr noundef nonnull align 8 dereferenceable(72) %18, ptr noundef %43, i32 noundef 1, i32 noundef %44, double noundef %45)
  %47 = call double @llvm.fmuladd.f64(double %42, double %46, double %40)
  %48 = load ptr, ptr %16, align 8, !tbaa !5
  %49 = getelementptr inbounds double, ptr %48, i64 1
  store double %47, ptr %49, align 8, !tbaa !9
  %50 = getelementptr inbounds %"class.pgo::PerlinNoise::PerlinWind", ptr %18, i32 0, i32 2
  %51 = getelementptr inbounds [3 x double], ptr %50, i64 0, i64 2
  %52 = load double, ptr %51, align 8, !tbaa !9
  %53 = getelementptr inbounds %"class.pgo::PerlinNoise::PerlinWind", ptr %18, i32 0, i32 1
  %54 = load double, ptr %53, align 8, !tbaa !13
  %55 = getelementptr inbounds [4 x double], ptr %17, i64 0, i64 0
  %56 = load i32, ptr %14, align 4, !tbaa !11
  %57 = load double, ptr %15, align 8, !tbaa !9
  %58 = call noundef double @_ZN3pgo11PerlinNoise10PerlinWind16GetPerlinNoise4DEPdiid(ptr noundef nonnull align 8 dereferenceable(72) %18, ptr noundef %55, i32 noundef 2, i32 noundef %56, double noundef %57)
  %59 = call double @llvm.fmuladd.f64(double %54, double %58, double %52)
  %60 = load ptr, ptr %16, align 8, !tbaa !5
  %61 = getelementptr inbounds double, ptr %60, i64 2
  store double %59, ptr %61, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 32, ptr %17) #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 = { mustprogress 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !10, i64 8}
!14 = !{!"_ZTSN3pgo11PerlinNoise10PerlinWindE", !10, i64 8, !7, i64 16, !7, i64 40}


; 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 willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZN3pgo11PerlinNoise10PerlinWind16GetPerlinNoise4DEPdiid(ptr noundef nonnull align 8 dereferenceable(72), ptr noundef, i32 noundef, i32 noundef, double noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3pgo11PerlinNoise10PerlinWind13GetPerlinWindEddddidPd(ptr noundef nonnull align 8 dereferenceable(72) %0, double noundef %1, double noundef %2, double noundef %3, double noundef %4, i32 noundef %5, double noundef %6, ptr nocapture noundef writeonly %7) local_unnamed_addr #2 align 2 {
  %9 = alloca [4 x double], align 16
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #3
  store double %1, ptr %9, align 16, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %9, i64 8
  store double %2, ptr %10, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %9, i64 16
  store double %3, ptr %11, align 16, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %9, i64 24
  store double %4, ptr %12, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %0, i64 16
  %14 = load double, ptr %13, align 8, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %0, i64 8
  %16 = load double, ptr %15, align 8, !tbaa !9
  %17 = call noundef double @_ZN3pgo11PerlinNoise10PerlinWind16GetPerlinNoise4DEPdiid(ptr noundef nonnull align 8 dereferenceable(72) %0, ptr noundef nonnull %9, i32 noundef 0, i32 noundef %5, double noundef %6)
  %18 = call double @llvm.fmuladd.f64(double %16, double %17, double %14)
  store double %18, ptr %7, align 8, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %0, i64 24
  %20 = load double, ptr %19, align 8, !tbaa !5
  %21 = load double, ptr %15, align 8, !tbaa !9
  %22 = call noundef double @_ZN3pgo11PerlinNoise10PerlinWind16GetPerlinNoise4DEPdiid(ptr noundef nonnull align 8 dereferenceable(72) %0, ptr noundef nonnull %9, i32 noundef 1, i32 noundef %5, double noundef %6)
  %23 = call double @llvm.fmuladd.f64(double %21, double %22, double %20)
  %24 = getelementptr inbounds i8, ptr %7, i64 8
  store double %23, ptr %24, align 8, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %0, i64 32
  %26 = load double, ptr %25, align 8, !tbaa !5
  %27 = load double, ptr %15, align 8, !tbaa !9
  %28 = call noundef double @_ZN3pgo11PerlinNoise10PerlinWind16GetPerlinNoise4DEPdiid(ptr noundef nonnull align 8 dereferenceable(72) %0, ptr noundef nonnull %9, i32 noundef 2, i32 noundef %5, double noundef %6)
  %29 = call double @llvm.fmuladd.f64(double %27, double %28, double %26)
  %30 = getelementptr inbounds i8, ptr %7, i64 16
  store double %29, ptr %30, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #3
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { mustprogress 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"}
!9 = !{!10, !6, i64 8}
!10 = !{!"_ZTSN3pgo11PerlinNoise10PerlinWindE", !6, i64 8, !7, i64 16, !7, i64 40}


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