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

; 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.ofdmflexframegen_s = type { i32, i32, i32, ptr, i32, i32, i32, i32, i32, i32, ptr, ptr, i32, ptr, i32, i32, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, ptr, i32, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, %struct.ofdmflexframegenprops_s, %struct.ofdmflexframegenprops_s }
%struct.ofdmflexframegenprops_s = type { i32, i32, i32, i32 }

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

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

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

declare i32 @packetizer_encode(ptr noundef, ptr noundef, ptr noundef) #2

declare void @scramble_data(ptr noundef, i32 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 128}
!10 = !{!"ofdmflexframegen_s", !11, i64 0, !11, i64 4, !11, i64 8, !6, i64 16, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !6, i64 48, !6, i64 56, !11, i64 64, !6, i64 72, !11, i64 80, !11, i64 84, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !11, i64 128, !11, i64 132, !11, i64 136, !11, i64 140, !6, i64 144, !11, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !11, i64 184, !11, i64 188, !11, i64 192, !11, i64 196, !11, i64 200, !11, i64 204, !11, i64 208, !11, i64 212, !12, i64 216, !12, i64 232}
!11 = !{!"int", !7, i64 0}
!12 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12}
!13 = !{!11, !11, i64 0}
!14 = !{!10, !6, i64 104}
!15 = !{!7, !7, i64 0}
!16 = !{!10, !11, i64 152}
!17 = !{!10, !11, i64 228}
!18 = !{!10, !11, i64 216}
!19 = !{!10, !11, i64 220}
!20 = !{!10, !11, i64 224}
!21 = !{!10, !6, i64 96}
!22 = !{!10, !6, i64 112}
!23 = !{!10, !11, 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 i32 @ofdmflexframegen_encode_header(ptr nocapture noundef readonly %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 128
  %3 = load i32, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 104
  %5 = load ptr, ptr %4, align 8, !tbaa !12
  %6 = zext i32 %3 to i64
  %7 = getelementptr inbounds i8, ptr %5, i64 %6
  store i8 105, ptr %7, align 1, !tbaa !13
  %8 = getelementptr inbounds i8, ptr %0, i64 152
  %9 = load i32, ptr %8, align 8, !tbaa !14
  %10 = lshr i32 %9, 8
  %11 = trunc i32 %10 to i8
  %12 = load ptr, ptr %4, align 8, !tbaa !12
  %13 = add i32 %3, 1
  %14 = zext i32 %13 to i64
  %15 = getelementptr inbounds i8, ptr %12, i64 %14
  store i8 %11, ptr %15, align 1, !tbaa !13
  %16 = load i32, ptr %8, align 8, !tbaa !14
  %17 = trunc i32 %16 to i8
  %18 = load ptr, ptr %4, align 8, !tbaa !12
  %19 = add i32 %3, 2
  %20 = zext i32 %19 to i64
  %21 = getelementptr inbounds i8, ptr %18, i64 %20
  store i8 %17, ptr %21, align 1, !tbaa !13
  %22 = getelementptr inbounds i8, ptr %0, i64 216
  %23 = getelementptr inbounds i8, ptr %0, i64 228
  %24 = load i32, ptr %23, align 4, !tbaa !15
  %25 = trunc i32 %24 to i8
  %26 = load ptr, ptr %4, align 8, !tbaa !12
  %27 = add i32 %3, 3
  %28 = zext i32 %27 to i64
  %29 = getelementptr inbounds i8, ptr %26, i64 %28
  store i8 %25, ptr %29, align 1, !tbaa !13
  %30 = load i32, ptr %22, align 8, !tbaa !16
  %.tr = trunc i32 %30 to i8
  %31 = shl i8 %.tr, 5
  %32 = load ptr, ptr %4, align 8, !tbaa !12
  %33 = add i32 %3, 4
  %34 = zext i32 %33 to i64
  %35 = getelementptr inbounds i8, ptr %32, i64 %34
  store i8 %31, ptr %35, align 1, !tbaa !13
  %36 = getelementptr inbounds i8, ptr %0, i64 220
  %37 = load i32, ptr %36, align 4, !tbaa !17
  %38 = load ptr, ptr %4, align 8, !tbaa !12
  %39 = getelementptr inbounds i8, ptr %38, i64 %34
  %40 = load i8, ptr %39, align 1, !tbaa !13
  %41 = trunc i32 %37 to i8
  %42 = and i8 %41, 31
  %43 = or i8 %42, %40
  store i8 %43, ptr %39, align 1, !tbaa !13
  %44 = getelementptr inbounds i8, ptr %0, i64 224
  %45 = load i32, ptr %44, align 8, !tbaa !18
  %46 = trunc i32 %45 to i8
  %47 = and i8 %46, 31
  %48 = load ptr, ptr %4, align 8, !tbaa !12
  %49 = add i32 %3, 5
  %50 = zext i32 %49 to i64
  %51 = getelementptr inbounds i8, ptr %48, i64 %50
  store i8 %47, ptr %51, align 1, !tbaa !13
  %52 = getelementptr inbounds i8, ptr %0, i64 96
  %53 = load ptr, ptr %52, align 8, !tbaa !19
  %54 = load ptr, ptr %4, align 8, !tbaa !12
  %55 = getelementptr inbounds i8, ptr %0, i64 112
  %56 = load ptr, ptr %55, align 8, !tbaa !20
  %57 = tail call i32 @packetizer_encode(ptr noundef %53, ptr noundef %54, ptr noundef %56) #2
  %58 = load ptr, ptr %55, align 8, !tbaa !20
  %59 = getelementptr inbounds i8, ptr %0, i64 136
  %60 = load i32, ptr %59, align 8, !tbaa !21
  tail call void @scramble_data(ptr noundef %58, i32 noundef %60) #2
  ret i32 0
}

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

declare void @scramble_data(ptr noundef, i32 noundef) local_unnamed_addr #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 = { "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 }

!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 128}
!6 = !{!"ofdmflexframegen_s", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !7, i64 24, !7, i64 28, !7, i64 32, !7, i64 36, !7, i64 40, !7, i64 44, !10, i64 48, !10, i64 56, !7, i64 64, !10, i64 72, !7, i64 80, !7, i64 84, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !7, i64 128, !7, i64 132, !7, i64 136, !7, i64 140, !10, i64 144, !7, i64 152, !10, i64 160, !10, i64 168, !10, i64 176, !7, i64 184, !7, i64 188, !7, i64 192, !7, i64 196, !7, i64 200, !7, i64 204, !7, i64 208, !7, i64 212, !11, i64 216, !11, i64 232}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12}
!12 = !{!6, !10, i64 104}
!13 = !{!8, !8, i64 0}
!14 = !{!6, !7, i64 152}
!15 = !{!6, !7, i64 228}
!16 = !{!6, !7, i64 216}
!17 = !{!6, !7, i64 220}
!18 = !{!6, !7, i64 224}
!19 = !{!6, !10, i64 96}
!20 = !{!6, !10, i64 112}
!21 = !{!6, !7, i64 136}


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