; LLVM IR from jgaeddert/liquid-dsp :: sandbox (throttle_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.timespec = type { i64, i64 }

@.str = external hidden unnamed_addr constant [68 x i8], align 1
@stdout = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca float, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca %struct.timespec, align 8
  %9 = alloca %struct.timespec, align 8
  %10 = alloca float, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca float, align 4
  %14 = alloca float, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store float 2.000000e+05, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  %15 = call ptr @firfilt_crcf_create_kaiser(i32 noundef 25, float noundef 2.500000e-01, float noundef 6.000000e+01, float noundef 0.000000e+00)
  store ptr %15, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 1024, ptr %4, align 4, !tbaa !11
  %16 = load i32, ptr %4, align 4, !tbaa !11
  %17 = zext i32 %16 to i64
  %18 = call ptr @llvm.stacksave.p0()
  store ptr %18, ptr %5, align 8
  %19 = alloca { float, float }, i64 %17, align 16
  store i64 %17, ptr %6, align 8
  %20 = load i32, ptr %4, align 4, !tbaa !11
  %21 = zext i32 %20 to i64
  %22 = alloca { float, float }, i64 %21, align 16
  store i64 %21, ptr %7, align 8
  %23 = load i32, ptr %4, align 4, !tbaa !11
  %24 = zext i32 %23 to i64
  %25 = mul i64 %24, 8
  call void @llvm.memset.p0.i64(ptr align 16 %19, i8 0, i64 %25, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store float 2.000000e+02, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 0, ptr %11, align 4, !tbaa !11
  br label %26

26:                                               ; preds = %85, %0
  %27 = load i32, ptr %11, align 4, !tbaa !11
  %28 = icmp ult i32 %27, 100
  br i1 %28, label %29, label %88

29:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 0, ptr %12, align 4, !tbaa !11
  %30 = call i32 @clock_gettime(i32 noundef 0, ptr noundef %8) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store float 0.000000e+00, ptr %13, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %35, %29
  %32 = load float, ptr %13, align 4, !tbaa !5
  %33 = fpext float %32 to double
  %34 = fcmp olt double %33, 2.000000e-01
  br i1 %34, label %35, label %60

35:                                               ; preds = %31
  %36 = load ptr, ptr %3, align 8, !tbaa !9
  %37 = load i32, ptr %4, align 4, !tbaa !11
  %38 = call i32 @firfilt_crcf_execute_block(ptr noundef %36, ptr noundef %19, i32 noundef %37, ptr noundef %22)
  %39 = load i32, ptr %4, align 4, !tbaa !11
  %40 = load i32, ptr %12, align 4, !tbaa !11
  %41 = add i32 %40, %39
  store i32 %41, ptr %12, align 4, !tbaa !11
  %42 = load float, ptr %10, align 4, !tbaa !5
  %43 = fptoui float %42 to i32
  %44 = call i32 @usleep(i32 noundef %43)
  %45 = call i32 @clock_gettime(i32 noundef 0, ptr noundef %9) #7
  %46 = getelementptr inbounds %struct.timespec, ptr %9, i32 0, i32 0
  %47 = load i64, ptr %46, align 8, !tbaa !13
  %48 = getelementptr inbounds %struct.timespec, ptr %8, i32 0, i32 0
  %49 = load i64, ptr %48, align 8, !tbaa !13
  %50 = sub nsw i64 %47, %49
  %51 = sitofp i64 %50 to double
  %52 = getelementptr inbounds %struct.timespec, ptr %9, i32 0, i32 1
  %53 = load i64, ptr %52, align 8, !tbaa !16
  %54 = getelementptr inbounds %struct.timespec, ptr %8, i32 0, i32 1
  %55 = load i64, ptr %54, align 8, !tbaa !16
  %56 = sub nsw i64 %53, %55
  %57 = sitofp i64 %56 to double
  %58 = call double @llvm.fmuladd.f64(double 1.000000e-09, double %57, double %51)
  %59 = fptrunc double %58 to float
  store float %59, ptr %13, align 4, !tbaa !5
  br label %31, !llvm.loop !17

60:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %61 = load i32, ptr %12, align 4, !tbaa !11
  %62 = uitofp i32 %61 to float
  %63 = load float, ptr %13, align 4, !tbaa !5
  %64 = fdiv float %62, %63
  store float %64, ptr %14, align 4, !tbaa !5
  %65 = load i32, ptr %11, align 4, !tbaa !11
  %66 = load float, ptr %14, align 4, !tbaa !5
  %67 = fmul float %66, 0x3F50624DE0000000
  %68 = fpext float %67 to double
  %69 = load float, ptr %2, align 4, !tbaa !5
  %70 = fmul float %69, 0x3F50624DE0000000
  %71 = fpext float %70 to double
  %72 = load float, ptr %10, align 4, !tbaa !5
  %73 = fpext float %72 to double
  %74 = call i32 (ptr, ...) @printf(ptr noundef @.str, i32 noundef %65, double noundef %68, double noundef %71, double noundef %73)
  %75 = load ptr, ptr @stdout, align 8, !tbaa !9
  %76 = call i32 @fflush(ptr noundef %75)
  %77 = load float, ptr %14, align 4, !tbaa !5
  %78 = load float, ptr %2, align 4, !tbaa !5
  %79 = fdiv float %77, %78
  %80 = call float @logf(float noundef %79) #7
  %81 = fmul float 0x3FC99999A0000000, %80
  %82 = call float @expf(float noundef %81) #7, !tbaa !11
  %83 = load float, ptr %10, align 4, !tbaa !5
  %84 = fmul float %83, %82
  store float %84, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %85

85:                                               ; preds = %60
  %86 = load i32, ptr %11, align 4, !tbaa !11
  %87 = add i32 %86, 1
  store i32 %87, ptr %11, align 4, !tbaa !11
  br label %26, !llvm.loop !19

88:                                               ; preds = %26
  %89 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  %90 = load ptr, ptr %3, align 8, !tbaa !9
  %91 = call i32 @firfilt_crcf_destroy(ptr noundef %90)
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #7
  %92 = load ptr, ptr %5, align 8
  call void @llvm.stackrestore.p0(ptr %92)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  %93 = load i32, ptr %1, align 4
  ret i32 %93
}

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

declare ptr @firfilt_crcf_create_kaiser(i32 noundef, float noundef, float noundef, float noundef) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

; Function Attrs: nounwind
declare i32 @clock_gettime(i32 noundef, ptr noundef) #5

declare i32 @firfilt_crcf_execute_block(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

declare i32 @usleep(i32 noundef) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #6

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

declare i32 @fflush(ptr noundef) #2

; Function Attrs: nounwind
declare float @expf(float noundef) #5

; Function Attrs: nounwind
declare float @logf(float noundef) #5

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

declare i32 @firfilt_crcf_destroy(ptr noundef) #2

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

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 = { "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 = { nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { 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 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !15, i64 0}
!14 = !{!"timespec", !15, i64 0, !15, i64 8}
!15 = !{!"long", !7, i64 0}
!16 = !{!14, !15, i64 8}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}


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

%struct.timespec = type { i64, i64 }

@.str = external hidden unnamed_addr constant [68 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca %struct.timespec, align 8
  %2 = alloca %struct.timespec, align 8
  %3 = tail call ptr @firfilt_crcf_create_kaiser(i32 noundef 25, float noundef 2.500000e-01, float noundef 6.000000e+01, float noundef 0.000000e+00) #8
  %4 = alloca [1024 x { float, float }], align 16
  %5 = alloca [1024 x { float, float }], align 16
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(8192) %4, i8 0, i64 8192, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #8
  %6 = getelementptr inbounds i8, ptr %2, i64 8
  %7 = getelementptr inbounds i8, ptr %1, i64 8
  br label %8

8:                                                ; preds = %0, %28
  %.02327 = phi i32 [ 0, %0 ], [ %42, %28 ]
  %.02426 = phi float [ 2.000000e+02, %0 ], [ %41, %28 ]
  %9 = call i32 @clock_gettime(i32 noundef 0, ptr noundef nonnull %1) #8
  %10 = fptoui float %.02426 to i32
  br label %11

11:                                               ; preds = %8, %11
  %.02225 = phi i32 [ 0, %8 ], [ %13, %11 ]
  %12 = call i32 @firfilt_crcf_execute_block(ptr noundef %3, ptr noundef nonnull %4, i32 noundef 1024, ptr noundef nonnull %5) #8
  %13 = add i32 %.02225, 1024
  %14 = call i32 @usleep(i32 noundef %10) #8
  %15 = call i32 @clock_gettime(i32 noundef 0, ptr noundef nonnull %2) #8
  %16 = load i64, ptr %2, align 8, !tbaa !5
  %17 = load i64, ptr %1, align 8, !tbaa !5
  %18 = sub nsw i64 %16, %17
  %19 = sitofp i64 %18 to double
  %20 = load i64, ptr %6, align 8, !tbaa !10
  %21 = load i64, ptr %7, align 8, !tbaa !10
  %22 = sub nsw i64 %20, %21
  %23 = sitofp i64 %22 to double
  %24 = call double @llvm.fmuladd.f64(double %23, double 1.000000e-09, double %19)
  %25 = fptrunc double %24 to float
  %26 = fpext float %25 to double
  %27 = fcmp olt double %26, 2.000000e-01
  br i1 %27, label %11, label %28, !llvm.loop !11

28:                                               ; preds = %11
  %29 = uitofp i32 %13 to float
  %30 = fdiv float %29, %25
  %31 = fmul float %30, 0x3F50624DE0000000
  %32 = fpext float %31 to double
  %33 = fpext float %.02426 to double
  %34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.02327, double noundef %32, double noundef 0x4069000020000000, double noundef %33)
  %35 = load ptr, ptr @stdout, align 8, !tbaa !13
  %36 = call i32 @fflush(ptr noundef %35)
  %37 = fdiv float %30, 2.000000e+05
  %38 = call float @logf(float noundef %37) #8
  %39 = fmul float %38, 0x3FC99999A0000000
  %40 = call float @expf(float noundef %39) #8, !tbaa !15
  %41 = fmul float %.02426, %40
  %42 = add nuw nsw i32 %.02327, 1
  %exitcond.not = icmp eq i32 %42, 100
  br i1 %exitcond.not, label %43, label %8, !llvm.loop !17

43:                                               ; preds = %28
  %44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  %45 = call i32 @firfilt_crcf_destroy(ptr noundef %3) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %1) #8
  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

declare ptr @firfilt_crcf_create_kaiser(i32 noundef, float noundef, float noundef, float noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

; Function Attrs: nounwind
declare i32 @clock_gettime(i32 noundef, ptr noundef) local_unnamed_addr #4

declare i32 @firfilt_crcf_execute_block(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

declare i32 @usleep(i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #5

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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare float @expf(float noundef) local_unnamed_addr #7

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare float @logf(float noundef) local_unnamed_addr #7

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

declare i32 @firfilt_crcf_destroy(ptr 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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 #7 = { mustprogress nofree nounwind willreturn memory(write) "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 #8 = { 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, !7, i64 0}
!6 = !{!"timespec", !7, i64 0, !7, i64 8}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !8, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"int", !8, i64 0}
!17 = distinct !{!17, !12}


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