; LLVM IR from jgaeddert/liquid-dsp :: src/nco/tests (nco_crcf_phase_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"

@liquid_autotest_verbose = external global i32, align 4
@.str = external hidden unnamed_addr constant [72 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [16 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @nco_crcf_phase_test(float noundef %0, float noundef %1, float noundef %2, i32 noundef %3, float noundef %4) #0 {
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca i32, align 4
  %10 = alloca float, align 4
  %11 = alloca ptr, align 8
  %12 = alloca float, align 4
  %13 = alloca float, align 4
  store float %0, ptr %6, align 4, !tbaa !5
  store float %1, ptr %7, align 4, !tbaa !5
  store float %2, ptr %8, align 4, !tbaa !5
  store i32 %3, ptr %9, align 4, !tbaa !9
  store float %4, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %14 = load i32, ptr %9, align 4, !tbaa !9
  %15 = call ptr @nco_crcf_create(i32 noundef %14)
  store ptr %15, ptr %11, align 8, !tbaa !11
  %16 = load ptr, ptr %11, align 8, !tbaa !11
  %17 = load float, ptr %6, align 4, !tbaa !5
  %18 = call i32 @nco_crcf_set_phase(ptr noundef %16, float noundef %17)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %19 = load ptr, ptr %11, align 8, !tbaa !11
  %20 = call float @nco_crcf_cos(ptr noundef %19)
  store float %20, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %21 = load ptr, ptr %11, align 8, !tbaa !11
  %22 = call float @nco_crcf_sin(ptr noundef %21)
  store float %22, ptr %13, align 4, !tbaa !5
  %23 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !9
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %25, label %47

25:                                               ; preds = %5
  %26 = load float, ptr %6, align 4, !tbaa !5
  %27 = fpext float %26 to double
  %28 = load float, ptr %7, align 4, !tbaa !5
  %29 = fpext float %28 to double
  %30 = load float, ptr %12, align 4, !tbaa !5
  %31 = fpext float %30 to double
  %32 = load float, ptr %7, align 4, !tbaa !5
  %33 = load float, ptr %12, align 4, !tbaa !5
  %34 = fsub float %32, %33
  %35 = fpext float %34 to double
  %36 = load float, ptr %6, align 4, !tbaa !5
  %37 = fpext float %36 to double
  %38 = load float, ptr %8, align 4, !tbaa !5
  %39 = fpext float %38 to double
  %40 = load float, ptr %13, align 4, !tbaa !5
  %41 = fpext float %40 to double
  %42 = load float, ptr %8, align 4, !tbaa !5
  %43 = load float, ptr %13, align 4, !tbaa !5
  %44 = fsub float %42, %43
  %45 = fpext float %44 to double
  %46 = call i32 (ptr, ...) @printf(ptr noundef @.str, double noundef %27, double noundef %29, double noundef %31, double noundef %35, double noundef %37, double noundef %39, double noundef %41, double noundef %45)
  br label %47

47:                                               ; preds = %25, %5
  %48 = load float, ptr %12, align 4, !tbaa !5
  %49 = load float, ptr %7, align 4, !tbaa !5
  %50 = fsub float %48, %49
  %51 = fpext float %50 to double
  %52 = load float, ptr %12, align 4, !tbaa !5
  %53 = load float, ptr %7, align 4, !tbaa !5
  %54 = fsub float %52, %53
  %55 = fpext float %54 to double
  %56 = load float, ptr %12, align 4, !tbaa !5
  %57 = load float, ptr %7, align 4, !tbaa !5
  %58 = fsub float %56, %57
  %59 = fpext float %58 to double
  %60 = load float, ptr %12, align 4, !tbaa !5
  %61 = load float, ptr %7, align 4, !tbaa !5
  %62 = fsub float %60, %61
  %63 = fpext float %62 to double
  %64 = call double @llvm.fmuladd.f64(double %51, double %55, double 0.000000e+00)
  %65 = call double @sqrt(double noundef %64) #5
  %66 = load float, ptr %10, align 4, !tbaa !5
  %67 = fpext float %66 to double
  %68 = fcmp ogt double %65, %67
  br i1 %68, label %81, label %69

69:                                               ; preds = %47
  %70 = load float, ptr %12, align 4, !tbaa !5
  %71 = call i1 @llvm.is.fpclass.f32(float %70, i32 3)
  br i1 %71, label %81, label %72

72:                                               ; preds = %69
  %73 = load float, ptr %12, align 4, !tbaa !5
  %74 = call i1 @llvm.is.fpclass.f32(float 0.000000e+00, i32 3)
  br i1 %74, label %81, label %75

75:                                               ; preds = %72
  %76 = load float, ptr %7, align 4, !tbaa !5
  %77 = call i1 @llvm.is.fpclass.f32(float %76, i32 3)
  br i1 %77, label %81, label %78

78:                                               ; preds = %75
  %79 = load float, ptr %7, align 4, !tbaa !5
  %80 = call i1 @llvm.is.fpclass.f32(float 0.000000e+00, i32 3)
  br i1 %80, label %81, label %102

81:                                               ; preds = %78, %75, %72, %69, %47
  %82 = load float, ptr %12, align 4, !tbaa !5
  %83 = load float, ptr %7, align 4, !tbaa !5
  %84 = fsub float %82, %83
  %85 = fpext float %84 to double
  %86 = load float, ptr %12, align 4, !tbaa !5
  %87 = load float, ptr %7, align 4, !tbaa !5
  %88 = fsub float %86, %87
  %89 = fpext float %88 to double
  %90 = load float, ptr %12, align 4, !tbaa !5
  %91 = load float, ptr %7, align 4, !tbaa !5
  %92 = fsub float %90, %91
  %93 = fpext float %92 to double
  %94 = load float, ptr %12, align 4, !tbaa !5
  %95 = load float, ptr %7, align 4, !tbaa !5
  %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 %10, align 4, !tbaa !5
  %101 = fpext float %100 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str.1, i32 noundef 56, ptr noundef @.str.2, double noundef %99, ptr noundef @.str.3, ptr noundef @.str.4, double noundef %101)
  br label %103

102:                                              ; preds = %78
  call void (...) @liquid_autotest_passed()
  br label %103

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

125:                                              ; preds = %103
  %126 = load float, ptr %13, align 4, !tbaa !5
  %127 = call i1 @llvm.is.fpclass.f32(float %126, i32 3)
  br i1 %127, label %137, label %128

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

131:                                              ; preds = %128
  %132 = load float, ptr %8, align 4, !tbaa !5
  %133 = call i1 @llvm.is.fpclass.f32(float %132, i32 3)
  br i1 %133, label %137, label %134

134:                                              ; preds = %131
  %135 = load float, ptr %8, align 4, !tbaa !5
  %136 = call i1 @llvm.is.fpclass.f32(float 0.000000e+00, i32 3)
  br i1 %136, label %137, label %158

137:                                              ; preds = %134, %131, %128, %125, %103
  %138 = load float, ptr %13, align 4, !tbaa !5
  %139 = load float, ptr %8, align 4, !tbaa !5
  %140 = fsub float %138, %139
  %141 = fpext float %140 to double
  %142 = load float, ptr %13, align 4, !tbaa !5
  %143 = load float, ptr %8, align 4, !tbaa !5
  %144 = fsub float %142, %143
  %145 = fpext float %144 to double
  %146 = load float, ptr %13, align 4, !tbaa !5
  %147 = load float, ptr %8, align 4, !tbaa !5
  %148 = fsub float %146, %147
  %149 = fpext float %148 to double
  %150 = load float, ptr %13, align 4, !tbaa !5
  %151 = load float, ptr %8, align 4, !tbaa !5
  %152 = fsub float %150, %151
  %153 = fpext float %152 to double
  %154 = call double @llvm.fmuladd.f64(double %141, double %145, double 0.000000e+00)
  %155 = call double @sqrt(double noundef %154) #5
  %156 = load float, ptr %10, align 4, !tbaa !5
  %157 = fpext float %156 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str.1, i32 noundef 57, ptr noundef @.str.5, double noundef %155, ptr noundef @.str.3, ptr noundef @.str.4, double noundef %157)
  br label %159

158:                                              ; preds = %134
  call void (...) @liquid_autotest_passed()
  br label %159

159:                                              ; preds = %158, %137
  %160 = load ptr, ptr %11, align 8, !tbaa !11
  %161 = call i32 @nco_crcf_destroy(ptr noundef %160)
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  ret void
}

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

declare ptr @nco_crcf_create(i32 noundef) #2

declare i32 @nco_crcf_set_phase(ptr noundef, float noundef) #2

declare float @nco_crcf_cos(ptr noundef) #2

declare float @nco_crcf_sin(ptr noundef) #2

declare i32 @printf(ptr noundef, ...) #2

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i1 @llvm.is.fpclass.f32(float, i32 immarg) #4

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

declare void @liquid_autotest_passed(...) #2

declare i32 @nco_crcf_destroy(ptr noundef) #2

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 "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 = !{!6, !6, i64 0}
!6 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}


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

@liquid_autotest_verbose = external local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [72 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [16 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @nco_crcf_phase_test(float noundef %0, float noundef %1, float noundef %2, i32 noundef %3, float noundef %4) local_unnamed_addr #0 {
  %6 = tail call ptr @nco_crcf_create(i32 noundef %3) #5
  %7 = tail call i32 @nco_crcf_set_phase(ptr noundef %6, float noundef %0) #5
  %8 = tail call float @nco_crcf_cos(ptr noundef %6) #5
  %9 = tail call float @nco_crcf_sin(ptr noundef %6) #5
  %10 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !5
  %.not = icmp eq i32 %10, 0
  br i1 %.not, label %22, label %11

11:                                               ; preds = %5
  %12 = fpext float %0 to double
  %13 = fpext float %1 to double
  %14 = fpext float %8 to double
  %15 = fsub float %1, %8
  %16 = fpext float %15 to double
  %17 = fpext float %2 to double
  %18 = fpext float %9 to double
  %19 = fsub float %2, %9
  %20 = fpext float %19 to double
  %21 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %12, double noundef %13, double noundef %14, double noundef %16, double noundef %12, double noundef %17, double noundef %18, double noundef %20)
  br label %22

22:                                               ; preds = %11, %5
  %23 = fsub float %8, %1
  %24 = fpext float %23 to double
  %25 = tail call double @llvm.fmuladd.f64(double %24, double %24, double 0.000000e+00)
  %sqrt = tail call double @llvm.sqrt.f64(double %25)
  %26 = fpext float %4 to double
  %27 = fcmp ogt double %sqrt, %26
  %28 = fcmp uno float %8, 0.000000e+00
  %or.cond = select i1 %27, i1 true, i1 %28
  %29 = fcmp uno float %1, 0.000000e+00
  %or.cond59 = or i1 %29, %or.cond
  br i1 %or.cond59, label %30, label %31

30:                                               ; preds = %22
  tail call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str.1, i32 noundef 56, ptr noundef nonnull @.str.2, double noundef %sqrt, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4, double noundef %26) #5
  br label %32

31:                                               ; preds = %22
  tail call void (...) @liquid_autotest_passed() #5
  br label %32

32:                                               ; preds = %31, %30
  %33 = fsub float %9, %2
  %34 = fpext float %33 to double
  %35 = tail call double @llvm.fmuladd.f64(double %34, double %34, double 0.000000e+00)
  %sqrt63 = tail call double @llvm.sqrt.f64(double %35)
  %36 = fcmp ogt double %sqrt63, %26
  %37 = fcmp uno float %9, 0.000000e+00
  %or.cond60 = select i1 %36, i1 true, i1 %37
  %38 = fcmp uno float %2, 0.000000e+00
  %or.cond61 = or i1 %38, %or.cond60
  br i1 %or.cond61, label %39, label %40

39:                                               ; preds = %32
  tail call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str.1, i32 noundef 57, ptr noundef nonnull @.str.5, double noundef %sqrt63, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4, double noundef %26) #5
  br label %41

40:                                               ; preds = %32
  tail call void (...) @liquid_autotest_passed() #5
  br label %41

41:                                               ; preds = %40, %39
  %42 = tail call i32 @nco_crcf_destroy(ptr noundef %6) #5
  ret void
}

declare ptr @nco_crcf_create(i32 noundef) local_unnamed_addr #1

declare i32 @nco_crcf_set_phase(ptr noundef, float noundef) local_unnamed_addr #1

declare float @nco_crcf_cos(ptr noundef) local_unnamed_addr #1

declare float @nco_crcf_sin(ptr noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

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

declare i32 @nco_crcf_destroy(ptr noundef) local_unnamed_addr #1

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

attributes #0 = { 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 #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 = { nofree 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: AggressiveInstCombinePass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass