; LLVM IR from jgaeddert/liquid-dsp :: src/modem/src (gmskmod)

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

@.str = external hidden unnamed_addr constant [78 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [58 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local ptr @gmskmod_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 56, ptr noundef @.str.1)
  store ptr %12, ptr %4, align 8
  br label %91

13:                                               ; preds = %3
  %14 = load i32, ptr %6, align 4, !tbaa !5
  %15 = icmp ult i32 %14, 1
  br i1 %15, label %16, label %18

16:                                               ; preds = %13
  %17 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str, i32 noundef 58, ptr noundef @.str.2)
  store ptr %17, ptr %4, align 8
  br label %91

18:                                               ; preds = %13
  %19 = load float, ptr %7, align 4, !tbaa !9
  %20 = fcmp ole float %19, 0.000000e+00
  br i1 %20, label %24, label %21

21:                                               ; preds = %18
  %22 = load float, ptr %7, align 4, !tbaa !9
  %23 = fcmp oge float %22, 1.000000e+00
  br i1 %23, label %24, label %26

24:                                               ; preds = %21, %18
  %25 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str, i32 noundef 60, ptr noundef @.str.3)
  store ptr %25, ptr %4, align 8
  br label %91

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

91:                                               ; preds = %26, %24, %16, %11
  %92 = load ptr, ptr %4, align 8
  ret ptr %92
}

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 i32 @liquid_firdes_gmsktx(i32 noundef, i32 noundef, float noundef, float noundef, ptr noundef) #1

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @gmskmod_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, !6, i64 0}
!14 = !{!"gmskmod_s", !6, i64 0, !6, i64 4, !10, i64 8, !6, i64 12, !12, i64 16, !12, i64 24, !10, i64 32, !10, i64 36}
!15 = !{!14, !6, i64 4}
!16 = !{!14, !10, i64 8}
!17 = !{!14, !10, i64 36}
!18 = !{!14, !6, i64 12}
!19 = !{!14, !12, i64 16}
!20 = !{!14, !12, i64 24}


; 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 [78 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [58 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local ptr @gmskmod_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 56, ptr noundef nonnull @.str.1) #3
  br label %35

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

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

11:                                               ; preds = %7
  %12 = fcmp ole float %2, 0.000000e+00
  %13 = fcmp oge float %2, 1.000000e+00
  %or.cond = or i1 %12, %13
  br i1 %or.cond, label %14, label %16

14:                                               ; preds = %11
  %15 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str, i32 noundef 60, ptr noundef nonnull @.str.3) #3
  br label %35

16:                                               ; preds = %11
  %17 = tail call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40) #4
  store i32 %0, ptr %17, align 8, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %17, i64 4
  store i32 %1, ptr %18, align 4, !tbaa !12
  %19 = getelementptr inbounds i8, ptr %17, i64 8
  store float %2, ptr %19, align 8, !tbaa !13
  %20 = uitofp i32 %0 to float
  %21 = fdiv float 1.000000e+00, %20
  %22 = getelementptr inbounds i8, ptr %17, i64 36
  store float %21, ptr %22, align 4, !tbaa !14
  %23 = shl i32 %0, 1
  %24 = mul i32 %23, %1
  %25 = or disjoint i32 %24, 1
  %26 = getelementptr inbounds i8, ptr %17, i64 12
  store i32 %25, ptr %26, align 4, !tbaa !15
  %27 = zext i32 %25 to i64
  %28 = shl nuw nsw i64 %27, 2
  %29 = tail call noalias ptr @malloc(i64 noundef %28) #4
  %30 = getelementptr inbounds i8, ptr %17, i64 16
  store ptr %29, ptr %30, align 8, !tbaa !16
  %31 = tail call i32 @liquid_firdes_gmsktx(i32 noundef %0, i32 noundef %1, float noundef %2, float noundef 0.000000e+00, ptr noundef %29) #3
  %32 = tail call ptr @firinterp_rrrf_create_prototype(i32 noundef 11, i32 noundef %0, i32 noundef %1, float noundef %2, float noundef 0.000000e+00) #3
  %33 = getelementptr inbounds i8, ptr %17, i64 24
  store ptr %32, ptr %33, align 8, !tbaa !17
  %34 = tail call i32 @gmskmod_reset(ptr noundef nonnull %17)
  br label %35

35:                                               ; preds = %16, %14, %9, %5
  %.0 = phi ptr [ %6, %5 ], [ %10, %9 ], [ %15, %14 ], [ %17, %16 ]
  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 i32 @liquid_firdes_gmsktx(i32 noundef, i32 noundef, float noundef, float noundef, ptr noundef) local_unnamed_addr #1

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

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

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 = { 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 = !{!"gmskmod_s", !7, i64 0, !7, i64 4, !10, i64 8, !7, i64 12, !11, i64 16, !11, i64 24, !10, i64 32, !10, i64 36}
!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, !10, i64 8}
!14 = !{!6, !10, i64 36}
!15 = !{!6, !7, i64 12}
!16 = !{!6, !11, i64 16}
!17 = !{!6, !11, i64 24}


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