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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @gmskframegen_create_set(i32 noundef %0, i32 noundef %1, float noundef %2) #0 {
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca float, align 4
  %7 = alloca ptr, align 8
  store i32 %0, ptr %4, align 4, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !5
  store float %2, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %8 = call noalias ptr @malloc(i64 noundef 152) #5
  store ptr %8, ptr %7, align 8, !tbaa !11
  %9 = load i32, ptr %4, align 4, !tbaa !5
  %10 = load ptr, ptr %7, align 8, !tbaa !11
  %11 = getelementptr inbounds %struct.gmskframegen_s, ptr %10, i32 0, i32 1
  store i32 %9, ptr %11, align 8, !tbaa !13
  %12 = load i32, ptr %5, align 4, !tbaa !5
  %13 = load ptr, ptr %7, align 8, !tbaa !11
  %14 = getelementptr inbounds %struct.gmskframegen_s, ptr %13, i32 0, i32 2
  store i32 %12, ptr %14, align 4, !tbaa !15
  %15 = load float, ptr %6, align 4, !tbaa !9
  %16 = load ptr, ptr %7, align 8, !tbaa !11
  %17 = getelementptr inbounds %struct.gmskframegen_s, ptr %16, i32 0, i32 3
  store float %15, ptr %17, align 8, !tbaa !16
  %18 = load ptr, ptr %7, align 8, !tbaa !11
  %19 = getelementptr inbounds %struct.gmskframegen_s, ptr %18, i32 0, i32 4
  store i32 63, ptr %19, align 4, !tbaa !17
  %20 = load ptr, ptr %7, align 8, !tbaa !11
  %21 = getelementptr inbounds %struct.gmskframegen_s, ptr %20, i32 0, i32 6
  store i32 0, ptr %21, align 4, !tbaa !18
  %22 = load ptr, ptr %7, align 8, !tbaa !11
  %23 = getelementptr inbounds %struct.gmskframegen_s, ptr %22, i32 0, i32 2
  %24 = load i32, ptr %23, align 4, !tbaa !15
  %25 = mul i32 2, %24
  %26 = load ptr, ptr %7, align 8, !tbaa !11
  %27 = getelementptr inbounds %struct.gmskframegen_s, ptr %26, i32 0, i32 7
  store i32 %25, ptr %27, align 8, !tbaa !19
  %28 = load ptr, ptr %7, align 8, !tbaa !11
  %29 = getelementptr inbounds %struct.gmskframegen_s, ptr %28, i32 0, i32 1
  %30 = load i32, ptr %29, align 8, !tbaa !13
  %31 = load ptr, ptr %7, align 8, !tbaa !11
  %32 = getelementptr inbounds %struct.gmskframegen_s, ptr %31, i32 0, i32 2
  %33 = load i32, ptr %32, align 4, !tbaa !15
  %34 = load ptr, ptr %7, align 8, !tbaa !11
  %35 = getelementptr inbounds %struct.gmskframegen_s, ptr %34, i32 0, i32 3
  %36 = load float, ptr %35, align 8, !tbaa !16
  %37 = call ptr @gmskmod_create(i32 noundef %30, i32 noundef %33, float noundef %36)
  %38 = load ptr, ptr %7, align 8, !tbaa !11
  %39 = getelementptr inbounds %struct.gmskframegen_s, ptr %38, i32 0, i32 0
  store ptr %37, ptr %39, align 8, !tbaa !20
  %40 = call ptr @msequence_create(i32 noundef 6, i32 noundef 109, i32 noundef 1)
  %41 = load ptr, ptr %7, align 8, !tbaa !11
  %42 = getelementptr inbounds %struct.gmskframegen_s, ptr %41, i32 0, i32 8
  store ptr %40, ptr %42, align 8, !tbaa !21
  %43 = load ptr, ptr %7, align 8, !tbaa !11
  %44 = call i32 @gmskframegen_reset(ptr noundef %43)
  %45 = load ptr, ptr %7, align 8, !tbaa !11
  %46 = getelementptr inbounds %struct.gmskframegen_s, ptr %45, i32 0, i32 11
  store ptr null, ptr %46, align 8, !tbaa !22
  %47 = load ptr, ptr %7, align 8, !tbaa !11
  %48 = getelementptr inbounds %struct.gmskframegen_s, ptr %47, i32 0, i32 12
  store ptr null, ptr %48, align 8, !tbaa !23
  %49 = load ptr, ptr %7, align 8, !tbaa !11
  %50 = getelementptr inbounds %struct.gmskframegen_s, ptr %49, i32 0, i32 13
  store ptr null, ptr %50, align 8, !tbaa !24
  %51 = load ptr, ptr %7, align 8, !tbaa !11
  %52 = call i32 @gmskframegen_set_header_len(ptr noundef %51, i32 noundef 8)
  %53 = load ptr, ptr %7, align 8, !tbaa !11
  %54 = getelementptr inbounds %struct.gmskframegen_s, ptr %53, i32 0, i32 18
  store i32 0, ptr %54, align 4, !tbaa !25
  %55 = load ptr, ptr %7, align 8, !tbaa !11
  %56 = getelementptr inbounds %struct.gmskframegen_s, ptr %55, i32 0, i32 15
  store i32 6, ptr %56, align 8, !tbaa !26
  %57 = load ptr, ptr %7, align 8, !tbaa !11
  %58 = getelementptr inbounds %struct.gmskframegen_s, ptr %57, i32 0, i32 16
  store i32 1, ptr %58, align 4, !tbaa !27
  %59 = load ptr, ptr %7, align 8, !tbaa !11
  %60 = getelementptr inbounds %struct.gmskframegen_s, ptr %59, i32 0, i32 17
  store i32 1, ptr %60, align 8, !tbaa !28
  %61 = load ptr, ptr %7, align 8, !tbaa !11
  %62 = getelementptr inbounds %struct.gmskframegen_s, ptr %61, i32 0, i32 18
  %63 = load i32, ptr %62, align 4, !tbaa !25
  %64 = load ptr, ptr %7, align 8, !tbaa !11
  %65 = getelementptr inbounds %struct.gmskframegen_s, ptr %64, i32 0, i32 15
  %66 = load i32, ptr %65, align 8, !tbaa !26
  %67 = load ptr, ptr %7, align 8, !tbaa !11
  %68 = getelementptr inbounds %struct.gmskframegen_s, ptr %67, i32 0, i32 16
  %69 = load i32, ptr %68, align 4, !tbaa !27
  %70 = load ptr, ptr %7, align 8, !tbaa !11
  %71 = getelementptr inbounds %struct.gmskframegen_s, ptr %70, i32 0, i32 17
  %72 = load i32, ptr %71, align 8, !tbaa !28
  %73 = call ptr @packetizer_create(i32 noundef %63, i32 noundef %66, i32 noundef %69, i32 noundef %72)
  %74 = load ptr, ptr %7, align 8, !tbaa !11
  %75 = getelementptr inbounds %struct.gmskframegen_s, ptr %74, i32 0, i32 14
  store ptr %73, ptr %75, align 8, !tbaa !29
  %76 = load ptr, ptr %7, align 8, !tbaa !11
  %77 = getelementptr inbounds %struct.gmskframegen_s, ptr %76, i32 0, i32 14
  %78 = load ptr, ptr %77, align 8, !tbaa !29
  %79 = call i32 @packetizer_get_enc_msg_len(ptr noundef %78)
  %80 = load ptr, ptr %7, align 8, !tbaa !11
  %81 = getelementptr inbounds %struct.gmskframegen_s, ptr %80, i32 0, i32 19
  store i32 %79, ptr %81, align 8, !tbaa !30
  %82 = load ptr, ptr %7, align 8, !tbaa !11
  %83 = getelementptr inbounds %struct.gmskframegen_s, ptr %82, i32 0, i32 19
  %84 = load i32, ptr %83, align 8, !tbaa !30
  %85 = mul i32 8, %84
  %86 = load ptr, ptr %7, align 8, !tbaa !11
  %87 = getelementptr inbounds %struct.gmskframegen_s, ptr %86, i32 0, i32 6
  store i32 %85, ptr %87, align 4, !tbaa !18
  %88 = load ptr, ptr %7, align 8, !tbaa !11
  %89 = getelementptr inbounds %struct.gmskframegen_s, ptr %88, i32 0, i32 19
  %90 = load i32, ptr %89, align 8, !tbaa !30
  %91 = zext i32 %90 to i64
  %92 = mul i64 %91, 1
  %93 = call noalias ptr @malloc(i64 noundef %92) #5
  %94 = load ptr, ptr %7, align 8, !tbaa !11
  %95 = getelementptr inbounds %struct.gmskframegen_s, ptr %94, i32 0, i32 20
  store ptr %93, ptr %95, align 8, !tbaa !31
  %96 = load ptr, ptr %7, align 8, !tbaa !11
  %97 = getelementptr inbounds %struct.gmskframegen_s, ptr %96, i32 0, i32 1
  %98 = load i32, ptr %97, align 8, !tbaa !13
  %99 = zext i32 %98 to i64
  %100 = mul i64 %99, 8
  %101 = call noalias ptr @malloc(i64 noundef %100) #5
  %102 = load ptr, ptr %7, align 8, !tbaa !11
  %103 = getelementptr inbounds %struct.gmskframegen_s, ptr %102, i32 0, i32 25
  store ptr %101, ptr %103, align 8, !tbaa !32
  %104 = load ptr, ptr %7, align 8, !tbaa !11
  %105 = call i32 @gmskframegen_reset(ptr noundef %104)
  %106 = load ptr, ptr %7, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  ret ptr %106
}

; 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

declare ptr @gmskmod_create(i32 noundef, i32 noundef, float noundef) #3

declare ptr @msequence_create(i32 noundef, i32 noundef, i32 noundef) #3

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

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

declare ptr @packetizer_create(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #3

declare i32 @packetizer_get_enc_msg_len(ptr noundef) #3

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

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 = { 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 = { "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 8}
!14 = !{!"gmskframegen_s", !12, i64 0, !6, i64 8, !6, i64 12, !10, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !6, i64 32, !12, i64 40, !6, i64 48, !6, i64 52, !12, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !6, i64 88, !6, i64 92, !6, i64 96, !6, i64 100, !6, i64 104, !12, i64 112, !6, i64 120, !6, i64 124, !6, i64 128, !6, i64 132, !12, i64 136, !6, i64 144}
!15 = !{!14, !6, i64 12}
!16 = !{!14, !10, i64 16}
!17 = !{!14, !6, i64 20}
!18 = !{!14, !6, i64 28}
!19 = !{!14, !6, i64 32}
!20 = !{!14, !12, i64 0}
!21 = !{!14, !12, i64 40}
!22 = !{!14, !12, i64 56}
!23 = !{!14, !12, i64 64}
!24 = !{!14, !12, i64 72}
!25 = !{!14, !6, i64 100}
!26 = !{!14, !6, i64 88}
!27 = !{!14, !6, i64 92}
!28 = !{!14, !6, i64 96}
!29 = !{!14, !12, i64 80}
!30 = !{!14, !6, i64 104}
!31 = !{!14, !12, i64 112}
!32 = !{!14, !12, i64 136}


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

; Function Attrs: nounwind uwtable
define dso_local noundef ptr @gmskframegen_create_set(i32 noundef %0, i32 noundef %1, float noundef %2) local_unnamed_addr #0 {
  %4 = tail call noalias dereferenceable_or_null(152) ptr @malloc(i64 noundef 152) #4
  %5 = getelementptr inbounds i8, ptr %4, i64 8
  store i32 %0, ptr %5, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %4, i64 12
  store i32 %1, ptr %6, align 4, !tbaa !12
  %7 = getelementptr inbounds i8, ptr %4, i64 16
  store float %2, ptr %7, align 8, !tbaa !13
  %8 = getelementptr inbounds i8, ptr %4, i64 20
  store i32 63, ptr %8, align 4, !tbaa !14
  %9 = getelementptr inbounds i8, ptr %4, i64 28
  store i32 0, ptr %9, align 4, !tbaa !15
  %10 = shl i32 %1, 1
  %11 = getelementptr inbounds i8, ptr %4, i64 32
  store i32 %10, ptr %11, align 8, !tbaa !16
  %12 = tail call ptr @gmskmod_create(i32 noundef %0, i32 noundef %1, float noundef %2) #5
  store ptr %12, ptr %4, align 8, !tbaa !17
  %13 = tail call ptr @msequence_create(i32 noundef 6, i32 noundef 109, i32 noundef 1) #5
  %14 = getelementptr inbounds i8, ptr %4, i64 40
  store ptr %13, ptr %14, align 8, !tbaa !18
  %15 = tail call i32 @gmskframegen_reset(ptr noundef nonnull %4)
  %16 = getelementptr inbounds i8, ptr %4, i64 56
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %16, i8 0, i64 24, i1 false)
  %17 = tail call i32 @gmskframegen_set_header_len(ptr noundef nonnull %4, i32 noundef 8)
  %18 = getelementptr inbounds i8, ptr %4, i64 88
  store <4 x i32> <i32 6, i32 1, i32 1, i32 0>, ptr %18, align 8, !tbaa !19
  %19 = tail call ptr @packetizer_create(i32 noundef 0, i32 noundef 6, i32 noundef 1, i32 noundef 1) #5
  %20 = getelementptr inbounds i8, ptr %4, i64 80
  store ptr %19, ptr %20, align 8, !tbaa !20
  %21 = tail call i32 @packetizer_get_enc_msg_len(ptr noundef %19) #5
  %22 = getelementptr inbounds i8, ptr %4, i64 104
  store i32 %21, ptr %22, align 8, !tbaa !21
  %23 = shl i32 %21, 3
  store i32 %23, ptr %9, align 4, !tbaa !15
  %24 = zext i32 %21 to i64
  %25 = tail call noalias ptr @malloc(i64 noundef %24) #4
  %26 = getelementptr inbounds i8, ptr %4, i64 112
  store ptr %25, ptr %26, align 8, !tbaa !22
  %27 = load i32, ptr %5, align 8, !tbaa !5
  %28 = zext i32 %27 to i64
  %29 = shl nuw nsw i64 %28, 3
  %30 = tail call noalias ptr @malloc(i64 noundef %29) #4
  %31 = getelementptr inbounds i8, ptr %4, i64 136
  store ptr %30, ptr %31, align 8, !tbaa !23
  %32 = tail call i32 @gmskframegen_reset(ptr noundef nonnull %4)
  ret ptr %4
}

; 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 @gmskmod_create(i32 noundef, i32 noundef, float noundef) local_unnamed_addr #2

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

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

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

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

declare i32 @packetizer_get_enc_msg_len(ptr noundef) local_unnamed_addr #2

; 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 = { 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 = { "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 allocsize(0) }
attributes #5 = { 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, !10, i64 8}
!6 = !{!"gmskframegen_s", !7, i64 0, !10, i64 8, !10, i64 12, !11, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !7, i64 40, !10, i64 48, !10, i64 52, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !10, i64 88, !10, i64 92, !10, i64 96, !10, i64 100, !10, i64 104, !7, i64 112, !10, i64 120, !10, i64 124, !10, i64 128, !10, i64 132, !7, i64 136, !10, i64 144}
!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 = !{!6, !10, i64 12}
!13 = !{!6, !11, i64 16}
!14 = !{!6, !10, i64 20}
!15 = !{!6, !10, i64 28}
!16 = !{!6, !10, i64 32}
!17 = !{!6, !7, i64 0}
!18 = !{!6, !7, i64 40}
!19 = !{!10, !10, i64 0}
!20 = !{!6, !7, i64 80}
!21 = !{!6, !10, i64 104}
!22 = !{!6, !7, i64 112}
!23 = !{!6, !7, i64 136}


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