; 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.7 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [19 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_randexpf() #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
  %9 = 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 0x4002666660000000, ptr %7, align 4, !tbaa !9
  store i64 0, ptr %2, align 8, !tbaa !5
  br label %10

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

14:                                               ; preds = %10
  %15 = load float, ptr %7, align 4, !tbaa !9
  %16 = call float @randexpf(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 = %14
  %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 %10, !llvm.loop !11

27:                                               ; preds = %10
  %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
  %36 = load float, ptr %4, align 4, !tbaa !9
  %37 = load float, ptr %4, align 4, !tbaa !9
  %38 = fneg float %36
  %39 = call float @llvm.fmuladd.f32(float %38, float %37, float %35)
  store float %39, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %40 = load float, ptr %7, align 4, !tbaa !9
  %41 = fpext float %40 to double
  %42 = fdiv double 1.000000e+00, %41
  %43 = fptrunc double %42 to float
  store float %43, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %44 = load float, ptr %7, align 4, !tbaa !9
  %45 = load float, ptr %7, align 4, !tbaa !9
  %46 = fmul float %44, %45
  %47 = fpext float %46 to double
  %48 = fdiv double 1.000000e+00, %47
  %49 = fptrunc double %48 to float
  store float %49, ptr %9, align 4, !tbaa !9
  %50 = load float, ptr %4, align 4, !tbaa !9
  %51 = load float, ptr %8, align 4, !tbaa !9
  %52 = fsub float %50, %51
  %53 = fpext float %52 to double
  %54 = load float, ptr %4, align 4, !tbaa !9
  %55 = load float, ptr %8, align 4, !tbaa !9
  %56 = fsub float %54, %55
  %57 = fpext float %56 to double
  %58 = load float, ptr %4, align 4, !tbaa !9
  %59 = load float, ptr %8, align 4, !tbaa !9
  %60 = fsub float %58, %59
  %61 = fpext float %60 to double
  %62 = load float, ptr %4, align 4, !tbaa !9
  %63 = load float, ptr %8, align 4, !tbaa !9
  %64 = fsub float %62, %63
  %65 = fpext float %64 to double
  %66 = call double @llvm.fmuladd.f64(double %53, double %57, double 0.000000e+00)
  %67 = call double @sqrt(double noundef %66) #5
  %68 = load float, ptr %6, align 4, !tbaa !9
  %69 = fpext float %68 to double
  %70 = fcmp ogt double %67, %69
  br i1 %70, label %83, label %71

71:                                               ; preds = %27
  %72 = load float, ptr %4, align 4, !tbaa !9
  %73 = call i1 @llvm.is.fpclass.f32(float %72, i32 3)
  br i1 %73, label %83, label %74

74:                                               ; preds = %71
  %75 = load float, ptr %4, align 4, !tbaa !9
  %76 = call i1 @llvm.is.fpclass.f32(float 0.000000e+00, i32 3)
  br i1 %76, label %83, label %77

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

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

83:                                               ; preds = %80, %77, %74, %71, %27
  %84 = load float, ptr %4, align 4, !tbaa !9
  %85 = load float, ptr %8, align 4, !tbaa !9
  %86 = fsub float %84, %85
  %87 = fpext float %86 to double
  %88 = load float, ptr %4, align 4, !tbaa !9
  %89 = load float, ptr %8, align 4, !tbaa !9
  %90 = fsub float %88, %89
  %91 = fpext float %90 to double
  %92 = load float, ptr %4, align 4, !tbaa !9
  %93 = load float, ptr %8, align 4, !tbaa !9
  %94 = fsub float %92, %93
  %95 = fpext float %94 to double
  %96 = load float, ptr %4, align 4, !tbaa !9
  %97 = load float, ptr %8, align 4, !tbaa !9
  %98 = fsub float %96, %97
  %99 = fpext float %98 to double
  %100 = call double @llvm.fmuladd.f64(double %87, double %91, double 0.000000e+00)
  %101 = call double @sqrt(double noundef %100) #5
  %102 = load float, ptr %6, align 4, !tbaa !9
  %103 = fpext float %102 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 170, ptr noundef @.str.7, double noundef %101, ptr noundef @.str.2, ptr noundef @.str.3, double noundef %103)
  br label %105

104:                                              ; preds = %80
  call void (...) @liquid_autotest_passed()
  br label %105

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

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

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

133:                                              ; preds = %130
  %134 = load float, ptr %9, align 4, !tbaa !9
  %135 = call i1 @llvm.is.fpclass.f32(float %134, i32 3)
  br i1 %135, label %139, label %136

136:                                              ; preds = %133
  %137 = load float, ptr %9, align 4, !tbaa !9
  %138 = call i1 @llvm.is.fpclass.f32(float 0.000000e+00, i32 3)
  br i1 %138, label %139, label %160

139:                                              ; preds = %136, %133, %130, %127, %105
  %140 = load float, ptr %5, align 4, !tbaa !9
  %141 = load float, ptr %9, align 4, !tbaa !9
  %142 = fsub float %140, %141
  %143 = fpext float %142 to double
  %144 = load float, ptr %5, align 4, !tbaa !9
  %145 = load float, ptr %9, align 4, !tbaa !9
  %146 = fsub float %144, %145
  %147 = fpext float %146 to double
  %148 = load float, ptr %5, align 4, !tbaa !9
  %149 = load float, ptr %9, align 4, !tbaa !9
  %150 = fsub float %148, %149
  %151 = fpext float %150 to double
  %152 = load float, ptr %5, align 4, !tbaa !9
  %153 = load float, ptr %9, align 4, !tbaa !9
  %154 = fsub float %152, %153
  %155 = fpext float %154 to double
  %156 = call double @llvm.fmuladd.f64(double %143, double %147, double 0.000000e+00)
  %157 = call double @sqrt(double noundef %156) #5
  %158 = load float, ptr %6, align 4, !tbaa !9
  %159 = fpext float %158 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 171, ptr noundef @.str.8, double noundef %157, ptr noundef @.str.2, ptr noundef @.str.3, double noundef %159)
  br label %161

160:                                              ; preds = %136
  call void (...) @liquid_autotest_passed()
  br label %161

161:                                              ; preds = %160, %139
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  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 @randexpf(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.7 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [19 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_randexpf() local_unnamed_addr #2 {
  br label %1

1:                                                ; preds = %0, %1
  %.069 = phi i64 [ 0, %0 ], [ %5, %1 ]
  %.06168 = phi float [ 0.000000e+00, %0 ], [ %3, %1 ]
  %.06267 = phi float [ 0.000000e+00, %0 ], [ %4, %1 ]
  %2 = tail call float @randexpf(float noundef 0x4002666660000000) #4
  %3 = fadd float %.06168, %2
  %4 = tail call float @llvm.fmuladd.f32(float %2, float %2, float %.06267)
  %5 = add nuw nsw i64 %.069, 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 = fneg float %7
  %10 = tail call float @llvm.fmuladd.f32(float %9, float %7, float %8)
  %11 = fadd float %7, 0xBFDBD37A80000000
  %12 = fpext float %11 to double
  %13 = tail call double @llvm.fmuladd.f64(double %12, double %12, double 0.000000e+00)
  %sqrt = tail call double @llvm.sqrt.f64(double %13)
  %14 = fcmp ogt double %sqrt, 0x3FC3333340000000
  %15 = fcmp uno float %7, 0.000000e+00
  %or.cond = select i1 %14, i1 true, i1 %15
  br i1 %or.cond, label %16, label %17

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

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

18:                                               ; preds = %17, %16
  %19 = fadd float %10, 0xBFC8325440000000
  %20 = fpext float %19 to double
  %21 = tail call double @llvm.fmuladd.f64(double %20, double %20, double 0.000000e+00)
  %sqrt65 = tail call double @llvm.sqrt.f64(double %21)
  %22 = fcmp ogt double %sqrt65, 0x3FC3333340000000
  %23 = fcmp uno float %10, 0.000000e+00
  %or.cond63 = select i1 %22, i1 true, i1 %23
  br i1 %or.cond63, label %24, label %25

24:                                               ; preds = %18
  tail call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 171, ptr noundef nonnull @.str.8, double noundef %sqrt65, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, double noundef 0x3FC3333340000000) #4
  br label %26

25:                                               ; preds = %18
  tail call void (...) @liquid_autotest_passed() #4
  br label %26

26:                                               ; preds = %25, %24
  ret void
}

declare float @randexpf(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