; LLVM IR from thalium/icebox :: third_party/virtualbox/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal (DhcpInput)

; 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._DHCP_SERVICE = type { i32, %struct._EFI_SERVICE_BINDING_PROTOCOL, i64, ptr, ptr, %struct._LIST_ENTRY, i64, i64, i64, i32, i32, i32, i32, ptr, ptr, ptr, i32, i32, i32, i64, ptr, ptr, ptr, %struct.EFI_MAC_ADDRESS, i8, i8, [16 x i8], ptr, %struct.EFI_DHCP4_CONFIG_DATA, i32, ptr, i32, i32, i64, i64, i32 }
%struct._EFI_SERVICE_BINDING_PROTOCOL = type { ptr, ptr }
%struct._LIST_ENTRY = type { ptr, ptr }
%struct.EFI_MAC_ADDRESS = type { [32 x i8] }
%struct.EFI_DHCP4_CONFIG_DATA = type { i32, ptr, i32, ptr, %struct.EFI_IPv4_ADDRESS, ptr, ptr, i32, ptr }
%struct.EFI_IPv4_ADDRESS = type { [4 x i8] }
%struct.NET_BUF = type { i32, i64, %struct._LIST_ENTRY, %union.NET_IP_HEAD, ptr, ptr, [64 x i8], ptr, i32, i32, [1 x %struct.NET_BLOCK_OP] }
%union.NET_IP_HEAD = type { ptr }
%struct.NET_BLOCK_OP = type { ptr, ptr, ptr, ptr, i32 }
%struct.EFI_DHCP4_PACKET = type <{ i32, i32, %struct.anon }>
%struct.anon = type <{ %struct.EFI_DHCP4_HEADER, i32, [1 x i8] }>
%struct.EFI_DHCP4_HEADER = type { i8, i8, i8, i8, i32, i16, i16, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, [16 x i8], [64 x i8], [128 x i8] }

@.str = external hidden unnamed_addr constant [151 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [26 x i8], align 1

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

declare zeroext i8 @DebugAssertEnabled() #1

declare void @DebugAssert(ptr noundef, i64 noundef, ptr noundef) #1

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

declare i32 @SwapBytes32(i32 noundef) #1

declare void @FreePool(ptr noundef) #1

declare i64 @DhcpValidateOptions(ptr noundef, ptr noundef) #1

declare ptr @AllocatePool(i64 noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @DhcpEndSession(ptr noundef, i64 noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i64 @DhcpHandleSelect(ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i64 @DhcpHandleRequest(ptr noundef, ptr noundef, ptr noundef) #2

declare i64 @CompareMem(ptr noundef, ptr noundef, i64 noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i64 @DhcpHandleRenewRebind(ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i64 @DhcpHandleReboot(ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @DhcpInput(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3) #2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i64 %2, ptr %7, align 8, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  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 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  store ptr null, ptr %11, align 8, !tbaa !5
  %16 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %16, ptr %9, align 8, !tbaa !5
  %17 = load i64, ptr %7, align 8, !tbaa !9
  %18 = icmp slt i64 %17, 0
  br i1 %18, label %19, label %20

19:                                               ; preds = %4
  store i32 1, ptr %15, align 4
  br label %196

20:                                               ; preds = %4
  %21 = load ptr, ptr %9, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct._DHCP_SERVICE, ptr %21, i32 0, i32 2
  %23 = load i64, ptr %22, align 8, !tbaa !11
  %24 = icmp eq i64 %23, 2
  br i1 %24, label %25, label %27

25:                                               ; preds = %20
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  call void @NetbufFree(ptr noundef %26)
  store i32 1, ptr %15, align 4
  br label %196

27:                                               ; preds = %20
  br label %28

28:                                               ; preds = %27
  br label %29

29:                                               ; preds = %28
  %30 = call zeroext i8 @DebugAssertEnabled()
  %31 = icmp ne i8 %30, 0
  br i1 %31, label %32, label %37

32:                                               ; preds = %29
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = icmp ne ptr %33, null
  br i1 %34, label %36, label %35

35:                                               ; preds = %32
  call void @DebugAssert(ptr noundef @.str, i64 noundef 985, ptr noundef @.str.10)
  br label %36

36:                                               ; preds = %35, %32
  br label %37

37:                                               ; preds = %36, %29
  br label %38

38:                                               ; preds = %37
  br label %39

39:                                               ; preds = %38
  %40 = load ptr, ptr %9, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct._DHCP_SERVICE, ptr %40, i32 0, i32 7
  %42 = load i64, ptr %41, align 8, !tbaa !18
  %43 = icmp eq i64 %42, 0
  br i1 %43, label %44, label %45

44:                                               ; preds = %39
  br label %179

45:                                               ; preds = %39
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.NET_BUF, ptr %46, i32 0, i32 9
  %48 = load i32, ptr %47, align 4, !tbaa !19
  %49 = zext i32 %48 to i64
  %50 = icmp ult i64 %49, 236
  br i1 %50, label %51, label %52

51:                                               ; preds = %45
  br label %179

52:                                               ; preds = %45
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.NET_BUF, ptr %53, i32 0, i32 9
  %55 = load i32, ptr %54, align 4, !tbaa !19
  %56 = zext i32 %55 to i64
  %57 = add i64 249, %56
  %58 = sub i64 %57, 236
  %59 = trunc i64 %58 to i32
  store i32 %59, ptr %14, align 4, !tbaa !21
  %60 = load i32, ptr %14, align 4, !tbaa !21
  %61 = zext i32 %60 to i64
  %62 = call ptr @AllocatePool(i64 noundef %61)
  store ptr %62, ptr %11, align 8, !tbaa !5
  %63 = load ptr, ptr %11, align 8, !tbaa !5
  %64 = icmp eq ptr %63, null
  br i1 %64, label %65, label %66

65:                                               ; preds = %52
  br label %179

66:                                               ; preds = %52
  %67 = load i32, ptr %14, align 4, !tbaa !21
  %68 = load ptr, ptr %11, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.EFI_DHCP4_PACKET, ptr %68, i32 0, i32 0
  store i32 %67, ptr %69, align 1, !tbaa !22
  %70 = load ptr, ptr %11, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.EFI_DHCP4_PACKET, ptr %70, i32 0, i32 2
  %72 = getelementptr inbounds %struct.anon, ptr %71, i32 0, i32 0
  store ptr %72, ptr %10, align 8, !tbaa !5
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.NET_BUF, ptr %74, i32 0, i32 9
  %76 = load i32, ptr %75, align 4, !tbaa !19
  %77 = load ptr, ptr %10, align 8, !tbaa !5
  %78 = call i32 @NetbufCopy(ptr noundef %73, i32 noundef 0, i32 noundef %76, ptr noundef %77)
  %79 = load ptr, ptr %11, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.EFI_DHCP4_PACKET, ptr %79, i32 0, i32 1
  store i32 %78, ptr %80, align 1, !tbaa !27
  %81 = load ptr, ptr %11, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.EFI_DHCP4_PACKET, ptr %81, i32 0, i32 1
  %83 = load i32, ptr %82, align 1, !tbaa !27
  %84 = load ptr, ptr %5, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.NET_BUF, ptr %84, i32 0, i32 9
  %86 = load i32, ptr %85, align 4, !tbaa !19
  %87 = icmp ne i32 %83, %86
  br i1 %87, label %88, label %89

88:                                               ; preds = %66
  br label %179

89:                                               ; preds = %66
  %90 = load ptr, ptr %10, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.EFI_DHCP4_HEADER, ptr %90, i32 0, i32 0
  %92 = load i8, ptr %91, align 1, !tbaa !28
  %93 = zext i8 %92 to i32
  %94 = icmp ne i32 %93, 2
  br i1 %94, label %117, label %95

95:                                               ; preds = %89
  %96 = load ptr, ptr %10, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.EFI_DHCP4_HEADER, ptr %96, i32 0, i32 4
  %98 = load i32, ptr %97, align 1, !tbaa !29
  %99 = call i32 @SwapBytes32(i32 noundef %98)
  %100 = load ptr, ptr %9, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct._DHCP_SERVICE, ptr %100, i32 0, i32 9
  %102 = load i32, ptr %101, align 8, !tbaa !30
  %103 = icmp ne i32 %99, %102
  br i1 %103, label %117, label %104

104:                                              ; preds = %95
  %105 = load ptr, ptr %9, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct._DHCP_SERVICE, ptr %105, i32 0, i32 26
  %107 = getelementptr inbounds [16 x i8], ptr %106, i64 0, i64 0
  %108 = load ptr, ptr %10, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.EFI_DHCP4_HEADER, ptr %108, i32 0, i32 11
  %110 = getelementptr inbounds [16 x i8], ptr %109, i64 0, i64 0
  %111 = load ptr, ptr %10, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.EFI_DHCP4_HEADER, ptr %111, i32 0, i32 2
  %113 = load i8, ptr %112, align 1, !tbaa !31
  %114 = zext i8 %113 to i64
  %115 = call i64 @CompareMem(ptr noundef %107, ptr noundef %110, i64 noundef %114)
  %116 = icmp ne i64 %115, 0
  br i1 %116, label %117, label %118

117:                                              ; preds = %104, %95, %89
  br label %179

118:                                              ; preds = %104
  store ptr null, ptr %12, align 8, !tbaa !5
  %119 = load ptr, ptr %11, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.EFI_DHCP4_PACKET, ptr %119, i32 0, i32 1
  %121 = load i32, ptr %120, align 1, !tbaa !27
  %122 = zext i32 %121 to i64
  %123 = icmp ugt i64 %122, 240
  br i1 %123, label %124, label %135

124:                                              ; preds = %118
  %125 = load ptr, ptr %11, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.EFI_DHCP4_PACKET, ptr %125, i32 0, i32 2
  %127 = getelementptr inbounds %struct.anon, ptr %126, i32 0, i32 1
  %128 = load i32, ptr %127, align 1, !tbaa !32
  %129 = icmp eq i32 %128, 1666417251
  br i1 %129, label %130, label %135

130:                                              ; preds = %124
  %131 = load ptr, ptr %11, align 8, !tbaa !5
  %132 = call i64 @DhcpValidateOptions(ptr noundef %131, ptr noundef %12)
  %133 = icmp slt i64 %132, 0
  br i1 %133, label %134, label %135

134:                                              ; preds = %130
  br label %179

135:                                              ; preds = %130, %124, %118
  store i64 0, ptr %13, align 8, !tbaa !9
  %136 = load ptr, ptr %9, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct._DHCP_SERVICE, ptr %136, i32 0, i32 7
  %138 = load i64, ptr %137, align 8, !tbaa !18
  switch i64 %138, label %161 [
    i64 2, label %139
    i64 3, label %144
    i64 7, label %149
    i64 1, label %149
    i64 4, label %149
    i64 5, label %151
    i64 6, label %151
    i64 8, label %156
  ]

139:                                              ; preds = %135
  %140 = load ptr, ptr %9, align 8, !tbaa !5
  %141 = load ptr, ptr %11, align 8, !tbaa !5
  %142 = load ptr, ptr %12, align 8, !tbaa !5
  %143 = call i64 @DhcpHandleSelect(ptr noundef %140, ptr noundef %141, ptr noundef %142)
  store i64 %143, ptr %13, align 8, !tbaa !9
  br label %161

144:                                              ; preds = %135
  %145 = load ptr, ptr %9, align 8, !tbaa !5
  %146 = load ptr, ptr %11, align 8, !tbaa !5
  %147 = load ptr, ptr %12, align 8, !tbaa !5
  %148 = call i64 @DhcpHandleRequest(ptr noundef %145, ptr noundef %146, ptr noundef %147)
  store i64 %148, ptr %13, align 8, !tbaa !9
  br label %161

149:                                              ; preds = %135, %135, %135
  %150 = load ptr, ptr %11, align 8, !tbaa !5
  call void @FreePool(ptr noundef %150)
  store i64 0, ptr %13, align 8, !tbaa !9
  br label %161

151:                                              ; preds = %135, %135
  %152 = load ptr, ptr %9, align 8, !tbaa !5
  %153 = load ptr, ptr %11, align 8, !tbaa !5
  %154 = load ptr, ptr %12, align 8, !tbaa !5
  %155 = call i64 @DhcpHandleRenewRebind(ptr noundef %152, ptr noundef %153, ptr noundef %154)
  store i64 %155, ptr %13, align 8, !tbaa !9
  br label %161

156:                                              ; preds = %135
  %157 = load ptr, ptr %9, align 8, !tbaa !5
  %158 = load ptr, ptr %11, align 8, !tbaa !5
  %159 = load ptr, ptr %12, align 8, !tbaa !5
  %160 = call i64 @DhcpHandleReboot(ptr noundef %157, ptr noundef %158, ptr noundef %159)
  store i64 %160, ptr %13, align 8, !tbaa !9
  br label %161

161:                                              ; preds = %156, %151, %149, %144, %139, %135
  %162 = load ptr, ptr %12, align 8, !tbaa !5
  %163 = icmp ne ptr %162, null
  br i1 %163, label %164, label %166

164:                                              ; preds = %161
  %165 = load ptr, ptr %12, align 8, !tbaa !5
  call void @FreePool(ptr noundef %165)
  br label %166

166:                                              ; preds = %164, %161
  store ptr null, ptr %11, align 8, !tbaa !5
  %167 = load i64, ptr %13, align 8, !tbaa !9
  %168 = icmp slt i64 %167, 0
  br i1 %168, label %169, label %178

169:                                              ; preds = %166
  %170 = load ptr, ptr %5, align 8, !tbaa !5
  call void @NetbufFree(ptr noundef %170)
  %171 = load ptr, ptr %9, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct._DHCP_SERVICE, ptr %171, i32 0, i32 20
  %173 = load ptr, ptr %172, align 8, !tbaa !33
  %174 = load ptr, ptr %9, align 8, !tbaa !5
  %175 = call i64 @UdpIoRecvDatagram(ptr noundef %173, ptr noundef @DhcpInput, ptr noundef %174, i32 noundef 0)
  %176 = load ptr, ptr %9, align 8, !tbaa !5
  %177 = load i64, ptr %13, align 8, !tbaa !9
  call void @DhcpEndSession(ptr noundef %176, i64 noundef %177)
  store i32 1, ptr %15, align 4
  br label %196

178:                                              ; preds = %166
  br label %179

179:                                              ; preds = %178, %134, %117, %88, %65, %51, %44
  %180 = load ptr, ptr %5, align 8, !tbaa !5
  call void @NetbufFree(ptr noundef %180)
  %181 = load ptr, ptr %11, align 8, !tbaa !5
  %182 = icmp ne ptr %181, null
  br i1 %182, label %183, label %185

183:                                              ; preds = %179
  %184 = load ptr, ptr %11, align 8, !tbaa !5
  call void @FreePool(ptr noundef %184)
  br label %185

185:                                              ; preds = %183, %179
  %186 = load ptr, ptr %9, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct._DHCP_SERVICE, ptr %186, i32 0, i32 20
  %188 = load ptr, ptr %187, align 8, !tbaa !33
  %189 = load ptr, ptr %9, align 8, !tbaa !5
  %190 = call i64 @UdpIoRecvDatagram(ptr noundef %188, ptr noundef @DhcpInput, ptr noundef %189, i32 noundef 0)
  store i64 %190, ptr %13, align 8, !tbaa !9
  %191 = load i64, ptr %13, align 8, !tbaa !9
  %192 = icmp slt i64 %191, 0
  br i1 %192, label %193, label %195

193:                                              ; preds = %185
  %194 = load ptr, ptr %9, align 8, !tbaa !5
  call void @DhcpEndSession(ptr noundef %194, i64 noundef -9223372036854775801)
  br label %195

195:                                              ; preds = %193, %185
  store i32 0, ptr %15, align 4
  br label %196

196:                                              ; preds = %195, %169, %25, %19
  call void @llvm.lifetime.end.p0(i64 4, 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
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  %197 = load i32, ptr %15, align 4
  switch i32 %197, label %199 [
    i32 0, label %198
    i32 1, label %198
  ]

198:                                              ; preds = %196, %196
  ret void

199:                                              ; preds = %196
  unreachable
}

declare void @NetbufFree(ptr noundef) #1

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

declare i64 @UdpIoRecvDatagram(ptr noundef, ptr noundef, ptr 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !10, i64 24}
!12 = !{!"_DHCP_SERVICE", !13, i64 0, !14, i64 8, !10, i64 24, !6, i64 32, !6, i64 40, !15, i64 48, !10, i64 64, !10, i64 72, !10, i64 80, !13, i64 88, !13, i64 92, !13, i64 96, !13, i64 100, !6, i64 104, !6, i64 112, !6, i64 120, !13, i64 128, !13, i64 132, !13, i64 136, !10, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !16, i64 176, !7, i64 208, !7, i64 209, !7, i64 210, !6, i64 232, !17, i64 240, !13, i64 312, !6, i64 320, !13, i64 328, !13, i64 332, !10, i64 336, !10, i64 344, !13, i64 352}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !6, i64 0, !6, i64 8}
!15 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!16 = !{!"", !7, i64 0}
!17 = !{!"", !13, i64 0, !6, i64 8, !13, i64 16, !6, i64 24, !16, i64 32, !6, i64 40, !6, i64 48, !13, i64 56, !6, i64 64}
!18 = !{!12, !10, i64 72}
!19 = !{!20, !13, i64 132}
!20 = !{!"", !13, i64 0, !10, i64 8, !15, i64 16, !7, i64 32, !6, i64 40, !6, i64 48, !7, i64 56, !6, i64 120, !13, i64 128, !13, i64 132, !7, i64 136}
!21 = !{!13, !13, i64 0}
!22 = !{!23, !13, i64 0}
!23 = !{!"", !13, i64 0, !13, i64 4, !24, i64 8}
!24 = !{!"", !25, i64 0, !13, i64 236, !7, i64 240}
!25 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !13, i64 4, !26, i64 8, !26, i64 10, !16, i64 12, !16, i64 16, !16, i64 20, !16, i64 24, !7, i64 28, !7, i64 44, !7, i64 108}
!26 = !{!"short", !7, i64 0}
!27 = !{!23, !13, i64 4}
!28 = !{!25, !7, i64 0}
!29 = !{!25, !13, i64 4}
!30 = !{!12, !13, i64 88}
!31 = !{!25, !7, i64 2}
!32 = !{!23, !13, i64 244}
!33 = !{!12, !6, i64 152}


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

@.str = external hidden unnamed_addr constant [151 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [26 x i8], align 1

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

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #1

declare void @DebugAssert(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #1

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

declare i32 @SwapBytes32(i32 noundef) local_unnamed_addr #1

declare void @FreePool(ptr noundef) local_unnamed_addr #1

declare i64 @DhcpValidateOptions(ptr noundef, ptr noundef) local_unnamed_addr #1

declare ptr @AllocatePool(i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @DhcpEndSession(ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i64 @DhcpHandleSelect(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i64 @DhcpHandleRequest(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i64 @CompareMem(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i64 @DhcpHandleRenewRebind(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i64 @DhcpHandleReboot(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @DhcpInput(ptr noundef %0, ptr nocapture readnone %1, i64 noundef %2, ptr noundef %3) #2 {
  %5 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  %6 = icmp slt i64 %2, 0
  br i1 %6, label %93, label %7

7:                                                ; preds = %4
  %8 = getelementptr inbounds i8, ptr %3, i64 24
  %9 = load i64, ptr %8, align 8, !tbaa !5
  %10 = icmp eq i64 %9, 2
  br i1 %10, label %11, label %12

11:                                               ; preds = %7
  tail call void @NetbufFree(ptr noundef %0) #3
  br label %93

12:                                               ; preds = %7
  %13 = tail call zeroext i8 @DebugAssertEnabled() #3
  %14 = icmp eq i8 %13, 0
  %15 = icmp ne ptr %0, null
  %or.cond = or i1 %15, %14
  br i1 %or.cond, label %17, label %16

16:                                               ; preds = %12
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 985, ptr noundef nonnull @.str.10) #3
  br label %17

17:                                               ; preds = %16, %12
  %18 = getelementptr inbounds i8, ptr %3, i64 72
  %19 = load i64, ptr %18, align 8, !tbaa !16
  %20 = icmp eq i64 %19, 0
  br i1 %20, label %85, label %21

21:                                               ; preds = %17
  %22 = getelementptr inbounds i8, ptr %0, i64 132
  %23 = load i32, ptr %22, align 4, !tbaa !17
  %24 = icmp ult i32 %23, 236
  br i1 %24, label %85, label %25

25:                                               ; preds = %21
  %26 = add i32 %23, 13
  %27 = zext i32 %26 to i64
  %28 = tail call ptr @AllocatePool(i64 noundef %27) #3
  %29 = icmp eq ptr %28, null
  br i1 %29, label %85, label %30

30:                                               ; preds = %25
  store i32 %26, ptr %28, align 1, !tbaa !19
  %31 = getelementptr inbounds i8, ptr %28, i64 8
  %32 = load i32, ptr %22, align 4, !tbaa !17
  %33 = tail call i32 @NetbufCopy(ptr noundef nonnull %0, i32 noundef 0, i32 noundef %32, ptr noundef nonnull %31) #3
  %34 = getelementptr inbounds i8, ptr %28, i64 4
  store i32 %33, ptr %34, align 1, !tbaa !24
  %35 = load i32, ptr %22, align 4, !tbaa !17
  %.not = icmp eq i32 %33, %35
  br i1 %.not, label %36, label %86

36:                                               ; preds = %30
  %37 = load i8, ptr %31, align 1, !tbaa !25
  %.not55 = icmp eq i8 %37, 2
  br i1 %.not55, label %38, label %86

38:                                               ; preds = %36
  %39 = getelementptr inbounds i8, ptr %28, i64 12
  %40 = load i32, ptr %39, align 1, !tbaa !26
  %41 = tail call i32 @SwapBytes32(i32 noundef %40) #3
  %42 = getelementptr inbounds i8, ptr %3, i64 88
  %43 = load i32, ptr %42, align 8, !tbaa !27
  %.not56 = icmp eq i32 %41, %43
  br i1 %.not56, label %44, label %86

44:                                               ; preds = %38
  %45 = getelementptr inbounds i8, ptr %3, i64 210
  %46 = getelementptr inbounds i8, ptr %28, i64 36
  %47 = getelementptr inbounds i8, ptr %28, i64 10
  %48 = load i8, ptr %47, align 1, !tbaa !28
  %49 = zext i8 %48 to i64
  %50 = tail call i64 @CompareMem(ptr noundef nonnull %45, ptr noundef nonnull %46, i64 noundef %49) #3
  %.not57 = icmp eq i64 %50, 0
  br i1 %.not57, label %51, label %86

51:                                               ; preds = %44
  store ptr null, ptr %5, align 8, !tbaa !29
  %52 = load i32, ptr %34, align 1, !tbaa !24
  %53 = icmp ugt i32 %52, 240
  br i1 %53, label %54, label %61

54:                                               ; preds = %51
  %55 = getelementptr inbounds i8, ptr %28, i64 244
  %56 = load i32, ptr %55, align 1, !tbaa !30
  %57 = icmp eq i32 %56, 1666417251
  br i1 %57, label %58, label %61

58:                                               ; preds = %54
  %59 = call i64 @DhcpValidateOptions(ptr noundef nonnull %28, ptr noundef nonnull %5) #3
  %60 = icmp slt i64 %59, 0
  br i1 %60, label %86, label %61

61:                                               ; preds = %58, %54, %51
  %62 = load i64, ptr %18, align 8, !tbaa !16
  switch i64 %62, label %76 [
    i64 2, label %63
    i64 3, label %66
    i64 7, label %69
    i64 1, label %69
    i64 4, label %69
    i64 5, label %70
    i64 6, label %70
    i64 8, label %73
  ]

63:                                               ; preds = %61
  %64 = load ptr, ptr %5, align 8, !tbaa !29
  %65 = call i64 @DhcpHandleSelect(ptr noundef nonnull %3, ptr noundef nonnull %28, ptr noundef %64)
  br label %76

66:                                               ; preds = %61
  %67 = load ptr, ptr %5, align 8, !tbaa !29
  %68 = call i64 @DhcpHandleRequest(ptr noundef nonnull %3, ptr noundef nonnull %28, ptr noundef %67)
  br label %76

69:                                               ; preds = %61, %61, %61
  call void @FreePool(ptr noundef nonnull %28) #3
  br label %76

70:                                               ; preds = %61, %61
  %71 = load ptr, ptr %5, align 8, !tbaa !29
  %72 = call i64 @DhcpHandleRenewRebind(ptr noundef nonnull %3, ptr noundef nonnull %28, ptr noundef %71)
  br label %76

73:                                               ; preds = %61
  %74 = load ptr, ptr %5, align 8, !tbaa !29
  %75 = call i64 @DhcpHandleReboot(ptr noundef nonnull %3, ptr noundef nonnull %28, ptr noundef %74)
  br label %76

76:                                               ; preds = %73, %70, %69, %66, %63, %61
  %.051 = phi i64 [ 0, %61 ], [ %75, %73 ], [ %72, %70 ], [ 0, %69 ], [ %68, %66 ], [ %65, %63 ]
  %77 = load ptr, ptr %5, align 8, !tbaa !29
  %.not58 = icmp eq ptr %77, null
  br i1 %.not58, label %79, label %78

78:                                               ; preds = %76
  call void @FreePool(ptr noundef nonnull %77) #3
  br label %79

79:                                               ; preds = %78, %76
  %80 = icmp slt i64 %.051, 0
  br i1 %80, label %81, label %85

81:                                               ; preds = %79
  call void @NetbufFree(ptr noundef nonnull %0) #3
  %82 = getelementptr inbounds i8, ptr %3, i64 152
  %83 = load ptr, ptr %82, align 8, !tbaa !31
  %84 = call i64 @UdpIoRecvDatagram(ptr noundef %83, ptr noundef nonnull @DhcpInput, ptr noundef nonnull %3, i32 noundef 0) #3
  call void @DhcpEndSession(ptr noundef nonnull %3, i64 noundef %.051)
  br label %93

85:                                               ; preds = %79, %25, %21, %17
  call void @NetbufFree(ptr noundef %0) #3
  br label %87

86:                                               ; preds = %30, %36, %38, %44, %58
  call void @NetbufFree(ptr noundef nonnull %0) #3
  call void @FreePool(ptr noundef nonnull %28) #3
  br label %87

87:                                               ; preds = %85, %86
  %88 = getelementptr inbounds i8, ptr %3, i64 152
  %89 = load ptr, ptr %88, align 8, !tbaa !31
  %90 = call i64 @UdpIoRecvDatagram(ptr noundef %89, ptr noundef nonnull @DhcpInput, ptr noundef nonnull %3, i32 noundef 0) #3
  %91 = icmp slt i64 %90, 0
  br i1 %91, label %92, label %93

92:                                               ; preds = %87
  call void @DhcpEndSession(ptr noundef nonnull %3, i64 noundef -9223372036854775801)
  br label %93

93:                                               ; preds = %87, %92, %4, %81, %11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  ret void
}

declare void @NetbufFree(ptr noundef) local_unnamed_addr #1

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

declare i64 @UdpIoRecvDatagram(ptr noundef, ptr noundef, ptr noundef, 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, !12, i64 24}
!6 = !{!"_DHCP_SERVICE", !7, i64 0, !10, i64 8, !12, i64 24, !11, i64 32, !11, i64 40, !13, i64 48, !12, i64 64, !12, i64 72, !12, i64 80, !7, i64 88, !7, i64 92, !7, i64 96, !7, i64 100, !11, i64 104, !11, i64 112, !11, i64 120, !7, i64 128, !7, i64 132, !7, i64 136, !12, i64 144, !11, i64 152, !11, i64 160, !11, i64 168, !14, i64 176, !8, i64 208, !8, i64 209, !8, i64 210, !11, i64 232, !15, i64 240, !7, i64 312, !11, i64 320, !7, i64 328, !7, i64 332, !12, i64 336, !12, i64 344, !7, i64 352}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !11, i64 0, !11, i64 8}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"long long", !8, i64 0}
!13 = !{!"_LIST_ENTRY", !11, i64 0, !11, i64 8}
!14 = !{!"", !8, i64 0}
!15 = !{!"", !7, i64 0, !11, i64 8, !7, i64 16, !11, i64 24, !14, i64 32, !11, i64 40, !11, i64 48, !7, i64 56, !11, i64 64}
!16 = !{!6, !12, i64 72}
!17 = !{!18, !7, i64 132}
!18 = !{!"", !7, i64 0, !12, i64 8, !13, i64 16, !8, i64 32, !11, i64 40, !11, i64 48, !8, i64 56, !11, i64 120, !7, i64 128, !7, i64 132, !8, i64 136}
!19 = !{!20, !7, i64 0}
!20 = !{!"", !7, i64 0, !7, i64 4, !21, i64 8}
!21 = !{!"", !22, i64 0, !7, i64 236, !8, i64 240}
!22 = !{!"", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3, !7, i64 4, !23, i64 8, !23, i64 10, !14, i64 12, !14, i64 16, !14, i64 20, !14, i64 24, !8, i64 28, !8, i64 44, !8, i64 108}
!23 = !{!"short", !8, i64 0}
!24 = !{!20, !7, i64 4}
!25 = !{!22, !8, i64 0}
!26 = !{!22, !7, i64 4}
!27 = !{!6, !7, i64 88}
!28 = !{!22, !8, i64 2}
!29 = !{!11, !11, i64 0}
!30 = !{!20, !7, i64 244}
!31 = !{!6, !11, i64 152}


; Effective O3 passes: CorrelatedValuePropagationPass,DeadArgumentEliminationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass