; LLVM IR from jgaeddert/liquid-dsp :: src/random/tests (random_autotest)

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

@.str = external hidden unnamed_addr constant [89 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [18 x i8], align 1

; 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 float @llvm.fmuladd.f32(float, float, float) #1

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

; 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 speculatable willreturn memory(none)
declare i1 @llvm.is.fpclass.f32(float, i32 immarg) #1

declare void @liquid_autotest_failed_expr(ptr noundef, i32 noundef, ptr noundef, double noundef, ptr noundef, ptr noundef, double noundef) #3

declare void @liquid_autotest_passed(...) #3

; 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 @autotest_randricekf() #4 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca float, align 4
  %4 = alloca float, align 4
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #5
  store i64 250000, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store float 0.000000e+00, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store float 0.000000e+00, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store float 0x3FC3333340000000, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store float 2.000000e+00, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store float 1.000000e+00, ptr %8, align 4, !tbaa !9
  store i64 0, ptr %2, align 8, !tbaa !5
  br label %9

9:                                                ; preds = %24, %0
  %10 = load i64, ptr %2, align 8, !tbaa !5
  %11 = load i64, ptr %1, align 8, !tbaa !5
  %12 = icmp ult i64 %10, %11
  br i1 %12, label %13, label %27

13:                                               ; preds = %9
  %14 = load float, ptr %7, align 4, !tbaa !9
  %15 = load float, ptr %8, align 4, !tbaa !9
  %16 = call float @randricekf(float noundef %14, float noundef %15)
  store float %16, ptr %3, align 4, !tbaa !9
  %17 = load float, ptr %3, align 4, !tbaa !9
  %18 = load float, ptr %4, align 4, !tbaa !9
  %19 = fadd float %18, %17
  store float %19, ptr %4, align 4, !tbaa !9
  %20 = load float, ptr %3, align 4, !tbaa !9
  %21 = load float, ptr %3, align 4, !tbaa !9
  %22 = load float, ptr %5, align 4, !tbaa !9
  %23 = call float @llvm.fmuladd.f32(float %20, float %21, float %22)
  store float %23, ptr %5, align 4, !tbaa !9
  br label %24

24:                                               ; preds = %13
  %25 = load i64, ptr %2, align 8, !tbaa !5
  %26 = add i64 %25, 1
  store i64 %26, ptr %2, align 8, !tbaa !5
  br label %9, !llvm.loop !11

27:                                               ; preds = %9
  %28 = load i64, ptr %1, align 8, !tbaa !5
  %29 = uitofp i64 %28 to float
  %30 = load float, ptr %4, align 4, !tbaa !9
  %31 = fdiv float %30, %29
  store float %31, ptr %4, align 4, !tbaa !9
  %32 = load float, ptr %5, align 4, !tbaa !9
  %33 = load i64, ptr %1, align 8, !tbaa !5
  %34 = uitofp i64 %33 to float
  %35 = fdiv float %32, %34
  store float %35, ptr %5, align 4, !tbaa !9
  %36 = load float, ptr %4, align 4, !tbaa !9
  %37 = fsub float %36, 0x3FEDADFF80000000
  %38 = fpext float %37 to double
  %39 = load float, ptr %4, align 4, !tbaa !9
  %40 = fsub float %39, 0x3FEDADFF80000000
  %41 = fpext float %40 to double
  %42 = load float, ptr %4, align 4, !tbaa !9
  %43 = fsub float %42, 0x3FEDADFF80000000
  %44 = fpext float %43 to double
  %45 = load float, ptr %4, align 4, !tbaa !9
  %46 = fsub float %45, 0x3FEDADFF80000000
  %47 = fpext float %46 to double
  %48 = call double @llvm.fmuladd.f64(double %38, double %41, double 0.000000e+00)
  %49 = call double @sqrt(double noundef %48) #5
  %50 = load float, ptr %6, align 4, !tbaa !9
  %51 = fpext float %50 to double
  %52 = fcmp ogt double %49, %51
  br i1 %52, label %63, label %53

53:                                               ; preds = %27
  %54 = load float, ptr %4, align 4, !tbaa !9
  %55 = call i1 @llvm.is.fpclass.f32(float %54, i32 3)
  br i1 %55, label %63, label %56

56:                                               ; preds = %53
  %57 = load float, ptr %4, align 4, !tbaa !9
  %58 = call i1 @llvm.is.fpclass.f32(float 0.000000e+00, i32 3)
  br i1 %58, label %63, label %59

59:                                               ; preds = %56
  %60 = call i1 @llvm.is.fpclass.f32(float 0x3FEDADFF80000000, i32 3)
  br i1 %60, label %63, label %61

61:                                               ; preds = %59
  %62 = call i1 @llvm.is.fpclass.f32(float 0.000000e+00, i32 3)
  br i1 %62, label %63, label %80

63:                                               ; preds = %61, %59, %56, %53, %27
  %64 = load float, ptr %4, align 4, !tbaa !9
  %65 = fsub float %64, 0x3FEDADFF80000000
  %66 = fpext float %65 to double
  %67 = load float, ptr %4, align 4, !tbaa !9
  %68 = fsub float %67, 0x3FEDADFF80000000
  %69 = fpext float %68 to double
  %70 = load float, ptr %4, align 4, !tbaa !9
  %71 = fsub float %70, 0x3FEDADFF80000000
  %72 = fpext float %71 to double
  %73 = load float, ptr %4, align 4, !tbaa !9
  %74 = fsub float %73, 0x3FEDADFF80000000
  %75 = fpext float %74 to double
  %76 = call double @llvm.fmuladd.f64(double %66, double %69, double 0.000000e+00)
  %77 = call double @sqrt(double noundef %76) #5
  %78 = load float, ptr %6, align 4, !tbaa !9
  %79 = fpext float %78 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 142, ptr noundef @.str.9, double noundef %77, ptr noundef @.str.2, ptr noundef @.str.3, double noundef %79)
  br label %81

80:                                               ; preds = %61
  call void (...) @liquid_autotest_passed()
  br label %81

81:                                               ; preds = %80, %63
  %82 = load float, ptr %5, align 4, !tbaa !9
  %83 = load float, ptr %8, align 4, !tbaa !9
  %84 = fsub float %82, %83
  %85 = fpext float %84 to double
  %86 = load float, ptr %5, align 4, !tbaa !9
  %87 = load float, ptr %8, align 4, !tbaa !9
  %88 = fsub float %86, %87
  %89 = fpext float %88 to double
  %90 = load float, ptr %5, align 4, !tbaa !9
  %91 = load float, ptr %8, align 4, !tbaa !9
  %92 = fsub float %90, %91
  %93 = fpext float %92 to double
  %94 = load float, ptr %5, align 4, !tbaa !9
  %95 = load float, ptr %8, align 4, !tbaa !9
  %96 = fsub float %94, %95
  %97 = fpext float %96 to double
  %98 = call double @llvm.fmuladd.f64(double %85, double %89, double 0.000000e+00)
  %99 = call double @sqrt(double noundef %98) #5
  %100 = load float, ptr %6, align 4, !tbaa !9
  %101 = fpext float %100 to double
  %102 = fcmp ogt double %99, %101
  br i1 %102, label %115, label %103

103:                                              ; preds = %81
  %104 = load float, ptr %5, align 4, !tbaa !9
  %105 = call i1 @llvm.is.fpclass.f32(float %104, i32 3)
  br i1 %105, label %115, label %106

106:                                              ; preds = %103
  %107 = load float, ptr %5, align 4, !tbaa !9
  %108 = call i1 @llvm.is.fpclass.f32(float 0.000000e+00, i32 3)
  br i1 %108, label %115, label %109

109:                                              ; preds = %106
  %110 = load float, ptr %8, align 4, !tbaa !9
  %111 = call i1 @llvm.is.fpclass.f32(float %110, i32 3)
  br i1 %111, label %115, label %112

112:                                              ; preds = %109
  %113 = load float, ptr %8, align 4, !tbaa !9
  %114 = call i1 @llvm.is.fpclass.f32(float 0.000000e+00, i32 3)
  br i1 %114, label %115, label %136

115:                                              ; preds = %112, %109, %106, %103, %81
  %116 = load float, ptr %5, align 4, !tbaa !9
  %117 = load float, ptr %8, align 4, !tbaa !9
  %118 = fsub float %116, %117
  %119 = fpext float %118 to double
  %120 = load float, ptr %5, align 4, !tbaa !9
  %121 = load float, ptr %8, align 4, !tbaa !9
  %122 = fsub float %120, %121
  %123 = fpext float %122 to double
  %124 = load float, ptr %5, align 4, !tbaa !9
  %125 = load float, ptr %8, align 4, !tbaa !9
  %126 = fsub float %124, %125
  %127 = fpext float %126 to double
  %128 = load float, ptr %5, align 4, !tbaa !9
  %129 = load float, ptr %8, align 4, !tbaa !9
  %130 = fsub float %128, %129
  %131 = fpext float %130 to double
  %132 = call double @llvm.fmuladd.f64(double %119, double %123, double 0.000000e+00)
  %133 = call double @sqrt(double noundef %132) #5
  %134 = load float, ptr %6, align 4, !tbaa !9
  %135 = fpext float %134 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 143, ptr noundef @.str.10, double noundef %133, ptr noundef @.str.2, ptr noundef @.str.3, double noundef %135)
  br label %137

136:                                              ; preds = %112
  call void (...) @liquid_autotest_passed()
  br label %137

137:                                              ; preds = %136, %115
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #5
  ret void
}

declare float @randricekf(float noundef, float noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 #3 = { "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 #4 = { 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 #5 = { 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"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"

@.str = external hidden unnamed_addr constant [89 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [18 x i8], align 1

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

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

declare void @liquid_autotest_failed_expr(ptr noundef, i32 noundef, ptr noundef, double noundef, ptr noundef, ptr noundef, double noundef) local_unnamed_addr #1

declare void @liquid_autotest_passed(...) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @autotest_randricekf() local_unnamed_addr #2 {
  br label %1

1:                                                ; preds = %0, %1
  %.055 = phi i64 [ 0, %0 ], [ %5, %1 ]
  %.04754 = phi float [ 0.000000e+00, %0 ], [ %3, %1 ]
  %.04853 = phi float [ 0.000000e+00, %0 ], [ %4, %1 ]
  %2 = tail call float @randricekf(float noundef 2.000000e+00, float noundef 1.000000e+00) #4
  %3 = fadd float %.04754, %2
  %4 = tail call float @llvm.fmuladd.f32(float %2, float %2, float %.04853)
  %5 = add nuw nsw i64 %.055, 1
  %exitcond.not = icmp eq i64 %5, 250000
  br i1 %exitcond.not, label %6, label %1, !llvm.loop !5

6:                                                ; preds = %1
  %7 = fdiv float %3, 2.500000e+05
  %8 = fdiv float %4, 2.500000e+05
  %9 = fadd float %7, 0xBFEDADFF80000000
  %10 = fpext float %9 to double
  %11 = tail call double @llvm.fmuladd.f64(double %10, double %10, double 0.000000e+00)
  %sqrt = tail call double @llvm.sqrt.f64(double %11)
  %12 = fcmp ogt double %sqrt, 0x3FC3333340000000
  %13 = fcmp uno float %7, 0.000000e+00
  %or.cond = select i1 %12, i1 true, i1 %13
  br i1 %or.cond, label %14, label %15

14:                                               ; preds = %6
  tail call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 142, ptr noundef nonnull @.str.9, double noundef %sqrt, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, double noundef 0x3FC3333340000000) #4
  br label %16

15:                                               ; preds = %6
  tail call void (...) @liquid_autotest_passed() #4
  br label %16

16:                                               ; preds = %15, %14
  %17 = fadd float %8, -1.000000e+00
  %18 = fpext float %17 to double
  %19 = tail call double @llvm.fmuladd.f64(double %18, double %18, double 0.000000e+00)
  %sqrt51 = tail call double @llvm.sqrt.f64(double %19)
  %20 = fcmp ogt double %sqrt51, 0x3FC3333340000000
  %21 = fcmp uno float %8, 0.000000e+00
  %or.cond49 = select i1 %20, i1 true, i1 %21
  br i1 %or.cond49, label %22, label %23

22:                                               ; preds = %16
  tail call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 143, ptr noundef nonnull @.str.10, double noundef %sqrt51, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, double noundef 0x3FC3333340000000) #4
  br label %24

23:                                               ; preds = %16
  tail call void (...) @liquid_autotest_passed() #4
  br label %24

24:                                               ; preds = %23, %22
  ret void
}

declare float @randricekf(float noundef, float noundef) local_unnamed_addr #1

; 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 = { "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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: AggressiveInstCombinePass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopRotatePass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass