; LLVM IR from jgaeddert/liquid-dsp :: src/buffer/src (buffercf)

; 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.windowcf_s = type { ptr, i32, i32, i32, i32, i32, i32 }

@.str.11 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [36 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

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

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

8:                                                ; preds = %47, %1
  %9 = load i32, ptr %3, align 4, !tbaa !12
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.windowcf_s, ptr %10, i32 0, i32 1
  %12 = load i32, ptr %11, align 8, !tbaa !9
  %13 = icmp ult i32 %9, %12
  br i1 %13, label %14, label %50

14:                                               ; preds = %8
  %15 = load i32, ptr %3, align 4, !tbaa !12
  %16 = load ptr, ptr %2, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.windowcf_s, ptr %16, i32 0, i32 6
  %18 = load i32, ptr %17, align 4, !tbaa !13
  %19 = icmp eq i32 %15, %18
  br i1 %19, label %20, label %22

20:                                               ; preds = %14
  %21 = call i32 (ptr, ...) @printf(ptr noundef @.str.15)
  br label %22

22:                                               ; preds = %20, %14
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.windowcf_s, ptr %23, i32 0, i32 0
  %25 = load ptr, ptr %24, align 8, !tbaa !14
  %26 = load i32, ptr %3, align 4, !tbaa !12
  %27 = zext i32 %26 to i64
  %28 = getelementptr inbounds { float, float }, ptr %25, i64 %27
  %29 = getelementptr inbounds { float, float }, ptr %28, i32 0, i32 0
  %30 = load float, ptr %29, align 4
  %31 = getelementptr inbounds { float, float }, ptr %28, i32 0, i32 1
  %32 = load float, ptr %31, align 4
  %33 = fpext float %30 to double
  %34 = load ptr, ptr %2, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.windowcf_s, ptr %34, i32 0, i32 0
  %36 = load ptr, ptr %35, align 8, !tbaa !14
  %37 = load i32, ptr %3, align 4, !tbaa !12
  %38 = zext i32 %37 to i64
  %39 = getelementptr inbounds { float, float }, ptr %36, i64 %38
  %40 = getelementptr inbounds { float, float }, ptr %39, i32 0, i32 0
  %41 = load float, ptr %40, align 4
  %42 = getelementptr inbounds { float, float }, ptr %39, i32 0, i32 1
  %43 = load float, ptr %42, align 4
  %44 = fpext float %43 to double
  %45 = call i32 (ptr, ...) @printf(ptr noundef @.str.16, double noundef %33, double noundef %44)
  %46 = call i32 (ptr, ...) @printf(ptr noundef @.str.14)
  br label %47

47:                                               ; preds = %22
  %48 = load i32, ptr %3, align 4, !tbaa !12
  %49 = add i32 %48, 1
  store i32 %49, ptr %3, align 4, !tbaa !12
  br label %8, !llvm.loop !15

50:                                               ; preds = %8
  %51 = call i32 (ptr, ...) @printf(ptr noundef @.str.17)
  %52 = load ptr, ptr %2, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.windowcf_s, ptr %52, i32 0, i32 1
  %54 = load i32, ptr %53, align 8, !tbaa !9
  store i32 %54, ptr %3, align 4, !tbaa !12
  br label %55

55:                                               ; preds = %86, %50
  %56 = load i32, ptr %3, align 4, !tbaa !12
  %57 = load ptr, ptr %2, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.windowcf_s, ptr %57, i32 0, i32 5
  %59 = load i32, ptr %58, align 8, !tbaa !17
  %60 = icmp ult i32 %56, %59
  br i1 %60, label %61, label %89

61:                                               ; preds = %55
  %62 = load ptr, ptr %2, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.windowcf_s, ptr %62, i32 0, i32 0
  %64 = load ptr, ptr %63, align 8, !tbaa !14
  %65 = load i32, ptr %3, align 4, !tbaa !12
  %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 %69 to double
  %73 = load ptr, ptr %2, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.windowcf_s, ptr %73, i32 0, i32 0
  %75 = load ptr, ptr %74, align 8, !tbaa !14
  %76 = load i32, ptr %3, align 4, !tbaa !12
  %77 = zext i32 %76 to i64
  %78 = getelementptr inbounds { float, float }, ptr %75, i64 %77
  %79 = getelementptr inbounds { float, float }, ptr %78, i32 0, i32 0
  %80 = load float, ptr %79, align 4
  %81 = getelementptr inbounds { float, float }, ptr %78, i32 0, i32 1
  %82 = load float, ptr %81, align 4
  %83 = fpext float %82 to double
  %84 = call i32 (ptr, ...) @printf(ptr noundef @.str.16, double noundef %72, double noundef %83)
  %85 = call i32 (ptr, ...) @printf(ptr noundef @.str.14)
  br label %86

86:                                               ; preds = %61
  %87 = load i32, ptr %3, align 4, !tbaa !12
  %88 = add i32 %87, 1
  store i32 %88, ptr %3, align 4, !tbaa !12
  br label %55, !llvm.loop !18

89:                                               ; preds = %55
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret i32 0
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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" }
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, !11, i64 8}
!10 = !{!"windowcf_s", !6, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28}
!11 = !{!"int", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!10, !11, i64 28}
!14 = !{!10, !6, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!10, !11, i64 24}
!18 = distinct !{!18, !16}


; 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 [24 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [36 x i8], align 1

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

; Function Attrs: nofree nounwind uwtable
define dso_local noundef i32 @windowcf_debug_print(ptr nocapture noundef readonly %0) local_unnamed_addr #1 {
  %2 = getelementptr inbounds i8, ptr %0, i64 8
  %3 = load i32, ptr %2, align 8, !tbaa !5
  %4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11, i32 noundef %3)
  %5 = load i32, ptr %2, 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 28
  br label %7

7:                                                ; preds = %.lr.ph, %13
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %13 ]
  %8 = load i32, ptr %6, align 4, !tbaa !11
  %9 = zext i32 %8 to i64
  %10 = icmp eq i64 %indvars.iv, %9
  br i1 %10, label %11, label %13

11:                                               ; preds = %7
  %12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15)
  br label %13

13:                                               ; preds = %11, %7
  %14 = load ptr, ptr %0, align 8, !tbaa !12
  %15 = getelementptr inbounds { float, float }, ptr %14, i64 %indvars.iv
  %16 = load float, ptr %15, align 4
  %17 = getelementptr inbounds i8, ptr %15, i64 4
  %18 = fpext float %16 to double
  %19 = load float, ptr %17, align 4
  %20 = fpext float %19 to double
  %21 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.16, double noundef %18, double noundef %20)
  %22 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %23 = load i32, ptr %2, align 8, !tbaa !5
  %24 = zext i32 %23 to i64
  %25 = icmp ult i64 %indvars.iv.next, %24
  br i1 %25, label %7, label %._crit_edge, !llvm.loop !13

._crit_edge:                                      ; preds = %13, %1
  %26 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.17)
  %27 = load i32, ptr %2, align 8, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %0, i64 24
  %29 = load i32, ptr %28, align 8, !tbaa !15
  %30 = icmp ult i32 %27, %29
  br i1 %30, label %.lr.ph20.preheader, label %._crit_edge21

.lr.ph20.preheader:                               ; preds = %._crit_edge
  %31 = zext i32 %27 to i64
  br label %.lr.ph20

.lr.ph20:                                         ; preds = %.lr.ph20.preheader, %.lr.ph20
  %indvars.iv23 = phi i64 [ %31, %.lr.ph20.preheader ], [ %indvars.iv.next24, %.lr.ph20 ]
  %32 = load ptr, ptr %0, align 8, !tbaa !12
  %33 = getelementptr inbounds { float, float }, ptr %32, i64 %indvars.iv23
  %34 = load float, ptr %33, align 4
  %35 = getelementptr inbounds i8, ptr %33, i64 4
  %36 = fpext float %34 to double
  %37 = load float, ptr %35, align 4
  %38 = fpext float %37 to double
  %39 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.16, double noundef %36, double noundef %38)
  %40 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14)
  %indvars.iv.next24 = add nuw nsw i64 %indvars.iv23, 1
  %41 = load i32, ptr %28, align 8, !tbaa !15
  %42 = zext i32 %41 to i64
  %43 = icmp ult i64 %indvars.iv.next24, %42
  br i1 %43, label %.lr.ph20, label %._crit_edge21, !llvm.loop !16

._crit_edge21:                                    ; preds = %.lr.ph20, %._crit_edge
  ret i32 0
}

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

!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 8}
!6 = !{!"windowcf_s", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !10, i64 28}
!12 = !{!6, !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!6, !10, i64 24}
!16 = distinct !{!16, !14}


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