; 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.5 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [17 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_crandnf() #4 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca { float, float }, align 4
  %4 = alloca float, align 4
  %5 = alloca float, align 4
  %6 = 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 8, 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
  store i64 0, ptr %2, align 8, !tbaa !5
  br label %7

7:                                                ; preds = %43, %0
  %8 = load i64, ptr %2, align 8, !tbaa !5
  %9 = load i64, ptr %1, align 8, !tbaa !5
  %10 = icmp ult i64 %8, %9
  br i1 %10, label %11, label %46

11:                                               ; preds = %7
  call void @crandnf(ptr noundef %3)
  %12 = getelementptr inbounds { float, float }, ptr %3, i32 0, i32 0
  %13 = load float, ptr %12, align 4
  %14 = getelementptr inbounds { float, float }, ptr %3, i32 0, i32 1
  %15 = load float, ptr %14, align 4
  %16 = getelementptr inbounds { float, float }, ptr %3, i32 0, i32 0
  %17 = load float, ptr %16, align 4
  %18 = getelementptr inbounds { float, float }, ptr %3, i32 0, i32 1
  %19 = load float, ptr %18, align 4
  %20 = fadd float %13, %19
  %21 = load float, ptr %4, align 4, !tbaa !9
  %22 = fadd float %21, %20
  store float %22, ptr %4, align 4, !tbaa !9
  %23 = getelementptr inbounds { float, float }, ptr %3, i32 0, i32 0
  %24 = load float, ptr %23, align 4
  %25 = getelementptr inbounds { float, float }, ptr %3, i32 0, i32 1
  %26 = load float, ptr %25, align 4
  %27 = getelementptr inbounds { float, float }, ptr %3, i32 0, i32 0
  %28 = load float, ptr %27, align 4
  %29 = getelementptr inbounds { float, float }, ptr %3, i32 0, i32 1
  %30 = load float, ptr %29, align 4
  %31 = getelementptr inbounds { float, float }, ptr %3, i32 0, i32 0
  %32 = load float, ptr %31, align 4
  %33 = getelementptr inbounds { float, float }, ptr %3, i32 0, i32 1
  %34 = load float, ptr %33, align 4
  %35 = getelementptr inbounds { float, float }, ptr %3, i32 0, i32 0
  %36 = load float, ptr %35, align 4
  %37 = getelementptr inbounds { float, float }, ptr %3, i32 0, i32 1
  %38 = load float, ptr %37, align 4
  %39 = fmul float %34, %38
  %40 = call float @llvm.fmuladd.f32(float %24, float %28, float %39)
  %41 = load float, ptr %5, align 4, !tbaa !9
  %42 = fadd float %41, %40
  store float %42, ptr %5, align 4, !tbaa !9
  br label %43

43:                                               ; preds = %11
  %44 = load i64, ptr %2, align 8, !tbaa !5
  %45 = add i64 %44, 1
  store i64 %45, ptr %2, align 8, !tbaa !5
  br label %7, !llvm.loop !11

46:                                               ; preds = %7
  %47 = load i64, ptr %1, align 8, !tbaa !5
  %48 = mul i64 %47, 2
  store i64 %48, ptr %1, align 8, !tbaa !5
  %49 = load i64, ptr %1, align 8, !tbaa !5
  %50 = uitofp i64 %49 to float
  %51 = load float, ptr %4, align 4, !tbaa !9
  %52 = fdiv float %51, %50
  store float %52, ptr %4, align 4, !tbaa !9
  %53 = load float, ptr %5, align 4, !tbaa !9
  %54 = load i64, ptr %1, align 8, !tbaa !5
  %55 = uitofp i64 %54 to float
  %56 = fdiv float %53, %55
  %57 = load float, ptr %4, align 4, !tbaa !9
  %58 = load float, ptr %4, align 4, !tbaa !9
  %59 = fneg float %57
  %60 = call float @llvm.fmuladd.f32(float %59, float %58, float %56)
  store float %60, ptr %5, align 4, !tbaa !9
  %61 = load float, ptr %4, align 4, !tbaa !9
  %62 = fsub float %61, 0.000000e+00
  %63 = fpext float %62 to double
  %64 = load float, ptr %4, align 4, !tbaa !9
  %65 = fsub float %64, 0.000000e+00
  %66 = fpext float %65 to double
  %67 = load float, ptr %4, align 4, !tbaa !9
  %68 = fsub float %67, 0.000000e+00
  %69 = fpext float %68 to double
  %70 = load float, ptr %4, align 4, !tbaa !9
  %71 = fsub float %70, 0.000000e+00
  %72 = fpext float %71 to double
  %73 = call double @llvm.fmuladd.f64(double %63, double %66, double 0.000000e+00)
  %74 = call double @sqrt(double noundef %73) #5
  %75 = load float, ptr %6, align 4, !tbaa !9
  %76 = fpext float %75 to double
  %77 = fcmp ogt double %74, %76
  br i1 %77, label %88, label %78

78:                                               ; preds = %46
  %79 = load float, ptr %4, align 4, !tbaa !9
  %80 = call i1 @llvm.is.fpclass.f32(float %79, i32 3)
  br i1 %80, label %88, label %81

81:                                               ; preds = %78
  %82 = load float, ptr %4, align 4, !tbaa !9
  %83 = call i1 @llvm.is.fpclass.f32(float 0.000000e+00, i32 3)
  br i1 %83, label %88, label %84

84:                                               ; preds = %81
  %85 = call i1 @llvm.is.fpclass.f32(float 0.000000e+00, i32 3)
  br i1 %85, label %88, label %86

86:                                               ; preds = %84
  %87 = call i1 @llvm.is.fpclass.f32(float 0.000000e+00, i32 3)
  br i1 %87, label %88, label %105

88:                                               ; preds = %86, %84, %81, %78, %46
  %89 = load float, ptr %4, align 4, !tbaa !9
  %90 = fsub float %89, 0.000000e+00
  %91 = fpext float %90 to double
  %92 = load float, ptr %4, align 4, !tbaa !9
  %93 = fsub float %92, 0.000000e+00
  %94 = fpext float %93 to double
  %95 = load float, ptr %4, align 4, !tbaa !9
  %96 = fsub float %95, 0.000000e+00
  %97 = fpext float %96 to double
  %98 = load float, ptr %4, align 4, !tbaa !9
  %99 = fsub float %98, 0.000000e+00
  %100 = fpext float %99 to double
  %101 = call double @llvm.fmuladd.f64(double %91, double %94, double 0.000000e+00)
  %102 = call double @sqrt(double noundef %101) #5
  %103 = load float, ptr %6, align 4, !tbaa !9
  %104 = fpext float %103 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 90, ptr noundef @.str.5, double noundef %102, ptr noundef @.str.2, ptr noundef @.str.3, double noundef %104)
  br label %106

105:                                              ; preds = %86
  call void (...) @liquid_autotest_passed()
  br label %106

106:                                              ; preds = %105, %88
  %107 = load float, ptr %5, align 4, !tbaa !9
  %108 = fsub float %107, 1.000000e+00
  %109 = fpext float %108 to double
  %110 = load float, ptr %5, align 4, !tbaa !9
  %111 = fsub float %110, 1.000000e+00
  %112 = fpext float %111 to double
  %113 = load float, ptr %5, align 4, !tbaa !9
  %114 = fsub float %113, 1.000000e+00
  %115 = fpext float %114 to double
  %116 = load float, ptr %5, align 4, !tbaa !9
  %117 = fsub float %116, 1.000000e+00
  %118 = fpext float %117 to double
  %119 = call double @llvm.fmuladd.f64(double %109, double %112, double 0.000000e+00)
  %120 = call double @sqrt(double noundef %119) #5
  %121 = load float, ptr %6, align 4, !tbaa !9
  %122 = fpext float %121 to double
  %123 = fcmp ogt double %120, %122
  br i1 %123, label %134, label %124

124:                                              ; preds = %106
  %125 = load float, ptr %5, align 4, !tbaa !9
  %126 = call i1 @llvm.is.fpclass.f32(float %125, i32 3)
  br i1 %126, label %134, label %127

127:                                              ; preds = %124
  %128 = load float, ptr %5, align 4, !tbaa !9
  %129 = call i1 @llvm.is.fpclass.f32(float 0.000000e+00, i32 3)
  br i1 %129, label %134, label %130

130:                                              ; preds = %127
  %131 = call i1 @llvm.is.fpclass.f32(float 1.000000e+00, i32 3)
  br i1 %131, label %134, label %132

132:                                              ; preds = %130
  %133 = call i1 @llvm.is.fpclass.f32(float 0.000000e+00, i32 3)
  br i1 %133, label %134, label %151

134:                                              ; preds = %132, %130, %127, %124, %106
  %135 = load float, ptr %5, align 4, !tbaa !9
  %136 = fsub float %135, 1.000000e+00
  %137 = fpext float %136 to double
  %138 = load float, ptr %5, align 4, !tbaa !9
  %139 = fsub float %138, 1.000000e+00
  %140 = fpext float %139 to double
  %141 = load float, ptr %5, align 4, !tbaa !9
  %142 = fsub float %141, 1.000000e+00
  %143 = fpext float %142 to double
  %144 = load float, ptr %5, align 4, !tbaa !9
  %145 = fsub float %144, 1.000000e+00
  %146 = fpext float %145 to double
  %147 = call double @llvm.fmuladd.f64(double %137, double %140, double 0.000000e+00)
  %148 = call double @sqrt(double noundef %147) #5
  %149 = load float, ptr %6, align 4, !tbaa !9
  %150 = fpext float %149 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 91, ptr noundef @.str.6, double noundef %148, ptr noundef @.str.2, ptr noundef @.str.3, double noundef %150)
  br label %152

151:                                              ; preds = %132
  call void (...) @liquid_autotest_passed()
  br label %152

152:                                              ; preds = %151, %134
  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 8, 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 void @crandnf(ptr 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.5 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [17 x i8], align 1

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

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

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

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

; Function Attrs: mustprogress 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_crandnf() local_unnamed_addr #3 {
  %1 = alloca { float, float }, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #5
  %2 = getelementptr inbounds i8, ptr %1, i64 4
  br label %3

3:                                                ; preds = %0, %3
  %.043 = phi float [ 0.000000e+00, %0 ], [ %10, %3 ]
  %.03542 = phi float [ 0.000000e+00, %0 ], [ %7, %3 ]
  %.03641 = phi i64 [ 0, %0 ], [ %11, %3 ]
  call void @crandnf(ptr noundef nonnull %1) #5
  %4 = load float, ptr %1, align 4
  %5 = load float, ptr %2, align 4
  %6 = fadd float %4, %5
  %7 = fadd float %.03542, %6
  %8 = fmul float %5, %5
  %9 = call float @llvm.fmuladd.f32(float %4, float %4, float %8)
  %10 = fadd float %.043, %9
  %11 = add nuw nsw i64 %.03641, 1
  %exitcond.not = icmp eq i64 %11, 250000
  br i1 %exitcond.not, label %12, label %3, !llvm.loop !5

12:                                               ; preds = %3
  %13 = fdiv float %7, 5.000000e+05
  %14 = fdiv float %10, 5.000000e+05
  %15 = fneg float %13
  %16 = call float @llvm.fmuladd.f32(float %15, float %13, float %14)
  %17 = fpext float %13 to double
  %18 = call double @llvm.fmuladd.f64(double %17, double %17, double 0.000000e+00)
  %sqrt = call double @llvm.sqrt.f64(double %18)
  %19 = fcmp ogt double %sqrt, 0x3FC3333340000000
  %20 = fcmp uno float %13, 0.000000e+00
  %or.cond = select i1 %19, i1 true, i1 %20
  br i1 %or.cond, label %21, label %22

21:                                               ; preds = %12
  call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 90, ptr noundef nonnull @.str.5, double noundef %sqrt, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, double noundef 0x3FC3333340000000) #5
  br label %23

22:                                               ; preds = %12
  call void (...) @liquid_autotest_passed() #5
  br label %23

23:                                               ; preds = %22, %21
  %24 = fadd float %16, -1.000000e+00
  %25 = fpext float %24 to double
  %26 = call double @llvm.fmuladd.f64(double %25, double %25, double 0.000000e+00)
  %sqrt39 = call double @llvm.sqrt.f64(double %26)
  %27 = fcmp ogt double %sqrt39, 0x3FC3333340000000
  %28 = fcmp uno float %16, 0.000000e+00
  %or.cond37 = select i1 %27, i1 true, i1 %28
  br i1 %or.cond37, label %29, label %30

29:                                               ; preds = %23
  call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 91, ptr noundef nonnull @.str.6, double noundef %sqrt39, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, double noundef 0x3FC3333340000000) #5
  br label %31

30:                                               ; preds = %23
  call void (...) @liquid_autotest_passed() #5
  br label %31

31:                                               ; preds = %30, %29
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  ret void
}

declare void @crandnf(ptr noundef) local_unnamed_addr #2

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { "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 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


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