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

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

; 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

declare void @ETHERNET_HOOK_YIELD() #1

declare void @ETHERNET_HOOK_DELAY(i32 noundef) #1

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

19:                                               ; preds = %3
  store i8 0, ptr %4, align 1
  store i32 1, ptr %16, align 4
  br label %197

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

28:                                               ; preds = %20
  store i8 0, ptr %4, align 1
  store i32 1, ptr %16, align 4
  br label %197

29:                                               ; preds = %20
  %30 = load i32, ptr %6, align 4, !tbaa !5
  %31 = sub i32 %30, 1
  %32 = icmp uge i32 %31, 1
  br i1 %32, label %33, label %34

33:                                               ; preds = %29
  store i8 0, ptr %4, align 1
  store i32 1, ptr %16, align 4
  br label %197

34:                                               ; preds = %29
  %35 = load ptr, ptr %8, align 8, !tbaa !9
  %36 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %35, i32 0, i32 16
  %37 = load i32, ptr %6, 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 %9, align 8, !tbaa !9
  %41 = load ptr, ptr %9, align 8, !tbaa !9
  %42 = getelementptr inbounds %struct._ETHERNET_CPSW_PORT, ptr %41, i32 0, i32 0
  %43 = load i8, ptr %42, align 4, !tbaa !13
  %44 = icmp ne i8 %43, 0
  br i1 %44, label %46, label %45

45:                                               ; preds = %34
  store i8 0, ptr %4, align 1
  store i32 1, ptr %16, align 4
  br label %197

46:                                               ; preds = %34
  store i16 480, ptr %10, align 2, !tbaa !15
  %47 = load ptr, ptr %9, align 8, !tbaa !9
  %48 = getelementptr inbounds %struct._ETHERNET_CPSW_PORT, ptr %47, i32 0, i32 4
  %49 = load i8, ptr %48, align 4, !tbaa !17
  %50 = zext i8 %49 to i32
  %51 = icmp ne i32 %50, 0
  %52 = zext i1 %51 to i64
  %53 = select i1 %51, i32 1, i32 0
  %54 = trunc i32 %53 to i16
  store i16 %54, ptr %13, align 2, !tbaa !15
  %55 = load i16, ptr %13, align 2, !tbaa !15
  %56 = zext i16 %55 to i32
  %57 = icmp ne i32 %56, 0
  %58 = zext i1 %57 to i64
  %59 = select i1 %57, i32 512, i32 0
  %60 = trunc i32 %59 to i16
  store i16 %60, ptr %12, align 2, !tbaa !15
  %61 = load ptr, ptr %8, align 8, !tbaa !9
  %62 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %61, i32 0, i32 2
  %63 = load i32, ptr %62, align 8, !tbaa !18
  %64 = load ptr, ptr %9, align 8, !tbaa !9
  %65 = getelementptr inbounds %struct._ETHERNET_CPSW_PORT, ptr %64, i32 0, i32 3
  %66 = load i32, ptr %65, align 4, !tbaa !19
  %67 = call i32 @PhyAutoNegotiate(i32 noundef %63, i32 noundef %66, ptr noundef %10, ptr noundef %12)
  %68 = icmp ne i32 %67, 1
  br i1 %68, label %69, label %70

69:                                               ; preds = %46
  store i8 0, ptr %4, align 1
  store i32 1, ptr %16, align 4
  br label %197

70:                                               ; preds = %46
  %71 = load i32, ptr %7, align 4, !tbaa !5
  %72 = icmp uge i32 %71, 10
  br i1 %72, label %73, label %76

73:                                               ; preds = %70
  %74 = load i32, ptr %7, align 4, !tbaa !5
  %75 = udiv i32 %74, 10
  br label %77

76:                                               ; preds = %70
  br label %77

77:                                               ; preds = %76, %73
  %78 = phi i32 [ %75, %73 ], [ 0, %76 ]
  store i32 %78, ptr %15, align 4, !tbaa !5
  br label %79

79:                                               ; preds = %100, %77
  br label %80

80:                                               ; preds = %79
  call void @ETHERNET_HOOK_DELAY(i32 noundef 10)
  %81 = load ptr, ptr %8, align 8, !tbaa !9
  %82 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %81, i32 0, i32 2
  %83 = load i32, ptr %82, align 8, !tbaa !18
  %84 = load ptr, ptr %9, align 8, !tbaa !9
  %85 = getelementptr inbounds %struct._ETHERNET_CPSW_PORT, ptr %84, i32 0, i32 3
  %86 = load i32, ptr %85, align 4, !tbaa !19
  %87 = call i32 @PhyAutoNegStatusGet(i32 noundef %83, i32 noundef %86)
  %88 = icmp eq i32 %87, 1
  br i1 %88, label %89, label %90

89:                                               ; preds = %80
  br label %101

90:                                               ; preds = %80
  %91 = load i32, ptr %15, align 4, !tbaa !5
  %92 = icmp ugt i32 %91, 0
  br i1 %92, label %93, label %100

93:                                               ; preds = %90
  %94 = load i32, ptr %15, align 4, !tbaa !5
  %95 = add i32 %94, -1
  store i32 %95, ptr %15, align 4, !tbaa !5
  %96 = load i32, ptr %15, align 4, !tbaa !5
  %97 = icmp eq i32 %96, 0
  br i1 %97, label %98, label %99

98:                                               ; preds = %93
  store i8 0, ptr %4, align 1
  store i32 1, ptr %16, align 4
  br label %197

99:                                               ; preds = %93
  br label %100

100:                                              ; preds = %99, %90
  call void @ETHERNET_HOOK_YIELD()
  br label %79

101:                                              ; preds = %89
  %102 = load ptr, ptr %8, align 8, !tbaa !9
  %103 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %102, i32 0, i32 2
  %104 = load i32, ptr %103, align 8, !tbaa !18
  %105 = load ptr, ptr %9, align 8, !tbaa !9
  %106 = getelementptr inbounds %struct._ETHERNET_CPSW_PORT, ptr %105, i32 0, i32 3
  %107 = load i32, ptr %106, align 4, !tbaa !19
  %108 = call i32 @PhyPartnerAbilityGet(i32 noundef %104, i32 noundef %107, ptr noundef %11, ptr noundef %13)
  %109 = icmp ne i32 %108, 1
  br i1 %109, label %110, label %111

110:                                              ; preds = %101
  store i8 0, ptr %4, align 1
  store i32 1, ptr %16, align 4
  br label %197

111:                                              ; preds = %101
  %112 = load i16, ptr %13, align 2, !tbaa !15
  %113 = zext i16 %112 to i32
  %114 = and i32 %113, 2048
  %115 = icmp ne i32 %114, 0
  br i1 %115, label %116, label %117

116:                                              ; preds = %111
  store i32 128, ptr %14, align 4, !tbaa !5
  br label %158

117:                                              ; preds = %111
  %118 = load i16, ptr %10, align 2, !tbaa !15
  %119 = zext i16 %118 to i32
  %120 = load i16, ptr %11, align 2, !tbaa !15
  %121 = zext i16 %120 to i32
  %122 = and i32 %119, %121
  %123 = and i32 %122, 256
  %124 = icmp ne i32 %123, 0
  br i1 %124, label %125, label %126

125:                                              ; preds = %117
  store i32 1, ptr %14, align 4, !tbaa !5
  br label %157

126:                                              ; preds = %117
  %127 = load i16, ptr %10, align 2, !tbaa !15
  %128 = zext i16 %127 to i32
  %129 = load i16, ptr %11, align 2, !tbaa !15
  %130 = zext i16 %129 to i32
  %131 = and i32 %128, %130
  %132 = and i32 %131, 128
  %133 = icmp ne i32 %132, 0
  br i1 %133, label %134, label %135

134:                                              ; preds = %126
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %156

135:                                              ; preds = %126
  %136 = load i16, ptr %10, align 2, !tbaa !15
  %137 = zext i16 %136 to i32
  %138 = load i16, ptr %11, align 2, !tbaa !15
  %139 = zext i16 %138 to i32
  %140 = and i32 %137, %139
  %141 = and i32 %140, 64
  %142 = icmp ne i32 %141, 0
  br i1 %142, label %143, label %144

143:                                              ; preds = %135
  store i32 262145, ptr %14, align 4, !tbaa !5
  br label %155

144:                                              ; preds = %135
  %145 = load i16, ptr %10, align 2, !tbaa !15
  %146 = zext i16 %145 to i32
  %147 = load i16, ptr %11, align 2, !tbaa !15
  %148 = zext i16 %147 to i32
  %149 = and i32 %146, %148
  %150 = and i32 %149, 32
  %151 = icmp ne i32 %150, 0
  br i1 %151, label %152, label %153

152:                                              ; preds = %144
  store i32 262144, ptr %14, align 4, !tbaa !5
  br label %154

153:                                              ; preds = %144
  store i8 0, ptr %4, align 1
  store i32 1, ptr %16, align 4
  br label %197

154:                                              ; preds = %152
  br label %155

155:                                              ; preds = %154, %143
  br label %156

156:                                              ; preds = %155, %134
  br label %157

157:                                              ; preds = %156, %125
  br label %158

158:                                              ; preds = %157, %116
  %159 = load ptr, ptr %9, align 8, !tbaa !9
  %160 = getelementptr inbounds %struct._ETHERNET_CPSW_PORT, ptr %159, i32 0, i32 2
  %161 = load i32, ptr %160, align 4, !tbaa !20
  %162 = load i32, ptr %14, align 4, !tbaa !5
  call void @CPSWSlTransferModeSet(i32 noundef %161, i32 noundef %162)
  call void @ETHERNET_HOOK_YIELD()
  %163 = load i32, ptr %7, align 4, !tbaa !5
  %164 = icmp uge i32 %163, 10
  br i1 %164, label %165, label %168

165:                                              ; preds = %158
  %166 = load i32, ptr %7, align 4, !tbaa !5
  %167 = udiv i32 %166, 10
  br label %169

168:                                              ; preds = %158
  br label %169

169:                                              ; preds = %168, %165
  %170 = phi i32 [ %167, %165 ], [ 0, %168 ]
  store i32 %170, ptr %15, align 4, !tbaa !5
  br label %171

171:                                              ; preds = %192, %169
  br label %172

172:                                              ; preds = %171
  call void @ETHERNET_HOOK_DELAY(i32 noundef 10)
  %173 = load ptr, ptr %8, align 8, !tbaa !9
  %174 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %173, i32 0, i32 2
  %175 = load i32, ptr %174, align 8, !tbaa !18
  %176 = load ptr, ptr %9, align 8, !tbaa !9
  %177 = getelementptr inbounds %struct._ETHERNET_CPSW_PORT, ptr %176, i32 0, i32 3
  %178 = load i32, ptr %177, align 4, !tbaa !19
  %179 = call i32 @PhyLinkStatusGet(i32 noundef %175, i32 noundef %178, i32 noundef 1)
  %180 = icmp eq i32 %179, 1
  br i1 %180, label %181, label %182

181:                                              ; preds = %172
  br label %193

182:                                              ; preds = %172
  %183 = load i32, ptr %15, align 4, !tbaa !5
  %184 = icmp ugt i32 %183, 0
  br i1 %184, label %185, label %192

185:                                              ; preds = %182
  %186 = load i32, ptr %15, align 4, !tbaa !5
  %187 = add i32 %186, -1
  store i32 %187, ptr %15, align 4, !tbaa !5
  %188 = load i32, ptr %15, align 4, !tbaa !5
  %189 = icmp eq i32 %188, 0
  br i1 %189, label %190, label %191

190:                                              ; preds = %185
  store i8 0, ptr %4, align 1
  store i32 1, ptr %16, align 4
  br label %197

191:                                              ; preds = %185
  br label %192

192:                                              ; preds = %191, %182
  call void @ETHERNET_HOOK_YIELD()
  br label %171

193:                                              ; preds = %181
  %194 = load ptr, ptr %9, align 8, !tbaa !9
  %195 = getelementptr inbounds %struct._ETHERNET_CPSW_PORT, ptr %194, i32 0, i32 2
  %196 = load i32, ptr %195, align 4, !tbaa !20
  call void @CPSWSlRGMIIEnable(i32 noundef %196)
  store i8 1, ptr %4, align 1
  store i32 1, ptr %16, align 4
  br label %197

197:                                              ; preds = %193, %190, %153, %110, %98, %69, %45, %33, %28, %19
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %198 = load i8, ptr %4, align 1
  ret i8 %198
}

declare i32 @PhyAutoNegotiate(i32 noundef, i32 noundef, ptr noundef, ptr noundef) #1

declare i32 @PhyAutoNegStatusGet(i32 noundef, i32 noundef) #1

declare i32 @PhyPartnerAbilityGet(i32 noundef, i32 noundef, ptr noundef, ptr noundef) #1

declare void @CPSWSlTransferModeSet(i32 noundef, i32 noundef) #1

declare i32 @PhyLinkStatusGet(i32 noundef, i32 noundef, i32 noundef) #1

declare void @CPSWSlRGMIIEnable(i32 noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 #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 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !7, i64 0}
!12 = !{!"_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, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !7, i64 88}
!13 = !{!14, !7, i64 0}
!14 = !{!"_ETHERNET_CPSW_PORT", !7, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !7, i64 16, !6, i64 20, !6, i64 24}
!15 = !{!16, !16, i64 0}
!16 = !{!"short", !7, i64 0}
!17 = !{!14, !7, i64 16}
!18 = !{!12, !6, i64 8}
!19 = !{!14, !6, i64 12}
!20 = !{!14, !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._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 }

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

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

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

declare void @ETHERNET_HOOK_YIELD() local_unnamed_addr #1

declare void @ETHERNET_HOOK_DELAY(i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local zeroext range(i8 0, 2) i8 @ETHERNET_AUTONEGOTIATE_INSTANCE_PORT(i32 noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #2 {
  %4 = alloca i16, align 2
  %5 = alloca i16, align 2
  %6 = alloca i16, align 2
  %7 = alloca i16, align 2
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %4) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %5) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %6) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %7) #3
  %.not = icmp ne i32 %0, 0
  %8 = load i8, ptr @ETHERNET_CPSW_INSTANCES, align 16
  %.not37 = icmp eq i8 %8, 0
  %or.cond.not52.not54 = select i1 %.not, i1 true, i1 %.not37
  %.not38 = icmp ne i32 %1, 1
  %or.cond50.not53 = or i1 %.not38, %or.cond.not52.not54
  %9 = load i8, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 88), align 8
  %.not39 = icmp eq i8 %9, 0
  %or.cond51 = select i1 %or.cond50.not53, i1 true, i1 %.not39
  br i1 %or.cond51, label %.loopexit, label %10

10:                                               ; preds = %3
  store i16 480, ptr %4, align 2, !tbaa !5
  %11 = load i8, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 104), align 8, !tbaa !9
  %.not40 = icmp ne i8 %11, 0
  %12 = zext i1 %.not40 to i16
  store i16 %12, ptr %7, align 2, !tbaa !5
  %13 = select i1 %.not40, i16 512, i16 0
  store i16 %13, ptr %6, align 2, !tbaa !5
  %14 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 8), align 8, !tbaa !12
  %15 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 100), align 4, !tbaa !15
  %16 = call i32 @PhyAutoNegotiate(i32 noundef %14, i32 noundef %15, ptr noundef nonnull %4, ptr noundef nonnull %6) #3
  %.not41 = icmp eq i32 %16, 1
  br i1 %.not41, label %17, label %.loopexit

17:                                               ; preds = %10
  %18 = udiv i32 %2, 10
  call void @ETHERNET_HOOK_DELAY(i32 noundef 10) #3
  %19 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 8), align 8, !tbaa !12
  %20 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 100), align 4, !tbaa !15
  %21 = call i32 @PhyAutoNegStatusGet(i32 noundef %19, i32 noundef %20) #3
  %22 = icmp eq i32 %21, 1
  br i1 %22, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %17, %26
  %.056 = phi i32 [ %.1, %26 ], [ %18, %17 ]
  %.not42 = icmp eq i32 %.056, 0
  br i1 %.not42, label %26, label %23

23:                                               ; preds = %.lr.ph
  %24 = add nsw i32 %.056, -1
  %25 = icmp eq i32 %24, 0
  br i1 %25, label %.loopexit, label %26

26:                                               ; preds = %23, %.lr.ph
  %.1 = phi i32 [ %24, %23 ], [ 0, %.lr.ph ]
  call void @ETHERNET_HOOK_YIELD() #3
  call void @ETHERNET_HOOK_DELAY(i32 noundef 10) #3
  %27 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 8), align 8, !tbaa !12
  %28 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 100), align 4, !tbaa !15
  %29 = call i32 @PhyAutoNegStatusGet(i32 noundef %27, i32 noundef %28) #3
  %30 = icmp eq i32 %29, 1
  br i1 %30, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %26, %17
  %31 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 8), align 8, !tbaa !12
  %32 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 100), align 4, !tbaa !15
  %33 = call i32 @PhyPartnerAbilityGet(i32 noundef %31, i32 noundef %32, ptr noundef nonnull %5, ptr noundef nonnull %7) #3
  %.not43 = icmp eq i32 %33, 1
  br i1 %.not43, label %34, label %.loopexit

34:                                               ; preds = %._crit_edge
  %35 = load i16, ptr %7, align 2, !tbaa !5
  %36 = and i16 %35, 2048
  %.not44 = icmp eq i16 %36, 0
  br i1 %.not44, label %37, label %49

37:                                               ; preds = %34
  %38 = load i16, ptr %4, align 2, !tbaa !5
  %39 = load i16, ptr %5, align 2, !tbaa !5
  %40 = and i16 %39, %38
  %41 = zext i16 %40 to i32
  %42 = and i32 %41, 256
  %.not45 = icmp eq i32 %42, 0
  br i1 %.not45, label %43, label %49

43:                                               ; preds = %37
  %44 = and i32 %41, 128
  %.not46 = icmp eq i32 %44, 0
  br i1 %.not46, label %45, label %49

45:                                               ; preds = %43
  %46 = and i32 %41, 64
  %.not47 = icmp eq i32 %46, 0
  br i1 %.not47, label %47, label %49

47:                                               ; preds = %45
  %48 = and i32 %41, 32
  %.not48 = icmp eq i32 %48, 0
  br i1 %.not48, label %.loopexit, label %49

49:                                               ; preds = %47, %45, %43, %37, %34
  %.029 = phi i32 [ 128, %34 ], [ 1, %37 ], [ 0, %43 ], [ 262145, %45 ], [ 262144, %47 ]
  %50 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 96), align 16, !tbaa !16
  call void @CPSWSlTransferModeSet(i32 noundef %50, i32 noundef %.029) #3
  call void @ETHERNET_HOOK_YIELD() #3
  call void @ETHERNET_HOOK_DELAY(i32 noundef 10) #3
  %51 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 8), align 8, !tbaa !12
  %52 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 100), align 4, !tbaa !15
  %53 = call i32 @PhyLinkStatusGet(i32 noundef %51, i32 noundef %52, i32 noundef 1) #3
  %54 = icmp eq i32 %53, 1
  br i1 %54, label %._crit_edge60, label %.lr.ph59

.lr.ph59:                                         ; preds = %49, %58
  %.257 = phi i32 [ %.3, %58 ], [ %18, %49 ]
  %.not49 = icmp eq i32 %.257, 0
  br i1 %.not49, label %58, label %55

55:                                               ; preds = %.lr.ph59
  %56 = add nsw i32 %.257, -1
  %57 = icmp eq i32 %56, 0
  br i1 %57, label %.loopexit, label %58

58:                                               ; preds = %55, %.lr.ph59
  %.3 = phi i32 [ %56, %55 ], [ 0, %.lr.ph59 ]
  call void @ETHERNET_HOOK_YIELD() #3
  call void @ETHERNET_HOOK_DELAY(i32 noundef 10) #3
  %59 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 8), align 8, !tbaa !12
  %60 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 100), align 4, !tbaa !15
  %61 = call i32 @PhyLinkStatusGet(i32 noundef %59, i32 noundef %60, i32 noundef 1) #3
  %62 = icmp eq i32 %61, 1
  br i1 %62, label %._crit_edge60, label %.lr.ph59

._crit_edge60:                                    ; preds = %58, %49
  %63 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 96), align 16, !tbaa !16
  call void @CPSWSlRGMIIEnable(i32 noundef %63) #3
  br label %.loopexit

.loopexit:                                        ; preds = %23, %55, %47, %._crit_edge, %10, %3, %._crit_edge60
  %.030 = phi i8 [ 1, %._crit_edge60 ], [ 0, %3 ], [ 0, %10 ], [ 0, %._crit_edge ], [ 0, %47 ], [ 0, %55 ], [ 0, %23 ]
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %7) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %4) #3
  ret i8 %.030
}

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

declare i32 @PhyAutoNegStatusGet(i32 noundef, i32 noundef) local_unnamed_addr #1

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

declare void @CPSWSlTransferModeSet(i32 noundef, i32 noundef) local_unnamed_addr #1

declare i32 @PhyLinkStatusGet(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

declare void @CPSWSlRGMIIEnable(i32 noundef) local_unnamed_addr #1

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


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass