; LLVM IR from jgaeddert/liquid-dsp :: examples (windowf_example)

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

@__const.main.v = external hidden unnamed_addr constant [10 x float], align 16
@.str = external hidden unnamed_addr constant [16 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [10 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 [10 x float], align 16
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 40, ptr %2) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %2, ptr align 16 @__const.main.v, i64 40, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %6 = call ptr @windowf_create(i32 noundef 10)
  store ptr %6, ptr %5, align 8, !tbaa !5
  %7 = load ptr, ptr %5, align 8, !tbaa !5
  %8 = call i32 @windowf_push(ptr noundef %7, float noundef 1.000000e+00)
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  %10 = call i32 @windowf_push(ptr noundef %9, float noundef 1.000000e+00)
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = call i32 @windowf_push(ptr noundef %11, float noundef 1.000000e+00)
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = call i32 @windowf_push(ptr noundef %13, float noundef 1.000000e+00)
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = getelementptr inbounds [10 x float], ptr %2, i64 0, i64 0
  %17 = call i32 @windowf_write(ptr noundef %15, ptr noundef %16, i32 noundef 4)
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = call i32 @windowf_push(ptr noundef %18, float noundef 3.000000e+00)
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = call i32 @windowf_push(ptr noundef %20, float noundef 3.000000e+00)
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = call i32 @windowf_push(ptr noundef %22, float noundef 3.000000e+00)
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = call i32 @windowf_push(ptr noundef %24, float noundef 3.000000e+00)
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = call i32 @windowf_read(ptr noundef %26, ptr noundef %3)
  %28 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %29

29:                                               ; preds = %41, %0
  %30 = load i32, ptr %4, align 4, !tbaa !9
  %31 = icmp ult i32 %30, 10
  br i1 %31, label %32, label %44

32:                                               ; preds = %29
  %33 = load i32, ptr %4, align 4, !tbaa !9
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = load i32, ptr %4, align 4, !tbaa !9
  %36 = zext i32 %35 to i64
  %37 = getelementptr inbounds float, ptr %34, i64 %36
  %38 = load float, ptr %37, align 4, !tbaa !11
  %39 = fpext float %38 to double
  %40 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %33, double noundef %39)
  br label %41

41:                                               ; preds = %32
  %42 = load i32, ptr %4, align 4, !tbaa !9
  %43 = add i32 %42, 1
  store i32 %43, ptr %4, align 4, !tbaa !9
  br label %29, !llvm.loop !13

44:                                               ; preds = %29
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = call i32 @windowf_debug_print(ptr noundef %45)
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = call i32 @windowf_destroy(ptr noundef %47)
  %49 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %2) #4
  ret i32 0
}

; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

declare ptr @windowf_create(i32 noundef) #3

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

declare i32 @windowf_write(ptr noundef, ptr noundef, i32 noundef) #3

declare i32 @windowf_read(ptr noundef, ptr noundef) #3

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

declare i32 @windowf_debug_print(ptr noundef) #3

declare i32 @windowf_destroy(ptr noundef) #3

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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 nounwind willreturn memory(argmem: readwrite) }
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 = !{!"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, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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"

@__const.main.v = external hidden unnamed_addr constant [10 x float], align 16
@.str = external hidden unnamed_addr constant [16 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [10 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 [10 x float], align 16
  %2 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %1) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(40) %1, ptr noundef nonnull align 16 dereferenceable(40) @__const.main.v, i64 40, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  %3 = tail call ptr @windowf_create(i32 noundef 10) #5
  %4 = tail call i32 @windowf_push(ptr noundef %3, float noundef 1.000000e+00) #5
  %5 = tail call i32 @windowf_push(ptr noundef %3, float noundef 1.000000e+00) #5
  %6 = tail call i32 @windowf_push(ptr noundef %3, float noundef 1.000000e+00) #5
  %7 = tail call i32 @windowf_push(ptr noundef %3, float noundef 1.000000e+00) #5
  %8 = call i32 @windowf_write(ptr noundef %3, ptr noundef nonnull %1, i32 noundef 4) #5
  %9 = call i32 @windowf_push(ptr noundef %3, float noundef 3.000000e+00) #5
  %10 = call i32 @windowf_push(ptr noundef %3, float noundef 3.000000e+00) #5
  %11 = call i32 @windowf_push(ptr noundef %3, float noundef 3.000000e+00) #5
  %12 = call i32 @windowf_push(ptr noundef %3, float noundef 3.000000e+00) #5
  %13 = call i32 @windowf_read(ptr noundef %3, ptr noundef nonnull %2) #5
  %14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = load float, ptr %15, align 4, !tbaa !9
  %17 = fpext float %16 to double
  %18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 0, double noundef %17)
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %19, i64 4
  %21 = load float, ptr %20, align 4, !tbaa !9
  %22 = fpext float %21 to double
  %23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 1, double noundef %22)
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %24, i64 8
  %26 = load float, ptr %25, align 4, !tbaa !9
  %27 = fpext float %26 to double
  %28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 2, double noundef %27)
  %29 = load ptr, ptr %2, align 8, !tbaa !5
  %30 = getelementptr inbounds i8, ptr %29, i64 12
  %31 = load float, ptr %30, align 4, !tbaa !9
  %32 = fpext float %31 to double
  %33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 3, double noundef %32)
  %34 = load ptr, ptr %2, align 8, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %34, i64 16
  %36 = load float, ptr %35, align 4, !tbaa !9
  %37 = fpext float %36 to double
  %38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 4, double noundef %37)
  %39 = load ptr, ptr %2, align 8, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %39, i64 20
  %41 = load float, ptr %40, align 4, !tbaa !9
  %42 = fpext float %41 to double
  %43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 5, double noundef %42)
  %44 = load ptr, ptr %2, align 8, !tbaa !5
  %45 = getelementptr inbounds i8, ptr %44, i64 24
  %46 = load float, ptr %45, align 4, !tbaa !9
  %47 = fpext float %46 to double
  %48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 6, double noundef %47)
  %49 = load ptr, ptr %2, align 8, !tbaa !5
  %50 = getelementptr inbounds i8, ptr %49, i64 28
  %51 = load float, ptr %50, align 4, !tbaa !9
  %52 = fpext float %51 to double
  %53 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 7, double noundef %52)
  %54 = load ptr, ptr %2, align 8, !tbaa !5
  %55 = getelementptr inbounds i8, ptr %54, i64 32
  %56 = load float, ptr %55, align 4, !tbaa !9
  %57 = fpext float %56 to double
  %58 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 8, double noundef %57)
  %59 = load ptr, ptr %2, align 8, !tbaa !5
  %60 = getelementptr inbounds i8, ptr %59, i64 36
  %61 = load float, ptr %60, align 4, !tbaa !9
  %62 = fpext float %61 to double
  %63 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 9, double noundef %62)
  %64 = call i32 @windowf_debug_print(ptr noundef %3) #5
  %65 = call i32 @windowf_destroy(ptr noundef %3) #5
  %66 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %1) #5
  ret i32 0
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

declare ptr @windowf_create(i32 noundef) local_unnamed_addr #3

declare i32 @windowf_push(ptr noundef, float noundef) local_unnamed_addr #3

declare i32 @windowf_write(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

declare i32 @windowf_read(ptr noundef, ptr noundef) local_unnamed_addr #3

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

declare i32 @windowf_debug_print(ptr noundef) local_unnamed_addr #3

declare i32 @windowf_destroy(ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #5 = { 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 = !{!"float", !7, i64 0}


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