; LLVM IR from lfarcaro/ARINC653_ARMV7A_AM335X :: ARINC653_PORT (ethernet)

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

; Function Attrs: nounwind uwtable
define dso_local void @ETHERNET_ALE_MAKEVLANTABLEENTRY(ptr noundef %0, i32 noundef %1, i8 noundef zeroext %2, i8 noundef zeroext %3, i8 noundef zeroext %4, i8 noundef zeroext %5) #0 {
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i8, align 1
  %10 = alloca i8, align 1
  %11 = alloca i8, align 1
  %12 = alloca i8, align 1
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !9
  store i8 %2, ptr %9, align 1, !tbaa !11
  store i8 %3, ptr %10, align 1, !tbaa !11
  store i8 %4, ptr %11, align 1, !tbaa !11
  store i8 %5, ptr %12, align 1, !tbaa !11
  %13 = load ptr, ptr %7, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct._ETHERNET_ALE_ENTRY, ptr %13, i32 0, i32 0
  store i32 0, ptr %14, align 4, !tbaa !12
  %15 = load ptr, ptr %7, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct._ETHERNET_ALE_ENTRY, ptr %15, i32 0, i32 1
  store i32 0, ptr %16, align 4, !tbaa !14
  %17 = load ptr, ptr %7, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct._ETHERNET_ALE_ENTRY, ptr %17, i32 0, i32 2
  store i32 0, ptr %18, align 4, !tbaa !15
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct._ETHERNET_ALE_ENTRY, ptr %19, i32 0, i32 1
  %21 = load i32, ptr %20, align 4, !tbaa !14
  %22 = or i32 %21, 536870912
  store i32 %22, ptr %20, align 4, !tbaa !14
  %23 = load i32, ptr %8, align 4, !tbaa !9
  %24 = shl i32 %23, 16
  %25 = and i32 %24, 268369920
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct._ETHERNET_ALE_ENTRY, ptr %26, i32 0, i32 1
  %28 = load i32, ptr %27, align 4, !tbaa !14
  %29 = or i32 %28, %25
  store i32 %29, ptr %27, align 4, !tbaa !14
  %30 = load i8, ptr %9, align 1, !tbaa !11
  %31 = zext i8 %30 to i32
  %32 = shl i32 %31, 24
  %33 = and i32 %32, 117440512
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct._ETHERNET_ALE_ENTRY, ptr %34, i32 0, i32 0
  %36 = load i32, ptr %35, align 4, !tbaa !12
  %37 = or i32 %36, %33
  store i32 %37, ptr %35, align 4, !tbaa !12
  %38 = load i8, ptr %10, align 1, !tbaa !11
  %39 = zext i8 %38 to i32
  %40 = shl i32 %39, 16
  %41 = and i32 %40, 458752
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct._ETHERNET_ALE_ENTRY, ptr %42, i32 0, i32 0
  %44 = load i32, ptr %43, align 4, !tbaa !12
  %45 = or i32 %44, %41
  store i32 %45, ptr %43, align 4, !tbaa !12
  %46 = load i8, ptr %11, align 1, !tbaa !11
  %47 = zext i8 %46 to i32
  %48 = shl i32 %47, 8
  %49 = and i32 %48, 1792
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct._ETHERNET_ALE_ENTRY, ptr %50, i32 0, i32 0
  %52 = load i32, ptr %51, align 4, !tbaa !12
  %53 = or i32 %52, %49
  store i32 %53, ptr %51, align 4, !tbaa !12
  %54 = load i8, ptr %12, align 1, !tbaa !11
  %55 = zext i8 %54 to i32
  %56 = shl i32 %55, 0
  %57 = and i32 %56, 7
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct._ETHERNET_ALE_ENTRY, ptr %58, i32 0, i32 0
  %60 = load i32, ptr %59, align 4, !tbaa !12
  %61 = or i32 %60, %57
  store i32 %61, ptr %59, align 4, !tbaa !12
  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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !10, i64 0}
!13 = !{!"_ETHERNET_ALE_ENTRY", !10, i64 0, !10, i64 4, !10, i64 8}
!14 = !{!13, !10, i64 4}
!15 = !{!13, !10, 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"

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local void @ETHERNET_ALE_MAKEVLANTABLEENTRY(ptr nocapture noundef writeonly %0, i32 noundef %1, i8 noundef zeroext %2, i8 noundef zeroext %3, i8 noundef zeroext %4, i8 noundef zeroext %5) local_unnamed_addr #0 {
  %7 = getelementptr inbounds i8, ptr %0, i64 4
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 0, ptr %8, align 4, !tbaa !5
  %9 = shl i32 %1, 16
  %10 = and i32 %9, 268369920
  %11 = or disjoint i32 %10, 536870912
  store i32 %11, ptr %7, align 4, !tbaa !10
  %12 = zext i8 %2 to i32
  %13 = shl nuw i32 %12, 24
  %14 = and i32 %13, 117440512
  %15 = zext i8 %3 to i32
  %16 = shl nuw nsw i32 %15, 16
  %17 = and i32 %16, 458752
  %18 = or disjoint i32 %17, %14
  %19 = zext i8 %4 to i32
  %20 = shl nuw nsw i32 %19, 8
  %21 = and i32 %20, 1792
  %22 = or disjoint i32 %18, %21
  %23 = and i8 %5, 7
  %24 = zext nneg i8 %23 to i32
  %25 = or disjoint i32 %22, %24
  store i32 %25, ptr %0, align 4, !tbaa !11
  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 8}
!6 = !{!"_ETHERNET_ALE_ENTRY", !7, i64 0, !7, i64 4, !7, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 4}
!11 = !{!6, !7, i64 0}


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