; LLVM IR from jgaeddert/liquid-dsp :: sandbox (firdes_group_delay_test)

; 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 [50 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [24 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @apply_delay(ptr noundef, ptr noundef, i32 noundef, float noundef) #0

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #3 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca float, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  %13 = alloca float, align 4
  %14 = alloca float, align 4
  %15 = alloca float, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 12, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store float 2.500000e-01, ptr %7, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %16 = load i32, ptr %6, align 4, !tbaa !5
  %17 = mul i32 2, %16
  %18 = add i32 %17, 1
  store i32 %18, ptr %8, align 4, !tbaa !5
  %19 = load i32, ptr %8, align 4, !tbaa !5
  %20 = zext i32 %19 to i64
  %21 = call ptr @llvm.stacksave.p0()
  store ptr %21, ptr %9, align 8
  %22 = alloca float, i64 %20, align 16
  store i64 %20, ptr %10, align 8
  %23 = load i32, ptr %8, align 4, !tbaa !5
  %24 = zext i32 %23 to i64
  %25 = alloca float, i64 %24, align 16
  store i64 %24, ptr %11, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %47, %2
  %27 = load i32, ptr %12, align 4, !tbaa !5
  %28 = load i32, ptr %8, align 4, !tbaa !5
  %29 = icmp ult i32 %27, %28
  br i1 %29, label %30, label %50

30:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %31 = load i32, ptr %12, align 4, !tbaa !5
  %32 = uitofp i32 %31 to float
  %33 = load i32, ptr %6, align 4, !tbaa !5
  %34 = uitofp i32 %33 to float
  %35 = fsub float %32, %34
  store float %35, ptr %13, align 4, !tbaa !11
  %36 = load float, ptr %7, align 4, !tbaa !11
  %37 = load float, ptr %13, align 4, !tbaa !11
  %38 = fmul float %36, %37
  %39 = call float @sincf(float noundef %38)
  %40 = load i32, ptr %12, align 4, !tbaa !5
  %41 = load i32, ptr %8, align 4, !tbaa !5
  %42 = call float @liquid_hamming(i32 noundef %40, i32 noundef %41)
  %43 = fmul float %39, %42
  %44 = load i32, ptr %12, align 4, !tbaa !5
  %45 = zext i32 %44 to i64
  %46 = getelementptr inbounds float, ptr %22, i64 %45
  store float %43, ptr %46, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %47

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

50:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store float -2.000000e+00, ptr %14, align 4, !tbaa !11
  %51 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %52 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  %53 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, ptr noundef @.str.3, ptr noundef @.str.4, ptr noundef @.str.5)
  br label %54

54:                                               ; preds = %57, %50
  %55 = load float, ptr %14, align 4, !tbaa !11
  %56 = fcmp ole float %55, 2.000000e+00
  br i1 %56, label %57, label %76

57:                                               ; preds = %54
  %58 = load i32, ptr %8, align 4, !tbaa !5
  %59 = load float, ptr %14, align 4, !tbaa !11
  call void @apply_delay(ptr noundef %22, ptr noundef %25, i32 noundef %58, float noundef %59)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %60 = load i32, ptr %8, align 4, !tbaa !5
  %61 = call float @fir_group_delay(ptr noundef %25, i32 noundef %60, float noundef 0.000000e+00)
  %62 = load i32, ptr %6, align 4, !tbaa !5
  %63 = uitofp i32 %62 to float
  %64 = fsub float %61, %63
  store float %64, ptr %15, align 4, !tbaa !11
  %65 = load float, ptr %14, align 4, !tbaa !11
  %66 = fpext float %65 to double
  %67 = load float, ptr %15, align 4, !tbaa !11
  %68 = fpext float %67 to double
  %69 = load float, ptr %14, align 4, !tbaa !11
  %70 = load float, ptr %15, align 4, !tbaa !11
  %71 = fsub float %69, %70
  %72 = fpext float %71 to double
  %73 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, double noundef %66, double noundef %68, double noundef %72)
  %74 = load float, ptr %14, align 4, !tbaa !11
  %75 = fadd float %74, 1.250000e-01
  store float %75, ptr %14, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %54, !llvm.loop !15

76:                                               ; preds = %54
  store i32 0, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  %77 = load ptr, ptr %9, align 8
  call void @llvm.stackrestore.p0(ptr %77)
  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
  %78 = load i32, ptr %3, align 4
  ret i32 %78
}

declare float @sincf(float noundef) #4

declare float @liquid_hamming(i32 noundef, i32 noundef) #4

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

declare float @fir_group_delay(ptr noundef, i32 noundef, float noundef) #4

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 = { nocallback nofree nosync nounwind willreturn }
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 = { "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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; 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 [50 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [24 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @apply_delay(ptr noundef, ptr noundef, i32 noundef, float noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #1 {
  %3 = alloca [25 x float], align 16
  %4 = alloca [25 x float], align 16
  br label %5

5:                                                ; preds = %2, %5
  %indvars.iv = phi i64 [ 0, %2 ], [ %indvars.iv.next, %5 ]
  %6 = trunc nuw nsw i64 %indvars.iv to i32
  %7 = uitofp nneg i32 %6 to float
  %8 = fadd float %7, -1.200000e+01
  %9 = fmul float %8, 2.500000e-01
  %10 = tail call float @sincf(float noundef %9) #4
  %11 = tail call float @liquid_hamming(i32 noundef %6, i32 noundef 25) #4
  %12 = fmul float %10, %11
  %13 = getelementptr inbounds float, ptr %3, i64 %indvars.iv
  store float %12, ptr %13, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 25
  br i1 %exitcond.not, label %14, label %5, !llvm.loop !9

14:                                               ; preds = %5
  %15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %16 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  %17 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.5)
  br label %18

18:                                               ; preds = %14, %18
  %.026 = phi float [ -2.000000e+00, %14 ], [ %26, %18 ]
  call void @apply_delay(ptr noundef nonnull %3, ptr noundef nonnull %4, i32 noundef 25, float noundef %.026)
  %19 = call float @fir_group_delay(ptr noundef nonnull %4, i32 noundef 25, float noundef 0.000000e+00) #4
  %20 = fadd float %19, -1.200000e+01
  %21 = fpext float %.026 to double
  %22 = fpext float %20 to double
  %23 = fsub float %.026, %20
  %24 = fpext float %23 to double
  %25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, double noundef %21, double noundef %22, double noundef %24)
  %26 = fadd float %.026, 1.250000e-01
  %27 = fcmp ugt float %26, 2.000000e+00
  br i1 %27, label %28, label %18, !llvm.loop !11

28:                                               ; preds = %18
  ret i32 0
}

declare float @sincf(float noundef) local_unnamed_addr #2

declare float @liquid_hamming(i32 noundef, i32 noundef) local_unnamed_addr #2

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

declare float @fir_group_delay(ptr noundef, i32 noundef, float noundef) local_unnamed_addr #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 = { 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 #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 = { 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 #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 = !{!6, !6, i64 0}
!6 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass