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

; 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 [90 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [22 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

declare void @liquid_autotest_passed(...) #1

declare void @liquid_autotest_failed_expr(ptr noundef, i32 noundef, ptr noundef, double noundef, ptr noundef, ptr noundef, double noundef) #1

declare i32 @cbufferf_release(ptr noundef, i32 noundef) #1

declare i32 @cbufferf_pop(ptr noundef, ptr noundef) #1

declare i32 @cbufferf_push(ptr noundef, float noundef) #1

declare i32 @cbufferf_destroy(ptr noundef) #1

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

declare ptr @cbufferf_create_max(i32 noundef, i32 noundef) #1

declare i32 @cbufferf_space_available(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @autotest_cbufferf_config() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca float, align 4
  %4 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #3
  store i32 48, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  store i32 17, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  %5 = load i32, ptr %1, align 4, !tbaa !5
  %6 = load i32, ptr %2, align 4, !tbaa !5
  %7 = call ptr @cbufferf_create_max(i32 noundef %5, i32 noundef %6)
  store ptr %7, ptr %4, align 8, !tbaa !9
  %8 = load ptr, ptr %4, align 8, !tbaa !9
  %9 = call i32 @cbufferf_max_size(ptr noundef %8)
  %10 = load i32, ptr %1, align 4, !tbaa !5
  %11 = icmp ne i32 %9, %10
  br i1 %11, label %12, label %18

12:                                               ; preds = %0
  %13 = load ptr, ptr %4, align 8, !tbaa !9
  %14 = call i32 @cbufferf_max_size(ptr noundef %13)
  %15 = uitofp i32 %14 to double
  %16 = load i32, ptr %1, align 4, !tbaa !5
  %17 = uitofp i32 %16 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 310, ptr noundef @.str.32, double noundef %15, ptr noundef @.str.3, ptr noundef @.str.33, double noundef %17)
  br label %19

18:                                               ; preds = %0
  call void (...) @liquid_autotest_passed()
  br label %19

19:                                               ; preds = %18, %12
  %20 = load ptr, ptr %4, align 8, !tbaa !9
  %21 = call i32 @cbufferf_max_read(ptr noundef %20)
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = icmp ne i32 %21, %22
  br i1 %23, label %24, label %30

24:                                               ; preds = %19
  %25 = load ptr, ptr %4, align 8, !tbaa !9
  %26 = call i32 @cbufferf_max_read(ptr noundef %25)
  %27 = uitofp i32 %26 to double
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = uitofp i32 %28 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 311, ptr noundef @.str.34, double noundef %27, ptr noundef @.str.3, ptr noundef @.str.35, double noundef %29)
  br label %31

30:                                               ; preds = %19
  call void (...) @liquid_autotest_passed()
  br label %31

31:                                               ; preds = %30, %24
  br label %32

32:                                               ; preds = %45, %31
  %33 = load ptr, ptr %4, align 8, !tbaa !9
  %34 = call i32 @cbufferf_space_available(ptr noundef %33)
  %35 = icmp ne i32 %34, 0
  br i1 %35, label %36, label %46

36:                                               ; preds = %32
  %37 = load ptr, ptr %4, align 8, !tbaa !9
  %38 = call i32 @cbufferf_push(ptr noundef %37, float noundef 0.000000e+00)
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %40, label %44

40:                                               ; preds = %36
  %41 = load ptr, ptr %4, align 8, !tbaa !9
  %42 = call i32 @cbufferf_push(ptr noundef %41, float noundef 0.000000e+00)
  %43 = sitofp i32 %42 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 315, ptr noundef @.str.36, double noundef %43, ptr noundef @.str.3, ptr noundef @.str.37, double noundef 0.000000e+00)
  br label %45

44:                                               ; preds = %36
  call void (...) @liquid_autotest_passed()
  br label %45

45:                                               ; preds = %44, %40
  br label %32, !llvm.loop !11

46:                                               ; preds = %32
  %47 = load ptr, ptr %4, align 8, !tbaa !9
  %48 = call i32 @cbufferf_print(ptr noundef %47)
  %49 = icmp ne i32 %48, 0
  br i1 %49, label %50, label %54

50:                                               ; preds = %46
  %51 = load ptr, ptr %4, align 8, !tbaa !9
  %52 = call i32 @cbufferf_print(ptr noundef %51)
  %53 = sitofp i32 %52 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 318, ptr noundef @.str.38, double noundef %53, ptr noundef @.str.3, ptr noundef @.str.37, double noundef 0.000000e+00)
  br label %55

54:                                               ; preds = %46
  call void (...) @liquid_autotest_passed()
  br label %55

55:                                               ; preds = %54, %50
  %56 = load ptr, ptr %4, align 8, !tbaa !9
  %57 = call i32 @cbufferf_push(ptr noundef %56, float noundef 0.000000e+00)
  %58 = icmp eq i32 %57, 0
  br i1 %58, label %59, label %63

59:                                               ; preds = %55
  %60 = load ptr, ptr %4, align 8, !tbaa !9
  %61 = call i32 @cbufferf_push(ptr noundef %60, float noundef 0.000000e+00)
  %62 = sitofp i32 %61 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 321, ptr noundef @.str.36, double noundef %62, ptr noundef @.str.39, ptr noundef @.str.37, double noundef 0.000000e+00)
  br label %64

63:                                               ; preds = %55
  call void (...) @liquid_autotest_passed()
  br label %64

64:                                               ; preds = %63, %59
  %65 = load ptr, ptr %4, align 8, !tbaa !9
  %66 = call i32 @cbufferf_reset(ptr noundef %65)
  %67 = load ptr, ptr %4, align 8, !tbaa !9
  %68 = call i32 @cbufferf_pop(ptr noundef %67, ptr noundef %3)
  %69 = icmp eq i32 %68, 0
  br i1 %69, label %70, label %74

70:                                               ; preds = %64
  %71 = load ptr, ptr %4, align 8, !tbaa !9
  %72 = call i32 @cbufferf_pop(ptr noundef %71, ptr noundef %3)
  %73 = sitofp i32 %72 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 327, ptr noundef @.str.40, double noundef %73, ptr noundef @.str.39, ptr noundef @.str.37, double noundef 0.000000e+00)
  br label %75

74:                                               ; preds = %64
  call void (...) @liquid_autotest_passed()
  br label %75

75:                                               ; preds = %74, %70
  %76 = load ptr, ptr %4, align 8, !tbaa !9
  %77 = call i32 @cbufferf_release(ptr noundef %76, i32 noundef 1)
  %78 = icmp eq i32 %77, 0
  br i1 %78, label %79, label %83

79:                                               ; preds = %75
  %80 = load ptr, ptr %4, align 8, !tbaa !9
  %81 = call i32 @cbufferf_release(ptr noundef %80, i32 noundef 1)
  %82 = sitofp i32 %81 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 328, ptr noundef @.str.41, double noundef %82, ptr noundef @.str.39, ptr noundef @.str.37, double noundef 0.000000e+00)
  br label %84

83:                                               ; preds = %75
  call void (...) @liquid_autotest_passed()
  br label %84

84:                                               ; preds = %83, %79
  %85 = load ptr, ptr %4, align 8, !tbaa !9
  %86 = call i32 @cbufferf_destroy(ptr noundef %85)
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #3
  ret void
}

declare i32 @cbufferf_max_size(ptr noundef) #1

declare i32 @cbufferf_max_read(ptr noundef) #1

declare i32 @cbufferf_print(ptr noundef) #1

declare i32 @cbufferf_reset(ptr noundef) #1

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 = !{!"int", !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 = distinct !{!11, !12}
!12 = !{!"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 [90 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [22 x i8], align 1

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

declare void @liquid_autotest_passed(...) local_unnamed_addr #1

declare void @liquid_autotest_failed_expr(ptr noundef, i32 noundef, ptr noundef, double noundef, ptr noundef, ptr noundef, double noundef) local_unnamed_addr #1

declare i32 @cbufferf_release(ptr noundef, i32 noundef) local_unnamed_addr #1

declare i32 @cbufferf_pop(ptr noundef, ptr noundef) local_unnamed_addr #1

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

declare i32 @cbufferf_destroy(ptr noundef) local_unnamed_addr #1

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

declare ptr @cbufferf_create_max(i32 noundef, i32 noundef) local_unnamed_addr #1

declare i32 @cbufferf_space_available(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @autotest_cbufferf_config() local_unnamed_addr #2 {
  %1 = alloca float, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #3
  %2 = tail call ptr @cbufferf_create_max(i32 noundef 48, i32 noundef 17) #3
  %3 = tail call i32 @cbufferf_max_size(ptr noundef %2) #3
  %.not = icmp eq i32 %3, 48
  br i1 %.not, label %7, label %4

4:                                                ; preds = %0
  %5 = tail call i32 @cbufferf_max_size(ptr noundef %2) #3
  %6 = uitofp i32 %5 to double
  tail call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 310, ptr noundef nonnull @.str.32, double noundef %6, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.33, double noundef 4.800000e+01) #3
  br label %8

7:                                                ; preds = %0
  tail call void (...) @liquid_autotest_passed() #3
  br label %8

8:                                                ; preds = %7, %4
  %9 = tail call i32 @cbufferf_max_read(ptr noundef %2) #3
  %.not22 = icmp eq i32 %9, 17
  br i1 %.not22, label %13, label %10

10:                                               ; preds = %8
  %11 = tail call i32 @cbufferf_max_read(ptr noundef %2) #3
  %12 = uitofp i32 %11 to double
  tail call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 311, ptr noundef nonnull @.str.34, double noundef %12, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.35, double noundef 1.700000e+01) #3
  br label %14

13:                                               ; preds = %8
  tail call void (...) @liquid_autotest_passed() #3
  br label %14

14:                                               ; preds = %13, %10
  %15 = tail call i32 @cbufferf_space_available(ptr noundef %2) #3
  %.not2326 = icmp eq i32 %15, 0
  br i1 %.not2326, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %14, %21
  %16 = tail call i32 @cbufferf_push(ptr noundef %2, float noundef 0.000000e+00) #3
  %.not25 = icmp eq i32 %16, 0
  br i1 %.not25, label %20, label %17

17:                                               ; preds = %.lr.ph
  %18 = tail call i32 @cbufferf_push(ptr noundef %2, float noundef 0.000000e+00) #3
  %19 = sitofp i32 %18 to double
  tail call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 315, ptr noundef nonnull @.str.36, double noundef %19, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.37, double noundef 0.000000e+00) #3
  br label %21

20:                                               ; preds = %.lr.ph
  tail call void (...) @liquid_autotest_passed() #3
  br label %21

21:                                               ; preds = %20, %17
  %22 = tail call i32 @cbufferf_space_available(ptr noundef %2) #3
  %.not23 = icmp eq i32 %22, 0
  br i1 %.not23, label %._crit_edge, label %.lr.ph, !llvm.loop !5

._crit_edge:                                      ; preds = %21, %14
  %23 = tail call i32 @cbufferf_print(ptr noundef %2) #3
  %.not24 = icmp eq i32 %23, 0
  br i1 %.not24, label %27, label %24

24:                                               ; preds = %._crit_edge
  %25 = tail call i32 @cbufferf_print(ptr noundef %2) #3
  %26 = sitofp i32 %25 to double
  tail call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 318, ptr noundef nonnull @.str.38, double noundef %26, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.37, double noundef 0.000000e+00) #3
  br label %28

27:                                               ; preds = %._crit_edge
  tail call void (...) @liquid_autotest_passed() #3
  br label %28

28:                                               ; preds = %27, %24
  %29 = tail call i32 @cbufferf_push(ptr noundef %2, float noundef 0.000000e+00) #3
  %30 = icmp eq i32 %29, 0
  br i1 %30, label %31, label %34

31:                                               ; preds = %28
  %32 = tail call i32 @cbufferf_push(ptr noundef %2, float noundef 0.000000e+00) #3
  %33 = sitofp i32 %32 to double
  tail call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 321, ptr noundef nonnull @.str.36, double noundef %33, ptr noundef nonnull @.str.39, ptr noundef nonnull @.str.37, double noundef 0.000000e+00) #3
  br label %35

34:                                               ; preds = %28
  tail call void (...) @liquid_autotest_passed() #3
  br label %35

35:                                               ; preds = %34, %31
  %36 = tail call i32 @cbufferf_reset(ptr noundef %2) #3
  %37 = call i32 @cbufferf_pop(ptr noundef %2, ptr noundef nonnull %1) #3
  %38 = icmp eq i32 %37, 0
  br i1 %38, label %39, label %42

39:                                               ; preds = %35
  %40 = call i32 @cbufferf_pop(ptr noundef %2, ptr noundef nonnull %1) #3
  %41 = sitofp i32 %40 to double
  call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 327, ptr noundef nonnull @.str.40, double noundef %41, ptr noundef nonnull @.str.39, ptr noundef nonnull @.str.37, double noundef 0.000000e+00) #3
  br label %43

42:                                               ; preds = %35
  call void (...) @liquid_autotest_passed() #3
  br label %43

43:                                               ; preds = %42, %39
  %44 = call i32 @cbufferf_release(ptr noundef %2, i32 noundef 1) #3
  %45 = icmp eq i32 %44, 0
  br i1 %45, label %46, label %49

46:                                               ; preds = %43
  %47 = call i32 @cbufferf_release(ptr noundef %2, i32 noundef 1) #3
  %48 = sitofp i32 %47 to double
  call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 328, ptr noundef nonnull @.str.41, double noundef %48, ptr noundef nonnull @.str.39, ptr noundef nonnull @.str.37, double noundef 0.000000e+00) #3
  br label %50

49:                                               ; preds = %43
  call void (...) @liquid_autotest_passed() #3
  br label %50

50:                                               ; preds = %49, %46
  %51 = call i32 @cbufferf_destroy(ptr noundef %2) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #3
  ret void
}

declare i32 @cbufferf_max_size(ptr noundef) local_unnamed_addr #1

declare i32 @cbufferf_max_read(ptr noundef) local_unnamed_addr #1

declare i32 @cbufferf_print(ptr noundef) local_unnamed_addr #1

declare i32 @cbufferf_reset(ptr noundef) local_unnamed_addr #1

attributes #0 = { mustprogress 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


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