; LLVM IR from jgaeddert/liquid-dsp :: sandbox (iirdes_gradsearch_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"

%struct.gs_s = type { i32, i32, i32, i32, i32, ptr, ptr, float, float, float, ptr, ptr, i32, ptr, float, float, float }

@.str.32 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [14 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 void @gs_expand(ptr noundef %0, i32 noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca { float, float }, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct.gs_s, ptr %7, i32 0, i32 5
  %9 = load ptr, ptr %8, align 8, !tbaa !11
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.gs_s, ptr %10, i32 0, i32 6
  %12 = load ptr, ptr %11, align 8, !tbaa !14
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.gs_s, ptr %13, i32 0, i32 0
  %15 = load i32, ptr %14, align 8, !tbaa !15
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.gs_s, ptr %16, i32 0, i32 7
  %18 = load float, ptr %17, align 8, !tbaa !16
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.gs_s, ptr %19, i32 0, i32 11
  %21 = load ptr, ptr %20, align 8, !tbaa !17
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.gs_s, ptr %22, i32 0, i32 10
  %24 = load ptr, ptr %23, align 8, !tbaa !18
  %25 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 0
  %26 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 1
  store float %18, ptr %25, align 4
  store float 0.000000e+00, ptr %26, align 4
  %27 = load <2 x float>, ptr %5, align 4
  %28 = call i32 @iirdes_dzpk2sosf(ptr noundef %9, ptr noundef %12, i32 noundef %15, <2 x float> noundef %27, ptr noundef %21, ptr noundef %24)
  %29 = load i32, ptr %4, align 4, !tbaa !9
  %30 = icmp ne i32 %29, 0
  br i1 %30, label %31, label %140

31:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.gs_s, ptr %32, i32 0, i32 1
  %34 = load i32, ptr %33, align 4, !tbaa !19
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.gs_s, ptr %35, i32 0, i32 2
  %37 = load i32, ptr %36, align 8, !tbaa !20
  %38 = add i32 %34, %37
  %39 = call i32 (ptr, ...) @printf(ptr noundef @.str.32, i32 noundef %38)
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %40

40:                                               ; preds = %82, %31
  %41 = load i32, ptr %6, align 4, !tbaa !9
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.gs_s, ptr %42, i32 0, i32 1
  %44 = load i32, ptr %43, align 4, !tbaa !19
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.gs_s, ptr %45, i32 0, i32 2
  %47 = load i32, ptr %46, align 8, !tbaa !20
  %48 = add i32 %44, %47
  %49 = icmp ult i32 %41, %48
  br i1 %49, label %50, label %85

50:                                               ; preds = %40
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.gs_s, ptr %51, i32 0, i32 11
  %53 = load ptr, ptr %52, align 8, !tbaa !17
  %54 = load i32, ptr %6, align 4, !tbaa !9
  %55 = mul i32 3, %54
  %56 = add i32 %55, 0
  %57 = zext i32 %56 to i64
  %58 = getelementptr inbounds float, ptr %53, i64 %57
  %59 = load float, ptr %58, align 4, !tbaa !21
  %60 = fpext float %59 to double
  %61 = load ptr, ptr %3, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.gs_s, ptr %61, i32 0, i32 11
  %63 = load ptr, ptr %62, align 8, !tbaa !17
  %64 = load i32, ptr %6, align 4, !tbaa !9
  %65 = mul i32 3, %64
  %66 = add i32 %65, 1
  %67 = zext i32 %66 to i64
  %68 = getelementptr inbounds float, ptr %63, i64 %67
  %69 = load float, ptr %68, align 4, !tbaa !21
  %70 = fpext float %69 to double
  %71 = load ptr, ptr %3, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.gs_s, ptr %71, i32 0, i32 11
  %73 = load ptr, ptr %72, align 8, !tbaa !17
  %74 = load i32, ptr %6, align 4, !tbaa !9
  %75 = mul i32 3, %74
  %76 = add i32 %75, 2
  %77 = zext i32 %76 to i64
  %78 = getelementptr inbounds float, ptr %73, i64 %77
  %79 = load float, ptr %78, align 4, !tbaa !21
  %80 = fpext float %79 to double
  %81 = call i32 (ptr, ...) @printf(ptr noundef @.str.33, double noundef %60, double noundef %70, double noundef %80)
  br label %82

82:                                               ; preds = %50
  %83 = load i32, ptr %6, align 4, !tbaa !9
  %84 = add i32 %83, 1
  store i32 %84, ptr %6, align 4, !tbaa !9
  br label %40, !llvm.loop !22

85:                                               ; preds = %40
  %86 = load ptr, ptr %3, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.gs_s, ptr %86, i32 0, i32 1
  %88 = load i32, ptr %87, align 4, !tbaa !19
  %89 = load ptr, ptr %3, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.gs_s, ptr %89, i32 0, i32 2
  %91 = load i32, ptr %90, align 8, !tbaa !20
  %92 = add i32 %88, %91
  %93 = call i32 (ptr, ...) @printf(ptr noundef @.str.34, i32 noundef %92)
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %94

94:                                               ; preds = %136, %85
  %95 = load i32, ptr %6, align 4, !tbaa !9
  %96 = load ptr, ptr %3, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.gs_s, ptr %96, i32 0, i32 1
  %98 = load i32, ptr %97, align 4, !tbaa !19
  %99 = load ptr, ptr %3, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.gs_s, ptr %99, i32 0, i32 2
  %101 = load i32, ptr %100, align 8, !tbaa !20
  %102 = add i32 %98, %101
  %103 = icmp ult i32 %95, %102
  br i1 %103, label %104, label %139

104:                                              ; preds = %94
  %105 = load ptr, ptr %3, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.gs_s, ptr %105, i32 0, i32 10
  %107 = load ptr, ptr %106, align 8, !tbaa !18
  %108 = load i32, ptr %6, align 4, !tbaa !9
  %109 = mul i32 3, %108
  %110 = add i32 %109, 0
  %111 = zext i32 %110 to i64
  %112 = getelementptr inbounds float, ptr %107, i64 %111
  %113 = load float, ptr %112, align 4, !tbaa !21
  %114 = fpext float %113 to double
  %115 = load ptr, ptr %3, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.gs_s, ptr %115, i32 0, i32 10
  %117 = load ptr, ptr %116, align 8, !tbaa !18
  %118 = load i32, ptr %6, align 4, !tbaa !9
  %119 = mul i32 3, %118
  %120 = add i32 %119, 1
  %121 = zext i32 %120 to i64
  %122 = getelementptr inbounds float, ptr %117, i64 %121
  %123 = load float, ptr %122, align 4, !tbaa !21
  %124 = fpext float %123 to double
  %125 = load ptr, ptr %3, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.gs_s, ptr %125, i32 0, i32 10
  %127 = load ptr, ptr %126, align 8, !tbaa !18
  %128 = load i32, ptr %6, align 4, !tbaa !9
  %129 = mul i32 3, %128
  %130 = add i32 %129, 2
  %131 = zext i32 %130 to i64
  %132 = getelementptr inbounds float, ptr %127, i64 %131
  %133 = load float, ptr %132, align 4, !tbaa !21
  %134 = fpext float %133 to double
  %135 = call i32 (ptr, ...) @printf(ptr noundef @.str.33, double noundef %114, double noundef %124, double noundef %134)
  br label %136

136:                                              ; preds = %104
  %137 = load i32, ptr %6, align 4, !tbaa !9
  %138 = add i32 %137, 1
  store i32 %138, ptr %6, align 4, !tbaa !9
  br label %94, !llvm.loop !24

139:                                              ; preds = %94
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  br label %140

140:                                              ; preds = %139, %2
  ret void
}

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

declare i32 @iirdes_dzpk2sosf(ptr noundef, ptr noundef, i32 noundef, <2 x float> noundef, ptr noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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, !6, i64 24}
!12 = !{!"gs_s", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !6, i64 24, !6, i64 32, !13, i64 40, !13, i64 44, !13, i64 48, !6, i64 56, !6, i64 64, !10, i64 72, !6, i64 80, !13, i64 88, !13, i64 92, !13, i64 96}
!13 = !{!"float", !7, i64 0}
!14 = !{!12, !6, i64 32}
!15 = !{!12, !10, i64 0}
!16 = !{!12, !13, i64 40}
!17 = !{!12, !6, i64 64}
!18 = !{!12, !6, i64 56}
!19 = !{!12, !10, i64 4}
!20 = !{!12, !10, i64 8}
!21 = !{!13, !13, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = distinct !{!24, !23}


; 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.32 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [14 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @gs_expand(ptr nocapture noundef readonly %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 24
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 32
  %6 = load ptr, ptr %5, align 8, !tbaa !12
  %7 = load i32, ptr %0, align 8, !tbaa !13
  %8 = getelementptr inbounds i8, ptr %0, i64 40
  %9 = load float, ptr %8, align 8, !tbaa !14
  %10 = getelementptr inbounds i8, ptr %0, i64 64
  %11 = load ptr, ptr %10, align 8, !tbaa !15
  %12 = getelementptr inbounds i8, ptr %0, i64 56
  %13 = load ptr, ptr %12, align 8, !tbaa !16
  %.sroa.0.4.vec.insert = insertelement <2 x float> <float poison, float 0.000000e+00>, float %9, i64 0
  %14 = tail call i32 @iirdes_dzpk2sosf(ptr noundef %4, ptr noundef %6, i32 noundef %7, <2 x float> noundef %.sroa.0.4.vec.insert, ptr noundef %11, ptr noundef %13) #3
  %.not = icmp eq i32 %1, 0
  br i1 %.not, label %.loopexit, label %15

15:                                               ; preds = %2
  %16 = getelementptr inbounds i8, ptr %0, i64 4
  %17 = load i32, ptr %16, align 4, !tbaa !17
  %18 = getelementptr inbounds i8, ptr %0, i64 8
  %19 = load i32, ptr %18, align 8, !tbaa !18
  %20 = add i32 %19, %17
  %21 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.32, i32 noundef %20)
  %22 = load i32, ptr %16, align 4, !tbaa !17
  %23 = load i32, ptr %18, align 8, !tbaa !18
  %24 = sub i32 0, %22
  %.not36 = icmp eq i32 %23, %24
  br i1 %.not36, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %15, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %15 ]
  %25 = load ptr, ptr %10, align 8, !tbaa !15
  %26 = trunc nuw i64 %indvars.iv to i32
  %27 = mul i32 %26, 3
  %28 = zext i32 %27 to i64
  %29 = getelementptr inbounds float, ptr %25, i64 %28
  %30 = load float, ptr %29, align 4, !tbaa !19
  %31 = fpext float %30 to double
  %32 = add i32 %27, 1
  %33 = zext i32 %32 to i64
  %34 = getelementptr inbounds float, ptr %25, i64 %33
  %35 = load float, ptr %34, align 4, !tbaa !19
  %36 = fpext float %35 to double
  %37 = add i32 %27, 2
  %38 = zext i32 %37 to i64
  %39 = getelementptr inbounds float, ptr %25, i64 %38
  %40 = load float, ptr %39, align 4, !tbaa !19
  %41 = fpext float %40 to double
  %42 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.33, double noundef %31, double noundef %36, double noundef %41)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %43 = load i32, ptr %16, align 4, !tbaa !17
  %44 = load i32, ptr %18, align 8, !tbaa !18
  %45 = add i32 %44, %43
  %46 = zext i32 %45 to i64
  %47 = icmp ult i64 %indvars.iv.next, %46
  br i1 %47, label %.lr.ph, label %._crit_edge, !llvm.loop !20

._crit_edge:                                      ; preds = %.lr.ph, %15
  %.lcssa = phi i32 [ 0, %15 ], [ %45, %.lr.ph ]
  %48 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.34, i32 noundef %.lcssa)
  %49 = load i32, ptr %16, align 4, !tbaa !17
  %50 = load i32, ptr %18, align 8, !tbaa !18
  %51 = sub i32 0, %49
  %.not37 = icmp eq i32 %50, %51
  br i1 %.not37, label %.loopexit, label %.lr.ph35

.lr.ph35:                                         ; preds = %._crit_edge, %.lr.ph35
  %indvars.iv40 = phi i64 [ %indvars.iv.next41, %.lr.ph35 ], [ 0, %._crit_edge ]
  %52 = load ptr, ptr %12, align 8, !tbaa !16
  %53 = trunc nuw i64 %indvars.iv40 to i32
  %54 = mul i32 %53, 3
  %55 = zext i32 %54 to i64
  %56 = getelementptr inbounds float, ptr %52, i64 %55
  %57 = load float, ptr %56, align 4, !tbaa !19
  %58 = fpext float %57 to double
  %59 = add i32 %54, 1
  %60 = zext i32 %59 to i64
  %61 = getelementptr inbounds float, ptr %52, i64 %60
  %62 = load float, ptr %61, align 4, !tbaa !19
  %63 = fpext float %62 to double
  %64 = add i32 %54, 2
  %65 = zext i32 %64 to i64
  %66 = getelementptr inbounds float, ptr %52, i64 %65
  %67 = load float, ptr %66, align 4, !tbaa !19
  %68 = fpext float %67 to double
  %69 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.33, double noundef %58, double noundef %63, double noundef %68)
  %indvars.iv.next41 = add nuw nsw i64 %indvars.iv40, 1
  %70 = load i32, ptr %16, align 4, !tbaa !17
  %71 = load i32, ptr %18, align 8, !tbaa !18
  %72 = add i32 %71, %70
  %73 = zext i32 %72 to i64
  %74 = icmp ult i64 %indvars.iv.next41, %73
  br i1 %74, label %.lr.ph35, label %.loopexit, !llvm.loop !22

.loopexit:                                        ; preds = %.lr.ph35, %._crit_edge, %2
  ret void
}

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

declare i32 @iirdes_dzpk2sosf(ptr noundef, ptr noundef, i32 noundef, <2 x float> noundef, ptr noundef, ptr 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 = { 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, !10, i64 24}
!6 = !{!"gs_s", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !10, i64 24, !10, i64 32, !11, i64 40, !11, i64 44, !11, i64 48, !10, i64 56, !10, i64 64, !7, i64 72, !10, i64 80, !11, i64 88, !11, i64 92, !11, i64 96}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{!6, !10, i64 32}
!13 = !{!6, !7, i64 0}
!14 = !{!6, !11, i64 40}
!15 = !{!6, !10, i64 64}
!16 = !{!6, !10, i64 56}
!17 = !{!6, !7, i64 4}
!18 = !{!6, !7, i64 8}
!19 = !{!11, !11, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !21}


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