; LLVM IR from jgaeddert/liquid-dsp :: src/filter/src (firdespm)

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

%struct.firdespm_s = type { i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, double, ptr, i32, ptr, ptr }

@.str.11 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [3 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 willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @firdespm_print(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  %4 = call i32 (ptr, ...) @printf(ptr noundef @.str.11)
  %5 = call i32 (ptr, ...) @printf(ptr noundef @.str.12)
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %6

6:                                                ; preds = %23, %1
  %7 = load i32, ptr %3, align 4, !tbaa !9
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.firdespm_s, ptr %8, i32 0, i32 4
  %10 = load i32, ptr %9, align 8, !tbaa !11
  %11 = icmp ult i32 %7, %10
  br i1 %11, label %12, label %26

12:                                               ; preds = %6
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.firdespm_s, ptr %13, i32 0, i32 8
  %15 = load ptr, ptr %14, align 8, !tbaa !14
  %16 = load i32, ptr %3, align 4, !tbaa !9
  %17 = mul i32 2, %16
  %18 = add i32 %17, 0
  %19 = zext i32 %18 to i64
  %20 = getelementptr inbounds double, ptr %15, i64 %19
  %21 = load double, ptr %20, align 8, !tbaa !15
  %22 = call i32 (ptr, ...) @printf(ptr noundef @.str.13, double noundef %21)
  br label %23

23:                                               ; preds = %12
  %24 = load i32, ptr %3, align 4, !tbaa !9
  %25 = add i32 %24, 1
  store i32 %25, ptr %3, align 4, !tbaa !9
  br label %6, !llvm.loop !16

26:                                               ; preds = %6
  %27 = call i32 (ptr, ...) @printf(ptr noundef @.str.14)
  %28 = call i32 (ptr, ...) @printf(ptr noundef @.str.15)
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %29

29:                                               ; preds = %46, %26
  %30 = load i32, ptr %3, align 4, !tbaa !9
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.firdespm_s, ptr %31, i32 0, i32 4
  %33 = load i32, ptr %32, align 8, !tbaa !11
  %34 = icmp ult i32 %30, %33
  br i1 %34, label %35, label %49

35:                                               ; preds = %29
  %36 = load ptr, ptr %2, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.firdespm_s, ptr %36, i32 0, i32 8
  %38 = load ptr, ptr %37, align 8, !tbaa !14
  %39 = load i32, ptr %3, align 4, !tbaa !9
  %40 = mul i32 2, %39
  %41 = add i32 %40, 1
  %42 = zext i32 %41 to i64
  %43 = getelementptr inbounds double, ptr %38, i64 %42
  %44 = load double, ptr %43, align 8, !tbaa !15
  %45 = call i32 (ptr, ...) @printf(ptr noundef @.str.13, double noundef %44)
  br label %46

46:                                               ; preds = %35
  %47 = load i32, ptr %3, align 4, !tbaa !9
  %48 = add i32 %47, 1
  store i32 %48, ptr %3, align 4, !tbaa !9
  br label %29, !llvm.loop !18

49:                                               ; preds = %29
  %50 = call i32 (ptr, ...) @printf(ptr noundef @.str.14)
  %51 = call i32 (ptr, ...) @printf(ptr noundef @.str.16)
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %52

52:                                               ; preds = %67, %49
  %53 = load i32, ptr %3, align 4, !tbaa !9
  %54 = load ptr, ptr %2, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.firdespm_s, ptr %54, i32 0, i32 4
  %56 = load i32, ptr %55, align 8, !tbaa !11
  %57 = icmp ult i32 %53, %56
  br i1 %57, label %58, label %70

58:                                               ; preds = %52
  %59 = load ptr, ptr %2, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.firdespm_s, ptr %59, i32 0, i32 9
  %61 = load ptr, ptr %60, align 8, !tbaa !19
  %62 = load i32, ptr %3, align 4, !tbaa !9
  %63 = zext i32 %62 to i64
  %64 = getelementptr inbounds double, ptr %61, i64 %63
  %65 = load double, ptr %64, align 8, !tbaa !15
  %66 = call i32 (ptr, ...) @printf(ptr noundef @.str.13, double noundef %65)
  br label %67

67:                                               ; preds = %58
  %68 = load i32, ptr %3, align 4, !tbaa !9
  %69 = add i32 %68, 1
  store i32 %69, ptr %3, align 4, !tbaa !9
  br label %52, !llvm.loop !20

70:                                               ; preds = %52
  %71 = call i32 (ptr, ...) @printf(ptr noundef @.str.14)
  %72 = call i32 (ptr, ...) @printf(ptr noundef @.str.17)
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %73

73:                                               ; preds = %88, %70
  %74 = load i32, ptr %3, align 4, !tbaa !9
  %75 = load ptr, ptr %2, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.firdespm_s, ptr %75, i32 0, i32 4
  %77 = load i32, ptr %76, align 8, !tbaa !11
  %78 = icmp ult i32 %74, %77
  br i1 %78, label %79, label %91

79:                                               ; preds = %73
  %80 = load ptr, ptr %2, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.firdespm_s, ptr %80, i32 0, i32 10
  %82 = load ptr, ptr %81, align 8, !tbaa !21
  %83 = load i32, ptr %3, align 4, !tbaa !9
  %84 = zext i32 %83 to i64
  %85 = getelementptr inbounds double, ptr %82, i64 %84
  %86 = load double, ptr %85, align 8, !tbaa !15
  %87 = call i32 (ptr, ...) @printf(ptr noundef @.str.13, double noundef %86)
  br label %88

88:                                               ; preds = %79
  %89 = load i32, ptr %3, align 4, !tbaa !9
  %90 = add i32 %89, 1
  store i32 %90, ptr %3, align 4, !tbaa !9
  br label %73, !llvm.loop !22

91:                                               ; preds = %73
  %92 = call i32 (ptr, ...) @printf(ptr noundef @.str.14)
  %93 = call i32 (ptr, ...) @printf(ptr noundef @.str.18)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret i32 0
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = !{!"any pointer", !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, !10, i64 16}
!12 = !{!"firdespm_s", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !13, i64 120, !6, i64 128, !10, i64 136, !6, i64 144, !6, i64 152}
!13 = !{!"double", !7, i64 0}
!14 = !{!12, !6, i64 32}
!15 = !{!13, !13, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}
!19 = !{!12, !6, i64 40}
!20 = distinct !{!20, !17}
!21 = !{!12, !6, i64 48}
!22 = distinct !{!22, !17}


; 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.11 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: nofree nounwind uwtable
define dso_local noundef i32 @firdespm_print(ptr nocapture noundef readonly %0) local_unnamed_addr #0 {
  %2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11)
  %3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12)
  %4 = getelementptr inbounds i8, ptr %0, i64 16
  %5 = load i32, ptr %4, align 8, !tbaa !5
  %.not = icmp eq i32 %5, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %1
  %6 = getelementptr inbounds i8, ptr %0, i64 32
  br label %7

7:                                                ; preds = %.lr.ph, %7
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %7 ]
  %8 = load ptr, ptr %6, align 8, !tbaa !12
  %9 = shl nuw nsw i64 %indvars.iv, 1
  %10 = and i64 %9, 4294967294
  %11 = getelementptr inbounds double, ptr %8, i64 %10
  %12 = load double, ptr %11, align 8, !tbaa !13
  %13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13, double noundef %12)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %14 = load i32, ptr %4, align 8, !tbaa !5
  %15 = zext i32 %14 to i64
  %16 = icmp ult i64 %indvars.iv.next, %15
  br i1 %16, label %7, label %._crit_edge, !llvm.loop !14

._crit_edge:                                      ; preds = %7, %1
  %17 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14)
  %18 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15)
  %19 = load i32, ptr %4, align 8, !tbaa !5
  %.not32 = icmp eq i32 %19, 0
  br i1 %.not32, label %._crit_edge23, label %.lr.ph22

.lr.ph22:                                         ; preds = %._crit_edge
  %20 = getelementptr inbounds i8, ptr %0, i64 32
  br label %21

21:                                               ; preds = %.lr.ph22, %21
  %indvars.iv36 = phi i64 [ 0, %.lr.ph22 ], [ %indvars.iv.next37, %21 ]
  %22 = load ptr, ptr %20, align 8, !tbaa !12
  %23 = shl nuw nsw i64 %indvars.iv36, 1
  %24 = and i64 %23, 4294967294
  %25 = or disjoint i64 %24, 1
  %26 = getelementptr inbounds double, ptr %22, i64 %25
  %27 = load double, ptr %26, align 8, !tbaa !13
  %28 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13, double noundef %27)
  %indvars.iv.next37 = add nuw nsw i64 %indvars.iv36, 1
  %29 = load i32, ptr %4, align 8, !tbaa !5
  %30 = zext i32 %29 to i64
  %31 = icmp ult i64 %indvars.iv.next37, %30
  br i1 %31, label %21, label %._crit_edge23, !llvm.loop !16

._crit_edge23:                                    ; preds = %21, %._crit_edge
  %32 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14)
  %33 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.16)
  %34 = load i32, ptr %4, align 8, !tbaa !5
  %.not33 = icmp eq i32 %34, 0
  br i1 %.not33, label %._crit_edge27, label %.lr.ph26

.lr.ph26:                                         ; preds = %._crit_edge23
  %35 = getelementptr inbounds i8, ptr %0, i64 40
  br label %36

36:                                               ; preds = %.lr.ph26, %36
  %indvars.iv39 = phi i64 [ 0, %.lr.ph26 ], [ %indvars.iv.next40, %36 ]
  %37 = load ptr, ptr %35, align 8, !tbaa !17
  %38 = getelementptr inbounds double, ptr %37, i64 %indvars.iv39
  %39 = load double, ptr %38, align 8, !tbaa !13
  %40 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13, double noundef %39)
  %indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
  %41 = load i32, ptr %4, align 8, !tbaa !5
  %42 = zext i32 %41 to i64
  %43 = icmp ult i64 %indvars.iv.next40, %42
  br i1 %43, label %36, label %._crit_edge27, !llvm.loop !18

._crit_edge27:                                    ; preds = %36, %._crit_edge23
  %44 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14)
  %45 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.17)
  %46 = load i32, ptr %4, align 8, !tbaa !5
  %.not34 = icmp eq i32 %46, 0
  br i1 %.not34, label %._crit_edge31, label %.lr.ph30

.lr.ph30:                                         ; preds = %._crit_edge27
  %47 = getelementptr inbounds i8, ptr %0, i64 48
  br label %48

48:                                               ; preds = %.lr.ph30, %48
  %indvars.iv42 = phi i64 [ 0, %.lr.ph30 ], [ %indvars.iv.next43, %48 ]
  %49 = load ptr, ptr %47, align 8, !tbaa !19
  %50 = getelementptr inbounds double, ptr %49, i64 %indvars.iv42
  %51 = load double, ptr %50, align 8, !tbaa !13
  %52 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13, double noundef %51)
  %indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
  %53 = load i32, ptr %4, align 8, !tbaa !5
  %54 = zext i32 %53 to i64
  %55 = icmp ult i64 %indvars.iv.next43, %54
  br i1 %55, label %48, label %._crit_edge31, !llvm.loop !20

._crit_edge31:                                    ; preds = %48, %._crit_edge27
  %56 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14)
  %57 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18)
  ret i32 0
}

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

attributes #0 = { nofree 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" }

!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, !7, i64 16}
!6 = !{!"firdespm_s", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !11, i64 120, !10, i64 128, !7, i64 136, !10, i64 144, !10, i64 152}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = !{!6, !10, i64 32}
!13 = !{!11, !11, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = !{!6, !10, i64 40}
!18 = distinct !{!18, !15}
!19 = !{!6, !10, i64 48}
!20 = distinct !{!20, !15}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass