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

@.str = external hidden unnamed_addr constant [21 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.26 = 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 i32, align 4
  %3 = alloca float, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 64, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store float 2.000000e+01, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %8 = load i32, ptr %2, align 4, !tbaa !5
  %9 = zext i32 %8 to i64
  %10 = call ptr @llvm.stacksave.p0()
  store ptr %10, ptr %5, align 8
  %11 = alloca float, i64 %9, align 16
  store i64 %9, ptr %6, align 8
  %12 = load i32, ptr %2, align 4, !tbaa !5
  %13 = load float, ptr %3, align 4, !tbaa !9
  %14 = call i32 @liquid_kbd_window(i32 noundef %12, float noundef %13, ptr noundef %11)
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %15 = call noalias ptr @fopen(ptr noundef @.str, ptr noundef @.str.1)
  store ptr %15, ptr %7, align 8, !tbaa !11
  %16 = load ptr, ptr %7, align 8, !tbaa !11
  %17 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %16, ptr noundef @.str.2, ptr noundef @.str) #5
  %18 = load ptr, ptr %7, align 8, !tbaa !11
  %19 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef @.str.3) #5
  %20 = load ptr, ptr %7, align 8, !tbaa !11
  %21 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %20, ptr noundef @.str.4) #5
  %22 = load ptr, ptr %7, align 8, !tbaa !11
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %22, ptr noundef @.str.5, i32 noundef %23) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %25

25:                                               ; preds = %46, %0
  %26 = load i32, ptr %4, align 4, !tbaa !5
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = icmp ult i32 %26, %27
  br i1 %28, label %29, label %49

29:                                               ; preds = %25
  %30 = load ptr, ptr %7, align 8, !tbaa !11
  %31 = load i32, ptr %4, align 4, !tbaa !5
  %32 = add i32 %31, 1
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = zext i32 %33 to i64
  %35 = getelementptr inbounds float, ptr %11, i64 %34
  %36 = load float, ptr %35, align 4, !tbaa !9
  %37 = fpext float %36 to double
  %38 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %30, ptr noundef @.str.6, i32 noundef %32, double noundef %37) #5
  %39 = load i32, ptr %4, align 4, !tbaa !5
  %40 = load i32, ptr %4, align 4, !tbaa !5
  %41 = zext i32 %40 to i64
  %42 = getelementptr inbounds float, ptr %11, i64 %41
  %43 = load float, ptr %42, align 4, !tbaa !9
  %44 = fpext float %43 to double
  %45 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i32 noundef %39, double noundef %44)
  br label %46

46:                                               ; preds = %29
  %47 = load i32, ptr %4, align 4, !tbaa !5
  %48 = add i32 %47, 1
  store i32 %48, ptr %4, align 4, !tbaa !5
  br label %25, !llvm.loop !13

49:                                               ; preds = %25
  %50 = load ptr, ptr %7, align 8, !tbaa !11
  %51 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %50, ptr noundef @.str.8) #5
  %52 = load ptr, ptr %7, align 8, !tbaa !11
  %53 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %52, ptr noundef @.str.9) #5
  %54 = load ptr, ptr %7, align 8, !tbaa !11
  %55 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %54, ptr noundef @.str.10) #5
  %56 = load ptr, ptr %7, align 8, !tbaa !11
  %57 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %56, ptr noundef @.str.11) #5
  %58 = load ptr, ptr %7, align 8, !tbaa !11
  %59 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %58, ptr noundef @.str.12) #5
  %60 = load ptr, ptr %7, align 8, !tbaa !11
  %61 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %60, ptr noundef @.str.13) #5
  %62 = load ptr, ptr %7, align 8, !tbaa !11
  %63 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %62, ptr noundef @.str.14) #5
  %64 = load ptr, ptr %7, align 8, !tbaa !11
  %65 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %64, ptr noundef @.str.15) #5
  %66 = load ptr, ptr %7, align 8, !tbaa !11
  %67 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %66, ptr noundef @.str.16) #5
  %68 = load ptr, ptr %7, align 8, !tbaa !11
  %69 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %68, ptr noundef @.str.17) #5
  %70 = load ptr, ptr %7, align 8, !tbaa !11
  %71 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %70, ptr noundef @.str.18) #5
  %72 = load ptr, ptr %7, align 8, !tbaa !11
  %73 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %72, ptr noundef @.str.19) #5
  %74 = load ptr, ptr %7, align 8, !tbaa !11
  %75 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %74, ptr noundef @.str.20) #5
  %76 = load ptr, ptr %7, align 8, !tbaa !11
  %77 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %76, ptr noundef @.str.15) #5
  %78 = load ptr, ptr %7, align 8, !tbaa !11
  %79 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %78, ptr noundef @.str.21) #5
  %80 = load ptr, ptr %7, align 8, !tbaa !11
  %81 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %80, ptr noundef @.str.22) #5
  %82 = load ptr, ptr %7, align 8, !tbaa !11
  %83 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %82, ptr noundef @.str.23) #5
  %84 = load ptr, ptr %7, align 8, !tbaa !11
  %85 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %84, ptr noundef @.str.24) #5
  %86 = load ptr, ptr %7, align 8, !tbaa !11
  %87 = call i32 @fclose(ptr noundef %86)
  %88 = call i32 (ptr, ...) @printf(ptr noundef @.str.25, ptr noundef @.str)
  %89 = call i32 (ptr, ...) @printf(ptr noundef @.str.26)
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  %90 = load ptr, ptr %5, align 8
  call void @llvm.stackrestore.p0(ptr %90)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  %91 = load i32, ptr %1, align 4
  ret i32 %91
}

; 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 nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2

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

declare noalias ptr @fopen(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #4

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

declare i32 @fclose(ptr noundef) #3

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #2

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 nosync nounwind willreturn }
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 "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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !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"

@.str = external hidden unnamed_addr constant [21 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.26 = 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 [64 x float], align 16
  %2 = call i32 @liquid_kbd_window(i32 noundef 64, float noundef 2.000000e+01, ptr noundef nonnull %1) #3
  %3 = call noalias ptr @fopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1)
  %4 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %3, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str) #3
  %5 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %3, ptr noundef nonnull @.str.3) #3
  %6 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %3, ptr noundef nonnull @.str.4) #3
  %7 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %3, ptr noundef nonnull @.str.5, i32 noundef 64) #3
  br label %8

8:                                                ; preds = %0, %8
  %indvars.iv = phi i64 [ 0, %0 ], [ %indvars.iv.next, %8 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %9 = getelementptr inbounds float, ptr %1, i64 %indvars.iv
  %10 = load float, ptr %9, align 4, !tbaa !5
  %11 = fpext float %10 to double
  %12 = trunc nuw nsw i64 %indvars.iv.next to i32
  %13 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %3, ptr noundef nonnull @.str.6, i32 noundef %12, double noundef %11) #3
  %14 = load float, ptr %9, align 4, !tbaa !5
  %15 = fpext float %14 to double
  %16 = trunc nuw nsw i64 %indvars.iv to i32
  %17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %16, double noundef %15)
  %exitcond.not = icmp eq i64 %indvars.iv.next, 64
  br i1 %exitcond.not, label %18, label %8, !llvm.loop !9

18:                                               ; preds = %8
  %19 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %3, ptr noundef nonnull @.str.8) #3
  %20 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %3, ptr noundef nonnull @.str.9) #3
  %21 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %3, ptr noundef nonnull @.str.10) #3
  %22 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %3, ptr noundef nonnull @.str.11) #3
  %23 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %3, ptr noundef nonnull @.str.12) #3
  %24 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %3, ptr noundef nonnull @.str.13) #3
  %25 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %3, ptr noundef nonnull @.str.14) #3
  %26 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %3, ptr noundef nonnull @.str.15) #3
  %27 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %3, ptr noundef nonnull @.str.16) #3
  %28 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %3, ptr noundef nonnull @.str.17) #3
  %29 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %3, ptr noundef nonnull @.str.18) #3
  %30 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %3, ptr noundef nonnull @.str.19) #3
  %31 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %3, ptr noundef nonnull @.str.20) #3
  %32 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %3, ptr noundef nonnull @.str.15) #3
  %33 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %3, ptr noundef nonnull @.str.21) #3
  %34 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %3, ptr noundef nonnull @.str.22) #3
  %35 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %3, ptr noundef nonnull @.str.23) #3
  %36 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %3, ptr noundef nonnull @.str.24) #3
  %37 = call i32 @fclose(ptr noundef %3)
  %38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.25, ptr noundef nonnull @.str)
  %39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.26)
  ret i32 0
}

declare i32 @liquid_kbd_window(i32 noundef, float noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #2

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #2

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 = { "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 = { 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 #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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


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