; LLVM IR from mlcommons/tiny :: benchmark/reference_submissions/streaming_wakeword/sww_testing_l4r5zi/X-CUBE-AI_ (get)

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

; Function Attrs: nounwind uwtable
define dso_local void @ai_sww_model_data_activations_buffer_get(ptr dead_on_unwind noalias writable sret(%struct.ai_buffer_) align 8 %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca [4 x i32], align 4
  store ptr %1, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds %struct.ai_buffer_, ptr %0, i32 0, i32 0
  store i32 263232, ptr %5, align 8, !tbaa !9
  %6 = getelementptr inbounds %struct.ai_buffer_, ptr %0, i32 0, i32 1
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %7, ptr %6, align 8, !tbaa !13
  %8 = getelementptr inbounds %struct.ai_buffer_, ptr %0, i32 0, i32 2
  store ptr null, ptr %8, align 8, !tbaa !14
  %9 = getelementptr inbounds %struct.ai_buffer_, ptr %0, i32 0, i32 3
  store i32 0, ptr %9, align 8, !tbaa !15
  %10 = getelementptr inbounds %struct.ai_buffer_, ptr %0, i32 0, i32 4
  store i32 5836, ptr %10, align 4, !tbaa !16
  %11 = getelementptr inbounds %struct.ai_buffer_, ptr %0, i32 0, i32 5
  %12 = load i32, ptr %11, align 8
  %13 = and i32 %12, -256
  %14 = or i32 %13, 1
  store i32 %14, ptr %11, align 8
  %15 = load i32, ptr %11, align 8
  %16 = and i32 %15, 255
  %17 = or i32 %16, 1024
  store i32 %17, ptr %11, align 8
  %18 = getelementptr inbounds %struct.ai_buffer_shape_, ptr %11, i32 0, i32 1
  store i32 1, ptr %4, align 4, !tbaa !17
  %19 = getelementptr inbounds i32, ptr %4, i64 1
  store i32 5836, ptr %19, align 4, !tbaa !17
  %20 = getelementptr inbounds i32, ptr %4, i64 2
  store i32 1, ptr %20, align 4, !tbaa !17
  %21 = getelementptr inbounds i32, ptr %4, i64 3
  store i32 1, ptr %21, align 4, !tbaa !17
  %22 = getelementptr inbounds [4 x i32], ptr %4, i64 0, i64 0
  store ptr %22, ptr %18, align 8, !tbaa !18
  ret void
}

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

!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 0}
!10 = !{!"ai_buffer_", !11, i64 0, !6, i64 8, !6, i64 16, !11, i64 24, !11, i64 28, !12, i64 32}
!11 = !{!"int", !7, i64 0}
!12 = !{!"ai_buffer_shape_", !11, i64 0, !11, i64 1, !6, i64 8}
!13 = !{!10, !6, i64 8}
!14 = !{!10, !6, i64 16}
!15 = !{!10, !11, i64 24}
!16 = !{!10, !11, i64 28}
!17 = !{!11, !11, i64 0}
!18 = !{!12, !6, i64 8}


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

%struct.ai_buffer_ = type { i32, ptr, ptr, i32, i32, %struct.ai_buffer_shape_ }
%struct.ai_buffer_shape_ = type { i32, ptr }

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local void @ai_sww_model_data_activations_buffer_get(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.ai_buffer_) align 8 %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca [4 x i32], align 4
  store i32 263232, ptr %0, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  store ptr %1, ptr %4, align 8, !tbaa !12
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  store ptr null, ptr %5, align 8, !tbaa !13
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  store i32 0, ptr %6, align 8, !tbaa !14
  %7 = getelementptr inbounds i8, ptr %0, i64 28
  store i32 5836, ptr %7, align 4, !tbaa !15
  %8 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 1025, ptr %8, align 8
  %9 = getelementptr inbounds i8, ptr %0, i64 40
  store ptr %3, ptr %9, align 8, !tbaa !16
  ret void
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) 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" }

!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 = !{!"ai_buffer_", !7, i64 0, !10, i64 8, !10, i64 16, !7, i64 24, !7, i64 28, !11, i64 32}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"ai_buffer_shape_", !7, i64 0, !7, i64 1, !10, i64 8}
!12 = !{!6, !10, i64 8}
!13 = !{!6, !10, i64 16}
!14 = !{!6, !7, i64 24}
!15 = !{!6, !7, i64 28}
!16 = !{!11, !10, i64 8}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass