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

@.str = external hidden unnamed_addr constant [86 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [65 x i8], align 1

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

11:                                               ; preds = %3
  %12 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str, i32 noundef 80, ptr noundef @.str.1, ptr noundef @.str.2)
  store ptr %12, ptr %4, align 8
  br label %83

13:                                               ; preds = %3
  %14 = load i32, ptr %5, align 4, !tbaa !5
  %15 = urem i32 %14, 2
  %16 = icmp ne i32 %15, 0
  br i1 %16, label %17, label %19

17:                                               ; preds = %13
  %18 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str, i32 noundef 82, ptr noundef @.str.3, ptr noundef @.str.2)
  store ptr %18, ptr %4, align 8
  br label %83

19:                                               ; preds = %13
  %20 = load i32, ptr %6, align 4, !tbaa !5
  %21 = icmp eq i32 %20, 0
  br i1 %21, label %22, label %24

22:                                               ; preds = %19
  %23 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str, i32 noundef 84, ptr noundef @.str.4, ptr noundef @.str.2)
  store ptr %23, ptr %4, align 8
  br label %83

24:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %25 = call noalias ptr @malloc(i64 noundef 72) #5
  store ptr %25, ptr %8, align 8, !tbaa !11
  %26 = load ptr, ptr %8, align 8, !tbaa !11
  %27 = getelementptr inbounds %struct.msourcecf_s, ptr %26, i32 0, i32 0
  store ptr null, ptr %27, align 8, !tbaa !13
  %28 = load ptr, ptr %8, align 8, !tbaa !11
  %29 = getelementptr inbounds %struct.msourcecf_s, ptr %28, i32 0, i32 1
  store i32 0, ptr %29, align 8, !tbaa !16
  %30 = load ptr, ptr %8, align 8, !tbaa !11
  %31 = getelementptr inbounds %struct.msourcecf_s, ptr %30, i32 0, i32 2
  store i32 0, ptr %31, align 4, !tbaa !17
  %32 = load i32, ptr %5, align 4, !tbaa !5
  %33 = load ptr, ptr %8, align 8, !tbaa !11
  %34 = getelementptr inbounds %struct.msourcecf_s, ptr %33, i32 0, i32 3
  store i32 %32, ptr %34, align 8, !tbaa !18
  %35 = load i32, ptr %6, align 4, !tbaa !5
  %36 = load ptr, ptr %8, align 8, !tbaa !11
  %37 = getelementptr inbounds %struct.msourcecf_s, ptr %36, i32 0, i32 4
  store i32 %35, ptr %37, align 4, !tbaa !19
  %38 = load float, ptr %7, align 4, !tbaa !9
  %39 = load ptr, ptr %8, align 8, !tbaa !11
  %40 = getelementptr inbounds %struct.msourcecf_s, ptr %39, i32 0, i32 5
  store float %38, ptr %40, align 8, !tbaa !20
  %41 = load ptr, ptr %8, align 8, !tbaa !11
  %42 = getelementptr inbounds %struct.msourcecf_s, ptr %41, i32 0, i32 11
  store i64 0, ptr %42, align 8, !tbaa !21
  %43 = load ptr, ptr %8, align 8, !tbaa !11
  %44 = getelementptr inbounds %struct.msourcecf_s, ptr %43, i32 0, i32 3
  %45 = load i32, ptr %44, align 8, !tbaa !18
  %46 = load ptr, ptr %8, align 8, !tbaa !11
  %47 = getelementptr inbounds %struct.msourcecf_s, ptr %46, i32 0, i32 4
  %48 = load i32, ptr %47, align 4, !tbaa !19
  %49 = load ptr, ptr %8, align 8, !tbaa !11
  %50 = getelementptr inbounds %struct.msourcecf_s, ptr %49, i32 0, i32 5
  %51 = load float, ptr %50, align 8, !tbaa !20
  %52 = call ptr @firpfbch2_crcf_create_kaiser(i32 noundef 1, i32 noundef %45, i32 noundef %48, float noundef %51)
  %53 = load ptr, ptr %8, align 8, !tbaa !11
  %54 = getelementptr inbounds %struct.msourcecf_s, ptr %53, i32 0, i32 6
  store ptr %52, ptr %54, align 8, !tbaa !22
  %55 = load ptr, ptr %8, align 8, !tbaa !11
  %56 = getelementptr inbounds %struct.msourcecf_s, ptr %55, i32 0, i32 3
  %57 = load i32, ptr %56, align 8, !tbaa !18
  %58 = zext i32 %57 to i64
  %59 = mul i64 %58, 8
  %60 = call noalias ptr @malloc(i64 noundef %59) #5
  %61 = load ptr, ptr %8, align 8, !tbaa !11
  %62 = getelementptr inbounds %struct.msourcecf_s, ptr %61, i32 0, i32 7
  store ptr %60, ptr %62, align 8, !tbaa !23
  %63 = load ptr, ptr %8, align 8, !tbaa !11
  %64 = getelementptr inbounds %struct.msourcecf_s, ptr %63, i32 0, i32 3
  %65 = load i32, ptr %64, align 8, !tbaa !18
  %66 = udiv i32 %65, 2
  %67 = zext i32 %66 to i64
  %68 = mul i64 %67, 8
  %69 = call noalias ptr @malloc(i64 noundef %68) #5
  %70 = load ptr, ptr %8, align 8, !tbaa !11
  %71 = getelementptr inbounds %struct.msourcecf_s, ptr %70, i32 0, i32 8
  store ptr %69, ptr %71, align 8, !tbaa !24
  %72 = load ptr, ptr %8, align 8, !tbaa !11
  %73 = getelementptr inbounds %struct.msourcecf_s, ptr %72, i32 0, i32 3
  %74 = load i32, ptr %73, align 8, !tbaa !18
  %75 = udiv i32 %74, 2
  %76 = load ptr, ptr %8, align 8, !tbaa !11
  %77 = getelementptr inbounds %struct.msourcecf_s, ptr %76, i32 0, i32 9
  store i32 %75, ptr %77, align 8, !tbaa !25
  %78 = load ptr, ptr %8, align 8, !tbaa !11
  %79 = getelementptr inbounds %struct.msourcecf_s, ptr %78, i32 0, i32 10
  store i32 0, ptr %79, align 4, !tbaa !26
  %80 = load ptr, ptr %8, align 8, !tbaa !11
  %81 = call i32 @msourcecf_reset(ptr noundef %80)
  %82 = load ptr, ptr %8, align 8, !tbaa !11
  store ptr %82, ptr %4, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %83

83:                                               ; preds = %24, %22, %17, %11
  %84 = load ptr, ptr %4, align 8
  ret ptr %84
}

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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @msourcecf_reset(ptr noundef) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #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, !12, i64 0}
!14 = !{!"msourcecf_s", !12, i64 0, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !10, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !6, i64 56, !6, i64 60, !15, i64 64}
!15 = !{!"long long", !7, i64 0}
!16 = !{!14, !6, i64 8}
!17 = !{!14, !6, i64 12}
!18 = !{!14, !6, i64 16}
!19 = !{!14, !6, i64 20}
!20 = !{!14, !10, i64 24}
!21 = !{!14, !15, i64 64}
!22 = !{!14, !12, i64 32}
!23 = !{!14, !12, i64 40}
!24 = !{!14, !12, i64 48}
!25 = !{!14, !6, i64 56}
!26 = !{!14, !6, i64 60}


; 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 [86 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [65 x i8], align 1

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

5:                                                ; preds = %3
  %6 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str, i32 noundef 80, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2) #4
  br label %35

7:                                                ; preds = %3
  %8 = and i32 %0, 1
  %.not = icmp eq i32 %8, 0
  br i1 %.not, label %11, label %9

9:                                                ; preds = %7
  %10 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str, i32 noundef 82, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.2) #4
  br label %35

11:                                               ; preds = %7
  %12 = icmp eq i32 %1, 0
  br i1 %12, label %13, label %15

13:                                               ; preds = %11
  %14 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str, i32 noundef 84, ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.2) #4
  br label %35

15:                                               ; preds = %11
  %16 = tail call noalias dereferenceable_or_null(72) ptr @malloc(i64 noundef 72) #5
  %17 = getelementptr inbounds i8, ptr %16, i64 16
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %16, i8 0, i64 16, i1 false)
  store i32 %0, ptr %17, align 8, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %16, i64 20
  store i32 %1, ptr %18, align 4, !tbaa !13
  %19 = getelementptr inbounds i8, ptr %16, i64 24
  store float %2, ptr %19, align 8, !tbaa !14
  %20 = getelementptr inbounds i8, ptr %16, i64 64
  store i64 0, ptr %20, align 8, !tbaa !15
  %21 = tail call ptr @firpfbch2_crcf_create_kaiser(i32 noundef 1, i32 noundef %0, i32 noundef %1, float noundef %2) #4
  %22 = getelementptr inbounds i8, ptr %16, i64 32
  store ptr %21, ptr %22, align 8, !tbaa !16
  %23 = zext i32 %0 to i64
  %24 = shl nuw nsw i64 %23, 3
  %25 = tail call noalias ptr @malloc(i64 noundef %24) #5
  %26 = getelementptr inbounds i8, ptr %16, i64 40
  store ptr %25, ptr %26, align 8, !tbaa !17
  %27 = lshr exact i32 %0, 1
  %28 = zext nneg i32 %27 to i64
  %29 = shl nuw nsw i64 %28, 3
  %30 = tail call noalias ptr @malloc(i64 noundef %29) #5
  %31 = getelementptr inbounds i8, ptr %16, i64 48
  store ptr %30, ptr %31, align 8, !tbaa !18
  %32 = getelementptr inbounds i8, ptr %16, i64 56
  store i32 %27, ptr %32, align 8, !tbaa !19
  %33 = getelementptr inbounds i8, ptr %16, i64 60
  store i32 0, ptr %33, align 4, !tbaa !20
  %34 = tail call i32 @msourcecf_reset(ptr noundef nonnull %16)
  br label %35

35:                                               ; preds = %15, %13, %9, %5
  %.0 = phi ptr [ %6, %5 ], [ %10, %9 ], [ %14, %13 ], [ %16, %15 ]
  ret ptr %.0
}

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

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 = { "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 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !10, i64 16}
!6 = !{!"msourcecf_s", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !11, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !10, i64 56, !10, i64 60, !12, i64 64}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{!"long long", !8, i64 0}
!13 = !{!6, !10, i64 20}
!14 = !{!6, !11, i64 24}
!15 = !{!6, !12, i64 64}
!16 = !{!6, !7, i64 32}
!17 = !{!6, !7, i64 40}
!18 = !{!6, !7, i64 48}
!19 = !{!6, !10, i64 56}
!20 = !{!6, !10, i64 60}


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