; 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.37 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [15 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
declare dso_local float @gs_evaluate(ptr noundef, i32 noundef) #1

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

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

7:                                                ; preds = %38, %2
  %8 = load i32, ptr %5, align 4, !tbaa !9
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.gs_s, ptr %9, i32 0, i32 0
  %11 = load i32, ptr %10, align 8, !tbaa !11
  %12 = icmp ult i32 %8, %11
  br i1 %12, label %13, label %41

13:                                               ; preds = %7
  %14 = load i32, ptr %5, align 4, !tbaa !9
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.gs_s, ptr %15, i32 0, i32 5
  %17 = load ptr, ptr %16, align 8, !tbaa !14
  %18 = load i32, ptr %5, align 4, !tbaa !9
  %19 = zext i32 %18 to i64
  %20 = getelementptr inbounds { float, float }, ptr %17, i64 %19
  %21 = getelementptr inbounds { float, float }, ptr %20, i32 0, i32 0
  %22 = load float, ptr %21, align 4
  %23 = getelementptr inbounds { float, float }, ptr %20, i32 0, i32 1
  %24 = load float, ptr %23, align 4
  %25 = fpext float %22 to double
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.gs_s, ptr %26, i32 0, i32 5
  %28 = load ptr, ptr %27, align 8, !tbaa !14
  %29 = load i32, ptr %5, align 4, !tbaa !9
  %30 = zext i32 %29 to i64
  %31 = getelementptr inbounds { float, float }, ptr %28, i64 %30
  %32 = getelementptr inbounds { float, float }, ptr %31, i32 0, i32 0
  %33 = load float, ptr %32, align 4
  %34 = getelementptr inbounds { float, float }, ptr %31, i32 0, i32 1
  %35 = load float, ptr %34, align 4
  %36 = fpext float %35 to double
  %37 = call i32 (ptr, ...) @printf(ptr noundef @.str.38, i32 noundef %14, double noundef %25, double noundef %36)
  br label %38

38:                                               ; preds = %13
  %39 = load i32, ptr %5, align 4, !tbaa !9
  %40 = add i32 %39, 1
  store i32 %40, ptr %5, align 4, !tbaa !9
  br label %7, !llvm.loop !15

41:                                               ; preds = %7
  %42 = call i32 (ptr, ...) @printf(ptr noundef @.str.39)
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %43

43:                                               ; preds = %74, %41
  %44 = load i32, ptr %5, align 4, !tbaa !9
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.gs_s, ptr %45, i32 0, i32 0
  %47 = load i32, ptr %46, align 8, !tbaa !11
  %48 = icmp ult i32 %44, %47
  br i1 %48, label %49, label %77

49:                                               ; preds = %43
  %50 = load i32, ptr %5, align 4, !tbaa !9
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.gs_s, ptr %51, i32 0, i32 6
  %53 = load ptr, ptr %52, align 8, !tbaa !17
  %54 = load i32, ptr %5, align 4, !tbaa !9
  %55 = zext i32 %54 to i64
  %56 = getelementptr inbounds { float, float }, ptr %53, i64 %55
  %57 = getelementptr inbounds { float, float }, ptr %56, i32 0, i32 0
  %58 = load float, ptr %57, align 4
  %59 = getelementptr inbounds { float, float }, ptr %56, i32 0, i32 1
  %60 = load float, ptr %59, align 4
  %61 = fpext float %58 to double
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.gs_s, ptr %62, i32 0, i32 6
  %64 = load ptr, ptr %63, align 8, !tbaa !17
  %65 = load i32, ptr %5, align 4, !tbaa !9
  %66 = zext i32 %65 to i64
  %67 = getelementptr inbounds { float, float }, ptr %64, i64 %66
  %68 = getelementptr inbounds { float, float }, ptr %67, i32 0, i32 0
  %69 = load float, ptr %68, align 4
  %70 = getelementptr inbounds { float, float }, ptr %67, i32 0, i32 1
  %71 = load float, ptr %70, align 4
  %72 = fpext float %71 to double
  %73 = call i32 (ptr, ...) @printf(ptr noundef @.str.40, i32 noundef %50, double noundef %61, double noundef %72)
  br label %74

74:                                               ; preds = %49
  %75 = load i32, ptr %5, align 4, !tbaa !9
  %76 = add i32 %75, 1
  store i32 %76, ptr %5, align 4, !tbaa !9
  br label %43, !llvm.loop !18

77:                                               ; preds = %43
  %78 = call i32 (ptr, ...) @printf(ptr noundef @.str.41)
  %79 = load ptr, ptr %3, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.gs_s, ptr %79, i32 0, i32 7
  %81 = load float, ptr %80, align 8, !tbaa !19
  %82 = fpext float %81 to double
  %83 = load ptr, ptr %3, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.gs_s, ptr %83, i32 0, i32 7
  %85 = load float, ptr %84, align 8, !tbaa !19
  %86 = call i32 (ptr, ...) @printf(ptr noundef @.str.42, double noundef %82, double noundef 0.000000e+00)
  %87 = load ptr, ptr %3, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.gs_s, ptr %87, i32 0, i32 16
  %89 = load float, ptr %88, align 8, !tbaa !20
  %90 = fpext float %89 to double
  %91 = call i32 (ptr, ...) @printf(ptr noundef @.str.43, double noundef %90)
  %92 = load ptr, ptr %3, align 8, !tbaa !5
  %93 = call float @gs_evaluate(ptr noundef %92, i32 noundef 1)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  ret void
}

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 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 = { 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 0}
!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 24}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!12, !6, i64 32}
!18 = distinct !{!18, !16}
!19 = !{!12, !13, i64 40}
!20 = !{!12, !13, i64 96}


; 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.37 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [15 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
define dso_local void @gs_print(ptr noundef %0, i32 noundef %1) local_unnamed_addr #2 {
  %3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.37)
  %4 = load i32, ptr %0, align 8, !tbaa !5
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2
  %5 = getelementptr inbounds i8, ptr %0, i64 24
  br label %6

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

._crit_edge:                                      ; preds = %6, %2
  %19 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.39)
  %20 = load i32, ptr %0, align 8, !tbaa !5
  %.not24 = icmp eq i32 %20, 0
  br i1 %.not24, label %._crit_edge23, label %.lr.ph22

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

22:                                               ; preds = %.lr.ph22, %22
  %indvars.iv26 = phi i64 [ 0, %.lr.ph22 ], [ %indvars.iv.next27, %22 ]
  %23 = load ptr, ptr %21, align 8, !tbaa !15
  %24 = getelementptr inbounds { float, float }, ptr %23, i64 %indvars.iv26
  %25 = load float, ptr %24, align 4
  %26 = getelementptr inbounds i8, ptr %24, i64 4
  %27 = fpext float %25 to double
  %28 = load float, ptr %26, align 4
  %29 = fpext float %28 to double
  %30 = trunc nuw i64 %indvars.iv26 to i32
  %31 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.40, i32 noundef %30, double noundef %27, double noundef %29)
  %indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1
  %32 = load i32, ptr %0, align 8, !tbaa !5
  %33 = zext i32 %32 to i64
  %34 = icmp ult i64 %indvars.iv.next27, %33
  br i1 %34, label %22, label %._crit_edge23, !llvm.loop !16

._crit_edge23:                                    ; preds = %22, %._crit_edge
  %35 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.41)
  %36 = getelementptr inbounds i8, ptr %0, i64 40
  %37 = load float, ptr %36, align 8, !tbaa !17
  %38 = fpext float %37 to double
  %39 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.42, double noundef %38, double noundef 0.000000e+00)
  %40 = getelementptr inbounds i8, ptr %0, i64 96
  %41 = load float, ptr %40, align 8, !tbaa !18
  %42 = fpext float %41 to double
  %43 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.43, double noundef %42)
  %44 = tail call float @gs_evaluate(ptr noundef nonnull %0, i32 noundef 1)
  ret void
}

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

!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 0}
!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 24}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!6, !10, i64 32}
!16 = distinct !{!16, !14}
!17 = !{!6, !11, i64 40}
!18 = !{!6, !11, i64 96}


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