; LLVM IR from thalium/icebox :: third_party/virtualbox/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe (Ip6ConfigParseDhcpReply)

; 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._EFI_DHCP6_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.EFI_DHCP6_PACKET_OPTION = type <{ i16, i16, [1 x i8] }>
%struct.EFI_IPv6_ADDRESS = type { [16 x i8] }
%struct._IP6_CONFIG_INSTANCE = type { i32, i8, %struct._LIST_ENTRY, i16, %struct.EFI_IP6_CONFIG_INTERFACE_INFO, %struct.EFI_IP6_CONFIG_INTERFACE_ID, i32, %struct.EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS, [7 x %struct.IP6_CONFIG_DATA_ITEM], %struct.NET_MAP, %struct.NET_MAP, %struct._EFI_IP6_CONFIG_PROTOCOL, ptr, ptr, ptr, ptr, i8, i32, ptr, i32, ptr, i32, %struct._IP6_FORM_CALLBACK_INFO, %struct.IP6_CONFIG_NVDATA }
%struct._LIST_ENTRY = type { ptr, ptr }
%struct.EFI_IP6_CONFIG_INTERFACE_INFO = type { [32 x i16], i8, i32, %struct.EFI_MAC_ADDRESS, i32, ptr, i32, ptr }
%struct.EFI_MAC_ADDRESS = type { [32 x i8] }
%struct.EFI_IP6_CONFIG_INTERFACE_ID = type { [8 x i8] }
%struct.EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS = type { i32 }
%struct.IP6_CONFIG_DATA_ITEM = type { ptr, ptr, i64, i8, %struct.NET_MAP, %union.IP6_CONFIG_DATA, i64 }
%union.IP6_CONFIG_DATA = type { ptr }
%struct.NET_MAP = type { %struct._LIST_ENTRY, %struct._LIST_ENTRY, i64 }
%struct._EFI_IP6_CONFIG_PROTOCOL = type { ptr, ptr, ptr, ptr }
%struct._IP6_FORM_CALLBACK_INFO = type { i32, ptr, %struct._EFI_HII_CONFIG_ACCESS_PROTOCOL, ptr, ptr }
%struct._EFI_HII_CONFIG_ACCESS_PROTOCOL = type { ptr, ptr, ptr }
%struct.IP6_CONFIG_NVDATA = type { i32, %struct.EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS, %struct.EFI_IP6_CONFIG_INTERFACE_ID, %struct._LIST_ENTRY, i32, %struct._LIST_ENTRY, i32, %struct._LIST_ENTRY, i32 }

@.str = external hidden unnamed_addr constant [135 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [31 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 zeroext i16 @SwapBytes16(i16 noundef zeroext) #1

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

declare ptr @AllocatePool(i64 noundef) #1

declare void @FreePool(ptr noundef) #1

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

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

declare zeroext i8 @NetIp6IsValidUnicast(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i64 @Ip6ConfigParseDhcpReply(ptr noundef %0, ptr noundef %1, ptr noundef %2) #2 {
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i16, align 2
  %12 = alloca i16, align 2
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, 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 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
  store i32 0, ptr %9, align 4, !tbaa !9
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct._EFI_DHCP6_PROTOCOL, ptr %18, i32 0, i32 8
  %20 = load ptr, ptr %19, align 8, !tbaa !11
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  %23 = call i64 %20(ptr noundef %21, ptr noundef %22, ptr noundef %9, ptr noundef null)
  store i64 %23, ptr %8, align 8, !tbaa !13
  %24 = load i64, ptr %8, align 8, !tbaa !13
  %25 = icmp ne i64 %24, -9223372036854775803
  br i1 %25, label %26, label %27

26:                                               ; preds = %3
  store i64 -9223372036854775802, ptr %4, align 8
  store i32 1, ptr %17, align 4
  br label %174

27:                                               ; preds = %3
  %28 = load i32, ptr %9, align 4, !tbaa !9
  %29 = zext i32 %28 to i64
  %30 = mul i64 %29, 8
  %31 = call ptr @AllocatePool(i64 noundef %30)
  store ptr %31, ptr %10, align 8, !tbaa !5
  %32 = load ptr, ptr %10, align 8, !tbaa !5
  %33 = icmp eq ptr %32, null
  br i1 %33, label %34, label %35

34:                                               ; preds = %27
  store i64 -9223372036854775802, ptr %4, align 8
  store i32 1, ptr %17, align 4
  br label %174

35:                                               ; preds = %27
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct._EFI_DHCP6_PROTOCOL, ptr %36, i32 0, i32 8
  %38 = load ptr, ptr %37, align 8, !tbaa !11
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = load ptr, ptr %7, align 8, !tbaa !5
  %41 = load ptr, ptr %10, align 8, !tbaa !5
  %42 = call i64 %38(ptr noundef %39, ptr noundef %40, ptr noundef %9, ptr noundef %41)
  store i64 %42, ptr %8, align 8, !tbaa !13
  %43 = load i64, ptr %8, align 8, !tbaa !13
  %44 = icmp slt i64 %43, 0
  br i1 %44, label %45, label %46

45:                                               ; preds = %35
  store i64 -9223372036854775802, ptr %8, align 8, !tbaa !13
  br label %171

46:                                               ; preds = %35
  store i64 0, ptr %8, align 8, !tbaa !13
  store i64 0, ptr %13, align 8, !tbaa !13
  br label %47

47:                                               ; preds = %167, %46
  %48 = load i64, ptr %13, align 8, !tbaa !13
  %49 = load i32, ptr %9, align 4, !tbaa !9
  %50 = zext i32 %49 to i64
  %51 = icmp ult i64 %48, %50
  br i1 %51, label %52, label %170

52:                                               ; preds = %47
  %53 = load ptr, ptr %10, align 8, !tbaa !5
  %54 = load i64, ptr %13, align 8, !tbaa !13
  %55 = getelementptr inbounds ptr, ptr %53, i64 %54
  %56 = load ptr, ptr %55, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.EFI_DHCP6_PACKET_OPTION, ptr %56, i32 0, i32 0
  %58 = call ptr @CopyMem(ptr noundef %11, ptr noundef %57, i64 noundef 2)
  %59 = load i16, ptr %11, align 2, !tbaa !15
  %60 = call zeroext i16 @SwapBytes16(i16 noundef zeroext %59)
  store i16 %60, ptr %11, align 2, !tbaa !15
  %61 = load i16, ptr %11, align 2, !tbaa !15
  %62 = zext i16 %61 to i32
  %63 = icmp eq i32 %62, 23
  br i1 %63, label %64, label %166

64:                                               ; preds = %52
  %65 = load ptr, ptr %10, align 8, !tbaa !5
  %66 = load i64, ptr %13, align 8, !tbaa !13
  %67 = getelementptr inbounds ptr, ptr %65, i64 %66
  %68 = load ptr, ptr %67, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.EFI_DHCP6_PACKET_OPTION, ptr %68, i32 0, i32 1
  %70 = call ptr @CopyMem(ptr noundef %12, ptr noundef %69, i64 noundef 2)
  %71 = load i16, ptr %12, align 2, !tbaa !15
  %72 = call zeroext i16 @SwapBytes16(i16 noundef zeroext %71)
  store i16 %72, ptr %12, align 2, !tbaa !15
  %73 = load i16, ptr %12, align 2, !tbaa !15
  %74 = zext i16 %73 to i32
  %75 = icmp eq i32 %74, 0
  br i1 %75, label %81, label %76

76:                                               ; preds = %64
  %77 = load i16, ptr %12, align 2, !tbaa !15
  %78 = zext i16 %77 to i64
  %79 = urem i64 %78, 16
  %80 = icmp ne i64 %79, 0
  br i1 %80, label %81, label %82

81:                                               ; preds = %76, %64
  store i64 -9223372036854775802, ptr %8, align 8, !tbaa !13
  br label %170

82:                                               ; preds = %76
  %83 = load ptr, ptr %10, align 8, !tbaa !5
  %84 = load i64, ptr %13, align 8, !tbaa !13
  %85 = getelementptr inbounds ptr, ptr %83, i64 %84
  %86 = load ptr, ptr %85, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.EFI_DHCP6_PACKET_OPTION, ptr %86, i32 0, i32 2
  %88 = getelementptr inbounds [1 x i8], ptr %87, i64 0, i64 0
  store ptr %88, ptr %15, align 8, !tbaa !5
  store i64 0, ptr %14, align 8, !tbaa !13
  br label %89

89:                                               ; preds = %103, %82
  %90 = load i64, ptr %14, align 8, !tbaa !13
  %91 = load i16, ptr %12, align 2, !tbaa !15
  %92 = zext i16 %91 to i64
  %93 = udiv i64 %92, 16
  %94 = icmp ult i64 %90, %93
  br i1 %94, label %95, label %106

95:                                               ; preds = %89
  %96 = load ptr, ptr %15, align 8, !tbaa !5
  %97 = call zeroext i8 @NetIp6IsValidUnicast(ptr noundef %96)
  %98 = icmp ne i8 %97, 0
  br i1 %98, label %100, label %99

99:                                               ; preds = %95
  store i64 -9223372036854775802, ptr %8, align 8, !tbaa !13
  br label %171

100:                                              ; preds = %95
  %101 = load ptr, ptr %15, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.EFI_IPv6_ADDRESS, ptr %101, i32 1
  store ptr %102, ptr %15, align 8, !tbaa !5
  br label %103

103:                                              ; preds = %100
  %104 = load i64, ptr %14, align 8, !tbaa !13
  %105 = add i64 %104, 1
  store i64 %105, ptr %14, align 8, !tbaa !13
  br label %89, !llvm.loop !17

106:                                              ; preds = %89
  %107 = load ptr, ptr %6, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct._IP6_CONFIG_INSTANCE, ptr %107, i32 0, i32 8
  %109 = getelementptr inbounds [7 x %struct.IP6_CONFIG_DATA_ITEM], ptr %108, i64 0, i64 6
  store ptr %109, ptr %16, align 8, !tbaa !5
  %110 = load ptr, ptr %16, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.IP6_CONFIG_DATA_ITEM, ptr %110, i32 0, i32 6
  %112 = load i64, ptr %111, align 8, !tbaa !19
  %113 = load i16, ptr %12, align 2, !tbaa !15
  %114 = zext i16 %113 to i64
  %115 = icmp ne i64 %112, %114
  br i1 %115, label %116, label %144

116:                                              ; preds = %106
  %117 = load ptr, ptr %16, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.IP6_CONFIG_DATA_ITEM, ptr %117, i32 0, i32 5
  %119 = load ptr, ptr %118, align 8, !tbaa !23
  %120 = icmp ne ptr %119, null
  br i1 %120, label %121, label %125

121:                                              ; preds = %116
  %122 = load ptr, ptr %16, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.IP6_CONFIG_DATA_ITEM, ptr %122, i32 0, i32 5
  %124 = load ptr, ptr %123, align 8, !tbaa !23
  call void @FreePool(ptr noundef %124)
  br label %125

125:                                              ; preds = %121, %116
  %126 = load i16, ptr %12, align 2, !tbaa !15
  %127 = zext i16 %126 to i64
  %128 = call ptr @AllocatePool(i64 noundef %127)
  %129 = load ptr, ptr %16, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.IP6_CONFIG_DATA_ITEM, ptr %129, i32 0, i32 5
  store ptr %128, ptr %130, align 8, !tbaa !23
  br label %131

131:                                              ; preds = %125
  %132 = call zeroext i8 @DebugAssertEnabled()
  %133 = icmp ne i8 %132, 0
  br i1 %133, label %134, label %141

134:                                              ; preds = %131
  %135 = load ptr, ptr %16, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.IP6_CONFIG_DATA_ITEM, ptr %135, i32 0, i32 5
  %137 = load ptr, ptr %136, align 8, !tbaa !23
  %138 = icmp ne ptr %137, null
  br i1 %138, label %140, label %139

139:                                              ; preds = %134
  call void @DebugAssert(ptr noundef @.str, i64 noundef 1527, ptr noundef @.str.10)
  br label %140

140:                                              ; preds = %139, %134
  br label %141

141:                                              ; preds = %140, %131
  br label %142

142:                                              ; preds = %141
  br label %143

143:                                              ; preds = %142
  br label %144

144:                                              ; preds = %143, %106
  %145 = load ptr, ptr %16, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.IP6_CONFIG_DATA_ITEM, ptr %145, i32 0, i32 5
  %147 = load ptr, ptr %146, align 8, !tbaa !23
  %148 = load ptr, ptr %10, align 8, !tbaa !5
  %149 = load i64, ptr %13, align 8, !tbaa !13
  %150 = getelementptr inbounds ptr, ptr %148, i64 %149
  %151 = load ptr, ptr %150, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.EFI_DHCP6_PACKET_OPTION, ptr %151, i32 0, i32 2
  %153 = getelementptr inbounds [1 x i8], ptr %152, i64 0, i64 0
  %154 = load i16, ptr %12, align 2, !tbaa !15
  %155 = zext i16 %154 to i64
  %156 = call ptr @CopyMem(ptr noundef %147, ptr noundef %153, i64 noundef %155)
  %157 = load i16, ptr %12, align 2, !tbaa !15
  %158 = zext i16 %157 to i64
  %159 = load ptr, ptr %16, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.IP6_CONFIG_DATA_ITEM, ptr %159, i32 0, i32 6
  store i64 %158, ptr %160, align 8, !tbaa !19
  %161 = load ptr, ptr %16, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.IP6_CONFIG_DATA_ITEM, ptr %161, i32 0, i32 2
  store i64 0, ptr %162, align 8, !tbaa !24
  %163 = load ptr, ptr %16, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.IP6_CONFIG_DATA_ITEM, ptr %163, i32 0, i32 4
  %165 = call i64 @NetMapIterate(ptr noundef %164, ptr noundef @Ip6ConfigSignalEvent, ptr noundef null)
  br label %170

166:                                              ; preds = %52
  br label %167

167:                                              ; preds = %166
  %168 = load i64, ptr %13, align 8, !tbaa !13
  %169 = add i64 %168, 1
  store i64 %169, ptr %13, align 8, !tbaa !13
  br label %47, !llvm.loop !25

170:                                              ; preds = %144, %81, %47
  br label %171

171:                                              ; preds = %170, %99, %45
  %172 = load ptr, ptr %10, align 8, !tbaa !5
  call void @FreePool(ptr noundef %172)
  %173 = load i64, ptr %8, align 8, !tbaa !13
  store i64 %173, ptr %4, align 8
  store i32 1, ptr %17, align 4
  br label %174

174:                                              ; preds = %171, %34, %26
  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 2, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %175 = load i64, ptr %4, align 8
  ret i64 %175
}

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 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 64}
!12 = !{!"_EFI_DHCP6_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64}
!13 = !{!14, !14, i64 0}
!14 = !{!"long long", !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"short", !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!20, !14, i64 80}
!20 = !{!"", !6, i64 0, !6, i64 8, !14, i64 16, !7, i64 24, !21, i64 32, !7, i64 72, !14, i64 80}
!21 = !{!"", !22, i64 0, !22, i64 16, !14, i64 32}
!22 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!23 = !{!7, !7, i64 0}
!24 = !{!20, !14, i64 16}
!25 = distinct !{!25, !18}


; 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 [135 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [31 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 zeroext i16 @SwapBytes16(i16 noundef zeroext) local_unnamed_addr #1

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

declare ptr @AllocatePool(i64 noundef) local_unnamed_addr #1

declare void @FreePool(ptr noundef) local_unnamed_addr #1

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

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

declare zeroext i8 @NetIp6IsValidUnicast(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i64 -9223372036854775802, 1) i64 @Ip6ConfigParseDhcpReply(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #2 {
  %4 = alloca i32, align 4
  %5 = alloca i16, align 2
  %6 = alloca i16, align 2
  call void @llvm.lifetime.start.p0(i64 4, 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
  store i32 0, ptr %4, align 4, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 64
  %8 = load ptr, ptr %7, align 8, !tbaa !9
  %9 = call i64 %8(ptr noundef %0, ptr noundef %2, ptr noundef nonnull %4, ptr noundef null) #3
  %.not = icmp eq i64 %9, -9223372036854775803
  br i1 %.not, label %10, label %81

10:                                               ; preds = %3
  %11 = load i32, ptr %4, align 4, !tbaa !5
  %12 = zext i32 %11 to i64
  %13 = shl nuw nsw i64 %12, 3
  %14 = call ptr @AllocatePool(i64 noundef %13) #3
  %15 = icmp eq ptr %14, null
  br i1 %15, label %81, label %16

16:                                               ; preds = %10
  %17 = load ptr, ptr %7, align 8, !tbaa !9
  %18 = call i64 %17(ptr noundef nonnull %0, ptr noundef %2, ptr noundef nonnull %4, ptr noundef nonnull %14) #3
  %19 = icmp slt i64 %18, 0
  br i1 %19, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %16
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %.not55 = icmp eq i32 %20, 0
  br i1 %.not55, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %76
  %.03851 = phi i64 [ %77, %76 ], [ 0, %.preheader ]
  %21 = getelementptr inbounds ptr, ptr %14, i64 %.03851
  %22 = load ptr, ptr %21, align 8, !tbaa !12
  %23 = call ptr @CopyMem(ptr noundef nonnull %5, ptr noundef %22, i64 noundef 2) #3
  %24 = load i16, ptr %5, align 2, !tbaa !13
  %25 = call zeroext i16 @SwapBytes16(i16 noundef zeroext %24) #3
  store i16 %25, ptr %5, align 2, !tbaa !13
  %26 = icmp eq i16 %25, 23
  br i1 %26, label %27, label %76

27:                                               ; preds = %.lr.ph
  %28 = getelementptr inbounds ptr, ptr %14, i64 %.03851
  %29 = load ptr, ptr %28, align 8, !tbaa !12
  %30 = getelementptr inbounds i8, ptr %29, i64 2
  %31 = call ptr @CopyMem(ptr noundef nonnull %6, ptr noundef nonnull %30, i64 noundef 2) #3
  %32 = load i16, ptr %6, align 2, !tbaa !13
  %33 = call zeroext i16 @SwapBytes16(i16 noundef zeroext %32) #3
  store i16 %33, ptr %6, align 2, !tbaa !13
  %34 = icmp ne i16 %33, 0
  %35 = and i16 %33, 15
  %.not42 = icmp eq i16 %35, 0
  %or.cond = and i1 %34, %.not42
  br i1 %or.cond, label %36, label %.loopexit

36:                                               ; preds = %27
  %37 = zext nneg i16 %33 to i64
  %.not56 = icmp ult i16 %33, 16
  br i1 %.not56, label %._crit_edge, label %.lr.ph54.preheader

.lr.ph54.preheader:                               ; preds = %36
  %38 = load ptr, ptr %28, align 8, !tbaa !12
  %39 = getelementptr inbounds i8, ptr %38, i64 4
  br label %.lr.ph54

.lr.ph54:                                         ; preds = %.lr.ph54.preheader, %41
  %.03653 = phi ptr [ %42, %41 ], [ %39, %.lr.ph54.preheader ]
  %.03752 = phi i64 [ %43, %41 ], [ 0, %.lr.ph54.preheader ]
  %40 = call zeroext i8 @NetIp6IsValidUnicast(ptr noundef nonnull %.03653) #3
  %.not47 = icmp eq i8 %40, 0
  br i1 %.not47, label %.loopexit, label %41

41:                                               ; preds = %.lr.ph54
  %42 = getelementptr inbounds i8, ptr %.03653, i64 16
  %43 = add nuw nsw i64 %.03752, 1
  %44 = load i16, ptr %6, align 2, !tbaa !13
  %45 = zext i16 %44 to i64
  %46 = lshr i64 %45, 4
  %47 = icmp ult i64 %43, %46
  br i1 %47, label %.lr.ph54, label %._crit_edge, !llvm.loop !15

._crit_edge:                                      ; preds = %41, %36
  %48 = phi i16 [ %33, %36 ], [ %44, %41 ]
  %.lcssa = phi i64 [ %37, %36 ], [ %45, %41 ]
  %49 = getelementptr inbounds i8, ptr %1, i64 792
  %50 = load i64, ptr %49, align 8, !tbaa !17
  %.not43 = icmp eq i64 %50, %.lcssa
  br i1 %.not43, label %63, label %51

51:                                               ; preds = %._crit_edge
  %52 = getelementptr inbounds i8, ptr %1, i64 784
  %53 = load ptr, ptr %52, align 8, !tbaa !22
  %.not44 = icmp eq ptr %53, null
  br i1 %.not44, label %55, label %54

54:                                               ; preds = %51
  call void @FreePool(ptr noundef nonnull %53) #3
  %.pre = load i16, ptr %6, align 2, !tbaa !13
  br label %55

55:                                               ; preds = %54, %51
  %56 = phi i16 [ %.pre, %54 ], [ %48, %51 ]
  %57 = zext i16 %56 to i64
  %58 = call ptr @AllocatePool(i64 noundef %57) #3
  store ptr %58, ptr %52, align 8, !tbaa !22
  %59 = call zeroext i8 @DebugAssertEnabled() #3
  %.not45 = icmp eq i8 %59, 0
  br i1 %.not45, label %63, label %60

60:                                               ; preds = %55
  %61 = load ptr, ptr %52, align 8, !tbaa !22
  %.not46 = icmp eq ptr %61, null
  br i1 %.not46, label %62, label %63

62:                                               ; preds = %60
  call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 1527, ptr noundef nonnull @.str.10) #3
  br label %63

63:                                               ; preds = %55, %62, %60, %._crit_edge
  %64 = getelementptr inbounds i8, ptr %1, i64 784
  %65 = load ptr, ptr %64, align 8, !tbaa !22
  %66 = load ptr, ptr %28, align 8, !tbaa !12
  %67 = getelementptr inbounds i8, ptr %66, i64 4
  %68 = load i16, ptr %6, align 2, !tbaa !13
  %69 = zext i16 %68 to i64
  %70 = call ptr @CopyMem(ptr noundef %65, ptr noundef nonnull %67, i64 noundef %69) #3
  %71 = load i16, ptr %6, align 2, !tbaa !13
  %72 = zext i16 %71 to i64
  store i64 %72, ptr %49, align 8, !tbaa !17
  %73 = getelementptr inbounds i8, ptr %1, i64 728
  store i64 0, ptr %73, align 8, !tbaa !23
  %74 = getelementptr inbounds i8, ptr %1, i64 744
  %75 = call i64 @NetMapIterate(ptr noundef nonnull %74, ptr noundef nonnull @Ip6ConfigSignalEvent, ptr noundef null) #3
  br label %.loopexit

76:                                               ; preds = %.lr.ph
  %77 = add nuw nsw i64 %.03851, 1
  %78 = load i32, ptr %4, align 4, !tbaa !5
  %79 = zext i32 %78 to i64
  %80 = icmp ult i64 %77, %79
  br i1 %80, label %.lr.ph, label %.loopexit, !llvm.loop !24

.loopexit:                                        ; preds = %76, %.lr.ph54, %.preheader, %27, %16, %63
  %.039 = phi i64 [ 0, %63 ], [ -9223372036854775802, %16 ], [ -9223372036854775802, %27 ], [ 0, %.preheader ], [ -9223372036854775802, %.lr.ph54 ], [ 0, %76 ]
  call void @FreePool(ptr noundef nonnull %14) #3
  br label %81

81:                                               ; preds = %10, %3, %.loopexit
  %.0 = phi i64 [ %.039, %.loopexit ], [ -9223372036854775802, %3 ], [ -9223372036854775802, %10 ]
  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 4, ptr nonnull %4) #3
  ret i64 %.0
}

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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 64}
!10 = !{!"_EFI_DHCP6_PROTOCOL", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"short", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!18, !19, i64 80}
!18 = !{!"", !11, i64 0, !11, i64 8, !19, i64 16, !7, i64 24, !20, i64 32, !7, i64 72, !19, i64 80}
!19 = !{!"long long", !7, i64 0}
!20 = !{!"", !21, i64 0, !21, i64 16, !19, i64 32}
!21 = !{!"_LIST_ENTRY", !11, i64 0, !11, i64 8}
!22 = !{!7, !7, i64 0}
!23 = !{!18, !19, i64 16}
!24 = distinct !{!24, !16}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass