; 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_CPDMA_BUFFERDESCRIPTOR = type { ptr, i32, 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_ENTERCRITICALSECTION() #1

declare void @ETHERNET_HOOK_EXITCRITICALSECTION() #1

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

23:                                               ; preds = %5
  store i8 0, ptr %6, align 1
  store i32 1, ptr %20, align 4
  br label %220

24:                                               ; preds = %5
  %25 = load i32, ptr %7, align 4, !tbaa !5
  %26 = zext i32 %25 to i64
  %27 = getelementptr inbounds [1 x %struct._ETHERNET_CPSW_INSTANCE], ptr @ETHERNET_CPSW_INSTANCES, i64 0, i64 %26
  store ptr %27, ptr %12, align 8, !tbaa !9
  %28 = load ptr, ptr %12, align 8, !tbaa !9
  %29 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %28, i32 0, i32 0
  %30 = load i8, ptr %29, align 8, !tbaa !12
  %31 = icmp ne i8 %30, 0
  br i1 %31, label %33, label %32

32:                                               ; preds = %24
  store i8 0, ptr %6, align 1
  store i32 1, ptr %20, align 4
  br label %220

33:                                               ; preds = %24
  %34 = load i32, ptr %8, align 4, !tbaa !5
  %35 = sub i32 %34, 1
  %36 = icmp uge i32 %35, 1
  br i1 %36, label %37, label %38

37:                                               ; preds = %33
  store i8 0, ptr %6, align 1
  store i32 1, ptr %20, align 4
  br label %220

38:                                               ; preds = %33
  %39 = load ptr, ptr %12, align 8, !tbaa !9
  %40 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %39, i32 0, i32 16
  %41 = load i32, ptr %8, align 4, !tbaa !5
  %42 = sub i32 %41, 1
  %43 = zext i32 %42 to i64
  %44 = getelementptr inbounds [1 x %struct._ETHERNET_CPSW_PORT], ptr %40, i64 0, i64 %43
  store ptr %44, ptr %13, align 8, !tbaa !9
  %45 = load ptr, ptr %13, align 8, !tbaa !9
  %46 = getelementptr inbounds %struct._ETHERNET_CPSW_PORT, ptr %45, i32 0, i32 0
  %47 = load i8, ptr %46, align 4, !tbaa !14
  %48 = icmp ne i8 %47, 0
  br i1 %48, label %50, label %49

49:                                               ; preds = %38
  store i8 0, ptr %6, align 1
  store i32 1, ptr %20, align 4
  br label %220

50:                                               ; preds = %38
  %51 = load i32, ptr %10, align 4, !tbaa !5
  %52 = icmp ugt i32 %51, 1510
  br i1 %52, label %53, label %54

53:                                               ; preds = %50
  store i8 0, ptr %6, align 1
  store i32 1, ptr %20, align 4
  br label %220

54:                                               ; preds = %50
  %55 = load i32, ptr %10, align 4, !tbaa !5
  %56 = icmp ult i32 %55, 60
  br i1 %56, label %57, label %58

57:                                               ; preds = %54
  store i32 60, ptr %10, align 4, !tbaa !5
  br label %58

58:                                               ; preds = %57, %54
  %59 = load i8, ptr %11, align 1, !tbaa !11
  %60 = icmp ne i8 %59, 0
  br i1 %60, label %61, label %62

61:                                               ; preds = %58
  call void @ETHERNET_HOOK_ENTERCRITICALSECTION()
  br label %62

62:                                               ; preds = %61, %58
  %63 = load i32, ptr %7, align 4, !tbaa !5
  call void @ETHERNET_CPDMA_FREESENTPACKETS(i32 noundef %63)
  %64 = load i32, ptr %10, align 4, !tbaa !5
  %65 = load ptr, ptr %12, align 8, !tbaa !9
  %66 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %65, i32 0, i32 9
  %67 = load i32, ptr %66, align 4, !tbaa !16
  %68 = mul i32 %67, 1514
  %69 = icmp ugt i32 %64, %68
  br i1 %69, label %70, label %75

70:                                               ; preds = %62
  %71 = load i8, ptr %11, align 1, !tbaa !11
  %72 = icmp ne i8 %71, 0
  br i1 %72, label %73, label %74

73:                                               ; preds = %70
  call void @ETHERNET_HOOK_EXITCRITICALSECTION()
  br label %74

74:                                               ; preds = %73, %70
  store i8 0, ptr %6, align 1
  store i32 1, ptr %20, align 4
  br label %220

75:                                               ; preds = %62
  %76 = load ptr, ptr %12, align 8, !tbaa !9
  %77 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %76, i32 0, i32 10
  %78 = load ptr, ptr %77, align 8, !tbaa !17
  store ptr %78, ptr %14, align 8, !tbaa !9
  store ptr null, ptr %15, align 8, !tbaa !9
  %79 = load i32, ptr %8, align 4, !tbaa !5
  %80 = shl i32 %79, 16
  %81 = or i32 -1609564160, %80
  %82 = load i32, ptr %10, align 4, !tbaa !5
  %83 = and i32 %82, 2047
  %84 = or i32 %81, %83
  %85 = load ptr, ptr %14, align 8, !tbaa !9
  %86 = getelementptr inbounds %struct._ETHERNET_CPDMA_BUFFERDESCRIPTOR, ptr %85, i32 0, i32 3
  store volatile i32 %84, ptr %86, align 8, !tbaa !18
  br label %87

87:                                               ; preds = %120, %75
  %88 = load i32, ptr %10, align 4, !tbaa !5
  %89 = icmp ugt i32 %88, 0
  br i1 %89, label %90, label %132

90:                                               ; preds = %87
  %91 = load i32, ptr %10, align 4, !tbaa !5
  %92 = icmp ugt i32 %91, 1514
  br i1 %92, label %93, label %94

93:                                               ; preds = %90
  br label %96

94:                                               ; preds = %90
  %95 = load i32, ptr %10, align 4, !tbaa !5
  br label %96

96:                                               ; preds = %94, %93
  %97 = phi i32 [ 1514, %93 ], [ %95, %94 ]
  store i32 %97, ptr %18, align 4, !tbaa !5
  %98 = load ptr, ptr %14, align 8, !tbaa !9
  %99 = getelementptr inbounds %struct._ETHERNET_CPDMA_BUFFERDESCRIPTOR, ptr %98, i32 0, i32 1
  %100 = load volatile i32, ptr %99, align 8, !tbaa !20
  %101 = zext i32 %100 to i64
  %102 = inttoptr i64 %101 to ptr
  store ptr %102, ptr %17, align 8, !tbaa !9
  store i32 0, ptr %19, align 4, !tbaa !5
  br label %103

103:                                              ; preds = %117, %96
  %104 = load i32, ptr %19, align 4, !tbaa !5
  %105 = load i32, ptr %18, align 4, !tbaa !5
  %106 = icmp ult i32 %104, %105
  br i1 %106, label %107, label %120

107:                                              ; preds = %103
  %108 = load ptr, ptr %9, align 8, !tbaa !9
  %109 = load i32, ptr %19, align 4, !tbaa !5
  %110 = zext i32 %109 to i64
  %111 = getelementptr inbounds i8, ptr %108, i64 %110
  %112 = load i8, ptr %111, align 1, !tbaa !11
  %113 = load ptr, ptr %17, align 8, !tbaa !9
  %114 = load i32, ptr %19, align 4, !tbaa !5
  %115 = zext i32 %114 to i64
  %116 = getelementptr inbounds i8, ptr %113, i64 %115
  store i8 %112, ptr %116, align 1, !tbaa !11
  br label %117

117:                                              ; preds = %107
  %118 = load i32, ptr %19, align 4, !tbaa !5
  %119 = add i32 %118, 1
  store i32 %119, ptr %19, align 4, !tbaa !5
  br label %103, !llvm.loop !21

120:                                              ; preds = %103
  %121 = load ptr, ptr %12, align 8, !tbaa !9
  %122 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %121, i32 0, i32 9
  %123 = load i32, ptr %122, align 4, !tbaa !16
  %124 = add i32 %123, -1
  store i32 %124, ptr %122, align 4, !tbaa !16
  %125 = load i32, ptr %18, align 4, !tbaa !5
  %126 = load i32, ptr %10, align 4, !tbaa !5
  %127 = sub i32 %126, %125
  store i32 %127, ptr %10, align 4, !tbaa !5
  %128 = load ptr, ptr %14, align 8, !tbaa !9
  store ptr %128, ptr %15, align 8, !tbaa !9
  %129 = load ptr, ptr %14, align 8, !tbaa !9
  %130 = getelementptr inbounds %struct._ETHERNET_CPDMA_BUFFERDESCRIPTOR, ptr %129, i32 0, i32 0
  %131 = load volatile ptr, ptr %130, align 8, !tbaa !23
  store ptr %131, ptr %14, align 8, !tbaa !9
  br label %87, !llvm.loop !24

132:                                              ; preds = %87
  %133 = load ptr, ptr %15, align 8, !tbaa !9
  %134 = getelementptr inbounds %struct._ETHERNET_CPDMA_BUFFERDESCRIPTOR, ptr %133, i32 0, i32 3
  %135 = load volatile i32, ptr %134, align 8, !tbaa !18
  %136 = or i32 %135, 1073741824
  store volatile i32 %136, ptr %134, align 8, !tbaa !18
  %137 = load ptr, ptr %12, align 8, !tbaa !9
  %138 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %137, i32 0, i32 12
  %139 = load ptr, ptr %138, align 8, !tbaa !25
  %140 = icmp eq ptr %139, null
  br i1 %140, label %141, label %172

141:                                              ; preds = %132
  %142 = load ptr, ptr %12, align 8, !tbaa !9
  %143 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %142, i32 0, i32 10
  %144 = load ptr, ptr %143, align 8, !tbaa !17
  %145 = load ptr, ptr %12, align 8, !tbaa !9
  %146 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %145, i32 0, i32 12
  store ptr %144, ptr %146, align 8, !tbaa !25
  %147 = load ptr, ptr %15, align 8, !tbaa !9
  %148 = load ptr, ptr %12, align 8, !tbaa !9
  %149 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %148, i32 0, i32 13
  store ptr %147, ptr %149, align 8, !tbaa !26
  %150 = load ptr, ptr %12, align 8, !tbaa !9
  %151 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %150, i32 0, i32 13
  %152 = load ptr, ptr %151, align 8, !tbaa !26
  %153 = getelementptr inbounds %struct._ETHERNET_CPDMA_BUFFERDESCRIPTOR, ptr %152, i32 0, i32 0
  store volatile ptr null, ptr %153, align 8, !tbaa !23
  %154 = load ptr, ptr %14, align 8, !tbaa !9
  %155 = load ptr, ptr %12, align 8, !tbaa !9
  %156 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %155, i32 0, i32 10
  store ptr %154, ptr %156, align 8, !tbaa !17
  %157 = load ptr, ptr %12, align 8, !tbaa !9
  %158 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %157, i32 0, i32 10
  %159 = load ptr, ptr %158, align 8, !tbaa !17
  %160 = icmp eq ptr %159, null
  br i1 %160, label %161, label %164

161:                                              ; preds = %141
  %162 = load ptr, ptr %12, align 8, !tbaa !9
  %163 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %162, i32 0, i32 11
  store ptr null, ptr %163, align 8, !tbaa !27
  br label %164

164:                                              ; preds = %161, %141
  %165 = load ptr, ptr %12, align 8, !tbaa !9
  %166 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %165, i32 0, i32 4
  %167 = load i32, ptr %166, align 8, !tbaa !28
  %168 = load ptr, ptr %12, align 8, !tbaa !9
  %169 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %168, i32 0, i32 12
  %170 = load ptr, ptr %169, align 8, !tbaa !25
  %171 = ptrtoint ptr %170 to i32
  call void @CPSWCPDMATxHdrDescPtrWrite(i32 noundef %167, i32 noundef %171, i32 noundef 0)
  br label %215

172:                                              ; preds = %132
  %173 = load ptr, ptr %12, align 8, !tbaa !9
  %174 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %173, i32 0, i32 13
  %175 = load ptr, ptr %174, align 8, !tbaa !26
  store ptr %175, ptr %16, align 8, !tbaa !9
  %176 = load ptr, ptr %12, align 8, !tbaa !9
  %177 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %176, i32 0, i32 10
  %178 = load ptr, ptr %177, align 8, !tbaa !17
  %179 = load ptr, ptr %12, align 8, !tbaa !9
  %180 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %179, i32 0, i32 13
  %181 = load ptr, ptr %180, align 8, !tbaa !26
  %182 = getelementptr inbounds %struct._ETHERNET_CPDMA_BUFFERDESCRIPTOR, ptr %181, i32 0, i32 0
  store volatile ptr %178, ptr %182, align 8, !tbaa !23
  %183 = load ptr, ptr %15, align 8, !tbaa !9
  %184 = load ptr, ptr %12, align 8, !tbaa !9
  %185 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %184, i32 0, i32 13
  store ptr %183, ptr %185, align 8, !tbaa !26
  %186 = load ptr, ptr %12, align 8, !tbaa !9
  %187 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %186, i32 0, i32 13
  %188 = load ptr, ptr %187, align 8, !tbaa !26
  %189 = getelementptr inbounds %struct._ETHERNET_CPDMA_BUFFERDESCRIPTOR, ptr %188, i32 0, i32 0
  store volatile ptr null, ptr %189, align 8, !tbaa !23
  %190 = load ptr, ptr %14, align 8, !tbaa !9
  %191 = load ptr, ptr %12, align 8, !tbaa !9
  %192 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %191, i32 0, i32 10
  store ptr %190, ptr %192, align 8, !tbaa !17
  %193 = load ptr, ptr %12, align 8, !tbaa !9
  %194 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %193, i32 0, i32 10
  %195 = load ptr, ptr %194, align 8, !tbaa !17
  %196 = icmp eq ptr %195, null
  br i1 %196, label %197, label %200

197:                                              ; preds = %172
  %198 = load ptr, ptr %12, align 8, !tbaa !9
  %199 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %198, i32 0, i32 11
  store ptr null, ptr %199, align 8, !tbaa !27
  br label %200

200:                                              ; preds = %197, %172
  %201 = load ptr, ptr %16, align 8, !tbaa !9
  %202 = getelementptr inbounds %struct._ETHERNET_CPDMA_BUFFERDESCRIPTOR, ptr %201, i32 0, i32 3
  %203 = load volatile i32, ptr %202, align 8, !tbaa !18
  %204 = and i32 %203, 268435456
  %205 = icmp ne i32 %204, 0
  br i1 %205, label %206, label %214

206:                                              ; preds = %200
  %207 = load ptr, ptr %12, align 8, !tbaa !9
  %208 = getelementptr inbounds %struct._ETHERNET_CPSW_INSTANCE, ptr %207, i32 0, i32 4
  %209 = load i32, ptr %208, align 8, !tbaa !28
  %210 = load ptr, ptr %16, align 8, !tbaa !9
  %211 = getelementptr inbounds %struct._ETHERNET_CPDMA_BUFFERDESCRIPTOR, ptr %210, i32 0, i32 0
  %212 = load volatile ptr, ptr %211, align 8, !tbaa !23
  %213 = ptrtoint ptr %212 to i32
  call void @CPSWCPDMATxHdrDescPtrWrite(i32 noundef %209, i32 noundef %213, i32 noundef 0)
  br label %214

214:                                              ; preds = %206, %200
  br label %215

215:                                              ; preds = %214, %164
  %216 = load i8, ptr %11, align 1, !tbaa !11
  %217 = icmp ne i8 %216, 0
  br i1 %217, label %218, label %219

218:                                              ; preds = %215
  call void @ETHERNET_HOOK_EXITCRITICALSECTION()
  br label %219

219:                                              ; preds = %218, %215
  store i8 1, ptr %6, align 1
  store i32 1, ptr %20, align 4
  br label %220

220:                                              ; preds = %219, %74, %53, %49, %37, %32, %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  %221 = load i8, ptr %6, align 1
  ret i8 %221
}

; Function Attrs: nounwind uwtable
declare hidden void @ETHERNET_CPDMA_FREESENTPACKETS(i32 noundef) #2

declare void @CPSWCPDMATxHdrDescPtrWrite(i32 noundef, i32 noundef, 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 = !{!7, !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, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, 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 = !{!13, !6, i64 36}
!17 = !{!13, !10, i64 40}
!18 = !{!19, !6, i64 16}
!19 = !{!"_ETHERNET_CPDMA_BUFFERDESCRIPTOR", !10, i64 0, !6, i64 8, !6, i64 12, !6, i64 16}
!20 = !{!19, !6, i64 8}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!19, !10, i64 0}
!24 = distinct !{!24, !22}
!25 = !{!13, !10, i64 56}
!26 = !{!13, !10, i64 64}
!27 = !{!13, !10, i64 48}
!28 = !{!13, !6, i64 16}


; 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

declare void @ETHERNET_HOOK_ENTERCRITICALSECTION() local_unnamed_addr #0

declare void @ETHERNET_HOOK_EXITCRITICALSECTION() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local zeroext range(i8 0, 2) i8 @ETHERNET_SENDPACKET(i32 noundef %0, i32 noundef %1, ptr nocapture noundef readonly %2, i32 noundef %3, i8 noundef zeroext %4) local_unnamed_addr #1 {
  %6 = ptrtoint ptr %2 to i64
  %.not = icmp ne i32 %0, 0
  %7 = load i8, ptr @ETHERNET_CPSW_INSTANCES, align 16
  %.not69 = icmp eq i8 %7, 0
  %or.cond.not78.not80 = select i1 %.not, i1 true, i1 %.not69
  %.not70 = icmp ne i32 %1, 1
  %or.cond75.not79 = or i1 %.not70, %or.cond.not78.not80
  %8 = load i8, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 88), align 8
  %.not71 = icmp eq i8 %8, 0
  %or.cond76 = select i1 %or.cond75.not79, i1 true, i1 %.not71
  %9 = icmp ugt i32 %3, 1510
  %or.cond77 = or i1 %9, %or.cond76
  br i1 %or.cond77, label %83, label %10

10:                                               ; preds = %5
  %spec.store.select = tail call i32 @llvm.umax.i32(i32 %3, i32 60)
  %.not72 = icmp eq i8 %4, 0
  br i1 %.not72, label %12, label %11

11:                                               ; preds = %10
  tail call void @ETHERNET_HOOK_ENTERCRITICALSECTION() #3
  br label %12

12:                                               ; preds = %11, %10
  tail call void @ETHERNET_CPDMA_FREESENTPACKETS(i32 noundef 0)
  %13 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 36), align 4, !tbaa !5
  %14 = mul i32 %13, 1514
  %15 = icmp ugt i32 %spec.store.select, %14
  br i1 %15, label %16, label %17

16:                                               ; preds = %12
  br i1 %.not72, label %83, label %.sink.split88

17:                                               ; preds = %12
  %18 = load ptr, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 40), align 8, !tbaa !11
  %19 = or disjoint i32 %spec.store.select, -1609498624
  %20 = getelementptr inbounds i8, ptr %18, i64 16
  store volatile i32 %19, ptr %20, align 8, !tbaa !12
  br label %iter.check

iter.check:                                       ; preds = %17, %.loopexit
  %.06283 = phi i32 [ %spec.store.select, %17 ], [ %54, %.loopexit ]
  %.06382 = phi ptr [ %18, %17 ], [ %55, %.loopexit ]
  %21 = tail call i32 @llvm.umin.i32(i32 %.06283, i32 1514)
  %22 = getelementptr inbounds i8, ptr %.06382, i64 8
  %23 = load volatile i32, ptr %22, align 8, !tbaa !14
  %24 = zext i32 %23 to i64
  %25 = inttoptr i64 %24 to ptr
  %wide.trip.count = zext nneg i32 %21 to i64
  %min.iters.check = icmp ult i32 %.06283, 8
  %26 = sub i64 %24, %6
  %diff.check = icmp ult i64 %26, 32
  %or.cond = select i1 %min.iters.check, i1 true, i1 %diff.check
  br i1 %or.cond, label %vec.epilog.scalar.ph.preheader, label %vector.main.loop.iter.check

vector.main.loop.iter.check:                      ; preds = %iter.check
  %min.iters.check89 = icmp ult i32 %.06283, 32
  br i1 %min.iters.check89, label %vec.epilog.ph, label %vector.ph

vector.ph:                                        ; preds = %vector.main.loop.iter.check
  %n.vec = and i64 %wide.trip.count, 2016
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %27 = getelementptr inbounds i8, ptr %2, i64 %index
  %28 = getelementptr inbounds i8, ptr %27, i64 16
  %wide.load = load <16 x i8>, ptr %27, align 1, !tbaa !15
  %wide.load90 = load <16 x i8>, ptr %28, align 1, !tbaa !15
  %29 = getelementptr inbounds i8, ptr %25, i64 %index
  %30 = getelementptr inbounds i8, ptr %29, i64 16
  store <16 x i8> %wide.load, ptr %29, align 1, !tbaa !15
  store <16 x i8> %wide.load90, ptr %30, align 1, !tbaa !15
  %index.next = add nuw i64 %index, 32
  %31 = icmp eq i64 %index.next, %n.vec
  br i1 %31, label %middle.block, label %vector.body, !llvm.loop !16

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %.loopexit, label %vec.epilog.iter.check

vec.epilog.iter.check:                            ; preds = %middle.block
  %n.vec.remaining = and i64 %wide.trip.count, 24
  %min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0
  br i1 %min.epilog.iters.check, label %vec.epilog.scalar.ph.preheader, label %vec.epilog.ph

vec.epilog.ph:                                    ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
  %vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
  %n.vec92 = and i64 %wide.trip.count, 2040
  br label %vec.epilog.vector.body

vec.epilog.vector.body:                           ; preds = %vec.epilog.vector.body, %vec.epilog.ph
  %index93 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next95, %vec.epilog.vector.body ]
  %32 = getelementptr inbounds i8, ptr %2, i64 %index93
  %wide.load94 = load <8 x i8>, ptr %32, align 1, !tbaa !15
  %33 = getelementptr inbounds i8, ptr %25, i64 %index93
  store <8 x i8> %wide.load94, ptr %33, align 1, !tbaa !15
  %index.next95 = add nuw i64 %index93, 8
  %34 = icmp eq i64 %index.next95, %n.vec92
  br i1 %34, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !20

vec.epilog.middle.block:                          ; preds = %vec.epilog.vector.body
  %cmp.n96 = icmp eq i64 %n.vec92, %wide.trip.count
  br i1 %cmp.n96, label %.loopexit, label %vec.epilog.scalar.ph.preheader

vec.epilog.scalar.ph.preheader:                   ; preds = %vec.epilog.middle.block, %iter.check, %vec.epilog.iter.check
  %indvars.iv.ph = phi i64 [ 0, %iter.check ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec92, %vec.epilog.middle.block ]
  %xtraiter = and i64 %wide.trip.count, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %vec.epilog.scalar.ph.prol.loopexit, label %vec.epilog.scalar.ph.prol

vec.epilog.scalar.ph.prol:                        ; preds = %vec.epilog.scalar.ph.preheader, %vec.epilog.scalar.ph.prol
  %indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %vec.epilog.scalar.ph.prol ], [ %indvars.iv.ph, %vec.epilog.scalar.ph.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %vec.epilog.scalar.ph.prol ], [ 0, %vec.epilog.scalar.ph.preheader ]
  %35 = getelementptr inbounds i8, ptr %2, i64 %indvars.iv.prol
  %36 = load i8, ptr %35, align 1, !tbaa !15
  %37 = getelementptr inbounds i8, ptr %25, i64 %indvars.iv.prol
  store i8 %36, ptr %37, align 1, !tbaa !15
  %indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %vec.epilog.scalar.ph.prol.loopexit, label %vec.epilog.scalar.ph.prol, !llvm.loop !21

vec.epilog.scalar.ph.prol.loopexit:               ; preds = %vec.epilog.scalar.ph.prol, %vec.epilog.scalar.ph.preheader
  %indvars.iv.unr = phi i64 [ %indvars.iv.ph, %vec.epilog.scalar.ph.preheader ], [ %indvars.iv.next.prol, %vec.epilog.scalar.ph.prol ]
  %38 = sub nsw i64 %indvars.iv.ph, %wide.trip.count
  %39 = icmp ugt i64 %38, -4
  br i1 %39, label %.loopexit, label %vec.epilog.scalar.ph

vec.epilog.scalar.ph:                             ; preds = %vec.epilog.scalar.ph.prol.loopexit, %vec.epilog.scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next.3, %vec.epilog.scalar.ph ], [ %indvars.iv.unr, %vec.epilog.scalar.ph.prol.loopexit ]
  %40 = getelementptr inbounds i8, ptr %2, i64 %indvars.iv
  %41 = load i8, ptr %40, align 1, !tbaa !15
  %42 = getelementptr inbounds i8, ptr %25, i64 %indvars.iv
  store i8 %41, ptr %42, align 1, !tbaa !15
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %43 = getelementptr inbounds i8, ptr %2, i64 %indvars.iv.next
  %44 = load i8, ptr %43, align 1, !tbaa !15
  %45 = getelementptr inbounds i8, ptr %25, i64 %indvars.iv.next
  store i8 %44, ptr %45, align 1, !tbaa !15
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %46 = getelementptr inbounds i8, ptr %2, i64 %indvars.iv.next.1
  %47 = load i8, ptr %46, align 1, !tbaa !15
  %48 = getelementptr inbounds i8, ptr %25, i64 %indvars.iv.next.1
  store i8 %47, ptr %48, align 1, !tbaa !15
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
  %49 = getelementptr inbounds i8, ptr %2, i64 %indvars.iv.next.2
  %50 = load i8, ptr %49, align 1, !tbaa !15
  %51 = getelementptr inbounds i8, ptr %25, i64 %indvars.iv.next.2
  store i8 %50, ptr %51, align 1, !tbaa !15
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
  br i1 %exitcond.not.3, label %.loopexit, label %vec.epilog.scalar.ph, !llvm.loop !23

.loopexit:                                        ; preds = %vec.epilog.scalar.ph.prol.loopexit, %vec.epilog.scalar.ph, %vec.epilog.middle.block, %middle.block
  %52 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 36), align 4, !tbaa !5
  %53 = add i32 %52, -1
  store i32 %53, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 36), align 4, !tbaa !5
  %54 = sub i32 %.06283, %21
  %55 = load volatile ptr, ptr %.06382, align 8, !tbaa !24
  %.not73 = icmp eq i32 %54, 0
  br i1 %.not73, label %56, label %iter.check, !llvm.loop !25

56:                                               ; preds = %.loopexit
  %57 = getelementptr inbounds i8, ptr %.06382, i64 16
  %58 = load volatile i32, ptr %57, align 8, !tbaa !12
  %59 = or i32 %58, 1073741824
  store volatile i32 %59, ptr %57, align 8, !tbaa !12
  %60 = load ptr, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 56), align 8, !tbaa !26
  %61 = icmp eq ptr %60, null
  br i1 %61, label %62, label %68

62:                                               ; preds = %56
  %63 = load ptr, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 40), align 8, !tbaa !11
  store ptr %63, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 56), align 8, !tbaa !26
  store ptr %.06382, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 64), align 16, !tbaa !27
  store volatile ptr null, ptr %.06382, align 8, !tbaa !24
  store ptr %55, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 40), align 8, !tbaa !11
  %64 = icmp eq ptr %55, null
  br i1 %64, label %65, label %66

65:                                               ; preds = %62
  store ptr null, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 48), align 16, !tbaa !28
  br label %66

66:                                               ; preds = %65, %62
  %67 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 16), align 16, !tbaa !29
  br label %.sink.split

68:                                               ; preds = %56
  %69 = load ptr, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 64), align 16, !tbaa !27
  %70 = load ptr, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 40), align 8, !tbaa !11
  store volatile ptr %70, ptr %69, align 8, !tbaa !24
  store ptr %.06382, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 64), align 16, !tbaa !27
  store volatile ptr null, ptr %.06382, align 8, !tbaa !24
  store ptr %55, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 40), align 8, !tbaa !11
  %71 = icmp eq ptr %55, null
  br i1 %71, label %72, label %73

72:                                               ; preds = %68
  store ptr null, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 48), align 16, !tbaa !28
  br label %73

73:                                               ; preds = %72, %68
  %74 = getelementptr inbounds i8, ptr %69, i64 16
  %75 = load volatile i32, ptr %74, align 8, !tbaa !12
  %76 = and i32 %75, 268435456
  %.not74 = icmp eq i32 %76, 0
  br i1 %.not74, label %82, label %77

77:                                               ; preds = %73
  %78 = load i32, ptr getelementptr inbounds (i8, ptr @ETHERNET_CPSW_INSTANCES, i64 16), align 16, !tbaa !29
  %79 = load volatile ptr, ptr %69, align 8, !tbaa !24
  br label %.sink.split

.sink.split:                                      ; preds = %66, %77
  %.sink87 = phi ptr [ %79, %77 ], [ %63, %66 ]
  %.sink = phi i32 [ %78, %77 ], [ %67, %66 ]
  %80 = ptrtoint ptr %.sink87 to i64
  %81 = trunc i64 %80 to i32
  tail call void @CPSWCPDMATxHdrDescPtrWrite(i32 noundef %.sink, i32 noundef %81, i32 noundef 0) #3
  br label %82

82:                                               ; preds = %.sink.split, %73
  br i1 %.not72, label %83, label %.sink.split88

.sink.split88:                                    ; preds = %82, %16
  %.061.ph = phi i8 [ 0, %16 ], [ 1, %82 ]
  tail call void @ETHERNET_HOOK_EXITCRITICALSECTION() #3
  br label %83

83:                                               ; preds = %.sink.split88, %82, %16, %5
  %.061 = phi i8 [ 0, %5 ], [ 0, %16 ], [ 1, %82 ], [ %.061.ph, %.sink.split88 ]
  ret i8 %.061
}

; Function Attrs: nounwind uwtable
declare hidden void @ETHERNET_CPDMA_FREESENTPACKETS(i32 noundef) local_unnamed_addr #1

declare void @CPSWCPDMATxHdrDescPtrWrite(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.i32(i32, i32) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umin.i32(i32, i32) #2

attributes #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 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !9, i64 36}
!6 = !{!"_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, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !7, i64 88}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!6, !10, i64 40}
!12 = !{!13, !9, i64 16}
!13 = !{!"_ETHERNET_CPDMA_BUFFERDESCRIPTOR", !10, i64 0, !9, i64 8, !9, i64 12, !9, i64 16}
!14 = !{!13, !9, i64 8}
!15 = !{!7, !7, i64 0}
!16 = distinct !{!16, !17, !18, !19}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!"llvm.loop.isvectorized", i32 1}
!19 = !{!"llvm.loop.unroll.runtime.disable"}
!20 = distinct !{!20, !17, !18, !19}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.unroll.disable"}
!23 = distinct !{!23, !17, !18}
!24 = !{!13, !10, i64 0}
!25 = distinct !{!25, !17}
!26 = !{!6, !10, i64 56}
!27 = !{!6, !10, i64 64}
!28 = !{!6, !10, i64 48}
!29 = !{!6, !9, i64 16}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopLoadEliminationPass,LoopRotatePass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass