; LLVM IR from jgaeddert/liquid-dsp :: src/framing/src (framingcf)

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

@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.50 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.51 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.52 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.54 = external hidden unnamed_addr constant [48 x i8], align 1

declare ptr @liquid_error_config_fl(ptr noundef, i32 noundef, ptr noundef, ...) #0

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

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

declare ptr @modemcf_create(i32 noundef) #0

; Function Attrs: nounwind uwtable
define dso_local ptr @symstreamcf_create_linear(i32 noundef %0, i32 noundef %1, i32 noundef %2, float noundef %3, i32 noundef %4) #3 {
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca float, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  store i32 %0, ptr %7, align 4, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !5
  store i32 %2, ptr %9, align 4, !tbaa !5
  store float %3, ptr %10, align 4, !tbaa !9
  store i32 %4, ptr %11, align 4, !tbaa !5
  %13 = load i32, ptr %8, align 4, !tbaa !5
  %14 = icmp ult i32 %13, 2
  br i1 %14, label %15, label %17

15:                                               ; preds = %5
  %16 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.50, i32 noundef 68, ptr noundef @.str.51, ptr noundef @.str.2)
  store ptr %16, ptr %6, align 8
  br label %89

17:                                               ; preds = %5
  %18 = load i32, ptr %9, align 4, !tbaa !5
  %19 = icmp eq i32 %18, 0
  br i1 %19, label %20, label %22

20:                                               ; preds = %17
  %21 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.50, i32 noundef 70, ptr noundef @.str.52, ptr noundef @.str.2)
  store ptr %21, ptr %6, align 8
  br label %89

22:                                               ; preds = %17
  %23 = load float, ptr %10, align 4, !tbaa !9
  %24 = fcmp ole float %23, 0.000000e+00
  br i1 %24, label %28, label %25

25:                                               ; preds = %22
  %26 = load float, ptr %10, align 4, !tbaa !9
  %27 = fcmp ogt float %26, 1.000000e+00
  br i1 %27, label %28, label %30

28:                                               ; preds = %25, %22
  %29 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.50, i32 noundef 72, ptr noundef @.str.53, ptr noundef @.str.2)
  store ptr %29, ptr %6, align 8
  br label %89

30:                                               ; preds = %25
  %31 = load i32, ptr %11, align 4, !tbaa !5
  %32 = icmp eq i32 %31, 0
  br i1 %32, label %36, label %33

33:                                               ; preds = %30
  %34 = load i32, ptr %11, align 4, !tbaa !5
  %35 = icmp sge i32 %34, 53
  br i1 %35, label %36, label %38

36:                                               ; preds = %33, %30
  %37 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.50, i32 noundef 74, ptr noundef @.str.54, ptr noundef @.str.2)
  store ptr %37, ptr %6, align 8
  br label %89

38:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %39 = call noalias ptr @malloc(i64 noundef 64) #5
  store ptr %39, ptr %12, align 8, !tbaa !11
  %40 = load i32, ptr %7, align 4, !tbaa !5
  %41 = load ptr, ptr %12, align 8, !tbaa !11
  %42 = getelementptr inbounds %struct.symstreamcf_s, ptr %41, i32 0, i32 0
  store i32 %40, ptr %42, align 8, !tbaa !13
  %43 = load i32, ptr %8, align 4, !tbaa !5
  %44 = load ptr, ptr %12, align 8, !tbaa !11
  %45 = getelementptr inbounds %struct.symstreamcf_s, ptr %44, i32 0, i32 1
  store i32 %43, ptr %45, align 4, !tbaa !15
  %46 = load i32, ptr %9, align 4, !tbaa !5
  %47 = load ptr, ptr %12, align 8, !tbaa !11
  %48 = getelementptr inbounds %struct.symstreamcf_s, ptr %47, i32 0, i32 2
  store i32 %46, ptr %48, align 8, !tbaa !16
  %49 = load float, ptr %10, align 4, !tbaa !9
  %50 = load ptr, ptr %12, align 8, !tbaa !11
  %51 = getelementptr inbounds %struct.symstreamcf_s, ptr %50, i32 0, i32 3
  store float %49, ptr %51, align 4, !tbaa !17
  %52 = load i32, ptr %11, align 4, !tbaa !5
  %53 = load ptr, ptr %12, align 8, !tbaa !11
  %54 = getelementptr inbounds %struct.symstreamcf_s, ptr %53, i32 0, i32 4
  store i32 %52, ptr %54, align 8, !tbaa !18
  %55 = load ptr, ptr %12, align 8, !tbaa !11
  %56 = getelementptr inbounds %struct.symstreamcf_s, ptr %55, i32 0, i32 6
  store float 1.000000e+00, ptr %56, align 8, !tbaa !19
  %57 = load ptr, ptr %12, align 8, !tbaa !11
  %58 = getelementptr inbounds %struct.symstreamcf_s, ptr %57, i32 0, i32 4
  %59 = load i32, ptr %58, align 8, !tbaa !18
  %60 = call ptr @modemcf_create(i32 noundef %59)
  %61 = load ptr, ptr %12, align 8, !tbaa !11
  %62 = getelementptr inbounds %struct.symstreamcf_s, ptr %61, i32 0, i32 5
  store ptr %60, ptr %62, align 8, !tbaa !20
  %63 = load ptr, ptr %12, align 8, !tbaa !11
  %64 = getelementptr inbounds %struct.symstreamcf_s, ptr %63, i32 0, i32 0
  %65 = load i32, ptr %64, align 8, !tbaa !13
  %66 = load ptr, ptr %12, align 8, !tbaa !11
  %67 = getelementptr inbounds %struct.symstreamcf_s, ptr %66, i32 0, i32 1
  %68 = load i32, ptr %67, align 4, !tbaa !15
  %69 = load ptr, ptr %12, align 8, !tbaa !11
  %70 = getelementptr inbounds %struct.symstreamcf_s, ptr %69, i32 0, i32 2
  %71 = load i32, ptr %70, align 8, !tbaa !16
  %72 = load ptr, ptr %12, align 8, !tbaa !11
  %73 = getelementptr inbounds %struct.symstreamcf_s, ptr %72, i32 0, i32 3
  %74 = load float, ptr %73, align 4, !tbaa !17
  %75 = call ptr @firinterp_crcf_create_prototype(i32 noundef %65, i32 noundef %68, i32 noundef %71, float noundef %74, float noundef 0.000000e+00)
  %76 = load ptr, ptr %12, align 8, !tbaa !11
  %77 = getelementptr inbounds %struct.symstreamcf_s, ptr %76, i32 0, i32 7
  store ptr %75, ptr %77, align 8, !tbaa !21
  %78 = load ptr, ptr %12, align 8, !tbaa !11
  %79 = getelementptr inbounds %struct.symstreamcf_s, ptr %78, i32 0, i32 1
  %80 = load i32, ptr %79, align 4, !tbaa !15
  %81 = zext i32 %80 to i64
  %82 = mul i64 %81, 8
  %83 = call noalias ptr @malloc(i64 noundef %82) #5
  %84 = load ptr, ptr %12, align 8, !tbaa !11
  %85 = getelementptr inbounds %struct.symstreamcf_s, ptr %84, i32 0, i32 8
  store ptr %83, ptr %85, align 8, !tbaa !22
  %86 = load ptr, ptr %12, align 8, !tbaa !11
  %87 = call i32 @symstreamcf_reset(ptr noundef %86)
  %88 = load ptr, ptr %12, align 8, !tbaa !11
  store ptr %88, ptr %6, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br label %89

89:                                               ; preds = %38, %36, %28, %20, %15
  %90 = load ptr, ptr %6, align 8
  ret ptr %90
}

declare ptr @firinterp_crcf_create_prototype(i32 noundef, i32 noundef, i32 noundef, float noundef, float noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @symstreamcf_reset(ptr noundef) #3

attributes #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 = { nounwind allocsize(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 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 #4 = { nounwind }
attributes #5 = { nounwind allocsize(0) }

!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 = !{!14, !6, i64 0}
!14 = !{!"symstreamcf_s", !6, i64 0, !6, i64 4, !6, i64 8, !10, i64 12, !6, i64 16, !12, i64 24, !10, i64 32, !12, i64 40, !12, i64 48, !6, i64 56}
!15 = !{!14, !6, i64 4}
!16 = !{!14, !6, i64 8}
!17 = !{!14, !10, i64 12}
!18 = !{!14, !6, i64 16}
!19 = !{!14, !10, i64 32}
!20 = !{!14, !12, i64 24}
!21 = !{!14, !12, i64 40}
!22 = !{!14, !12, i64 48}


; 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.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.50 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.51 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.52 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.54 = external hidden unnamed_addr constant [48 x i8], align 1

declare ptr @liquid_error_config_fl(ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #1

declare ptr @modemcf_create(i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local ptr @symstreamcf_create_linear(i32 noundef %0, i32 noundef %1, i32 noundef %2, float noundef %3, i32 noundef %4) local_unnamed_addr #2 {
  %6 = icmp ult i32 %1, 2
  br i1 %6, label %7, label %9

7:                                                ; preds = %5
  %8 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.50, i32 noundef 68, ptr noundef nonnull @.str.51, ptr noundef nonnull @.str.2) #3
  br label %39

9:                                                ; preds = %5
  %10 = icmp eq i32 %2, 0
  br i1 %10, label %11, label %13

11:                                               ; preds = %9
  %12 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.50, i32 noundef 70, ptr noundef nonnull @.str.52, ptr noundef nonnull @.str.2) #3
  br label %39

13:                                               ; preds = %9
  %14 = fcmp ole float %3, 0.000000e+00
  %15 = fcmp ogt float %3, 1.000000e+00
  %or.cond = or i1 %14, %15
  br i1 %or.cond, label %16, label %18

16:                                               ; preds = %13
  %17 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.50, i32 noundef 72, ptr noundef nonnull @.str.53, ptr noundef nonnull @.str.2) #3
  br label %39

18:                                               ; preds = %13
  %19 = icmp eq i32 %4, 0
  %20 = icmp sgt i32 %4, 52
  %or.cond3 = or i1 %19, %20
  br i1 %or.cond3, label %21, label %23

21:                                               ; preds = %18
  %22 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.50, i32 noundef 74, ptr noundef nonnull @.str.54, ptr noundef nonnull @.str.2) #3
  br label %39

23:                                               ; preds = %18
  %24 = tail call noalias dereferenceable_or_null(64) ptr @malloc(i64 noundef 64) #4
  store i32 %0, ptr %24, align 8, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %24, i64 4
  store i32 %1, ptr %25, align 4, !tbaa !12
  %26 = getelementptr inbounds i8, ptr %24, i64 8
  store i32 %2, ptr %26, align 8, !tbaa !13
  %27 = getelementptr inbounds i8, ptr %24, i64 12
  store float %3, ptr %27, align 4, !tbaa !14
  %28 = getelementptr inbounds i8, ptr %24, i64 16
  store i32 %4, ptr %28, align 8, !tbaa !15
  %29 = getelementptr inbounds i8, ptr %24, i64 32
  store float 1.000000e+00, ptr %29, align 8, !tbaa !16
  %30 = tail call ptr @modemcf_create(i32 noundef %4) #3
  %31 = getelementptr inbounds i8, ptr %24, i64 24
  store ptr %30, ptr %31, align 8, !tbaa !17
  %32 = tail call ptr @firinterp_crcf_create_prototype(i32 noundef %0, i32 noundef %1, i32 noundef %2, float noundef %3, float noundef 0.000000e+00) #3
  %33 = getelementptr inbounds i8, ptr %24, i64 40
  store ptr %32, ptr %33, align 8, !tbaa !18
  %34 = zext i32 %1 to i64
  %35 = shl nuw nsw i64 %34, 3
  %36 = tail call noalias ptr @malloc(i64 noundef %35) #4
  %37 = getelementptr inbounds i8, ptr %24, i64 48
  store ptr %36, ptr %37, align 8, !tbaa !19
  %38 = tail call i32 @symstreamcf_reset(ptr noundef nonnull %24)
  br label %39

39:                                               ; preds = %23, %21, %16, %11, %7
  %.0 = phi ptr [ %8, %7 ], [ %12, %11 ], [ %17, %16 ], [ %22, %21 ], [ %24, %23 ]
  ret ptr %.0
}

declare ptr @firinterp_crcf_create_prototype(i32 noundef, i32 noundef, i32 noundef, float noundef, float noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @symstreamcf_reset(ptr noundef) local_unnamed_addr #2

attributes #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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 }
attributes #4 = { nounwind allocsize(0) }

!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 = !{!"symstreamcf_s", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 12, !7, i64 16, !11, i64 24, !10, i64 32, !11, i64 40, !11, i64 48, !7, i64 56}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"float", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!6, !7, i64 4}
!13 = !{!6, !7, i64 8}
!14 = !{!6, !10, i64 12}
!15 = !{!6, !7, i64 16}
!16 = !{!6, !10, i64 32}
!17 = !{!6, !11, i64 24}
!18 = !{!6, !11, i64 40}
!19 = !{!6, !11, i64 48}


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