; LLVM IR from jgaeddert/liquid-dsp :: src/framing/tests (symstreamcf_delay_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 [54 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [101 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @testbench_symstreamcf_delay(i32 noundef %0, i32 noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca float, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca float, align 4
  %11 = alloca i32, align 4
  %12 = alloca { float, float }, align 4
  %13 = alloca { float, float }, align 4
  %14 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 7, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store float 0x3FD3333340000000, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 40, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %15 = load i32, ptr %5, align 4, !tbaa !5
  %16 = load i32, ptr %3, align 4, !tbaa !5
  %17 = load i32, ptr %4, align 4, !tbaa !5
  %18 = load float, ptr %6, align 4, !tbaa !9
  %19 = load i32, ptr %7, align 4, !tbaa !5
  %20 = call ptr @symstreamcf_create_linear(i32 noundef %15, i32 noundef %16, i32 noundef %17, float noundef %18, i32 noundef %19)
  store ptr %20, ptr %8, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %21 = load ptr, ptr %8, align 8, !tbaa !11
  %22 = call i32 @symstreamcf_get_delay(ptr noundef %21)
  store i32 %22, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %23 = load i32, ptr %3, align 4, !tbaa !5
  %24 = uitofp i32 %23 to float
  %25 = fadd float 2.000000e+00, %24
  store float %25, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %48, %2
  %27 = load i32, ptr %11, align 4, !tbaa !5
  %28 = load i32, ptr %9, align 4, !tbaa !5
  %29 = add i32 1000, %28
  %30 = icmp ult i32 %27, %29
  br i1 %30, label %31, label %51

31:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %32 = load ptr, ptr %8, align 8, !tbaa !11
  %33 = call i32 @symstreamcf_write_samples(ptr noundef %32, ptr noundef %12, i32 noundef 1)
  %34 = getelementptr inbounds { float, float }, ptr %12, i32 0, i32 0
  %35 = load float, ptr %34, align 4
  %36 = getelementptr inbounds { float, float }, ptr %12, i32 0, i32 1
  %37 = load float, ptr %36, align 4
  %38 = getelementptr inbounds { float, float }, ptr %13, i32 0, i32 0
  %39 = getelementptr inbounds { float, float }, ptr %13, i32 0, i32 1
  store float %35, ptr %38, align 4
  store float %37, ptr %39, align 4
  %40 = load <2 x float>, ptr %13, align 4
  %41 = call float @cabsf(<2 x float> noundef %40) #5
  %42 = fcmp ogt float %41, 0x3FECCCCCC0000000
  br i1 %42, label %43, label %44

43:                                               ; preds = %31
  store i32 2, ptr %14, align 4
  br label %45

44:                                               ; preds = %31
  store i32 0, ptr %14, align 4
  br label %45

45:                                               ; preds = %44, %43
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  %46 = load i32, ptr %14, align 4
  switch i32 %46, label %139 [
    i32 0, label %47
    i32 2, label %51
  ]

47:                                               ; preds = %45
  br label %48

48:                                               ; preds = %47
  %49 = load i32, ptr %11, align 4, !tbaa !5
  %50 = add i32 %49, 1
  store i32 %50, ptr %11, align 4, !tbaa !5
  br label %26, !llvm.loop !13

51:                                               ; preds = %45, %26
  %52 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !5
  %53 = icmp ne i32 %52, 0
  br i1 %53, label %54, label %60

54:                                               ; preds = %51
  %55 = load i32, ptr %9, align 4, !tbaa !5
  %56 = load i32, ptr %11, align 4, !tbaa !5
  %57 = load float, ptr %10, align 4, !tbaa !9
  %58 = fpext float %57 to double
  %59 = call i32 (ptr, ...) @printf(ptr noundef @.str, i32 noundef %55, i32 noundef %56, double noundef %58)
  br label %60

60:                                               ; preds = %54, %51
  %61 = load i32, ptr %9, align 4, !tbaa !5
  %62 = uitofp i32 %61 to float
  %63 = load i32, ptr %11, align 4, !tbaa !5
  %64 = uitofp i32 %63 to float
  %65 = fsub float %62, %64
  %66 = fpext float %65 to double
  %67 = load i32, ptr %9, align 4, !tbaa !5
  %68 = uitofp i32 %67 to float
  %69 = load i32, ptr %11, align 4, !tbaa !5
  %70 = uitofp i32 %69 to float
  %71 = fsub float %68, %70
  %72 = fpext float %71 to double
  %73 = load i32, ptr %9, align 4, !tbaa !5
  %74 = uitofp i32 %73 to float
  %75 = load i32, ptr %11, align 4, !tbaa !5
  %76 = uitofp i32 %75 to float
  %77 = fsub float %74, %76
  %78 = fpext float %77 to double
  %79 = load i32, ptr %9, align 4, !tbaa !5
  %80 = uitofp i32 %79 to float
  %81 = load i32, ptr %11, align 4, !tbaa !5
  %82 = uitofp i32 %81 to float
  %83 = fsub float %80, %82
  %84 = fpext float %83 to double
  %85 = call double @llvm.fmuladd.f64(double %66, double %72, double 0.000000e+00)
  %86 = call double @sqrt(double noundef %85) #5
  %87 = load float, ptr %10, align 4, !tbaa !9
  %88 = fpext float %87 to double
  %89 = fcmp ogt double %86, %88
  br i1 %89, label %106, label %90

90:                                               ; preds = %60
  %91 = load i32, ptr %9, align 4, !tbaa !5
  %92 = uitofp i32 %91 to float
  %93 = call i1 @llvm.is.fpclass.f32(float %92, i32 3)
  br i1 %93, label %106, label %94

94:                                               ; preds = %90
  %95 = load i32, ptr %9, align 4, !tbaa !5
  %96 = uitofp i32 %95 to float
  %97 = call i1 @llvm.is.fpclass.f32(float 0.000000e+00, i32 3)
  br i1 %97, label %106, label %98

98:                                               ; preds = %94
  %99 = load i32, ptr %11, align 4, !tbaa !5
  %100 = uitofp i32 %99 to float
  %101 = call i1 @llvm.is.fpclass.f32(float %100, i32 3)
  br i1 %101, label %106, label %102

102:                                              ; preds = %98
  %103 = load i32, ptr %11, align 4, !tbaa !5
  %104 = uitofp i32 %103 to float
  %105 = call i1 @llvm.is.fpclass.f32(float 0.000000e+00, i32 3)
  br i1 %105, label %106, label %135

106:                                              ; preds = %102, %98, %94, %90, %60
  %107 = load i32, ptr %9, align 4, !tbaa !5
  %108 = uitofp i32 %107 to float
  %109 = load i32, ptr %11, align 4, !tbaa !5
  %110 = uitofp i32 %109 to float
  %111 = fsub float %108, %110
  %112 = fpext float %111 to double
  %113 = load i32, ptr %9, align 4, !tbaa !5
  %114 = uitofp i32 %113 to float
  %115 = load i32, ptr %11, align 4, !tbaa !5
  %116 = uitofp i32 %115 to float
  %117 = fsub float %114, %116
  %118 = fpext float %117 to double
  %119 = load i32, ptr %9, align 4, !tbaa !5
  %120 = uitofp i32 %119 to float
  %121 = load i32, ptr %11, align 4, !tbaa !5
  %122 = uitofp i32 %121 to float
  %123 = fsub float %120, %122
  %124 = fpext float %123 to double
  %125 = load i32, ptr %9, align 4, !tbaa !5
  %126 = uitofp i32 %125 to float
  %127 = load i32, ptr %11, align 4, !tbaa !5
  %128 = uitofp i32 %127 to float
  %129 = fsub float %126, %128
  %130 = fpext float %129 to double
  %131 = call double @llvm.fmuladd.f64(double %112, double %118, double 0.000000e+00)
  %132 = call double @sqrt(double noundef %131) #5
  %133 = load float, ptr %10, align 4, !tbaa !9
  %134 = fpext float %133 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str.1, i32 noundef 55, ptr noundef @.str.2, double noundef %132, ptr noundef @.str.3, ptr noundef @.str.4, double noundef %134)
  br label %136

135:                                              ; preds = %102
  call void (...) @liquid_autotest_passed()
  br label %136

136:                                              ; preds = %135, %106
  %137 = load ptr, ptr %8, align 8, !tbaa !11
  %138 = call i32 @symstreamcf_destroy(ptr noundef %137)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, 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
  ret void

139:                                              ; preds = %45
  unreachable
}

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

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

declare i32 @symstreamcf_get_delay(ptr noundef) #2

declare i32 @symstreamcf_write_samples(ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: nounwind
declare float @cabsf(<2 x float> noundef) #3

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

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 @symstreamcf_destroy(ptr noundef) #2

attributes #0 = { nounwind uwtable "min-legal-vector-width"="64" "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 = !{!"int", !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 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !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"

@liquid_autotest_verbose = external local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [54 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [101 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @testbench_symstreamcf_delay(i32 noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = alloca { float, float }, align 8
  %4 = tail call ptr @symstreamcf_create_linear(i32 noundef 7, i32 noundef %0, i32 noundef %1, float noundef 0x3FD3333340000000, i32 noundef 40) #7
  %5 = tail call i32 @symstreamcf_get_delay(ptr noundef %4) #7
  %6 = uitofp i32 %0 to float
  %7 = fadd float %6, 2.000000e+00
  %8 = add i32 %5, 1000
  %.not43 = icmp eq i32 %8, 0
  br i1 %.not43, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2, %13
  %.03840 = phi i32 [ %14, %13 ], [ 0, %2 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  %9 = call i32 @symstreamcf_write_samples(ptr noundef %4, ptr noundef nonnull %3, i32 noundef 1) #7
  %10 = load <2 x float>, ptr %3, align 8
  %11 = call float @cabsf(<2 x float> noundef %10) #7
  %12 = fcmp ogt float %11, 0x3FECCCCCC0000000
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  br i1 %12, label %._crit_edge, label %13

13:                                               ; preds = %.lr.ph
  %14 = add nuw i32 %.03840, 1
  %exitcond.not = icmp eq i32 %14, %8
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !5

._crit_edge:                                      ; preds = %13, %.lr.ph, %2
  %.038.lcssa = phi i32 [ 0, %2 ], [ %.03840, %.lr.ph ], [ %8, %13 ]
  %15 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !7
  %.not = icmp eq i32 %15, 0
  %.pre = fpext float %7 to double
  br i1 %.not, label %._crit_edge._crit_edge, label %16

16:                                               ; preds = %._crit_edge
  %17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5, i32 noundef %.038.lcssa, double noundef %.pre)
  br label %._crit_edge._crit_edge

._crit_edge._crit_edge:                           ; preds = %._crit_edge, %16
  %18 = uitofp i32 %5 to float
  %19 = uitofp i32 %.038.lcssa to float
  %20 = fsub float %18, %19
  %21 = fpext float %20 to double
  %22 = call double @llvm.fmuladd.f64(double %21, double %21, double 0.000000e+00)
  %sqrt = call double @llvm.sqrt.f64(double %22)
  %23 = fcmp ogt double %sqrt, %.pre
  br i1 %23, label %24, label %25

24:                                               ; preds = %._crit_edge._crit_edge
  call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str.1, i32 noundef 55, ptr noundef nonnull @.str.2, double noundef %sqrt, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4, double noundef %.pre) #7
  br label %26

25:                                               ; preds = %._crit_edge._crit_edge
  call void (...) @liquid_autotest_passed() #7
  br label %26

26:                                               ; preds = %25, %24
  %27 = call i32 @symstreamcf_destroy(ptr noundef %4) #7
  ret void
}

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

declare ptr @symstreamcf_create_linear(i32 noundef, i32 noundef, i32 noundef, float noundef, i32 noundef) local_unnamed_addr #2

declare i32 @symstreamcf_get_delay(ptr noundef) local_unnamed_addr #2

declare i32 @symstreamcf_write_samples(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind
declare float @cabsf(<2 x float> noundef) local_unnamed_addr #3

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

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

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

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

declare i32 @symstreamcf_destroy(ptr noundef) local_unnamed_addr #2

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

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


; Effective O3 passes: AggressiveInstCombinePass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass