; LLVM IR from microsoft/LightAIMD :: src (functional)

; 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: nounwind
declare double @pow(double noundef, double noundef) #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 @functional_lda_c_vwn(ptr noundef %0, ptr noundef %1, ptr noundef %2, i64 noundef %3) #2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, 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 double, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store i64 %3, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  store i64 0, ptr %9, align 8, !tbaa !9
  br label %23

23:                                               ; preds = %172, %4
  %24 = load i64, ptr %9, align 8, !tbaa !9
  %25 = load i64, ptr %8, align 8, !tbaa !9
  %26 = icmp ult i64 %24, %25
  br i1 %26, label %28, label %27

27:                                               ; preds = %23
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br label %175

28:                                               ; preds = %23
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = load i64, ptr %9, align 8, !tbaa !9
  %31 = getelementptr inbounds double, ptr %29, i64 %30
  %32 = load double, ptr %31, align 8, !tbaa !11
  %33 = fcmp olt double %32, 1.000000e-10
  br i1 %33, label %34, label %41

34:                                               ; preds = %28
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = load i64, ptr %9, align 8, !tbaa !9
  %37 = getelementptr inbounds double, ptr %35, i64 %36
  store double 0.000000e+00, ptr %37, align 8, !tbaa !11
  %38 = load ptr, ptr %7, align 8, !tbaa !5
  %39 = load i64, ptr %9, align 8, !tbaa !9
  %40 = getelementptr inbounds double, ptr %38, i64 %39
  store double 0.000000e+00, ptr %40, align 8, !tbaa !11
  br label %171

41:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = load i64, ptr %9, align 8, !tbaa !9
  %44 = getelementptr inbounds double, ptr %42, i64 %43
  %45 = load double, ptr %44, align 8, !tbaa !11
  %46 = fdiv double 0x3FCE8EC8A4AEACC4, %45
  %47 = call double @pow(double noundef %46, double noundef 0x3FC5555555555555) #4
  store double %47, ptr %10, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  store double 3.109070e-02, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  store double -1.049800e-01, ptr %12, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  store double 3.727440e+00, ptr %13, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  store double 1.293520e+01, ptr %14, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %48 = load double, ptr %14, align 8, !tbaa !11
  %49 = load double, ptr %13, align 8, !tbaa !11
  %50 = load double, ptr %13, align 8, !tbaa !11
  %51 = fmul double %49, %50
  %52 = fneg double %51
  %53 = call double @llvm.fmuladd.f64(double %48, double 4.000000e+00, double %52)
  store double %53, ptr %15, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %54 = load double, ptr %15, align 8, !tbaa !11
  %55 = call double @sqrt(double noundef %54) #4
  store double %55, ptr %16, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %56 = load double, ptr %10, align 8, !tbaa !11
  %57 = load double, ptr %10, align 8, !tbaa !11
  %58 = fmul double %56, %57
  store double %58, ptr %17, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  %59 = load double, ptr %17, align 8, !tbaa !11
  %60 = load double, ptr %13, align 8, !tbaa !11
  %61 = load double, ptr %10, align 8, !tbaa !11
  %62 = call double @llvm.fmuladd.f64(double %60, double %61, double %59)
  %63 = load double, ptr %14, align 8, !tbaa !11
  %64 = fadd double %62, %63
  store double %64, ptr %18, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  %65 = load double, ptr %12, align 8, !tbaa !11
  %66 = load double, ptr %12, align 8, !tbaa !11
  %67 = load double, ptr %13, align 8, !tbaa !11
  %68 = load double, ptr %12, align 8, !tbaa !11
  %69 = fmul double %67, %68
  %70 = call double @llvm.fmuladd.f64(double %65, double %66, double %69)
  %71 = load double, ptr %14, align 8, !tbaa !11
  %72 = fadd double %70, %71
  store double %72, ptr %19, align 8, !tbaa !11
  %73 = load double, ptr %11, align 8, !tbaa !11
  %74 = load double, ptr %17, align 8, !tbaa !11
  %75 = load double, ptr %18, align 8, !tbaa !11
  %76 = fdiv double %74, %75
  %77 = call double @log(double noundef %76) #4
  %78 = load double, ptr %13, align 8, !tbaa !11
  %79 = load double, ptr %12, align 8, !tbaa !11
  %80 = load double, ptr %19, align 8, !tbaa !11
  %81 = fdiv double %79, %80
  %82 = fmul double %78, %81
  %83 = load double, ptr %10, align 8, !tbaa !11
  %84 = load double, ptr %12, align 8, !tbaa !11
  %85 = fsub double %83, %84
  %86 = call double @pow(double noundef %85, double noundef 2.000000e+00) #4
  %87 = load double, ptr %18, align 8, !tbaa !11
  %88 = fdiv double %86, %87
  %89 = call double @log(double noundef %88) #4
  %90 = fneg double %82
  %91 = call double @llvm.fmuladd.f64(double %90, double %89, double %77)
  %92 = load double, ptr %13, align 8, !tbaa !11
  %93 = fmul double 2.000000e+00, %92
  %94 = load double, ptr %16, align 8, !tbaa !11
  %95 = fdiv double %93, %94
  %96 = load double, ptr %12, align 8, !tbaa !11
  %97 = load double, ptr %12, align 8, !tbaa !11
  %98 = load double, ptr %13, align 8, !tbaa !11
  %99 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %97, double %98)
  %100 = fmul double %96, %99
  %101 = load double, ptr %19, align 8, !tbaa !11
  %102 = fdiv double %100, %101
  %103 = fsub double 1.000000e+00, %102
  %104 = fmul double %95, %103
  %105 = load double, ptr %16, align 8, !tbaa !11
  %106 = load double, ptr %10, align 8, !tbaa !11
  %107 = load double, ptr %13, align 8, !tbaa !11
  %108 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %106, double %107)
  %109 = fdiv double %105, %108
  %110 = call double @atan(double noundef %109) #4
  %111 = call double @llvm.fmuladd.f64(double %104, double %110, double %91)
  %112 = fmul double %73, %111
  %113 = load ptr, ptr %6, align 8, !tbaa !5
  %114 = load i64, ptr %9, align 8, !tbaa !9
  %115 = getelementptr inbounds double, ptr %113, i64 %114
  store double %112, ptr %115, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  %116 = load double, ptr %10, align 8, !tbaa !11
  %117 = load double, ptr %13, align 8, !tbaa !11
  %118 = call double @llvm.fmuladd.f64(double %116, double 2.000000e+00, double %117)
  store double %118, ptr %20, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #4
  %119 = load double, ptr %20, align 8, !tbaa !11
  %120 = load double, ptr %20, align 8, !tbaa !11
  %121 = fmul double %119, %120
  store double %121, ptr %21, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #4
  %122 = load double, ptr %21, align 8, !tbaa !11
  %123 = load double, ptr %15, align 8, !tbaa !11
  %124 = fadd double %122, %123
  store double %124, ptr %22, align 8, !tbaa !11
  %125 = load ptr, ptr %6, align 8, !tbaa !5
  %126 = load i64, ptr %9, align 8, !tbaa !9
  %127 = getelementptr inbounds double, ptr %125, i64 %126
  %128 = load double, ptr %127, align 8, !tbaa !11
  %129 = load double, ptr %10, align 8, !tbaa !11
  %130 = fdiv double %129, 6.000000e+00
  %131 = load double, ptr %11, align 8, !tbaa !11
  %132 = fmul double %130, %131
  %133 = load double, ptr %10, align 8, !tbaa !11
  %134 = fdiv double 2.000000e+00, %133
  %135 = load double, ptr %20, align 8, !tbaa !11
  %136 = load double, ptr %18, align 8, !tbaa !11
  %137 = fdiv double %135, %136
  %138 = fsub double %134, %137
  %139 = load double, ptr %13, align 8, !tbaa !11
  %140 = fmul double 4.000000e+00, %139
  %141 = load double, ptr %22, align 8, !tbaa !11
  %142 = fdiv double %140, %141
  %143 = fsub double %138, %142
  %144 = load double, ptr %13, align 8, !tbaa !11
  %145 = load double, ptr %12, align 8, !tbaa !11
  %146 = fmul double %144, %145
  %147 = load double, ptr %19, align 8, !tbaa !11
  %148 = fdiv double %146, %147
  %149 = load double, ptr %10, align 8, !tbaa !11
  %150 = load double, ptr %12, align 8, !tbaa !11
  %151 = fsub double %149, %150
  %152 = fdiv double 2.000000e+00, %151
  %153 = load double, ptr %20, align 8, !tbaa !11
  %154 = load double, ptr %18, align 8, !tbaa !11
  %155 = fdiv double %153, %154
  %156 = fsub double %152, %155
  %157 = load double, ptr %12, align 8, !tbaa !11
  %158 = load double, ptr %13, align 8, !tbaa !11
  %159 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %157, double %158)
  %160 = fmul double 4.000000e+00, %159
  %161 = load double, ptr %22, align 8, !tbaa !11
  %162 = fdiv double %160, %161
  %163 = fsub double %156, %162
  %164 = fneg double %148
  %165 = call double @llvm.fmuladd.f64(double %164, double %163, double %143)
  %166 = fneg double %132
  %167 = call double @llvm.fmuladd.f64(double %166, double %165, double %128)
  %168 = load ptr, ptr %7, align 8, !tbaa !5
  %169 = load i64, ptr %9, align 8, !tbaa !9
  %170 = getelementptr inbounds double, ptr %168, i64 %169
  store double %167, ptr %170, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %171

171:                                              ; preds = %41, %34
  br label %172

172:                                              ; preds = %171
  %173 = load i64, ptr %9, align 8, !tbaa !9
  %174 = add i64 %173, 1
  store i64 %174, ptr %9, align 8, !tbaa !9
  br label %23, !llvm.loop !13

175:                                              ; preds = %27
  ret void
}

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

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

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

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

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

; Function Attrs: nofree nounwind memory(write, argmem: readwrite) uwtable
define dso_local void @functional_lda_c_vwn(ptr nocapture noundef readonly %0, ptr nocapture noundef writeonly %1, ptr nocapture noundef writeonly %2, i64 noundef %3) local_unnamed_addr #1 {
  %.not = icmp eq i64 %3, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %45, %4
  ret void

.lr.ph:                                           ; preds = %4, %45
  %.073 = phi i64 [ %48, %45 ], [ 0, %4 ]
  %5 = getelementptr inbounds double, ptr %0, i64 %.073
  %6 = load double, ptr %5, align 8, !tbaa !5
  %7 = fcmp olt double %6, 1.000000e-10
  br i1 %7, label %45, label %8

8:                                                ; preds = %.lr.ph
  %9 = fdiv double 0x3FCE8EC8A4AEACC4, %6
  %10 = tail call double @pow(double noundef %9, double noundef 0x3FC5555555555555) #3
  %11 = fmul double %10, %10
  %12 = tail call double @llvm.fmuladd.f64(double %10, double 3.727440e+00, double %11)
  %13 = fadd double %12, 1.293520e+01
  %14 = fdiv double %11, %13
  %15 = tail call double @log(double noundef %14) #3
  %16 = tail call double @llvm.fmuladd.f64(double %10, double 2.000000e+00, double 3.727440e+00)
  %17 = fdiv double 0x40189BA37B40A142, %16
  %18 = fmul double %16, %16
  %19 = fdiv double %10, 6.000000e+00
  %20 = fdiv double %16, %13
  %21 = insertelement <2 x double> poison, double %10, i64 0
  %22 = insertelement <2 x double> %21, double %18, i64 1
  %23 = fadd <2 x double> %22, <double 1.049800e-01, double 0x4042EC6A33DE257B>
  %24 = fmul <2 x double> %23, %23
  %square = extractelement <2 x double> %24, i64 0
  %25 = fdiv double %square, %13
  %26 = tail call double @log(double noundef %25) #3
  %27 = tail call double @llvm.fmuladd.f64(double %26, double 0x3F9FEA66CFE1E22B, double %15)
  %28 = tail call double @atan(double noundef %17) #3
  %29 = tail call double @llvm.fmuladd.f64(double %28, double 0x3FF3F5733078CB8E, double %27)
  %30 = fmul double %29, 3.109070e-02
  %31 = insertelement <2 x double> %23, double %10, i64 0
  %32 = fdiv <2 x double> <double 2.000000e+00, double 0x402DD1CC100E6AFD>, %31
  %33 = extractelement <2 x double> %32, i64 0
  %34 = fsub double %33, %20
  %35 = extractelement <2 x double> %32, i64 1
  %36 = fsub double %34, %35
  %37 = fdiv <2 x double> <double 2.000000e+00, double 0x402C23CC8DE2AC32>, %23
  %38 = extractelement <2 x double> %37, i64 0
  %39 = fsub double %38, %20
  %40 = extractelement <2 x double> %37, i64 1
  %41 = fsub double %39, %40
  %42 = tail call double @llvm.fmuladd.f64(double %41, double 0x3F9FEA66CFE1E22A, double %36)
  %43 = fmul double %19, -3.109070e-02
  %44 = tail call double @llvm.fmuladd.f64(double %43, double %42, double %30)
  br label %45

45:                                               ; preds = %.lr.ph, %8
  %.sink74 = phi double [ %30, %8 ], [ 0.000000e+00, %.lr.ph ]
  %.sink = phi double [ %44, %8 ], [ 0.000000e+00, %.lr.ph ]
  %46 = getelementptr inbounds double, ptr %1, i64 %.073
  store double %.sink74, ptr %46, align 8
  %47 = getelementptr inbounds double, ptr %2, i64 %.073
  store double %.sink, ptr %47, align 8
  %48 = add nuw i64 %.073, 1
  %exitcond.not = icmp eq i64 %48, %3
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9
}

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @log(double noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @atan(double noundef) local_unnamed_addr #0

attributes #0 = { 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 #1 = { nofree nounwind 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 #2 = { mustprogress 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 = !{!"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: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MergedLoadStoreMotionPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass,VectorCombinePass