; 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_CPSW_INSTANCE = type { i8, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, [1 x %struct._ETHERNET_CPSW_PORT] }
%struct._ETHERNET_CPSW_PORT = type { i8, i32, i32, i32, i8, i32, i32 }
%struct._ETHERNET_ALE_ENTRY = type { i32, i32, i32 }

@ETHERNET_CPSW_INSTANCES = external hidden global [1 x %struct._ETHERNET_CPSW_INSTANCE], align 16

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @ETHERNET_ALE_MAKEVLANUNICASTADDRESSTABLEENTRY(ptr noundef, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, i32 noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @ETHERNET_ALE_MAKEVLANTABLEENTRY(ptr noundef, i32 noundef, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext) #0

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

declare void @ETHERNET_HOOK_YIELD() #2

declare void @CPSWSlReset(i32 noundef) #2

declare void @CPSWALEPortStateSet(i32 noundef, i32 noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local zeroext i8 @ETHERNET_INITIALIZE_INSTANCE_PORT(i32 noundef %0, i32 noundef %1, i8 noundef zeroext %2, ptr noundef %3) #0 {
  %5 = alloca i8, align 1
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i8, align 1
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca %struct._ETHERNET_ALE_ENTRY, align 4
  %13 = alloca %struct._ETHERNET_ALE_ENTRY, align 4
  %14 = alloca i32, align 4
  store i32 %0, ptr %6, align 4, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !5
  store i8 %2, ptr %8, align 1, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 12, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 12, ptr %13) #3
  %15 = load i32, ptr %6, align 4, !tbaa !5
  %16 = icmp uge i32 %15, 1
  br i1 %16, label %17, label %18

17:                                               ; preds = %4
  store i8 0, ptr %5, align 1
  store i32 1, ptr %14, align 4
  br label %150

18:                                               ; preds = %4
  %19 = load i32, ptr %6, align 4, !tbaa !5
  %20 = zext i32 %19 to i64
  %21 = getelementptr inbounds [1 x %struct._ETHERNET_CPSW_INSTANCE], ptr @ETHERNET_CPSW_INSTANCES, i64 0, i64 %20
  store ptr %21, ptr %10, align 8, !tbaa !10
  %22 = load ptr, ptr %10, align 8, !tbaa !10
  %23 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %22, i32 0, i32 0
  %24 = load i8, ptr %23, align 8, !tbaa !12
  %25 = icmp ne i8 %24, 0
  br i1 %25, label %27, label %26

26:                                               ; preds = %18
  store i8 0, ptr %5, align 1
  store i32 1, ptr %14, align 4
  br label %150

27:                                               ; preds = %18
  %28 = load i32, ptr %7, align 4, !tbaa !5
  %29 = sub i32 %28, 1
  %30 = icmp uge i32 %29, 1
  br i1 %30, label %31, label %32

31:                                               ; preds = %27
  store i8 0, ptr %5, align 1
  store i32 1, ptr %14, align 4
  br label %150

32:                                               ; preds = %27
  %33 = load i32, ptr %6, align 4, !tbaa !5
  switch i32 %33, label %60 [
    i32 0, label %34
  ]

34:                                               ; preds = %32
  %35 = load ptr, ptr %10, align 8, !tbaa !10
  %36 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %35, i32 0, i32 16
  %37 = load i32, ptr %7, align 4, !tbaa !5
  %38 = sub i32 %37, 1
  %39 = zext i32 %38 to i64
  %40 = getelementptr inbounds [1 x %struct._ETHERNET_CPSW_PORT], ptr %36, i64 0, i64 %39
  store ptr %40, ptr %11, align 8, !tbaa !10
  %41 = load ptr, ptr %11, align 8, !tbaa !10
  %42 = getelementptr inbounds %struct._ETHERNET_CPSW_PORT, ptr %41, i32 0, i32 0
  %43 = load i8, ptr %42, align 4, !tbaa !14
  %44 = icmp ne i8 %43, 0
  br i1 %44, label %45, label %46

45:                                               ; preds = %34
  store i8 0, ptr %5, align 1
  store i32 1, ptr %14, align 4
  br label %150

46:                                               ; preds = %34
  %47 = load i32, ptr %7, align 4, !tbaa !5
  switch i32 %47, label %56 [
    i32 1, label %48
    i32 2, label %52
  ]

48:                                               ; preds = %46
  %49 = load i8, ptr %8, align 1, !tbaa !9
  %50 = load ptr, ptr %11, align 8, !tbaa !10
  %51 = getelementptr inbounds %struct._ETHERNET_CPSW_PORT, ptr %50, i32 0, i32 4
  store i8 %49, ptr %51, align 4, !tbaa !16
  br label %57

52:                                               ; preds = %46
  %53 = load i8, ptr %8, align 1, !tbaa !9
  %54 = load ptr, ptr %11, align 8, !tbaa !10
  %55 = getelementptr inbounds %struct._ETHERNET_CPSW_PORT, ptr %54, i32 0, i32 4
  store i8 %53, ptr %55, align 4, !tbaa !16
  br label %57

56:                                               ; preds = %46
  store i8 0, ptr %5, align 1
  store i32 1, ptr %14, align 4
  br label %150

57:                                               ; preds = %52, %48
  %58 = load ptr, ptr %11, align 8, !tbaa !10
  %59 = getelementptr inbounds %struct._ETHERNET_CPSW_PORT, ptr %58, i32 0, i32 0
  store i8 1, ptr %59, align 4, !tbaa !14
  br label %61

60:                                               ; preds = %32
  store i8 0, ptr %5, align 1
  store i32 1, ptr %14, align 4
  br label %150

61:                                               ; preds = %57
  call void @ETHERNET_HOOK_YIELD()
  %62 = load ptr, ptr %11, align 8, !tbaa !10
  %63 = getelementptr inbounds %struct._ETHERNET_CPSW_PORT, ptr %62, i32 0, i32 2
  %64 = load i32, ptr %63, align 4, !tbaa !17
  call void @CPSWSlReset(i32 noundef %64)
  %65 = load ptr, ptr %11, align 8, !tbaa !10
  %66 = getelementptr inbounds %struct._ETHERNET_CPSW_PORT, ptr %65, i32 0, i32 1
  %67 = load i32, ptr %66, align 4, !tbaa !18
  %68 = load ptr, ptr %9, align 8, !tbaa !10
  call void @CPSWPortSrcAddrSet(i32 noundef %67, ptr noundef %68)
  %69 = load ptr, ptr %11, align 8, !tbaa !10
  %70 = getelementptr inbounds %struct._ETHERNET_CPSW_PORT, ptr %69, i32 0, i32 1
  %71 = load i32, ptr %70, align 4, !tbaa !18
  %72 = load i32, ptr %7, align 4, !tbaa !5
  call void @CPSWPortVLANConfig(i32 noundef %71, i32 noundef %72, i32 noundef 0, i32 noundef 0)
  %73 = load ptr, ptr %11, align 8, !tbaa !10
  %74 = getelementptr inbounds %struct._ETHERNET_CPSW_PORT, ptr %73, i32 0, i32 5
  %75 = load i32, ptr %74, align 4, !tbaa !19
  %76 = icmp eq i32 %75, -1
  br i1 %76, label %77, label %87

77:                                               ; preds = %61
  %78 = load ptr, ptr %10, align 8, !tbaa !10
  %79 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %78, i32 0, i32 5
  %80 = load i32, ptr %79, align 4, !tbaa !20
  %81 = load ptr, ptr %11, align 8, !tbaa !10
  %82 = getelementptr inbounds %struct._ETHERNET_CPSW_PORT, ptr %81, i32 0, i32 5
  %83 = call zeroext i8 @ETHERNET_ALE_FINDFREEENTRY(i32 noundef %80, ptr noundef %82)
  %84 = icmp ne i8 %83, 0
  br i1 %84, label %86, label %85

85:                                               ; preds = %77
  store i8 0, ptr %5, align 1
  store i32 1, ptr %14, align 4
  br label %150

86:                                               ; preds = %77
  br label %87

87:                                               ; preds = %86, %61
  %88 = load i32, ptr %7, align 4, !tbaa !5
  %89 = load i32, ptr %7, align 4, !tbaa !5
  %90 = shl i32 1, %89
  %91 = or i32 1, %90
  %92 = trunc i32 %91 to i8
  %93 = load i32, ptr %7, align 4, !tbaa !5
  %94 = shl i32 1, %93
  %95 = or i32 1, %94
  %96 = trunc i32 %95 to i8
  call void @ETHERNET_ALE_MAKEVLANTABLEENTRY(ptr noundef %12, i32 noundef %88, i8 noundef zeroext %92, i8 noundef zeroext 0, i8 noundef zeroext 0, i8 noundef zeroext %96)
  %97 = load ptr, ptr %10, align 8, !tbaa !10
  %98 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %97, i32 0, i32 5
  %99 = load i32, ptr %98, align 4, !tbaa !20
  %100 = load ptr, ptr %11, align 8, !tbaa !10
  %101 = getelementptr inbounds %struct._ETHERNET_CPSW_PORT, ptr %100, i32 0, i32 5
  %102 = load i32, ptr %101, align 4, !tbaa !19
  %103 = call zeroext i8 @ETHERNET_ALE_SETTABLEENTRY(i32 noundef %99, i32 noundef %102, ptr noundef %12)
  %104 = icmp ne i8 %103, 0
  br i1 %104, label %106, label %105

105:                                              ; preds = %87
  store i8 0, ptr %5, align 1
  store i32 1, ptr %14, align 4
  br label %150

106:                                              ; preds = %87
  %107 = load ptr, ptr %11, align 8, !tbaa !10
  %108 = getelementptr inbounds %struct._ETHERNET_CPSW_PORT, ptr %107, i32 0, i32 6
  %109 = load i32, ptr %108, align 4, !tbaa !21
  %110 = icmp eq i32 %109, -1
  br i1 %110, label %111, label %121

111:                                              ; preds = %106
  %112 = load ptr, ptr %10, align 8, !tbaa !10
  %113 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %112, i32 0, i32 5
  %114 = load i32, ptr %113, align 4, !tbaa !20
  %115 = load ptr, ptr %11, align 8, !tbaa !10
  %116 = getelementptr inbounds %struct._ETHERNET_CPSW_PORT, ptr %115, i32 0, i32 6
  %117 = call zeroext i8 @ETHERNET_ALE_FINDFREEENTRY(i32 noundef %114, ptr noundef %116)
  %118 = icmp ne i8 %117, 0
  br i1 %118, label %120, label %119

119:                                              ; preds = %111
  store i8 0, ptr %5, align 1
  store i32 1, ptr %14, align 4
  br label %150

120:                                              ; preds = %111
  br label %121

121:                                              ; preds = %120, %106
  %122 = load i32, ptr %7, align 4, !tbaa !5
  %123 = load ptr, ptr %9, align 8, !tbaa !10
  call void @ETHERNET_ALE_MAKEVLANUNICASTADDRESSTABLEENTRY(ptr noundef %13, i8 noundef zeroext 0, i8 noundef zeroext 0, i8 noundef zeroext 0, i8 noundef zeroext 0, i32 noundef %122, ptr noundef %123)
  %124 = load ptr, ptr %10, align 8, !tbaa !10
  %125 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %124, i32 0, i32 5
  %126 = load i32, ptr %125, align 4, !tbaa !20
  %127 = load ptr, ptr %11, align 8, !tbaa !10
  %128 = getelementptr inbounds %struct._ETHERNET_CPSW_PORT, ptr %127, i32 0, i32 6
  %129 = load i32, ptr %128, align 4, !tbaa !21
  %130 = call zeroext i8 @ETHERNET_ALE_SETTABLEENTRY(i32 noundef %126, i32 noundef %129, ptr noundef %13)
  %131 = icmp ne i8 %130, 0
  br i1 %131, label %133, label %132

132:                                              ; preds = %121
  store i8 0, ptr %5, align 1
  store i32 1, ptr %14, align 4
  br label %150

133:                                              ; preds = %121
  call void @ETHERNET_HOOK_YIELD()
  %134 = load ptr, ptr %10, align 8, !tbaa !10
  %135 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %134, i32 0, i32 5
  %136 = load i32, ptr %135, align 4, !tbaa !20
  %137 = load i32, ptr %7, align 4, !tbaa !5
  call void @CPSWALEPortStateSet(i32 noundef %136, i32 noundef %137, i32 noundef 3)
  %138 = load ptr, ptr %10, align 8, !tbaa !10
  %139 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %138, i32 0, i32 2
  %140 = load i32, ptr %139, align 8, !tbaa !22
  %141 = call i32 @MDIOPhyAliveStatusGet(i32 noundef %140)
  %142 = load ptr, ptr %11, align 8, !tbaa !10
  %143 = getelementptr inbounds %struct._ETHERNET_CPSW_PORT, ptr %142, i32 0, i32 3
  %144 = load i32, ptr %143, align 4, !tbaa !23
  %145 = shl i32 1, %144
  %146 = and i32 %141, %145
  %147 = icmp eq i32 %146, 0
  br i1 %147, label %148, label %149

148:                                              ; preds = %133
  store i8 0, ptr %5, align 1
  store i32 1, ptr %14, align 4
  br label %150

149:                                              ; preds = %133
  store i8 1, ptr %5, align 1
  store i32 1, ptr %14, align 4
  br label %150

150:                                              ; preds = %149, %148, %132, %119, %105, %85, %60, %56, %45, %31, %26, %17
  call void @llvm.lifetime.end.p0(i64 12, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 12, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  %151 = load i8, ptr %5, align 1
  ret i8 %151
}

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

declare void @CPSWPortVLANConfig(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #2

declare i32 @MDIOPhyAliveStatusGet(i32 noundef) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!13, !7, i64 0}
!13 = !{!"_ETHERNET_CPSW_INSTANCE", !7, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !7, i64 88}
!14 = !{!15, !7, i64 0}
!15 = !{!"_ETHERNET_CPSW_PORT", !7, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !7, i64 16, !6, i64 20, !6, i64 24}
!16 = !{!15, !7, i64 16}
!17 = !{!15, !6, i64 8}
!18 = !{!15, !6, i64 4}
!19 = !{!15, !6, i64 20}
!20 = !{!13, !6, i64 20}
!21 = !{!15, !6, i64 24}
!22 = !{!13, !6, i64 8}
!23 = !{!15, !6, i64 12}


; 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._ETHERNET_CPSW_INSTANCE = type { i8, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, [1 x %struct._ETHERNET_CPSW_PORT] }
%struct._ETHERNET_CPSW_PORT = type { i8, i32, i32, i32, i8, i32, i32 }
%struct._ETHERNET_ALE_ENTRY = type { i32, i32, i32 }

@ETHERNET_CPSW_INSTANCES = external hidden global [1 x %struct._ETHERNET_CPSW_INSTANCE], align 16

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @ETHERNET_ALE_MAKEVLANUNICASTADDRESSTABLEENTRY(ptr noundef, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @ETHERNET_ALE_MAKEVLANTABLEENTRY(ptr noundef, i32 noundef, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext) local_unnamed_addr #0

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

declare void @ETHERNET_HOOK_YIELD() local_unnamed_addr #2

declare void @CPSWSlReset(i32 noundef) local_unnamed_addr #2

declare void @CPSWALEPortStateSet(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local zeroext range(i8 0, 2) i8 @ETHERNET_INITIALIZE_INSTANCE_PORT(i32 noundef %0, i32 noundef %1, i8 noundef zeroext %2, ptr noundef %3) local_unnamed_addr #0 {
  %5 = alloca %struct._ETHERNET_ALE_ENTRY, align 4
  %6 = alloca %struct._ETHERNET_ALE_ENTRY, align 4
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %5) #3
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #3
  %.not = icmp eq i32 %0, 0
  %7 = load i8, ptr @ETHERNET_CPSW_INSTANCES, align 16
  %.not40 = icmp ne i8 %7, 0
  %or.cond.not50 = select i1 %.not, i1 %.not40, i1 false
  %.not41 = icmp eq i32 %1, 1
  %or.cond47 = and i1 %.not41, %or.cond.not50
  %8 = load i8, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 88), align 8
  %.not42 = icmp eq i8 %8, 0
  %or.cond48 = select i1 %or.cond47, i1 %.not42, i1 false
  %.off = add i32 %1, -1
  %switch = icmp ult i32 %.off, 2
  %or.cond49 = and i1 %switch, %or.cond48
  br i1 %or.cond49, label %9, label %40

9:                                                ; preds = %4
  store i8 %2, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 104), align 8, !tbaa !5
  store i8 1, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 88), align 8, !tbaa !10
  tail call void @ETHERNET_HOOK_YIELD() #3
  %10 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 96), align 16, !tbaa !11
  tail call void @CPSWSlReset(i32 noundef %10) #3
  %11 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 92), align 4, !tbaa !12
  tail call void @CPSWPortSrcAddrSet(i32 noundef %11, ptr noundef %3) #3
  %12 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 92), align 4, !tbaa !12
  tail call void @CPSWPortVLANConfig(i32 noundef %12, i32 noundef 1, i32 noundef 0, i32 noundef 0) #3
  %13 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 108), align 4, !tbaa !13
  %14 = icmp eq i32 %13, -1
  br i1 %14, label %15, label %18

15:                                               ; preds = %9
  %16 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 20), align 4, !tbaa !14
  %17 = tail call zeroext i8 @ETHERNET_ALE_FINDFREEENTRY(i32 noundef %16, ptr noundef nonnull getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 108))
  %.not43 = icmp eq i8 %17, 0
  br i1 %.not43, label %40, label %18

18:                                               ; preds = %15, %9
  call void @ETHERNET_ALE_MAKEVLANTABLEENTRY(ptr noundef nonnull %5, i32 noundef 1, i8 noundef zeroext 3, i8 noundef zeroext 0, i8 noundef zeroext 0, i8 noundef zeroext 3)
  %19 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 20), align 4, !tbaa !14
  %20 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 108), align 4, !tbaa !13
  %21 = call zeroext i8 @ETHERNET_ALE_SETTABLEENTRY(i32 noundef %19, i32 noundef %20, ptr noundef nonnull %5)
  %.not44 = icmp eq i8 %21, 0
  br i1 %.not44, label %40, label %22

22:                                               ; preds = %18
  %23 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 112), align 16, !tbaa !17
  %24 = icmp eq i32 %23, -1
  br i1 %24, label %25, label %28

25:                                               ; preds = %22
  %26 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 20), align 4, !tbaa !14
  %27 = call zeroext i8 @ETHERNET_ALE_FINDFREEENTRY(i32 noundef %26, ptr noundef nonnull getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 112))
  %.not45 = icmp eq i8 %27, 0
  br i1 %.not45, label %40, label %28

28:                                               ; preds = %25, %22
  call void @ETHERNET_ALE_MAKEVLANUNICASTADDRESSTABLEENTRY(ptr noundef nonnull %6, i8 noundef zeroext 0, i8 noundef zeroext 0, i8 noundef zeroext 0, i8 noundef zeroext 0, i32 noundef 1, ptr noundef %3)
  %29 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 20), align 4, !tbaa !14
  %30 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 112), align 16, !tbaa !17
  %31 = call zeroext i8 @ETHERNET_ALE_SETTABLEENTRY(i32 noundef %29, i32 noundef %30, ptr noundef nonnull %6)
  %.not46 = icmp eq i8 %31, 0
  br i1 %.not46, label %40, label %32

32:                                               ; preds = %28
  call void @ETHERNET_HOOK_YIELD() #3
  %33 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 20), align 4, !tbaa !14
  call void @CPSWALEPortStateSet(i32 noundef %33, i32 noundef 1, i32 noundef 3) #3
  %34 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 8), align 8, !tbaa !18
  %35 = call i32 @MDIOPhyAliveStatusGet(i32 noundef %34) #3
  %36 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 100), align 4, !tbaa !19
  %37 = shl nuw i32 1, %36
  %38 = and i32 %37, %35
  %39 = icmp ne i32 %38, 0
  %. = zext i1 %39 to i8
  br label %40

40:                                               ; preds = %32, %28, %25, %18, %15, %4
  %.0 = phi i8 [ 0, %4 ], [ 0, %15 ], [ 0, %18 ], [ 0, %25 ], [ 0, %28 ], [ %., %32 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #3
  ret i8 %.0
}

declare void @CPSWPortSrcAddrSet(i32 noundef, ptr noundef) local_unnamed_addr #2

declare void @CPSWPortVLANConfig(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

declare i32 @MDIOPhyAliveStatusGet(i32 noundef) local_unnamed_addr #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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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, !7, i64 16}
!6 = !{!"_ETHERNET_CPSW_PORT", !7, i64 0, !9, i64 4, !9, i64 8, !9, i64 12, !7, i64 16, !9, i64 20, !9, i64 24}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!6, !7, i64 0}
!11 = !{!6, !9, i64 8}
!12 = !{!6, !9, i64 4}
!13 = !{!6, !9, i64 20}
!14 = !{!15, !9, i64 20}
!15 = !{!"_ETHERNET_CPSW_INSTANCE", !7, i64 0, !9, i64 4, !9, i64 8, !9, i64 12, !9, i64 16, !9, i64 20, !9, i64 24, !9, i64 28, !9, i64 32, !9, i64 36, !16, i64 40, !16, i64 48, !16, i64 56, !16, i64 64, !16, i64 72, !16, i64 80, !7, i64 88}
!16 = !{!"any pointer", !7, i64 0}
!17 = !{!6, !9, i64 24}
!18 = !{!15, !9, i64 8}
!19 = !{!6, !9, i64 12}


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