; LLVM IR from jgaeddert/liquid-dsp :: sandbox (thiran_allpass_iir_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 [37 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1

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

20:                                               ; preds = %40, %0
  %21 = load i32, ptr %7, align 4, !tbaa !5
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = icmp ule i32 %21, %22
  br i1 %23, label %24, label %43

24:                                               ; preds = %20
  %25 = load i32, ptr %7, align 4, !tbaa !5
  %26 = add i32 %25, 1
  %27 = load i32, ptr %7, align 4, !tbaa !5
  %28 = zext i32 %27 to i64
  %29 = getelementptr inbounds float, ptr %17, i64 %28
  %30 = load float, ptr %29, align 4, !tbaa !9
  %31 = fpext float %30 to double
  %32 = load i32, ptr %7, align 4, !tbaa !5
  %33 = add i32 %32, 1
  %34 = load i32, ptr %7, align 4, !tbaa !5
  %35 = zext i32 %34 to i64
  %36 = getelementptr inbounds float, ptr %13, i64 %35
  %37 = load float, ptr %36, align 4, !tbaa !9
  %38 = fpext float %37 to double
  %39 = call i32 (ptr, ...) @printf(ptr noundef @.str, i32 noundef %26, double noundef %31, i32 noundef %33, double noundef %38)
  br label %40

40:                                               ; preds = %24
  %41 = load i32, ptr %7, align 4, !tbaa !5
  %42 = add i32 %41, 1
  store i32 %42, ptr %7, align 4, !tbaa !5
  br label %20, !llvm.loop !11

43:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %44 = load i32, ptr %2, align 4, !tbaa !5
  %45 = add i32 %44, 1
  %46 = load i32, ptr %2, align 4, !tbaa !5
  %47 = add i32 %46, 1
  %48 = call float @iir_group_delay(ptr noundef %13, i32 noundef %45, ptr noundef %17, i32 noundef %47, float noundef 0.000000e+00)
  store float %48, ptr %8, align 4, !tbaa !9
  %49 = load float, ptr %8, align 4, !tbaa !9
  %50 = fpext float %49 to double
  %51 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, double noundef %50)
  %52 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  %53 = load ptr, ptr %4, align 8
  call void @llvm.stackrestore.p0(ptr %53)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  %54 = load i32, ptr %1, align 4
  ret i32 %54
}

; 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: nounwind uwtable
declare dso_local void @compute_thiran_allpass(i32 noundef, float noundef, ptr noundef, ptr noundef) #0

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

declare float @iir_group_delay(ptr noundef, i32 noundef, ptr noundef, i32 noundef, float noundef) #3

; 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

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 = { nocallback nofree nosync nounwind willreturn }
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 }

!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 = 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 [37 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca [5 x float], align 16
  %2 = alloca [5 x float], align 16
  call void @compute_thiran_allpass(i32 noundef 4, float noundef 0x3FB99999A0000000, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %3 = load float, ptr %2, align 16, !tbaa !5
  %4 = fpext float %3 to double
  %5 = load float, ptr %1, align 16, !tbaa !5
  %6 = fpext float %5 to double
  %7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 1, double noundef %4, i32 noundef 1, double noundef %6)
  %8 = getelementptr inbounds i8, ptr %2, i64 4
  %9 = load float, ptr %8, align 4, !tbaa !5
  %10 = fpext float %9 to double
  %11 = getelementptr inbounds i8, ptr %1, i64 4
  %12 = load float, ptr %11, align 4, !tbaa !5
  %13 = fpext float %12 to double
  %14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 2, double noundef %10, i32 noundef 2, double noundef %13)
  %15 = getelementptr inbounds i8, ptr %2, i64 8
  %16 = load float, ptr %15, align 8, !tbaa !5
  %17 = fpext float %16 to double
  %18 = getelementptr inbounds i8, ptr %1, i64 8
  %19 = load float, ptr %18, align 8, !tbaa !5
  %20 = fpext float %19 to double
  %21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 3, double noundef %17, i32 noundef 3, double noundef %20)
  %22 = getelementptr inbounds i8, ptr %2, i64 12
  %23 = load float, ptr %22, align 4, !tbaa !5
  %24 = fpext float %23 to double
  %25 = getelementptr inbounds i8, ptr %1, i64 12
  %26 = load float, ptr %25, align 4, !tbaa !5
  %27 = fpext float %26 to double
  %28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 4, double noundef %24, i32 noundef 4, double noundef %27)
  %29 = getelementptr inbounds i8, ptr %2, i64 16
  %30 = load float, ptr %29, align 16, !tbaa !5
  %31 = fpext float %30 to double
  %32 = getelementptr inbounds i8, ptr %1, i64 16
  %33 = load float, ptr %32, align 16, !tbaa !5
  %34 = fpext float %33 to double
  %35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 5, double noundef %31, i32 noundef 5, double noundef %34)
  %36 = call float @iir_group_delay(ptr noundef nonnull %1, i32 noundef 5, ptr noundef nonnull %2, i32 noundef 5, float noundef 0.000000e+00) #3
  %37 = fpext float %36 to double
  %38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %37)
  %39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  ret i32 0
}

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

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

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

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 = { 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 #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 }

!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"}


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